GitHub Action
commited on
Commit
·
b29b26f
1
Parent(s):
836782a
Sync from GitHub: ee3547b8e59b6326e9402c72f0721f378c1b1d61
Browse files- .gitattributes +6 -0
- frontend/src/routes/+layout.svelte +77 -12
- frontend/src/routes/+page.svelte +36 -22
- hfstudio/server.py +66 -7
- hfstudio/static/_app/immutable/assets/0.BuN4nQsJ.css +1 -0
- hfstudio/static/_app/immutable/chunks/CB1vOLR2.js +3 -0
- hfstudio/static/_app/immutable/chunks/DOFcFfVQ.js +1 -0
- hfstudio/static/_app/immutable/entry/app.B18cP-tp.js +2 -0
- hfstudio/static/_app/immutable/entry/start.7dRPTxlt.js +1 -0
- hfstudio/static/_app/immutable/nodes/0._eVrFTiQ.js +3 -0
- hfstudio/static/_app/immutable/nodes/1.D3aD59tB.js +1 -0
- hfstudio/static/_app/immutable/nodes/2.aVyilnly.js +18 -0
- hfstudio/static/_app/immutable/nodes/3.CqKlOYDp.js +1 -0
- hfstudio/static/index.html +7 -7
.gitattributes
CHANGED
|
@@ -7,3 +7,9 @@
|
|
| 7 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 8 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
| 9 |
*.pdf filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 8 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
| 9 |
*.pdf filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
hfstudio/static/assets/hf-logo.png filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
hfstudio/static/assets/hf-studio-logo.png filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
frontend/static/assets/hf-logo.png filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
frontend/static/assets/hf-studio-logo.png filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
hfstudio/static/samples/harvard.wav filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
frontend/static/samples/harvard.wav filter=lfs diff=lfs merge=lfs -text
|
frontend/src/routes/+layout.svelte
CHANGED
|
@@ -10,9 +10,16 @@
|
|
| 10 |
let showTokenInput = false;
|
| 11 |
let tokenInput = '';
|
| 12 |
let tokenError = '';
|
|
|
|
|
|
|
| 13 |
|
| 14 |
onMount(() => {
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
checkLoginStatus();
|
| 17 |
|
| 18 |
// Re-check login status when page becomes visible (e.g., after OAuth redirect)
|
|
@@ -34,12 +41,52 @@
|
|
| 34 |
};
|
| 35 |
});
|
| 36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
function checkLoginStatus() {
|
| 38 |
const token = localStorage.getItem('hf_access_token');
|
| 39 |
-
if (token) {
|
| 40 |
-
//
|
|
|
|
| 41 |
fetchUserInfo(token);
|
| 42 |
-
} else {
|
| 43 |
isLoggedIn = false;
|
| 44 |
username = '';
|
| 45 |
}
|
|
@@ -47,6 +94,7 @@
|
|
| 47 |
|
| 48 |
async function fetchUserInfo(token) {
|
| 49 |
try {
|
|
|
|
| 50 |
// Validate token using the correct whoami-v2 endpoint
|
| 51 |
const response = await fetch('https://huggingface.co/api/whoami-v2', {
|
| 52 |
headers: {
|
|
@@ -59,21 +107,24 @@
|
|
| 59 |
isLoggedIn = true;
|
| 60 |
const fullName = userData.name || userData.fullname || userData.login || userData.username || 'User';
|
| 61 |
username = fullName.split(' ')[0];
|
|
|
|
| 62 |
} else {
|
| 63 |
// Token might be invalid, remove it
|
| 64 |
localStorage.removeItem('hf_access_token');
|
| 65 |
isLoggedIn = false;
|
| 66 |
username = '';
|
|
|
|
| 67 |
}
|
| 68 |
} catch (error) {
|
| 69 |
// Token might be invalid, remove it
|
| 70 |
localStorage.removeItem('hf_access_token');
|
| 71 |
isLoggedIn = false;
|
| 72 |
username = '';
|
|
|
|
| 73 |
}
|
| 74 |
}
|
| 75 |
|
| 76 |
-
function handleAuthAction() {
|
| 77 |
if (isLoggedIn) {
|
| 78 |
// Logout
|
| 79 |
localStorage.removeItem('hf_access_token');
|
|
@@ -81,10 +132,16 @@
|
|
| 81 |
isLoggedIn = false;
|
| 82 |
username = '';
|
| 83 |
} else {
|
| 84 |
-
//
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
}
|
| 89 |
}
|
| 90 |
|
|
@@ -202,10 +259,13 @@
|
|
| 202 |
<div class="absolute bottom-4 left-2 right-2 w-52">
|
| 203 |
<button
|
| 204 |
on:click={handleAuthAction}
|
| 205 |
-
|
|
|
|
| 206 |
>
|
| 207 |
<img src="/assets/hf-logo.png" alt="HF Logo" class="w-5 h-5" />
|
| 208 |
-
{#if
|
|
|
|
|
|
|
| 209 |
<span>Sign Out, {username}</span>
|
| 210 |
{:else}
|
| 211 |
<span>Sign In</span>
|
|
@@ -227,13 +287,18 @@
|
|
| 227 |
|
| 228 |
<div class="mb-4 p-3 bg-blue-50 rounded-md text-sm">
|
| 229 |
<p class="text-blue-800 mb-2">
|
| 230 |
-
<strong>
|
| 231 |
</p>
|
| 232 |
<p class="text-blue-700">
|
| 233 |
1. Go to <a href="https://huggingface.co/settings/tokens" target="_blank" class="underline text-blue-600">HuggingFace Settings</a><br>
|
| 234 |
2. Create a new token with "Inference API" permissions<br>
|
| 235 |
3. Copy and paste it below
|
| 236 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 237 |
</div>
|
| 238 |
|
| 239 |
<div class="mb-4">
|
|
|
|
| 10 |
let showTokenInput = false;
|
| 11 |
let tokenInput = '';
|
| 12 |
let tokenError = '';
|
| 13 |
+
let isLocalEnvironment = false;
|
| 14 |
+
let isCheckingAuth = true;
|
| 15 |
|
| 16 |
onMount(() => {
|
| 17 |
+
console.log('onMount called - starting auth check');
|
| 18 |
+
// First check if we can use local token (for local development)
|
| 19 |
+
// This should happen before checking localStorage to prioritize local tokens
|
| 20 |
+
checkLocalTokenAvailability();
|
| 21 |
+
|
| 22 |
+
// Then check if user is logged in (from localStorage)
|
| 23 |
checkLoginStatus();
|
| 24 |
|
| 25 |
// Re-check login status when page becomes visible (e.g., after OAuth redirect)
|
|
|
|
| 41 |
};
|
| 42 |
});
|
| 43 |
|
| 44 |
+
async function checkLocalTokenAvailability() {
|
| 45 |
+
try {
|
| 46 |
+
console.log('Checking local token availability...');
|
| 47 |
+
const response = await fetch('/api/auth/local-token');
|
| 48 |
+
const data = await response.json();
|
| 49 |
+
console.log('Local token response:', data);
|
| 50 |
+
|
| 51 |
+
if (data.available) {
|
| 52 |
+
isLocalEnvironment = true;
|
| 53 |
+
// Always use the local token if available (it's more reliable than localStorage)
|
| 54 |
+
localStorage.setItem('hf_access_token', data.token);
|
| 55 |
+
console.log('Set local token in localStorage');
|
| 56 |
+
|
| 57 |
+
// If we have user info from the API, use it directly
|
| 58 |
+
if (data.user_info && data.user_info.name !== "Local User") {
|
| 59 |
+
isLoggedIn = true;
|
| 60 |
+
username = data.user_info.name.split(' ')[0];
|
| 61 |
+
console.log('Logged in with user info:', username);
|
| 62 |
+
} else {
|
| 63 |
+
// For local tokens, even if we can't validate due to rate limiting,
|
| 64 |
+
// we should still consider the user logged in
|
| 65 |
+
isLoggedIn = true;
|
| 66 |
+
username = "Local User";
|
| 67 |
+
console.log('Logged in with local token (validation skipped due to rate limiting)');
|
| 68 |
+
console.log('isLoggedIn set to:', isLoggedIn, 'username set to:', username);
|
| 69 |
+
}
|
| 70 |
+
} else {
|
| 71 |
+
isLocalEnvironment = false;
|
| 72 |
+
console.log('No local token available');
|
| 73 |
+
}
|
| 74 |
+
} catch (error) {
|
| 75 |
+
console.log('Could not check local token availability:', error);
|
| 76 |
+
isLocalEnvironment = false;
|
| 77 |
+
} finally {
|
| 78 |
+
isCheckingAuth = false;
|
| 79 |
+
console.log('Finished checking auth, isLoggedIn:', isLoggedIn);
|
| 80 |
+
}
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
function checkLoginStatus() {
|
| 84 |
const token = localStorage.getItem('hf_access_token');
|
| 85 |
+
if (token && !isLoggedIn) {
|
| 86 |
+
// Only fetch user info if we're not already logged in
|
| 87 |
+
// (to avoid overriding the local token login state)
|
| 88 |
fetchUserInfo(token);
|
| 89 |
+
} else if (!token) {
|
| 90 |
isLoggedIn = false;
|
| 91 |
username = '';
|
| 92 |
}
|
|
|
|
| 94 |
|
| 95 |
async function fetchUserInfo(token) {
|
| 96 |
try {
|
| 97 |
+
console.log('Fetching user info for token:', token.substring(0, 10) + '...');
|
| 98 |
// Validate token using the correct whoami-v2 endpoint
|
| 99 |
const response = await fetch('https://huggingface.co/api/whoami-v2', {
|
| 100 |
headers: {
|
|
|
|
| 107 |
isLoggedIn = true;
|
| 108 |
const fullName = userData.name || userData.fullname || userData.login || userData.username || 'User';
|
| 109 |
username = fullName.split(' ')[0];
|
| 110 |
+
console.log('Successfully fetched user info:', username);
|
| 111 |
} else {
|
| 112 |
// Token might be invalid, remove it
|
| 113 |
localStorage.removeItem('hf_access_token');
|
| 114 |
isLoggedIn = false;
|
| 115 |
username = '';
|
| 116 |
+
console.log('Token validation failed:', response.status);
|
| 117 |
}
|
| 118 |
} catch (error) {
|
| 119 |
// Token might be invalid, remove it
|
| 120 |
localStorage.removeItem('hf_access_token');
|
| 121 |
isLoggedIn = false;
|
| 122 |
username = '';
|
| 123 |
+
console.log('Error fetching user info:', error);
|
| 124 |
}
|
| 125 |
}
|
| 126 |
|
| 127 |
+
async function handleAuthAction() {
|
| 128 |
if (isLoggedIn) {
|
| 129 |
// Logout
|
| 130 |
localStorage.removeItem('hf_access_token');
|
|
|
|
| 132 |
isLoggedIn = false;
|
| 133 |
username = '';
|
| 134 |
} else {
|
| 135 |
+
// If we're on Spaces, redirect to OAuth
|
| 136 |
+
if (window.location.hostname.includes('hf.space') || window.location.hostname.includes('huggingface.co')) {
|
| 137 |
+
const oauthUrl = `https://huggingface.co/oauth/authorize?client_id=cdf32a17-e40f-4a84-b683-f66aa1105793&redirect_uri=${encodeURIComponent(window.location.origin + '/auth/callback')}&scope=openid profile&response_type=code&state=${Date.now()}`;
|
| 138 |
+
window.location.href = oauthUrl;
|
| 139 |
+
} else {
|
| 140 |
+
// Local development fallback: show token input
|
| 141 |
+
showTokenInput = true;
|
| 142 |
+
tokenInput = '';
|
| 143 |
+
tokenError = '';
|
| 144 |
+
}
|
| 145 |
}
|
| 146 |
}
|
| 147 |
|
|
|
|
| 259 |
<div class="absolute bottom-4 left-2 right-2 w-52">
|
| 260 |
<button
|
| 261 |
on:click={handleAuthAction}
|
| 262 |
+
disabled={isCheckingAuth}
|
| 263 |
+
class="w-full px-6 py-3 bg-black text-white rounded-lg font-medium hover:bg-gray-800 transition-colors shadow-sm flex items-center justify-center gap-2 text-sm disabled:opacity-50 disabled:cursor-not-allowed"
|
| 264 |
>
|
| 265 |
<img src="/assets/hf-logo.png" alt="HF Logo" class="w-5 h-5" />
|
| 266 |
+
{#if isCheckingAuth}
|
| 267 |
+
<span>Checking... ({isLoggedIn ? 'logged in' : 'not logged in'})</span>
|
| 268 |
+
{:else if isLoggedIn}
|
| 269 |
<span>Sign Out, {username}</span>
|
| 270 |
{:else}
|
| 271 |
<span>Sign In</span>
|
|
|
|
| 287 |
|
| 288 |
<div class="mb-4 p-3 bg-blue-50 rounded-md text-sm">
|
| 289 |
<p class="text-blue-800 mb-2">
|
| 290 |
+
<strong>Manual Token Entry:</strong> Please enter your HuggingFace token.
|
| 291 |
</p>
|
| 292 |
<p class="text-blue-700">
|
| 293 |
1. Go to <a href="https://huggingface.co/settings/tokens" target="_blank" class="underline text-blue-600">HuggingFace Settings</a><br>
|
| 294 |
2. Create a new token with "Inference API" permissions<br>
|
| 295 |
3. Copy and paste it below
|
| 296 |
</p>
|
| 297 |
+
{#if isLocalEnvironment}
|
| 298 |
+
<p class="text-blue-600 mt-2">
|
| 299 |
+
<strong>Tip:</strong> You can also run <code>huggingface-cli login</code> in your terminal to automatically use your local token.
|
| 300 |
+
</p>
|
| 301 |
+
{/if}
|
| 302 |
</div>
|
| 303 |
|
| 304 |
<div class="mb-4">
|
frontend/src/routes/+page.svelte
CHANGED
|
@@ -1,10 +1,11 @@
|
|
| 1 |
<script>
|
| 2 |
-
import { Play, Download, Loader2, AlertCircle, ChevronDown, Copy, RefreshCw, Share, MoreHorizontal, Settings, Sliders, Pause, SkipBack, SkipForward } from 'lucide-svelte';
|
| 3 |
|
| 4 |
let text = `In a world where knowledge flowed freely like rivers connecting distant lands, a community of passionate researchers and developers worked together to build something extraordinary. They believed that artificial intelligence should belong to everyone, not locked away in corporate towers. Day by day, they shared their discoveries, their code, and their dreams with people across the globe. Their open source models could understand language, generate images, and even speak with human-like voices. This collaborative spirit sparked innovation in ways that no single company could achieve alone, proving that when brilliant minds unite around a common cause, they can democratize the future of technology.`;
|
| 5 |
let selectedVoice = 'Novia';
|
| 6 |
let selectedModel = 'Chatterbox';
|
| 7 |
let mode = 'api'; // 'api' or 'local'
|
|
|
|
| 8 |
let modelDropdownOpen = false;
|
| 9 |
let isGenerating = false;
|
| 10 |
let audioUrl = null;
|
|
@@ -250,10 +251,6 @@
|
|
| 250 |
}
|
| 251 |
}
|
| 252 |
|
| 253 |
-
function clearText() {
|
| 254 |
-
text = '';
|
| 255 |
-
audioUrl = null;
|
| 256 |
-
}
|
| 257 |
</script>
|
| 258 |
|
| 259 |
<div class="flex flex-col h-full" on:click={handleClickOutside}>
|
|
@@ -279,20 +276,29 @@
|
|
| 279 |
</div>
|
| 280 |
|
| 281 |
<div class="flex items-center gap-2">
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 291 |
</div>
|
| 292 |
</div>
|
| 293 |
</header>
|
| 294 |
|
| 295 |
<!-- Main content area -->
|
|
|
|
| 296 |
<div class="flex-1 flex">
|
| 297 |
<!-- Main content area -->
|
| 298 |
<div class="flex-1 flex flex-col p-6">
|
|
@@ -317,14 +323,6 @@
|
|
| 317 |
placeholder="Welcome to our text to speech demo. This technology can transform any written content into natural sounding audio."
|
| 318 |
/>
|
| 319 |
|
| 320 |
-
{#if text}
|
| 321 |
-
<button
|
| 322 |
-
on:click={clearText}
|
| 323 |
-
class="absolute top-4 right-6 text-sm text-gray-400 hover:text-gray-600"
|
| 324 |
-
>
|
| 325 |
-
Clear
|
| 326 |
-
</button>
|
| 327 |
-
{/if}
|
| 328 |
</div>
|
| 329 |
|
| 330 |
<!-- Fixed bottom generate button -->
|
|
@@ -628,4 +626,20 @@
|
|
| 628 |
</div>
|
| 629 |
</div>
|
| 630 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 631 |
</div>
|
|
|
|
| 1 |
<script>
|
| 2 |
+
import { Play, Download, Loader2, AlertCircle, ChevronDown, Copy, RefreshCw, Share, MoreHorizontal, Settings, Sliders, Pause, SkipBack, SkipForward, Layout, Code } from 'lucide-svelte';
|
| 3 |
|
| 4 |
let text = `In a world where knowledge flowed freely like rivers connecting distant lands, a community of passionate researchers and developers worked together to build something extraordinary. They believed that artificial intelligence should belong to everyone, not locked away in corporate towers. Day by day, they shared their discoveries, their code, and their dreams with people across the globe. Their open source models could understand language, generate images, and even speak with human-like voices. This collaborative spirit sparked innovation in ways that no single company could achieve alone, proving that when brilliant minds unite around a common cause, they can democratize the future of technology.`;
|
| 5 |
let selectedVoice = 'Novia';
|
| 6 |
let selectedModel = 'Chatterbox';
|
| 7 |
let mode = 'api'; // 'api' or 'local'
|
| 8 |
+
let viewMode = 'ui'; // 'ui' or 'code'
|
| 9 |
let modelDropdownOpen = false;
|
| 10 |
let isGenerating = false;
|
| 11 |
let audioUrl = null;
|
|
|
|
| 251 |
}
|
| 252 |
}
|
| 253 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 254 |
</script>
|
| 255 |
|
| 256 |
<div class="flex flex-col h-full" on:click={handleClickOutside}>
|
|
|
|
| 276 |
</div>
|
| 277 |
|
| 278 |
<div class="flex items-center gap-2">
|
| 279 |
+
<!-- View mode toggle -->
|
| 280 |
+
<div class="flex items-center bg-gray-100 rounded-md p-0.5">
|
| 281 |
+
<button
|
| 282 |
+
class="flex items-center gap-1.5 px-3 py-1 text-sm font-medium rounded transition-colors {viewMode === 'ui' ? 'bg-white shadow-sm' : 'text-gray-600'}"
|
| 283 |
+
on:click={() => viewMode = 'ui'}
|
| 284 |
+
>
|
| 285 |
+
<Layout size={14} />
|
| 286 |
+
UI
|
| 287 |
+
</button>
|
| 288 |
+
<button
|
| 289 |
+
class="flex items-center gap-1.5 px-3 py-1 text-sm font-medium rounded transition-colors {viewMode === 'code' ? 'bg-white shadow-sm' : 'text-gray-600'}"
|
| 290 |
+
on:click={() => viewMode = 'code'}
|
| 291 |
+
>
|
| 292 |
+
<Code size={14} />
|
| 293 |
+
Code
|
| 294 |
+
</button>
|
| 295 |
+
</div>
|
| 296 |
</div>
|
| 297 |
</div>
|
| 298 |
</header>
|
| 299 |
|
| 300 |
<!-- Main content area -->
|
| 301 |
+
{#if viewMode === 'ui'}
|
| 302 |
<div class="flex-1 flex">
|
| 303 |
<!-- Main content area -->
|
| 304 |
<div class="flex-1 flex flex-col p-6">
|
|
|
|
| 323 |
placeholder="Welcome to our text to speech demo. This technology can transform any written content into natural sounding audio."
|
| 324 |
/>
|
| 325 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 326 |
</div>
|
| 327 |
|
| 328 |
<!-- Fixed bottom generate button -->
|
|
|
|
| 626 |
</div>
|
| 627 |
</div>
|
| 628 |
</div>
|
| 629 |
+
{:else}
|
| 630 |
+
<!-- Code view -->
|
| 631 |
+
<div class="flex-1 flex items-center justify-center bg-gray-50 p-8">
|
| 632 |
+
<div class="max-w-2xl w-full">
|
| 633 |
+
<div class="bg-white rounded-lg shadow-sm border border-gray-200 p-6">
|
| 634 |
+
<h2 class="text-lg font-semibold mb-4">Code View</h2>
|
| 635 |
+
<p class="text-gray-600 mb-4">
|
| 636 |
+
Here you can see the code to integrate text-to-speech into your application.
|
| 637 |
+
</p>
|
| 638 |
+
<pre class="bg-gray-900 text-gray-100 p-4 rounded-lg overflow-x-auto"><code>// Coming soon: API integration code
|
| 639 |
+
// This will show how to use the TTS API
|
| 640 |
+
// with your selected settings</code></pre>
|
| 641 |
+
</div>
|
| 642 |
+
</div>
|
| 643 |
+
</div>
|
| 644 |
+
{/if}
|
| 645 |
</div>
|
hfstudio/server.py
CHANGED
|
@@ -11,7 +11,7 @@ import soundfile as sf
|
|
| 11 |
import httpx
|
| 12 |
import os
|
| 13 |
from pathlib import Path
|
| 14 |
-
from huggingface_hub import InferenceClient
|
| 15 |
|
| 16 |
app = FastAPI(title="HFStudio API", version="0.1.0")
|
| 17 |
|
|
@@ -94,6 +94,54 @@ async def get_status():
|
|
| 94 |
"api_configured": True
|
| 95 |
}
|
| 96 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
@app.get("/api/voices")
|
| 98 |
async def get_voices():
|
| 99 |
voices = [
|
|
@@ -223,10 +271,13 @@ async def exchange_oauth_token(request: OAuthTokenRequest, http_request: Request
|
|
| 223 |
client_id = "cdf32a17-e40f-4a84-b683-f66aa1105793"
|
| 224 |
client_secret = "f590cb2d-6eac-4cef-a0cb-d0116825295c"
|
| 225 |
|
| 226 |
-
#
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
|
|
|
|
|
|
|
|
|
| 230 |
referer = http_request.headers.get("referer", "")
|
| 231 |
if referer:
|
| 232 |
from urllib.parse import urlparse
|
|
@@ -273,7 +324,7 @@ async def exchange_oauth_token(request: OAuthTokenRequest, http_request: Request
|
|
| 273 |
raise HTTPException(status_code=500, detail=str(e))
|
| 274 |
|
| 275 |
@app.get("/auth/callback")
|
| 276 |
-
async def oauth_callback(code: str = None, state: str = None):
|
| 277 |
"""Handle OAuth callback and redirect to frontend with token"""
|
| 278 |
if not code:
|
| 279 |
return HTMLResponse("""
|
|
@@ -293,7 +344,15 @@ async def oauth_callback(code: str = None, state: str = None):
|
|
| 293 |
|
| 294 |
client_id = "cdf32a17-e40f-4a84-b683-f66aa1105793"
|
| 295 |
client_secret = "f590cb2d-6eac-4cef-a0cb-d0116825295c"
|
| 296 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 297 |
|
| 298 |
token_data = {
|
| 299 |
"client_id": client_id,
|
|
|
|
| 11 |
import httpx
|
| 12 |
import os
|
| 13 |
from pathlib import Path
|
| 14 |
+
from huggingface_hub import InferenceClient, get_token, whoami
|
| 15 |
|
| 16 |
app = FastAPI(title="HFStudio API", version="0.1.0")
|
| 17 |
|
|
|
|
| 94 |
"api_configured": True
|
| 95 |
}
|
| 96 |
|
| 97 |
+
@app.get("/api/auth/local-token")
|
| 98 |
+
async def get_local_token():
|
| 99 |
+
"""Get local HF token if available (for local development)"""
|
| 100 |
+
try:
|
| 101 |
+
# Check if we're running on Spaces
|
| 102 |
+
if os.getenv("SPACE_HOST"):
|
| 103 |
+
return {"available": False, "reason": "running_on_spaces"}
|
| 104 |
+
|
| 105 |
+
# Try to get local token
|
| 106 |
+
token = get_token()
|
| 107 |
+
if not token:
|
| 108 |
+
return {"available": False, "reason": "no_local_token"}
|
| 109 |
+
|
| 110 |
+
# Try to validate token by getting user info, but handle rate limiting gracefully
|
| 111 |
+
try:
|
| 112 |
+
user_info = whoami(token=token)
|
| 113 |
+
if user_info.get("type") != "user":
|
| 114 |
+
return {"available": False, "reason": "invalid_token_type"}
|
| 115 |
+
|
| 116 |
+
return {
|
| 117 |
+
"available": True,
|
| 118 |
+
"token": token,
|
| 119 |
+
"user_info": {
|
| 120 |
+
"name": user_info.get("name"),
|
| 121 |
+
"fullname": user_info.get("fullname"),
|
| 122 |
+
"avatarUrl": user_info.get("avatarUrl")
|
| 123 |
+
}
|
| 124 |
+
}
|
| 125 |
+
except Exception as api_error:
|
| 126 |
+
# If API validation fails (e.g., rate limiting), still return the token
|
| 127 |
+
# The frontend can validate it when needed
|
| 128 |
+
if "429" in str(api_error) or "rate limit" in str(api_error).lower():
|
| 129 |
+
return {
|
| 130 |
+
"available": True,
|
| 131 |
+
"token": token,
|
| 132 |
+
"user_info": {
|
| 133 |
+
"name": "Local User",
|
| 134 |
+
"fullname": "Local User",
|
| 135 |
+
"avatarUrl": None
|
| 136 |
+
},
|
| 137 |
+
"warning": "Token validation skipped due to rate limiting"
|
| 138 |
+
}
|
| 139 |
+
else:
|
| 140 |
+
return {"available": False, "reason": f"token_validation_error: {str(api_error)}"}
|
| 141 |
+
|
| 142 |
+
except Exception as e:
|
| 143 |
+
return {"available": False, "reason": f"error: {str(e)}"}
|
| 144 |
+
|
| 145 |
@app.get("/api/voices")
|
| 146 |
async def get_voices():
|
| 147 |
voices = [
|
|
|
|
| 271 |
client_id = "cdf32a17-e40f-4a84-b683-f66aa1105793"
|
| 272 |
client_secret = "f590cb2d-6eac-4cef-a0cb-d0116825295c"
|
| 273 |
|
| 274 |
+
# Determine redirect URI based on environment
|
| 275 |
+
if os.getenv("SPACE_HOST"):
|
| 276 |
+
# On Spaces, use the Space URL
|
| 277 |
+
space_host = os.getenv("SPACE_HOST").split(",")[0] # Handle custom domains
|
| 278 |
+
redirect_uri = f"https://{space_host}/auth/callback"
|
| 279 |
+
else:
|
| 280 |
+
# Local development - try to determine from referer header
|
| 281 |
referer = http_request.headers.get("referer", "")
|
| 282 |
if referer:
|
| 283 |
from urllib.parse import urlparse
|
|
|
|
| 324 |
raise HTTPException(status_code=500, detail=str(e))
|
| 325 |
|
| 326 |
@app.get("/auth/callback")
|
| 327 |
+
async def oauth_callback(code: str = None, state: str = None, request: Request = None):
|
| 328 |
"""Handle OAuth callback and redirect to frontend with token"""
|
| 329 |
if not code:
|
| 330 |
return HTMLResponse("""
|
|
|
|
| 344 |
|
| 345 |
client_id = "cdf32a17-e40f-4a84-b683-f66aa1105793"
|
| 346 |
client_secret = "f590cb2d-6eac-4cef-a0cb-d0116825295c"
|
| 347 |
+
|
| 348 |
+
# Determine redirect URI based on environment
|
| 349 |
+
if os.getenv("SPACE_HOST"):
|
| 350 |
+
# On Spaces, use the Space URL
|
| 351 |
+
space_host = os.getenv("SPACE_HOST").split(",")[0] # Handle custom domains
|
| 352 |
+
redirect_uri = f"https://{space_host}/auth/callback"
|
| 353 |
+
else:
|
| 354 |
+
# Local development
|
| 355 |
+
redirect_uri = "http://localhost:7860/auth/callback"
|
| 356 |
|
| 357 |
token_data = {
|
| 358 |
"client_id": client_id,
|
hfstudio/static/_app/immutable/assets/0.BuN4nQsJ.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background: 0 0% 100%;--foreground: 240 10% 3.9%;--card: 0 0% 100%;--card-foreground: 240 10% 3.9%;--popover: 0 0% 100%;--popover-foreground: 240 10% 3.9%;--primary: 240 5.9% 10%;--primary-foreground: 0 0% 98%;--secondary: 240 4.8% 95.9%;--secondary-foreground: 240 5.9% 10%;--muted: 240 4.8% 95.9%;--muted-foreground: 240 3.8% 46.1%;--accent: 240 4.8% 95.9%;--accent-foreground: 240 5.9% 10%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 0 0% 98%;--border: 240 5.9% 90%;--input: 240 5.9% 90%;--ring: 240 5.9% 10%;--radius: .5rem}.visible{visibility:visible}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.bottom-0{bottom:0}.bottom-4{bottom:1rem}.left-0{left:0}.left-2{left:.5rem}.left-56{left:14rem}.right-0{right:0}.right-2{right:.5rem}.right-80{right:20rem}.top-full{top:100%}.z-10{z-index:10}.z-50{z-index:50}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.ml-0\.5{margin-left:.125rem}.ml-1{margin-left:.25rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.block{display:block}.flex{display:flex}.contents{display:contents}.hidden{display:none}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-12{height:3rem}.h-2{height:.5rem}.h-5{height:1.25rem}.h-8{height:2rem}.h-full{height:100%}.h-screen{height:100vh}.min-h-screen{min-height:100vh}.w-12{width:3rem}.w-2{width:.5rem}.w-5{width:1.25rem}.w-52{width:13rem}.w-56{width:14rem}.w-8{width:2rem}.w-80{width:20rem}.w-full{width:100%}.max-w-2xl{max-width:42rem}.max-w-md{max-width:28rem}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.scale-150{--tw-scale-x: 1.5;--tw-scale-y: 1.5;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.resize-none{resize:none}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.flex-col{flex-direction:column}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-amber-400{--tw-border-opacity: 1;border-color:rgb(251 191 36 / var(--tw-border-opacity, 1))}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.border-t-transparent{border-top-color:transparent}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.bg-gray-900{--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-opacity-50{--tw-bg-opacity: .5}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-amber-400{--tw-gradient-from: #fbbf24 var(--tw-gradient-from-position);--tw-gradient-to: rgb(251 191 36 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-orange-500{--tw-gradient-to: #f97316 var(--tw-gradient-to-position)}.bg-right{background-position:right}.bg-no-repeat{background-repeat:no-repeat}.p-0\.5{padding:.125rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.pb-24{padding-bottom:6rem}.pr-10{padding-right:2.5rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-center{text-align:center}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.leading-relaxed{line-height:1.625}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.text-blue-900{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity, 1))}.text-gray-100{--tw-text-opacity: 1;color:rgb(243 244 246 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}.slider-hf::-webkit-slider-thumb{height:1rem;width:1rem;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;border-radius:9999px;background:linear-gradient(45deg,#ffd21e,#ff9d00);box-shadow:0 1px 3px #0000001a}.slider-hf::-moz-range-thumb{height:1rem;width:1rem;cursor:pointer;border-radius:9999px;border-width:0px;background:linear-gradient(45deg,#ffd21e,#ff9d00);box-shadow:0 1px 3px #0000001a}.pause-filled{display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px}.pause-filled:before,.pause-filled:after{content:"";width:2px;height:10px;background-color:currentColor;border-radius:1px}.pause-filled:before{margin-right:2px}.pause-filled:after{margin-left:2px}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-50:hover{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-800:hover{--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.hover\:bg-orange-600:hover{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / var(--tw-bg-opacity, 1))}.hover\:from-amber-500:hover{--tw-gradient-from: #f59e0b var(--tw-gradient-from-position);--tw-gradient-to: rgb(245 158 11 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:to-orange-600:hover{--tw-gradient-to: #ea580c var(--tw-gradient-to-position)}.hover\:text-gray-800:hover{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.focus\:border-transparent:focus{border-color:transparent}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-amber-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(251 191 36 / var(--tw-ring-opacity, 1))}.focus\:ring-orange-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(249 115 22 / var(--tw-ring-opacity, 1))}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}
|
hfstudio/static/_app/immutable/chunks/CB1vOLR2.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
var St=Object.defineProperty;var Et=(e,t,n)=>t in e?St(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var R=(e,t,n)=>Et(e,typeof t!="symbol"?t+"":t,n);import{S as At,G as Rt,Y as Tt,Z as Ut,_ as It,$ as Lt,a0 as $t,a1 as xt,r as ve,a2 as Ct,H as be,n as ge,s as Pt}from"./BI_gvUUO.js";class Qe extends At{constructor(n){if(!n||!n.target&&!n.$$inline)throw new Error("'target' is a required option");super();R(this,"$$prop_def");R(this,"$$events_def");R(this,"$$slot_def")}$destroy(){super.$destroy(),this.$destroy=()=>{console.warn("Component was already destroyed")}}$capture_state(){}$inject_state(){}}class Ot extends Qe{}const Nt=Object.freeze(Object.defineProperty({__proto__:null,SvelteComponent:Qe,SvelteComponentTyped:Ot,afterUpdate:Rt,beforeUpdate:Tt,createEventDispatcher:Ut,getAllContexts:It,getContext:Lt,hasContext:$t,onDestroy:xt,onMount:ve,setContext:Ct,tick:be},Symbol.toStringTag,{value:"Module"}));class ce{constructor(t,n){this.status=t,typeof n=="string"?this.body={message:n}:n?this.body=n:this.body={message:`Error: ${t}`}}toString(){return JSON.stringify(this.body)}}class Re{constructor(t,n){this.status=t,this.location=n}}class Te extends Error{constructor(t,n,r){super(r),this.status=t,this.text=n}}new URL("sveltekit-internal://");function jt(e,t){return e==="/"||t==="ignore"?e:t==="never"?e.endsWith("/")?e.slice(0,-1):e:t==="always"&&!e.endsWith("/")?e+"/":e}function Dt(e){return e.split("%25").map(decodeURI).join("%25")}function Bt(e){for(const t in e)e[t]=decodeURIComponent(e[t]);return e}function me({href:e}){return e.split("#")[0]}function Ft(e,t,n,r=!1){const a=new URL(e);Object.defineProperty(a,"searchParams",{value:new Proxy(a.searchParams,{get(i,o){if(o==="get"||o==="getAll"||o==="has")return l=>(n(l),i[o](l));t();const c=Reflect.get(i,o);return typeof c=="function"?c.bind(i):c}}),enumerable:!0,configurable:!0});const s=["href","pathname","search","toString","toJSON"];r&&s.push("hash");for(const i of s)Object.defineProperty(a,i,{get(){return t(),e[i]},enumerable:!0,configurable:!0});return a}function Mt(...e){let t=5381;for(const n of e)if(typeof n=="string"){let r=n.length;for(;r;)t=t*33^n.charCodeAt(--r)}else if(ArrayBuffer.isView(n)){const r=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);let a=r.length;for(;a;)t=t*33^r[--a]}else throw new TypeError("value must be a string or TypedArray");return(t>>>0).toString(36)}new TextEncoder;const Vt=new TextDecoder;function qt(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}const zt=window.fetch;window.fetch=(e,t)=>((e instanceof Request?e.method:(t==null?void 0:t.method)||"GET")!=="GET"&&G.delete(Ue(e)),zt(e,t));const G=new Map;function Gt(e,t){const n=Ue(e,t),r=document.querySelector(n);if(r!=null&&r.textContent){r.remove();let{body:a,...s}=JSON.parse(r.textContent);const i=r.getAttribute("data-ttl");return i&&G.set(n,{body:a,init:s,ttl:1e3*Number(i)}),r.getAttribute("data-b64")!==null&&(a=qt(a)),Promise.resolve(new Response(a,s))}return window.fetch(e,t)}function Yt(e,t,n){if(G.size>0){const r=Ue(e,n),a=G.get(r);if(a){if(performance.now()<a.ttl&&["default","force-cache","only-if-cached",void 0].includes(n==null?void 0:n.cache))return new Response(a.body,a.init);G.delete(r)}}return window.fetch(t,n)}function Ue(e,t){let r=`script[data-sveltekit-fetched][data-url=${JSON.stringify(e instanceof Request?e.url:e)}]`;if(t!=null&&t.headers||t!=null&&t.body){const a=[];t.headers&&a.push([...new Headers(t.headers)].join(",")),t.body&&(typeof t.body=="string"||ArrayBuffer.isView(t.body))&&a.push(t.body),r+=`[data-hash="${Mt(...a)}"]`}return r}const Ht=/^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;function Kt(e){const t=[];return{pattern:e==="/"?/^\/$/:new RegExp(`^${Jt(e).map(r=>{const a=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(r);if(a)return t.push({name:a[1],matcher:a[2],optional:!1,rest:!0,chained:!0}),"(?:/([^]*))?";const s=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(r);if(s)return t.push({name:s[1],matcher:s[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!r)return;const i=r.split(/\[(.+?)\](?!\])/);return"/"+i.map((c,l)=>{if(l%2){if(c.startsWith("x+"))return _e(String.fromCharCode(parseInt(c.slice(2),16)));if(c.startsWith("u+"))return _e(String.fromCharCode(...c.slice(2).split("-").map(u=>parseInt(u,16))));const d=Ht.exec(c),[,h,y,f,p]=d;return t.push({name:f,matcher:p,optional:!!h,rest:!!y,chained:y?l===1&&i[0]==="":!1}),y?"([^]*?)":h?"([^/]*)?":"([^/]+?)"}return _e(c)}).join("")}).join("")}/?$`),params:t}}function Wt(e){return e!==""&&!/^\([^)]+\)$/.test(e)}function Jt(e){return e.slice(1).split("/").filter(Wt)}function Xt(e,t,n){const r={},a=e.slice(1),s=a.filter(o=>o!==void 0);let i=0;for(let o=0;o<t.length;o+=1){const c=t[o];let l=a[o-i];if(c.chained&&c.rest&&i&&(l=a.slice(o-i,o+1).filter(d=>d).join("/"),i=0),l===void 0){c.rest&&(r[c.name]="");continue}if(!c.matcher||n[c.matcher](l)){r[c.name]=l;const d=t[o+1],h=a[o+1];d&&!d.rest&&d.optional&&h&&c.chained&&(i=0),!d&&!h&&Object.keys(r).length===s.length&&(i=0);continue}if(c.optional&&c.chained){i++;continue}return}if(!i)return r}function _e(e){return e.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function Zt({nodes:e,server_loads:t,dictionary:n,matchers:r}){const a=new Set(t);return Object.entries(n).map(([o,[c,l,d]])=>{const{pattern:h,params:y}=Kt(o),f={id:o,exec:p=>{const u=h.exec(p);if(u)return Xt(u,y,r)},errors:[1,...d||[]].map(p=>e[p]),layouts:[0,...l||[]].map(i),leaf:s(c)};return f.errors.length=f.layouts.length=Math.max(f.errors.length,f.layouts.length),f});function s(o){const c=o<0;return c&&(o=~o),[c,e[o]]}function i(o){return o===void 0?o:[a.has(o),e[o]]}}function et(e,t=JSON.parse){try{return t(sessionStorage[e])}catch{}}function Me(e,t,n=JSON.stringify){const r=n(t);try{sessionStorage[e]=r}catch{}}const D=[];function Ie(e,t=ge){let n;const r=new Set;function a(o){if(Pt(e,o)&&(e=o,n)){const c=!D.length;for(const l of r)l[1](),D.push(l,e);if(c){for(let l=0;l<D.length;l+=2)D[l][0](D[l+1]);D.length=0}}}function s(o){a(o(e))}function i(o,c=ge){const l=[o,c];return r.add(l),r.size===1&&(n=t(a,s)||ge),o(e),()=>{r.delete(l),r.size===0&&n&&(n(),n=null)}}return{set:a,update:s,subscribe:i}}var Xe;const $=((Xe=globalThis.__sveltekit_18kzuba)==null?void 0:Xe.base)??"";var Ze;const Qt=((Ze=globalThis.__sveltekit_18kzuba)==null?void 0:Ze.assets)??$??"",en="1760677880498",tt="sveltekit:snapshot",nt="sveltekit:scroll",at="sveltekit:states",tn="sveltekit:pageurl",F="sveltekit:history",K="sveltekit:navigation",O={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},Z=location.origin;function Le(e){if(e instanceof URL)return e;let t=document.baseURI;if(!t){const n=document.getElementsByTagName("base");t=n.length?n[0].href:document.URL}return new URL(e,t)}function le(){return{x:pageXOffset,y:pageYOffset}}function B(e,t){return e.getAttribute(`data-sveltekit-${t}`)}const Ve={...O,"":O.hover};function rt(e){let t=e.assignedSlot??e.parentNode;return(t==null?void 0:t.nodeType)===11&&(t=t.host),t}function ot(e,t){for(;e&&e!==t;){if(e.nodeName.toUpperCase()==="A"&&e.hasAttribute("href"))return e;e=rt(e)}}function ke(e,t,n){let r;try{if(r=new URL(e instanceof SVGAElement?e.href.baseVal:e.href,document.baseURI),n&&r.hash.match(/^#[^/]/)){const o=location.hash.split("#")[1]||"/";r.hash=`#${o}${r.hash}`}}catch{}const a=e instanceof SVGAElement?e.target.baseVal:e.target,s=!r||!!a||fe(r,t,n)||(e.getAttribute("rel")||"").split(/\s+/).includes("external"),i=(r==null?void 0:r.origin)===Z&&e.hasAttribute("download");return{url:r,external:s,target:a,download:i}}function ee(e){let t=null,n=null,r=null,a=null,s=null,i=null,o=e;for(;o&&o!==document.documentElement;)r===null&&(r=B(o,"preload-code")),a===null&&(a=B(o,"preload-data")),t===null&&(t=B(o,"keepfocus")),n===null&&(n=B(o,"noscroll")),s===null&&(s=B(o,"reload")),i===null&&(i=B(o,"replacestate")),o=rt(o);function c(l){switch(l){case"":case"true":return!0;case"off":case"false":return!1;default:return}}return{preload_code:Ve[r??"off"],preload_data:Ve[a??"off"],keepfocus:c(t),noscroll:c(n),reload:c(s),replace_state:c(i)}}function qe(e){const t=Ie(e);let n=!0;function r(){n=!0,t.update(i=>i)}function a(i){n=!1,t.set(i)}function s(i){let o;return t.subscribe(c=>{(o===void 0||n&&c!==o)&&i(o=c)})}return{notify:r,set:a,subscribe:s}}const st={v:()=>{}};function nn(){const{set:e,subscribe:t}=Ie(!1);let n;async function r(){clearTimeout(n);try{const a=await fetch(`${Qt}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!a.ok)return!1;const i=(await a.json()).version!==en;return i&&(e(!0),st.v(),clearTimeout(n)),i}catch{return!1}}return{subscribe:t,check:r}}function fe(e,t,n){return e.origin!==Z||!e.pathname.startsWith(t)?!0:n?!(e.pathname===t+"/"||e.pathname===t+"/index.html"||e.protocol==="file:"&&e.pathname.replace(/\/[^/]+\.html?$/,"")===t):!1}function qn(e){}function an(e){const t=on(e),n=new ArrayBuffer(t.length),r=new DataView(n);for(let a=0;a<n.byteLength;a++)r.setUint8(a,t.charCodeAt(a));return n}const rn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function on(e){e.length%4===0&&(e=e.replace(/==?$/,""));let t="",n=0,r=0;for(let a=0;a<e.length;a++)n<<=6,n|=rn.indexOf(e[a]),r+=6,r===24&&(t+=String.fromCharCode((n&16711680)>>16),t+=String.fromCharCode((n&65280)>>8),t+=String.fromCharCode(n&255),n=r=0);return r===12?(n>>=4,t+=String.fromCharCode(n)):r===18&&(n>>=2,t+=String.fromCharCode((n&65280)>>8),t+=String.fromCharCode(n&255)),t}const sn=-1,cn=-2,ln=-3,fn=-4,un=-5,dn=-6;function hn(e,t){if(typeof e=="number")return a(e,!0);if(!Array.isArray(e)||e.length===0)throw new Error("Invalid input");const n=e,r=Array(n.length);function a(s,i=!1){if(s===sn)return;if(s===ln)return NaN;if(s===fn)return 1/0;if(s===un)return-1/0;if(s===dn)return-0;if(i||typeof s!="number")throw new Error("Invalid input");if(s in r)return r[s];const o=n[s];if(!o||typeof o!="object")r[s]=o;else if(Array.isArray(o))if(typeof o[0]=="string"){const c=o[0],l=t==null?void 0:t[c];if(l)return r[s]=l(a(o[1]));switch(c){case"Date":r[s]=new Date(o[1]);break;case"Set":const d=new Set;r[s]=d;for(let f=1;f<o.length;f+=1)d.add(a(o[f]));break;case"Map":const h=new Map;r[s]=h;for(let f=1;f<o.length;f+=2)h.set(a(o[f]),a(o[f+1]));break;case"RegExp":r[s]=new RegExp(o[1],o[2]);break;case"Object":r[s]=Object(o[1]);break;case"BigInt":r[s]=BigInt(o[1]);break;case"null":const y=Object.create(null);r[s]=y;for(let f=1;f<o.length;f+=2)y[o[f]]=a(o[f+1]);break;case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"BigInt64Array":case"BigUint64Array":{const f=globalThis[c],p=new f(a(o[1]));r[s]=o[2]!==void 0?p.subarray(o[2],o[3]):p;break}case"ArrayBuffer":{const f=o[1],p=an(f);r[s]=p;break}case"Temporal.Duration":case"Temporal.Instant":case"Temporal.PlainDate":case"Temporal.PlainTime":case"Temporal.PlainDateTime":case"Temporal.PlainMonthDay":case"Temporal.PlainYearMonth":case"Temporal.ZonedDateTime":{const f=c.slice(9);r[s]=Temporal[f].from(o[1]);break}case"URL":{const f=new URL(o[1]);r[s]=f;break}case"URLSearchParams":{const f=new URLSearchParams(o[1]);r[s]=f;break}default:throw new Error(`Unknown type ${c}`)}}else{const c=new Array(o.length);r[s]=c;for(let l=0;l<o.length;l+=1){const d=o[l];d!==cn&&(c[l]=a(d))}}else{const c={};r[s]=c;for(const l in o){if(l==="__proto__")throw new Error("Cannot parse an object with a `__proto__` property");const d=o[l];c[l]=a(d)}}return r[s]}return a(0)}const it=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...it];const pn=new Set([...it]);[...pn];function gn(e){return e.filter(t=>t!=null)}const mn="x-sveltekit-invalidated",_n="x-sveltekit-trailing-slash";function te(e){return e instanceof ce||e instanceof Te?e.status:500}function wn(e){return e instanceof Te?e.text:"Internal Error"}let T,W,we;const yn=ve.toString().includes("$$")||/function \w+\(\) \{\}/.test(ve.toString());yn?(T={data:{},form:null,error:null,params:{},route:{id:null},state:{},status:-1,url:new URL("https://example.com")},W={current:null},we={current:!1}):(T=new class{constructor(){R(this,"data",$state.raw({}));R(this,"form",$state.raw(null));R(this,"error",$state.raw(null));R(this,"params",$state.raw({}));R(this,"route",$state.raw({id:null}));R(this,"state",$state.raw({}));R(this,"status",$state.raw(-1));R(this,"url",$state.raw(new URL("https://example.com")))}},W=new class{constructor(){R(this,"current",$state.raw(null))}},we=new class{constructor(){R(this,"current",$state.raw(!1))}},st.v=()=>we.current=!0);function vn(e){Object.assign(T,e)}const bn="/__data.json",kn=".html__data.json";function Sn(e){return e.endsWith(".html")?e.replace(/\.html$/,kn):e.replace(/\/$/,"")+bn}const ze={spanContext(){return En},setAttribute(){return this},setAttributes(){return this},addEvent(){return this},setStatus(){return this},updateName(){return this},end(){return this},isRecording(){return!1},recordException(){return this},addLink(){return this},addLinks(){return this}},En={traceId:"",spanId:"",traceFlags:0},{tick:An}=Nt,Rn=new Set(["icon","shortcut icon","apple-touch-icon"]),j=et(nt)??{},J=et(tt)??{},C={url:qe({}),page:qe({}),navigating:Ie(null),updated:nn()};function $e(e){j[e]=le()}function Tn(e,t){let n=e+1;for(;j[n];)delete j[n],n+=1;for(n=t+1;J[n];)delete J[n],n+=1}function q(e,t=!1){return t?location.replace(e.href):location.href=e.href,new Promise(()=>{})}async function ct(){if("serviceWorker"in navigator){const e=await navigator.serviceWorker.getRegistration($||"/");e&&await e.update()}}function Ge(){}let xe,Se,ne,x,Ee,S;const ae=[],re=[];let I=null;const Q=new Map,lt=new Set,Un=new Set,Y=new Set;let b={branch:[],error:null,url:null},Ce=!1,oe=!1,Ye=!0,X=!1,z=!1,ft=!1,Pe=!1,ut,A,L,N;const H=new Set,He=new Map;async function Hn(e,t,n){var s,i,o,c,l;(s=globalThis.__sveltekit_18kzuba)!=null&&s.data&&globalThis.__sveltekit_18kzuba.data,document.URL!==location.href&&(location.href=location.href),S=e,await((o=(i=e.hooks).init)==null?void 0:o.call(i)),xe=Zt(e),x=document.documentElement,Ee=t,Se=e.nodes[0],ne=e.nodes[1],Se(),ne(),A=(c=history.state)==null?void 0:c[F],L=(l=history.state)==null?void 0:l[K],A||(A=L=Date.now(),history.replaceState({...history.state,[F]:A,[K]:L},""));const r=j[A];function a(){r&&(history.scrollRestoration="manual",scrollTo(r.x,r.y))}n?(a(),await Dn(Ee,n)):(await M({type:"enter",url:Le(S.hash?Fn(new URL(location.href)):location.href),replace_state:!0}),a()),jn()}function In(){ae.length=0,Pe=!1}function dt(e){re.some(t=>t==null?void 0:t.snapshot)&&(J[e]=re.map(t=>{var n;return(n=t==null?void 0:t.snapshot)==null?void 0:n.capture()}))}function ht(e){var t;(t=J[e])==null||t.forEach((n,r)=>{var a,s;(s=(a=re[r])==null?void 0:a.snapshot)==null||s.restore(n)})}function Ke(){$e(A),Me(nt,j),dt(L),Me(tt,J)}async function pt(e,t,n,r){let a;t.invalidateAll&&(I=null),await M({type:"goto",url:Le(e),keepfocus:t.keepFocus,noscroll:t.noScroll,replace_state:t.replaceState,state:t.state,redirect_count:n,nav_token:r,accept:()=>{t.invalidateAll&&(Pe=!0,a=[...He.keys()]),t.invalidate&&t.invalidate.forEach(Nn)}}),t.invalidateAll&&be().then(be).then(()=>{He.forEach(({resource:s},i)=>{var o;a!=null&&a.includes(i)&&((o=s.refresh)==null||o.call(s))})})}async function Ln(e){if(e.id!==(I==null?void 0:I.id)){const t={};H.add(t),I={id:e.id,token:t,promise:_t({...e,preload:t}).then(n=>(H.delete(t),n.type==="loaded"&&n.state.error&&(I=null),n))}}return I.promise}async function ye(e){var n;const t=(n=await de(e,!1))==null?void 0:n.route;t&&await Promise.all([...t.layouts,t.leaf].map(r=>r==null?void 0:r[1]()))}function gt(e,t,n){var a;b=e.state;const r=document.querySelector("style[data-sveltekit]");if(r&&r.remove(),Object.assign(T,e.props.page),ut=new S.root({target:t,props:{...e.props,stores:C,components:re},hydrate:n,sync:!1}),ht(L),n){const s={from:null,to:{params:b.params,route:{id:((a=b.route)==null?void 0:a.id)??null},url:new URL(location.href)},willUnload:!1,type:"enter",complete:Promise.resolve()};Y.forEach(i=>i(s))}oe=!0}function se({url:e,params:t,branch:n,status:r,error:a,route:s,form:i}){let o="never";if($&&(e.pathname===$||e.pathname===$+"/"))o="always";else for(const f of n)(f==null?void 0:f.slash)!==void 0&&(o=f.slash);e.pathname=jt(e.pathname,o),e.search=e.search;const c={type:"loaded",state:{url:e,params:t,branch:n,error:a,route:s},props:{constructors:gn(n).map(f=>f.node.component),page:De(T)}};i!==void 0&&(c.props.form=i);let l={},d=!T,h=0;for(let f=0;f<Math.max(n.length,b.branch.length);f+=1){const p=n[f],u=b.branch[f];(p==null?void 0:p.data)!==(u==null?void 0:u.data)&&(d=!0),p&&(l={...l,...p.data},d&&(c.props[`data_${h}`]=l),h+=1)}return(!b.url||e.href!==b.url.href||b.error!==a||i!==void 0&&i!==T.form||d)&&(c.props.page={error:a,params:t,route:{id:(s==null?void 0:s.id)??null},state:{},status:r,url:new URL(e),form:i??null,data:d?l:T.data}),c}async function Oe({loader:e,parent:t,url:n,params:r,route:a,server_data_node:s}){var d,h,y;let i=null,o=!0;const c={dependencies:new Set,params:new Set,parent:!1,route:!1,url:!1,search_params:new Set},l=await e();if((d=l.universal)!=null&&d.load){let f=function(...u){for(const g of u){const{href:_}=new URL(g,n);c.dependencies.add(_)}};const p={tracing:{enabled:!1,root:ze,current:ze},route:new Proxy(a,{get:(u,g)=>(o&&(c.route=!0),u[g])}),params:new Proxy(r,{get:(u,g)=>(o&&c.params.add(g),u[g])}),data:(s==null?void 0:s.data)??null,url:Ft(n,()=>{o&&(c.url=!0)},u=>{o&&c.search_params.add(u)},S.hash),async fetch(u,g){u instanceof Request&&(g={body:u.method==="GET"||u.method==="HEAD"?void 0:await u.blob(),cache:u.cache,credentials:u.credentials,headers:[...u.headers].length>0?u==null?void 0:u.headers:void 0,integrity:u.integrity,keepalive:u.keepalive,method:u.method,mode:u.mode,redirect:u.redirect,referrer:u.referrer,referrerPolicy:u.referrerPolicy,signal:u.signal,...g});const{resolved:_,promise:U}=mt(u,g,n);return o&&f(_.href),U},setHeaders:()=>{},depends:f,parent(){return o&&(c.parent=!0),t()},untrack(u){o=!1;try{return u()}finally{o=!0}}};i=await l.universal.load.call(null,p)??null}return{node:l,loader:e,server:s,universal:(h=l.universal)!=null&&h.load?{type:"data",data:i,uses:c}:null,data:i??(s==null?void 0:s.data)??null,slash:((y=l.universal)==null?void 0:y.trailingSlash)??(s==null?void 0:s.slash)}}function mt(e,t,n){let r=e instanceof Request?e.url:e;const a=new URL(r,n);a.origin===n.origin&&(r=a.href.slice(n.origin.length));const s=oe?Yt(r,a.href,t):Gt(r,t);return{resolved:a,promise:s}}function We(e,t,n,r,a,s){if(Pe)return!0;if(!a)return!1;if(a.parent&&e||a.route&&t||a.url&&n)return!0;for(const i of a.search_params)if(r.has(i))return!0;for(const i of a.params)if(s[i]!==b.params[i])return!0;for(const i of a.dependencies)if(ae.some(o=>o(new URL(i))))return!0;return!1}function Ne(e,t){return(e==null?void 0:e.type)==="data"?e:(e==null?void 0:e.type)==="skip"?t??null:null}function $n(e,t){if(!e)return new Set(t.searchParams.keys());const n=new Set([...e.searchParams.keys(),...t.searchParams.keys()]);for(const r of n){const a=e.searchParams.getAll(r),s=t.searchParams.getAll(r);a.every(i=>s.includes(i))&&s.every(i=>a.includes(i))&&n.delete(r)}return n}function Je({error:e,url:t,route:n,params:r}){return{type:"loaded",state:{error:e,url:t,route:n,params:r,branch:[]},props:{page:De(T),constructors:[]}}}async function _t({id:e,invalidating:t,url:n,params:r,route:a,preload:s}){if((I==null?void 0:I.id)===e)return H.delete(I.token),I.promise;const{errors:i,layouts:o,leaf:c}=a,l=[...o,c];i.forEach(w=>w==null?void 0:w().catch(()=>{})),l.forEach(w=>w==null?void 0:w[1]().catch(()=>{}));let d=null;const h=b.url?e!==ie(b.url):!1,y=b.route?a.id!==b.route.id:!1,f=$n(b.url,n);let p=!1;const u=l.map((w,m)=>{var P;const v=b.branch[m],k=!!(w!=null&&w[0])&&((v==null?void 0:v.loader)!==w[1]||We(p,y,h,f,(P=v.server)==null?void 0:P.uses,r));return k&&(p=!0),k});if(u.some(Boolean)){try{d=await vt(n,u)}catch(w){const m=await V(w,{url:n,params:r,route:{id:e}});return H.has(s)?Je({error:m,url:n,params:r,route:a}):ue({status:te(w),error:m,url:n,route:a})}if(d.type==="redirect")return d}const g=d==null?void 0:d.nodes;let _=!1;const U=l.map(async(w,m)=>{var he;if(!w)return;const v=b.branch[m],k=g==null?void 0:g[m];if((!k||k.type==="skip")&&w[1]===(v==null?void 0:v.loader)&&!We(_,y,h,f,(he=v.universal)==null?void 0:he.uses,r))return v;if(_=!0,(k==null?void 0:k.type)==="error")throw k;return Oe({loader:w[1],url:n,params:r,route:a,parent:async()=>{var Fe;const Be={};for(let pe=0;pe<m;pe+=1)Object.assign(Be,(Fe=await U[pe])==null?void 0:Fe.data);return Be},server_data_node:Ne(k===void 0&&w[0]?{type:"skip"}:k??null,w[0]?v==null?void 0:v.server:void 0)})});for(const w of U)w.catch(()=>{});const E=[];for(let w=0;w<l.length;w+=1)if(l[w])try{E.push(await U[w])}catch(m){if(m instanceof Re)return{type:"redirect",location:m.location};if(H.has(s))return Je({error:await V(m,{params:r,url:n,route:{id:a.id}}),url:n,params:r,route:a});let v=te(m),k;if(g!=null&&g.includes(m))v=m.status??v,k=m.error;else if(m instanceof ce)k=m.body;else{if(await C.updated.check())return await ct(),await q(n);k=await V(m,{params:r,url:n,route:{id:a.id}})}const P=await xn(w,E,i);return P?se({url:n,params:r,branch:E.slice(0,P.idx).concat(P.node),status:v,error:k,route:a}):await yt(n,{id:a.id},k,v)}else E.push(void 0);return se({url:n,params:r,branch:E,status:200,error:null,route:a,form:t?void 0:null})}async function xn(e,t,n){for(;e--;)if(n[e]){let r=e;for(;!t[r];)r-=1;try{return{idx:r+1,node:{node:await n[e](),loader:n[e],data:{},server:null,universal:null}}}catch{continue}}}async function ue({status:e,error:t,url:n,route:r}){const a={};let s=null;if(S.server_loads[0]===0)try{const o=await vt(n,[!0]);if(o.type!=="data"||o.nodes[0]&&o.nodes[0].type!=="data")throw 0;s=o.nodes[0]??null}catch{(n.origin!==Z||n.pathname!==location.pathname||Ce)&&await q(n)}try{const o=await Oe({loader:Se,url:n,params:a,route:r,parent:()=>Promise.resolve({}),server_data_node:Ne(s)}),c={node:await ne(),loader:ne,universal:null,server:null,data:null};return se({url:n,params:a,branch:[o,c],status:e,error:t,route:null})}catch(o){if(o instanceof Re)return pt(new URL(o.location,location.href),{},0);throw o}}async function Cn(e){const t=e.href;if(Q.has(t))return Q.get(t);let n;try{const r=(async()=>{let a=await S.hooks.reroute({url:new URL(e),fetch:async(s,i)=>mt(s,i,e).promise})??e;if(typeof a=="string"){const s=new URL(e);S.hash?s.hash=a:s.pathname=a,a=s}return a})();Q.set(t,r),n=await r}catch{Q.delete(t);return}return n}async function de(e,t){if(e&&!fe(e,$,S.hash)){const n=await Cn(e);if(!n)return;const r=Pn(n);for(const a of xe){const s=a.exec(r);if(s)return{id:ie(e),invalidating:t,route:a,params:Bt(s),url:e}}}}function Pn(e){return Dt(S.hash?e.hash.replace(/^#/,"").replace(/[?#].+/,""):e.pathname.slice($.length))||"/"}function ie(e){return(S.hash?e.hash.replace(/^#/,""):e.pathname)+e.search}function wt({url:e,type:t,intent:n,delta:r,event:a}){let s=!1;const i=je(b,n,e,t);r!==void 0&&(i.navigation.delta=r),a!==void 0&&(i.navigation.event=a);const o={...i.navigation,cancel:()=>{s=!0,i.reject(new Error("navigation cancelled"))}};return X||lt.forEach(c=>c(o)),s?null:i}async function M({type:e,url:t,popped:n,keepfocus:r,noscroll:a,replace_state:s,state:i={},redirect_count:o=0,nav_token:c={},accept:l=Ge,block:d=Ge,event:h}){const y=N;N=c;const f=await de(t,!1),p=e==="enter"?je(b,f,t,e):wt({url:t,type:e,delta:n==null?void 0:n.delta,intent:f,event:h});if(!p){d(),N===c&&(N=y);return}const u=A,g=L;l(),X=!0,oe&&p.navigation.type!=="enter"&&C.navigating.set(W.current=p.navigation);let _=f&&await _t(f);if(!_){if(fe(t,$,S.hash))return await q(t,s);_=await yt(t,{id:null},await V(new Te(404,"Not Found",`Not found: ${t.pathname}`),{url:t,params:{},route:{id:null}}),404,s)}if(t=(f==null?void 0:f.url)||t,N!==c)return p.reject(new Error("navigation aborted")),!1;if(_.type==="redirect"){if(o<20){await M({type:e,url:new URL(_.location,t),popped:n,keepfocus:r,noscroll:a,replace_state:s,state:i,redirect_count:o+1,nav_token:c}),p.fulfil(void 0);return}_=await ue({status:500,error:await V(new Error("Redirect loop"),{url:t,params:{},route:{id:null}}),url:t,route:{id:null}})}else _.props.page.status>=400&&await C.updated.check()&&(await ct(),await q(t,s));if(In(),$e(u),dt(g),_.props.page.url.pathname!==t.pathname&&(t.pathname=_.props.page.url.pathname),i=n?n.state:i,!n){const m=s?0:1,v={[F]:A+=m,[K]:L+=m,[at]:i};(s?history.replaceState:history.pushState).call(history,v,"",t),s||Tn(A,L)}if(I=null,_.props.page.state=i,oe){const m=(await Promise.all(Array.from(Un,v=>v(p.navigation)))).filter(v=>typeof v=="function");if(m.length>0){let v=function(){m.forEach(k=>{Y.delete(k)})};m.push(v),m.forEach(k=>{Y.add(k)})}b=_.state,_.props.page&&(_.props.page.url=t),ut.$set(_.props),vn(_.props.page),ft=!0}else gt(_,Ee,!1);const{activeElement:U}=document;await An();let E=n?n.scroll:a?le():null;if(Ye){const m=t.hash&&document.getElementById(kt(t));if(E)scrollTo(E.x,E.y);else if(m){m.scrollIntoView();const{top:v,left:k}=m.getBoundingClientRect();E={x:pageXOffset+k,y:pageYOffset+v}}else scrollTo(0,0)}const w=document.activeElement!==U&&document.activeElement!==document.body;!r&&!w&&Bn(t,E),Ye=!0,_.props.page&&Object.assign(T,_.props.page),X=!1,e==="popstate"&&ht(L),p.fulfil(void 0),Y.forEach(m=>m(p.navigation)),C.navigating.set(W.current=null)}async function yt(e,t,n,r,a){return e.origin===Z&&e.pathname===location.pathname&&!Ce?await ue({status:r,error:n,url:e,route:t}):await q(e,a)}function On(){let e,t,n;x.addEventListener("mousemove",o=>{const c=o.target;clearTimeout(e),e=setTimeout(()=>{s(c,O.hover)},20)});function r(o){o.defaultPrevented||s(o.composedPath()[0],O.tap)}x.addEventListener("mousedown",r),x.addEventListener("touchstart",r,{passive:!0});const a=new IntersectionObserver(o=>{for(const c of o)c.isIntersecting&&(ye(new URL(c.target.href)),a.unobserve(c.target))},{threshold:0});async function s(o,c){const l=ot(o,x),d=l===t&&c>=n;if(!l||d)return;const{url:h,external:y,download:f}=ke(l,$,S.hash);if(y||f)return;const p=ee(l),u=h&&ie(b.url)===ie(h);if(!(p.reload||u))if(c<=p.preload_data){t=l,n=O.tap;const g=await de(h,!1);if(!g)return;Ln(g)}else c<=p.preload_code&&(t=l,n=c,ye(h))}function i(){a.disconnect();for(const o of x.querySelectorAll("a")){const{url:c,external:l,download:d}=ke(o,$,S.hash);if(l||d)continue;const h=ee(o);h.reload||(h.preload_code===O.viewport&&a.observe(o),h.preload_code===O.eager&&ye(c))}}Y.add(i),i()}function V(e,t){if(e instanceof ce)return e.body;const n=te(e),r=wn(e);return S.hooks.handleError({error:e,event:t,status:n,message:r})??{message:r}}function Kn(e,t={}){return e=new URL(Le(e)),e.origin!==Z?Promise.reject(new Error("goto: invalid URL")):pt(e,t,0)}function Nn(e){if(typeof e=="function")ae.push(e);else{const{href:t}=new URL(e,location.href);ae.push(n=>n.href===t)}}function jn(){var t;history.scrollRestoration="manual",addEventListener("beforeunload",n=>{let r=!1;if(Ke(),!X){const a=je(b,void 0,null,"leave"),s={...a.navigation,cancel:()=>{r=!0,a.reject(new Error("navigation cancelled"))}};lt.forEach(i=>i(s))}r?(n.preventDefault(),n.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&Ke()}),(t=navigator.connection)!=null&&t.saveData||On(),x.addEventListener("click",async n=>{if(n.button||n.which!==1||n.metaKey||n.ctrlKey||n.shiftKey||n.altKey||n.defaultPrevented)return;const r=ot(n.composedPath()[0],x);if(!r)return;const{url:a,external:s,target:i,download:o}=ke(r,$,S.hash);if(!a)return;if(i==="_parent"||i==="_top"){if(window.parent!==window)return}else if(i&&i!=="_self")return;const c=ee(r);if(!(r instanceof SVGAElement)&&a.protocol!==location.protocol&&!(a.protocol==="https:"||a.protocol==="http:")||o)return;const[d,h]=(S.hash?a.hash.replace(/^#/,""):a.href).split("#"),y=d===me(location);if(s||c.reload&&(!y||!h)){wt({url:a,type:"link",event:n})?X=!0:n.preventDefault();return}if(h!==void 0&&y){const[,f]=b.url.href.split("#");if(f===h){if(n.preventDefault(),h===""||h==="top"&&r.ownerDocument.getElementById("top")===null)scrollTo({top:0});else{const p=r.ownerDocument.getElementById(decodeURIComponent(h));p&&(p.scrollIntoView(),p.focus())}return}if(z=!0,$e(A),e(a),!c.replace_state)return;z=!1}n.preventDefault(),await new Promise(f=>{requestAnimationFrame(()=>{setTimeout(f,0)}),setTimeout(f,100)}),await M({type:"link",url:a,keepfocus:c.keepfocus,noscroll:c.noscroll,replace_state:c.replace_state??a.href===location.href,event:n})}),x.addEventListener("submit",n=>{if(n.defaultPrevented)return;const r=HTMLFormElement.prototype.cloneNode.call(n.target),a=n.submitter;if(((a==null?void 0:a.formTarget)||r.target)==="_blank"||((a==null?void 0:a.formMethod)||r.method)!=="get")return;const o=new URL((a==null?void 0:a.hasAttribute("formaction"))&&(a==null?void 0:a.formAction)||r.action);if(fe(o,$,!1))return;const c=n.target,l=ee(c);if(l.reload)return;n.preventDefault(),n.stopPropagation();const d=new FormData(c,a);o.search=new URLSearchParams(d).toString(),M({type:"form",url:o,keepfocus:l.keepfocus,noscroll:l.noscroll,replace_state:l.replace_state??o.href===location.href,event:n})}),addEventListener("popstate",async n=>{var r;if(!Ae){if((r=n.state)!=null&&r[F]){const a=n.state[F];if(N={},a===A)return;const s=j[a],i=n.state[at]??{},o=new URL(n.state[tn]??location.href),c=n.state[K],l=b.url?me(location)===me(b.url):!1;if(c===L&&(ft||l)){i!==T.state&&(T.state=i),e(o),j[A]=le(),s&&scrollTo(s.x,s.y),A=a;return}const h=a-A;await M({type:"popstate",url:o,popped:{state:i,scroll:s,delta:h},accept:()=>{A=a,L=c},block:()=>{history.go(-h)},nav_token:N,event:n})}else if(!z){const a=new URL(location.href);e(a),S.hash&&location.reload()}}}),addEventListener("hashchange",()=>{z&&(z=!1,history.replaceState({...history.state,[F]:++A,[K]:L},"",location.href))});for(const n of document.querySelectorAll("link"))Rn.has(n.rel)&&(n.href=n.href);addEventListener("pageshow",n=>{n.persisted&&C.navigating.set(W.current=null)});function e(n){b.url=T.url=n,C.page.set(De(T)),C.page.notify()}}async function Dn(e,{status:t=200,error:n,node_ids:r,params:a,route:s,server_route:i,data:o,form:c}){Ce=!0;const l=new URL(location.href);let d;({params:a={},route:s={id:null}}=await de(l,!1)||{}),d=xe.find(({id:f})=>f===s.id);let h,y=!0;try{const f=r.map(async(u,g)=>{const _=o[g];return _!=null&&_.uses&&(_.uses=bt(_.uses)),Oe({loader:S.nodes[u],url:l,params:a,route:s,parent:async()=>{const U={};for(let E=0;E<g;E+=1)Object.assign(U,(await f[E]).data);return U},server_data_node:Ne(_)})}),p=await Promise.all(f);if(d){const u=d.layouts;for(let g=0;g<u.length;g++)u[g]||p.splice(g,0,void 0)}h=se({url:l,params:a,branch:p,status:t,error:n,form:c,route:d??null})}catch(f){if(f instanceof Re){await q(new URL(f.location,location.href));return}h=await ue({status:te(f),error:await V(f,{url:l,params:a,route:s}),url:l,route:s}),e.textContent="",y=!1}h.props.page&&(h.props.page.state={}),gt(h,e,y)}async function vt(e,t){var s;const n=new URL(e);n.pathname=Sn(e.pathname),e.pathname.endsWith("/")&&n.searchParams.append(_n,"1"),n.searchParams.append(mn,t.map(i=>i?"1":"0").join(""));const r=window.fetch,a=await r(n.href,{});if(!a.ok){let i;throw(s=a.headers.get("content-type"))!=null&&s.includes("application/json")?i=await a.json():a.status===404?i="Not Found":a.status===500&&(i="Internal Error"),new ce(a.status,i)}return new Promise(async i=>{var h;const o=new Map,c=a.body.getReader();function l(y){return hn(y,{...S.decoders,Promise:f=>new Promise((p,u)=>{o.set(f,{fulfil:p,reject:u})})})}let d="";for(;;){const{done:y,value:f}=await c.read();if(y&&!d)break;for(d+=!f&&d?`
|
| 2 |
+
`:Vt.decode(f,{stream:!0});;){const p=d.indexOf(`
|
| 3 |
+
`);if(p===-1)break;const u=JSON.parse(d.slice(0,p));if(d=d.slice(p+1),u.type==="redirect")return i(u);if(u.type==="data")(h=u.nodes)==null||h.forEach(g=>{(g==null?void 0:g.type)==="data"&&(g.uses=bt(g.uses),g.data=l(g.data))}),i(u);else if(u.type==="chunk"){const{id:g,data:_,error:U}=u,E=o.get(g);o.delete(g),U?E.reject(l(U)):E.fulfil(l(_))}}}})}function bt(e){return{dependencies:new Set((e==null?void 0:e.dependencies)??[]),params:new Set((e==null?void 0:e.params)??[]),parent:!!(e!=null&&e.parent),route:!!(e!=null&&e.route),url:!!(e!=null&&e.url),search_params:new Set((e==null?void 0:e.search_params)??[])}}let Ae=!1;function Bn(e,t=null){const n=document.querySelector("[autofocus]");if(n)n.focus();else{const r=kt(e);if(r&&document.getElementById(r)){const{x:s,y:i}=t??le();setTimeout(()=>{const o=history.state;Ae=!0,location.replace(`#${r}`),S.hash&&location.replace(e.hash),history.replaceState(o,"",e.hash),scrollTo(s,i),Ae=!1})}else{const s=document.body,i=s.getAttribute("tabindex");s.tabIndex=-1,s.focus({preventScroll:!0,focusVisible:!1}),i!==null?s.setAttribute("tabindex",i):s.removeAttribute("tabindex")}const a=getSelection();if(a&&a.type!=="None"){const s=[];for(let i=0;i<a.rangeCount;i+=1)s.push(a.getRangeAt(i));setTimeout(()=>{if(a.rangeCount===s.length){for(let i=0;i<a.rangeCount;i+=1){const o=s[i],c=a.getRangeAt(i);if(o.commonAncestorContainer!==c.commonAncestorContainer||o.startContainer!==c.startContainer||o.endContainer!==c.endContainer||o.startOffset!==c.startOffset||o.endOffset!==c.endOffset)return}a.removeAllRanges()}})}}}function je(e,t,n,r){var c,l;let a,s;const i=new Promise((d,h)=>{a=d,s=h});return i.catch(()=>{}),{navigation:{from:{params:e.params,route:{id:((c=e.route)==null?void 0:c.id)??null},url:e.url},to:n&&{params:(t==null?void 0:t.params)??null,route:{id:((l=t==null?void 0:t.route)==null?void 0:l.id)??null},url:n},willUnload:!t,type:r,complete:i},fulfil:a,reject:s}}function De(e){return{data:e.data,error:e.error,form:e.form,params:e.params,route:e.route,state:e.state,status:e.status,url:e.url}}function Fn(e){const t=new URL(e);return t.hash=decodeURIComponent(e.hash),t}function kt(e){let t;if(S.hash){const[,,n]=e.hash.split("#",3);t=n??""}else t=e.hash.slice(1);return decodeURIComponent(t)}export{Hn as a,Kn as g,qn as l,C as s};
|
hfstudio/static/_app/immutable/chunks/DOFcFfVQ.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
import{s as e}from"./CB1vOLR2.js";const r=()=>{const s=e;return{page:{subscribe:s.page.subscribe},navigating:{subscribe:s.navigating.subscribe},updated:s.updated}},b={subscribe(s){return r().page.subscribe(s)}};export{b as p};
|
hfstudio/static/_app/immutable/entry/app.B18cP-tp.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0._eVrFTiQ.js","../chunks/BI_gvUUO.js","../chunks/IHki7fMi.js","../assets/0.BuN4nQsJ.css","../nodes/1.D3aD59tB.js","../chunks/DOFcFfVQ.js","../chunks/CB1vOLR2.js","../nodes/2.aVyilnly.js","../nodes/3.CqKlOYDp.js"])))=>i.map(i=>d[i]);
|
| 2 |
+
import{S as C,i as q,s as B,d,x as h,y as g,D as S,E as A,b as E,h as U,F as w,k as F,G,r as H,H as J,I as y,J as P,K as R,L,M as N,o as D,N as p,e as K,f as W,j as z,O as I,a as Q,g as X,t as Y}from"../chunks/BI_gvUUO.js";import"../chunks/IHki7fMi.js";const Z="modulepreload",M=function(o,e){return new URL(o,e).href},T={},O=function(e,n,i){let r=Promise.resolve();if(n&&n.length>0){const t=document.getElementsByTagName("link"),s=document.querySelector("meta[property=csp-nonce]"),a=(s==null?void 0:s.nonce)||(s==null?void 0:s.getAttribute("nonce"));r=Promise.allSettled(n.map(f=>{if(f=M(f,i),f in T)return;T[f]=!0;const l=f.endsWith(".css"),_=l?'[rel="stylesheet"]':"";if(!!i)for(let k=t.length-1;k>=0;k--){const v=t[k];if(v.href===f&&(!l||v.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${f}"]${_}`))return;const m=document.createElement("link");if(m.rel=l?"stylesheet":Z,l||(m.as="script"),m.crossOrigin="",m.href=f,a&&m.setAttribute("nonce",a),document.head.appendChild(m),l)return new Promise((k,v)=>{m.addEventListener("load",k),m.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${f}`)))})}))}function u(t){const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=t,window.dispatchEvent(s),!s.defaultPrevented)throw t}return r.then(t=>{for(const s of t||[])s.status==="rejected"&&u(s.reason);return e().catch(u)})},ae={};function $(o){let e,n,i;var r=o[2][0];function u(t,s){return{props:{data:t[4],form:t[3],params:t[1].params}}}return r&&(e=y(r,u(o)),o[12](e)),{c(){e&&R(e.$$.fragment),n=w()},l(t){e&&N(e.$$.fragment,t),n=w()},m(t,s){e&&L(e,t,s),E(t,n,s),i=!0},p(t,s){if(s&4&&r!==(r=t[2][0])){if(e){S();const a=e;h(a.$$.fragment,1,0,()=>{P(a,1)}),A()}r?(e=y(r,u(t)),t[12](e),R(e.$$.fragment),g(e.$$.fragment,1),L(e,n.parentNode,n)):e=null}else if(r){const a={};s&16&&(a.data=t[4]),s&8&&(a.form=t[3]),s&2&&(a.params=t[1].params),e.$set(a)}},i(t){i||(e&&g(e.$$.fragment,t),i=!0)},o(t){e&&h(e.$$.fragment,t),i=!1},d(t){t&&d(n),o[12](null),e&&P(e,t)}}}function x(o){let e,n,i;var r=o[2][0];function u(t,s){return{props:{data:t[4],params:t[1].params,$$slots:{default:[ee]},$$scope:{ctx:t}}}}return r&&(e=y(r,u(o)),o[11](e)),{c(){e&&R(e.$$.fragment),n=w()},l(t){e&&N(e.$$.fragment,t),n=w()},m(t,s){e&&L(e,t,s),E(t,n,s),i=!0},p(t,s){if(s&4&&r!==(r=t[2][0])){if(e){S();const a=e;h(a.$$.fragment,1,0,()=>{P(a,1)}),A()}r?(e=y(r,u(t)),t[11](e),R(e.$$.fragment),g(e.$$.fragment,1),L(e,n.parentNode,n)):e=null}else if(r){const a={};s&16&&(a.data=t[4]),s&2&&(a.params=t[1].params),s&8239&&(a.$$scope={dirty:s,ctx:t}),e.$set(a)}},i(t){i||(e&&g(e.$$.fragment,t),i=!0)},o(t){e&&h(e.$$.fragment,t),i=!1},d(t){t&&d(n),o[11](null),e&&P(e,t)}}}function ee(o){let e,n,i;var r=o[2][1];function u(t,s){return{props:{data:t[5],form:t[3],params:t[1].params}}}return r&&(e=y(r,u(o)),o[10](e)),{c(){e&&R(e.$$.fragment),n=w()},l(t){e&&N(e.$$.fragment,t),n=w()},m(t,s){e&&L(e,t,s),E(t,n,s),i=!0},p(t,s){if(s&4&&r!==(r=t[2][1])){if(e){S();const a=e;h(a.$$.fragment,1,0,()=>{P(a,1)}),A()}r?(e=y(r,u(t)),t[10](e),R(e.$$.fragment),g(e.$$.fragment,1),L(e,n.parentNode,n)):e=null}else if(r){const a={};s&32&&(a.data=t[5]),s&8&&(a.form=t[3]),s&2&&(a.params=t[1].params),e.$set(a)}},i(t){i||(e&&g(e.$$.fragment,t),i=!0)},o(t){e&&h(e.$$.fragment,t),i=!1},d(t){t&&d(n),o[10](null),e&&P(e,t)}}}function V(o){let e,n=o[7]&&j(o);return{c(){e=z("div"),n&&n.c(),this.h()},l(i){e=K(i,"DIV",{id:!0,"aria-live":!0,"aria-atomic":!0,style:!0});var r=W(e);n&&n.l(r),r.forEach(d),this.h()},h(){D(e,"id","svelte-announcer"),D(e,"aria-live","assertive"),D(e,"aria-atomic","true"),p(e,"position","absolute"),p(e,"left","0"),p(e,"top","0"),p(e,"clip","rect(0 0 0 0)"),p(e,"clip-path","inset(50%)"),p(e,"overflow","hidden"),p(e,"white-space","nowrap"),p(e,"width","1px"),p(e,"height","1px")},m(i,r){E(i,e,r),n&&n.m(e,null)},p(i,r){i[7]?n?n.p(i,r):(n=j(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},d(i){i&&d(e),n&&n.d()}}}function j(o){let e;return{c(){e=Y(o[8])},l(n){e=X(n,o[8])},m(n,i){E(n,e,i)},p(n,i){i&256&&Q(e,n[8])},d(n){n&&d(e)}}}function te(o){let e,n,i,r,u;const t=[x,$],s=[];function a(l,_){return l[2][1]?0:1}e=a(o),n=s[e]=t[e](o);let f=o[6]&&V(o);return{c(){n.c(),i=F(),f&&f.c(),r=w()},l(l){n.l(l),i=U(l),f&&f.l(l),r=w()},m(l,_){s[e].m(l,_),E(l,i,_),f&&f.m(l,_),E(l,r,_),u=!0},p(l,[_]){let b=e;e=a(l),e===b?s[e].p(l,_):(S(),h(s[b],1,1,()=>{s[b]=null}),A(),n=s[e],n?n.p(l,_):(n=s[e]=t[e](l),n.c()),g(n,1),n.m(i.parentNode,i)),l[6]?f?f.p(l,_):(f=V(l),f.c(),f.m(r.parentNode,r)):f&&(f.d(1),f=null)},i(l){u||(g(n),u=!0)},o(l){h(n),u=!1},d(l){l&&(d(i),d(r)),s[e].d(l),f&&f.d(l)}}}function ne(o,e,n){let{stores:i}=e,{page:r}=e,{constructors:u}=e,{components:t=[]}=e,{form:s}=e,{data_0:a=null}=e,{data_1:f=null}=e;G(i.page.notify);let l=!1,_=!1,b=null;H(()=>{const c=i.page.subscribe(()=>{l&&(n(7,_=!0),J().then(()=>{n(8,b=document.title||"untitled page")}))});return n(6,l=!0),c});function m(c){I[c?"unshift":"push"](()=>{t[1]=c,n(0,t)})}function k(c){I[c?"unshift":"push"](()=>{t[0]=c,n(0,t)})}function v(c){I[c?"unshift":"push"](()=>{t[0]=c,n(0,t)})}return o.$$set=c=>{"stores"in c&&n(9,i=c.stores),"page"in c&&n(1,r=c.page),"constructors"in c&&n(2,u=c.constructors),"components"in c&&n(0,t=c.components),"form"in c&&n(3,s=c.form),"data_0"in c&&n(4,a=c.data_0),"data_1"in c&&n(5,f=c.data_1)},o.$$.update=()=>{o.$$.dirty&514&&i.page.set(r)},[t,r,u,s,a,f,l,_,b,i,m,k,v]}class le extends C{constructor(e){super(),q(this,e,ne,te,B,{stores:9,page:1,constructors:2,components:0,form:3,data_0:4,data_1:5})}}const fe=[()=>O(()=>import("../nodes/0._eVrFTiQ.js"),__vite__mapDeps([0,1,2,3]),import.meta.url),()=>O(()=>import("../nodes/1.D3aD59tB.js"),__vite__mapDeps([4,1,2,5,6]),import.meta.url),()=>O(()=>import("../nodes/2.aVyilnly.js"),__vite__mapDeps([7,1,2]),import.meta.url),()=>O(()=>import("../nodes/3.CqKlOYDp.js"),__vite__mapDeps([8,1,2,6,5]),import.meta.url)],ce=[],ue={"/":[2],"/auth/callback":[3]},se={handleError:({error:o})=>{console.error(o)},reroute:()=>{},transport:{}},ie=Object.fromEntries(Object.entries(se.transport).map(([o,e])=>[o,e.decode])),_e=!1,me=(o,e)=>ie[o](e);export{me as decode,ie as decoders,ue as dictionary,_e as hash,se as hooks,ae as matchers,fe as nodes,le as root,ce as server_loads};
|
hfstudio/static/_app/immutable/entry/start.7dRPTxlt.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
import{l as o,a as r}from"../chunks/CB1vOLR2.js";export{o as load_css,r as start};
|
hfstudio/static/_app/immutable/nodes/0._eVrFTiQ.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import{S as we,i as Te,s as Ce,v as Le,d as v,w as ye,x as Ie,y as Ee,o as r,z as Se,A as He,B as Me,b as X,c as s,u as te,m as Ne,e as i,f as N,q as I,h as k,j as c,k as x,r as Ae,C as be,a as ge,g as se,t as ne,n as Ue}from"../chunks/BI_gvUUO.js";import"../chunks/IHki7fMi.js";function Pe(u){let t,e="Sign In";return{c(){t=c("span"),t.textContent=e},l(l){t=i(l,"SPAN",{"data-svelte-h":!0}),I(t)!=="svelte-6n3gky"&&(t.textContent=e)},m(l,f){X(l,t,f)},p:Ue,d(l){l&&v(t)}}}function Be(u){let t,e,l;return{c(){t=c("span"),e=ne("Sign Out, "),l=ne(u[2])},l(f){t=i(f,"SPAN",{});var b=N(t);e=se(b,"Sign Out, "),l=se(b,u[2]),b.forEach(v)},m(f,b){X(f,t,b),s(t,e),s(t,l)},p(f,b){b&4&&ge(l,f[2])},d(f){f&&v(t)}}}function De(u){let t,e,l=u[1]?"logged in":"not logged in",f,b;return{c(){t=c("span"),e=ne("Checking... ("),f=ne(l),b=ne(")")},l(n){t=i(n,"SPAN",{});var a=N(t);e=se(a,"Checking... ("),f=se(a,l),b=se(a,")"),a.forEach(v)},m(n,a){X(n,t,a),s(t,e),s(t,f),s(t,b)},p(n,a){a&2&&l!==(l=n[1]?"logged in":"not logged in")&&ge(f,l)},d(n){n&&v(t)}}}function ve(u){let t,e,l,f="Sign In with HuggingFace Token",b,n,a,z="<strong>Manual Token Entry:</strong> Please enter your HuggingFace token.",L,d,A=`1. Go to <a href="https://huggingface.co/settings/tokens" target="_blank" class="underline text-blue-600">HuggingFace Settings</a><br/>
|
| 2 |
+
2. Create a new token with "Inference API" permissions<br/>
|
| 3 |
+
3. Copy and paste it below`,G,R,m,B,W="HuggingFace Token",q,_,J,Y,y,o,g="Cancel",w,D,Z="Sign In",O,le,T=u[6]&&ke(),h=u[5]&&xe(u);return{c(){t=c("div"),e=c("div"),l=c("h2"),l.textContent=f,b=x(),n=c("div"),a=c("p"),a.innerHTML=z,L=x(),d=c("p"),d.innerHTML=A,G=x(),T&&T.c(),R=x(),m=c("div"),B=c("label"),B.textContent=W,q=x(),_=c("input"),J=x(),h&&h.c(),Y=x(),y=c("div"),o=c("button"),o.textContent=g,w=x(),D=c("button"),D.textContent=Z,this.h()},l(H){t=i(H,"DIV",{class:!0});var V=N(t);e=i(V,"DIV",{class:!0});var M=N(e);l=i(M,"H2",{class:!0,"data-svelte-h":!0}),I(l)!=="svelte-1t0ehet"&&(l.textContent=f),b=k(M),n=i(M,"DIV",{class:!0});var C=N(n);a=i(C,"P",{class:!0,"data-svelte-h":!0}),I(a)!=="svelte-344vn4"&&(a.innerHTML=z),L=k(C),d=i(C,"P",{class:!0,"data-svelte-h":!0}),I(d)!=="svelte-1ffvpx3"&&(d.innerHTML=A),G=k(C),T&&T.l(C),C.forEach(v),R=k(M),m=i(M,"DIV",{class:!0});var U=N(m);B=i(U,"LABEL",{for:!0,class:!0,"data-svelte-h":!0}),I(B)!=="svelte-vtbmxo"&&(B.textContent=W),q=k(U),_=i(U,"INPUT",{id:!0,type:!0,placeholder:!0,class:!0}),J=k(U),h&&h.l(U),U.forEach(v),Y=k(M),y=i(M,"DIV",{class:!0});var Q=N(y);o=i(Q,"BUTTON",{class:!0,"data-svelte-h":!0}),I(o)!=="svelte-csk0rj"&&(o.textContent=g),w=k(Q),D=i(Q,"BUTTON",{class:!0,"data-svelte-h":!0}),I(D)!=="svelte-1nxas5u"&&(D.textContent=Z),Q.forEach(v),M.forEach(v),V.forEach(v),this.h()},h(){r(l,"class","text-xl font-semibold mb-4"),r(a,"class","text-blue-800 mb-2"),r(d,"class","text-blue-700"),r(n,"class","mb-4 p-3 bg-blue-50 rounded-md text-sm"),r(B,"for","token"),r(B,"class","block text-sm font-medium text-gray-700 mb-2"),r(_,"id","token"),r(_,"type","password"),r(_,"placeholder","hf_..."),r(_,"class","w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-orange-500 focus:border-transparent"),r(m,"class","mb-4"),r(o,"class","px-4 py-2 text-gray-600 hover:text-gray-800 transition-colors"),r(D,"class","px-4 py-2 bg-orange-500 text-white rounded-md hover:bg-orange-600 transition-colors"),r(y,"class","flex justify-end gap-3"),r(e,"class","bg-white rounded-lg p-6 max-w-md w-full mx-4 shadow-xl"),r(t,"class","fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50")},m(H,V){X(H,t,V),s(t,e),s(e,l),s(e,b),s(e,n),s(n,a),s(n,L),s(n,d),s(n,G),T&&T.m(n,null),s(e,R),s(e,m),s(m,B),s(m,q),s(m,_),be(_,u[4]),s(m,J),h&&h.m(m,null),s(e,Y),s(e,y),s(y,o),s(y,w),s(y,D),O||(le=[te(_,"input",u[14]),te(_,"keydown",u[15]),te(o,"click",u[9]),te(D,"click",u[10])],O=!0)},p(H,V){H[6]?T||(T=ke(),T.c(),T.m(n,null)):T&&(T.d(1),T=null),V&16&&_.value!==H[4]&&be(_,H[4]),H[5]?h?h.p(H,V):(h=xe(H),h.c(),h.m(m,null)):h&&(h.d(1),h=null)},d(H){H&&v(t),T&&T.d(),h&&h.d(),O=!1,ye(le)}}}function ke(u){let t,e="<strong>Tip:</strong> You can also run <code>huggingface-cli login</code> in your terminal to automatically use your local token.";return{c(){t=c("p"),t.innerHTML=e,this.h()},l(l){t=i(l,"P",{class:!0,"data-svelte-h":!0}),I(t)!=="svelte-1gg2uwy"&&(t.innerHTML=e),this.h()},h(){r(t,"class","text-blue-600 mt-2")},m(l,f){X(l,t,f)},d(l){l&&v(t)}}}function xe(u){let t,e;return{c(){t=c("p"),e=ne(u[5]),this.h()},l(l){t=i(l,"P",{class:!0});var f=N(t);e=se(f,u[5]),f.forEach(v),this.h()},h(){r(t,"class","text-red-600 text-sm mt-1")},m(l,f){X(l,t,f),s(t,e)},p(l,f){f&32&&ge(e,l[5])},d(l){l&&v(t)}}}function je(u){let t,e,l,f='<div class="flex items-center gap-3"><img src="/assets/hf-studio-logo.png" alt="HF Logo" class="w-8 h-8"/> <h1 class="text-xl font-semibold">HFStudio<sup class="text-xs text-gray-500 ml-1">BETA</sup></h1></div>',b,n,a,z="Tasks",L,d,A,G="🎙️",R,m,B="Text to Speech",W,q,_,J="<span>🎵</span> <span>Voice Cloning</span>",Y,y,o="<span>🎧</span> <span>Speech to Text</span>",g,w,D="<span>🎼</span> <span>Sound Effects</span>",Z,O,le="<span>🎸</span> <span>Music Generation</span>",T,h,H="<span>🔊</span> <span>Audio Enhancement</span>",V,M,C,U,Q,ie,ce,$,ue,K,fe,pe;function he(p,S){return p[7]?De:p[1]?Be:Pe}let oe=he(u),F=oe(u);const de=u[12].default,j=Le(de,u,u[11],null);let E=u[3]&&ve(u);return{c(){t=c("div"),e=c("aside"),l=c("div"),l.innerHTML=f,b=x(),n=c("nav"),a=c("div"),a.textContent=z,L=x(),d=c("button"),A=c("span"),A.textContent=G,R=x(),m=c("span"),m.textContent=B,q=x(),_=c("button"),_.innerHTML=J,Y=x(),y=c("button"),y.innerHTML=o,g=x(),w=c("button"),w.innerHTML=D,Z=x(),O=c("button"),O.innerHTML=le,T=x(),h=c("button"),h.innerHTML=H,V=x(),M=c("div"),C=c("button"),U=c("img"),ie=x(),F.c(),ce=x(),$=c("main"),j&&j.c(),ue=x(),E&&E.c(),this.h()},l(p){t=i(p,"DIV",{class:!0});var S=N(t);e=i(S,"ASIDE",{class:!0});var ee=N(e);l=i(ee,"DIV",{class:!0,"data-svelte-h":!0}),I(l)!=="svelte-1vahj38"&&(l.innerHTML=f),b=k(ee),n=i(ee,"NAV",{class:!0});var P=N(n);a=i(P,"DIV",{class:!0,"data-svelte-h":!0}),I(a)!=="svelte-1x5465q"&&(a.textContent=z),L=k(P),d=i(P,"BUTTON",{class:!0});var ae=N(d);A=i(ae,"SPAN",{"data-svelte-h":!0}),I(A)!=="svelte-1yx42xi"&&(A.textContent=G),R=k(ae),m=i(ae,"SPAN",{"data-svelte-h":!0}),I(m)!=="svelte-2j89jk"&&(m.textContent=B),ae.forEach(v),q=k(P),_=i(P,"BUTTON",{class:!0,"data-svelte-h":!0}),I(_)!=="svelte-10dl8nf"&&(_.innerHTML=J),Y=k(P),y=i(P,"BUTTON",{class:!0,"data-svelte-h":!0}),I(y)!=="svelte-wf0x5d"&&(y.innerHTML=o),g=k(P),w=i(P,"BUTTON",{class:!0,"data-svelte-h":!0}),I(w)!=="svelte-x7bha3"&&(w.innerHTML=D),Z=k(P),O=i(P,"BUTTON",{class:!0,"data-svelte-h":!0}),I(O)!=="svelte-1tyblmt"&&(O.innerHTML=le),T=k(P),h=i(P,"BUTTON",{class:!0,"data-svelte-h":!0}),I(h)!=="svelte-1emrjb3"&&(h.innerHTML=H),P.forEach(v),V=k(ee),M=i(ee,"DIV",{class:!0});var me=N(M);C=i(me,"BUTTON",{class:!0});var re=N(C);U=i(re,"IMG",{src:!0,alt:!0,class:!0}),ie=k(re),F.l(re),re.forEach(v),me.forEach(v),ee.forEach(v),ce=k(S),$=i(S,"MAIN",{class:!0});var _e=N($);j&&j.l(_e),_e.forEach(v),ue=k(S),E&&E.l(S),S.forEach(v),this.h()},h(){r(l,"class","p-4 border-b border-gray-200"),r(a,"class","mt-2 mb-1 px-2 text-xs font-medium text-gray-500 uppercase"),r(d,"class",W="w-full flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-gray-100 transition-colors text-left "+(u[0]==="tts"?"bg-gray-100":"")),r(_,"class","w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left opacity-40 cursor-not-allowed"),_.disabled=!0,r(y,"class","w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left opacity-40 cursor-not-allowed"),y.disabled=!0,r(w,"class","w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left opacity-40 cursor-not-allowed"),w.disabled=!0,r(O,"class","w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left opacity-40 cursor-not-allowed"),O.disabled=!0,r(h,"class","w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left opacity-40 cursor-not-allowed"),h.disabled=!0,r(n,"class","p-2 text-sm"),Ne(U.src,Q="/assets/hf-logo.png")||r(U,"src",Q),r(U,"alt","HF Logo"),r(U,"class","w-5 h-5"),C.disabled=u[7],r(C,"class","w-full px-6 py-3 bg-black text-white rounded-lg font-medium hover:bg-gray-800 transition-colors shadow-sm flex items-center justify-center gap-2 text-sm disabled:opacity-50 disabled:cursor-not-allowed"),r(M,"class","absolute bottom-4 left-2 right-2 w-52"),r(e,"class","w-56 border-r border-gray-200 bg-white flex-shrink-0 "),r($,"class","flex-1 overflow-auto"),r(t,"class","flex h-screen bg-white")},m(p,S){X(p,t,S),s(t,e),s(e,l),s(e,b),s(e,n),s(n,a),s(n,L),s(n,d),s(d,A),s(d,R),s(d,m),s(n,q),s(n,_),s(n,Y),s(n,y),s(n,g),s(n,w),s(n,Z),s(n,O),s(n,T),s(n,h),s(e,V),s(e,M),s(M,C),s(C,U),s(C,ie),F.m(C,null),s(t,ce),s(t,$),j&&j.m($,null),s(t,ue),E&&E.m(t,null),K=!0,fe||(pe=[te(d,"click",u[13]),te(C,"click",u[8])],fe=!0)},p(p,[S]){(!K||S&1&&W!==(W="w-full flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-gray-100 transition-colors text-left "+(p[0]==="tts"?"bg-gray-100":"")))&&r(d,"class",W),oe===(oe=he(p))&&F?F.p(p,S):(F.d(1),F=oe(p),F&&(F.c(),F.m(C,null))),(!K||S&128)&&(C.disabled=p[7]),j&&j.p&&(!K||S&2048)&&Se(j,de,p,p[11],K?Me(de,p[11],S,null):He(p[11]),null),p[3]?E?E.p(p,S):(E=ve(p),E.c(),E.m(t,null)):E&&(E.d(1),E=null)},i(p){K||(Ee(j,p),K=!0)},o(p){Ie(j,p),K=!1},d(p){p&&v(t),F.d(),j&&j.d(p),E&&E.d(),fe=!1,ye(pe)}}}function Oe(u,t,e){let{$$slots:l={},$$scope:f}=t,b="tts",n=!1,a="",z=!1,L="",d="",A=!1,G=!0;Ae(()=>{console.log("onMount called - starting auth check"),R(),m(),document.addEventListener("visibilitychange",()=>{document.hidden||m()}),window.addEventListener("storage",m);const o=setInterval(m,1e3);return()=>{window.removeEventListener("storage",m),clearInterval(o)}});async function R(){try{console.log("Checking local token availability...");const g=await(await fetch("/api/auth/local-token")).json();console.log("Local token response:",g),g.available?(e(6,A=!0),localStorage.setItem("hf_access_token",g.token),console.log("Set local token in localStorage"),g.user_info&&g.user_info.name!=="Local User"?(e(1,n=!0),e(2,a=g.user_info.name.split(" ")[0]),console.log("Logged in with user info:",a)):(e(1,n=!0),e(2,a="Local User"),console.log("Logged in with local token (validation skipped due to rate limiting)"),console.log("isLoggedIn set to:",n,"username set to:",a))):(e(6,A=!1),console.log("No local token available"))}catch(o){console.log("Could not check local token availability:",o),e(6,A=!1)}finally{e(7,G=!1),console.log("Finished checking auth, isLoggedIn:",n)}}function m(){const o=localStorage.getItem("hf_access_token");o&&!n?B(o):o||(e(1,n=!1),e(2,a=""))}async function B(o){try{console.log("Fetching user info for token:",o.substring(0,10)+"...");const g=await fetch("https://huggingface.co/api/whoami-v2",{headers:{Authorization:`Bearer ${o}`}});if(g.ok){const w=await g.json();e(1,n=!0);const D=w.name||w.fullname||w.login||w.username||"User";e(2,a=D.split(" ")[0]),console.log("Successfully fetched user info:",a)}else localStorage.removeItem("hf_access_token"),e(1,n=!1),e(2,a=""),console.log("Token validation failed:",g.status)}catch(g){localStorage.removeItem("hf_access_token"),e(1,n=!1),e(2,a=""),console.log("Error fetching user info:",g)}}async function W(){if(n)localStorage.removeItem("hf_access_token"),sessionStorage.removeItem("oauth_state"),e(1,n=!1),e(2,a="");else if(window.location.hostname.includes("hf.space")||window.location.hostname.includes("huggingface.co")){const o=`https://huggingface.co/oauth/authorize?client_id=cdf32a17-e40f-4a84-b683-f66aa1105793&redirect_uri=${encodeURIComponent(window.location.origin+"/auth/callback")}&scope=openid profile&response_type=code&state=${Date.now()}`;window.location.href=o}else e(3,z=!0),e(4,L=""),e(5,d="")}function q(){e(3,z=!1),e(4,L=""),e(5,d="")}async function _(){if(!L.trim()){e(5,d="Please enter a token");return}if(!L.startsWith("hf_")){e(5,d='Token should start with "hf_"');return}try{const o=await fetch("https://huggingface.co/api/whoami-v2",{headers:{Authorization:`Bearer ${L.trim()}`}});if(o.ok){const g=await o.json();localStorage.setItem("hf_access_token",L.trim()),e(1,n=!0);const w=g.name||g.fullname||g.login||g.username||"User";e(2,a=w.split(" ")[0]),q()}else{const g=await o.text();console.log("Token validation error:",o.status,g),e(5,d=`Invalid token (${o.status}). Please check your token and try again.`)}}catch(o){console.error("Token validation error:",o),e(5,d="Error validating token. Please try again.")}}const J=()=>e(0,b="tts");function Y(){L=this.value,e(4,L)}const y=o=>o.key==="Enter"&&_();return u.$$set=o=>{"$$scope"in o&&e(11,f=o.$$scope)},[b,n,a,z,L,d,A,G,W,q,_,f,l,J,Y,y]}class qe extends we{constructor(t){super(),Te(this,t,Oe,je,Ce,{})}}export{qe as component};
|
hfstudio/static/_app/immutable/nodes/1.D3aD59tB.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
import{S as x,i as S,s as j,n as u,d as c,a as h,b as _,c as d,e as v,f as g,g as b,h as k,j as E,t as $,k as q,l as y}from"../chunks/BI_gvUUO.js";import"../chunks/IHki7fMi.js";import{p as C}from"../chunks/DOFcFfVQ.js";function H(p){var f;let a,s=p[0].status+"",r,n,o,i=((f=p[0].error)==null?void 0:f.message)+"",m;return{c(){a=E("h1"),r=$(s),n=q(),o=E("p"),m=$(i)},l(e){a=v(e,"H1",{});var t=g(a);r=b(t,s),t.forEach(c),n=k(e),o=v(e,"P",{});var l=g(o);m=b(l,i),l.forEach(c)},m(e,t){_(e,a,t),d(a,r),_(e,n,t),_(e,o,t),d(o,m)},p(e,[t]){var l;t&1&&s!==(s=e[0].status+"")&&h(r,s),t&1&&i!==(i=((l=e[0].error)==null?void 0:l.message)+"")&&h(m,i)},i:u,o:u,d(e){e&&(c(a),c(n),c(o))}}}function P(p,a,s){let r;return y(p,C,n=>s(0,r=n)),[r]}class B extends x{constructor(a){super(),S(this,a,P,H,j,{})}}export{B as component};
|
hfstudio/static/_app/immutable/nodes/2.aVyilnly.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import{S as Me,i as He,s as Pe,v as Qe,P as S,d as u,Q as ol,x as y,y as $,z as Ye,A as Ze,B as et,R as rl,b as ie,c as a,T as xl,f as m,F as At,U as Ul,V as gl,W as te,J as R,L as K,M as J,K as X,w as al,o as c,E as Wt,u as F,e as f,g as C,h as v,j as d,t as P,k,D as qt,C as kt,a as dt,q as Xe,n as Tt,O as jl,X as sl,N as Kt,m as _l}from"../chunks/BI_gvUUO.js";import"../chunks/IHki7fMi.js";function Vt(o){return(o==null?void 0:o.length)!==void 0?o:Array.from(o)}function Fe(o,e){const s={},t={},l={$$scope:1};let n=o.length;for(;n--;){const r=o[n],i=e[n];if(i){for(const h in r)h in i||(t[h]=1);for(const h in i)l[h]||(s[h]=i[h],l[h]=1);o[n]=i}else for(const h in r)l[h]=1}for(const r in t)r in s||(s[r]=void 0);return s}function mt(o){return typeof o=="object"&&o!==null?o:{}}/**
|
| 2 |
+
* @license lucide-svelte v0.303.0 - ISC
|
| 3 |
+
|
| 4 |
+
This source code is licensed under the ISC license.
|
| 5 |
+
See the LICENSE file in the root directory of this source tree.
|
| 6 |
+
*/const pl={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};function bl(o,e,s){const t=o.slice();return t[10]=e[s][0],t[11]=e[s][1],t}function fl(o){let e,s=[o[11]],t={};for(let l=0;l<s.length;l+=1)t=S(t,s[l]);return{c(){e=Ul(o[10]),this.h()},l(l){e=xl(l,o[10],{}),m(e).forEach(u),this.h()},h(){rl(e,t)},m(l,n){ie(l,e,n)},p(l,n){rl(e,t=Fe(s,[n&32&&l[11]]))},d(l){l&&u(e)}}}function vl(o){let e=o[10],s,t=o[10]&&fl(o);return{c(){t&&t.c(),s=At()},l(l){t&&t.l(l),s=At()},m(l,n){t&&t.m(l,n),ie(l,s,n)},p(l,n){l[10]?e?Pe(e,l[10])?(t.d(1),t=fl(l),e=l[10],t.c(),t.m(s.parentNode,s)):t.p(l,n):(t=fl(l),e=l[10],t.c(),t.m(s.parentNode,s)):e&&(t.d(1),t=null,e=l[10])},d(l){l&&u(s),t&&t.d(l)}}}function zl(o){let e,s,t,l,n,r=Vt(o[5]),i=[];for(let g=0;g<r.length;g+=1)i[g]=vl(bl(o,r,g));const h=o[9].default,E=Qe(h,o,o[8],null);let N=[pl,o[6],{width:o[2]},{height:o[2]},{stroke:o[1]},{"stroke-width":t=o[4]?Number(o[3])*24/Number(o[2]):o[3]},{class:l=`lucide-icon lucide lucide-${o[0]} ${o[7].class??""}`}],I={};for(let g=0;g<N.length;g+=1)I=S(I,N[g]);return{c(){e=Ul("svg");for(let g=0;g<i.length;g+=1)i[g].c();s=At(),E&&E.c(),this.h()},l(g){e=xl(g,"svg",{width:!0,height:!0,stroke:!0,"stroke-width":!0,class:!0});var p=m(e);for(let b=0;b<i.length;b+=1)i[b].l(p);s=At(),E&&E.l(p),p.forEach(u),this.h()},h(){rl(e,I)},m(g,p){ie(g,e,p);for(let b=0;b<i.length;b+=1)i[b]&&i[b].m(e,null);a(e,s),E&&E.m(e,null),n=!0},p(g,[p]){if(p&32){r=Vt(g[5]);let b;for(b=0;b<r.length;b+=1){const D=bl(g,r,b);i[b]?i[b].p(D,p):(i[b]=vl(D),i[b].c(),i[b].m(e,s))}for(;b<i.length;b+=1)i[b].d(1);i.length=r.length}E&&E.p&&(!n||p&256)&&Ye(E,h,g,g[8],n?et(h,g[8],p,null):Ze(g[8]),null),rl(e,I=Fe(N,[pl,p&64&&g[6],(!n||p&4)&&{width:g[2]},(!n||p&4)&&{height:g[2]},(!n||p&2)&&{stroke:g[1]},(!n||p&28&&t!==(t=g[4]?Number(g[3])*24/Number(g[2]):g[3]))&&{"stroke-width":t},(!n||p&129&&l!==(l=`lucide-icon lucide lucide-${g[0]} ${g[7].class??""}`))&&{class:l}]))},i(g){n||($(E,g),n=!0)},o(g){y(E,g),n=!1},d(g){g&&u(e),ol(i,g),E&&E.d(g)}}}function Ll(o,e,s){const t=["name","color","size","strokeWidth","absoluteStrokeWidth","iconNode"];let l=gl(e,t),{$$slots:n={},$$scope:r}=e,{name:i}=e,{color:h="currentColor"}=e,{size:E=24}=e,{strokeWidth:N=2}=e,{absoluteStrokeWidth:I=!1}=e,{iconNode:g}=e;return o.$$set=p=>{s(7,e=S(S({},e),te(p))),s(6,l=gl(e,t)),"name"in p&&s(0,i=p.name),"color"in p&&s(1,h=p.color),"size"in p&&s(2,E=p.size),"strokeWidth"in p&&s(3,N=p.strokeWidth),"absoluteStrokeWidth"in p&&s(4,I=p.absoluteStrokeWidth),"iconNode"in p&&s(5,g=p.iconNode),"$$scope"in p&&s(8,r=p.$$scope)},e=te(e),[i,h,E,N,I,g,l,e,r,n]}class ht extends Me{constructor(e){super(),He(this,e,Ll,zl,Pe,{name:0,color:1,size:2,strokeWidth:3,absoluteStrokeWidth:4,iconNode:5})}}function Ol(o){let e;const s=o[2].default,t=Qe(s,o,o[3],null);return{c(){t&&t.c()},l(l){t&&t.l(l)},m(l,n){t&&t.m(l,n),e=!0},p(l,n){t&&t.p&&(!e||n&8)&&Ye(t,s,l,l[3],e?et(s,l[3],n,null):Ze(l[3]),null)},i(l){e||($(t,l),e=!0)},o(l){y(t,l),e=!1},d(l){t&&t.d(l)}}}function Bl(o){let e,s;const t=[{name:"alert-circle"},o[1],{iconNode:o[0]}];let l={$$slots:{default:[Ol]},$$scope:{ctx:o}};for(let n=0;n<t.length;n+=1)l=S(l,t[n]);return e=new ht({props:l}),{c(){X(e.$$.fragment)},l(n){J(e.$$.fragment,n)},m(n,r){K(e,n,r),s=!0},p(n,[r]){const i=r&3?Fe(t,[t[0],r&2&&mt(n[1]),r&1&&{iconNode:n[0]}]):{};r&8&&(i.$$scope={dirty:r,ctx:n}),e.$set(i)},i(n){s||($(e.$$.fragment,n),s=!0)},o(n){y(e.$$.fragment,n),s=!1},d(n){R(e,n)}}}function Ml(o,e,s){let{$$slots:t={},$$scope:l}=e;const n=[["circle",{cx:"12",cy:"12",r:"10"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16"}]];return o.$$set=r=>{s(1,e=S(S({},e),te(r))),"$$scope"in r&&s(3,l=r.$$scope)},e=te(e),[n,e,t,l]}class Hl extends Me{constructor(e){super(),He(this,e,Ml,Bl,Pe,{})}}function Fl(o){let e;const s=o[2].default,t=Qe(s,o,o[3],null);return{c(){t&&t.c()},l(l){t&&t.l(l)},m(l,n){t&&t.m(l,n),e=!0},p(l,n){t&&t.p&&(!e||n&8)&&Ye(t,s,l,l[3],e?et(s,l[3],n,null):Ze(l[3]),null)},i(l){e||($(t,l),e=!0)},o(l){y(t,l),e=!1},d(l){t&&t.d(l)}}}function Wl(o){let e,s;const t=[{name:"chevron-down"},o[1],{iconNode:o[0]}];let l={$$slots:{default:[Fl]},$$scope:{ctx:o}};for(let n=0;n<t.length;n+=1)l=S(l,t[n]);return e=new ht({props:l}),{c(){X(e.$$.fragment)},l(n){J(e.$$.fragment,n)},m(n,r){K(e,n,r),s=!0},p(n,[r]){const i=r&3?Fe(t,[t[0],r&2&&mt(n[1]),r&1&&{iconNode:n[0]}]):{};r&8&&(i.$$scope={dirty:r,ctx:n}),e.$set(i)},i(n){s||($(e.$$.fragment,n),s=!0)},o(n){y(e.$$.fragment,n),s=!1},d(n){R(e,n)}}}function ql(o,e,s){let{$$slots:t={},$$scope:l}=e;const n=[["path",{d:"m6 9 6 6 6-6"}]];return o.$$set=r=>{s(1,e=S(S({},e),te(r))),"$$scope"in r&&s(3,l=r.$$scope)},e=te(e),[n,e,t,l]}class Gl extends Me{constructor(e){super(),He(this,e,ql,Wl,Pe,{})}}function Rl(o){let e;const s=o[2].default,t=Qe(s,o,o[3],null);return{c(){t&&t.c()},l(l){t&&t.l(l)},m(l,n){t&&t.m(l,n),e=!0},p(l,n){t&&t.p&&(!e||n&8)&&Ye(t,s,l,l[3],e?et(s,l[3],n,null):Ze(l[3]),null)},i(l){e||($(t,l),e=!0)},o(l){y(t,l),e=!1},d(l){t&&t.d(l)}}}function Kl(o){let e,s;const t=[{name:"code"},o[1],{iconNode:o[0]}];let l={$$slots:{default:[Rl]},$$scope:{ctx:o}};for(let n=0;n<t.length;n+=1)l=S(l,t[n]);return e=new ht({props:l}),{c(){X(e.$$.fragment)},l(n){J(e.$$.fragment,n)},m(n,r){K(e,n,r),s=!0},p(n,[r]){const i=r&3?Fe(t,[t[0],r&2&&mt(n[1]),r&1&&{iconNode:n[0]}]):{};r&8&&(i.$$scope={dirty:r,ctx:n}),e.$set(i)},i(n){s||($(e.$$.fragment,n),s=!0)},o(n){y(e.$$.fragment,n),s=!1},d(n){R(e,n)}}}function Jl(o,e,s){let{$$slots:t={},$$scope:l}=e;const n=[["polyline",{points:"16 18 22 12 16 6"}],["polyline",{points:"8 6 2 12 8 18"}]];return o.$$set=r=>{s(1,e=S(S({},e),te(r))),"$$scope"in r&&s(3,l=r.$$scope)},e=te(e),[n,e,t,l]}class Xl extends Me{constructor(e){super(),He(this,e,Jl,Kl,Pe,{})}}function Ql(o){let e;const s=o[2].default,t=Qe(s,o,o[3],null);return{c(){t&&t.c()},l(l){t&&t.l(l)},m(l,n){t&&t.m(l,n),e=!0},p(l,n){t&&t.p&&(!e||n&8)&&Ye(t,s,l,l[3],e?et(s,l[3],n,null):Ze(l[3]),null)},i(l){e||($(t,l),e=!0)},o(l){y(t,l),e=!1},d(l){t&&t.d(l)}}}function Yl(o){let e,s;const t=[{name:"download"},o[1],{iconNode:o[0]}];let l={$$slots:{default:[Ql]},$$scope:{ctx:o}};for(let n=0;n<t.length;n+=1)l=S(l,t[n]);return e=new ht({props:l}),{c(){X(e.$$.fragment)},l(n){J(e.$$.fragment,n)},m(n,r){K(e,n,r),s=!0},p(n,[r]){const i=r&3?Fe(t,[t[0],r&2&&mt(n[1]),r&1&&{iconNode:n[0]}]):{};r&8&&(i.$$scope={dirty:r,ctx:n}),e.$set(i)},i(n){s||($(e.$$.fragment,n),s=!0)},o(n){y(e.$$.fragment,n),s=!1},d(n){R(e,n)}}}function Zl(o,e,s){let{$$slots:t={},$$scope:l}=e;const n=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}],["polyline",{points:"7 10 12 15 17 10"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3"}]];return o.$$set=r=>{s(1,e=S(S({},e),te(r))),"$$scope"in r&&s(3,l=r.$$scope)},e=te(e),[n,e,t,l]}class kl extends Me{constructor(e){super(),He(this,e,Zl,Yl,Pe,{})}}function en(o){let e;const s=o[2].default,t=Qe(s,o,o[3],null);return{c(){t&&t.c()},l(l){t&&t.l(l)},m(l,n){t&&t.m(l,n),e=!0},p(l,n){t&&t.p&&(!e||n&8)&&Ye(t,s,l,l[3],e?et(s,l[3],n,null):Ze(l[3]),null)},i(l){e||($(t,l),e=!0)},o(l){y(t,l),e=!1},d(l){t&&t.d(l)}}}function tn(o){let e,s;const t=[{name:"loader-2"},o[1],{iconNode:o[0]}];let l={$$slots:{default:[en]},$$scope:{ctx:o}};for(let n=0;n<t.length;n+=1)l=S(l,t[n]);return e=new ht({props:l}),{c(){X(e.$$.fragment)},l(n){J(e.$$.fragment,n)},m(n,r){K(e,n,r),s=!0},p(n,[r]){const i=r&3?Fe(t,[t[0],r&2&&mt(n[1]),r&1&&{iconNode:n[0]}]):{};r&8&&(i.$$scope={dirty:r,ctx:n}),e.$set(i)},i(n){s||($(e.$$.fragment,n),s=!0)},o(n){y(e.$$.fragment,n),s=!1},d(n){R(e,n)}}}function ln(o,e,s){let{$$slots:t={},$$scope:l}=e;const n=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56"}]];return o.$$set=r=>{s(1,e=S(S({},e),te(r))),"$$scope"in r&&s(3,l=r.$$scope)},e=te(e),[n,e,t,l]}class nn extends Me{constructor(e){super(),He(this,e,ln,tn,Pe,{})}}function sn(o){let e;const s=o[2].default,t=Qe(s,o,o[3],null);return{c(){t&&t.c()},l(l){t&&t.l(l)},m(l,n){t&&t.m(l,n),e=!0},p(l,n){t&&t.p&&(!e||n&8)&&Ye(t,s,l,l[3],e?et(s,l[3],n,null):Ze(l[3]),null)},i(l){e||($(t,l),e=!0)},o(l){y(t,l),e=!1},d(l){t&&t.d(l)}}}function on(o){let e,s;const t=[{name:"more-horizontal"},o[1],{iconNode:o[0]}];let l={$$slots:{default:[sn]},$$scope:{ctx:o}};for(let n=0;n<t.length;n+=1)l=S(l,t[n]);return e=new ht({props:l}),{c(){X(e.$$.fragment)},l(n){J(e.$$.fragment,n)},m(n,r){K(e,n,r),s=!0},p(n,[r]){const i=r&3?Fe(t,[t[0],r&2&&mt(n[1]),r&1&&{iconNode:n[0]}]):{};r&8&&(i.$$scope={dirty:r,ctx:n}),e.$set(i)},i(n){s||($(e.$$.fragment,n),s=!0)},o(n){y(e.$$.fragment,n),s=!1},d(n){R(e,n)}}}function rn(o,e,s){let{$$slots:t={},$$scope:l}=e;const n=[["circle",{cx:"12",cy:"12",r:"1"}],["circle",{cx:"19",cy:"12",r:"1"}],["circle",{cx:"5",cy:"12",r:"1"}]];return o.$$set=r=>{s(1,e=S(S({},e),te(r))),"$$scope"in r&&s(3,l=r.$$scope)},e=te(e),[n,e,t,l]}class an extends Me{constructor(e){super(),He(this,e,rn,on,Pe,{})}}function cn(o){let e;const s=o[2].default,t=Qe(s,o,o[3],null);return{c(){t&&t.c()},l(l){t&&t.l(l)},m(l,n){t&&t.m(l,n),e=!0},p(l,n){t&&t.p&&(!e||n&8)&&Ye(t,s,l,l[3],e?et(s,l[3],n,null):Ze(l[3]),null)},i(l){e||($(t,l),e=!0)},o(l){y(t,l),e=!1},d(l){t&&t.d(l)}}}function un(o){let e,s;const t=[{name:"panels-top-left"},o[1],{iconNode:o[0]}];let l={$$slots:{default:[cn]},$$scope:{ctx:o}};for(let n=0;n<t.length;n+=1)l=S(l,t[n]);return e=new ht({props:l}),{c(){X(e.$$.fragment)},l(n){J(e.$$.fragment,n)},m(n,r){K(e,n,r),s=!0},p(n,[r]){const i=r&3?Fe(t,[t[0],r&2&&mt(n[1]),r&1&&{iconNode:n[0]}]):{};r&8&&(i.$$scope={dirty:r,ctx:n}),e.$set(i)},i(n){s||($(e.$$.fragment,n),s=!0)},o(n){y(e.$$.fragment,n),s=!1},d(n){R(e,n)}}}function fn(o,e,s){let{$$slots:t={},$$scope:l}=e;const n=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M3 9h18"}],["path",{d:"M9 21V9"}]];return o.$$set=r=>{s(1,e=S(S({},e),te(r))),"$$scope"in r&&s(3,l=r.$$scope)},e=te(e),[n,e,t,l]}class dn extends Me{constructor(e){super(),He(this,e,fn,un,Pe,{})}}function mn(o){let e;const s=o[2].default,t=Qe(s,o,o[3],null);return{c(){t&&t.c()},l(l){t&&t.l(l)},m(l,n){t&&t.m(l,n),e=!0},p(l,n){t&&t.p&&(!e||n&8)&&Ye(t,s,l,l[3],e?et(s,l[3],n,null):Ze(l[3]),null)},i(l){e||($(t,l),e=!0)},o(l){y(t,l),e=!1},d(l){t&&t.d(l)}}}function hn(o){let e,s;const t=[{name:"play"},o[1],{iconNode:o[0]}];let l={$$slots:{default:[mn]},$$scope:{ctx:o}};for(let n=0;n<t.length;n+=1)l=S(l,t[n]);return e=new ht({props:l}),{c(){X(e.$$.fragment)},l(n){J(e.$$.fragment,n)},m(n,r){K(e,n,r),s=!0},p(n,[r]){const i=r&3?Fe(t,[t[0],r&2&&mt(n[1]),r&1&&{iconNode:n[0]}]):{};r&8&&(i.$$scope={dirty:r,ctx:n}),e.$set(i)},i(n){s||($(e.$$.fragment,n),s=!0)},o(n){y(e.$$.fragment,n),s=!1},d(n){R(e,n)}}}function gn(o,e,s){let{$$slots:t={},$$scope:l}=e;const n=[["polygon",{points:"5 3 19 12 5 21 5 3"}]];return o.$$set=r=>{s(1,e=S(S({},e),te(r))),"$$scope"in r&&s(3,l=r.$$scope)},e=te(e),[n,e,t,l]}class dl extends Me{constructor(e){super(),He(this,e,gn,hn,Pe,{})}}function _n(o){let e;const s=o[2].default,t=Qe(s,o,o[3],null);return{c(){t&&t.c()},l(l){t&&t.l(l)},m(l,n){t&&t.m(l,n),e=!0},p(l,n){t&&t.p&&(!e||n&8)&&Ye(t,s,l,l[3],e?et(s,l[3],n,null):Ze(l[3]),null)},i(l){e||($(t,l),e=!0)},o(l){y(t,l),e=!1},d(l){t&&t.d(l)}}}function pn(o){let e,s;const t=[{name:"share"},o[1],{iconNode:o[0]}];let l={$$slots:{default:[_n]},$$scope:{ctx:o}};for(let n=0;n<t.length;n+=1)l=S(l,t[n]);return e=new ht({props:l}),{c(){X(e.$$.fragment)},l(n){J(e.$$.fragment,n)},m(n,r){K(e,n,r),s=!0},p(n,[r]){const i=r&3?Fe(t,[t[0],r&2&&mt(n[1]),r&1&&{iconNode:n[0]}]):{};r&8&&(i.$$scope={dirty:r,ctx:n}),e.$set(i)},i(n){s||($(e.$$.fragment,n),s=!0)},o(n){y(e.$$.fragment,n),s=!1},d(n){R(e,n)}}}function bn(o,e,s){let{$$slots:t={},$$scope:l}=e;const n=[["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8"}],["polyline",{points:"16 6 12 2 8 6"}],["line",{x1:"12",x2:"12",y1:"2",y2:"15"}]];return o.$$set=r=>{s(1,e=S(S({},e),te(r))),"$$scope"in r&&s(3,l=r.$$scope)},e=te(e),[n,e,t,l]}class $l extends Me{constructor(e){super(),He(this,e,bn,pn,Pe,{})}}function vn(o){let e;const s=o[2].default,t=Qe(s,o,o[3],null);return{c(){t&&t.c()},l(l){t&&t.l(l)},m(l,n){t&&t.m(l,n),e=!0},p(l,n){t&&t.p&&(!e||n&8)&&Ye(t,s,l,l[3],e?et(s,l[3],n,null):Ze(l[3]),null)},i(l){e||($(t,l),e=!0)},o(l){y(t,l),e=!1},d(l){t&&t.d(l)}}}function kn(o){let e,s;const t=[{name:"skip-back"},o[1],{iconNode:o[0]}];let l={$$slots:{default:[vn]},$$scope:{ctx:o}};for(let n=0;n<t.length;n+=1)l=S(l,t[n]);return e=new ht({props:l}),{c(){X(e.$$.fragment)},l(n){J(e.$$.fragment,n)},m(n,r){K(e,n,r),s=!0},p(n,[r]){const i=r&3?Fe(t,[t[0],r&2&&mt(n[1]),r&1&&{iconNode:n[0]}]):{};r&8&&(i.$$scope={dirty:r,ctx:n}),e.$set(i)},i(n){s||($(e.$$.fragment,n),s=!0)},o(n){y(e.$$.fragment,n),s=!1},d(n){R(e,n)}}}function $n(o,e,s){let{$$slots:t={},$$scope:l}=e;const n=[["polygon",{points:"19 20 9 12 19 4 19 20"}],["line",{x1:"5",x2:"5",y1:"19",y2:"5"}]];return o.$$set=r=>{s(1,e=S(S({},e),te(r))),"$$scope"in r&&s(3,l=r.$$scope)},e=te(e),[n,e,t,l]}class yn extends Me{constructor(e){super(),He(this,e,$n,kn,Pe,{})}}function wn(o){let e;const s=o[2].default,t=Qe(s,o,o[3],null);return{c(){t&&t.c()},l(l){t&&t.l(l)},m(l,n){t&&t.m(l,n),e=!0},p(l,n){t&&t.p&&(!e||n&8)&&Ye(t,s,l,l[3],e?et(s,l[3],n,null):Ze(l[3]),null)},i(l){e||($(t,l),e=!0)},o(l){y(t,l),e=!1},d(l){t&&t.d(l)}}}function En(o){let e,s;const t=[{name:"skip-forward"},o[1],{iconNode:o[0]}];let l={$$slots:{default:[wn]},$$scope:{ctx:o}};for(let n=0;n<t.length;n+=1)l=S(l,t[n]);return e=new ht({props:l}),{c(){X(e.$$.fragment)},l(n){J(e.$$.fragment,n)},m(n,r){K(e,n,r),s=!0},p(n,[r]){const i=r&3?Fe(t,[t[0],r&2&&mt(n[1]),r&1&&{iconNode:n[0]}]):{};r&8&&(i.$$scope={dirty:r,ctx:n}),e.$set(i)},i(n){s||($(e.$$.fragment,n),s=!0)},o(n){y(e.$$.fragment,n),s=!1},d(n){R(e,n)}}}function Nn(o,e,s){let{$$slots:t={},$$scope:l}=e;const n=[["polygon",{points:"5 4 15 12 5 20 5 4"}],["line",{x1:"19",x2:"19",y1:"5",y2:"19"}]];return o.$$set=r=>{s(1,e=S(S({},e),te(r))),"$$scope"in r&&s(3,l=r.$$scope)},e=te(e),[n,e,t,l]}class Tn extends Me{constructor(e){super(),He(this,e,Nn,En,Pe,{})}}function yl(o,e,s){const t=o.slice();return t[41]=e[s],t}function wl(o,e,s){const t=o.slice();return t[44]=e[s],t}function El(o,e,s){const t=o.slice();return t[44]=e[s],t}function In(o){let e,s=`<div class="max-w-2xl w-full"><div class="bg-white rounded-lg shadow-sm border border-gray-200 p-6"><h2 class="text-lg font-semibold mb-4">Code View</h2> <p class="text-gray-600 mb-4">Here you can see the code to integrate text-to-speech into your application.</p> <pre class="bg-gray-900 text-gray-100 p-4 rounded-lg overflow-x-auto"><code>// Coming soon: API integration code
|
| 7 |
+
// This will show how to use the TTS API
|
| 8 |
+
// with your selected settings</code></pre></div></div>`;return{c(){e=d("div"),e.innerHTML=s,this.h()},l(t){e=f(t,"DIV",{class:!0,"data-svelte-h":!0}),Xe(e)!=="svelte-1aigu8s"&&(e.innerHTML=s),this.h()},h(){c(e,"class","flex-1 flex items-center justify-center bg-gray-50 p-8")},m(t,l){ie(t,e,l)},p:Tt,i:Tt,o:Tt,d(t){t&&u(e)}}}function Dn(o){let e,s,t,l,n,r,i,h,E,N=o[0].length+"",I,g,p,b,D,U,q,Se,z,V,A,le,Ve="Model",ue,_e,L,W,O,fe,We,Z,Q,xe='<h3 class="font-medium text-gray-900">Voice</h3>',j,B,me,ne,tt='<div class="flex items-center gap-2"><div class="w-8 h-8 bg-gray-400 rounded-full flex items-center justify-center text-white text-xs font-medium">+</div> <span class="text-sm font-medium text-gray-600">Clone your voice</span></div> <div class="text-xs text-gray-400">(coming soon)</div>',$e,se,pe,ye,T,we="Speed",de,Ee,be=o[8].toFixed(1)+"",Ne,Ae,Ct,he,lt,nt,Ue="<span>0.5x</span> <span>2.0x</span>",gt,je,ze,st,$t="Stability",ot,rt,qe=(o[9]*100).toFixed(0)+"",_t,It,Pt,oe,Ge,Ce,Re,at,it="Similarity",ct,ut,Le=(o[10]*100).toFixed(0)+"",Ke,xt,Te,Ie,Ot,pt,De,bt,Gt="Style",ft,yt,ce=o[11]===0?"None":"Exaggerated",w,G,re,ve,Bt,Mt,ee=o[3]==="local"&&Nl();const Ut=[Vn,Sn],Je=[];function jt(_,M){return _[6]?0:1}D=jt(o),U=Je[D]=Ut[D](o);let ae=o[7]&&Tl(o),Oe=Vt(o[17]),ge=[];for(let _=0;_<Oe.length;_+=1)ge[_]=Sl(El(o,Oe,_));O=new Gl({props:{size:16,class:"text-gray-500"}});let ke=o[5]&&Vl(o),wt=Vt(o[18]),H=[];for(let _=0;_<wt.length;_+=1)H[_]=Cl(yl(o,wt,_));return{c(){e=d("div"),s=d("div"),ee&&ee.c(),t=k(),l=d("div"),n=d("textarea"),r=k(),i=d("div"),h=d("div"),E=d("span"),I=P(N),g=P(" / 5,000 characters"),p=k(),b=d("button"),U.c(),Se=k(),ae&&ae.c(),z=k(),V=d("div"),A=d("div"),le=d("h3"),le.textContent=Ve,ue=k(),_e=d("button"),L=d("span");for(let _=0;_<ge.length;_+=1)ge[_].c();W=k(),X(O.$$.fragment),fe=k(),ke&&ke.c(),We=k(),Z=d("div"),Q=d("div"),Q.innerHTML=xe,j=k(),B=d("div");for(let _=0;_<H.length;_+=1)H[_].c();me=k(),ne=d("button"),ne.innerHTML=tt,$e=k(),se=d("div"),pe=d("div"),ye=d("div"),T=d("label"),T.textContent=we,de=k(),Ee=d("span"),Ne=P(be),Ae=P("x"),Ct=k(),he=d("input"),lt=k(),nt=d("div"),nt.innerHTML=Ue,gt=k(),je=d("div"),ze=d("div"),st=d("label"),st.textContent=$t,ot=k(),rt=d("span"),_t=P(qe),It=P("%"),Pt=k(),oe=d("input"),Ge=k(),Ce=d("div"),Re=d("div"),at=d("label"),at.textContent=it,ct=k(),ut=d("span"),Ke=P(Le),xt=P("%"),Te=k(),Ie=d("input"),Ot=k(),pt=d("div"),De=d("div"),bt=d("label"),bt.textContent=Gt,ft=k(),yt=d("span"),w=P(ce),G=k(),re=d("input"),this.h()},l(_){e=f(_,"DIV",{class:!0});var M=m(e);s=f(M,"DIV",{class:!0});var Y=m(s);ee&&ee.l(Y),t=v(Y),l=f(Y,"DIV",{class:!0});var x=m(l);n=f(x,"TEXTAREA",{class:!0,placeholder:!0}),m(n).forEach(u),x.forEach(u),r=v(Y),i=f(Y,"DIV",{class:!0});var Be=m(i);h=f(Be,"DIV",{class:!0});var Rt=m(h);E=f(Rt,"SPAN",{class:!0});var Ht=m(E);I=C(Ht,N),g=C(Ht," / 5,000 characters"),Ht.forEach(u),Rt.forEach(u),p=v(Be),b=f(Be,"BUTTON",{class:!0});var Et=m(b);U.l(Et),Et.forEach(u),Be.forEach(u),Se=v(Y),ae&&ae.l(Y),Y.forEach(u),z=v(M),V=f(M,"DIV",{class:!0});var vt=m(V);A=f(vt,"DIV",{class:!0});var Nt=m(A);le=f(Nt,"H3",{class:!0,"data-svelte-h":!0}),Xe(le)!=="svelte-b3hs3r"&&(le.textContent=Ve),ue=v(Nt),_e=f(Nt,"BUTTON",{class:!0});var zt=m(_e);L=f(zt,"SPAN",{});var ml=m(L);for(let Lt=0;Lt<ge.length;Lt+=1)ge[Lt].l(ml);ml.forEach(u),W=v(zt),J(O.$$.fragment,zt),zt.forEach(u),fe=v(Nt),ke&&ke.l(Nt),Nt.forEach(u),We=v(vt),Z=f(vt,"DIV",{class:!0});var Jt=m(Z);Q=f(Jt,"DIV",{class:!0,"data-svelte-h":!0}),Xe(Q)!=="svelte-182x1ki"&&(Q.innerHTML=xe),j=v(Jt),B=f(Jt,"DIV",{class:!0});var Xt=m(B);for(let Lt=0;Lt<H.length;Lt+=1)H[Lt].l(Xt);me=v(Xt),ne=f(Xt,"BUTTON",{class:!0,"data-svelte-h":!0}),Xe(ne)!=="svelte-20x663"&&(ne.innerHTML=tt),Xt.forEach(u),Jt.forEach(u),$e=v(vt),se=f(vt,"DIV",{class:!0});var Dt=m(se);pe=f(Dt,"DIV",{});var Ft=m(pe);ye=f(Ft,"DIV",{class:!0});var Qt=m(ye);T=f(Qt,"LABEL",{class:!0,"data-svelte-h":!0}),Xe(T)!=="svelte-9vcpiu"&&(T.textContent=we),de=v(Qt),Ee=f(Qt,"SPAN",{class:!0});var il=m(Ee);Ne=C(il,be),Ae=C(il,"x"),il.forEach(u),Qt.forEach(u),Ct=v(Ft),he=f(Ft,"INPUT",{type:!0,min:!0,max:!0,step:!0,class:!0}),lt=v(Ft),nt=f(Ft,"DIV",{class:!0,"data-svelte-h":!0}),Xe(nt)!=="svelte-4ydm1m"&&(nt.innerHTML=Ue),Ft.forEach(u),gt=v(Dt),je=f(Dt,"DIV",{});var Yt=m(je);ze=f(Yt,"DIV",{class:!0});var Zt=m(ze);st=f(Zt,"LABEL",{class:!0,"data-svelte-h":!0}),Xe(st)!=="svelte-1lgjete"&&(st.textContent=$t),ot=v(Zt),rt=f(Zt,"SPAN",{class:!0});var cl=m(rt);_t=C(cl,qe),It=C(cl,"%"),cl.forEach(u),Zt.forEach(u),Pt=v(Yt),oe=f(Yt,"INPUT",{type:!0,min:!0,max:!0,step:!0,class:!0}),Yt.forEach(u),Ge=v(Dt),Ce=f(Dt,"DIV",{});var el=m(Ce);Re=f(el,"DIV",{class:!0});var tl=m(Re);at=f(tl,"LABEL",{class:!0,"data-svelte-h":!0}),Xe(at)!=="svelte-1ha0vec"&&(at.textContent=it),ct=v(tl),ut=f(tl,"SPAN",{class:!0});var ul=m(ut);Ke=C(ul,Le),xt=C(ul,"%"),ul.forEach(u),tl.forEach(u),Te=v(el),Ie=f(el,"INPUT",{type:!0,min:!0,max:!0,step:!0,class:!0}),el.forEach(u),Ot=v(Dt),pt=f(Dt,"DIV",{});var ll=m(pt);De=f(ll,"DIV",{class:!0});var nl=m(De);bt=f(nl,"LABEL",{class:!0,"data-svelte-h":!0}),Xe(bt)!=="svelte-1ata0tk"&&(bt.textContent=Gt),ft=v(nl),yt=f(nl,"SPAN",{class:!0});var hl=m(yt);w=C(hl,ce),hl.forEach(u),nl.forEach(u),G=v(ll),re=f(ll,"INPUT",{type:!0,min:!0,max:!0,step:!0,class:!0}),ll.forEach(u),Dt.forEach(u),vt.forEach(u),M.forEach(u),this.h()},h(){c(n,"class","w-full h-full p-6 bg-white resize-none border-0 focus:outline-none text-gray-900 text-base leading-relaxed"),c(n,"placeholder","Welcome to our text to speech demo. This technology can transform any written content into natural sounding audio."),c(l,"class","flex-1 pb-24"),c(E,"class","text-sm text-gray-500"),c(h,"class","flex items-center justify-between mb-3"),b.disabled=q=o[6]||!o[0].trim(),c(b,"class","w-full px-6 py-3 bg-gradient-to-r from-amber-400 to-orange-500 text-white rounded-lg font-medium hover:from-amber-500 hover:to-orange-600 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2 shadow-sm"),c(i,"class","fixed bottom-0 left-56 right-80 p-4 bg-white border-t border-gray-200"),c(s,"class","flex-1 flex flex-col p-6"),c(le,"class","font-medium text-gray-900 mb-3"),c(_e,"class","w-full p-3 border border-gray-200 rounded-lg bg-white text-sm focus:outline-none focus:ring-2 focus:ring-amber-400 focus:border-transparent appearance-none bg-no-repeat bg-right pr-10 shadow-sm text-left flex items-center justify-between"),c(A,"class","mb-6 relative model-dropdown"),c(Q,"class","mb-3"),c(ne,"class","w-full flex items-center justify-between p-2 rounded-md opacity-50 cursor-not-allowed text-left"),ne.disabled=!0,c(B,"class","space-y-1"),c(Z,"class","mb-6"),c(T,"class","text-sm font-medium text-gray-700"),c(Ee,"class","text-sm text-gray-500"),c(ye,"class","flex justify-between mb-1"),c(he,"type","range"),c(he,"min","0.5"),c(he,"max","2"),c(he,"step","0.1"),c(he,"class","w-full h-1.5 bg-gray-200 rounded-lg appearance-none cursor-pointer slider-hf"),c(nt,"class","flex justify-between text-xs text-gray-400 mt-1"),c(st,"class","text-sm font-medium text-gray-700"),c(rt,"class","text-sm text-gray-500"),c(ze,"class","flex justify-between mb-1"),c(oe,"type","range"),c(oe,"min","0"),c(oe,"max","1"),c(oe,"step","0.01"),c(oe,"class","w-full h-1.5 bg-gray-200 rounded-lg appearance-none cursor-pointer slider-hf"),c(at,"class","text-sm font-medium text-gray-700"),c(ut,"class","text-sm text-gray-500"),c(Re,"class","flex justify-between mb-1"),c(Ie,"type","range"),c(Ie,"min","0"),c(Ie,"max","1"),c(Ie,"step","0.01"),c(Ie,"class","w-full h-1.5 bg-gray-200 rounded-lg appearance-none cursor-pointer slider-hf"),c(bt,"class","text-sm font-medium text-gray-700"),c(yt,"class","text-sm text-gray-500"),c(De,"class","flex justify-between mb-1"),c(re,"type","range"),c(re,"min","0"),c(re,"max","1"),c(re,"step","1"),c(re,"class","w-full h-1.5 bg-gray-200 rounded-lg appearance-none cursor-pointer slider-hf"),c(se,"class","space-y-4 pt-4 border-t border-gray-200"),c(V,"class","w-80 border-l border-gray-200 bg-white p-4 overflow-y-auto"),c(e,"class","flex-1 flex")},m(_,M){ie(_,e,M),a(e,s),ee&&ee.m(s,null),a(s,t),a(s,l),a(l,n),kt(n,o[0]),a(s,r),a(s,i),a(i,h),a(h,E),a(E,I),a(E,g),a(i,p),a(i,b),Je[D].m(b,null),a(s,Se),ae&&ae.m(s,null),a(e,z),a(e,V),a(V,A),a(A,le),a(A,ue),a(A,_e),a(_e,L);for(let Y=0;Y<ge.length;Y+=1)ge[Y]&&ge[Y].m(L,null);a(_e,W),K(O,_e,null),a(A,fe),ke&&ke.m(A,null),a(V,We),a(V,Z),a(Z,Q),a(Z,j),a(Z,B);for(let Y=0;Y<H.length;Y+=1)H[Y]&&H[Y].m(B,null);a(B,me),a(B,ne),a(V,$e),a(V,se),a(se,pe),a(pe,ye),a(ye,T),a(ye,de),a(ye,Ee),a(Ee,Ne),a(Ee,Ae),a(pe,Ct),a(pe,he),kt(he,o[8]),a(pe,lt),a(pe,nt),a(se,gt),a(se,je),a(je,ze),a(ze,st),a(ze,ot),a(ze,rt),a(rt,_t),a(rt,It),a(je,Pt),a(je,oe),kt(oe,o[9]),a(se,Ge),a(se,Ce),a(Ce,Re),a(Re,at),a(Re,ct),a(Re,ut),a(ut,Ke),a(ut,xt),a(Ce,Te),a(Ce,Ie),kt(Ie,o[10]),a(se,Ot),a(se,pt),a(pt,De),a(De,bt),a(De,ft),a(De,yt),a(yt,w),a(pt,G),a(pt,re),kt(re,o[11]),ve=!0,Bt||(Mt=[F(n,"input",o[31]),F(b,"click",o[19]),F(_e,"click",o[33]),F(he,"change",o[36]),F(he,"input",o[36]),F(oe,"change",o[37]),F(oe,"input",o[37]),F(Ie,"change",o[38]),F(Ie,"input",o[38]),F(re,"change",o[39]),F(re,"input",o[39])],Bt=!0)},p(_,M){_[3]==="local"?ee?M[0]&8&&$(ee,1):(ee=Nl(),ee.c(),$(ee,1),ee.m(s,t)):ee&&(qt(),y(ee,1,1,()=>{ee=null}),Wt()),M[0]&1&&kt(n,_[0]),(!ve||M[0]&1)&&N!==(N=_[0].length+"")&&dt(I,N);let Y=D;if(D=jt(_),D!==Y&&(qt(),y(Je[Y],1,1,()=>{Je[Y]=null}),Wt(),U=Je[D],U||(U=Je[D]=Ut[D](_),U.c()),$(U,1),U.m(b,null)),(!ve||M[0]&65&&q!==(q=_[6]||!_[0].trim()))&&(b.disabled=q),_[7]?ae?(ae.p(_,M),M[0]&128&&$(ae,1)):(ae=Tl(_),ae.c(),$(ae,1),ae.m(s,null)):ae&&(qt(),y(ae,1,1,()=>{ae=null}),Wt()),M[0]&131076){Oe=Vt(_[17]);let x;for(x=0;x<Oe.length;x+=1){const Be=El(_,Oe,x);ge[x]?ge[x].p(Be,M):(ge[x]=Sl(Be),ge[x].c(),ge[x].m(L,null))}for(;x<ge.length;x+=1)ge[x].d(1);ge.length=Oe.length}if(_[5]?ke?ke.p(_,M):(ke=Vl(_),ke.c(),ke.m(A,null)):ke&&(ke.d(1),ke=null),M[0]&262146){wt=Vt(_[18]);let x;for(x=0;x<wt.length;x+=1){const Be=yl(_,wt,x);H[x]?H[x].p(Be,M):(H[x]=Cl(Be),H[x].c(),H[x].m(B,me))}for(;x<H.length;x+=1)H[x].d(1);H.length=wt.length}(!ve||M[0]&256)&&be!==(be=_[8].toFixed(1)+"")&&dt(Ne,be),M[0]&256&&kt(he,_[8]),(!ve||M[0]&512)&&qe!==(qe=(_[9]*100).toFixed(0)+"")&&dt(_t,qe),M[0]&512&&kt(oe,_[9]),(!ve||M[0]&1024)&&Le!==(Le=(_[10]*100).toFixed(0)+"")&&dt(Ke,Le),M[0]&1024&&kt(Ie,_[10]),(!ve||M[0]&2048)&&ce!==(ce=_[11]===0?"None":"Exaggerated")&&dt(w,ce),M[0]&2048&&kt(re,_[11])},i(_){ve||($(ee),$(U),$(ae),$(O.$$.fragment,_),ve=!0)},o(_){y(ee),y(U),y(ae),y(O.$$.fragment,_),ve=!1},d(_){_&&u(e),ee&&ee.d(),Je[D].d(),ae&&ae.d(),ol(ge,_),R(O),ke&&ke.d(),ol(H,_),Bt=!1,al(Mt)}}}function Nl(o){let e,s,t,l,n='<p class="font-medium text-blue-900">To run locally:</p> <code class="text-xs bg-blue-100 px-1.5 py-0.5 rounded">pip install hfstudio</code> <span class="text-blue-700">and run</span> <code class="text-xs bg-blue-100 px-1.5 py-0.5 rounded">hfstudio</code> <span class="text-blue-700">from your terminal</span>',r;return s=new Hl({props:{size:18,class:"text-blue-600 mt-0.5 flex-shrink-0"}}),{c(){e=d("div"),X(s.$$.fragment),t=k(),l=d("div"),l.innerHTML=n,this.h()},l(i){e=f(i,"DIV",{class:!0});var h=m(e);J(s.$$.fragment,h),t=v(h),l=f(h,"DIV",{class:!0,"data-svelte-h":!0}),Xe(l)!=="svelte-p3cqs1"&&(l.innerHTML=n),h.forEach(u),this.h()},h(){c(l,"class","text-sm"),c(e,"class","mb-4 p-3 bg-blue-50 border border-blue-200 rounded-lg flex items-start gap-2")},m(i,h){ie(i,e,h),K(s,e,null),a(e,t),a(e,l),r=!0},i(i){r||($(s.$$.fragment,i),r=!0)},o(i){y(s.$$.fragment,i),r=!1},d(i){i&&u(e),R(s)}}}function Sn(o){let e,s,t;return e=new dl({props:{size:20}}),{c(){X(e.$$.fragment),s=P(`
|
| 9 |
+
Generate speech`)},l(l){J(e.$$.fragment,l),s=C(l,`
|
| 10 |
+
Generate speech`)},m(l,n){K(e,l,n),ie(l,s,n),t=!0},i(l){t||($(e.$$.fragment,l),t=!0)},o(l){y(e.$$.fragment,l),t=!1},d(l){l&&u(s),R(e,l)}}}function Vn(o){let e,s,t;return e=new nn({props:{size:20,class:"animate-spin"}}),{c(){X(e.$$.fragment),s=P(`
|
| 11 |
+
Generating...`)},l(l){J(e.$$.fragment,l),s=C(l,`
|
| 12 |
+
Generating...`)},m(l,n){K(e,l,n),ie(l,s,n),t=!0},i(l){t||($(e.$$.fragment,l),t=!0)},o(l){y(e.$$.fragment,l),t=!1},d(l){l&&u(s),R(e,l)}}}function Tl(o){let e,s,t,l,n,r,i,h,E,N,I,g,p,b,D,U,q,Se="Share",z,V,A,le="Download",Ve,ue,_e,L,W,O,fe,We,Z,Q,xe=St(o[13])+"",j,B,me,ne,tt,$e,se=St(o[14])+"",pe,ye,T,we,de,Ee,be,Ne,Ae,Ct,he,lt,nt,Ue,gt,je=St(o[13])+"",ze,st,$t,ot,rt,qe,_t=St(o[14])+"",It,Pt,oe,Ge,Ce,Re,at,it,ct,ut,Le,Ke,xt,Te,Ie,Ot;D=new $l({props:{size:14,class:"text-gray-600"}}),ue=new kl({props:{size:14,class:"text-gray-600"}});const pt=[Cn,An],De=[];function bt(w,G){return w[12]?0:1}O=bt(o),fe=De[O]=pt[O](o),de=new yn({props:{size:20,class:"text-gray-600"}});const Gt=[xn,Pn],ft=[];function yt(w,G){return w[12]?0:1}Ne=yt(o),Ae=ft[Ne]=Gt[Ne](o),lt=new Tn({props:{size:20,class:"text-gray-600"}}),Ce=new $l({props:{size:14}}),ct=new kl({props:{size:16,class:"text-gray-600"}}),Ke=new an({props:{size:16,class:"text-gray-600"}});let ce=o[7]&&Il(o);return{c(){e=d("div"),s=d("div"),t=d("div"),l=k(),n=d("div"),r=d("h3"),i=P(o[15]),h=k(),E=d("p"),N=P(o[1]),I=P(" • Created 1 second ago"),g=k(),p=d("div"),b=d("button"),X(D.$$.fragment),U=k(),q=d("span"),q.textContent=Se,z=k(),V=d("button"),A=d("span"),A.textContent=le,Ve=k(),X(ue.$$.fragment),_e=k(),L=d("div"),W=d("button"),fe.c(),We=k(),Z=d("div"),Q=d("span"),j=P(xe),B=k(),me=d("div"),ne=d("div"),tt=k(),$e=d("span"),pe=P(se),ye=k(),T=d("div"),we=d("button"),X(de.$$.fragment),Ee=k(),be=d("button"),Ae.c(),Ct=k(),he=d("button"),X(lt.$$.fragment),nt=k(),Ue=d("div"),gt=d("span"),ze=P(je),st=k(),$t=d("div"),ot=d("div"),rt=k(),qe=d("span"),It=P(_t),Pt=k(),oe=d("div"),Ge=d("button"),X(Ce.$$.fragment),Re=P(`
|
| 13 |
+
Share`),at=k(),it=d("button"),X(ct.$$.fragment),ut=k(),Le=d("button"),X(Ke.$$.fragment),xt=k(),ce&&ce.c(),this.h()},l(w){e=f(w,"DIV",{class:!0});var G=m(e);s=f(G,"DIV",{class:!0});var re=m(s);t=f(re,"DIV",{class:!0}),m(t).forEach(u),l=v(re),n=f(re,"DIV",{class:!0});var ve=m(n);r=f(ve,"H3",{class:!0});var Bt=m(r);i=C(Bt,o[15]),Bt.forEach(u),h=v(ve),E=f(ve,"P",{class:!0});var Mt=m(E);N=C(Mt,o[1]),I=C(Mt," • Created 1 second ago"),Mt.forEach(u),ve.forEach(u),g=v(re),p=f(re,"DIV",{class:!0});var ee=m(p);b=f(ee,"BUTTON",{class:!0});var Ut=m(b);J(D.$$.fragment,Ut),U=v(Ut),q=f(Ut,"SPAN",{class:!0,"data-svelte-h":!0}),Xe(q)!=="svelte-hbn8gl"&&(q.textContent=Se),Ut.forEach(u),z=v(ee),V=f(ee,"BUTTON",{class:!0});var Je=m(V);A=f(Je,"SPAN",{class:!0,"data-svelte-h":!0}),Xe(A)!=="svelte-h01aeg"&&(A.textContent=le),Ve=v(Je),J(ue.$$.fragment,Je),Je.forEach(u),ee.forEach(u),re.forEach(u),_e=v(G),L=f(G,"DIV",{class:!0});var jt=m(L);W=f(jt,"BUTTON",{class:!0});var ae=m(W);fe.l(ae),ae.forEach(u),We=v(jt),Z=f(jt,"DIV",{class:!0});var Oe=m(Z);Q=f(Oe,"SPAN",{class:!0});var ge=m(Q);j=C(ge,xe),ge.forEach(u),B=v(Oe),me=f(Oe,"DIV",{class:!0});var ke=m(me);ne=f(ke,"DIV",{class:!0,style:!0}),m(ne).forEach(u),ke.forEach(u),tt=v(Oe),$e=f(Oe,"SPAN",{class:!0});var wt=m($e);pe=C(wt,se),wt.forEach(u),Oe.forEach(u),jt.forEach(u),ye=v(G),T=f(G,"DIV",{class:!0});var H=m(T);we=f(H,"BUTTON",{class:!0,title:!0});var _=m(we);J(de.$$.fragment,_),_.forEach(u),Ee=v(H),be=f(H,"BUTTON",{class:!0});var M=m(be);Ae.l(M),M.forEach(u),Ct=v(H),he=f(H,"BUTTON",{class:!0,title:!0});var Y=m(he);J(lt.$$.fragment,Y),Y.forEach(u),nt=v(H),Ue=f(H,"DIV",{class:!0});var x=m(Ue);gt=f(x,"SPAN",{class:!0});var Be=m(gt);ze=C(Be,je),Be.forEach(u),st=v(x),$t=f(x,"DIV",{class:!0});var Rt=m($t);ot=f(Rt,"DIV",{class:!0,style:!0}),m(ot).forEach(u),Rt.forEach(u),rt=v(x),qe=f(x,"SPAN",{class:!0});var Ht=m(qe);It=C(Ht,_t),Ht.forEach(u),x.forEach(u),Pt=v(H),oe=f(H,"DIV",{class:!0});var Et=m(oe);Ge=f(Et,"BUTTON",{class:!0});var vt=m(Ge);J(Ce.$$.fragment,vt),Re=C(vt,`
|
| 14 |
+
Share`),vt.forEach(u),at=v(Et),it=f(Et,"BUTTON",{class:!0,title:!0});var Nt=m(it);J(ct.$$.fragment,Nt),Nt.forEach(u),ut=v(Et),Le=f(Et,"BUTTON",{class:!0,title:!0});var zt=m(Le);J(Ke.$$.fragment,zt),zt.forEach(u),Et.forEach(u),H.forEach(u),xt=v(G),ce&&ce.l(G),G.forEach(u),this.h()},h(){c(t,"class","w-2 h-2 bg-green-500 rounded-full"),c(r,"class","font-medium text-gray-900 text-sm"),c(E,"class","text-xs text-gray-500"),c(n,"class","flex-1"),c(q,"class","text-gray-700"),c(b,"class","flex items-center gap-1.5 px-3 py-1.5 text-sm border border-gray-200 rounded-md hover:bg-gray-50 transition-colors"),c(A,"class","text-gray-700"),c(V,"class","flex items-center gap-1.5 px-3 py-1.5 text-sm border border-gray-200 rounded-md hover:bg-gray-50 transition-colors"),c(p,"class","flex items-center gap-2"),c(s,"class","flex items-center gap-3 mb-4"),c(W,"class","w-8 h-8 bg-black rounded-full flex items-center justify-center hover:bg-gray-800 transition-colors"),c(Q,"class","text-xs text-gray-500 font-mono"),c(ne,"class","h-full bg-gradient-to-r from-amber-400 to-orange-500 rounded-full transition-all"),Kt(ne,"width",o[13]/o[14]*100+"%"),c(me,"class","flex-1 h-1 bg-gray-200 rounded-full cursor-pointer"),c($e,"class","text-xs text-gray-500 font-mono"),c(Z,"class","flex-1 flex items-center gap-2"),c(L,"class","flex items-center gap-3 mb-4"),c(we,"class","p-2 hover:bg-gray-100 rounded-full"),c(we,"title","Skip back"),c(be,"class","w-12 h-12 bg-black rounded-full flex items-center justify-center hover:bg-gray-800 transition-colors"),c(he,"class","p-2 hover:bg-gray-100 rounded-full"),c(he,"title","Skip forward"),c(gt,"class","text-xs text-gray-500 font-mono"),c(ot,"class","h-full bg-gradient-to-r from-amber-400 to-orange-500 rounded-full transition-all"),Kt(ot,"width",o[13]/o[14]*100+"%"),c($t,"class","flex-1 h-1 bg-gray-200 rounded-full"),c(qe,"class","text-xs text-gray-500 font-mono"),c(Ue,"class","flex-1 flex items-center gap-3"),c(Ge,"class","flex items-center gap-2 px-3 py-1.5 text-sm border border-gray-200 rounded-md hover:bg-gray-50"),c(it,"class","p-2 hover:bg-gray-100 rounded-md"),c(it,"title","Download"),c(Le,"class","p-2 hover:bg-gray-100 rounded-md"),c(Le,"title","More options"),c(oe,"class","flex items-center gap-2"),c(T,"class","flex items-center gap-4 mb-4"),c(e,"class","p-4 border border-gray-200 rounded-lg bg-white")},m(w,G){ie(w,e,G),a(e,s),a(s,t),a(s,l),a(s,n),a(n,r),a(r,i),a(n,h),a(n,E),a(E,N),a(E,I),a(s,g),a(s,p),a(p,b),K(D,b,null),a(b,U),a(b,q),a(p,z),a(p,V),a(V,A),a(V,Ve),K(ue,V,null),a(e,_e),a(e,L),a(L,W),De[O].m(W,null),a(L,We),a(L,Z),a(Z,Q),a(Q,j),a(Z,B),a(Z,me),a(me,ne),a(Z,tt),a(Z,$e),a($e,pe),a(e,ye),a(e,T),a(T,we),K(de,we,null),a(T,Ee),a(T,be),ft[Ne].m(be,null),a(T,Ct),a(T,he),K(lt,he,null),a(T,nt),a(T,Ue),a(Ue,gt),a(gt,ze),a(Ue,st),a(Ue,$t),a($t,ot),a(Ue,rt),a(Ue,qe),a(qe,It),a(T,Pt),a(T,oe),a(oe,Ge),K(Ce,Ge,null),a(Ge,Re),a(oe,at),a(oe,it),K(ct,it,null),a(oe,ut),a(oe,Le),K(Ke,Le,null),a(e,xt),ce&&ce.m(e,null),Te=!0,Ie||(Ot=[F(b,"click",Pl),F(V,"click",o[25]),F(W,"click",o[20]),F(be,"click",o[20]),F(Ge,"click",Pl),F(it,"click",o[25])],Ie=!0)},p(w,G){(!Te||G[0]&32768)&&dt(i,w[15]),(!Te||G[0]&2)&&dt(N,w[1]);let re=O;O=bt(w),O!==re&&(qt(),y(De[re],1,1,()=>{De[re]=null}),Wt(),fe=De[O],fe||(fe=De[O]=pt[O](w),fe.c()),$(fe,1),fe.m(W,null)),(!Te||G[0]&8192)&&xe!==(xe=St(w[13])+"")&&dt(j,xe),(!Te||G[0]&24576)&&Kt(ne,"width",w[13]/w[14]*100+"%"),(!Te||G[0]&16384)&&se!==(se=St(w[14])+"")&&dt(pe,se);let ve=Ne;Ne=yt(w),Ne!==ve&&(qt(),y(ft[ve],1,1,()=>{ft[ve]=null}),Wt(),Ae=ft[Ne],Ae||(Ae=ft[Ne]=Gt[Ne](w),Ae.c()),$(Ae,1),Ae.m(be,null)),(!Te||G[0]&8192)&&je!==(je=St(w[13])+"")&&dt(ze,je),(!Te||G[0]&24576)&&Kt(ot,"width",w[13]/w[14]*100+"%"),(!Te||G[0]&16384)&&_t!==(_t=St(w[14])+"")&&dt(It,_t),w[7]?ce?ce.p(w,G):(ce=Il(w),ce.c(),ce.m(e,null)):ce&&(ce.d(1),ce=null)},i(w){Te||($(D.$$.fragment,w),$(ue.$$.fragment,w),$(fe),$(de.$$.fragment,w),$(Ae),$(lt.$$.fragment,w),$(Ce.$$.fragment,w),$(ct.$$.fragment,w),$(Ke.$$.fragment,w),Te=!0)},o(w){y(D.$$.fragment,w),y(ue.$$.fragment,w),y(fe),y(de.$$.fragment,w),y(Ae),y(lt.$$.fragment,w),y(Ce.$$.fragment,w),y(ct.$$.fragment,w),y(Ke.$$.fragment,w),Te=!1},d(w){w&&u(e),R(D),R(ue),De[O].d(),R(de),ft[Ne].d(),R(lt),R(Ce),R(ct),R(Ke),ce&&ce.d(),Ie=!1,al(Ot)}}}function An(o){let e,s;return e=new dl({props:{size:14,class:"text-white ml-0.5"}}),{c(){X(e.$$.fragment)},l(t){J(e.$$.fragment,t)},m(t,l){K(e,t,l),s=!0},i(t){s||($(e.$$.fragment,t),s=!0)},o(t){y(e.$$.fragment,t),s=!1},d(t){R(e,t)}}}function Cn(o){let e;return{c(){e=d("div"),this.h()},l(s){e=f(s,"DIV",{class:!0}),m(e).forEach(u),this.h()},h(){c(e,"class","pause-filled text-white")},m(s,t){ie(s,e,t)},i:Tt,o:Tt,d(s){s&&u(e)}}}function Pn(o){let e,s;return e=new dl({props:{size:20,class:"text-white ml-0.5"}}),{c(){X(e.$$.fragment)},l(t){J(e.$$.fragment,t)},m(t,l){K(e,t,l),s=!0},i(t){s||($(e.$$.fragment,t),s=!0)},o(t){y(e.$$.fragment,t),s=!1},d(t){R(e,t)}}}function xn(o){let e;return{c(){e=d("div"),this.h()},l(s){e=f(s,"DIV",{class:!0}),m(e).forEach(u),this.h()},h(){c(e,"class","pause-filled text-white scale-150")},m(s,t){ie(s,e,t)},i:Tt,o:Tt,d(s){s&&u(e)}}}function Il(o){let e,s,t,l;return{c(){e=d("audio"),this.h()},l(n){e=f(n,"AUDIO",{src:!0,style:!0}),m(e).forEach(u),this.h()},h(){_l(e.src,s=o[7])||c(e,"src",s),Kt(e,"display","none")},m(n,r){ie(n,e,r),o[32](e),t||(l=[F(e,"loadedmetadata",o[21]),F(e,"timeupdate",o[22]),F(e,"play",o[23]),F(e,"pause",o[24])],t=!0)},p(n,r){r[0]&128&&!_l(e.src,s=n[7])&&c(e,"src",s)},d(n){n&&u(e),o[32](null),t=!1,al(l)}}}function Dl(o){let e=o[44].name+"",s,t,l=o[44].badge&&Un(o);return{c(){s=P(e),l&&l.c(),t=At()},l(n){s=C(n,e),l&&l.l(n),t=At()},m(n,r){ie(n,s,r),l&&l.m(n,r),ie(n,t,r)},p(n,r){n[44].badge&&l.p(n,r)},d(n){n&&(u(s),u(t)),l&&l.d(n)}}}function Un(o){let e,s,t,l=o[44].badge+"",n,r;return{c(){e=P(" "),s=d("span"),t=P("("),n=P(l),r=P(")"),this.h()},l(i){e=C(i," "),s=f(i,"SPAN",{class:!0});var h=m(s);t=C(h,"("),n=C(h,l),r=C(h,")"),h.forEach(u),this.h()},h(){c(s,"class","text-xs text-gray-500")},m(i,h){ie(i,e,h),ie(i,s,h),a(s,t),a(s,n),a(s,r)},p:Tt,d(i){i&&(u(e),u(s))}}}function Sl(o){let e,s=o[44].name===o[2]&&Dl(o);return{c(){s&&s.c(),e=At()},l(t){s&&s.l(t),e=At()},m(t,l){s&&s.m(t,l),ie(t,e,l)},p(t,l){t[44].name===t[2]?s?s.p(t,l):(s=Dl(t),s.c(),s.m(e.parentNode,e)):s&&(s.d(1),s=null)},d(t){t&&u(e),s&&s.d(t)}}}function Vl(o){let e,s=Vt(o[17]),t=[];for(let l=0;l<s.length;l+=1)t[l]=Al(wl(o,s,l));return{c(){e=d("div");for(let l=0;l<t.length;l+=1)t[l].c();this.h()},l(l){e=f(l,"DIV",{class:!0});var n=m(e);for(let r=0;r<t.length;r+=1)t[r].l(n);n.forEach(u),this.h()},h(){c(e,"class","absolute top-full left-0 right-0 mt-1 bg-white border border-gray-200 rounded-lg shadow-lg z-10")},m(l,n){ie(l,e,n);for(let r=0;r<t.length;r+=1)t[r]&&t[r].m(e,null)},p(l,n){if(n[0]&131108){s=Vt(l[17]);let r;for(r=0;r<s.length;r+=1){const i=wl(l,s,r);t[r]?t[r].p(i,n):(t[r]=Al(i),t[r].c(),t[r].m(e,null))}for(;r<t.length;r+=1)t[r].d(1);t.length=s.length}},d(l){l&&u(e),ol(t,l)}}}function jn(o){let e,s,t,l=o[44].badge+"",n,r;return{c(){e=P(" "),s=d("span"),t=P("("),n=P(l),r=P(")"),this.h()},l(i){e=C(i," "),s=f(i,"SPAN",{class:!0});var h=m(s);t=C(h,"("),n=C(h,l),r=C(h,")"),h.forEach(u),this.h()},h(){c(s,"class","text-xs text-gray-500")},m(i,h){ie(i,e,h),ie(i,s,h),a(s,t),a(s,n),a(s,r)},p:Tt,d(i){i&&(u(e),u(s))}}}function Al(o){let e,s=o[44].name+"",t,l,n,r,i,h=o[44].badge&&jn(o);function E(){return o[34](o[44])}return{c(){e=d("button"),t=P(s),h&&h.c(),l=k(),this.h()},l(N){e=f(N,"BUTTON",{class:!0});var I=m(e);t=C(I,s),h&&h.l(I),l=v(I),I.forEach(u),this.h()},h(){c(e,"class",n="w-full px-3 py-2 text-left hover:bg-gray-50 transition-colors text-sm "+(o[44].name===o[2]?"bg-gray-100":""))},m(N,I){ie(N,e,I),a(e,t),h&&h.m(e,null),a(e,l),r||(i=F(e,"click",E),r=!0)},p(N,I){o=N,o[44].badge&&h.p(o,I),I[0]&4&&n!==(n="w-full px-3 py-2 text-left hover:bg-gray-50 transition-colors text-sm "+(o[44].name===o[2]?"bg-gray-100":""))&&c(e,"class",n)},d(N){N&&u(e),h&&h.d(),r=!1,i()}}}function Cl(o){let e,s,t,l=o[41].name[0]+"",n,r,i,h=o[41].name+"",E,N,I,g=o[41].description+"",p,b,D,U,q;function Se(){return o[35](o[41])}return{c(){e=d("button"),s=d("div"),t=d("div"),n=P(l),r=k(),i=d("span"),E=P(h),N=k(),I=d("div"),p=P(g),b=k(),this.h()},l(z){e=f(z,"BUTTON",{class:!0});var V=m(e);s=f(V,"DIV",{class:!0});var A=m(s);t=f(A,"DIV",{class:!0});var le=m(t);n=C(le,l),le.forEach(u),r=v(A),i=f(A,"SPAN",{class:!0});var Ve=m(i);E=C(Ve,h),Ve.forEach(u),A.forEach(u),N=v(V),I=f(V,"DIV",{class:!0});var ue=m(I);p=C(ue,g),ue.forEach(u),b=v(V),V.forEach(u),this.h()},h(){c(t,"class","w-8 h-8 bg-gradient-to-br from-amber-400 to-orange-500 rounded-full flex items-center justify-center text-white text-xs font-medium"),c(i,"class","text-sm font-medium"),c(s,"class","flex items-center gap-2"),c(I,"class","text-xs text-gray-500"),c(e,"class",D="w-full flex items-center justify-between p-2 rounded-md hover:bg-gray-50 transition-colors text-left "+(o[41].name===o[1]?"bg-gray-100":""))},m(z,V){ie(z,e,V),a(e,s),a(s,t),a(t,n),a(s,r),a(s,i),a(i,E),a(e,N),a(e,I),a(I,p),a(e,b),U||(q=F(e,"click",Se),U=!0)},p(z,V){o=z,V[0]&2&&D!==(D="w-full flex items-center justify-between p-2 rounded-md hover:bg-gray-50 transition-colors text-left "+(o[41].name===o[1]?"bg-gray-100":""))&&c(e,"class",D)},d(z){z&&u(e),U=!1,q()}}}function zn(o){let e,s,t,l,n,r,i,h,E,N,I,g,p,b,D,U,q,Se,z,V,A,le,Ve,ue,_e,L,W,O,fe,We;q=new dn({props:{size:14}}),le=new Xl({props:{size:14}});const Z=[Dn,In],Q=[];function xe(j,B){return j[4]==="ui"?0:1}return L=xe(o),W=Q[L]=Z[L](o),{c(){e=d("div"),s=d("header"),t=d("div"),l=d("div"),n=d("div"),r=d("button"),i=P("API"),E=k(),N=d("button"),I=P("Local"),p=k(),b=d("div"),D=d("div"),U=d("button"),X(q.$$.fragment),Se=P(`
|
| 15 |
+
UI`),V=k(),A=d("button"),X(le.$$.fragment),Ve=P(`
|
| 16 |
+
Code`),_e=k(),W.c(),this.h()},l(j){e=f(j,"DIV",{class:!0});var B=m(e);s=f(B,"HEADER",{class:!0});var me=m(s);t=f(me,"DIV",{class:!0});var ne=m(t);l=f(ne,"DIV",{class:!0});var tt=m(l);n=f(tt,"DIV",{class:!0});var $e=m(n);r=f($e,"BUTTON",{class:!0});var se=m(r);i=C(se,"API"),se.forEach(u),E=v($e),N=f($e,"BUTTON",{class:!0});var pe=m(N);I=C(pe,"Local"),pe.forEach(u),$e.forEach(u),tt.forEach(u),p=v(ne),b=f(ne,"DIV",{class:!0});var ye=m(b);D=f(ye,"DIV",{class:!0});var T=m(D);U=f(T,"BUTTON",{class:!0});var we=m(U);J(q.$$.fragment,we),Se=C(we,`
|
| 17 |
+
UI`),we.forEach(u),V=v(T),A=f(T,"BUTTON",{class:!0});var de=m(A);J(le.$$.fragment,de),Ve=C(de,`
|
| 18 |
+
Code`),de.forEach(u),T.forEach(u),ye.forEach(u),ne.forEach(u),me.forEach(u),_e=v(B),W.l(B),B.forEach(u),this.h()},h(){c(r,"class",h="px-3 py-1 text-sm font-medium rounded transition-colors "+(o[3]==="api"?"bg-white shadow-sm":"text-gray-600")),c(N,"class",g="px-3 py-1 text-sm font-medium rounded transition-colors "+(o[3]==="local"?"bg-white shadow-sm":"text-gray-600")),c(n,"class","flex items-center bg-gray-100 rounded-md p-0.5"),c(l,"class","flex items-center gap-3"),c(U,"class",z="flex items-center gap-1.5 px-3 py-1 text-sm font-medium rounded transition-colors "+(o[4]==="ui"?"bg-white shadow-sm":"text-gray-600")),c(A,"class",ue="flex items-center gap-1.5 px-3 py-1 text-sm font-medium rounded transition-colors "+(o[4]==="code"?"bg-white shadow-sm":"text-gray-600")),c(D,"class","flex items-center bg-gray-100 rounded-md p-0.5"),c(b,"class","flex items-center gap-2"),c(t,"class","flex items-center justify-between px-4 py-2"),c(s,"class","border-b border-gray-200 bg-white"),c(e,"class","flex flex-col h-full")},m(j,B){ie(j,e,B),a(e,s),a(s,t),a(t,l),a(l,n),a(n,r),a(r,i),a(n,E),a(n,N),a(N,I),a(t,p),a(t,b),a(b,D),a(D,U),K(q,U,null),a(U,Se),a(D,V),a(D,A),K(le,A,null),a(A,Ve),a(e,_e),Q[L].m(e,null),O=!0,fe||(We=[F(r,"click",o[27]),F(N,"click",o[28]),F(U,"click",o[29]),F(A,"click",o[30]),F(e,"click",o[26])],fe=!0)},p(j,B){(!O||B[0]&8&&h!==(h="px-3 py-1 text-sm font-medium rounded transition-colors "+(j[3]==="api"?"bg-white shadow-sm":"text-gray-600")))&&c(r,"class",h),(!O||B[0]&8&&g!==(g="px-3 py-1 text-sm font-medium rounded transition-colors "+(j[3]==="local"?"bg-white shadow-sm":"text-gray-600")))&&c(N,"class",g),(!O||B[0]&16&&z!==(z="flex items-center gap-1.5 px-3 py-1 text-sm font-medium rounded transition-colors "+(j[4]==="ui"?"bg-white shadow-sm":"text-gray-600")))&&c(U,"class",z),(!O||B[0]&16&&ue!==(ue="flex items-center gap-1.5 px-3 py-1 text-sm font-medium rounded transition-colors "+(j[4]==="code"?"bg-white shadow-sm":"text-gray-600")))&&c(A,"class",ue);let me=L;L=xe(j),L===me?Q[L].p(j,B):(qt(),y(Q[me],1,1,()=>{Q[me]=null}),Wt(),W=Q[L],W?W.p(j,B):(W=Q[L]=Z[L](j),W.c()),$(W,1),W.m(e,null))},i(j){O||($(q.$$.fragment,j),$(le.$$.fragment,j),$(W),O=!0)},o(j){y(q.$$.fragment,j),y(le.$$.fragment,j),y(W),O=!1},d(j){j&&u(e),R(q),R(le),Q[L].d(),fe=!1,al(We)}}}function Ln(){if(console.log("Getting access token..."),typeof window<"u"&&window.gradio&&window.gradio.auth_token)return console.log("Found Gradio auth token:",window.gradio.auth_token.substring(0,10)+"..."),window.gradio.auth_token;const o=document.querySelector('meta[name="hf-oauth-token"]');if(o){const t=o.getAttribute("content");if(t)return console.log("Found token in meta tag:",t.substring(0,10)+"..."),t}const e=["hf_access_token","hf_token","huggingface_token","oauth_token","access_token"];for(const t of e){const l=localStorage.getItem(t);if(l)return console.log(`Found token in localStorage['${t}']:`,l.substring(0,10)+"..."),l}for(const t of e){const l=sessionStorage.getItem(t);if(l)return console.log(`Found token in sessionStorage['${t}']:`,l.substring(0,10)+"..."),l}const s=document.cookie.split(";");for(const t of s){const[l,n]=t.trim().split("=");if(l&&(l.includes("token")||l.includes("hf")||l.includes("oauth")))return console.log(`Found potential token in cookie '${l}':`,n?n.substring(0,10)+"...":"empty"),decodeURIComponent(n)}try{const t=document.querySelector("script[data-hf-token]");if(t){const l=t.getAttribute("data-hf-token");if(l)return console.log("Found token in script data attribute:",l.substring(0,10)+"..."),l}}catch{}return console.log("No OAuth token found in any storage location"),console.log("Available localStorage keys:",Object.keys(localStorage)),console.log("Available sessionStorage keys:",Object.keys(sessionStorage)),console.log("Available cookies:",document.cookie),console.log("Available global objects:",{window:typeof window,gradio:typeof(window==null?void 0:window.gradio),hf:typeof(window==null?void 0:window.hf),huggingface:typeof(window==null?void 0:window.huggingface)}),console.log("URL search params:",new URLSearchParams(window.location.search).toString()),console.log("All meta tags:",Array.from(document.getElementsByTagName("meta")).map(t=>{var l;return{name:t.name,content:((l=t.content)==null?void 0:l.substring(0,20))+"..."}})),null}function St(o){const e=Math.floor(o/60),s=Math.floor(o%60);return`${e}:${s.toString().padStart(2,"0")}`}function Pl(){console.log("Share audio")}function On(o,e,s){let t="In a world where knowledge flowed freely like rivers connecting distant lands, a community of passionate researchers and developers worked together to build something extraordinary. They believed that artificial intelligence should belong to everyone, not locked away in corporate towers. Day by day, they shared their discoveries, their code, and their dreams with people across the globe. Their open source models could understand language, generate images, and even speak with human-like voices. This collaborative spirit sparked innovation in ways that no single company could achieve alone, proving that when brilliant minds unite around a common cause, they can democratize the future of technology.",l="Novia",n="Chatterbox",r="api",i="ui",h=!1,E=!1,N=null,I=1,g=.5,p=.75,b=0,D=!1,U=0,q=0,Se="",z=null;const V=[{id:"chatterbox",name:"Chatterbox",badge:"recommended"},{id:"kokoro",name:"Kokoro",badge:"faster but lower quality"}],A=[{id:"novia",name:"Novia",description:"Warm, conversational voice"},{id:"sarah",name:"Sarah",description:"Clear, professional tone"},{id:"alex",name:"Alex",description:"Friendly, approachable voice"},{id:"emma",name:"Emma",description:"Calm, soothing delivery"}];async function le(){if(t.trim()){s(6,E=!0),s(7,N=null),s(13,U=0),s(12,D=!1),s(15,Se=t.length>30?t.substring(0,30)+"...":t);try{const T=Ln();console.log("Access token for API call:",T?"Found ("+T.substring(0,10)+"...)":"None");const we={text:t,voice_id:l.toLowerCase(),model_id:n.toLowerCase(),mode:r,access_token:T,parameters:{speed:I,stability:g,similarity:p,style_exaggeration:b}};console.log("Sending request to /api/tts/generate:",we);const de=await fetch("/api/tts/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(we)});if(console.log("API response status:",de.status),!de.ok){const be=await de.text();throw console.error("API error response:",be),new Error(`HTTP error! status: ${de.status}, body: ${be}`)}const Ee=await de.json();if(console.log("API response result:",Ee),Ee.success&&Ee.audio_url)s(7,N=Ee.audio_url);else{const be=Ee.error||"Unknown error occurred";alert(`❌ ${be}`),s(7,N=null)}}catch(T){console.error("Error generating speech:",T),alert("❌ Network error: Failed to connect to the server"),s(7,N=null)}finally{s(6,E=!1)}}}function Ve(){z&&(D?z.pause():z.play())}function ue(){z&&(s(14,q=z.duration),z.play())}function _e(){z&&s(13,U=z.currentTime)}function L(){s(12,D=!0)}function W(){s(12,D=!1)}function O(){if(N){const T=document.createElement("a");T.href=N,T.download="speech.wav",T.click()}}function fe(T){T.target.closest(".model-dropdown")||s(5,h=!1)}const We=()=>s(3,r="api"),Z=()=>s(3,r="local"),Q=()=>s(4,i="ui"),xe=()=>s(4,i="code");function j(){t=this.value,s(0,t)}function B(T){jl[T?"unshift":"push"](()=>{z=T,s(16,z)})}const me=()=>s(5,h=!h),ne=T=>{s(2,n=T.name),s(5,h=!1)},tt=T=>s(1,l=T.name);function $e(){I=sl(this.value),s(8,I)}function se(){g=sl(this.value),s(9,g)}function pe(){p=sl(this.value),s(10,p)}function ye(){b=sl(this.value),s(11,b)}return[t,l,n,r,i,h,E,N,I,g,p,b,D,U,q,Se,z,V,A,le,Ve,ue,_e,L,W,O,fe,We,Z,Q,xe,j,B,me,ne,tt,$e,se,pe,ye]}class Hn extends Me{constructor(e){super(),He(this,e,On,zn,Pe,{},null,[-1,-1])}}export{Hn as component};
|
hfstudio/static/_app/immutable/nodes/3.CqKlOYDp.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
import{S as V,i as j,s as q,n as A,d,b as y,c as h,m as N,o as f,p as O,h as E,e as p,f as b,q as H,k as P,j as _,l as z,r as M,a as S,u as R,g as I,t as C}from"../chunks/BI_gvUUO.js";import"../chunks/IHki7fMi.js";import{g as F}from"../chunks/CB1vOLR2.js";import{p as B}from"../chunks/DOFcFfVQ.js";function G(m){let s,t,l,e,r;return{c(){s=_("div"),t=_("div"),l=P(),e=_("p"),r=C(m[0]),this.h()},l(u){s=p(u,"DIV",{class:!0});var o=b(s);t=p(o,"DIV",{class:!0}),b(t).forEach(d),l=E(o),e=p(o,"P",{});var n=b(e);r=I(n,m[0]),n.forEach(d),o.forEach(d),this.h()},h(){f(t,"class","animate-spin w-8 h-8 border-2 border-amber-400 border-t-transparent rounded-full mx-auto mb-2"),f(s,"class","text-gray-600 mb-4")},m(u,o){y(u,s,o),h(s,t),h(s,l),h(s,e),h(e,r)},p(u,o){o&1&&S(r,u[0])},d(u){u&&d(s)}}}function J(m){let s,t,l,e,r,u,o,n,k="Return to HFStudio",g,x;return{c(){s=_("div"),t=_("p"),l=C(m[0]),e=P(),r=_("p"),u=C(m[1]),o=P(),n=_("button"),n.textContent=k,this.h()},l(c){s=p(c,"DIV",{class:!0});var a=b(s);t=p(a,"P",{class:!0});var i=b(t);l=I(i,m[0]),i.forEach(d),e=E(a),r=p(a,"P",{class:!0});var v=b(r);u=I(v,m[1]),v.forEach(d),a.forEach(d),o=E(c),n=p(c,"BUTTON",{class:!0,"data-svelte-h":!0}),H(n)!=="svelte-lo2i5l"&&(n.textContent=k),this.h()},h(){f(t,"class","font-medium"),f(r,"class","text-sm mt-1"),f(s,"class","text-red-600 mb-4"),f(n,"class","px-4 py-2 bg-gradient-to-r from-amber-400 to-orange-500 text-white rounded-lg hover:from-amber-500 hover:to-orange-600 transition-colors")},m(c,a){y(c,s,a),h(s,t),h(t,l),h(s,e),h(s,r),h(r,u),y(c,o,a),y(c,n,a),g||(x=R(n,"click",m[2]),g=!0)},p(c,a){a&1&&S(l,c[0]),a&2&&S(u,c[1])},d(c){c&&(d(s),d(o),d(n)),g=!1,x()}}}function L(m){let s,t,l,e,r,u,o,n,k="HFStudio Authentication",g;function x(i,v){return i[1]?J:G}let c=x(m),a=c(m);return{c(){s=P(),t=_("div"),l=_("div"),e=_("div"),r=_("img"),o=P(),n=_("h1"),n.textContent=k,g=P(),a.c(),this.h()},l(i){O("svelte-17lku3q",document.head).forEach(d),s=E(i),t=p(i,"DIV",{class:!0});var D=b(t);l=p(D,"DIV",{class:!0});var T=b(l);e=p(T,"DIV",{class:!0});var w=b(e);r=p(w,"IMG",{src:!0,alt:!0,class:!0}),o=E(w),n=p(w,"H1",{class:!0,"data-svelte-h":!0}),H(n)!=="svelte-l7zisw"&&(n.textContent=k),g=E(w),a.l(w),w.forEach(d),T.forEach(d),D.forEach(d),this.h()},h(){document.title="Authenticating with Hugging Face - HFStudio",N(r.src,u="/assets/hf-logo.png")||f(r,"src",u),f(r,"alt","HF Logo"),f(r,"class","w-12 h-12 mx-auto mb-4"),f(n,"class","text-xl font-semibold mb-2"),f(e,"class","text-center"),f(l,"class","max-w-md w-full bg-white rounded-lg shadow-md p-6"),f(t,"class","min-h-screen flex items-center justify-center bg-gray-50")},m(i,v){y(i,s,v),y(i,t,v),h(t,l),h(l,e),h(e,r),h(e,o),h(e,n),h(e,g),a.m(e,null)},p(i,[v]){c===(c=x(i))&&a?a.p(i,v):(a.d(1),a=c(i),a&&(a.c(),a.m(e,null)))},i:A,o:A,d(i){i&&(d(s),d(t)),a.d()}}}function U(m,s,t){let l;z(m,B,o=>t(3,l=o));let e="Processing...",r=null;return M(async()=>{try{const o=l.url.searchParams.get("code"),n=l.url.searchParams.get("state"),k=l.url.searchParams.get("error"),g=l.url.searchParams.get("error_description");if(k){t(1,r=g||k),t(0,e="Authentication failed");return}if(!o){t(1,r="No authorization code received"),t(0,e="Authentication failed");return}const x=sessionStorage.getItem("oauth_state");if(x&&n!==x){t(1,r="Invalid state parameter"),t(0,e="Authentication failed");return}const c=await fetch("/api/auth/token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:o})});if(!c.ok){const i=await c.text();throw console.error("Token exchange failed:",i),new Error(`Failed to exchange code for token: ${i}`)}const a=await c.json();localStorage.setItem("hf_access_token",a.access_token),t(0,e="Successfully authenticated!"),setTimeout(()=>{F("/")},2e3)}catch(o){t(1,r=o.message),t(0,e="Authentication failed")}}),[e,r,()=>F("/")]}class Y extends V{constructor(s){super(),j(this,s,U,L,q,{})}}export{Y as component};
|
hfstudio/static/index.html
CHANGED
|
@@ -6,25 +6,25 @@
|
|
| 6 |
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
<title>HFStudio - Text to Speech</title>
|
| 8 |
|
| 9 |
-
<link rel="modulepreload" href="/_app/immutable/entry/start.
|
| 10 |
-
<link rel="modulepreload" href="/_app/immutable/chunks/
|
| 11 |
-
<link rel="modulepreload" href="/_app/immutable/chunks/
|
| 12 |
-
<link rel="modulepreload" href="/_app/immutable/entry/app.
|
| 13 |
<link rel="modulepreload" href="/_app/immutable/chunks/IHki7fMi.js">
|
| 14 |
</head>
|
| 15 |
<body data-sveltekit-preload-data="hover">
|
| 16 |
<div style="display: contents">
|
| 17 |
<script>
|
| 18 |
{
|
| 19 |
-
|
| 20 |
base: ""
|
| 21 |
};
|
| 22 |
|
| 23 |
const element = document.currentScript.parentElement;
|
| 24 |
|
| 25 |
Promise.all([
|
| 26 |
-
import("/_app/immutable/entry/start.
|
| 27 |
-
import("/_app/immutable/entry/app.
|
| 28 |
]).then(([kit, app]) => {
|
| 29 |
kit.start(app, element);
|
| 30 |
});
|
|
|
|
| 6 |
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 7 |
<title>HFStudio - Text to Speech</title>
|
| 8 |
|
| 9 |
+
<link rel="modulepreload" href="/_app/immutable/entry/start.7dRPTxlt.js">
|
| 10 |
+
<link rel="modulepreload" href="/_app/immutable/chunks/CB1vOLR2.js">
|
| 11 |
+
<link rel="modulepreload" href="/_app/immutable/chunks/BI_gvUUO.js">
|
| 12 |
+
<link rel="modulepreload" href="/_app/immutable/entry/app.B18cP-tp.js">
|
| 13 |
<link rel="modulepreload" href="/_app/immutable/chunks/IHki7fMi.js">
|
| 14 |
</head>
|
| 15 |
<body data-sveltekit-preload-data="hover">
|
| 16 |
<div style="display: contents">
|
| 17 |
<script>
|
| 18 |
{
|
| 19 |
+
__sveltekit_18kzuba = {
|
| 20 |
base: ""
|
| 21 |
};
|
| 22 |
|
| 23 |
const element = document.currentScript.parentElement;
|
| 24 |
|
| 25 |
Promise.all([
|
| 26 |
+
import("/_app/immutable/entry/start.7dRPTxlt.js"),
|
| 27 |
+
import("/_app/immutable/entry/app.B18cP-tp.js")
|
| 28 |
]).then(([kit, app]) => {
|
| 29 |
kit.start(app, element);
|
| 30 |
});
|