GitHub Action
commited on
Commit
Β·
2c9f03f
1
Parent(s):
4a3b056
Sync from GitHub: def82365a1dbb3e6e2e9e20d2593fb6548b79150
Browse files- .gitattributes +6 -0
- frontend/src/routes/voice-cloning/+page.svelte +10 -6
- hfstudio/server.py +55 -10
- hfstudio/static/_app/immutable/chunks/DFBNfz2t.js +1 -0
- hfstudio/static/_app/immutable/chunks/DiPl7Yg5.js +3 -0
- hfstudio/static/_app/immutable/entry/app.CtX5T3n3.js +2 -0
- hfstudio/static/_app/immutable/entry/start.BGBHC2PU.js +1 -0
- hfstudio/static/_app/immutable/nodes/0.TRqG0fGK.js +4 -0
- hfstudio/static/_app/immutable/nodes/1.B8bDkK4r.js +1 -0
- hfstudio/static/_app/immutable/nodes/4.v7i3IxTN.js +14 -0
- hfstudio/static/_app/version.json +1 -1
- hfstudio/static/index.html +6 -6
- pyproject.toml +1 -0
.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/voice-cloning/+page.svelte
CHANGED
|
@@ -144,10 +144,14 @@
|
|
| 144 |
try {
|
| 145 |
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
|
| 146 |
|
| 147 |
-
// Try to use
|
| 148 |
let options = {};
|
| 149 |
-
if (MediaRecorder.isTypeSupported('audio/
|
| 150 |
-
options.mimeType = 'audio/
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
} else if (MediaRecorder.isTypeSupported('audio/webm')) {
|
| 152 |
options.mimeType = 'audio/webm';
|
| 153 |
}
|
|
@@ -173,7 +177,7 @@
|
|
| 173 |
};
|
| 174 |
|
| 175 |
mediaRecorder.onstop = () => {
|
| 176 |
-
const audioBlob = new Blob(audioChunks, { type: 'audio/
|
| 177 |
const audioUrl = URL.createObjectURL(audioBlob);
|
| 178 |
const recording = {
|
| 179 |
id: Date.now(),
|
|
@@ -298,7 +302,7 @@
|
|
| 298 |
try {
|
| 299 |
// Create FormData to send the audio file
|
| 300 |
const formData = new FormData();
|
| 301 |
-
formData.append('audio_file', selectedRecording.blob, 'recording.
|
| 302 |
|
| 303 |
const response = await fetch('/api/voice/transcribe', {
|
| 304 |
method: 'POST',
|
|
@@ -335,7 +339,7 @@
|
|
| 335 |
|
| 336 |
try {
|
| 337 |
const uploadFormData = new FormData();
|
| 338 |
-
uploadFormData.append('audio_file', selectedRecording.blob, 'recording.
|
| 339 |
|
| 340 |
const voiceName = `Voice_${Date.now()}`;
|
| 341 |
const transcript = encodeURIComponent(result.transcript);
|
|
|
|
| 144 |
try {
|
| 145 |
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
|
| 146 |
|
| 147 |
+
// Try to use MP3 format if supported, otherwise use WebM or default
|
| 148 |
let options = {};
|
| 149 |
+
if (MediaRecorder.isTypeSupported('audio/mp3')) {
|
| 150 |
+
options.mimeType = 'audio/mp3';
|
| 151 |
+
} else if (MediaRecorder.isTypeSupported('audio/mpeg')) {
|
| 152 |
+
options.mimeType = 'audio/mpeg';
|
| 153 |
+
} else if (MediaRecorder.isTypeSupported('audio/webm;codecs=opus')) {
|
| 154 |
+
options.mimeType = 'audio/webm;codecs=opus';
|
| 155 |
} else if (MediaRecorder.isTypeSupported('audio/webm')) {
|
| 156 |
options.mimeType = 'audio/webm';
|
| 157 |
}
|
|
|
|
| 177 |
};
|
| 178 |
|
| 179 |
mediaRecorder.onstop = () => {
|
| 180 |
+
const audioBlob = new Blob(audioChunks, { type: options.mimeType || 'audio/webm' });
|
| 181 |
const audioUrl = URL.createObjectURL(audioBlob);
|
| 182 |
const recording = {
|
| 183 |
id: Date.now(),
|
|
|
|
| 302 |
try {
|
| 303 |
// Create FormData to send the audio file
|
| 304 |
const formData = new FormData();
|
| 305 |
+
formData.append('audio_file', selectedRecording.blob, 'recording.mp3');
|
| 306 |
|
| 307 |
const response = await fetch('/api/voice/transcribe', {
|
| 308 |
method: 'POST',
|
|
|
|
| 339 |
|
| 340 |
try {
|
| 341 |
const uploadFormData = new FormData();
|
| 342 |
+
uploadFormData.append('audio_file', selectedRecording.blob, 'recording.mp3');
|
| 343 |
|
| 344 |
const voiceName = `Voice_${Date.now()}`;
|
| 345 |
const transcript = encodeURIComponent(result.transcript);
|
hfstudio/server.py
CHANGED
|
@@ -40,6 +40,7 @@ from hfstudio.database import create_tables, get_db, CodeHistory, Voice, Session
|
|
| 40 |
from sqlalchemy.orm import Session
|
| 41 |
from transformers import pipeline
|
| 42 |
import soundfile as sf
|
|
|
|
| 43 |
|
| 44 |
|
| 45 |
class TTSRequest(BaseModel):
|
|
@@ -121,10 +122,21 @@ def require_auth(
|
|
| 121 |
|
| 122 |
static_dir = Path(__file__).parent / "static"
|
| 123 |
models_dir = Path(__file__).parent.parent / "models"
|
| 124 |
-
voices_dir = Path(__file__).parent / "voices"
|
| 125 |
|
| 126 |
-
|
| 127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
|
| 129 |
|
| 130 |
def generate_voice_url_id() -> str:
|
|
@@ -134,7 +146,7 @@ def generate_voice_url_id() -> str:
|
|
| 134 |
|
| 135 |
def get_voice_file_path(url_id: str) -> Path:
|
| 136 |
"""Get the local file path for a voice file."""
|
| 137 |
-
return voices_dir / f"{url_id}.
|
| 138 |
|
| 139 |
|
| 140 |
def cleanup_expired_voices(db: Session):
|
|
@@ -829,6 +841,7 @@ async def oauth_callback(
|
|
| 829 |
# Production - use full origin URL from referer or fallback to www.hfstud.io
|
| 830 |
if referer:
|
| 831 |
from urllib.parse import urlparse
|
|
|
|
| 832 |
parsed = urlparse(referer)
|
| 833 |
base_url = f"{parsed.scheme}://{parsed.netloc}"
|
| 834 |
else:
|
|
@@ -997,8 +1010,19 @@ async def upload_voice_to_server(
|
|
| 997 |
audio_content = await audio_file.read()
|
| 998 |
|
| 999 |
try:
|
| 1000 |
-
|
| 1001 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1002 |
|
| 1003 |
# Set expiration to 24 hours from now
|
| 1004 |
expires_at = datetime.utcnow() + timedelta(hours=24)
|
|
@@ -1114,8 +1138,8 @@ async def serve_voice_file(voice_id: str, db: Session = Depends(get_db)):
|
|
| 1114 |
|
| 1115 |
return FileResponse(
|
| 1116 |
path=str(file_path),
|
| 1117 |
-
media_type="audio/
|
| 1118 |
-
filename=f"{voice.voice_name}.
|
| 1119 |
)
|
| 1120 |
|
| 1121 |
except HTTPException:
|
|
@@ -1170,7 +1194,9 @@ async def delete_voice(
|
|
| 1170 |
|
| 1171 |
|
| 1172 |
@app.get("/{path:path}")
|
| 1173 |
-
async def serve_spa(
|
|
|
|
|
|
|
| 1174 |
if (
|
| 1175 |
path.startswith("api/")
|
| 1176 |
or path.startswith("docs")
|
|
@@ -1180,7 +1206,26 @@ async def serve_spa(path: str):
|
|
| 1180 |
|
| 1181 |
index_path = static_dir / "index.html"
|
| 1182 |
if index_path.exists():
|
| 1183 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1184 |
else:
|
| 1185 |
return HTMLResponse("""
|
| 1186 |
<html>
|
|
|
|
| 40 |
from sqlalchemy.orm import Session
|
| 41 |
from transformers import pipeline
|
| 42 |
import soundfile as sf
|
| 43 |
+
from pydub import AudioSegment
|
| 44 |
|
| 45 |
|
| 46 |
class TTSRequest(BaseModel):
|
|
|
|
| 122 |
|
| 123 |
static_dir = Path(__file__).parent / "static"
|
| 124 |
models_dir = Path(__file__).parent.parent / "models"
|
|
|
|
| 125 |
|
| 126 |
+
|
| 127 |
+
# Create voices directory in the same location as the database
|
| 128 |
+
def get_voices_dir():
|
| 129 |
+
"""Get voices directory, using same location as database."""
|
| 130 |
+
if os.getenv("SPACE_ID"):
|
| 131 |
+
voices_dir = Path("/data/.huggingface/hfstudio/voices")
|
| 132 |
+
else:
|
| 133 |
+
voices_dir = Path(__file__).parent / "voices"
|
| 134 |
+
|
| 135 |
+
voices_dir.mkdir(parents=True, exist_ok=True)
|
| 136 |
+
return voices_dir
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
voices_dir = get_voices_dir()
|
| 140 |
|
| 141 |
|
| 142 |
def generate_voice_url_id() -> str:
|
|
|
|
| 146 |
|
| 147 |
def get_voice_file_path(url_id: str) -> Path:
|
| 148 |
"""Get the local file path for a voice file."""
|
| 149 |
+
return voices_dir / f"{url_id}.mp3"
|
| 150 |
|
| 151 |
|
| 152 |
def cleanup_expired_voices(db: Session):
|
|
|
|
| 841 |
# Production - use full origin URL from referer or fallback to www.hfstud.io
|
| 842 |
if referer:
|
| 843 |
from urllib.parse import urlparse
|
| 844 |
+
|
| 845 |
parsed = urlparse(referer)
|
| 846 |
base_url = f"{parsed.scheme}://{parsed.netloc}"
|
| 847 |
else:
|
|
|
|
| 1010 |
audio_content = await audio_file.read()
|
| 1011 |
|
| 1012 |
try:
|
| 1013 |
+
# Save the original audio to a temporary file first
|
| 1014 |
+
with tempfile.NamedTemporaryFile(delete=False, suffix=".tmp") as temp_file:
|
| 1015 |
+
temp_file.write(audio_content)
|
| 1016 |
+
temp_audio_path = temp_file.name
|
| 1017 |
+
|
| 1018 |
+
try:
|
| 1019 |
+
# Convert audio to MP3 using pydub
|
| 1020 |
+
audio = AudioSegment.from_file(temp_audio_path)
|
| 1021 |
+
audio.export(str(file_path), format="mp3", bitrate="128k")
|
| 1022 |
+
finally:
|
| 1023 |
+
# Clean up temporary file
|
| 1024 |
+
if os.path.exists(temp_audio_path):
|
| 1025 |
+
os.unlink(temp_audio_path)
|
| 1026 |
|
| 1027 |
# Set expiration to 24 hours from now
|
| 1028 |
expires_at = datetime.utcnow() + timedelta(hours=24)
|
|
|
|
| 1138 |
|
| 1139 |
return FileResponse(
|
| 1140 |
path=str(file_path),
|
| 1141 |
+
media_type="audio/mpeg",
|
| 1142 |
+
filename=f"{voice.voice_name}.mp3",
|
| 1143 |
)
|
| 1144 |
|
| 1145 |
except HTTPException:
|
|
|
|
| 1194 |
|
| 1195 |
|
| 1196 |
@app.get("/{path:path}")
|
| 1197 |
+
async def serve_spa(
|
| 1198 |
+
path: str, request: Request, session: Dict[str, Any] = Depends(get_current_session)
|
| 1199 |
+
):
|
| 1200 |
if (
|
| 1201 |
path.startswith("api/")
|
| 1202 |
or path.startswith("docs")
|
|
|
|
| 1206 |
|
| 1207 |
index_path = static_dir / "index.html"
|
| 1208 |
if index_path.exists():
|
| 1209 |
+
# Read the HTML file
|
| 1210 |
+
with open(index_path, "r", encoding="utf-8") as f:
|
| 1211 |
+
html_content = f.read()
|
| 1212 |
+
|
| 1213 |
+
# Prepare initial user data
|
| 1214 |
+
initial_user = {"authenticated": False}
|
| 1215 |
+
if session:
|
| 1216 |
+
initial_user = {"authenticated": True, "user_info": session["user_info"]}
|
| 1217 |
+
|
| 1218 |
+
# Inject initial user data script before closing head tag
|
| 1219 |
+
initial_user_script = f"""
|
| 1220 |
+
<script>
|
| 1221 |
+
window.__INITIAL_USER__ = {json.dumps(initial_user)};
|
| 1222 |
+
</script>
|
| 1223 |
+
</head>"""
|
| 1224 |
+
|
| 1225 |
+
# Replace closing head tag with script + closing head tag
|
| 1226 |
+
html_content = html_content.replace("</head>", initial_user_script)
|
| 1227 |
+
|
| 1228 |
+
return HTMLResponse(html_content, media_type="text/html")
|
| 1229 |
else:
|
| 1230 |
return HTMLResponse("""
|
| 1231 |
<html>
|
hfstudio/static/_app/immutable/chunks/DFBNfz2t.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
import{s as e}from"./DiPl7Yg5.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/chunks/DiPl7Yg5.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
var St=Object.defineProperty;var kt=(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)=>kt(e,typeof t!="symbol"?t+"":t,n);import{S as Et,U as At,$ as Rt,a0 as Tt,a1 as It,a2 as Ut,a3 as Lt,a4 as xt,G as ve,a5 as $t,V as be,n as ge,s as Ct}from"./TRxHAhOH.js";class Ze extends Et{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 Pt extends Ze{}const Ot=Object.freeze(Object.defineProperty({__proto__:null,SvelteComponent:Ze,SvelteComponentTyped:Pt,afterUpdate:At,beforeUpdate:Rt,createEventDispatcher:Tt,getAllContexts:It,getContext:Ut,hasContext:Lt,onDestroy:xt,onMount:ve,setContext:$t,tick:be},Symbol.toStringTag,{value:"Module"}));class ie{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 Nt(e,t){return e==="/"||t==="ignore"?e:t==="never"?e.endsWith("/")?e.slice(0,-1):e:t==="always"&&!e.endsWith("/")?e+"/":e}function jt(e){return e.split("%25").map(decodeURI).join("%25")}function Dt(e){for(const t in e)e[t]=decodeURIComponent(e[t]);return e}function me({href:e}){return e.split("#")[0]}function Bt(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 Ft(...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 Mt(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 qt=window.fetch;window.fetch=(e,t)=>((e instanceof Request?e.method:(t==null?void 0:t.method)||"GET")!=="GET"&&G.delete(Ie(e)),qt(e,t));const G=new Map;function zt(e,t){const n=Ie(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=Mt(a)),Promise.resolve(new Response(a,s))}return window.fetch(e,t)}function Gt(e,t,n){if(G.size>0){const r=Ie(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 Ie(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="${Ft(...a)}"]`}return r}const Yt=/^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;function Ht(e){const t=[];return{pattern:e==="/"?/^\/$/:new RegExp(`^${Wt(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=Yt.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 Kt(e){return e!==""&&!/^\([^)]+\)$/.test(e)}function Wt(e){return e.slice(1).split("/").filter(Kt)}function Jt(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 Xt({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}=Ht(o),f={id:o,exec:p=>{const u=h.exec(p);if(u)return Jt(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 Qe(e,t=JSON.parse){try{return t(sessionStorage[e])}catch{}}function Fe(e,t,n=JSON.stringify){const r=n(t);try{sessionStorage[e]=r}catch{}}const D=[];function Ue(e,t=ge){let n;const r=new Set;function a(o){if(Ct(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 Je;const x=((Je=globalThis.__sveltekit_11cx65z)==null?void 0:Je.base)??"";var Xe;const Zt=((Xe=globalThis.__sveltekit_11cx65z)==null?void 0:Xe.assets)??x??"",Qt="1761281584427",et="sveltekit:snapshot",tt="sveltekit:scroll",nt="sveltekit:states",en="sveltekit:pageurl",F="sveltekit:history",K="sveltekit:navigation",O={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},ce=location.origin;function at(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 Se(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)===ce&&e.hasAttribute("download");return{url:r,external:s,target:a,download:i}}function Q(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 Me(e){const t=Ue(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 tn(){const{set:e,subscribe:t}=Ue(!1);let n;async function r(){clearTimeout(n);try{const a=await fetch(`${Zt}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!a.ok)return!1;const i=(await a.json()).version!==Qt;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!==ce||!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 nn(e){const t=rn(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 an="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function rn(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|=an.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 on=-1,sn=-2,cn=-3,ln=-4,fn=-5,un=-6;function dn(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===on)return;if(s===cn)return NaN;if(s===ln)return 1/0;if(s===fn)return-1/0;if(s===un)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=nn(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!==sn&&(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 hn=new Set([...it]);[...hn];function pn(e){return e.filter(t=>t!=null)}const gn="x-sveltekit-invalidated",mn="x-sveltekit-trailing-slash";function ee(e){return e instanceof ie||e instanceof Te?e.status:500}function _n(e){return e instanceof Te?e.text:"Internal Error"}let T,W,we;const wn=ve.toString().includes("$$")||/function \w+\(\) \{\}/.test(ve.toString());wn?(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 yn(e){Object.assign(T,e)}const vn="/__data.json",bn=".html__data.json";function Sn(e){return e.endsWith(".html")?e.replace(/\.html$/,bn):e.replace(/\/$/,"")+vn}const qe={spanContext(){return kn},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}},kn={traceId:"",spanId:"",traceFlags:0},{tick:En}=Ot,An=new Set(["icon","shortcut icon","apple-touch-icon"]),j=Qe(tt)??{},J=Qe(et)??{},C={url:Me({}),page:Me({}),navigating:Ue(null),updated:tn()};function Le(e){j[e]=le()}function Rn(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(x||"/");e&&await e.update()}}function ze(){}let xe,ke,te,$,Ee,k;const ne=[],ae=[];let U=null;const Z=new Map,lt=new Set,Tn=new Set,Y=new Set;let b={branch:[],error:null,url:null},$e=!1,re=!1,Ge=!0,X=!1,z=!1,ft=!1,Ce=!1,ut,A,L,N;const H=new Set,Ye=new Map;async function Hn(e,t,n){var s,i,o,c,l;(s=globalThis.__sveltekit_11cx65z)!=null&&s.data&&globalThis.__sveltekit_11cx65z.data,document.URL!==location.href&&(location.href=location.href),k=e,await((o=(i=e.hooks).init)==null?void 0:o.call(i)),xe=Xt(e),$=document.documentElement,Ee=t,ke=e.nodes[0],te=e.nodes[1],ke(),te(),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 V({type:"enter",url:at(k.hash?Fn(new URL(location.href)):location.href),replace_state:!0}),a()),jn()}function In(){ne.length=0,Ce=!1}function dt(e){ae.some(t=>t==null?void 0:t.snapshot)&&(J[e]=ae.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=ae[r])==null?void 0:a.snapshot)==null||s.restore(n)})}function He(){Le(A),Fe(tt,j),dt(L),Fe(et,J)}async function Un(e,t,n,r){let a;t.invalidateAll&&(U=null),await V({type:"goto",url:at(e),keepfocus:t.keepFocus,noscroll:t.noScroll,replace_state:t.replaceState,state:t.state,redirect_count:n,nav_token:r,accept:()=>{t.invalidateAll&&(Ce=!0,a=[...Ye.keys()]),t.invalidate&&t.invalidate.forEach(Nn)}}),t.invalidateAll&&be().then(be).then(()=>{Ye.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!==(U==null?void 0:U.id)){const t={};H.add(t),U={id:e.id,token:t,promise:mt({...e,preload:t}).then(n=>(H.delete(t),n.type==="loaded"&&n.state.error&&(U=null),n))}}return U.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 pt(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 k.root({target:t,props:{...e.props,stores:C,components:ae},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))}re=!0}function oe({url:e,params:t,branch:n,status:r,error:a,route:s,form:i}){let o="never";if(x&&(e.pathname===x||e.pathname===x+"/"))o="always";else for(const f of n)(f==null?void 0:f.slash)!==void 0&&(o=f.slash);e.pathname=Nt(e.pathname,o),e.search=e.search;const c={type:"loaded",state:{url:e,params:t,branch:n,error:a,route:s},props:{constructors:pn(n).map(f=>f.node.component),page:je(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 Pe({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:qe,current:qe},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:Bt(n,()=>{o&&(c.url=!0)},u=>{o&&c.search_params.add(u)},k.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:I}=gt(u,g,n);return o&&f(_.href),I},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 gt(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=re?Gt(r,a.href,t):zt(r,t);return{resolved:a,promise:s}}function Ke(e,t,n,r,a,s){if(Ce)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(ne.some(o=>o(new URL(i))))return!0;return!1}function Oe(e,t){return(e==null?void 0:e.type)==="data"?e:(e==null?void 0:e.type)==="skip"?t??null:null}function xn(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 We({error:e,url:t,route:n,params:r}){return{type:"loaded",state:{error:e,url:t,route:n,params:r,branch:[]},props:{page:je(T),constructors:[]}}}async function mt({id:e,invalidating:t,url:n,params:r,route:a,preload:s}){if((U==null?void 0:U.id)===e)return H.delete(U.token),U.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!==se(b.url):!1,y=b.route?a.id!==b.route.id:!1,f=xn(b.url,n);let p=!1;const u=l.map((w,m)=>{var P;const v=b.branch[m],S=!!(w!=null&&w[0])&&((v==null?void 0:v.loader)!==w[1]||Ke(p,y,h,f,(P=v.server)==null?void 0:P.uses,r));return S&&(p=!0),S});if(u.some(Boolean)){try{d=await yt(n,u)}catch(w){const m=await M(w,{url:n,params:r,route:{id:e}});return H.has(s)?We({error:m,url:n,params:r,route:a}):ue({status:ee(w),error:m,url:n,route:a})}if(d.type==="redirect")return d}const g=d==null?void 0:d.nodes;let _=!1;const I=l.map(async(w,m)=>{var he;if(!w)return;const v=b.branch[m],S=g==null?void 0:g[m];if((!S||S.type==="skip")&&w[1]===(v==null?void 0:v.loader)&&!Ke(_,y,h,f,(he=v.universal)==null?void 0:he.uses,r))return v;if(_=!0,(S==null?void 0:S.type)==="error")throw S;return Pe({loader:w[1],url:n,params:r,route:a,parent:async()=>{var Be;const De={};for(let pe=0;pe<m;pe+=1)Object.assign(De,(Be=await I[pe])==null?void 0:Be.data);return De},server_data_node:Oe(S===void 0&&w[0]?{type:"skip"}:S??null,w[0]?v==null?void 0:v.server:void 0)})});for(const w of I)w.catch(()=>{});const E=[];for(let w=0;w<l.length;w+=1)if(l[w])try{E.push(await I[w])}catch(m){if(m instanceof Re)return{type:"redirect",location:m.location};if(H.has(s))return We({error:await M(m,{params:r,url:n,route:{id:a.id}}),url:n,params:r,route:a});let v=ee(m),S;if(g!=null&&g.includes(m))v=m.status??v,S=m.error;else if(m instanceof ie)S=m.body;else{if(await C.updated.check())return await ct(),await q(n);S=await M(m,{params:r,url:n,route:{id:a.id}})}const P=await $n(w,E,i);return P?oe({url:n,params:r,branch:E.slice(0,P.idx).concat(P.node),status:v,error:S,route:a}):await wt(n,{id:a.id},S,v)}else E.push(void 0);return oe({url:n,params:r,branch:E,status:200,error:null,route:a,form:t?void 0:null})}async function $n(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(k.server_loads[0]===0)try{const o=await yt(n,[!0]);if(o.type!=="data"||o.nodes[0]&&o.nodes[0].type!=="data")throw 0;s=o.nodes[0]??null}catch{(n.origin!==ce||n.pathname!==location.pathname||$e)&&await q(n)}try{const o=await Pe({loader:ke,url:n,params:a,route:r,parent:()=>Promise.resolve({}),server_data_node:Oe(s)}),c={node:await te(),loader:te,universal:null,server:null,data:null};return oe({url:n,params:a,branch:[o,c],status:e,error:t,route:null})}catch(o){if(o instanceof Re)return Un(new URL(o.location,location.href),{},0);throw o}}async function Cn(e){const t=e.href;if(Z.has(t))return Z.get(t);let n;try{const r=(async()=>{let a=await k.hooks.reroute({url:new URL(e),fetch:async(s,i)=>gt(s,i,e).promise})??e;if(typeof a=="string"){const s=new URL(e);k.hash?s.hash=a:s.pathname=a,a=s}return a})();Z.set(t,r),n=await r}catch{Z.delete(t);return}return n}async function de(e,t){if(e&&!fe(e,x,k.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:se(e),invalidating:t,route:a,params:Dt(s),url:e}}}}function Pn(e){return jt(k.hash?e.hash.replace(/^#/,"").replace(/[?#].+/,""):e.pathname.slice(x.length))||"/"}function se(e){return(k.hash?e.hash.replace(/^#/,""):e.pathname)+e.search}function _t({url:e,type:t,intent:n,delta:r,event:a}){let s=!1;const i=Ne(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 V({type:e,url:t,popped:n,keepfocus:r,noscroll:a,replace_state:s,state:i={},redirect_count:o=0,nav_token:c={},accept:l=ze,block:d=ze,event:h}){const y=N;N=c;const f=await de(t,!1),p=e==="enter"?Ne(b,f,t,e):_t({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,re&&p.navigation.type!=="enter"&&C.navigating.set(W.current=p.navigation);let _=f&&await mt(f);if(!_){if(fe(t,x,k.hash))return await q(t,s);_=await wt(t,{id:null},await M(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 V({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 M(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(),Le(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,[nt]:i};(s?history.replaceState:history.pushState).call(history,v,"",t),s||Rn(A,L)}if(U=null,_.props.page.state=i,re){const m=(await Promise.all(Array.from(Tn,v=>v(p.navigation)))).filter(v=>typeof v=="function");if(m.length>0){let v=function(){m.forEach(S=>{Y.delete(S)})};m.push(v),m.forEach(S=>{Y.add(S)})}b=_.state,_.props.page&&(_.props.page.url=t),ut.$set(_.props),yn(_.props.page),ft=!0}else pt(_,Ee,!1);const{activeElement:I}=document;await En();let E=n?n.scroll:a?le():null;if(Ge){const m=t.hash&&document.getElementById(bt(t));if(E)scrollTo(E.x,E.y);else if(m){m.scrollIntoView();const{top:v,left:S}=m.getBoundingClientRect();E={x:pageXOffset+S,y:pageYOffset+v}}else scrollTo(0,0)}const w=document.activeElement!==I&&document.activeElement!==document.body;!r&&!w&&Bn(t,E),Ge=!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 wt(e,t,n,r,a){return e.origin===ce&&e.pathname===location.pathname&&!$e?await ue({status:r,error:n,url:e,route:t}):await q(e,a)}function On(){let e,t,n;$.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)}$.addEventListener("mousedown",r),$.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,$),d=l===t&&c>=n;if(!l||d)return;const{url:h,external:y,download:f}=Se(l,x,k.hash);if(y||f)return;const p=Q(l),u=h&&se(b.url)===se(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 $.querySelectorAll("a")){const{url:c,external:l,download:d}=Se(o,x,k.hash);if(l||d)continue;const h=Q(o);h.reload||(h.preload_code===O.viewport&&a.observe(o),h.preload_code===O.eager&&ye(c))}}Y.add(i),i()}function M(e,t){if(e instanceof ie)return e.body;const n=ee(e),r=_n(e);return k.hooks.handleError({error:e,event:t,status:n,message:r})??{message:r}}function Nn(e){if(typeof e=="function")ne.push(e);else{const{href:t}=new URL(e,location.href);ne.push(n=>n.href===t)}}function jn(){var t;history.scrollRestoration="manual",addEventListener("beforeunload",n=>{let r=!1;if(He(),!X){const a=Ne(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"&&He()}),(t=navigator.connection)!=null&&t.saveData||On(),$.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],$);if(!r)return;const{url:a,external:s,target:i,download:o}=Se(r,x,k.hash);if(!a)return;if(i==="_parent"||i==="_top"){if(window.parent!==window)return}else if(i&&i!=="_self")return;const c=Q(r);if(!(r instanceof SVGAElement)&&a.protocol!==location.protocol&&!(a.protocol==="https:"||a.protocol==="http:")||o)return;const[d,h]=(k.hash?a.hash.replace(/^#/,""):a.href).split("#"),y=d===me(location);if(s||c.reload&&(!y||!h)){_t({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,Le(A),e(a),!c.replace_state)return;z=!1}n.preventDefault(),await new Promise(f=>{requestAnimationFrame(()=>{setTimeout(f,0)}),setTimeout(f,100)}),await V({type:"link",url:a,keepfocus:c.keepfocus,noscroll:c.noscroll,replace_state:c.replace_state??a.href===location.href,event:n})}),$.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,x,!1))return;const c=n.target,l=Q(c);if(l.reload)return;n.preventDefault(),n.stopPropagation();const d=new FormData(c,a);o.search=new URLSearchParams(d).toString(),V({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[nt]??{},o=new URL(n.state[en]??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 V({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),k.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"))An.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(je(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}){$e=!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=vt(_.uses)),Pe({loader:k.nodes[u],url:l,params:a,route:s,parent:async()=>{const I={};for(let E=0;E<g;E+=1)Object.assign(I,(await f[E]).data);return I},server_data_node:Oe(_)})}),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=oe({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:ee(f),error:await M(f,{url:l,params:a,route:s}),url:l,route:s}),e.textContent="",y=!1}h.props.page&&(h.props.page.state={}),pt(h,e,y)}async function yt(e,t){var s;const n=new URL(e);n.pathname=Sn(e.pathname),e.pathname.endsWith("/")&&n.searchParams.append(mn,"1"),n.searchParams.append(gn,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 ie(a.status,i)}return new Promise(async i=>{var h;const o=new Map,c=a.body.getReader();function l(y){return dn(y,{...k.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=vt(g.uses),g.data=l(g.data))}),i(u);else if(u.type==="chunk"){const{id:g,data:_,error:I}=u,E=o.get(g);o.delete(g),I?E.reject(l(I)):E.fulfil(l(_))}}}})}function vt(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=bt(e);if(r&&document.getElementById(r)){const{x:s,y:i}=t??le();setTimeout(()=>{const o=history.state;Ae=!0,location.replace(`#${r}`),k.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 Ne(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 je(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 bt(e){let t;if(k.hash){const[,,n]=e.hash.split("#",3);t=n??""}else t=e.hash.slice(1);return decodeURIComponent(t)}export{Hn as a,qn as l,C as s};
|
hfstudio/static/_app/immutable/entry/app.CtX5T3n3.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.TRqG0fGK.js","../chunks/TRxHAhOH.js","../chunks/IHki7fMi.js","../chunks/DFBNfz2t.js","../chunks/DiPl7Yg5.js","../chunks/QpZLpmTi.js","../chunks/nn-QVLrM.js","../chunks/BhRpzVYR.js","../assets/0.D3cVNcGj.css","../nodes/1.B8bDkK4r.js","../nodes/2.B1zebCaO.js","../chunks/DUd0gdPo.js","../chunks/BNlacN_j.js","../chunks/DRlRadqT.js","../assets/2.CdRym-eY.css","../nodes/3.D8euRajz.js","../assets/3.BNkL3CE9.css","../nodes/4.v7i3IxTN.js"])))=>i.map(i=>d[i]);
|
| 2 |
+
import{S as C,i as U,s as q,d,w as h,x as g,N as O,K as S,b as v,h as B,M as w,k as W,U as z,G,V as K,W as y,v as P,A as R,y as L,z as D,p as T,Q as p,e as Q,f as F,j as H,T as V,a as J,g as X,t as Y}from"../chunks/TRxHAhOH.js";import"../chunks/IHki7fMi.js";const Z="modulepreload",M=function(o,e){return new URL(o,e).href},I={},A=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 I)return;I[f]=!0;const l=f.endsWith(".css"),_=l?'[rel="stylesheet"]':"";if(!!i)for(let k=t.length-1;k>=0;k--){const E=t[k];if(E.href===f&&(!l||E.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,E)=>{m.addEventListener("load",k),m.addEventListener("error",()=>E(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&&D(e.$$.fragment,t),n=w()},m(t,s){e&&L(e,t,s),v(t,n,s),i=!0},p(t,s){if(s&4&&r!==(r=t[2][0])){if(e){O();const a=e;h(a.$$.fragment,1,0,()=>{P(a,1)}),S()}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&&D(e.$$.fragment,t),n=w()},m(t,s){e&&L(e,t,s),v(t,n,s),i=!0},p(t,s){if(s&4&&r!==(r=t[2][0])){if(e){O();const a=e;h(a.$$.fragment,1,0,()=>{P(a,1)}),S()}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&&D(e.$$.fragment,t),n=w()},m(t,s){e&&L(e,t,s),v(t,n,s),i=!0},p(t,s){if(s&4&&r!==(r=t[2][1])){if(e){O();const a=e;h(a.$$.fragment,1,0,()=>{P(a,1)}),S()}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 N(o){let e,n=o[7]&&j(o);return{c(){e=H("div"),n&&n.c(),this.h()},l(i){e=Q(i,"DIV",{id:!0,"aria-live":!0,"aria-atomic":!0,style:!0});var r=F(e);n&&n.l(r),r.forEach(d),this.h()},h(){T(e,"id","svelte-announcer"),T(e,"aria-live","assertive"),T(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){v(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){v(n,e,i)},p(n,i){i&256&&J(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]&&N(o);return{c(){n.c(),i=W(),f&&f.c(),r=w()},l(l){n.l(l),i=B(l),f&&f.l(l),r=w()},m(l,_){s[e].m(l,_),v(l,i,_),f&&f.m(l,_),v(l,r,_),u=!0},p(l,[_]){let b=e;e=a(l),e===b?s[e].p(l,_):(O(),h(s[b],1,1,()=>{s[b]=null}),S(),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=N(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;z(i.page.notify);let l=!1,_=!1,b=null;G(()=>{const c=i.page.subscribe(()=>{l&&(n(7,_=!0),K().then(()=>{n(8,b=document.title||"untitled page")}))});return n(6,l=!0),c});function m(c){V[c?"unshift":"push"](()=>{t[1]=c,n(0,t)})}function k(c){V[c?"unshift":"push"](()=>{t[0]=c,n(0,t)})}function E(c){V[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,E]}class le extends C{constructor(e){super(),U(this,e,ne,te,q,{stores:9,page:1,constructors:2,components:0,form:3,data_0:4,data_1:5})}}const fe=[()=>A(()=>import("../nodes/0.TRqG0fGK.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8]),import.meta.url),()=>A(()=>import("../nodes/1.B8bDkK4r.js"),__vite__mapDeps([9,1,2,3,4]),import.meta.url),()=>A(()=>import("../nodes/2.B1zebCaO.js"),__vite__mapDeps([10,1,11,7,2,12,13,14]),import.meta.url),()=>A(()=>import("../nodes/3.D8euRajz.js"),__vite__mapDeps([15,1,11,7,2,5,13,16]),import.meta.url),()=>A(()=>import("../nodes/4.v7i3IxTN.js"),__vite__mapDeps([17,1,7,2,12,6,13]),import.meta.url)],ce=[],ue={"/":[2],"/code-recorder":[3],"/voice-cloning":[4]},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.BGBHC2PU.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
import{l as o,a as r}from"../chunks/DiPl7Yg5.js";export{o as load_css,r as start};
|
hfstudio/static/_app/immutable/nodes/0.TRqG0fGK.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import{S as lt,i as ot,s as rt,C as it,d as M,v as Qe,w as Oe,x as Ue,p as s,D as ut,E as ct,F as pt,b as be,c as t,y as Xe,e as a,f as j,r as d,h as u,z as Ze,j as l,k as c,A as $e,l as ft,G as dt,H as ht,I as et,m as xe,a as mt,g as gt,t as xt}from"../chunks/TRxHAhOH.js";import"../chunks/IHki7fMi.js";import{p as bt}from"../chunks/DFBNfz2t.js";import{N as _t}from"../chunks/QpZLpmTi.js";import{M as vt}from"../chunks/nn-QVLrM.js";function tt(f){let o,n,p,L="Sign In with HuggingFace Token",R,e,x,A="<strong>Manual Token Entry:</strong> Please enter your HuggingFace token.",D,h,T=`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`,Q,F,_,O,q="HuggingFace Token",W,b,S,Y,k,i,N="Cancel",H,g,z="Sign In",B,U,y=f[5]&&nt(),w=f[4]&&st(f);return{c(){o=l("div"),n=l("div"),p=l("h2"),p.textContent=L,R=c(),e=l("div"),x=l("p"),x.innerHTML=A,D=c(),h=l("p"),h.innerHTML=T,Q=c(),y&&y.c(),F=c(),_=l("div"),O=l("label"),O.textContent=q,W=c(),b=l("input"),S=c(),w&&w.c(),Y=c(),k=l("div"),i=l("button"),i.textContent=N,H=c(),g=l("button"),g.textContent=z,this.h()},l(v){o=a(v,"DIV",{class:!0});var G=j(o);n=a(G,"DIV",{class:!0});var V=j(n);p=a(V,"H2",{class:!0,"data-svelte-h":!0}),d(p)!=="svelte-1t0ehet"&&(p.textContent=L),R=u(V),e=a(V,"DIV",{class:!0});var E=j(e);x=a(E,"P",{class:!0,"data-svelte-h":!0}),d(x)!=="svelte-344vn4"&&(x.innerHTML=A),D=u(E),h=a(E,"P",{class:!0,"data-svelte-h":!0}),d(h)!=="svelte-orsfwv"&&(h.innerHTML=T),Q=u(E),y&&y.l(E),E.forEach(M),F=u(V),_=a(V,"DIV",{class:!0});var K=j(_);O=a(K,"LABEL",{for:!0,class:!0,"data-svelte-h":!0}),d(O)!=="svelte-vtbmxo"&&(O.textContent=q),W=u(K),b=a(K,"INPUT",{id:!0,type:!0,placeholder:!0,class:!0}),S=u(K),w&&w.l(K),K.forEach(M),Y=u(V),k=a(V,"DIV",{class:!0});var X=j(k);i=a(X,"BUTTON",{class:!0,"data-svelte-h":!0}),d(i)!=="svelte-csk0rj"&&(i.textContent=N),H=u(X),g=a(X,"BUTTON",{class:!0,"data-svelte-h":!0}),d(g)!=="svelte-1nxas5u"&&(g.textContent=z),X.forEach(M),V.forEach(M),G.forEach(M),this.h()},h(){s(p,"class","text-xl font-semibold mb-4"),s(x,"class","text-blue-800 mb-2"),s(h,"class","text-blue-700"),s(e,"class","mb-4 p-3 bg-blue-50 rounded-md text-sm"),s(O,"for","token"),s(O,"class","block text-sm font-medium text-gray-700 mb-2"),s(b,"id","token"),s(b,"type","password"),s(b,"placeholder","hf_..."),s(b,"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"),s(_,"class","mb-4"),s(i,"class","px-4 py-2 text-gray-600 hover:text-gray-800 transition-colors"),s(g,"class","px-4 py-2 bg-orange-500 text-white rounded-md hover:bg-orange-600 transition-colors"),s(k,"class","flex justify-end gap-3"),s(n,"class","bg-white rounded-lg p-6 max-w-md w-full mx-4 shadow-xl"),s(o,"class","fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50")},m(v,G){be(v,o,G),t(o,n),t(n,p),t(n,R),t(n,e),t(e,x),t(e,D),t(e,h),t(e,Q),y&&y.m(e,null),t(n,F),t(n,_),t(_,O),t(_,W),t(_,b),et(b,f[3]),t(_,S),w&&w.m(_,null),t(n,Y),t(n,k),t(k,i),t(k,H),t(k,g),B||(U=[xe(b,"input",f[13]),xe(b,"keydown",f[14]),xe(i,"click",f[9]),xe(g,"click",f[10])],B=!0)},p(v,G){v[5]?y||(y=nt(),y.c(),y.m(e,null)):y&&(y.d(1),y=null),G&8&&b.value!==v[3]&&et(b,v[3]),v[4]?w?w.p(v,G):(w=st(v),w.c(),w.m(_,null)):w&&(w.d(1),w=null)},d(v){v&&M(o),y&&y.d(),w&&w.d(),B=!1,ht(U)}}}function nt(f){let o,n=`<strong>Tip:</strong> You can also run <code>huggingface-cli login</code> in your terminal
|
| 4 |
+
to automatically use your local token.`;return{c(){o=l("p"),o.innerHTML=n,this.h()},l(p){o=a(p,"P",{class:!0,"data-svelte-h":!0}),d(o)!=="svelte-xrut8w"&&(o.innerHTML=n),this.h()},h(){s(o,"class","text-blue-600 mt-2")},m(p,L){be(p,o,L)},d(p){p&&M(o)}}}function st(f){let o,n;return{c(){o=l("p"),n=xt(f[4]),this.h()},l(p){o=a(p,"P",{class:!0});var L=j(o);n=gt(L,f[4]),L.forEach(M),this.h()},h(){s(o,"class","text-red-600 text-sm mt-1")},m(p,L){be(p,o,L),t(o,n)},p(p,L){L&16&&mt(n,p[4])},d(p){p&&M(o)}}}function wt(f){let o,n,p,L='<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>',R,e,x,A="Audio",D,h,T,Q="ποΈ",F,_,O="Text to Speech",q,W,b,S,Y,k,i="Voice Cloning",N,H,g,z="<span>π§</span> <span>Speech to Text</span>",B,U,y="<span>πΌ</span> <span>Sound Effects</span>",w,v,G="<span>πΈ</span> <span>Music Generation</span>",V,E,K="<span>π</span> <span>Audio Enhancement</span>",X,fe,Pe="Image",_e,Z,Ve="<span>π¨</span> <span>Text to Image</span>",ve,$,je="<span>πΌοΈ</span> <span>Image to Image</span>",we,ee,De="<span>βοΈ</span> <span>Remove Background</span>",Te,te,Fe="<span>π</span> <span>Upscale Image</span>",ye,ne,ze="<span>π</span> <span>Face Swap</span>",Ce,se,Re="<span>π</span> <span>Image to Text</span>",ke,de,qe="Video",Le,ae,Ge="<span>π¬</span> <span>Text to Video</span>",He,le,Je="<span>ποΈ</span> <span>Image to Video</span>",Ie,oe,We="<span>β¨</span> <span>Video Enhancement</span>",Me,re,Ye="<span>π€</span> <span>Lip Sync</span>",Ne,ie,Ke="<span>π£οΈ</span> <span>Video Dubbing</span>",Ee,ue,ce,Se,Be,pe;S=new vt({props:{size:16}}),ce=new _t({props:{isLoggedIn:f[0],username:f[1],handleAuthAction:f[8],flashButton:f[6],pageTitle:at(f[7].url.pathname)}});const Ae=f[12].default,P=it(Ae,f,f[11],null);let I=f[2]&&tt(f);return{c(){o=l("div"),n=l("aside"),p=l("div"),p.innerHTML=L,R=c(),e=l("nav"),x=l("div"),x.textContent=A,D=c(),h=l("a"),T=l("span"),T.textContent=Q,F=c(),_=l("span"),_.textContent=O,W=c(),b=l("a"),$e(S.$$.fragment),Y=c(),k=l("span"),k.textContent=i,H=c(),g=l("button"),g.innerHTML=z,B=c(),U=l("button"),U.innerHTML=y,w=c(),v=l("button"),v.innerHTML=G,V=c(),E=l("button"),E.innerHTML=K,X=c(),fe=l("div"),fe.textContent=Pe,_e=c(),Z=l("button"),Z.innerHTML=Ve,ve=c(),$=l("button"),$.innerHTML=je,we=c(),ee=l("button"),ee.innerHTML=De,Te=c(),te=l("button"),te.innerHTML=Fe,ye=c(),ne=l("button"),ne.innerHTML=ze,Ce=c(),se=l("button"),se.innerHTML=Re,ke=c(),de=l("div"),de.textContent=qe,Le=c(),ae=l("button"),ae.innerHTML=Ge,He=c(),le=l("button"),le.innerHTML=Je,Ie=c(),oe=l("button"),oe.innerHTML=We,Me=c(),re=l("button"),re.innerHTML=Ye,Ne=c(),ie=l("button"),ie.innerHTML=Ke,Ee=c(),ue=l("main"),$e(ce.$$.fragment),Se=c(),P&&P.c(),Be=c(),I&&I.c(),this.h()},l(m){o=a(m,"DIV",{class:!0});var C=j(o);n=a(C,"ASIDE",{class:!0});var J=j(n);p=a(J,"DIV",{class:!0,"data-svelte-h":!0}),d(p)!=="svelte-xzbt87"&&(p.innerHTML=L),R=u(J),e=a(J,"NAV",{class:!0});var r=j(e);x=a(r,"DIV",{class:!0,"data-svelte-h":!0}),d(x)!=="svelte-52jqai"&&(x.textContent=A),D=u(r),h=a(r,"A",{href:!0,class:!0});var he=j(h);T=a(he,"SPAN",{"data-svelte-h":!0}),d(T)!=="svelte-1yx42xi"&&(T.textContent=Q),F=u(he),_=a(he,"SPAN",{"data-svelte-h":!0}),d(_)!=="svelte-2j89jk"&&(_.textContent=O),he.forEach(M),W=u(r),b=a(r,"A",{href:!0,class:!0});var me=j(b);Ze(S.$$.fragment,me),Y=u(me),k=a(me,"SPAN",{"data-svelte-h":!0}),d(k)!=="svelte-10pmll2"&&(k.textContent=i),me.forEach(M),H=u(r),g=a(r,"BUTTON",{class:!0,"data-svelte-h":!0}),d(g)!=="svelte-wf0x5d"&&(g.innerHTML=z),B=u(r),U=a(r,"BUTTON",{class:!0,"data-svelte-h":!0}),d(U)!=="svelte-x7bha3"&&(U.innerHTML=y),w=u(r),v=a(r,"BUTTON",{class:!0,"data-svelte-h":!0}),d(v)!=="svelte-1tyblmt"&&(v.innerHTML=G),V=u(r),E=a(r,"BUTTON",{class:!0,"data-svelte-h":!0}),d(E)!=="svelte-1emrjb3"&&(E.innerHTML=K),X=u(r),fe=a(r,"DIV",{class:!0,"data-svelte-h":!0}),d(fe)!=="svelte-1pmjg3x"&&(fe.textContent=Pe),_e=u(r),Z=a(r,"BUTTON",{class:!0,"data-svelte-h":!0}),d(Z)!=="svelte-11wbuiv"&&(Z.innerHTML=Ve),ve=u(r),$=a(r,"BUTTON",{class:!0,"data-svelte-h":!0}),d($)!=="svelte-ol2yvl"&&($.innerHTML=je),we=u(r),ee=a(r,"BUTTON",{class:!0,"data-svelte-h":!0}),d(ee)!=="svelte-ttigif"&&(ee.innerHTML=De),Te=u(r),te=a(r,"BUTTON",{class:!0,"data-svelte-h":!0}),d(te)!=="svelte-ixgtu4"&&(te.innerHTML=Fe),ye=u(r),ne=a(r,"BUTTON",{class:!0,"data-svelte-h":!0}),d(ne)!=="svelte-r2ax5z"&&(ne.innerHTML=ze),Ce=u(r),se=a(r,"BUTTON",{class:!0,"data-svelte-h":!0}),d(se)!=="svelte-n9rt3x"&&(se.innerHTML=Re),ke=u(r),de=a(r,"DIV",{class:!0,"data-svelte-h":!0}),d(de)!=="svelte-1gfxetb"&&(de.textContent=qe),Le=u(r),ae=a(r,"BUTTON",{class:!0,"data-svelte-h":!0}),d(ae)!=="svelte-gox1rd"&&(ae.innerHTML=Ge),He=u(r),le=a(r,"BUTTON",{class:!0,"data-svelte-h":!0}),d(le)!=="svelte-13pimzy"&&(le.innerHTML=Je),Ie=u(r),oe=a(r,"BUTTON",{class:!0,"data-svelte-h":!0}),d(oe)!=="svelte-c86wph"&&(oe.innerHTML=We),Me=u(r),re=a(r,"BUTTON",{class:!0,"data-svelte-h":!0}),d(re)!=="svelte-wkify0"&&(re.innerHTML=Ye),Ne=u(r),ie=a(r,"BUTTON",{class:!0,"data-svelte-h":!0}),d(ie)!=="svelte-10ou061"&&(ie.innerHTML=Ke),r.forEach(M),J.forEach(M),Ee=u(C),ue=a(C,"MAIN",{class:!0});var ge=j(ue);Ze(ce.$$.fragment,ge),Se=u(ge),P&&P.l(ge),ge.forEach(M),Be=u(C),I&&I.l(C),C.forEach(M),this.h()},h(){s(p,"class","px-4 py-4 border-b border-gray-200 min-h-[73px] flex items-center"),s(x,"class","mt-2 mb-1 px-2 text-xs font-medium text-gray-500 uppercase"),s(h,"href","/"),s(h,"class",q="w-full flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-gray-100 transition-colors text-left "+(f[7].url.pathname==="/"?"bg-gray-100":"")),s(b,"href","/voice-cloning"),s(b,"class",N="w-full flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-gray-100 transition-colors text-left "+(f[7].url.pathname==="/voice-cloning"?"bg-gray-100":"")),s(g,"class","w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left opacity-40 cursor-not-allowed"),g.disabled=!0,s(U,"class","w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left opacity-40 cursor-not-allowed"),U.disabled=!0,s(v,"class","w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left opacity-40 cursor-not-allowed"),v.disabled=!0,s(E,"class","w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left opacity-40 cursor-not-allowed"),E.disabled=!0,s(fe,"class","mt-4 mb-1 px-2 text-xs font-medium text-gray-500 uppercase"),s(Z,"class","w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left opacity-40 cursor-not-allowed"),Z.disabled=!0,s($,"class","w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left opacity-40 cursor-not-allowed"),$.disabled=!0,s(ee,"class","w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left opacity-40 cursor-not-allowed"),ee.disabled=!0,s(te,"class","w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left opacity-40 cursor-not-allowed"),te.disabled=!0,s(ne,"class","w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left opacity-40 cursor-not-allowed"),ne.disabled=!0,s(se,"class","w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left opacity-40 cursor-not-allowed"),se.disabled=!0,s(de,"class","mt-4 mb-1 px-2 text-xs font-medium text-gray-500 uppercase"),s(ae,"class","w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left opacity-40 cursor-not-allowed"),ae.disabled=!0,s(le,"class","w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left opacity-40 cursor-not-allowed"),le.disabled=!0,s(oe,"class","w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left opacity-40 cursor-not-allowed"),oe.disabled=!0,s(re,"class","w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left opacity-40 cursor-not-allowed"),re.disabled=!0,s(ie,"class","w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left opacity-40 cursor-not-allowed"),ie.disabled=!0,s(e,"class","p-2 text-sm flex-1"),s(n,"class","w-56 border-r border-gray-200 bg-white flex-shrink-0 flex flex-col h-full relative "),s(ue,"class","flex-1 overflow-auto"),s(o,"class","flex h-screen bg-white")},m(m,C){be(m,o,C),t(o,n),t(n,p),t(n,R),t(n,e),t(e,x),t(e,D),t(e,h),t(h,T),t(h,F),t(h,_),t(e,W),t(e,b),Xe(S,b,null),t(b,Y),t(b,k),t(e,H),t(e,g),t(e,B),t(e,U),t(e,w),t(e,v),t(e,V),t(e,E),t(e,X),t(e,fe),t(e,_e),t(e,Z),t(e,ve),t(e,$),t(e,we),t(e,ee),t(e,Te),t(e,te),t(e,ye),t(e,ne),t(e,Ce),t(e,se),t(e,ke),t(e,de),t(e,Le),t(e,ae),t(e,He),t(e,le),t(e,Ie),t(e,oe),t(e,Me),t(e,re),t(e,Ne),t(e,ie),t(o,Ee),t(o,ue),Xe(ce,ue,null),t(ue,Se),P&&P.m(ue,null),t(o,Be),I&&I.m(o,null),pe=!0},p(m,[C]){(!pe||C&128&&q!==(q="w-full flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-gray-100 transition-colors text-left "+(m[7].url.pathname==="/"?"bg-gray-100":"")))&&s(h,"class",q),(!pe||C&128&&N!==(N="w-full flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-gray-100 transition-colors text-left "+(m[7].url.pathname==="/voice-cloning"?"bg-gray-100":"")))&&s(b,"class",N);const J={};C&1&&(J.isLoggedIn=m[0]),C&2&&(J.username=m[1]),C&64&&(J.flashButton=m[6]),C&128&&(J.pageTitle=at(m[7].url.pathname)),ce.$set(J),P&&P.p&&(!pe||C&2048)&&ut(P,Ae,m,m[11],pe?pt(Ae,m[11],C,null):ct(m[11]),null),m[2]?I?I.p(m,C):(I=tt(m),I.c(),I.m(o,null)):I&&(I.d(1),I=null)},i(m){pe||(Ue(S.$$.fragment,m),Ue(ce.$$.fragment,m),Ue(P,m),pe=!0)},o(m){Oe(S.$$.fragment,m),Oe(ce.$$.fragment,m),Oe(P,m),pe=!1},d(m){m&&M(o),Qe(S),Qe(ce),P&&P.d(m),I&&I.d()}}}function at(f){switch(f){case"/":return"Text to Speech";case"/voice-cloning":return"Voice Cloning";default:return"HFStudio"}}function Tt(f,o,n){let p;ft(f,bt,i=>n(7,p=i));let{$$slots:L={},$$scope:R}=o,e=typeof window<"u"&&window.__INITIAL_USER__?window.__INITIAL_USER__:{authenticated:!1},x=(e==null?void 0:e.authenticated)||!1,A=e!=null&&e.authenticated&&(e!=null&&e.user_info)?(e.user_info.name||e.user_info.fullname||e.user_info.login||e.user_info.username||"User").split(" ")[0]:"",D=!1,h="",T="",Q=!1,F=!1,_=!1;dt(()=>(window.addEventListener("show-login-prompt",()=>{x||(n(6,F=!0),setTimeout(()=>{n(6,F=!1)},1600))}),O().then(()=>{e!=null&&e.authenticated||q()}),document.addEventListener("visibilitychange",()=>{document.hidden||q()}),()=>{}));async function O(){try{_=(await(await fetch("/api/status")).json()).is_spaces||!1}catch(i){console.error("Error checking Spaces status:",i),_=!1}}async function q(){if(!(e!=null&&e.authenticated&&x))try{const i=await fetch("/api/auth/user",{credentials:"include"});if(i.ok){const N=await i.json();if(N.authenticated){n(0,x=!0);const H=N.user_info,g=H.name||H.fullname||H.login||H.username||"User";n(1,A=g.split(" ")[0])}else n(0,x=!1),n(1,A="")}else n(0,x=!1),n(1,A="")}catch{n(0,x=!1),n(1,A="")}}async function W(){if(x){try{await fetch("/api/auth/logout",{method:"POST",credentials:"include"})}catch(i){console.error("Logout error:",i)}sessionStorage.removeItem("oauth_state"),n(0,x=!1),n(1,A=""),window.location.reload()}else try{const N=await(await fetch("/api/auth/oauth-config")).json(),H=N.scopes||"inference-api";let g=window.location.origin+"/auth/callback";window.location.hostname==="localhost"&&window.location.port==="11111"&&(g="http://localhost:7860/auth/callback");const z=window.location.pathname,B=`https://huggingface.co/oauth/authorize?client_id=${N.client_id}&redirect_uri=${encodeURIComponent(g)}&scope=${encodeURIComponent(H)}&response_type=code&state=${encodeURIComponent(z)}`;window.location.href=B}catch{n(2,D=!0),n(3,h=""),n(4,T="")}}function b(){n(2,D=!1),n(3,h=""),n(4,T="")}async function S(){if(!h.trim()){n(4,T="Please enter a token");return}if(!h.startsWith("hf_")){n(4,T='Token should start with "hf_"');return}try{const i=await fetch("https://huggingface.co/api/whoami-v2",{headers:{Authorization:`Bearer ${h.trim()}`}});if(i.ok){const N=await i.json(),H=h.trim();try{const g=await fetch("/api/auth/manual-token",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({token:H})});if(g.ok){const z=await g.json();n(0,x=!0);const B=z.user_info,U=B.name||B.fullname||B.login||B.username||"User";n(1,A=U.split(" ")[0]),b()}else{const z=await g.json();n(4,T=z.detail||"Token validation failed")}}catch{n(4,T="Failed to validate token. Please try again.")}}else n(4,T=`Invalid token (${i.status}). Please check your token and try again.`)}catch{n(4,T="Error validating token. Please try again.")}}function Y(){h=this.value,n(3,h)}const k=i=>i.key==="Enter"&&S();return f.$$set=i=>{"$$scope"in i&&n(11,R=i.$$scope)},[x,A,D,h,T,Q,F,p,W,b,S,R,L,Y,k]}class It extends lt{constructor(o){super(),ot(this,o,Tt,wt,rt,{})}}export{It as component};
|
hfstudio/static/_app/immutable/nodes/1.B8bDkK4r.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/TRxHAhOH.js";import"../chunks/IHki7fMi.js";import{p as C}from"../chunks/DFBNfz2t.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/4.v7i3IxTN.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import{S as ft,i as dt,s as _t,u as Je,v as pe,w as C,x as D,y as me,z as ge,A as be,B as ot,C as At,D as jt,E as Ht,F as Bt,d as u,H as it,a as Ce,K as Ve,p as d,b as q,c,m as Se,L as Qt,h as V,e as h,f as b,r as we,g as H,M as Ke,k as $,j as p,t as B,G as Wt,Q as oe,n as Be,J as Ot,N as $e}from"../chunks/TRxHAhOH.js";import{I as Ft,g as qt,a as Yt,e as nt}from"../chunks/BhRpzVYR.js";import"../chunks/IHki7fMi.js";import{S as Xt,L as ht,A as Zt,X as er}from"../chunks/BNlacN_j.js";import{M as Gt}from"../chunks/nn-QVLrM.js";import{P as Jt,a as Kt}from"../chunks/DRlRadqT.js";function tr(s){let e;const t=s[2].default,r=At(t,s,s[3],null);return{c(){r&&r.c()},l(l){r&&r.l(l)},m(l,o){r&&r.m(l,o),e=!0},p(l,o){r&&r.p&&(!e||o&8)&&jt(r,t,l,l[3],e?Bt(t,l[3],o,null):Ht(l[3]),null)},i(l){e||(D(r,l),e=!0)},o(l){C(r,l),e=!1},d(l){r&&r.d(l)}}}function rr(s){let e,t;const r=[{name:"square"},s[1],{iconNode:s[0]}];let l={$$slots:{default:[tr]},$$scope:{ctx:s}};for(let o=0;o<r.length;o+=1)l=Je(l,r[o]);return e=new Ft({props:l}),{c(){be(e.$$.fragment)},l(o){ge(e.$$.fragment,o)},m(o,n){me(e,o,n),t=!0},p(o,[n]){const i=n&3?qt(r,[r[0],n&2&&Yt(o[1]),n&1&&{iconNode:o[0]}]):{};n&8&&(i.$$scope={dirty:n,ctx:o}),e.$set(i)},i(o){t||(D(e.$$.fragment,o),t=!0)},o(o){C(e.$$.fragment,o),t=!1},d(o){pe(e,o)}}}function lr(s,e,t){let{$$slots:r={},$$scope:l}=e;const o=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}]];return s.$$set=n=>{t(1,e=Je(Je({},e),ot(n))),"$$scope"in n&&t(3,l=n.$$scope)},e=ot(e),[o,e,r,l]}class sr extends ft{constructor(e){super(),dt(this,e,lr,rr,_t,{})}}function or(s){let e;const t=s[2].default,r=At(t,s,s[3],null);return{c(){r&&r.c()},l(l){r&&r.l(l)},m(l,o){r&&r.m(l,o),e=!0},p(l,o){r&&r.p&&(!e||o&8)&&jt(r,t,l,l[3],e?Bt(t,l[3],o,null):Ht(l[3]),null)},i(l){e||(D(r,l),e=!0)},o(l){C(r,l),e=!1},d(l){r&&r.d(l)}}}function nr(s){let e,t;const r=[{name:"trash-2"},s[1],{iconNode:s[0]}];let l={$$slots:{default:[or]},$$scope:{ctx:s}};for(let o=0;o<r.length;o+=1)l=Je(l,r[o]);return e=new Ft({props:l}),{c(){be(e.$$.fragment)},l(o){ge(e.$$.fragment,o)},m(o,n){me(e,o,n),t=!0},p(o,[n]){const i=n&3?qt(r,[r[0],n&2&&Yt(o[1]),n&1&&{iconNode:o[0]}]):{};n&8&&(i.$$scope={dirty:n,ctx:o}),e.$set(i)},i(o){t||(D(e.$$.fragment,o),t=!0)},o(o){C(e.$$.fragment,o),t=!1},d(o){pe(e,o)}}}function ar(s,e,t){let{$$slots:r={},$$scope:l}=e;const o=[["path",{d:"M3 6h18"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17"}]];return s.$$set=n=>{t(1,e=Je(Je({},e),ot(n))),"$$scope"in n&&t(3,l=n.$$scope)},e=ot(e),[o,e,r,l]}class ir extends ft{constructor(e){super(),dt(this,e,ar,nr,_t,{})}}function $t(s,e,t){const r=s.slice();return r[47]=e[t],r}function Ct(s,e,t){const r=s.slice();return r[50]=e[t],r[52]=t,r}function St(s){let e,t,r,l,o,n;return{c(){e=p("div"),t=p("div"),r=$(),l=p("div"),o=$(),n=p("div"),this.h()},l(i){e=h(i,"DIV",{class:!0});var a=b(e);t=h(a,"DIV",{class:!0,style:!0}),b(t).forEach(u),r=V(a),l=h(a,"DIV",{class:!0,style:!0}),b(l).forEach(u),o=V(a),n=h(a,"DIV",{class:!0,style:!0}),b(n).forEach(u),a.forEach(u),this.h()},h(){d(t,"class","absolute rounded-full border-2 border-orange-300 transition-all duration-75"),oe(t,"width",120+s[7]*120+"px"),oe(t,"height",120+s[7]*120+"px"),oe(t,"opacity",.4+s[7]*.6),d(l,"class","absolute rounded-full border-2 border-orange-200 transition-all duration-100"),oe(l,"width",150+s[7]*150+"px"),oe(l,"height",150+s[7]*150+"px"),oe(l,"opacity",.3+s[7]*.5),d(n,"class","absolute rounded-full border-1 border-orange-100 transition-all duration-125"),oe(n,"width",180+s[7]*180+"px"),oe(n,"height",180+s[7]*180+"px"),oe(n,"opacity",.2+s[7]*.4),d(e,"class","absolute inset-0 flex items-center justify-center")},m(i,a){q(i,e,a),c(e,t),c(e,r),c(e,l),c(e,o),c(e,n)},p(i,a){a[0]&128&&oe(t,"width",120+i[7]*120+"px"),a[0]&128&&oe(t,"height",120+i[7]*120+"px"),a[0]&128&&oe(t,"opacity",.4+i[7]*.6),a[0]&128&&oe(l,"width",150+i[7]*150+"px"),a[0]&128&&oe(l,"height",150+i[7]*150+"px"),a[0]&128&&oe(l,"opacity",.3+i[7]*.5),a[0]&128&&oe(n,"width",180+i[7]*180+"px"),a[0]&128&&oe(n,"height",180+i[7]*180+"px"),a[0]&128&&oe(n,"opacity",.2+i[7]*.4)},d(i){i&&u(e)}}}function cr(s){let e,t;return e=new Gt({props:{size:36,class:"text-white"}}),{c(){be(e.$$.fragment)},l(r){ge(e.$$.fragment,r)},m(r,l){me(e,r,l),t=!0},p:Be,i(r){t||(D(e.$$.fragment,r),t=!0)},o(r){C(e.$$.fragment,r),t=!1},d(r){pe(e,r)}}}function ur(s){let e,t,r,l;return r=new sr({props:{size:36,class:(s[6]>=100?"text-white":"text-orange-700")+" relative z-10"}}),{c(){e=p("div"),t=$(),be(r.$$.fragment),this.h()},l(o){e=h(o,"DIV",{class:!0,style:!0}),b(e).forEach(u),t=V(o),ge(r.$$.fragment,o),this.h()},h(){d(e,"class","absolute bottom-0 left-0 right-0 bg-orange-500 transition-all duration-100 ease-linear rounded-full"),oe(e,"height",s[6]+"%")},m(o,n){q(o,e,n),q(o,t,n),me(r,o,n),l=!0},p(o,n){(!l||n[0]&64)&&oe(e,"height",o[6]+"%");const i={};n[0]&64&&(i.class=(o[6]>=100?"text-white":"text-orange-700")+" relative z-10"),r.$set(i)},i(o){l||(D(r.$$.fragment,o),l=!0)},o(o){C(r.$$.fragment,o),l=!1},d(o){o&&(u(e),u(t)),pe(r,o)}}}function Lt(s){let e,t,r='<svg class="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg>',l,o,n='Hugging Face <span class="bg-gradient-to-r from-purple-500 via-pink-500 via-green-500 to-blue-500 bg-clip-text text-transparent font-bold">PRO</span>',i,a,g=`Sign in to with your Hugging Face <a href="https://huggingface.co/pro" target="_blank" class="text-amber-600 hover:text-amber-700 underline font-medium">PRO account</a> to get started with $2 of free API credits per month. You can add a billing method for
|
| 2 |
+
additional pay-as-you-go usage ‴`,_,v;return{c(){e=p("div"),t=p("button"),t.innerHTML=r,l=$(),o=p("p"),o.innerHTML=n,i=$(),a=p("p"),a.innerHTML=g,this.h()},l(m){e=h(m,"DIV",{class:!0});var w=b(e);t=h(w,"BUTTON",{class:!0,"aria-label":!0,"data-svelte-h":!0}),we(t)!=="svelte-1ywh7al"&&(t.innerHTML=r),l=V(w),o=h(w,"P",{class:!0,"data-svelte-h":!0}),we(o)!=="svelte-1k9uu9c"&&(o.innerHTML=n),i=V(w),a=h(w,"P",{class:!0,"data-svelte-h":!0}),we(a)!=="svelte-tylx6o"&&(a.innerHTML=g),w.forEach(u),this.h()},h(){d(t,"class","absolute top-2 right-2 text-gray-400 hover:text-gray-600 transition-colors"),d(t,"aria-label","Dismiss"),d(o,"class","text-sm font-medium text-gray-700 mb-1 pr-4"),d(a,"class","text-sm text-gray-600 pr-4"),d(e,"class","mb-3 px-3 py-2 bg-gradient-to-r from-amber-50 to-orange-50 rounded-lg border border-amber-200 relative")},m(m,w){q(m,e,w),c(e,t),c(e,l),c(e,o),c(e,i),c(e,a),_||(v=Se(t,"click",s[29]),_=!0)},p:Be,d(m){m&&u(e),_=!1,v()}}}function fr(s){let e,t,r=nt(s[1]),l=[];for(let n=0;n<r.length;n+=1)l[n]=Mt(Ct(s,r,n));const o=n=>C(l[n],1,1,()=>{l[n]=null});return{c(){e=p("div");for(let n=0;n<l.length;n+=1)l[n].c();this.h()},l(n){e=h(n,"DIV",{class:!0});var i=b(e);for(let a=0;a<l.length;a+=1)l[a].l(i);i.forEach(u),this.h()},h(){d(e,"class","space-y-2")},m(n,i){q(n,e,i);for(let a=0;a<l.length;a+=1)l[a]&&l[a].m(e,null);t=!0},p(n,i){if(i[0]&100664070){r=nt(n[1]);let a;for(a=0;a<r.length;a+=1){const g=Ct(n,r,a);l[a]?(l[a].p(g,i),D(l[a],1)):(l[a]=Mt(g),l[a].c(),D(l[a],1),l[a].m(e,null))}for($e(),a=r.length;a<l.length;a+=1)o(a);Ve()}},i(n){if(!t){for(let i=0;i<r.length;i+=1)D(l[i]);t=!0}},o(n){l=l.filter(Boolean);for(let i=0;i<l.length;i+=1)C(l[i]);t=!1},d(n){n&&u(e),Ot(l,n)}}}function dr(s){let e,t,r,l,o="Pick a recording to clone",n,i,a="No recordings yet",g;return t=new Gt({props:{size:32,class:"mx-auto mb-2 opacity-30"}}),{c(){e=p("div"),be(t.$$.fragment),r=$(),l=p("p"),l.textContent=o,n=$(),i=p("p"),i.textContent=a,this.h()},l(_){e=h(_,"DIV",{class:!0});var v=b(e);ge(t.$$.fragment,v),r=V(v),l=h(v,"P",{class:!0,"data-svelte-h":!0}),we(l)!=="svelte-faot34"&&(l.textContent=o),n=V(v),i=h(v,"P",{class:!0,"data-svelte-h":!0}),we(i)!=="svelte-kwlxsz"&&(i.textContent=a),v.forEach(u),this.h()},h(){d(l,"class","text-sm"),d(i,"class","text-xs text-gray-400"),d(e,"class","text-center py-8 text-gray-500")},m(_,v){q(_,e,v),me(t,e,null),c(e,r),c(e,l),c(e,n),c(e,i),g=!0},p:Be,i(_){g||(D(t.$$.fragment,_),g=!0)},o(_){C(t.$$.fragment,_),g=!1},d(_){_&&u(e),pe(t)}}}function _r(s){let e,t;return e=new Kt({props:{size:14,class:"text-gray-600"}}),{c(){be(e.$$.fragment)},l(r){ge(e.$$.fragment,r)},m(r,l){me(e,r,l),t=!0},i(r){t||(D(e.$$.fragment,r),t=!0)},o(r){C(e.$$.fragment,r),t=!1},d(r){pe(e,r)}}}function hr(s){let e,t;return e=new Jt({props:{size:14,class:"text-gray-600"}}),{c(){be(e.$$.fragment)},l(r){ge(e.$$.fragment,r)},m(r,l){me(e,r,l),t=!0},i(r){t||(D(e.$$.fragment,r),t=!0)},o(r){C(e.$$.fragment,r),t=!1},d(r){pe(e,r)}}}function Mt(s){var ce;let e,t,r,l,o=s[52]+1+"",n,i,a,g,_,v,m,w=s[50].timestamp.toLocaleTimeString()+"",L,O,T,W=((ce=s[2])==null?void 0:ce.id)===s[50].id?"Selected":"Select for cloning",P,S,G,Y,R,Q,z;const N=[hr,_r],E=[];function j(U,y){var J;return((J=U[8])==null?void 0:J.id)===U[50].id&&U[9]&&!U[9].paused?0:1}g=j(s),_=E[g]=N[g](s);function K(){return s[30](s[50])}function F(){return s[31](s[50])}return{c(){e=p("div"),t=p("div"),r=p("span"),l=B("Recording "),n=B(o),i=$(),a=p("button"),_.c(),v=$(),m=p("div"),L=B(w),O=$(),T=p("button"),P=B(W),G=$(),this.h()},l(U){e=h(U,"DIV",{class:!0});var y=b(e);t=h(y,"DIV",{class:!0});var J=b(t);r=h(J,"SPAN",{class:!0});var ee=b(r);l=H(ee,"Recording "),n=H(ee,o),ee.forEach(u),i=V(J),a=h(J,"BUTTON",{class:!0});var I=b(a);_.l(I),I.forEach(u),J.forEach(u),v=V(y),m=h(y,"DIV",{class:!0});var x=b(m);L=H(x,w),x.forEach(u),O=V(y),T=h(y,"BUTTON",{class:!0});var X=b(T);P=H(X,W),X.forEach(u),G=V(y),y.forEach(u),this.h()},h(){var U,y;d(r,"class","text-sm font-medium text-gray-900"),d(a,"class","p-1 hover:bg-gray-100 rounded transition-colors"),d(t,"class","flex items-center justify-between mb-2"),d(m,"class","text-xs text-gray-500 mb-2"),d(T,"class",S="w-full text-xs px-2 py-1 rounded "+(((U=s[2])==null?void 0:U.id)===s[50].id?"bg-amber-200 text-amber-800":"bg-gray-100 text-gray-700 hover:bg-gray-200")+" transition-colors"),d(e,"class",Y="border rounded-lg p-3 "+(((y=s[2])==null?void 0:y.id)===s[50].id?"border-amber-300 bg-amber-50":"border-gray-200 hover:border-gray-300")+" transition-colors")},m(U,y){q(U,e,y),c(e,t),c(t,r),c(r,l),c(r,n),c(t,i),c(t,a),E[g].m(a,null),c(e,v),c(e,m),c(m,L),c(e,O),c(e,T),c(T,P),c(e,G),R=!0,Q||(z=[Se(a,"click",K),Se(T,"click",F)],Q=!0)},p(U,y){var ee,I,x;s=U;let J=g;g=j(s),g!==J&&($e(),C(E[J],1,1,()=>{E[J]=null}),Ve(),_=E[g],_||(_=E[g]=N[g](s),_.c()),D(_,1),_.m(a,null)),(!R||y[0]&2)&&w!==(w=s[50].timestamp.toLocaleTimeString()+"")&&Ce(L,w),(!R||y[0]&6)&&W!==(W=((ee=s[2])==null?void 0:ee.id)===s[50].id?"Selected":"Select for cloning")&&Ce(P,W),(!R||y[0]&6&&S!==(S="w-full text-xs px-2 py-1 rounded "+(((I=s[2])==null?void 0:I.id)===s[50].id?"bg-amber-200 text-amber-800":"bg-gray-100 text-gray-700 hover:bg-gray-200")+" transition-colors"))&&d(T,"class",S),(!R||y[0]&6&&Y!==(Y="border rounded-lg p-3 "+(((x=s[2])==null?void 0:x.id)===s[50].id?"border-amber-300 bg-amber-50":"border-gray-200 hover:border-gray-300")+" transition-colors"))&&d(e,"class",Y)},i(U){R||(D(_),R=!0)},o(U){C(_),R=!1},d(U){U&&u(e),E[g].d(),Q=!1,it(z)}}}function pr(s){let e;return{c(){e=B("Clone")},l(t){e=H(t,"Clone")},m(t,r){q(t,e,r)},i:Be,o:Be,d(t){t&&u(e)}}}function mr(s){let e,t,r;return e=new ht({props:{size:16,class:"animate-spin"}}),{c(){be(e.$$.fragment),t=B(`
|
| 3 |
+
Uploading...`)},l(l){ge(e.$$.fragment,l),t=H(l,`
|
| 4 |
+
Uploading...`)},m(l,o){me(e,l,o),q(l,t,o),r=!0},i(l){r||(D(e.$$.fragment,l),r=!0)},o(l){C(e.$$.fragment,l),r=!1},d(l){l&&u(t),pe(e,l)}}}function gr(s){let e,t,r;return e=new ht({props:{size:16,class:"animate-spin"}}),{c(){be(e.$$.fragment),t=B(`
|
| 5 |
+
Transcribing...`)},l(l){ge(e.$$.fragment,l),t=H(l,`
|
| 6 |
+
Transcribing...`)},m(l,o){me(e,l,o),q(l,t,o),r=!0},i(l){r||(D(e.$$.fragment,l),r=!0)},o(l){C(e.$$.fragment,l),r=!1},d(l){l&&u(t),pe(e,l)}}}function br(s){let e;return{c(){e=B("β")},l(t){e=H(t,"β")},m(t,r){q(t,e,r)},p:Be,d(t){t&&u(e)}}}function vr(s){let e,t;function r(n,i){return i[0]&4&&(e=null),e==null&&(e=!!at(n[2])),e?kr:yr}let l=r(s,[-1,-1]),o=l(s);return{c(){o.c(),t=Ke()},l(n){o.l(n),t=Ke()},m(n,i){o.m(n,i),q(n,t,i)},p(n,i){l!==(l=r(n,i))&&(o.d(1),o=l(n),o&&(o.c(),o.m(t.parentNode,t)))},d(n){n&&u(t),o.d(n)}}}function yr(s){let e;return{c(){e=B("β")},l(t){e=H(t,"β")},m(t,r){q(t,e,r)},d(t){t&&u(e)}}}function kr(s){let e;return{c(){e=B("β")},l(t){e=H(t,"β")},m(t,r){q(t,e,r)},d(t){t&&u(e)}}}function wr(s){let e;return{c(){e=B("β")},l(t){e=H(t,"β")},m(t,r){q(t,e,r)},p:Be,d(t){t&&u(e)}}}function Er(s){let e,t;function r(n,i){return i[0]&4&&(e=null),e==null&&(e=!!n[21](n[2])),e?Tr:Dr}let l=r(s,[-1,-1]),o=l(s);return{c(){o.c(),t=Ke()},l(n){o.l(n),t=Ke()},m(n,i){o.m(n,i),q(n,t,i)},p(n,i){l!==(l=r(n,i))&&(o.d(1),o=l(n),o&&(o.c(),o.m(t.parentNode,t)))},d(n){n&&u(t),o.d(n)}}}function Dr(s){let e;return{c(){e=B("β")},l(t){e=H(t,"β")},m(t,r){q(t,e,r)},d(t){t&&u(e)}}}function Tr(s){let e;return{c(){e=B("β")},l(t){e=H(t,"β")},m(t,r){q(t,e,r)},d(t){t&&u(e)}}}function Pt(s){let e,t,r,l=s[10][s[2].id].first_words+"",o,n;return{c(){e=p("div"),t=p("p"),r=B('"'),o=B(l),n=B('..."'),this.h()},l(i){e=h(i,"DIV",{class:!0});var a=b(e);t=h(a,"P",{class:!0});var g=b(t);r=H(g,'"'),o=H(g,l),n=H(g,'..."'),g.forEach(u),a.forEach(u),this.h()},h(){d(t,"class","text-sm text-gray-600 italic"),d(e,"class","mt-3 p-3 bg-gray-50 rounded-lg border")},m(i,a){q(i,e,a),c(e,t),c(t,r),c(t,o),c(t,n)},p(i,a){a[0]&1028&&l!==(l=i[10][i[2].id].first_words+"")&&Ce(o,l)},d(i){i&&u(e)}}}function Ir(s){let e,t,r;return{c(){e=p("div"),t=p("p"),r=B(s[14]),this.h()},l(l){e=h(l,"DIV",{class:!0});var o=b(e);t=h(o,"P",{class:!0});var n=b(t);r=H(n,s[14]),n.forEach(u),o.forEach(u),this.h()},h(){d(t,"class","text-sm text-green-700"),d(e,"class","mt-3 p-3 bg-green-50 rounded-lg border border-green-200")},m(l,o){q(l,e,o),c(e,t),c(t,r)},p(l,o){o[0]&16384&&Ce(r,l[14])},d(l){l&&u(e)}}}function xr(s){let e,t,r,l,o,n,i;return{c(){e=p("div"),t=p("p"),r=B("Your voice has been saved to a "),l=p("a"),o=B("temporary URL"),i=B(` for 24 hours and will be automatically deleted. You can now use it for text-to-speech
|
| 7 |
+
generation.`),this.h()},l(a){e=h(a,"DIV",{class:!0});var g=b(e);t=h(g,"P",{class:!0});var _=b(t);r=H(_,"Your voice has been saved to a "),l=h(_,"A",{href:!0,target:!0,class:!0});var v=b(l);o=H(v,"temporary URL"),v.forEach(u),i=H(_,` for 24 hours and will be automatically deleted. You can now use it for text-to-speech
|
| 8 |
+
generation.`),_.forEach(u),g.forEach(u),this.h()},h(){d(l,"href",n=s[13][s[2].id].voice_url),d(l,"target","_blank"),d(l,"class","text-green-800 underline hover:text-green-900"),d(t,"class","text-sm text-green-700"),d(e,"class","mt-3 p-3 bg-green-50 rounded-lg border border-green-200")},m(a,g){q(a,e,g),c(e,t),c(t,r),c(t,l),c(l,o),c(t,i)},p(a,g){g[0]&8196&&n!==(n=a[13][a[2].id].voice_url)&&d(l,"href",n)},d(a){a&&u(e)}}}function Rt(s){let e,t,r="Your existing voice clone",l,o,n,i=nt(s[15]),a=[];for(let _=0;_<i.length;_+=1)a[_]=zt($t(s,i,_));const g=_=>C(a[_],1,1,()=>{a[_]=null});return{c(){e=p("div"),t=p("h3"),t.textContent=r,l=$(),o=p("div");for(let _=0;_<a.length;_+=1)a[_].c();this.h()},l(_){e=h(_,"DIV",{class:!0});var v=b(e);t=h(v,"H3",{class:!0,"data-svelte-h":!0}),we(t)!=="svelte-5uh5wl"&&(t.textContent=r),l=V(v),o=h(v,"DIV",{class:!0});var m=b(o);for(let w=0;w<a.length;w+=1)a[w].l(m);m.forEach(u),v.forEach(u),this.h()},h(){d(t,"class","text-sm font-medium text-gray-700 mb-3"),d(o,"class","space-y-2"),d(e,"class","mt-6 pt-4 border-t border-gray-200")},m(_,v){q(_,e,v),c(e,t),c(e,l),c(e,o);for(let m=0;m<a.length;m+=1)a[m]&&a[m].m(o,null);n=!0},p(_,v){if(v[0]&335643392){i=nt(_[15]);let m;for(m=0;m<i.length;m+=1){const w=$t(_,i,m);a[m]?(a[m].p(w,v),D(a[m],1)):(a[m]=zt(w),a[m].c(),D(a[m],1),a[m].m(o,null))}for($e(),m=i.length;m<a.length;m+=1)g(m);Ve()}},i(_){if(!n){for(let v=0;v<i.length;v+=1)D(a[v]);n=!0}},o(_){a=a.filter(Boolean);for(let v=0;v<a.length;v+=1)C(a[v]);n=!1},d(_){_&&u(e),Ot(a,_)}}}function Vr(s){let e,t;return e=new Kt({props:{size:14,class:"text-blue-600"}}),{c(){be(e.$$.fragment)},l(r){ge(e.$$.fragment,r)},m(r,l){me(e,r,l),t=!0},i(r){t||(D(e.$$.fragment,r),t=!0)},o(r){C(e.$$.fragment,r),t=!1},d(r){pe(e,r)}}}function $r(s){let e,t;return e=new Jt({props:{size:14,class:"text-blue-600"}}),{c(){be(e.$$.fragment)},l(r){ge(e.$$.fragment,r)},m(r,l){me(e,r,l),t=!0},i(r){t||(D(e.$$.fragment,r),t=!0)},o(r){C(e.$$.fragment,r),t=!1},d(r){pe(e,r)}}}function Cr(s){let e,t;return e=new ir({props:{size:14}}),{c(){be(e.$$.fragment)},l(r){ge(e.$$.fragment,r)},m(r,l){me(e,r,l),t=!0},i(r){t||(D(e.$$.fragment,r),t=!0)},o(r){C(e.$$.fragment,r),t=!1},d(r){pe(e,r)}}}function Sr(s){let e,t;return e=new ht({props:{size:14,class:"animate-spin"}}),{c(){be(e.$$.fragment)},l(r){ge(e.$$.fragment,r)},m(r,l){me(e,r,l),t=!0},i(r){t||(D(e.$$.fragment,r),t=!0)},o(r){C(e.$$.fragment,r),t=!1},d(r){pe(e,r)}}}function zt(s){let e,t,r,l=s[47].voice_name+"",o,n,i,a,g,_,v,m,w,L,O,T,W,P=new Date(s[47].expires_at).toLocaleDateString()+"",S,G,Y=new Date(s[47].expires_at).toLocaleTimeString()+"",R,Q,z,N,E;const j=[$r,Vr],K=[];function F(I,x){var X;return((X=I[8])==null?void 0:X.id)===I[47].id&&I[9]&&!I[9].paused?0:1}g=F(s),_=K[g]=j[g](s);function ce(){return s[32](s[47])}const U=[Sr,Cr],y=[];function J(I,x){return I[16]?0:1}w=J(s),L=y[w]=U[w](s);function ee(){return s[33](s[47])}return{c(){e=p("div"),t=p("div"),r=p("span"),o=B(l),n=$(),i=p("div"),a=p("button"),_.c(),v=$(),m=p("button"),L.c(),O=$(),T=p("div"),W=B("Expires: "),S=B(P),G=B(" at "),R=B(Y),Q=$(),this.h()},l(I){e=h(I,"DIV",{class:!0});var x=b(e);t=h(x,"DIV",{class:!0});var X=b(t);r=h(X,"SPAN",{class:!0});var Z=b(r);o=H(Z,l),Z.forEach(u),n=V(X),i=h(X,"DIV",{class:!0});var ne=b(i);a=h(ne,"BUTTON",{class:!0,title:!0});var ae=b(a);_.l(ae),ae.forEach(u),v=V(ne),m=h(ne,"BUTTON",{class:!0,title:!0});var ue=b(m);L.l(ue),ue.forEach(u),ne.forEach(u),X.forEach(u),O=V(x),T=h(x,"DIV",{class:!0});var ye=b(T);W=H(ye,"Expires: "),S=H(ye,P),G=H(ye," at "),R=H(ye,Y),ye.forEach(u),Q=V(x),x.forEach(u),this.h()},h(){d(r,"class","text-sm font-medium text-blue-900"),d(a,"class","p-1 hover:bg-blue-100 rounded transition-colors"),d(a,"title","Play voice sample"),m.disabled=s[16],d(m,"class","p-1 text-red-600 hover:text-red-800 hover:bg-red-100 rounded transition-colors disabled:opacity-50"),d(m,"title","Delete voice"),d(i,"class","flex items-center gap-2"),d(t,"class","flex items-center justify-between mb-2"),d(T,"class","text-xs text-blue-600"),d(e,"class","border rounded-lg p-3 bg-blue-50 border-blue-200")},m(I,x){q(I,e,x),c(e,t),c(t,r),c(r,o),c(t,n),c(t,i),c(i,a),K[g].m(a,null),c(i,v),c(i,m),y[w].m(m,null),c(e,O),c(e,T),c(T,W),c(T,S),c(T,G),c(T,R),c(e,Q),z=!0,N||(E=[Se(a,"click",ce),Se(m,"click",ee)],N=!0)},p(I,x){s=I,(!z||x[0]&32768)&&l!==(l=s[47].voice_name+"")&&Ce(o,l);let X=g;g=F(s),g!==X&&($e(),C(K[X],1,1,()=>{K[X]=null}),Ve(),_=K[g],_||(_=K[g]=j[g](s),_.c()),D(_,1),_.m(a,null));let Z=w;w=J(s),w!==Z&&($e(),C(y[Z],1,1,()=>{y[Z]=null}),Ve(),L=y[w],L||(L=y[w]=U[w](s),L.c()),D(L,1),L.m(m,null)),(!z||x[0]&65536)&&(m.disabled=s[16]),(!z||x[0]&32768)&&P!==(P=new Date(s[47].expires_at).toLocaleDateString()+"")&&Ce(S,P),(!z||x[0]&32768)&&Y!==(Y=new Date(s[47].expires_at).toLocaleTimeString()+"")&&Ce(R,Y)},i(I){z||(D(_),D(L),z=!0)},o(I){C(_),C(L),z=!1},d(I){I&&u(e),K[g].d(),y[w].d(),N=!1,it(E)}}}function Nt(s){let e,t,r,l,o,n,i,a,g,_,v,m,w="An error occurred while processing your request",L,O,T,W,P,S,G,Y,R="Close",Q,z,N;n=new Zt({props:{size:20,class:"text-red-600"}}),T=new er({props:{size:20,class:"text-gray-500"}});let E=s[5]&&Ut(s);return{c(){e=p("div"),t=p("div"),r=p("div"),l=p("div"),o=p("div"),be(n.$$.fragment),i=$(),a=p("div"),g=p("h3"),_=B(s[4]),v=$(),m=p("p"),m.textContent=w,L=$(),O=p("button"),be(T.$$.fragment),W=$(),P=p("div"),E&&E.c(),S=$(),G=p("div"),Y=p("button"),Y.textContent=R,this.h()},l(j){e=h(j,"DIV",{class:!0});var K=b(e);t=h(K,"DIV",{class:!0});var F=b(t);r=h(F,"DIV",{class:!0});var ce=b(r);l=h(ce,"DIV",{class:!0});var U=b(l);o=h(U,"DIV",{class:!0});var y=b(o);ge(n.$$.fragment,y),y.forEach(u),i=V(U),a=h(U,"DIV",{class:!0});var J=b(a);g=h(J,"H3",{class:!0});var ee=b(g);_=H(ee,s[4]),ee.forEach(u),v=V(J),m=h(J,"P",{class:!0,"data-svelte-h":!0}),we(m)!=="svelte-1l3zl3"&&(m.textContent=w),J.forEach(u),U.forEach(u),L=V(ce),O=h(ce,"BUTTON",{class:!0,title:!0});var I=b(O);ge(T.$$.fragment,I),I.forEach(u),ce.forEach(u),W=V(F),P=h(F,"DIV",{class:!0});var x=b(P);E&&E.l(x),x.forEach(u),S=V(F),G=h(F,"DIV",{class:!0});var X=b(G);Y=h(X,"BUTTON",{class:!0,"data-svelte-h":!0}),we(Y)!=="svelte-4sxk6g"&&(Y.textContent=R),X.forEach(u),F.forEach(u),K.forEach(u),this.h()},h(){d(o,"class","w-10 h-10 bg-red-100 rounded-full flex items-center justify-center flex-shrink-0"),d(g,"class","text-lg font-semibold text-gray-900 truncate"),d(m,"class","text-sm text-gray-600"),d(a,"class","min-w-0"),d(l,"class","flex items-center gap-3 min-w-0"),d(O,"class","p-2 hover:bg-red-100 rounded-full transition-colors flex-shrink-0"),d(O,"title","Close"),d(r,"class","flex items-center justify-between p-6 border-b border-gray-200 bg-red-50 flex-shrink-0"),d(P,"class","p-6 overflow-y-auto flex-1 min-h-0"),d(Y,"class","px-6 py-2 bg-red-600 text-white rounded-lg hover:bg-red-700 transition-colors"),d(G,"class","flex items-center justify-end gap-3 p-6 border-t border-gray-200 bg-gray-50 flex-shrink-0"),d(t,"class","bg-white rounded-xl shadow-2xl max-w-2xl w-full max-h-[80vh] flex flex-col"),d(e,"class","fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4")},m(j,K){q(j,e,K),c(e,t),c(t,r),c(r,l),c(l,o),me(n,o,null),c(l,i),c(l,a),c(a,g),c(g,_),c(a,v),c(a,m),c(r,L),c(r,O),me(T,O,null),c(t,W),c(t,P),E&&E.m(P,null),c(t,S),c(t,G),c(G,Y),Q=!0,z||(N=[Se(O,"click",s[22]),Se(Y,"click",s[22])],z=!0)},p(j,K){(!Q||K[0]&16)&&Ce(_,j[4]),j[5]?E?E.p(j,K):(E=Ut(j),E.c(),E.m(P,null)):E&&(E.d(1),E=null)},i(j){Q||(D(n.$$.fragment,j),D(T.$$.fragment,j),Q=!0)},o(j){C(n.$$.fragment,j),C(T.$$.fragment,j),Q=!1},d(j){j&&u(e),pe(n),pe(T),E&&E.d(),z=!1,it(N)}}}function Ut(s){let e,t,r="Error Details:",l,o,n;return{c(){e=p("div"),t=p("h4"),t.textContent=r,l=$(),o=p("pre"),n=B(s[5]),this.h()},l(i){e=h(i,"DIV",{class:!0});var a=b(e);t=h(a,"H4",{class:!0,"data-svelte-h":!0}),we(t)!=="svelte-3lmggt"&&(t.textContent=r),l=V(a),o=h(a,"PRE",{class:!0});var g=b(o);n=H(g,s[5]),g.forEach(u),a.forEach(u),this.h()},h(){d(t,"class","text-sm font-medium text-gray-900 mb-2"),d(o,"class","text-xs text-gray-700 whitespace-pre-wrap font-mono leading-relaxed break-words"),d(e,"class","bg-gray-50 rounded-lg p-4 border")},m(i,a){q(i,e,a),c(e,t),c(e,l),c(e,o),c(o,n)},p(i,a){a[0]&32&&Ce(n,i[5])},d(i){i&&u(e)}}}function Lr(s){let e,t,r,l,o,n,i,a='<span class="text-sm text-gray-400">Sample script</span>',g,_,v,m,w,L,O,T,W="I consent to cloning my voice.",P,S=s[20][s[17]]+"",G,Y,R,Q,z,N,E,j,K,F,ce=`<p class="text-center"><em>Record your voice for at least 3 seconds to create a voice clone. To prevent
|
| 9 |
+
unauthorized voice cloning, you must start by clearly saying "I consent to cloning my
|
| 10 |
+
voice" β the rest of the text is arbitrary. Try reading the sample above.</em></p>`,U,y,J,ee,I,x,X,Z,ne,ae,ue,ye,Ae,Ee,Ie,Qe,We,Xe,xe,k,A,te,ve,Le,ke,fe,ie,je,Me;m=new Xt({props:{size:16}});let re=s[0]&&St(s);const Ze=[ur,cr],Pe=[];function pt(f,M){return f[0]?0:1}N=pt(s),E=Pe[N]=Ze[N](s);let de=!s[18]&&s[19]&&Lt(s);const mt=[dr,fr],Re=[];function gt(f,M){return f[1].length===0?0:1}I=gt(s),x=Re[I]=mt[I](s);const bt=[gr,mr,pr],He=[];function vt(f,M){return f[11]?0:f[12]?1:2}ae=vt(s),ue=He[ae]=bt[ae](s);function yt(f,M){return f[2]?vr:br}let et=yt(s),De=et(s);function kt(f,M){return f[2]&&f[10][f[2].id]?Er:wr}let tt=kt(s),Te=tt(s),_e=s[2]&&s[10][s[2].id]&&Pt(s);function wt(f,M){if(f[14]&&f[2]&&f[13][f[2].id])return xr;if(f[14])return Ir}let Oe=wt(s),he=Oe&&Oe(s),le=s[18]&&s[15].length>0&&Rt(s),se=s[3]&&Nt(s);return{c(){e=$(),t=p("div"),r=p("div"),l=p("div"),o=p("div"),n=p("div"),i=p("div"),i.innerHTML=a,g=$(),_=p("div"),v=p("button"),be(m.$$.fragment),w=$(),L=p("div"),O=p("p"),T=p("span"),T.textContent=W,P=$(),G=B(S),Y=$(),R=p("div"),re&&re.c(),Q=$(),z=p("button"),E.c(),K=$(),F=p("div"),F.innerHTML=ce,U=$(),y=p("div"),de&&de.c(),J=$(),ee=p("div"),x.c(),X=$(),Z=p("div"),ne=p("button"),ue.c(),Ae=$(),Ee=p("div"),Ie=p("span"),De.c(),Qe=B(`
|
| 11 |
+
at least 3 seconds`),Xe=$(),xe=p("span"),Te.c(),k=B(`
|
| 12 |
+
includes consent`),te=$(),_e&&_e.c(),ve=$(),he&&he.c(),Le=$(),le&&le.c(),ke=$(),se&&se.c(),fe=Ke(),this.h()},l(f){Qt("svelte-ymar42",document.head).forEach(u),e=V(f),t=h(f,"DIV",{class:!0});var Fe=b(t);r=h(Fe,"DIV",{class:!0});var ze=b(r);l=h(ze,"DIV",{class:!0});var qe=b(l);o=h(qe,"DIV",{class:!0});var Ye=b(o);n=h(Ye,"DIV",{class:!0});var Ge=b(n);i=h(Ge,"DIV",{class:!0,"data-svelte-h":!0}),we(i)!=="svelte-hnzyx9"&&(i.innerHTML=a),g=V(Ge),_=h(Ge,"DIV",{class:!0});var Et=b(_);v=h(Et,"BUTTON",{class:!0,title:!0});var Dt=b(v);ge(m.$$.fragment,Dt),Dt.forEach(u),Et.forEach(u),w=V(Ge),L=h(Ge,"DIV",{class:!0});var Tt=b(L);O=h(Tt,"P",{});var rt=b(O);T=h(rt,"SPAN",{class:!0,"data-svelte-h":!0}),we(T)!=="svelte-teyhel"&&(T.textContent=W),P=V(rt),G=H(rt,S),rt.forEach(u),Tt.forEach(u),Ge.forEach(u),Y=V(Ye),R=h(Ye,"DIV",{class:!0});var lt=b(R);re&&re.l(lt),Q=V(lt),z=h(lt,"BUTTON",{class:!0});var It=b(z);E.l(It),It.forEach(u),lt.forEach(u),K=V(Ye),F=h(Ye,"DIV",{class:!0,"data-svelte-h":!0}),we(F)!=="svelte-fbcwq9"&&(F.innerHTML=ce),Ye.forEach(u),qe.forEach(u),U=V(ze),y=h(ze,"DIV",{class:!0});var Ne=b(y);de&&de.l(Ne),J=V(Ne),ee=h(Ne,"DIV",{class:!0});var xt=b(ee);x.l(xt),xt.forEach(u),X=V(Ne),Z=h(Ne,"DIV",{class:!0});var Ue=b(Z);ne=h(Ue,"BUTTON",{class:!0});var Vt=b(ne);ue.l(Vt),Vt.forEach(u),Ae=V(Ue),Ee=h(Ue,"DIV",{class:!0});var st=b(Ee);Ie=h(st,"SPAN",{class:!0});var ct=b(Ie);De.l(ct),Qe=H(ct,`
|
| 13 |
+
at least 3 seconds`),ct.forEach(u),Xe=V(st),xe=h(st,"SPAN",{class:!0});var ut=b(xe);Te.l(ut),k=H(ut,`
|
| 14 |
+
includes consent`),ut.forEach(u),st.forEach(u),te=V(Ue),_e&&_e.l(Ue),ve=V(Ue),he&&he.l(Ue),Ue.forEach(u),Le=V(Ne),le&&le.l(Ne),Ne.forEach(u),ze.forEach(u),Fe.forEach(u),ke=V(f),se&&se.l(f),fe=Ke(),this.h()},h(){document.title="Voice Cloning - HFStudio",d(i,"class","absolute top-3 left-3 flex items-center gap-2 z-10"),d(v,"class","p-1 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-lg transition-colors"),d(v,"title","Try a different sample text"),d(_,"class","absolute top-3 right-3 flex items-center gap-2 z-10"),d(T,"class","bg-yellow-50 px-2 py-1 rounded border border-amber-200"),d(L,"class","w-full h-80 pt-10 px-6 pb-6 bg-white border border-amber-400 rounded-lg text-gray-900 text-lg leading-relaxed overflow-y-auto"),d(n,"class","relative mb-4"),d(z,"class",j="w-24 h-24 rounded-full flex items-center justify-center transition-all duration-200 shadow-lg relative overflow-hidden z-20 cursor-pointer "+(s[0]?"border-4 border-orange-500 bg-transparent":"bg-orange-500 hover:bg-orange-600")),d(R,"class","flex justify-center items-center flex-1 relative"),d(F,"class","mb-6"),d(o,"class","flex-1 pb-24 relative flex flex-col"),d(l,"class","flex-1 flex flex-col p-6"),d(ee,"class","mb-4"),ne.disabled=ye=!s[2]||s[11]||s[12],d(ne,"class","w-full px-4 py-2 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 transition-colors flex items-center justify-center gap-2"),d(Ie,"class",We="flex items-center gap-1 "+(s[2]?at(s[2])?"text-green-600":"text-red-600":"text-gray-400")),d(xe,"class",A="flex items-center gap-1 "+(s[2]?s[21](s[2])?"text-green-600":s[10][s[2].id]?"text-red-600":"text-gray-400":"text-gray-400")),d(Ee,"class","mt-3 text-sm flex items-center gap-4"),d(Z,"class","mt-6 pt-4 border-t border-gray-200"),d(y,"class","w-80 border-l border-gray-200 bg-white p-3 overflow-y-auto"),d(r,"class","flex-1 flex"),d(t,"class","flex flex-col h-full")},m(f,M){q(f,e,M),q(f,t,M),c(t,r),c(r,l),c(l,o),c(o,n),c(n,i),c(n,g),c(n,_),c(_,v),me(m,v,null),c(n,w),c(n,L),c(L,O),c(O,T),c(O,P),c(O,G),c(o,Y),c(o,R),re&&re.m(R,null),c(R,Q),c(R,z),Pe[N].m(z,null),c(o,K),c(o,F),c(r,U),c(r,y),de&&de.m(y,null),c(y,J),c(y,ee),Re[I].m(ee,null),c(y,X),c(y,Z),c(Z,ne),He[ae].m(ne,null),c(Z,Ae),c(Z,Ee),c(Ee,Ie),De.m(Ie,null),c(Ie,Qe),c(Ee,Xe),c(Ee,xe),Te.m(xe,null),c(xe,k),c(Z,te),_e&&_e.m(Z,null),c(Z,ve),he&&he.m(Z,null),c(y,Le),le&&le.m(y,null),q(f,ke,M),se&&se.m(f,M),q(f,fe,M),ie=!0,je||(Me=[Se(v,"click",s[23]),Se(z,"click",s[24]),Se(ne,"click",s[27])],je=!0)},p(f,M){(!ie||M[0]&131072)&&S!==(S=f[20][f[17]]+"")&&Ce(G,S),f[0]?re?re.p(f,M):(re=St(f),re.c(),re.m(R,Q)):re&&(re.d(1),re=null);let Fe=N;N=pt(f),N===Fe?Pe[N].p(f,M):($e(),C(Pe[Fe],1,1,()=>{Pe[Fe]=null}),Ve(),E=Pe[N],E?E.p(f,M):(E=Pe[N]=Ze[N](f),E.c()),D(E,1),E.m(z,null)),(!ie||M[0]&1&&j!==(j="w-24 h-24 rounded-full flex items-center justify-center transition-all duration-200 shadow-lg relative overflow-hidden z-20 cursor-pointer "+(f[0]?"border-4 border-orange-500 bg-transparent":"bg-orange-500 hover:bg-orange-600")))&&d(z,"class",j),!f[18]&&f[19]?de?de.p(f,M):(de=Lt(f),de.c(),de.m(y,J)):de&&(de.d(1),de=null);let ze=I;I=gt(f),I===ze?Re[I].p(f,M):($e(),C(Re[ze],1,1,()=>{Re[ze]=null}),Ve(),x=Re[I],x?x.p(f,M):(x=Re[I]=mt[I](f),x.c()),D(x,1),x.m(ee,null));let qe=ae;ae=vt(f),ae!==qe&&($e(),C(He[qe],1,1,()=>{He[qe]=null}),Ve(),ue=He[ae],ue||(ue=He[ae]=bt[ae](f),ue.c()),D(ue,1),ue.m(ne,null)),(!ie||M[0]&6148&&ye!==(ye=!f[2]||f[11]||f[12]))&&(ne.disabled=ye),et===(et=yt(f))&&De?De.p(f,M):(De.d(1),De=et(f),De&&(De.c(),De.m(Ie,Qe))),(!ie||M[0]&4&&We!==(We="flex items-center gap-1 "+(f[2]?at(f[2])?"text-green-600":"text-red-600":"text-gray-400")))&&d(Ie,"class",We),tt===(tt=kt(f))&&Te?Te.p(f,M):(Te.d(1),Te=tt(f),Te&&(Te.c(),Te.m(xe,k))),(!ie||M[0]&1028&&A!==(A="flex items-center gap-1 "+(f[2]?f[21](f[2])?"text-green-600":f[10][f[2].id]?"text-red-600":"text-gray-400":"text-gray-400")))&&d(xe,"class",A),f[2]&&f[10][f[2].id]?_e?_e.p(f,M):(_e=Pt(f),_e.c(),_e.m(Z,ve)):_e&&(_e.d(1),_e=null),Oe===(Oe=wt(f))&&he?he.p(f,M):(he&&he.d(1),he=Oe&&Oe(f),he&&(he.c(),he.m(Z,null))),f[18]&&f[15].length>0?le?(le.p(f,M),M[0]&294912&&D(le,1)):(le=Rt(f),le.c(),D(le,1),le.m(y,null)):le&&($e(),C(le,1,1,()=>{le=null}),Ve()),f[3]?se?(se.p(f,M),M[0]&8&&D(se,1)):(se=Nt(f),se.c(),D(se,1),se.m(fe.parentNode,fe)):se&&($e(),C(se,1,1,()=>{se=null}),Ve())},i(f){ie||(D(m.$$.fragment,f),D(E),D(x),D(ue),D(le),D(se),ie=!0)},o(f){C(m.$$.fragment,f),C(E),C(x),C(ue),C(le),C(se),ie=!1},d(f){f&&(u(e),u(t),u(ke),u(fe)),pe(m),re&&re.d(),Pe[N].d(),de&&de.d(),Re[I].d(),He[ae].d(),De.d(),Te.d(),_e&&_e.d(),he&&he.d(),le&&le.d(),se&&se.d(f),je=!1,it(Me)}}}function at(s){return s&&s.duration>=3}function Mr(s,e,t){let r=!1,l=[],o=null,n=[],i=null,a=[],g=!1,_="",v="",m=0,w=0,L=null,O=0,T=null,W=null,P=null,S=null,G={},Y=!1,R=!1,Q={},z="",N=[],E=!1;const j=["There's a quiet kind of magic in the early hours of the morning, when the world is still half-asleep and the air feels crisp with possibility. The hum of the refrigerator becomes a rhythm, the ticking of the clock a heartbeat, and for a brief moment, everything feels perfectly in sync.","The aroma of fresh coffee dances through the kitchen as sunlight streams through translucent curtains, casting golden patterns on weathered wooden floors. Steam rises from the ceramic mug like incense, creating a small sanctuary of warmth and comfort in the midst of a busy day.","Ocean waves crash against weathered cliffs with relentless determination, their white foam reaching toward the endless sky. Seabirds call out across the salt-scented breeze, their cries echoing off ancient stone formations that have stood witness to countless storms and seasons."];let K=0,F=!1,ce=!1;function U(k){if(!k)return!1;const A=G[k.id];return A&&A.consent_detected}function y(k,A=""){t(4,_=k),t(5,v=A),t(3,g=!0)}function J(){t(3,g=!1),t(4,_=""),t(5,v="")}function ee(){t(17,K=(K+1)%j.length)}async function I(){try{const k=await fetch("/api/auth/user",{credentials:"include"});if(k.ok){const A=await k.json(),te=F;t(18,F=A.authenticated),F&&!te?await Ae():!F&&te&&t(15,N=[])}else t(18,F=!1),t(15,N=[])}catch{t(18,F=!1),t(15,N=[])}}async function x(){if(!F){t(19,ce=!0);return}try{let ke=function(){if(!r||!W)return;W.getByteFrequencyData(Le);let fe=0;for(let ie=0;ie<ve;ie++)fe+=Le[ie];t(7,O=fe/ve/255),requestAnimationFrame(ke)};const k=await navigator.mediaDevices.getUserMedia({audio:!0});let A={};MediaRecorder.isTypeSupported("audio/mp3")?A.mimeType="audio/mp3":MediaRecorder.isTypeSupported("audio/mpeg")?A.mimeType="audio/mpeg":MediaRecorder.isTypeSupported("audio/webm;codecs=opus")?A.mimeType="audio/webm;codecs=opus":MediaRecorder.isTypeSupported("audio/webm")&&(A.mimeType="audio/webm"),i=new MediaRecorder(k,A),a=[],n=[],t(6,w=0),t(7,O=0),T=new(window.AudioContext||window.webkitAudioContext),W=T.createAnalyser(),T.createMediaStreamSource(k).connect(W),W.fftSize=256;const ve=W.frequencyBinCount,Le=new Uint8Array(ve);i.ondataavailable=fe=>{a.push(fe.data)},i.onstop=()=>{const fe=new Blob(a,{type:A.mimeType||"audio/webm"}),ie=URL.createObjectURL(fe),je={id:Date.now(),url:ie,blob:fe,timestamp:new Date,duration:w/100*15};t(1,l=[...l,je]),k.getTracks().forEach(Me=>Me.stop()),T&&(T.close(),T=null),t(6,w=0),t(7,O=0)},i.start(),t(0,r=!0),ke(),L=setInterval(()=>{if(!r){clearInterval(L);return}t(6,w+=100/15/10),w>=100&&t(6,w=100)},100)}catch(k){console.error("Error accessing microphone:",k),y("Microphone Error","Could not access microphone. Please check permissions.")}}function X(){i&&i.state==="recording"&&(i.stop(),t(0,r=!1),n=[],L&&(clearInterval(L),L=null))}function Z(){r?X():x()}function ne(k){t(2,o=k)}function ae(k){if((P==null?void 0:P.id)===k.id&&S&&!S.paused){S.pause(),t(8,P=null);return}S&&(S.pause(),t(9,S=null)),t(9,S=new Audio(k.url)),t(8,P=k),S.addEventListener("ended",()=>{t(8,P=null),t(9,S=null)}),S.addEventListener("pause",()=>{S&&S.ended&&(t(8,P=null),t(9,S=null))}),S.play()}async function ue(){if(!o){y("Clone Error","Please select a recording.");return}t(11,Y=!0),t(14,z="");try{const k=new FormData;k.append("audio_file",o.blob,"recording.mp3");const A=await fetch("/api/voice/transcribe",{method:"POST",credentials:"include",body:k});if(!A.ok){const ve=await A.text();throw new Error(`HTTP error! status: ${A.status}, response: ${ve}`)}const te=await A.json();if(te.success){t(10,G[o.id]={transcript:te.transcript,first_words:te.first_words,consent_detected:te.consent_detected},G),t(10,G={...G});const ve=at(o),Le=te.consent_detected;if(ve&&Le){t(11,Y=!1),t(12,R=!0);try{const ke=new FormData;ke.append("audio_file",o.blob,"recording.mp3");const fe=`Voice_${Date.now()}`,ie=encodeURIComponent(te.transcript),je=Math.floor(o.duration),Me=await fetch(`/api/voice/upload?voice_name=${fe}&transcript=${ie}&duration=${je}`,{method:"POST",credentials:"include",body:ke});if(!Me.ok){const Ze=await Me.text();throw new Error(`Upload failed: ${Ze}`)}const re=await Me.json();re.success?(t(13,Q[o.id]=re,Q),t(13,Q={...Q}),t(14,z="Your voice has been saved to a temporary URL for 24 hours and will be automatically deleted. You can now use it for text-to-speech generation."),await Ae()):y("Upload Error",re.error||"Failed to upload voice")}catch(ke){y("Upload Error",`Failed to upload voice: ${ke.message}`)}finally{t(12,R=!1)}}}else y("Transcription Error",te.error||"Failed to transcribe audio")}catch(k){y("Network Error",`Failed to process recording: ${k.message}`)}finally{R||t(11,Y=!1)}}async function ye(){try{const k=await fetch("/api/history/load",{method:"GET",credentials:"include"});k.ok&&(m=(await k.json()).entries.filter(ve=>ve.entry_type==="generation").length)}catch(k){console.error("Error loading history count:",k),m=0}}async function Ae(){if(F)try{const k=await fetch("/api/voice/user-voices",{method:"GET",credentials:"include"});if(k.ok){const A=await k.json();t(15,N=A.voices)}}catch(k){console.error("Error loading user voices:",k),t(15,N=[])}}async function Ee(k){t(16,E=!0);try{const A=await fetch(`/api/voice/${k}`,{method:"DELETE",credentials:"include"});if(A.ok)t(15,N=N.filter(te=>te.id!==k)),t(14,z="Voice deleted successfully"),setTimeout(()=>{t(14,z="")},3e3);else{const te=await A.json();y("Delete Error",te.detail||"Failed to delete voice")}}catch(A){y("Delete Error",`Failed to delete voice: ${A.message}`)}finally{t(16,E=!1)}}return Wt(async()=>{await I(),await ye(),await Ae()}),[r,l,o,g,_,v,w,O,P,S,G,Y,R,Q,z,N,E,K,F,ce,j,U,J,ee,Z,ne,ae,ue,Ee,()=>t(19,ce=!1),k=>ae(k),k=>ne(k),k=>ae({url:k.voice_url,id:k.id}),k=>Ee(k.id)]}class jr extends ft{constructor(e){super(),dt(this,e,Mr,Lr,_t,{},null,[-1,-1])}}export{jr as component};
|
hfstudio/static/_app/version.json
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"version":"
|
|
|
|
| 1 |
+
{"version":"1761281584427"}
|
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/TRxHAhOH.js">
|
| 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.BGBHC2PU.js">
|
| 10 |
+
<link rel="modulepreload" href="/_app/immutable/chunks/DiPl7Yg5.js">
|
| 11 |
<link rel="modulepreload" href="/_app/immutable/chunks/TRxHAhOH.js">
|
| 12 |
+
<link rel="modulepreload" href="/_app/immutable/entry/app.CtX5T3n3.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_11cx65z = {
|
| 20 |
base: ""
|
| 21 |
};
|
| 22 |
|
| 23 |
const element = document.currentScript.parentElement;
|
| 24 |
|
| 25 |
Promise.all([
|
| 26 |
+
import("/_app/immutable/entry/start.BGBHC2PU.js"),
|
| 27 |
+
import("/_app/immutable/entry/app.CtX5T3n3.js")
|
| 28 |
]).then(([kit, app]) => {
|
| 29 |
kit.start(app, element);
|
| 30 |
});
|
pyproject.toml
CHANGED
|
@@ -35,6 +35,7 @@ dependencies = [
|
|
| 35 |
"sqlalchemy>=2.0.0",
|
| 36 |
"transformers>=4.21.0",
|
| 37 |
"torch>=1.12.0",
|
|
|
|
| 38 |
]
|
| 39 |
|
| 40 |
[project.optional-dependencies]
|
|
|
|
| 35 |
"sqlalchemy>=2.0.0",
|
| 36 |
"transformers>=4.21.0",
|
| 37 |
"torch>=1.12.0",
|
| 38 |
+
"pydub>=0.25.0",
|
| 39 |
]
|
| 40 |
|
| 41 |
[project.optional-dependencies]
|