1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Index-DF3kc4kz.js","./i18n-B3JWGZHu.js","./i18n-CXkKSvel.css","./index-DdqQhAtx.js","./StreamingBar.svelte_svelte_type_style_lang-BaPvPIGD.js","./html-DY1zcnE_.js","./ScrollFade.svelte_svelte_type_style_lang-DtOW0AJa.js","./snippet-D4B_MRR0.js","./ScrollFade-DV-0xzhB.css","./index-B_pwUImq.js","./StreamingBar-CMuqaV2j.css","./Clear-B7_nEoLK.js","./Index-CI7BqPz-.css","./index-3jMPb64b.js","./index-tFQomdd2.js"])))=>i.map(i=>d[i]); 2(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();const ps="modulepreload",vs=function(e,t){return new URL(e,t).href},Un={},_t=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){let _=function(f){return Promise.all(f.map(l=>Promise.resolve(l).then(u=>({status:"fulfilled",value:u}),u=>({status:"rejected",reason:u}))))};const o=document.getElementsByTagName("link"),a=document.querySelector("meta[property=csp-nonce]"),c=a?.nonce||a?.getAttribute("nonce");s=_(n.map(f=>{if(f=vs(f,r),f in Un)return;Un[f]=!0;const l=f.endsWith(".css"),u=l?'[rel="stylesheet"]':"";if(r)for(let v=o.length-1;v>=0;v--){const p=o[v];if(p.href===f&&(!l||p.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${f}"]${u}`))return;const d=document.createElement("link");if(d.rel=l?"stylesheet":ps,l||(d.as="script"),d.crossOrigin="",d.href=f,c&&d.setAttribute("nonce",c),document.head.appendChild(d),l)return new Promise((v,p)=>{d.addEventListener("load",v),d.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${f}`)))})}))}function i(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return s.then(o=>{for(const a of o||[])a.status==="rejected"&&i(a.reason);return t().catch(i)})},ms="host",lr="queue/data",gs="queue/join",qn="upload",ws="login",Pt="config",ys="info",bs="runtime",Es="sleeptime",Ss="heartbeat",ks="component_server",Ts="reset",As="cancel",xs="app_id",cr="This application is currently busy. Please try again. ",Se="Connection errored out. ",Ee="Could not resolve app config. ",$s="Could not get space status. ",Os="Could not get API info. ",wn="Space metadata could not be loaded. ",Rs="Invalid URL. A full URL path is required.",Cs="Not authorized to access this space. ",ur="Invalid credentials. Could not login. ",Ns="Login credentials are required to access this space.",Ps="File system access is only available in Node.js environments",fr="Root URL not found in client config",Ls="Error uploading file";async function Fn(e,t,n){try{return(await(await fetch(`https://huggingface.co/api/spaces/${e}/jwt`,{headers:{Authorization:`Bearer ${t}`,...n?{Cookie:n}:{}}})).json()).token||!1}catch{return!1}}function Is(e){let t={};return e.forEach(({api_name:n,id:r})=>{n&&(t[n]=r)}),t}async function Ds(e){const t=this.options.token?{Authorization:`Bearer ${this.options.token}`}:{};if(t["Content-Type"]="application/json",typeof window<"u"&&window.gradio_config&&location.origin!=="http://localhost:9876"){if(window.gradio_config.current_page&&(e=e.substring(0,e.lastIndexOf("/"))),window.gradio_config.dev_mode||typeof window<"u"&&window?.BUILD_MODE==="dev"){let n=sn(e,this.deep_link?Pt+"?deep_link="+this.deep_link:Pt);const r=await this.fetch(n,{headers:t,credentials:"include"}),s=await zn(r,!!this.options.auth);s.root=e||s.root,window.gradio_config={...s,current_page:window.gradio_config.current_page}}return{...window.gradio_config}}else if(e){let n=sn(e,this.deep_link?Pt+"?deep_link="+this.deep_link:Pt);const r=await this.fetch(n,{headers:t,credentials:"include"}),s=await zn(r,!!this.options.auth);return s.root||(s.root=e),s}throw new Error(Ee)}async function zn(e,t){if(e?.status===401&&!t){const r=(await e.json())?.detail?.auth_message;throw new Error(r||Ns)}else if(e?.status===401&&t)throw new Error(ur);if(e?.status===200){let n=await e.json();return n.dependencies?.forEach((r,s)=>{r.id===void 0&&(r.id=s)}),n}else if(e?.status===401)throw new Error(Cs);throw new Error(Ee)}async function js(){const{http_protocol:e,host:t}=await bn(this.app_reference,this.options.token);try{if(this.options.auth){const n=await dr(e,t,this.options.auth,this.fetch,this.options.token);n&&this.set_cookies(n)}}catch(n){throw Error(n.message)}}
vendor: 5,818 bytes, line 2
2async function dr(e,t,n,r,s){const i=new FormData;i.append("username",n?.[0]),i.append("password",n?.[1]);let o={};s&&(o.Authorization=`Bearer ${s}`);const a=await r(`${e}//${t}/${ws}`,{headers:o,method:"POST",body:i,credentials:"include"});if(a.status===200)return a.headers.get("set-cookie");throw a.status===401?new Error(ur):new Error(wn)}function en(e){if(e.startsWith("http")){const{protocol:t,host:n,pathname:r}=new URL(e);return{ws_protocol:t==="https:"?"wss":"ws",http_protocol:t,host:n+(r!=="/"?r:"")}}return{ws_protocol:"wss",http_protocol:"https:",host:new URL(e).host}}const _r=e=>{let t=[];return e.split(/,(?=\s*[^\s=;]+=[^\s=;]+)/).forEach(r=>{const[s,i]=r.split(";")[0].split("=");s&&i&&t.push(`${s.trim()}=${i.trim()}`)}),t},yn=/^[a-zA-Z0-9_\-\.]+\/[a-zA-Z0-9_\-\.]+$/,Ms=/.*hf\.space\/{0,1}.*$/;async function bn(e,t){const n={};t&&(n.Authorization=`Bearer ${t}`);const r=e.trim().replace(/\/$/,"");if(yn.test(r))try{const i=(await(await fetch(`https://huggingface.co/api/spaces/${r}/${ms}`,{headers:n})).json()).host;return{space_id:e,...en(i)}}catch{throw new Error(wn)}if(Ms.test(r)){const{ws_protocol:s,http_protocol:i,host:o}=en(r);return{space_id:o.split("/")[0].replace(".hf.space",""),ws_protocol:s,http_protocol:i,host:o}}return{space_id:!1,...en(r)}}const sn=(...e)=>{try{return e.reduce((t,n)=>(t=t.replace(/\/+$/,""),n=n.replace(/^\/+/,""),new URL(n,t+"/").toString()))}catch{throw new Error(Rs)}};function Us(e,t,n){const r={named_endpoints:{},unnamed_endpoints:{}};return Object.keys(e).forEach(s=>{(s==="named_endpoints"||s==="unnamed_endpoints")&&(r[s]={},Object.entries(e[s]).forEach(([i,{parameters:o,returns:a}])=>{const c=t.dependencies.find(l=>l.api_name===i||l.api_name===i.replace("/",""))?.id||n[i.replace("/","")]||-1,_=c!==-1?t.dependencies.find(l=>l.id==c)?.types:{generator:!1,cancel:!1};if(c!==-1&&t.dependencies.find(l=>l.id==c)?.inputs?.length!==o.length){const l=t.dependencies.find(u=>u.id==c).inputs.map(u=>t.components.find(d=>d.id===u)?.type);try{l.forEach((u,d)=>{if(u==="state"){const v={component:"state",example:null,parameter_default:null,parameter_has_default:!0,parameter_name:null,hidden:!0};o.splice(d,0,v)}})}catch(u){console.error(u)}}const f=(l,u,d,v)=>({...l,description:Fs(l?.type,d),type:qs(l?.type,u,d,v)||""});r[s][i]={parameters:o.map(l=>f(l,l?.component,l?.serializer,"parameter")),returns:a.map(l=>f(l,l?.component,l?.serializer,"return")),type:_}}))}),r}function qs(e,t,n,r){if(t==="Api")return e.type;switch(e?.type){case"string":return"string";case"boolean":return"boolean";case"number":return"number"}if(n==="JSONSerializable"||n==="StringSerializable")return"any";if(n==="ListStringSerializable")return"string[]";if(t==="Image")return r==="parameter"?"Blob | File | Buffer":"string";if(n==="FileSerializable")return e?.type==="array"?r==="parameter"?"(Blob | File | Buffer)[]":"{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}[]":r==="parameter"?"Blob | File | Buffer":"{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}";if(n==="GallerySerializable")return r==="parameter"?"[(Blob | File | Buffer), (string | null)][]":"[{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}, (string | null))][]"}function Fs(e,t){return t==="GallerySerializable"?"array of [file, label] tuples":t==="ListStringSerializable"?"array of strings":t==="FileSerializable"?"array of files or single file":e?.description}function Bn(e,t){switch(e.msg){case"send_data":return{type:"data"};case"send_hash":return{type:"hash"};case"queue_full":return{type:"update",status:{queue:!0,message:cr,stage:"error",code:e.code,success:e.success}};case"heartbeat":return{type:"heartbeat"};case"unexpected_error":return{type:"unexpected_error",status:{queue:!0,message:e.message,session_not_found:e.session_not_found,stage:"error",success:!1}};case"broken_connection":return{type:"broken_connection",status:{queue:!0,message:e.message,stage:"error",success:!1}};case"estimation":return{type:"update",status:{queue:!0,stage:t||"pending",code:e.code,size:e.queue_size,position:e.rank,eta:e.rank_eta,success:e.success}};case"progress":return{type:"update",status:{queue:!0,stage:"pending",code:e.code,progress_data:e.progress_data,success:e.success}};case"log":return{type:"log",data:e};case"process_generating":return{type:"generating",status:{queue:!0,message:e.success?null:e.output.error,stage:e.success?"generating":"error",code:e.code,progress_data:e.progress_data,eta:e.average_duration,changed_state_ids:e.success?e.output.changed_state_ids:void 0},data:e.success?e.output:null};case"process_streaming":return{type:"streaming",status:{queue:!0,message:e.output.error,stage:"streaming",time_limit:e.time_limit,code:e.code,progress_data:e.progress_data,eta:e.eta},data:e.output};case"process_completed":return"error"in e.output?{type:"update",status:{queue:!0,title:e.output.title??"Error",message:e.output.error??"An error occurred",visible:e.output.visible,duration:e.output.duration,stage:"error",code:e.code,success:e.success}}:{type:"complete",status:{queue:!0,message:e.success?void 0:e.output.error,stage:e.success?"complete":"error",code:e.code,progress_data:e.progress_data,changed_state_ids:e.success?e.output.changed_state_ids:void 0,used_cache:e.used_cache,cache_duration:e.cache_duration,avg_time:e.avg_time},data:e.success?e.output:null};case"process_starts":return{type:"update",status:{queue:!0,stage:"pending",code:e.code,size:e.rank,position:0,success:e.success,eta:e.eta},original_msg:"process_starts"}}return{type:"none",status:{stage:"error",queue:!0}}}const zs=(e=[],t)=>{const n=t?t.parameters:[];if(Array.isArray(e))return t&&n.length>0&&e.length>n.length&&console.warn("Too many arguments provided for the endpoint."),e;const r=[],s=Object.keys(e);
2return n.forEach((i,o)=>{if(e.hasOwnProperty(i.parameter_name))r[o]=e[i.parameter_name];else if(i.parameter_has_default)r[o]=i.parameter_default;else throw new Error(`No value provided for required parameter: ${i.parameter_name}`)}),s.forEach(i=>{if(!n.some(o=>o.parameter_name===i))throw new Error(`Parameter \`${i}\` is not a valid keyword argument. Please refer to the API for usage.`)}),r.forEach((i,o)=>{if(i===void 0&&!n[o].parameter_has_default)throw new Error(`No value provided for required parameter: ${n[o].parameter_name}`)}),r};async function Bs(){if(this.api_info)return this.api_info;const{token:e}=this.options,{config:t}=this,n={"Content-Type":"application/json"};if(e&&(n.Authorization=`Bearer ${e}`),!!t)try{let r,s;if(typeof window<"u"&&window.gradio_api_info)s=window.gradio_api_info;else{const i=sn(t.root,this.api_prefix,ys);if(r=await this.fetch(i,{headers:n,credentials:"include"}),!r.ok)throw new Error(Se);s=await r.json()}return"api"in s&&(s=s.api),s.named_endpoints["/predict"]&&!s.unnamed_endpoints[0]&&(s.unnamed_endpoints[0]=s.named_endpoints["/predict"]),Us(s,t,this.api_map)}catch(r){throw new Error("Could not get API info. "+r.message)}}async function Gs(e,t,n){const r={};this?.options?.token&&(r.Authorization=`Bearer ${this.options.token}`);const s=1e3,i=[];let o;for(let a=0;a<t.length;a+=s){const c=t.slice(a,a+s),_=new FormData;c.forEach(l=>{_.append("files",l)});try{const l=n?`${e}${this.api_prefix}/${qn}?upload_id=${n}`:`${e}${this.api_prefix}/${qn}`;o=await this.fetch(l,{method:"POST",body:_,headers:r,credentials:"include"})}catch(l){throw new Error(Se+l.message)}if(!o.ok){const l=await o.text();return{error:`HTTP ${o.status}: ${l}`}}const f=await o.json();f&&i.push(...f)}return{files:i}}const Hs={radix:1e3,unit:["b","kb","Mb","Gb","Tb","Pb","Eb","Zb","Yb"]},Vs={radix:1024,unit:["b","Kib","Mib","Gib","Tib","Pib","Eib","Zib","Yib"]},Ys={radix:1024,unit:["b","Kb","Mb","Gb","Tb","Pb","Eb","Zb","Yb"]},Gn={si:Hs,iec:Vs,jedec:Ys};function Ws(e,t=1,n="jedec"){e=Math.abs(e);const{radix:r,unit:s}=Gn[n]||Gn.jedec;let i=0;for(;e>=r;)e/=r,++i;return`${e.toFixed(t)} ${s[i]}`}async function Ks(e,t,n,r){let s=(Array.isArray(e)?e:[e]).map(o=>o.blob);const i=s.filter(o=>o.size>(r??1/0));if(i.length)throw new Error(`File(s) exceed the maximum allowed size of ${Ws(r||1/0)}: ${i.map(o=>`"${o.name}"`).join(", ")}`);return await Promise.all(await this.upload_files(t,s,n).then(async o=>{if(o.error)throw new Error(o.error);return o.files?o.files.map((a,c)=>new zt({...e[c],path:a,url:`${t}${this.api_prefix}/file=${a}`})):[]}))}async function ia(e,t){return e.map(n=>new zt({path:n.name,orig_name:n.name,blob:n,size:n.size,mime_type:n.type,is_stream:t}))}class zt{path;url;orig_name;size;blob;is_stream;mime_type;alt_text;b64;meta={_type:"gradio.FileData"};constructor({path:t,url:n,orig_name:r,size:s,blob:i,is_stream:o,mime_type:a,alt_text:c,b64:_}){this.path=t,this.url=n,this.orig_name=r,this.size=s,this.blob=n?void 0:i,this.is_stream=o,this.mime_type=a,this.alt_text=c,this.b64=_}}class Js{type;command;meta;fileData;constructor(t,n){this.type="command",this.command=t,this.meta=n}}typeof process<"u"&&process.versions&&process.versions.node;function Hn(e,t,n){for(;n.length>1;){const s=n.shift();if(typeof s=="string"||typeof s=="number")e=e[s];else throw new Error("Invalid key type")}const r=n.shift();if(typeof r=="string"||typeof r=="number")e[r]=t;else throw new Error("Invalid key type")}async function on(e,t=void 0,n=[],r=!1,s=void 0){if(Array.isArray(e)){let i=[];return await Promise.all(e.map(async(o,a)=>{let c=n.slice();c.push(String(a));const _=await on(e[a],r?s?.parameters[a]?.component||void 0:t,c,!1,s);i=i.concat(_)})),i}else{if(globalThis.Buffer&&e instanceof globalThis.Buffer||e instanceof Blob)return[{path:n,blob:new Blob([e]),type:t}];if(typeof e=="object"&&e!==null){let i=[];for(const o of Object.keys(e)){const a=[...n,o],c=e[o];i=i.concat(await on(c,void 0,a,!1,s))}return i}}return[]}function Zs(e,t){let n=t?.dependencies?.find(r=>r.id==e)?.queue;return n!=null?!n:!t.enable_queue}function Xs(e,t){return new Promise((n,r)=>{const s=new MessageChannel;s.port1.onmessage=(({data:i})=>{s.port1.close(),n(i)}),window.parent.postMessage(e,t,[s.port2])})}function Lt(e,t,n,r,s=!1){if(r==="input"&&!s)throw new Error("Invalid code path. Cannot skip state inputs for input.");if(r==="output"&&s)return e;let i=[],o=0;
vendor: 7,777 bytes, lines 2-3
2const a=r==="input"?t.inputs:t.outputs;for(let c=0;c<a.length;c++){const _=a[c];if(n.find(l=>l.id===_)?.type==="state"){if(s)if(e.length===a.length){const l=e[o];i.push(l),o++}else i.push(null);else{o++;continue}continue}else{const l=e[o];i.push(l),o++}}return i}async function Qs(e,t,n){const r=this;await ei(r,t);const s=await on(t,void 0,[],!0,n);return(await Promise.all(s.map(async({path:o,blob:a,type:c})=>{if(!a)return{path:o,type:c};const _=await r.upload_files(e,[a]),f=_.files&&_.files[0];return{path:o,file_url:f,type:c,name:typeof File<"u"&&a instanceof File?a?.name:void 0}}))).forEach(({path:o,file_url:a,type:c,name:_})=>{if(c==="Gallery")Hn(t,a,o);else if(a){const f=new zt({path:a,orig_name:_});Hn(t,f,o)}}),t}async function ei(e,t){if(!(e.config?.root||e.config?.root_url))throw new Error(fr);await hr(e,t)}async function hr(e,t,n=[]){for(const r in t)t[r]instanceof Js?await ti(e,t,r):typeof t[r]=="object"&&t[r]!==null&&await hr(e,t[r],[...n,r])}async function ti(e,t,n){let r=t[n];const s=e.config?.root||e.config?.root_url;if(!s)throw new Error(fr);try{let i,o;if(typeof process<"u"&&process.versions&&process.versions.node){const f=await _t(()=>import("./__vite-browser-external-D7Ct-6yo.js").then(u=>u._),[],import.meta.url);o=(await _t(()=>import("./__vite-browser-external-D7Ct-6yo.js").then(u=>u._),[],import.meta.url)).resolve(process.cwd(),r.meta.path),i=await f.readFile(o)}else throw new Error(Ps);const a=new Blob([i],{type:"application/octet-stream"}),c=await e.upload_files(s,[a]),_=c.files&&c.files[0];if(_){const f=new zt({path:_,orig_name:r.meta.name||""});t[n]=f}}catch(i){console.error(Ls,i)}}async function ni(e,t,n){const r={"Content-Type":"application/json"};this.options.token&&(r.Authorization=`Bearer ${this.options.token}`);try{var s=await this.fetch(e,{method:"POST",body:JSON.stringify(t),headers:{...r,...n},credentials:"include"})}catch{return[{error:Se},500]}let i,o;try{i=await s.json(),o=s.status}catch(a){i={error:`Could not parse server response: ${a}`},o=500}return[i,o]}async function ri(e,t={}){let n=!1,r=!1;if(!this.config)throw new Error("Could not resolve app config");if(typeof e=="number")this.config.dependencies.find(s=>s.id==e);else{const s=e.replace(/^\//,"");this.config.dependencies.find(i=>i.id==this.api_map[s])}return new Promise(async(s,i)=>{const o=this.submit(e,t,null,null,!0);let a;for await(const c of o)c.type==="data"&&(r&&s(a),n=!0,a=c),c.type==="status"&&(c.stage==="error"&&i(c),c.stage==="complete"&&(r=!0,n&&s(a)))})}async function ht(e,t,n){let r=t==="subdomain"?`https://huggingface.co/api/spaces/by-subdomain/${e}`:`https://huggingface.co/api/spaces/${e}`,s,i;try{if(s=await fetch(r),i=s.status,i!==200)throw new Error;s=await s.json()}catch{n({status:"error",load_status:"error",message:$s,detail:"NOT_FOUND"});return}if(!s||i!==200)return;const{runtime:{stage:o},id:a}=s;switch(o){case"STOPPED":case"SLEEPING":n({status:"sleeping",load_status:"pending",message:"Space is asleep. Waking it up...",detail:o}),setTimeout(()=>{ht(e,t,n)},1e3);break;case"PAUSED":n({status:"paused",load_status:"error",message:"This space has been paused by the author. If you would like to try this demo, consider duplicating the space.",detail:o,discussions_enabled:await Vn(a)});break;case"RUNNING":case"RUNNING_BUILDING":n({status:"running",load_status:"complete",message:"Space is running.",detail:o});break;case"BUILDING":n({status:"building",load_status:"pending",message:"Space is building...",detail:o}),setTimeout(()=>{ht(e,t,n)},1e3);break;case"APP_STARTING":n({status:"starting",load_status:"pending",message:"Space is starting...",detail:o}),setTimeout(()=>{ht(e,t,n)},1e3);break;default:n({status:"space_error",load_status:"error",message:"This space is experiencing an issue.",detail:o,discussions_enabled:await Vn(a)});break}}const pr=async(e,t)=>{let n=0;const r=12,s=5e3;return new Promise(i=>{ht(e,yn.test(e)?"space_name":"subdomain",o=>{t(o),o.status==="running"||o.status==="error"||o.status==="paused"||o.status==="space_error"?i():(o.status==="sleeping"||o.status==="building")&&(n<r?(n++,setTimeout(()=>{pr(e,t).then(i)},s)):i())})})},si=/^(?=[^]*\b[dD]iscussions{0,1}\b)(?=[^]*\b[dD]isabled\b)[^]*$/;async function Vn(e){try{const t=await fetch(`https://huggingface.co/api/spaces/${e}/discussions`,{method:"HEAD"}),n=t.headers.get("x-error-message");return!(!t.ok||n&&si.test(n))}catch{return!1}}async function ii(e,t){const n={};t&&(n.Authorization=`Bearer ${t}`);try{const r=await fetch(`https://huggingface.co/api/spaces/${e}/${bs}`,{headers:n});if(r.status!==200)throw new Error("Space hardware could not be obtained.");const{hardware:s}=await r.json();return s.current}catch(r){throw new Error(r.message)}}async function oi(e,t,n){const r={};n&&(r.Authorization=`Bearer ${n}`);const s={seconds:t};try{const i=await fetch(`https://huggingface.co/api/spaces/${e}/${Es}`,{method:"POST",headers:{"Content-Type":"application/json",...r},body:JSON.stringify(s)});if(i.status!==200)throw new Error("Could not set sleep timeout on duplicated Space. Please visit *ADD HF LINK TO SETTINGS* to set a timeout manually to reduce billing charges.");return await i.json()}catch(i){throw new Error(i.message)}}const Yn=["cpu-basic","cpu-upgrade","cpu-xl","t4-small","t4-medium","a10g-small","a10g-large","a10g-largex2","a10g-largex4","a100-large","zero-a10g","h100","h100x8"];async function ai(e,t){const{token:n,private:r,hardware:s,timeout:i,auth:o}=t;if(s&&!Yn.includes(s))throw new Error(`Invalid hardware type provided. Valid types are: ${Yn.map(m=>`"${m}"`).join(",")}.`);const{http_protocol:a,host:c}=await bn(e,n);let _=null;if(o){const m=await dr(a,c,o,fetch);m&&(_=_r(m))}const f={Authorization:`Bearer ${n}`,"Content-Type":"application/json",..._?{Cookie:_.join("; ")}:{}},l=(await(await fetch("https://huggingface.co/api/whoami-v2",{headers:f})).json()).name,u=e.split("/")[1],d={repository:`${l}/${u}`};r&&(d.private=!0);let v;try{s||(v=await ii(e,n))}catch(m){throw Error(wn+m.message)}const p=s||v||"cpu-basic";d.hardware=p;try{const m=await fetch(`https://huggingface.co/api/spaces/${e}/duplicate`,{method:"POST",headers:f,body:JSON.stringify(d)});if(m.status===409)try{return await Dt.connect(`${l}/${u}`,t)}catch(Ce){throw console.error("Failed to connect Client instance:",Ce),Ce}else if(m.status!==200)throw new Error(m.statusText);const U=await m.json();return await oi(`${l}/${u}`,i||300,n),await Dt.connect(li(U.url),t)}catch(m){throw new Error(m)}}function li(e){const t=/https:\/\/huggingface.co\/spaces\/([^/]+\/[^/]+)/,n=e.match(t);if(n)return n[1]}const Wn="supports-zerogpu-headers";let Kn=!1;function ci(){return typeof window<"u"&&typeof document<"u"&&typeof window.addEventListener=="function"}function vr(e){return e.includes(".dev.")?`https://moon-${e.split(".")[1]}.dev.spaces.huggingface.tech`:e.endsWith(".hf.space")?"https://huggingface.co":null}function ui(){if(!ci()||Kn)return;window.addEventListener("message",t=>{t.data===Wn&&(window.supports_zerogpu_headers=!0)}),Kn=!0;const e=vr(window.location.hostname);e&&window.parent!==window&&window.parent.postMessage(Wn,e)}class fi extends TransformStream{#e="";constructor(t={allowCR:!1}){super({transform:(n,r)=>{for(n=this.#e+n;;){const s=n.indexOf(` 3`),i=t.allowCR?n.indexOf("\r"):-1;if(i!==-1&&i!==n.length-1&&(s===-1||s-1>i)){r.enqueue(n.slice(0,i)),n=n.slice(i+1);continue}if(s===-1)break;const o=n[s-1]==="\r"?s-1:s;r.enqueue(n.slice(0,o)),n=n.slice(s+1)}this.#e=n},flush:n=>{if(this.#e==="")return;const r=t.allowCR&&this.#e.endsWith("\r")?this.#e.slice(0,-1):this.#e;n.enqueue(r)}})}}function di(e){let t=new TextDecoderStream,n=new fi({allowCR:!0});return e.pipeThrough(t).pipeThrough(n)}function _i(e){let n=/[:]\s*/.exec(e),r=n&&n.index;if(r)return[e.substring(0,r),e.substring(r+n[0].length)]}
3function Jn(e,t,n){e.get(t)||e.set(t,n)}async function*hi(e,t){if(!e.body)return;let n=di(e.body),r,s=n.getReader(),i;for(;;){if(t&&t.aborted)return s.cancel();if(r=await s.read(),r.done)return;if(!r.value){i&&(yield i),i=void 0;continue}let[o,a]=_i(r.value)||[];o==="data"?(i||={},i[o]=i[o]?i[o]+` 4`+a:a):o==="event"?(i||={},i[o]=a):o==="id"?(i||={},i[o]=String(+a)===a?+a:a):o==="retry"&&(i||={},i[o]=+a||void 0)}}async function pi(e,t){let n=new Request(e,t);Jn(n.headers,"Accept","text/event-stream"),Jn(n.headers,"Content-Type","application/json");let r=await fetch(n);if(!r.ok)throw r;return hi(r,n.signal)}async function vi(){let{event_callbacks:e,unclosed_events:t,pending_stream_messages:n,stream_status:r,config:s,jwt:i}=this;const o=this;if(!s)throw new Error("Could not resolve app config");r.open=!0;let a=null,c=new URLSearchParams({session_hash:this.session_hash}).toString(),_=new URL(`${s.root}${this.api_prefix}/${lr}?${c}`);if(i&&_.searchParams.set("__sign",i),a=this.stream(_),!a){console.warn("Cannot connect to SSE endpoint: "+_.toString());return}a.onmessage=async function(f){let l=JSON.parse(f.data);if(l.msg==="close_stream"){En(r,o.abort_controller);return}const u=l.event_id;if(!u)await Promise.all(Object.keys(e).map(d=>e[d](l)));else if(e[u]&&s){l.msg==="process_completed"&&["sse","sse_v1","sse_v2","sse_v2.1","sse_v3"].includes(s.protocol)&&t.delete(u);let d=e[u];typeof window<"u"&&typeof document<"u"?setTimeout(d,0,l):d(l)}else n[u]||(n[u]=[]),n[u].push(l)},a.onerror=async function(f){console.error(f),await Promise.all(Object.keys(e).map(l=>e[l]({msg:"broken_connection",message:Se})))}}function En(e,t){e&&(e.open=!1,t?.abort())}function mi(e,t,n){!e[t]?(e[t]=[],n.data.forEach((s,i)=>{e[t][i]=s})):n.data.forEach((s,i)=>{let o=gi(e[t][i],s);e[t][i]=o,n.data[i]=o})}function gi(e,t){return t.forEach(([n,r,s])=>{e=wi(e,r,n,s)}),e}function wi(e,t,n,r){if(t.length===0){if(n==="replace")return r;if(n==="append")return e+r;throw new Error(`Unsupported action: ${n}`)}let s=e;for(let o=0;o<t.length-1;o++)s=s[t[o]];const i=t[t.length-1];switch(n){case"replace":s[i]=r;break;case"append":s[i]+=r;break;case"add":Array.isArray(s)?s.splice(Number(i),0,r):s[i]=r;break;case"delete":Array.isArray(s)?s.splice(Number(i),1):delete s[i];break;default:throw new Error(`Unknown action: ${n}`)}return e}function yi(e,t={}){const n={close:()=>{console.warn("Method not implemented.")},onerror:null,onmessage:null,onopen:null,readyState:0,url:e.toString(),withCredentials:!1,CONNECTING:0,OPEN:1,CLOSED:2,addEventListener:()=>{throw new Error("Method not implemented.")},dispatchEvent:()=>{throw new Error("Method not implemented.")},removeEventListener:()=>{throw new Error("Method not implemented.")}};return pi(e,t).then(async r=>{n.readyState=n.OPEN;try{for await(const s of r)n.onmessage&&n.onmessage(s);n.readyState=n.CLOSED}catch(s){n.onerror&&n.onerror(s),n.readyState=n.CLOSED}}).catch(r=>{console.error(r),n.onerror&&n.onerror(r),n.readyState=n.CLOSED}),n}function bi(e,t={},n,r,s,i){try{let o=function(S){(s||cs[S.type])&&f(S)},a=function(){for(jn=!0;ut.length>0;)ut.shift()({value:void 0,done:!0})},c=function(S){ut.length>0?ut.shift()(S):Xt.push(S)},_=function(S){c(Ei(S)),a()},f=function(S){c({value:S,done:!1})},l=function(){return Xt.length>0?Promise.resolve(Xt.shift()):jn?Promise.resolve({value:void 0,done:!0}):new Promise(S=>ut.push(S))};const{token:u}=this.options,{fetch:d,app_reference:v,config:p,session_hash:m,api_info:U,api_map:Ce,stream_status:Ge,pending_stream_messages:He,pending_diff_streams:Ne,event_callbacks:Jt,unclosed_events:os,post_data:Zt,options:Rt,api_prefix:me}=this,Pn=i||{"x-gradio-user":"api"},as=this;if(!U)throw new Error("No API found");if(!p)throw new Error("Could not resolve app config");let{fn_index:E,endpoint_info:Ln,dependency:lt}=Si(U,e,Ce,p),ls=zs(t,Ln),Ve,ge=p.protocol??"ws";if(ge==="ws")throw new Error("WebSocket protocol is not supported in this version");let Ye="",sa=()=>Ye;const k=typeof e=="number"?"/predict":e;let Ct,P=null,we=!1,In={},ct=typeof window<"u"&&typeof document<"u"?new URLSearchParams(window.location.search).toString():"";const cs=Rt?.events?.reduce((S,oe)=>(S[oe]=!0,S),{})||{};async function us(){let S={},oe={};S={event_id:P},oe={event_id:P,session_hash:m,fn_index:E};try{if(!p)throw new Error("Could not resolve app config");"event_id"in oe&&await d(`${p.root}${me}/${As}`,{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify(oe)}),await d(`${p.root}${me}/${Ts}`,{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify(S)})}catch{console.warn("The `/reset` endpoint could not be called. Subsequent endpoint results may be unreliable.")}}const fs=async S=>{await this._resolve_heartbeat(S)};
4async function Dn(S){if(!p)return;let oe=S.render_id;p.components=[...p.components.filter(I=>I.props.rendered_in!==oe),...S.components],p.dependencies=[...p.dependencies.filter(I=>I.rendered_in!==oe),...S.dependencies];const Nt=p.components.some(I=>I.type==="state"),O=p.dependencies.some(I=>I.targets.some(We=>We[1]==="unload"));p.connect_heartbeat=Nt||O,await fs(p),o({type:"render",data:S,endpoint:k,fn_index:E})}const ds=this.handle_blob(p.root,ls,Ln).then(async S=>{if(Ct={data:Lt(S,lt,p.components,"input",!0)||[],event_data:n,fn_index:E,trigger_id:r},Zs(E,p))o({type:"status",endpoint:k,stage:"pending",queue:!1,fn_index:E,time:new Date}),Zt(`${p.root}${me}/run${k.startsWith("/")?k:`/${k}`}${ct?"?"+ct:""}`,{...Ct,session_hash:m},Pn).then(async([O,I])=>{const We=O.data;if(I==200)o({type:"data",endpoint:k,fn_index:E,data:Lt(We,lt,p.components,"output",Rt.with_null_state),time:new Date,event_data:n,trigger_id:r}),O.render_config&&await Dn(O.render_config),o({type:"status",endpoint:k,fn_index:E,stage:"complete",eta:O.average_duration,queue:!1,time:new Date});else{const ae=O?.error===Se;o({type:"status",stage:"error",endpoint:k,fn_index:E,message:O.error,broken:ae,queue:!1,time:new Date})}}).catch(O=>{o({type:"status",stage:"error",message:O.message,endpoint:k,fn_index:E,queue:!1,time:new Date})});else if(ge=="sse"){o({type:"status",stage:"pending",queue:!0,endpoint:k,fn_index:E,time:new Date});var Nt=new URLSearchParams({fn_index:E.toString(),session_hash:m}).toString();let O=new URL(`${p.root}${me}/${lr}?${ct?ct+"&":""}${Nt}`);if(this.jwt&&O.searchParams.set("__sign",this.jwt),Ve=this.stream(O),!Ve)return Promise.reject(new Error("Cannot connect to SSE endpoint: "+O.toString()));Ve.onmessage=async function(I){const We=JSON.parse(I.data),{type:ae,status:ye,data:R}=Bn(We,In[E]);if(ae==="update"&&ye&&!we)o({type:"status",endpoint:k,fn_index:E,time:new Date,...ye}),ye.stage==="error"&&(Ve?.close(),a());else if(ae==="data"){let[Ke,Pe]=await Zt(`${p.root}${me}/queue/data`,{...Ct,session_hash:m,event_id:P});Pe!==200&&(o({type:"status",stage:"error",message:Se,queue:!0,endpoint:k,fn_index:E,time:new Date}),Ve?.close(),a())}else ae==="complete"?we=ye:ae==="log"?o({type:"log",title:R.title,log:R.log,level:R.level,endpoint:k,duration:R.duration,visible:R.visible,fn_index:E}):(ae==="generating"||ae==="streaming")&&o({type:"status",time:new Date,...ye,stage:ye?.stage,queue:!0,endpoint:k,fn_index:E});R&&(o({type:"data",time:new Date,data:Lt(R.data,lt,p.components,"output",Rt.with_null_state),endpoint:k,fn_index:E,event_data:n,trigger_id:r}),we&&(o({type:"status",time:new Date,...we,stage:ye?.stage,queue:!0,endpoint:k,fn_index:E}),Ve?.close(),a()))}}else if(ge=="sse_v1"||ge=="sse_v2"||ge=="sse_v2.1"||ge=="sse_v3"){o({type:"status",stage:"pending",queue:!0,endpoint:k,fn_index:E,time:new Date});let O="";typeof window<"u"&&typeof document<"u"&&(O=window?.location?.hostname);const I=vr(O);return(typeof window<"u"&&typeof document<"u"&&window.parent!=window&&!!I&&window.supports_zerogpu_headers?Xs("zerogpu-headers",I):Promise.resolve(null)).then(R=>{const Ke={...Pn,...R||{}};return Zt(`${p.root}${me}/${gs}?${ct}`,{...Ct,session_hash:m},Ke)}).then(async([R,Ke])=>{if(R.event_id&&(Ye=R.event_id),Ke===503)o({type:"status",stage:"error",message:cr,queue:!0,endpoint:k,fn_index:E,time:new Date,visible:!0});else if(Ke===422)o({type:"status",stage:"error",message:R.detail,queue:!0,endpoint:k,fn_index:E,code:"validation_error",time:new Date,visible:!0}),a();else if(Ke!==200){const Pe=R?.error===Se;o({type:"status",stage:"error",broken:Pe,message:Pe?Se:R.detail||R.error,queue:!0,endpoint:k,fn_index:E,time:new Date,visible:!0})}else{P=R.event_id,Ye=P;let Pe=async function(Qt){try{const{type:H,status:V,data:Y,original_msg:_s}=Bn(Qt,In[E]);if(H=="heartbeat")return;if(H==="update"&&V&&!we)o({type:"status",endpoint:k,fn_index:E,time:new Date,original_msg:_s,...V});else if(H==="complete")we=V;else if(H=="unexpected_error"||H=="broken_connection"){console.error("Unexpected error",V?.message);const hs=H==="broken_connection";o({type:"status",stage:"error",message:V?.message||"An Unexpected Error Occurred!",queue:!0,endpoint:k,broken:hs,session_not_found:V?.session_not_found,fn_index:E,time:new Date})}else if(H==="log"){o({type:"log",title:Y.title,log:Y.log,level:Y.level,endpoint:k,duration:Y.duration,visible:Y.visible,fn_index:E});return}else(H==="generating"||H==="streaming")&&(o({type:"status",time:new Date,...V,stage:V?.stage,queue:!0,endpoint:k,fn_index:E}),Y&<.connection!=="stream"&&["sse_v2","sse_v2.1","sse_v3"].includes(ge)&&mi(Ne,P,Y));Y&&(o({type:"data",time:new Date,data:Lt(Y.data,lt,p.components,"output",Rt.with_null_state),endpoint:k,fn_index:E}),Y.render_config&&await Dn(Y.render_config),we&&(o({type:"status",time:new Date,...we,stage:V?.stage,queue:!0,endpoint:k,fn_index:E}),a())),(V?.stage==="complete"||V?.stage==="error")&&(Jt[P]&&delete Jt[P],P in Ne&&delete Ne[P])}catch(H){console.error("Unexpected client exception",H),o({type:"status",stage:"error",message:"An Unexpected Error Occurred!",queue:!0,endpoint:k,fn_index:E,time:new Date}),["sse_v2","sse_v2.1","sse_v3"].includes(ge)&&(En(Ge,as.abort_controller),Ge.open=!1,a())}};P in He&&(He[P].forEach(Qt=>Pe(Qt)),delete He[P]),Jt[P]=Pe,os.add(P),Ge.open||await this.open_stream()}})}});let jn=!1;const Xt=[],ut=[],Mn={[Symbol.asyncIterator]:()=>Mn,next:l,throw:async S=>(_(S),l()),return:async()=>(a(),{value:void 0,done:!0}),cancel:us,send_chunk:S=>{this.post_data(`${p.root}${me}/stream/${Ye}`,{...S,session_hash:this.session_hash})},close_stream:()=>{this.post_data(`${p.root}${me}/stream/${Ye}/close`,{}),a()},event_id:()=>Ye,wait_for_id:async()=>(await ds,P)};return Mn}catch(o){throw console.error("Submit function encountered an error:",o),o}}function Ei(e){return{then:(t,n)=>n(e)}}function Si(e,t,n,r){let s,i,o;if(typeof t=="number")s=t,i=e.unnamed_endpoints[s],o=r.dependencies.find(a=>a.id==t);else{const a=t.replace(/^\//,"");s=n[a],i=e.named_endpoints[t.trim()],o=r.dependencies.find(c=>c.id==n[a])}if(typeof s!="number")throw new Error("There is no endpoint matching that name of fn_index matching that number.");return{fn_index:s,endpoint_info:i,dependency:o}}class Dt{app_reference;options;deep_link=null;config;api_prefix="";api_info;api_map={};session_hash=Math.random().toString(36).substring(2);jwt=!1;last_status={};cookies=null;stream_status={open:!1};closed=!1;pending_stream_messages={};pending_diff_streams={};event_callbacks={};unclosed_events=new Set;heartbeat_event=null;abort_controller=null;stream_instance=null;current_payload;get_url_config(t=null){if(!this.config)throw new Error(Ee);t===null&&(t=window.location.href);const n=o=>o.replace(/^\/+|\/+$/g,"");let r=n(new URL(this.config.root).pathname),s=n(new URL(t).pathname),i;return s.startsWith(r)?i=n(s.substring(r.length)):i="",this.get_page_config(i)}get_page_config(t){if(!this.config)throw new Error(Ee);let n=this.config;return t in n.page||(t=""),{...n,current_page:t,layout:n.page[t].layout,components:n.components.filter(r=>n.page[t].components.includes(r.id)),dependencies:this.config.dependencies.filter(r=>n.page[t].dependencies.includes(r.id))}}
4fetch(t,n){const r=new Headers(n?.headers||{});return this&&this.cookies&&r.append("Cookie",this.cookies),this&&this.options.headers&&new Headers(this.options.headers).forEach((i,o)=>{r.append(o,i)}),fetch(t,{...n,headers:r})}stream(t){const n=new Headers;return this&&this.cookies&&n.append("Cookie",this.cookies),this&&this.options.headers&&new Headers(this.options.headers).forEach((s,i)=>{n.append(i,s)}),this&&this.options.token&&n.append("Authorization",`Bearer ${this.options.token}`),this.abort_controller=new AbortController,this.stream_instance=yi(t.toString(),{credentials:"include",headers:n,signal:this.abort_controller.signal}),this.stream_instance}view_api;upload_files;upload;handle_blob;post_data;submit;predict;open_stream;resolve_config;resolve_cookies;constructor(t,n={events:["data"]}){this.app_reference=t,this.deep_link=n.query_params?.deep_link||null,n.events||(n.events=["data"]),this.options=n,this.current_payload={},n.cookies&&(this.cookies=n.cookies),this.view_api=Bs.bind(this),this.upload_files=Gs.bind(this),this.handle_blob=Qs.bind(this),this.post_data=ni.bind(this),this.submit=bi.bind(this),this.predict=ri.bind(this),this.open_stream=vi.bind(this),this.resolve_config=Ds.bind(this),this.resolve_cookies=js.bind(this),this.upload=Ks.bind(this),this.fetch=this.fetch.bind(this),this.handle_space_success=this.handle_space_success.bind(this),this.stream=this.stream.bind(this)}
4async init(){ui(),this.options.auth&&await this.resolve_cookies(),await this._resolve_config().then(({config:t})=>this._resolve_heartbeat(t)),this.api_info=await this.view_api(),this.api_map=Is(this.config?.dependencies||[])}async _resolve_heartbeat(t){if(t&&(this.config=t,this.api_prefix=t.api_prefix||"",this.config&&this.config.connect_heartbeat&&this.config.space_id&&this.options.token&&(this.jwt=await Fn(this.config.space_id,this.options.token,this.cookies))),t.space_id&&this.options.token&&(this.jwt=await Fn(t.space_id,this.options.token)),this.config&&this.config.connect_heartbeat){const n=new URL(`${this.config.root}${this.api_prefix}/${Ss}/${this.session_hash}`);this.jwt&&n.searchParams.set("__sign",this.jwt),this.heartbeat_event||(this.heartbeat_event=this.stream(n))}}static async connect(t,n={events:["data"]}){const r=new this(t,n);return n.session_hash&&(r.session_hash=n.session_hash),await r.init(),r}async reconnect(){const t=new URL(`${this.config.root}${this.api_prefix}/${xs}`);let n;try{const r=await this.fetch(t);if(!r.ok)throw new Error;n=(await r.json()).app_id}catch{return"broken"}return n!==this.config.app_id?"changed":"connected"}close(){this.closed=!0,En(this.stream_status,this.abort_controller)}set_current_payload(t){this.current_payload=t}static async duplicate(t,n={events:["data"]}){return ai(t,n)}async _resolve_config(){const{http_protocol:t,host:n,space_id:r}=await bn(this.app_reference,this.options.token),{status_callback:s}=this.options;r&&s&&await pr(r,s);let i;try{let o=`${t}//${n}`;if(i=await this.resolve_config(o),!i)throw new Error(Ee);return this.config_success(i)}catch(o){if(r&&s)ht(r,yn.test(r)?"space_name":"subdomain",this.handle_space_success);else throw s&&s({status:"error",message:"Could not load this space.",load_status:"error",detail:"NOT_FOUND"}),Error(o)}}async config_success(t){if(this.config=t,this.api_prefix=t.api_prefix||"",this.config.auth_required)return this.prepare_return_obj();try{this.api_info=await this.view_api()}catch(n){console.error(Os+n.message)}return this.prepare_return_obj()}async handle_space_success(t){if(!this)throw new Error(Ee);const{status_callback:n}=this.options;if(n&&n(t),t.status==="running")try{if(this.config=await this._resolve_config(),this.api_prefix=this?.config?.api_prefix||"",!this.config)throw new Error(Ee);return await this.config_success(this.config)}catch(r){throw n&&n({status:"error",message:"Could not load this space.",load_status:"error",detail:"NOT_FOUND"}),r}}async component_server(t,n,r){if(!this.config)throw new Error(Ee);const s={},{token:i}=this.options,{session_hash:o}=this;i&&(s.Authorization=`Bearer ${this.options.token}`);let a,c=this.config.components.find(f=>f.id===t);c?.props?.root_url?a=c.props.root_url:a=this.config.root;let _;if(typeof r=="object"&&r!==null&&"binary"in r){const f=r;_=new FormData;for(const l in f.data)l!=="binary"&&_.append(l,f.data[l]);_.set("component_id",t.toString()),_.set("fn_name",n),_.set("session_hash",o)}else _=JSON.stringify({data:r,component_id:t,fn_name:n,session_hash:o}),s["Content-Type"]="application/json";i&&(s.Authorization=`Bearer ${i}`);try{const f=await this.fetch(`${a}${this.api_prefix}/${ks}/`,{method:"POST",body:_,headers:s,credentials:"include"});if(!f.ok)throw new Error("Could not connect to component server: "+f.statusText);return await f.json()}catch(f){console.warn(f)}}set_cookies(t){this.cookies=_r(t).join("; ")}prepare_return_obj(){return{config:this.config,predict:this.predict,submit:this.submit,view_api:this.view_api,component_server:this.component_server}}}const ki="production",h=!ki.toLowerCase().startsWith("prod");var mr=Array.isArray,Ti=Array.prototype.indexOf,Ai=Array.from,xe=Object.defineProperty,Qe=Object.getOwnPropertyDescriptor,xi=Object.getOwnPropertyDescriptors,$i=Object.prototype,Oi=Array.prototype,gr=Object.getPrototypeOf,Zn=Object.isExtensible;function oa(e){return typeof e=="function"}const aa=()=>{};function la(e){return typeof e?.then=="function"}function ca(e){return e()}function Ri(e){for(var t=0;t<e.length;t++)e[t]()}function wr(){var e,t,n=new Promise((r,s)=>{e=r,t=s});return{promise:n,resolve:e,reject:t}}function ua(e,t){if(Array.isArray(e))return e;if(t===void 0||!(Symbol.iterator in e))return Array.from(e);const n=[];for(const r of e)if(n.push(r),n.length===t)break;return n}const $=2,gt=4,et=8,jt=1<<24,he=16,se=32,Be=64,Bt=128,B=512,N=1024,L=2048,ie=4096,ee=8192,ce=16384,Et=32768,wt=65536,Mt=1<<17,yr=1<<18,it=1<<19,br=1<<20,fa=1<<25,$e=32768,an=1<<21,Gt=1<<22,ke=1<<23,Te=Symbol("$state"),da=Symbol("legacy props"),_a=Symbol(""),Er=Symbol("proxy path"),De=new class extends
4Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},pa=1,Ht=3,St=8;function kt(e){if(h){const t=new Error(`lifecycle_outside_component 5\`${e}(...)\` can only be used during component initialisation 6https://svelte.dev/e/lifecycle_outside_component`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Ci(){if(h){const e=new Error("async_derived_orphan\nCannot create a `$derived(...)` with an `await` expression outside of an effect tree\nhttps://svelte.dev/e/async_derived_orphan");throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/async_derived_orphan")}function va(){if(h){const e=new Error("bind_invalid_checkbox_value\nUsing `bind:value` together with a checkbox input is not allowed. Use `bind:checked` instead\nhttps://svelte.dev/e/bind_invalid_checkbox_value");throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/bind_invalid_checkbox_value")}function Ni(){if(h){const e=new Error(`derived_references_self 7A derived value cannot reference itself recursively 8https://svelte.dev/e/derived_references_self`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/derived_references_self")}function Pi(e){if(h){const t=new Error(`effect_in_teardown 9\`${e}\` cannot be used inside an effect cleanup function 10https://svelte.dev/e/effect_in_teardown`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_in_teardown")}function Li(){if(h){const e=new Error("effect_in_unowned_derived\nEffect cannot be created inside a `$derived` value that was not itself created inside an effect\nhttps://svelte.dev/e/effect_in_unowned_derived");throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Ii(e){if(h){const t=new Error(`effect_orphan 11\`${e}\` can only be used inside an effect (e.g. during component initialisation) 12https://svelte.dev/e/effect_orphan`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_orphan")}function Di(){if(h){const e=new Error(`effect_update_depth_exceeded 13Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state 14https://svelte.dev/e/effect_update_depth_exceeded`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function ma(){if(h){const e=new Error("invalid_snippet\nCould not `{@render}` snippet due to the expression being `null` or `undefined`. Consider using optional chaining `{@render snippet?.()}`\nhttps://svelte.dev/e/invalid_snippet");throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/invalid_snippet")}function ji(e){if(h){const t=new Error(`lifecycle_legacy_only 15\`${e}(...)\` cannot be used in runes mode 16https://svelte.dev/e/lifecycle_legacy_only`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/lifecycle_legacy_only")}function ga(e){if(h){const t=new Error(`props_invalid_value 17Cannot do \`bind:${e}={undefined}\` when \`${e}\` has a fallback value 18https://svelte.dev/e/props_invalid_value`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/props_invalid_value")}function wa(e){if(h){const t=new Error(`props_rest_readonly 19Rest element properties of \`$props()\` such as \`${e}\` are readonly 20https://svelte.dev/e/props_rest_readonly`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/props_rest_readonly")}function Mi(e){if(h){const t=new Error(`rune_outside_svelte 21The \`${e}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files 22https://svelte.dev/e/rune_outside_svelte`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/rune_outside_svelte")}function Ui(){if(h){const e=new Error("set_context_after_init\n`setContext` must be called when a component first initializes, not in a subsequent effect or after an `await` expression\nhttps://svelte.dev/e/set_context_after_init");throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/set_context_after_init")}function qi(){if(h){const e=new Error("state_descriptors_fixed\nProperty descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.\nhttps://svelte.dev/e/state_descriptors_fixed");throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Fi(){if(h){const e=new Error("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/state_prototype_fixed")}function zi(){if(h){const e=new Error("state_unsafe_mutation\nUpdating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`\nhttps://svelte.dev/e/state_unsafe_mutation");throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function Bi(){if(h){const e=new Error("svelte_boundary_reset_onerror\nA `<svelte:boundary>` `reset` function cannot be called while an error is still being handled\nhttps://svelte.dev/e/svelte_boundary_reset_onerror");throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const ya=1,ba=2,Ea=4,Sa=8,ka=16,Ta=1,Aa=2,xa=4,$a=8,Oa=16,Ra=1,Ca=2,Na=4,Gi=1,Hi=2,Vi="[",Sr="[!",kr="]",Vt={},C=Symbol(),Yi=Symbol("filename"),Pa="http://www.w3.org/1999/xhtml",La="http://www.w3.org/2000/svg",Ia="@attach";var pe="font-weight: bold",ve="font-weight: normal";
22function Da(e,t,n){h?console.warn(`%c[svelte] hydration_attribute_changed 23%cThe \`${e}\` attribute on \`${t}\` changed its value between server and client renders. The client value, \`${n}\`, will be ignored in favour of the server value 24https://svelte.dev/e/hydration_attribute_changed`,pe,ve):console.warn("https://svelte.dev/e/hydration_attribute_changed")}function ja(e){h?console.warn(`%c[svelte] hydration_html_changed 25%c${e?`The value of an \`{@html ...}\` block ${e} changed between server and client renders. The client value will be ignored in favour of the server value`:"The value of an `{@html ...}` block changed between server and client renders. The client value will be ignored in favour of the server value"} 26https://svelte.dev/e/hydration_html_changed`,pe,ve):console.warn("https://svelte.dev/e/hydration_html_changed")}function Yt(e){h?console.warn(`%c[svelte] hydration_mismatch 27%cHydration failed because the initial UI does not match what was rendered on the server 28https://svelte.dev/e/hydration_mismatch`,pe,ve):console.warn("https://svelte.dev/e/hydration_mismatch")}function Wi(){h?console.warn(`%c[svelte] lifecycle_double_unmount 29%cTried to unmount a component that was not mounted 30https://svelte.dev/e/lifecycle_double_unmount`,pe,ve):console.warn("https://svelte.dev/e/lifecycle_double_unmount")}function Ma(){h?console.warn("%c[svelte] select_multiple_invalid_value\n%cThe `value` property of a `<select multiple>` element should be an array, but it received a non-array value. The selection will be kept as is.\nhttps://svelte.dev/e/select_multiple_invalid_value",pe,ve):console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function tn(e){h?console.warn(`%c[svelte] state_proxy_equality_mismatch 31%cReactive \`$state(...)\` proxies and the values they proxy have different identities. Because of this, comparisons with \`${e}\` will produce unexpected results 32https://svelte.dev/e/state_proxy_equality_mismatch`,pe,ve):console.warn("https://svelte.dev/e/state_proxy_equality_mismatch")}function Ki(){h?console.warn(`%c[svelte] state_proxy_unmount 33%cTried to unmount a state proxy, rather than a component 34https://svelte.dev/e/state_proxy_unmount`,pe,ve):console.warn("https://svelte.dev/e/state_proxy_unmount")}function Ji(){h?console.warn("%c[svelte] svelte_boundary_reset_noop\n%cA `<svelte:boundary>` `reset` function only resets the boundary the first time it is called\nhttps://svelte.dev/e/svelte_boundary_reset_noop",pe,ve):console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function Ua(e){h?console.warn(`%c[svelte] transition_slide_display 35%cThe \`slide\` transition does not work correctly for elements with \`display: ${e}\` 36https://svelte.dev/e/transition_slide_display`,pe,ve):console.warn("https://svelte.dev/e/transition_slide_display")}let A=!1;function qa(e){A=e}let b;function fe(e){if(e===null)throw Yt(),Vt;return b=e}function Sn(){return fe(Re(b))}function Fa(e){if(A){if(Re(b)!==null)throw Yt(),Vt;b=e}}function Zi(e=1){if(A){for(var t=e,n=b;t--;)n=Re(n);b=n}}function Xi(e=!0){for(var t=0,n=b;;){if(n.nodeType===St){var r=n.data;if(r===kr){if(t===0)return n;t-=1}else(r===Vi||r===Sr)&&(t+=1)}var s=Re(n);e&&n.remove(),n=s}}function za(e){if(!e||e.nodeType!==St)throw Yt(),Vt;return e.data}function Tr(e){return e===this.v}function Qi(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function Ar(e){return!Qi(e,this.v)}let te=!1,Tt=!1,eo=!1;function Ba(){te=!0}function Ga(){Tt=!0}function J(e,t){return e.label=t,xr(e.v,t),e}function xr(e,t){return e?.[Er]?.(t),e}function to(e){const t=new Error,n=no();return n.length===0?null:(n.unshift(` 37`),xe(t,"stack",{value:n.join(` 38`)}),xe(t,"name",{value:e}),t)}function no(){const e=Error.stackTraceLimit;Error.stackTraceLimit=1/0;const t=new Error().stack;if(Error.stackTraceLimit=e,!t)return[];const n=t.split(` 39`),r=[];for(let s=0;s<n.length;s++){const i=n[s],o=i.replaceAll("\\","/");if(i.trim()!=="Error"){if(i.includes("validate_each_keys"))return[];o.includes("svelte/src/internal")||o.includes("node_modules/.vite")||r.push(i)}}return r}let y=null;function tt(e){y=e}let nt=null;function Ut(e){nt=e}let At=null;function Xn(e){At=e}function Ha(e){return $r("getContext").get(e)}function Va(e,t){const n=$r("setContext");if(te){var r=g.f,s=!w&&(r&se)!==0&&!y.i;s||Ui()}return n.set(e,t),t}function ro(e,t=!1,n){y={p:y,i:!1,c:null,e:null,s:e,x:null,l:Tt&&!t?{s:null,u:null,$:[]}:null},h&&(y.function=n,At=n)}function so(e){var t=y,n=t.e;if(n!==null){t.e=null;for(var r of n)Gr(r)}return e!==void 0&&(t.x=e),t.i=!0,y=t.p,h&&(At=y?.function??null),e??{}}
39function xt(){return!Tt||y!==null&&y.l===null}function $r(e){return y===null&&kt(e),y.c??=new Map(io(y)||void 0)}function io(e){let t=e.p;for(;t!==null;){const n=t.c;if(n!==null)return n;t=t.p}return null}let je=[];function Or(){var e=je;je=[],Ri(e)}function $t(e){if(je.length===0&&!pt){var t=je;queueMicrotask(()=>{t===je&&Or()})}je.push(e)}function oo(){for(;je.length>0;)Or()}const ln=new WeakMap;function Rr(e){var t=g;if(t===null)return w.f|=ke,e;if(h&&e instanceof Error&&!ln.has(e)&&ln.set(e,ao(e,t)),(t.f&Et)===0){if((t.f&Bt)===0)throw h&&!t.parent&&e instanceof Error&&Cr(e),e;t.b.error(e)}else Fe(e,t)}function Fe(e,t){for(;t!==null;){if((t.f&Bt)!==0)try{t.b.error(e);return}catch(n){e=n}t=t.parent}throw h&&e instanceof Error&&Cr(e),e}function ao(e,t){const n=Qe(e,"message");if(!(n&&!n.configurable)){for(var r=On?" ":" ",s=` 40${r}in ${t.fn?.name||"<unknown>"}`,i=t.ctx;i!==null;)s+=` 41${r}in ${i.function?.[Yi].split("/").pop()}`,i=i.p;return{message:e.message+` 42${s} 43`,stack:e.stack?.split(` 44`).filter(o=>!o.includes("svelte/src/internal")).join(` 45`)}}}function Cr(e){const t=ln.get(e);t&&(xe(e,"message",{value:t.message}),xe(e,"stack",{value:t.stack}))}const lo=-7169;function x(e,t){e.f=e.f&lo|t}function kn(e){(e.f&B)!==0||e.deps===null?x(e,N):x(e,ie)}function Nr(e){if(e!==null)for(const t of e)(t.f&$)===0||(t.f&$e)===0||(t.f^=$e,Nr(t.deps))}function Pr(e,t,n){(e.f&L)!==0?t.add(e):(e.f&ie)!==0&&n.add(e),Nr(e.deps),x(e,N)}const Je=new Set;let T=null,nn=null,D=null,z=[],Wt=null,cn=!1,pt=!1;class X{committed=!1;current=new Map;previous=new Map;#e=new Set;#c=new Set;#r=0;#o=0;#s=null;#n=new Set;#t=new Set;skipped_effects=new Set;is_fork=!1;is_deferred(){return this.is_fork||this.#o>0}process(t){z=[],nn=null,this.apply();var n=[],r=[];for(const s of t)this.#i(s,n,r);this.is_fork||this.#l(),this.is_deferred()?(this.#a(r),this.#a(n)):(nn=this,T=null,Qn(r),Qn(n),nn=null,this.#s?.resolve()),D=null}#i(t,n,r){t.f^=N;for(var s=t.first,i=null;s!==null;){var o=s.f,a=(o&(se|Be))!==0,c=a&&(o&N)!==0,_=c||(o&ee)!==0||this.skipped_effects.has(s);if(te&&i===null&&(o&Bt)!==0&&s.b?.is_pending&&(i=s),!_&&s.fn!==null){a?s.f^=N:i!==null&&(o&(gt|et|jt))!==0?i.b.defer_effect(s):(o>)!==0?n.push(s):te&&(o&(et|jt))!==0?r.push(s):ot(s)&&((o&he)!==0&&this.#n.add(s),st(s));var f=s.first;if(f!==null){s=f;continue}}var l=s.parent;for(s=s.next;s===null&&l!==null;)l===i&&(i=null),s=l.next,l=l.parent}}#a(t){for(var n=0;n<t.length;n+=1)Pr(t[n],this.#n,this.#t)}capture(t,n){n!==C&&!this.previous.has(t)&&this.previous.set(t,n),(t.f&ke)===0&&(this.current.set(t,t.v),D?.set(t,t.v))}activate(){T=this,this.apply()}deactivate(){T===this&&(T=null,D=null)}flush(){if(this.activate(),z.length>0){if(Lr(),T!==null&&T!==this)return}else this.#r===0&&this.process([]);this.deactivate()}discard(){for(const t of this.#c)t(this);this.#c.clear()}#l(){if(this.#o===0){for(const t of this.#e)t();this.#e.clear()}this.#r===0&&this.#u()}#u(){if(Je.size>1){this.previous.clear();var t=D,n=!0;for(const s of Je){if(s===this){n=!1;continue}const i=[];for(const[a,c]of this.current){if(s.current.has(a))if(n&&c!==s.current.get(a))s.current.set(a,c);else continue;i.push(a)}if(i.length===0)continue;const o=[...s.current.keys()].filter(a=>!this.current.has(a));if(o.length>0){var r=z;z=[];const a=new Set,c=new Map;for(const _ of i)Ir(_,o,a,c);if(z.length>0){T=s,s.apply();for(const _ of z)s.#i(_,[],[]);s.deactivate()}z=r}}T=null,D=t}this.committed=!0,Je.delete(this)}increment(t){this.#r+=1,t&&(this.#o+=1)}decrement(t){this.#r-=1,t&&(this.#o-=1),this.revive()}revive(){for(const t of this.#n)this.#t.delete(t),x(t,L),de(t);for(const t of this.#t)x(t,ie),de(t);this.flush()}oncommit(t){this.#e.add(t)}ondiscard(t){this.#c.add(t)}settled(){return(this.#s??=wr()).promise}static ensure(){if(T===null){const t=T=new X;Je.add(T),pt||X.enqueue(()=>{T===t&&t.flush()})}return T}static enqueue(t){$t(t)}apply(){if(!(!te||!this.is_fork&&Je.size===1)){D=new Map(this.current);for(const t of Je)if(t!==this)for(const[n,r]of t.previous)D.has(n)||D.set(n,r)}}}function co(e){var t=pt;pt=!0;try{for(var n;;){if(oo(),z.length===0&&(T?.flush(),z.length===0))return Wt=null,n;Lr()}}finally{pt=t}}function Lr(){var e=Ue;cn=!0;var t=h?new Set:null;try{var n=0;for(qt(!0);z.length>0;){var r=X.ensure();if(n++>1e3){if(h){var s=new Map;for(const o of r.current.keys())for(const[a,c]of o.updated??[]){var i=s.get(a);i||(i={error:c.error,count:0},s.set(a,i)),i.count+=c.count}for(const o of s.values())o.error&&console.error(o.error)}uo()}if(r.process(z),Ae.clear(),h)for(const o of r.current.keys())t.add(o)}}finally{if(cn=!1,qt(e),Wt=null,h)for(const o of t)o.updated=null}}function uo(){try{Di()}catch(e){h&&xe(e,"stack",{value:""}),Fe(e,Wt)}}let Z=null;function Qn(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var r=e[n++];if((r.f&(ce|ee))===0&&ot(r)&&(Z=new Set,st(r),r.deps===null&&r.first===null&&r.nodes===null&&(r.teardown===null&&r.ac===null?Yr(r):r.fn=null),Z?.size>0)){Ae.clear();for(const s of Z){if((s.f&(ce|ee))!==0)continue;const i=[s];let o=s.parent;for(;o!==null;)Z.has(o)&&(Z.delete(o),i.push(o)),o=o.parent;for(let a=i.length-1;a>=0;a--){const c=i[a];(c.f&(ce|ee))===0&&st(c)}}Z.clear()}}Z=null}}function Ir(e,t,n,r){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(const s of e.reactions){const i=s.f;(i&$)!==0?Ir(s,t,n,r):(i&(Gt|he))!==0&&(i&L)===0&&Dr(s,t,r)&&(x(s,L),de(s))}}function Dr(e,t,n){const r=n.get(e);if(r!==void 0)return r;if(e.deps!==null)for(const s of e.deps){if(t.includes(s))return!0;
45if((s.f&$)!==0&&Dr(s,t,n))return n.set(s,!0),!0}return n.set(e,!1),!1}function de(e){for(var t=Wt=e;t.parent!==null;){t=t.parent;var n=t.f;if(cn&&t===g&&(n&he)!==0&&(n&yr)===0)return;if((n&(Be|se))!==0){if((n&N)===0)return;t.f^=N}}z.push(t)}function fo(e){let t=0,n=Ot(0),r;return h&&J(n,"createSubscriber version"),()=>{Rn()&&(Q(n),Nn(()=>(t===0&&(r=at(()=>e(()=>vt(n)))),t+=1,()=>{$t(()=>{t-=1,t===0&&(r?.(),r=void 0,vt(n))})})))}}var _o=wt|it|Bt;function ho(e,t,n){new po(e,t,n)}class po{parent;is_pending=!1;#e;#c=A?b:null;#r;#o;#s;#n=null;#t=null;#i=null;#a=null;#l=null;#u=0;#f=0;#_=!1;#h=new Set;#p=new Set;#d=null;#y=fo(()=>(this.#d=Ot(this.#u),h&&J(this.#d,"$effect.pending()"),()=>{this.#d=null}));constructor(t,n,r){this.#e=t,this.#r=n,this.#o=r,this.parent=g.b,this.is_pending=!!this.#r.pending,this.#s=Lo(()=>{if(g.b=this,A){const i=this.#c;Sn(),i.nodeType===St&&i.data===Sr?this.#E():(this.#b(),this.#f===0&&(this.is_pending=!1))}else{var s=this.#g();try{this.#n=Ie(()=>r(s))}catch(i){this.error(i)}this.#f>0?this.#m():this.is_pending=!1}return()=>{this.#l?.remove()}},_o),A&&(this.#e=b)}#b(){try{this.#n=Ie(()=>this.#o(this.#e))}catch(t){this.error(t)}}#E(){const t=this.#r.pending;t&&(this.#t=Ie(()=>t(this.#e)),X.enqueue(()=>{var n=this.#g();this.#n=this.#v(()=>(X.ensure(),Ie(()=>this.#o(n)))),this.#f>0?this.#m():(It(this.#t,()=>{this.#t=null}),this.is_pending=!1)}))}#g(){var t=this.#e;return this.is_pending&&(this.#l=_e(),this.#e.before(this.#l),t=this.#l),t}defer_effect(t){Pr(t,this.#h,this.#p)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#r.pending}#v(t){var n=g,r=w,s=y;K(this.#s),M(this.#s),tt(this.#s.ctx);try{return t()}catch(i){return Rr(i),null}finally{K(n),M(r),tt(s)}}#m(){const t=this.#r.pending;this.#n!==null&&(this.#a=document.createDocumentFragment(),this.#a.append(this.#l),jo(this.#n,this.#a)),this.#t===null&&(this.#t=Ie(()=>t(this.#e)))}#w(t){if(!this.has_pending_snippet()){this.parent&&this.parent.#w(t);return}if(this.#f+=t,this.#f===0){this.is_pending=!1;for(const n of this.#h)x(n,L),de(n);for(const n of this.#p)x(n,ie),de(n);this.#h.clear(),this.#p.clear(),this.#t&&It(this.#t,()=>{this.#t=null}),this.#a&&(this.#e.before(this.#a),this.#a=null)}}update_pending_count(t){this.#w(t),this.#u+=t,this.#d&&bt(this.#d,this.#u)}get_effect_pending(){return this.#y(),Q(this.#d)}error(t){var n=this.#r.onerror;let r=this.#r.failed;if(this.#_||!n&&!r)throw t;this.#n&&(ne(this.#n),this.#n=null),this.#t&&(ne(this.#t),this.#t=null),this.#i&&(ne(this.#i),this.#i=null),A&&(fe(this.#c),Zi(),fe(Xi()));var s=!1,i=!1;const o=()=>{if(s){Ji();return}s=!0,i&&Bi(),X.ensure(),this.#u=0,this.#i!==null&&It(this.#i,()=>{this.#i=null}),this.is_pending=this.has_pending_snippet(),this.#n=this.#v(()=>(this.#_=!1,Ie(()=>this.#o(this.#e)))),this.#f>0?this.#m():this.is_pending=!1};var a=w;try{M(null),i=!0,n?.(t,o),i=!1}catch(c){Fe(c,this.#s&&this.#s.parent)}finally{M(a)}r&&$t(()=>{this.#i=this.#v(()=>{X.ensure(),this.#_=!0;try{return Ie(()=>{r(this.#e,()=>t,()=>o)})}catch(c){return Fe(c,this.#s.parent),null}finally{this.#_=!1}})})}}function vo(){return g.b}function Tn(e,t,n,r){const s=xt()?An:wo;if(n.length===0&&e.length===0){r(t.map(s));return}var i=T,o=g,a=jr();function c(){Promise.all(n.map(_=>go(_))).then(_=>{a();try{r([...t.map(s),..._])}catch(f){(o.f&ce)===0&&Fe(f,o)}i?.deactivate(),yt()}).catch(_=>{Fe(_,o)})}e.length>0?Promise.all(e).then(()=>{a();try{return c()}finally{i?.deactivate(),yt()}}):c()}function Ya(e,t){Tn(e,[],[],t)}function jr(){var e=g,t=w,n=y,r=T;if(h)var s=nt;return function(o=!0){K(e),M(t),tt(n),o&&r?.activate(),h&&Ut(s)}}function yt(){K(null),M(null),tt(null),h&&Ut(null)}function Wa(e){const t=jr();var n=vo(),r=T,s=n.is_rendered();n.update_pending_count(1),r.increment(s);var i=g,o=null;const a=f=>{o={error:f},rr(i)||Fe(f,i)};var c=Promise.resolve(e[0]()).catch(a),_=[c];for(const f of e.slice(1))c=c.then(()=>{if(o)throw o.error;if(rr(i))throw De;return t(),f()}).catch(a).finally(()=>{yt(),T?.deactivate()}),_.push(c);return c.then(()=>Promise.resolve()).finally(()=>
45{n.update_pending_count(-1),r.decrement(s)}),_}const mo=new Set;function An(e){var t=$|L,n=w!==null&&(w.f&$)!==0?w:null;return g!==null&&(g.f|=it),{ctx:y,deps:null,effects:null,equals:Tr,f:t,fn:e,reactions:null,rv:0,v:C,wv:0,parent:n??g,ac:null}}function go(e,t,n){let r=g;r===null&&Ci();var s=r.b,i=void 0,o=Ot(C);h&&(o.label=t);var a=!w,c=new Map;return Po(()=>{var _=wr();i=_.promise;try{Promise.resolve(e()).then(_.resolve,_.reject).then(()=>{f===T&&f.committed&&f.deactivate(),yt()})}catch(d){_.reject(d),yt()}var f=T;if(a){var l=s.is_rendered();s.update_pending_count(1),f.increment(l),c.get(f)?.reject(De),c.delete(f),c.set(f,_)}const u=(d,v=void 0)=>{if(f.activate(),v)v!==De&&(o.f|=ke,bt(o,v));else{(o.f&ke)!==0&&(o.f^=ke),bt(o,d);for(const[p,m]of c){if(c.delete(p),p===f)break;m.reject(De)}}a&&(s.update_pending_count(-1),f.decrement(l))};_.promise.then(u,d=>u(null,d||"unknown"))}),Cn(()=>{for(const _ of c.values())_.reject(De)}),h&&(o.f|=Gt),new Promise(_=>{function f(l){function u(){l===i?_(o):f(i)}l.then(u,u)}f(i)})}function Ka(e){const t=An(e);return te||Jr(t),t}function wo(e){const t=An(e);return t.equals=Ar,t}function un(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)ne(t[n])}}let rn=[];function yo(e){for(var t=e.parent;t!==null;){if((t.f&$)===0)return(t.f&ce)===0?t:null;t=t.parent}return null}function xn(e){var t,n=g;if(K(yo(e)),h){let r=rt;er(new Set);try{rn.includes(e)&&Ni(),rn.push(e),e.f&=~$e,un(e),t=fn(e)}finally{K(n),er(r),rn.pop()}}else try{e.f&=~$e,un(e),t=fn(e)}finally{K(n)}return t}function Mr(e){var t=xn(e);if(!e.equals(t)&&(e.wv=Xr(),(!T?.is_fork||e.deps===null)&&(e.v=t,e.deps===null))){x(e,N);return}ze||(D!==null?(Rn()||T?.is_fork)&&D.set(e,t):kn(e))}let rt=new Set;const Ae=new Map;function er(e){rt=e}let $n=!1;function bo(){$n=!0}function Ot(e,t){var n={f:0,v:e,reactions:null,equals:Tr,rv:0,wv:0};return n}function be(e,t){const n=Ot(e);return Jr(n),n}function Ja(e,t=!1,n=!0){const r=Ot(e);return t||(r.equals=Ar),Tt&&n&&y!==null&&y.l!==null&&(y.l.s??=[]).push(r),r}function Za(e,t){return le(e,at(()=>Q(e))),t}function le(e,t,n=!1){w!==null&&(!W||(w.f&Mt)!==0)&&xt()&&(w.f&($|he|Gt|Mt))!==0&&!ue?.includes(e)&&zi();let r=n?ft(t):t;return h&&xr(r,e.label),bt(e,r)}function bt(e,t){if(!e.equals(t)){var n=e.v;ze?Ae.set(e,t):Ae.set(e,n),e.v=t;var r=X.ensure();if(r.capture(e,n),h){if(g!==null){e.updated??=new Map;const s=(e.updated.get("")?.count??0)+1;if(e.updated.set("",{error:null,count:s}),s>5){const i=to("updated at");if(i!==null){let o=e.updated.get(i.stack);o||(o={error:i,count:0},e.updated.set(i.stack,o)),o.count++}}}g!==null&&(e.set_during_effect=!0)}if((e.f&$)!==0){const s=e;(e.f&L)!==0&&xn(s),kn(s)}e.wv=Xr(),qr(e,L),xt()&&g!==null&&(g.f&N)!==0&&(g.f&(se|Be))===0&&(F===null?Uo([e]):F.push(e)),!r.is_fork&&rt.size>0&&!$n&&Ur()}return t}function Ur(){$n=!1;var e=Ue;qt(!0);const t=Array.from(rt);try{for(const n of t)(n.f&N)!==0&&x(n,ie),ot(n)&&st(n)}finally{qt(e)}rt.clear()}function Xa(e,t=1){var n=Q(e),r=t===1?n++:n--;return le(e,n),r}function vt(e){le(e,e.v+1)}function qr(e,t){var n=e.reactions;if(n!==null)for(var r=xt(),s=n.length,i=0;i<s;i++){var o=n[i],a=o.f;if(!(!r&&o===g)){if(h&&(a&Mt)!==0){rt.add(o);continue}var c=(a&L)===0;if(c&&x(o,t),(a&$)!==0){var _=o;D?.delete(_),(a&$e)===0&&(a&B&&(o.f|=$e),qr(_,ie))}else c&&((a&he)!==0&&Z!==null&&Z.add(o),de(o))}}}const Eo=/^[a-zA-Z_$][a-zA-Z_$0-9]*$/;function ft(e){if(typeof e!="object"||e===null||Te in e)return e;const t=gr(e);if(t!==$i&&t!==Oi)return e;var n=new Map,r=mr(e),s=be(0),i=qe,o=f=>{if(qe===i)return f();var l=w,u=qe;M(null),ir(i);var d=f();return M(l),ir(u),d};r&&(n.set("length",be(e.length)),h&&(e=ko(e)));var a="";let c=!1;function _(f){if(!c){c=!0,a=f,J(s,`${a} version`);for(const[l,u]of n)J(u,Le(a,l));c=!1}}return new Proxy(e,{defineProperty(f,l,u){(!("value"in u)||u.configurable===!1||u.enumerable===!1||u.writable===!1)&&qi();var d=n.get(l);return d===void 0?d=o(()=>{var v=be(u.value);return n.set(l,v),h&&typeof l=="string"&&J(v,Le(a,l)),v}):le(d,u.value,!0),!0},deleteProperty(f,l){var u=n.get(l);if(u===void 0){if(l in f){const d=o(()=>be(C));n.set(l,d),vt(s),h&&J(d,Le(a,l))}}else le(u,C),vt(s);return!0},get(f,l,u){if(l===Te)return e;if(h&&l===Er)return _;var d=n.get(l),v=l in f;if(d===void 0&&(!v||Qe(f,l)?.writable)&&(d=o(()=>{var m=ft(v?f[l]:C),U=be(m);return h&&J(U,Le(a,l)),U}),n.set(l,d)),d!==void 0){var p=Q(d);return p===C?void 0:p}return Reflect.get(f,l,u)},getOwnPropertyDescriptor(f,l){var u=Reflect.getOwnPropertyDescriptor(f,l);if(u&&"value"in u){var d=n.get(l);d&&(u.value=Q(d))}else if(u===void 0){var v=n.get(l),p=v?.v;if(v!==void 0&&p!==C)return{enumerable:!0,configurable:!0,value:p,writable:!0}}return u},has(f,l){if(l===Te)return!0;var u=n.get(l),d=u!==void 0&&u.v!==C||Reflect.has(f,l);if(u!==void 0||g!==null&&(!d||Qe(f,l)?.writable)){u===void 0&&(u=o(()=>{var p=d?ft(f[l]):C,m=be(p);return h&&J(m,Le(a,l)),m}),n.set(l,u));var v=Q(u);if(v===C)return!1}return d},set(f,l,u,d){var v=n.get(l),p=l in f;if(r&&l==="length")for(var m=u;m<v.v;m+=1){var U=n.get(m+"");
45U!==void 0?le(U,C):m in f&&(U=o(()=>be(C)),n.set(m+"",U),h&&J(U,Le(a,m)))}if(v===void 0)(!p||Qe(f,l)?.writable)&&(v=o(()=>be(void 0)),h&&J(v,Le(a,l)),le(v,ft(u)),n.set(l,v));else{p=v.v!==C;var Ce=o(()=>ft(u));le(v,Ce)}var Ge=Reflect.getOwnPropertyDescriptor(f,l);if(Ge?.set&&Ge.set.call(d,u),!p){if(r&&typeof l=="string"){var He=n.get("length"),Ne=Number(l);Number.isInteger(Ne)&&Ne>=He.v&&le(He,Ne+1)}vt(s)}return!0},ownKeys(f){Q(s);var l=Reflect.ownKeys(f).filter(v=>{var p=n.get(v);return p===void 0||p.v!==C});for(var[u,d]of n)d.v!==C&&!(u in f)&&l.push(u);return l},setPrototypeOf(){Fi()}})}function Le(e,t){return typeof t=="symbol"?`${e}[Symbol(${t.description??""})]`:Eo.test(t)?`${e}.${t}`:/^\d+$/.test(t)?`${e}[${t}]`:`${e}['${t}']`}function mt(e){try{if(e!==null&&typeof e=="object"&&Te in e)return e[Te]}catch{}return e}function Qa(e,t){return Object.is(mt(e),mt(t))}const So=new Set(["copyWithin","fill","pop","push","reverse","shift","sort","splice","unshift"]);function ko(e){return new Proxy(e,{get(t,n,r){var s=Reflect.get(t,n,r);return So.has(n)?function(...i){bo();var o=s.apply(this,i);return Ur(),o}:s}})}function To(){const e=Array.prototype,t=Array.__svelte_cleanup;t&&t();const{indexOf:n,lastIndexOf:r,includes:s}=e;e.indexOf=function(i,o){const a=n.call(this,i,o);if(a===-1){for(let c=o??0;c<this.length;c+=1)if(mt(this[c])===i){tn("array.indexOf(...)");break}}return a},e.lastIndexOf=function(i,o){const a=r.call(this,i,o??this.length-1);if(a===-1){for(let c=0;c<=(o??this.length-1);c+=1)if(mt(this[c])===i){tn("array.lastIndexOf(...)");break}}return a},e.includes=function(i,o){const a=s.call(this,i,o);if(!a){for(let c=0;c<this.length;c+=1)if(mt(this[c])===i){tn("array.includes(...)");break}}return a},Array.__svelte_cleanup=()=>{e.indexOf=n,e.lastIndexOf=r,e.includes=s}}var tr,Ao,On,Fr,zr;function xo(){if(tr===void 0){tr=window,Ao=document,On=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;Fr=Qe(t,"firstChild").get,zr=Qe(t,"nextSibling").get,Zn(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),Zn(n)&&(n.__t=void 0),h&&(e.__svelte_meta=null,To())}}function _e(e=""){return document.createTextNode(e)}function Oe(e){return Fr.call(e)}function Re(e){return zr.call(e)}function el(e,t){if(!A)return Oe(e);var n=Oe(b);if(n===null)n=b.appendChild(_e());else if(t&&n.nodeType!==Ht){var r=_e();return n?.before(r),fe(r),r}return fe(n),n}function tl(e,t=!1){if(!A){var n=Oe(e);return n instanceof Comment&&n.data===""?Re(n):n}if(t&&b?.nodeType!==Ht){var r=_e();return b?.before(r),fe(r),r}return b}function nl(e,t=1,n=!1){let r=A?b:e;for(var s;t--;)s=r,r=Re(r);if(!A)return r;if(n&&r?.nodeType!==Ht){var i=_e();return r===null?s?.after(i):r.before(i),fe(i),i}return fe(r),r}function $o(e){e.textContent=""}function rl(){if(!te||Z!==null)return!1;var e=g.f;return(e&Et)!==0}function sl(e,t){if(t){const n=document.body;e.autofocus=!0,$t(()=>{document.activeElement===n&&e.focus()})}}function il(e){A&&Oe(e)!==null&&$o(e)}let nr=!1;function Oo(){nr||(nr=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(const t of e.target.elements)t.__on_r?.()})},{capture:!0}))}function ol(e,t,n,r=!0){r&&n();for(var s of t)e.addEventListener(s,n);Cn(()=>{for(var i of t)e.removeEventListener(i,n)})}function Kt(e){var t=w,n=g;M(null),K(null);try{return e()}finally{M(t),K(n)}}function al(e,t,n,r=n){e.addEventListener(t,()=>Kt(n));const s=e.__on_r;s?e.__on_r=()=>{s(),r(!0)}:e.__on_r=()=>r(!0),Oo()}function Br(e){g===null&&(w===null&&Ii(e),Li()),ze&&Pi(e)}function Ro(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function G(e,t,n){var r=g;if(h)for(;r!==null&&(r.f&Mt)!==0;)r=r.parent;r!==null&&(r.f&ee)!==0&&(e|=ee);var s={ctx:y,deps:null,nodes:null,f:e|L|B,first:null,fn:t,last:null,next:null,parent:r,b:r&&r.b,prev:null,teardown:null,wv:0,ac:null};if(h&&(s.component_function=At),n)try{st(s),s.f|=Et}catch(a){throw ne(s),a}else t!==null&&de(s);var i=s;if(n&&i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&(i.f&it)===0&&(i=i.first,(e&he)!==0&&(e&wt)!==0&&i!==null&&(i.f|=wt)),i!==null&&(i.parent=r,r!==null&&Ro(i,r),w!==null&&(w.f&$)!==0&&(e&Be)===0)){var o=w;(o.effects??=[]).push(i)}return s}function Rn(){return w!==null&&!W}function Cn(e){const t=G(et,null,!1);return x(t,N),t.teardown=e,t}function Co(e){Br("$effect"),h&&xe(e,"name",{value:"$effect"});var t=g.f,n=!w&&(t&se)!==0&&(t&Et)===0;if(n){var r=y;(r.e??=[]).push(e)}else return Gr(e)}function Gr(e){return G(gt|br,e,!1)}function ll(e){return Br("$effect.pre"),h&&xe(e,"name",{value:"$effect.pre"}),G(et|br,e,!0)}function No(e){X.ensure();const t=G(Be|it,e,!0);return(n={})=>new Promise(r=>{n.outro?It(t,()=>{ne(t),r(void 0)}):(ne(t),r(void 0))})}function cl(e){return G(gt,e,!1)}function ul(e,t){var n=y,r={effect:null,ran:!1,deps:e};n.l.$.push(r),r.effect=Nn(()=>{e(),!r.ran&&(r.ran=!0,at(t))})}function fl(){var e=y;Nn(()=>{for(var t of e.l.$){t.deps();var n=t.effect;(n.f&N)!==0&&n.deps!==null&&x(n,ie),ot(n)&&st(n),t.ran=!1}})}function Po(e){return G(Gt|it,e,!0)}function Nn(e,t=0){return G(et|t,e,!0)}function dl(e,t=[],n=[],r=[]){Tn(r,t,n,s=>{G(et,()=>e(...s.map(Q)),!0)})}function _l(e,t=[],n=[],r=[]){var s=T,i=n.length>0||r.length>0;i&&s.increment(!0),Tn(r,t,n,o=>{G(gt,()=>
45e(...o.map(Q)),!1),i&&s.decrement(!0)})}function Lo(e,t=0){var n=G(he|t,e,!0);return h&&(n.dev_stack=nt),n}function hl(e,t=0){var n=G(jt|t,e,!0);return h&&(n.dev_stack=nt),n}function Ie(e){return G(se|it,e,!0)}function Hr(e){var t=e.teardown;if(t!==null){const n=ze,r=w;sr(!0),M(null);try{t.call(null)}finally{sr(n),M(r)}}}function Vr(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){const s=n.ac;s!==null&&Kt(()=>{s.abort(De)});var r=n.next;(n.f&Be)!==0?n.parent=null:ne(n,t),n=r}}function Io(e){for(var t=e.first;t!==null;){var n=t.next;(t.f&se)===0&&ne(t),t=n}}function ne(e,t=!0){var n=!1;(t||(e.f&yr)!==0)&&e.nodes!==null&&e.nodes.end!==null&&(Do(e.nodes.start,e.nodes.end),n=!0),Vr(e,t&&!n),Ft(e,0),x(e,ce);var r=e.nodes&&e.nodes.t;if(r!==null)for(const i of r)i.stop();Hr(e);var s=e.parent;s!==null&&s.first!==null&&Yr(e),h&&(e.component_function=null),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=null}function Do(e,t){for(;e!==null;){var n=e===t?null:Re(e);e.remove(),e=n}}function Yr(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function It(e,t,n=!0){var r=[];Wr(e,r,!0);var s=()=>{n&&ne(e),t&&t()},i=r.length;if(i>0){var o=()=>--i||s();for(var a of r)a.out(o)}else s()}function Wr(e,t,n){if((e.f&ee)===0){e.f^=ee;var r=e.nodes&&e.nodes.t;if(r!==null)for(const a of r)(a.is_global||n)&&t.push(a);for(var s=e.first;s!==null;){var i=s.next,o=(s.f&wt)!==0||(s.f&se)!==0&&(e.f&he)!==0;Wr(s,t,o?n:!1),s=i}}}function pl(e){Kr(e,!0)}function Kr(e,t){if((e.f&ee)!==0){e.f^=ee,(e.f&N)===0&&(x(e,L),de(e));for(var n=e.first;n!==null;){var r=n.next,s=(n.f&wt)!==0||(n.f&se)!==0;Kr(n,s?t:!1),n=r}var i=e.nodes&&e.nodes.t;if(i!==null)for(const o of i)(o.is_global||t)&&o.in()}}function rr(e=g){return(e.f&ce)!==0}function jo(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var s=n===r?null:Re(n);t.append(n),n=s}}let Xe=null;function Mo(e){var t=Xe;try{if(Xe=new Set,at(e),t!==null)for(var n of Xe)t.add(n);return Xe}finally{Xe=t}}function vl(e){for(var t of Mo(e))bt(t,t.v)}let Ue=!1;function qt(e){Ue=e}let ze=!1;function sr(e){ze=e}let w=null,W=!1;function M(e){w=e}let g=null;function K(e){g=e}let ue=null;function Jr(e){w!==null&&(!te||(w.f&$)!==0)&&(ue===null?ue=[e]:ue.push(e))}let j=null,q=0,F=null;function Uo(e){F=e}let Zr=1,Me=0,qe=Me;function ir(e){qe=e}function Xr(){return++Zr}function ot(e){var t=e.f;if((t&L)!==0)return!0;if(t&$&&(e.f&=~$e),(t&ie)!==0){for(var n=e.deps,r=n.length,s=0;s<r;s++){var i=n[s];if(ot(i)&&Mr(i),i.wv>e.wv)return!0}(t&B)!==0&&D===null&&x(e,N)}return!1}function Qr(e,t,n=!0){var r=e.reactions;if(r!==null&&!(!te&&ue?.includes(e)))for(var s=0;s<r.length;s++){var i=r[s];(i.f&$)!==0?Qr(i,t,!1):t===i&&(n?x(i,L):(i.f&N)!==0&&x(i,ie),de(i))}}function fn(e){var t=j,n=q,r=F,s=w,i=ue,o=y,a=W,c=qe,_=e.f;j=null,q=0,F=null,w=(_&(se|Be))===0?e:null,ue=null,tt(e.ctx),W=!1,qe=++Me,e.ac!==null&&(Kt(()=>{e.ac.abort(De)}),e.ac=null);try{e.f|=an;var f=e.fn,l=f(),u=e.deps;if(j!==null){var d;if(Ft(e,q),u!==null&&q>0)for(u.length=q+j.length,d=0;d<j.length;d++)u[q+d]=j[d];else e.deps=u=j;if(Rn()&&(e.f&B)!==0)for(d=q;d<u.length;d++)(u[d].reactions??=[]).push(e)}else u!==null&&q<u.length&&(Ft(e,q),u.length=q);if(xt()&&F!==null&&!W&&u!==null&&(e.f&($|ie|L))===0)for(d=0;d<F.length;d++)Qr(F[d],e);if(s!==null&&s!==e){if(Me++,s.deps!==null)for(let v=0;v<n;v+=1)s.deps[v].rv=Me;if(t!==null)for(const v of t)v.rv=Me;F!==null&&(r===null?r=F:r.push(...F))}return(e.f&ke)!==0&&(e.f^=ke),l}catch(v){return Rr(v)}finally{e.f^=an,j=t,q=n,F=r,w=s,ue=i,tt(o),W=a,qe=c}}function qo(e,t){let n=t.reactions;if(n!==null){var r=Ti.call(n,e);if(r!==-1){var s=n.length-1;s===0?n=t.reactions=null:(n[r]=n[s],n.pop())}}if(n===null&&(t.f&$)!==0&&(j===null||!j.includes(t))){var i=t;(i.f&B)!==0&&(i.f^=B,i.f&=~$e),kn(i),un(i),Ft(i,0)}}function Ft(e,t){var n=e.deps;if(n!==null)for(var r=t;r<n.length;r++)qo(e,n[r])}function st(e){var t=e.f;if((t&ce)===0){x(e,N);var n=g,r=Ue;if(g=e,Ue=!0,h){var s=At;Xn(e.component_function);var i=nt;Ut(e.dev_stack??nt)}try{(t&(he|jt))!==0?Io(e):Vr(e),Hr(e);var o=fn(e);e.teardown=typeof o=="function"?o:null,e.wv=Zr;var a;h&&eo&&(e.f&L)!==0&&e.deps}finally{Ue=r,g=n,h&&(Xn(s),Ut(i))}}}async function ml(){if(te)return new Promise(e=>{requestAnimationFrame(()=>e()),setTimeout(()=>e())});await Promise.resolve(),co()}function Q(e){var t=e.f,n=(t&$)!==0;if(Xe?.add(e),w!==null&&!W){var r=g!==null&&(g.f&ce)!==0;if(!r&&!ue?.includes(e)){var s=w.deps;if((w.f&an)!==0)e.rv<Me&&(e.rv=Me,j===null&&s!==null&&s[q]===e?q++:j===null?j=[e]:j.push(e));else{(w.deps??=[]).push(e);var i=e.reactions;i===null?e.reactions=[w]:i.includes(w)||i.push(w)}}}if(h&&mo.delete(e),ze&&Ae.has(e))return Ae.get(e);if(n){var o=e;if(ze){var a=o.v;return((o.f&N)===0&&o.reactions!==null||ts(o))&&(a=xn(o)),Ae.set(o,a),a}var c=(o.f&B)===0&&!W&&w!==null&&(Ue||(w.f&B)!==0),_=o.deps===null;
45ot(o)&&(c&&(o.f|=B),Mr(o)),c&&!_&&es(o)}if(D?.has(e))return D.get(e);if((e.f&ke)!==0)throw e.v;return e.v}function es(e){if(e.deps!==null){e.f|=B;for(const t of e.deps)(t.reactions??=[]).push(e),(t.f&$)!==0&&(t.f&B)===0&&es(t)}}function ts(e){if(e.v===C)return!0;if(e.deps===null)return!1;for(const t of e.deps)if(Ae.has(t)||(t.f&$)!==0&&ts(t))return!0;return!1}function at(e){var t=W;try{return W=!0,e()}finally{W=t}}function gl(e){if(!(typeof e!="object"||!e||e instanceof EventTarget)){if(Te in e)dn(e);else if(!Array.isArray(e))for(let t in e){const n=e[t];typeof n=="object"&&n&&Te in n&&dn(n)}}}function dn(e,t=new Set){if(typeof e=="object"&&e!==null&&!(e instanceof EventTarget)&&!t.has(e)){t.add(e),e instanceof Date&&e.getTime();for(let r in e)try{dn(e[r],t)}catch{}const n=gr(e);if(n!==Object.prototype&&n!==Array.prototype&&n!==Map.prototype&&n!==Set.prototype&&n!==Date.prototype){const r=xi(n);for(let s in r){const i=r[s].get;if(i)try{i.call(e)}catch{}}}}}const Fo=/\r/g;function wl(e){e=e.replace(Fo,"");let t=5381,n=e.length;for(;n--;)t=(t<<5)-t^e.charCodeAt(n);return(t>>>0).toString(36)}function yl(e){return e.endsWith("capture")&&e!=="gotpointercapture"&&e!=="lostpointercapture"}const zo=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function bl(e){return zo.includes(e)}const Bo={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject",novalidate:"noValidate",allowfullscreen:"allowFullscreen",disablepictureinpicture:"disablePictureInPicture",disableremoteplayback:"disableRemotePlayback"};function El(e){return e=e.toLowerCase(),Bo[e]??e}const Go=["touchstart","touchmove"];function Ho(e){return Go.includes(e)}const Vo=["textarea","script","style","title"];function Sl(e){return Vo.includes(e)}function kl(e){return e?.replace(/\//g,"/â")}const ns=new Set,_n=new Set;function Tl(e){if(!A)return;e.removeAttribute("onload"),e.removeAttribute("onerror");const t=e.__e;t!==void 0&&(e.__e=void 0,queueMicrotask(()=>{e.isConnected&&e.dispatchEvent(t)}))}function Yo(e,t,n,r={}){function s(i){if(r.capture||dt.call(t,i),!i.cancelBubble)return Kt(()=>n?.call(this,i))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?$t(()=>{t.addEventListener(e,s,r)}):t.addEventListener(e,s,r),s}function Al(e,t,n,r,s){var i={capture:r,passive:s},o=Yo(e,t,n,i);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&Cn(()=>{t.removeEventListener(e,o,i)})}function xl(e){for(var t=0;t<e.length;t++)ns.add(e[t]);for(var n of _n)n(e)}let or=null;function dt(e){var t=this,n=t.ownerDocument,r=e.type,s=e.composedPath?.()||[],i=s[0]||e.target;or=e;var o=0,a=or===e&&e.__root;if(a){var c=s.indexOf(a);if(c!==-1&&(t===document||t===window)){e.__root=t;return}var _=s.indexOf(t);if(_===-1)return;c<=_&&(o=c)}if(i=s[o]||e.target,i!==t){xe(e,"currentTarget",{configurable:!0,get(){return i||n}});var f=w,l=g;M(null),K(null);try{for(var u,d=[];i!==null;){var v=i.assignedSlot||i.parentNode||i.host||null;try{var p=i["__"+r];p!=null&&(!i.disabled||e.target===i)&&p.call(i,e)}catch(m){u?d.push(m):u=m}if(e.cancelBubble||v===t||v===null)break;i=v}if(u){for(let m of d)queueMicrotask(()=>{throw m});throw u}}finally{e.__root=t,delete e.currentTarget,M(f),K(l)}}}function rs(e){var t=document.createElement("template");return t.innerHTML=e.replaceAll("<!>","<!---->"),t.content}function re(e,t){var n=g;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function $l(e,t){var n=(t&Gi)!==0,r=(t&Hi)!==0,s,i=!e.startsWith("<!>");return()=>{if(A)return re(b,null),b;s===void 0&&(s=rs(i?e:"<!>"+e),n||(s=Oe(s)));var o=r||On?document.importNode(s,!0):s.cloneNode(!0);if(n){var a=Oe(o),c=o.lastChild;re(a,c)}else re(o,o);return o}}function Wo(e,t,n="svg"){var r=!e.startsWith("<!>"),s=`<${n}>${r?e:"<!>"+e}</${n}>`,i;return()=>{if(A)return re(b,null),b;if(!i){var o=rs(s),a=Oe(o);
45i=Oe(a)}var c=i.cloneNode(!0);return re(c,c),c}}function Ol(e,t){return Wo(e,t,"svg")}function Rl(e=""){if(!A){var t=_e(e+"");return re(t,t),t}var n=b;return n.nodeType!==Ht&&(n.before(n=_e()),fe(n)),re(n,n),n}function Cl(){if(A)return re(b,null),b;var e=document.createDocumentFragment(),t=document.createComment(""),n=_e();return e.append(t,n),re(t,n),e}function Nl(e,t){if(A){var n=g;((n.f&Et)===0||n.nodes.end===null)&&(n.nodes.end=b),Sn();return}e!==null&&e.before(t)}function Pl(){if(A&&b&&b.nodeType===St&&b.textContent?.startsWith("$")){const e=b.textContent.substring(1);return Sn(),e}return(window.__svelte??={}).uid??=1,`c${window.__svelte.uid++}`}let hn=!0;function Ll(e){hn=e}function Il(e,t){var n=t==null?"":typeof t=="object"?t+"":t;n!==(e.__t??=e.nodeValue)&&(e.__t=n,e.nodeValue=n+"")}function ar(e,t){return Ko(e,t)}const Ze=new Map;function Ko(e,{target:t,anchor:n,props:r={},events:s,context:i,intro:o=!0}){xo();var a=new Set,c=l=>{for(var u=0;u<l.length;u++){var d=l[u];if(!a.has(d)){a.add(d);var v=Ho(d);t.addEventListener(d,dt,{passive:v});var p=Ze.get(d);p===void 0?(document.addEventListener(d,dt,{passive:v}),Ze.set(d,1)):Ze.set(d,p+1)}}};c(Ai(ns)),_n.add(c);var _=void 0,f=No(()=>{var l=n??t.appendChild(_e());return ho(l,{pending:()=>{}},u=>{if(i){ro({});var d=y;d.c=i}if(s&&(r.$$events=s),A&&re(u,null),hn=o,_=e(u,r)||{},hn=!0,A&&(g.nodes.end=b,b===null||b.nodeType!==St||b.data!==kr))throw Yt(),Vt;i&&so()}),()=>{for(var u of a){t.removeEventListener(u,dt);var d=Ze.get(u);--d===0?(document.removeEventListener(u,dt),Ze.delete(u)):Ze.set(u,d)}_n.delete(c),l!==n&&l.parentNode?.removeChild(l)}});return pn.set(_,f),_}let pn=new WeakMap;function Jo(e,t){const n=pn.get(e);return n?(pn.delete(e),n(t)):(h&&(Te in e?Ki():Wi()),Promise.resolve())}if(h){let e=function(t){if(!(t in globalThis)){let n;Object.defineProperty(globalThis,t,{configurable:!0,get:()=>{if(n!==void 0)return n;Mi(t)},set:r=>{n=r}})}};e("$state"),e("$effect"),e("$derived"),e("$inspect"),e("$props"),e("$bindable")}function Zo(e){y===null&&kt("onMount"),Tt&&y.l!==null?ss(y).m.push(e):Co(()=>{const t=at(e);if(typeof t=="function")return t})}function Dl(e){y===null&&kt("onDestroy"),Zo(()=>()=>at(e))}function Xo(e,t,{bubbles:n=!1,cancelable:r=!1}={}){return new CustomEvent(e,{detail:t,bubbles:n,cancelable:r})}function jl(){const e=y;return e===null&&kt("createEventDispatcher"),(t,n,r)=>{const s=e.s.$$events?.[t];if(s){const i=mr(s)?s.slice():[s],o=Xo(t,n,r);for(const a of i)a.call(e.x,o);return!o.defaultPrevented}return!0}}function Ml(e){y===null&&kt("afterUpdate"),y.l===null&&ji("afterUpdate"),ss(y).a.push(e)}function ss(e){var t=e.l;return t.u??={a:[],b:[],m:[]}}const Qo="./assets/index-u_70EsSX.css";let vn;vn=[];let mn,gn,is,ea=new Promise(e=>{is=e});globalThis.__MODE__??="_NORMAL_";const ta=globalThis.__MODE__;async function na(){ta==="_CC_"&&await _t(()=>import("virtual:cc-init"),[],import.meta.url);const e=await Promise.all([_t(()=>import("./Index-DF3kc4kz.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]),import.meta.url),_t(()=>import("./index-3jMPb64b.js"),__vite__mapDeps([13,1,2,14]),import.meta.url)]);mn=e[0].default,gn=e[1].mount_css,is()}function ra(){class e extends HTMLElement{control_page_title;initial_height;is_embed;container;info;autoscroll;eager;theme_mode;host;space;src;app;loading;updating;constructor(){super(),this.host=this.getAttribute("host"),this.space=this.getAttribute("space"),this.src=this.getAttribute("src"),this.control_page_title=this.getAttribute("control_page_title"),this.initial_height=this.getAttribute("initial_height")??"300px",this.is_embed=this.getAttribute("embed")??"true",this.container=this.getAttribute("container")??"true",this.info=this.getAttribute("info")??!0,this.autoscroll=this.getAttribute("autoscroll"),this.eager=this.getAttribute("eager"),this.theme_mode=this.getAttribute("theme_mode"),this.updating=!1,this.loading=!1}async connectedCallback(){await na(),this.loading=!0,this.app&&this.app.$destroy(),typeof vn!="string"&&vn.forEach(i=>gn(i,document.head)),await gn(Qo,document.head);
45const n=new CustomEvent("domchange",{bubbles:!0,cancelable:!1,composed:!0});new MutationObserver(i=>{this.dispatchEvent(n)}).observe(this,{childList:!0});const s={target:this,props:{space:this.space?this.space.trim():this.space,src:this.src?this.src.trim():this.src,info:this.info!=="false",container:this.container!=="false",is_embed:this.is_embed!=="false",initial_height:this.initial_height,eager:this.eager==="true",version:"6-16-0",theme_mode:this.theme_mode,autoscroll:this.autoscroll==="true",control_page_title:this.control_page_title==="true",Client:Dt,app_mode:window.__gradio_mode__==="app"}};this.app=ar(mn,s),this.updating&&this.setAttribute(this.updating.name,this.updating.value),this.loading=!1}static get observedAttributes(){return["src","space","host"]}async attributeChangedCallback(n,r,s){if(await ea,(n==="host"||n==="space"||n==="src")&&s!==r){if(this.updating={name:n,value:s},this.loading)return;this.app&&Jo(this.app),this.space=null,this.host=null,this.src=null,n==="host"?this.host=s:n==="space"?this.space=s:n==="src"&&(this.src=s);const i={target:this,props:{space:this.space?this.space.trim():this.space,src:this.src?this.src.trim():this.src,info:this.info!=="false",container:this.container!=="false",is_embed:this.is_embed!=="false",initial_height:this.initial_height,eager:this.eager==="true",version:"6-16-0",theme_mode:this.theme_mode,autoscroll:this.autoscroll==="true",control_page_title:this.control_page_title==="true",Client:Dt,app_mode:window.__gradio_mode__==="app"}};this.app=ar(mn,i),this.updating=!1}}}customElements.get("gradio-app")||customElements.define("gradio-app",e)}ra();export{le as $,va as A,T as B,St as C,h as D,wt as E,Yi as F,ml as G,Vt as H,Cn as I,$t as J,nn as K,Qa as L,ro as M,tl as N,so as O,co as P,el as Q,$l as R,nl as S,Fa as T,Al as U,Tl as V,mr as W,Il as X,ul as Y,Q as Z,fl as _,Nl as a,oa as a$,Ja as a0,jl as a1,Ka as a2,Cl as a3,Rl as a4,Zi as a5,xt as a6,Zo as a7,ol as a8,Kt as a9,X as aA,yt as aB,pt as aC,Ot as aD,C as aE,jr as aF,Sr as aG,Xi as aH,ar as aI,Jo as aJ,Pl as aK,Qe as aL,Xa as aM,vo as aN,Tn as aO,yr as aP,Wa as aQ,go as aR,Ya as aS,_l as aT,Ao as aU,hn as aV,he as aW,Et as aX,Na as aY,Ra as aZ,Ca as a_,be as aa,ft as ab,Co as ac,wo as ad,Dl as ae,_t as af,ll as ag,xl as ah,il as ai,sl as aj,Ll as ak,La as al,_e as am,pa as an,Sl as ao,qa as ap,Za as aq,ua as ar,ia as as,zt as at,tr as au,Va as av,Ha as aw,Ml as ax,la as ay,bt as az,g as b,aa as b0,Ua as b1,vl as b2,gr as b3,$i as b4,pl as b5,ne as b6,It as b7,Ie as b8,jo as b9,Ri as bA,ca as bB,An as bC,xe as bD,ga as bE,xa as bF,ce as bG,$a as bH,Ta as bI,Oa as bJ,ze as bK,da as bL,K as bM,wa as bN,Tt as bO,Aa as bP,Ga as bQ,Ba as bR,rl as ba,za as bb,Ea as bc,Ai as bd,ya as be,ka as bf,ba as bg,fa as bh,ee as bi,Sa as bj,$o as bk,kr as bl,hl as bm,Ma as bn,_a as bo,Ia as bp,Pa as bq,yl as br,Yo as bs,El as bt,bl as bu,xi as bv,Oo as bw,Da as bx,Te as by,y as bz,rs as c,re as d,Sn as e,Ol as f,Oe as g,A as h,b as i,Re as j,Yt as k,wl as l,At as m,ja as n,kl as o,Lo as p,ma as q,Do as r,fe as s,dl as t,cl as u,at as v,Nn as w,gl as x,Qi as y,al as z};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.