1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Index-Czfua_SX.js","./i18n-DMKL1Q3B.js","./i18n--4Ke01SI.css","./StreamingBar-DrfQmzG9.js","./IconButtonWrapper-BWheMLkN.js","./MarkdownCode-U4KoZ7qK.js","./prism-python-iiDAHIFD.js","./MarkdownCode-Uk-jbna-.css","./IconButtonWrapper-DVQ8sIMc.css","./StreamingBar-K0YZHDYh.css","./Index-CI7BqPz-.css","./index-CQPuV1pp.js","./init.svelte-DZC7iBwi.js","./index-tFQomdd2.js","./utils.svelte-Ceck75cM.js"])))=>i.map(i=>d[i]); 2import*as ve from"./svelte/svelte_svelte.js";import{mount as Ee,unmount as dt}from"./svelte/svelte_svelte.js";import*as Se from"./svelte/svelte_animate.js";import*as ke from"./svelte/svelte_attachments.js";import*as $e from"./svelte/svelte_easing.js";import*as Re from"./svelte/svelte_internal_client.js";import*as Ae from"./svelte/svelte_internal_flags_async.js";import*as Oe from"./svelte/svelte_internal_flags_legacy.js";import*as Te from"./svelte/svelte_internal_flags_tracing.js";import*as Pe from"./svelte/svelte_internal_server.js";import*as Ce from"./svelte/svelte_legacy.js";import*as Le from"./svelte/svelte_motion.js";import*as Ne from"./svelte/svelte_reactivity.js";import*as xe from"./svelte/svelte_reactivity_window.js";import*as De from"./svelte/svelte_server.js";import*as Ie from"./svelte/svelte_store.js";import*as je from"./svelte/svelte_transition.js";import*as Ue from"./svelte/svelte_events.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))n(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function s(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(r){if(r.ep)return;r.ep=!0;const i=s(r);fetch(r.href,i)}})();const _t="modulepreload",mt=function(e,t){return new URL(e,t).href},qe={},K=function(t,s,n){let r=Promise.resolve();if(s&&s.length>0){let h=function(u){return Promise.all(u.map(c=>Promise.resolve(c).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};const o=document.getElementsByTagName("link"),a=document.querySelector("meta[property=csp-nonce]"),l=a?.nonce||a?.getAttribute("nonce");r=h(s.map(u=>{if(u=mt(u,n),u in qe)return;qe[u]=!0;const c=u.endsWith(".css"),f=c?'[rel="stylesheet"]':"";if(n)for(let p=o.length-1;p>=0;p--){const v=o[p];if(v.href===u&&(!c||v.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${u}"]${f}`))return;const g=document.createElement("link");if(g.rel=c?"stylesheet":_t,c||(g.as="script"),g.crossOrigin="",g.href=u,l&&g.setAttribute("nonce",l),document.head.appendChild(g),c)return new Promise((p,v)=>{g.addEventListener("load",p),g.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${u}`)))})}))}function i(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return r.then(o=>{for(const a of o||[])a.status==="rejected"&&i(a.reason);return t().catch(i)})},gt="host",Ze="queue/data",wt="queue/join",ze="upload",yt="login",W="config",bt="info",vt="runtime",Et="sleeptime",St="heartbeat",kt="component_server",$t="reset",Rt="cancel",At="app_id",Ke="This application is currently busy. Please try again. ",G="Connection errored out. ",N="Could not resolve app config. ",Ot="Could not get space status. ",Tt="Could not get API info. ",he="Space metadata could not be loaded. ",Pt="Invalid URL. A full URL path is required.",Ct="Not authorized to access this space. ",Ye="Invalid credentials. Could not login. ",Lt="Login credentials are required to access this space.",Nt="File system access is only available in Node.js environments",Qe="Root URL not found in client config",xt="Error uploading file";async function Me(e,t,s){try{return(await(await fetch(`https://huggingface.co/api/spaces/${e}/jwt`,{headers:{Authorization:`Bearer ${t}
2`,...s?{Cookie:s}:{}}})).json()).token||!1}catch{return!1}}function Dt(e){let t={};return e.forEach(({api_name:s,id:n})=>{s&&(t[s]=n)}),t}async function It(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){let s=ae(e,this.deep_link?W+"?deep_link="+this.deep_link:W);const n=await this.fetch(s,{headers:t,credentials:"include"}),r=await Be(n,e,!!this.options.auth);window.gradio_config={...r,current_page:window.gradio_config.current_page}}return window.gradio_config.root=e,{...window.gradio_config}}else if(e){let s=ae(e,this.deep_link?W+"?deep_link="+this.deep_link:W);const n=await this.fetch(s,{headers:t,credentials:"include"});return Be(n,e,!!this.options.auth)}throw new Error(N)}async function Be(e,t,s){if(e?.status===401&&!s){const r=(await e.json())?.detail?.auth_message;throw new Error(r||Lt)}else if(e?.status===401&&s)throw new Error(Ye);if(e?.status===200){let n=await e.json();return n.root=t,n.dependencies?.forEach((r,i)=>{r.id===void 0&&(r.id=i)}),n}else if(e?.status===401)throw new Error(Ct);throw new Error(N)}async function jt(){const{http_protocol:e,host:t}=await de(this.app_reference,this.options.token);try{if(this.options.auth){const s=await Xe(e,t,this.options.auth,this.fetch,this.options.token);s&&this.set_cookies(s)}}catch(s){throw Error(s.message)}}async function Xe(e,t,s,n,r){const i=new FormData;i.append("username",s?.[0]),i.append("password",s?.[1]);let o={};r&&(o.Authorization=`Bearer ${r}`);const a=await n(`${e}//${t}/${yt}`,{headers:o,method:"POST",body:i,credentials:"include"});if(a.status===200)return a.headers.get("set-cookie");throw a.status===401?new Error(Ye):new Error(he)}function oe(e){if(e.startsWith("http")){const{protocol:t,host:s,pathname:n}=new URL(e);return{ws_protocol:t==="https:"?"wss":"ws",http_protocol:t,host:s+(n!=="/"?n:"")}}return{ws_protocol:"wss",http_protocol:"https:",host:new URL(e).host}}const et=e=>{let t=[];return e.split(/,(?=\s*[^\s=;]+=[^\s=;]+)/).forEach(n=>{const[r,i]=n.split(";")[0].split("=");r&&i&&t.push(`${r.trim()}=${i.trim()}`)}),t},fe=/^[a-zA-Z0-9_\-\.]+\/[a-zA-Z0-9_\-\.]+$/,Ut=/.*hf\.space\/{0,1}.*$/;async function de(e,t){const s={};t&&(s.Authorization=`Bearer ${t}`);const n=e.trim().replace(/\/$/,"");if(fe.test(n))try{const i=(await(await fetch(`https://huggingface.co/api/spaces/${n}/${gt}`,{headers:s})).json()).host;return{space_id:e,...oe(i)}}catch{throw new Error(he)}if(Ut.test(n)){const{ws_protocol:r,http_protocol:i,host:o}=oe(n);return{space_id:o.split("/")[0].replace(".hf.space",""),ws_protocol:r,http_protocol:i,host:o}}return{space_id:!1,...oe(n)}}const ae=(...e)=>{try{return e.reduce((t,s)=>(t=t.replace(/\/+$/,""),s=s.replace(/^\/+/,""),new URL(s,t+"/").toString()))}catch{throw new Error(Pt)}};function qt(e,t,s){const n={named_endpoints:{},unnamed_endpoints:{}};return Object.keys(e).forEach(r=>{(r==="named_endpoints"||r==="unnamed_endpoints")&&(n[r]={},Object.entries(e[r]).forEach(([i,{parameters:o,returns:a}])=>{const l=t.dependencies.find(c=>c.api_name===i||c.api_name===i.replace("/",""))?.id||s[i.replace("/","")]||-1,h=l!==-1?t.dependencies.find(c=>c.id==l)?.types:{generator:!1,cancel:!1};if(l!==-1&&t.dependencies.find(c=>c.id==l)?.inputs?.length!==o.length){const c=t.dependencies.find(f=>f.id==l).inputs.map(f=>t.components.find(g=>g.id===f)?.type);try{c.forEach((f,g)=>{if(f==="state"){const p={component:"state",example:null,parameter_default:null,parameter_has_default:!0,parameter_name:null,hidden:!0};o.splice(g,0,p)}})}catch(f){console.error(f)}}const u=(c,f,g,p)=>({...c,description:Mt(c?.type,g),type:zt(c?.type,f,g,p)||""});n[r][i]={parameters:o.map(c=>u(c,c?.component,c?.serializer,"parameter")),returns:a.map(c=>u(c,c?.component,c?.serializer,"return")),type:h}}))}),n}function zt(e,t,s,n){if(t==="Api")return e.type;switch(e?.type){case"string":return"string";case"boolean":return"boolean";case"number":return"number"}if(s==="JSONSerializable"||s==="StringSerializable")return"any";if(s==="ListStringSerializable")return"string[]";if(t==="Image")return n==="parameter"?"Blob | File | Buffer":"string";if(s==="FileSerializable")return e?.type==="array"?n==="parameter"?"(Blob | File | Buffer)[]":"{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}[]":n==="parameter"?"Blob | File | Buffer":"{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}";if(s==="GallerySerializable")return n==="parameter"?"[(Blob | File | Buffer), (string | null)][]":"[{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}, (string | null))][]"}function Mt(e,t){return t==="GallerySerializable"?"array of [file, label] tuples":t==="ListStringSerializable"?"array of str
2ings":t==="FileSerializable"?"array of files or single file":e?.description}function Fe(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:Ke,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},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 Bt=(e=[],t)=>{const s=t?t.parameters:[];if(Array.isArray(e))return t&&s.length>0&&e.length>s.length&&console.warn("Too many arguments provided for the endpoint."),e;const n=[],r=Object.keys(e);return s.forEach((i,o)=>{if(e.hasOwnProperty(i.parameter_name))n[o]=e[i.parameter_name];else if(i.parameter_has_default)n[o]=i.parameter_default;else throw new Error(`No value provided for required parameter: ${i.parameter_name}`)}),r.forEach(i=>{if(!s.some(o=>o.parameter_name===i))throw new Error(`Parameter \`${i}\` is not a valid keyword argument. Please refer to the API for usage.`)}),n.forEach((i,o)=>{if(i===void 0&&!s[o].parameter_has_default)throw new Error(`No value provided for required parameter: ${s[o].parameter_name}`)}),n};async function Ft(){if(this.api_info)return this.api_info;const{token:e}=this.options,{config:t}=this,s={"Content-Type":"application/json"};if(e&&(s.Authorization=`Bearer ${e}`),!!t)try{let n,r;if(typeof window<"u"&&window.gradio_api_info)r=window.gradio_api_info;else{const i=ae(t.root,this.api_prefix,bt);if(n=await this.fetch(i,{headers:s,credentials:"include"}),!n.ok)throw new Error(G);r=await n.json()}return"api"in r&&(r=r.api),r.named_endpoints["/predict"]&&!r.unnamed_endpoints[0]&&(r.unnamed_endpoints[0]=r.named_endpoints["/predict"]),qt(r,t,this.api_map)}catch(n){throw new Error("Could not get API info. "+n.message)}}async function Gt(e,t,s){const n={};this?.options?.token&&(n.Authorization=`Bearer ${this.options.token}`);const r=1e3,i=[];let o;for(let a=0;a<t.length;a+=r){const l=t.slice(a,a+r),h=new FormData;l.forEach(c=>{h.append("files",c)});try{const c=s?`${e}${this.api_prefix}/${ze}?upload_id=${s}`:`${e}${this.api_prefix}/${ze}`;o=await this.fetch(c,{method:"POST",body:h,headers:n,credentials:"include"})}catch(c){throw new Error(G+c.message)}if(!o.ok){const c=await o.text();return{error:`HTTP ${o.status}: ${c}`}}const u=await o.json();u&&i.push(...u)}return{files:i}}const Jt={radix:1e3,unit:["b","kb","Mb","Gb","Tb","Pb","Eb","Zb","Yb"]},Ht={radix:1024,unit:["b","Kib","Mib","Gib","Tib","Pib","Eib","Zib","Yib"]},Vt={radix:1024,unit:["b","Kb","Mb","Gb","Tb","Pb","Eb","Zb","Yb"]},Ge={si:Jt,iec:Ht,jedec:Vt};function Wt(e,t=1,s="jedec"){e=Math.abs(e);const{radix:n,unit:r}=Ge[s]||Ge.jedec;let i=0;for(;e>=n;)e/=n,++i;return`${e.toFixed(t)} ${r[i]}`}async function Zt(e,t,s,n){let r=(Array.isArray(e)?e:[e]).map(o=>o.blob);const i=r.filter(o=>o.size>(n??1/0));if(i.length)throw new Error(`File(s) exceed the maximum allowed size of ${Wt(n||1/0)}: ${i.map(o=>`"${o.name}"`).join(", ")}`);return await Promise.all(await this.upload_files(t,r,s).then(async o=>{if(o.error)throw new Error(o.error);return o.files?o.files.map((a,l)=>new Q({...e[l],path:a,url:`${t}${this.api_prefix}/file=${a}`})):[]}))}async function Ts(e,t){return e.map(s=>new Q({path:s.name,orig_name:s.name,blob:s,size:s.size,mime_type:s.type,is_stream
vendor: 15,199 bytes, lines 2-4
2:t}))}class Q{path;url;orig_name;size;blob;is_stream;mime_type;alt_text;b64;meta={_type:"gradio.FileData"};constructor({path:t,url:s,orig_name:n,size:r,blob:i,is_stream:o,mime_type:a,alt_text:l,b64:h}){this.path=t,this.url=s,this.orig_name=n,this.size=r,this.blob=s?void 0:i,this.is_stream=o,this.mime_type=a,this.alt_text=l,this.b64=h}}class Kt{type;command;meta;fileData;constructor(t,s){this.type="command",this.command=t,this.meta=s}}typeof process<"u"&&process.versions&&process.versions.node;function Je(e,t,s){for(;s.length>1;){const r=s.shift();if(typeof r=="string"||typeof r=="number")e=e[r];else throw new Error("Invalid key type")}const n=s.shift();if(typeof n=="string"||typeof n=="number")e[n]=t;else throw new Error("Invalid key type")}async function ce(e,t=void 0,s=[],n=!1,r=void 0){if(Array.isArray(e)){let i=[];return await Promise.all(e.map(async(o,a)=>{let l=s.slice();l.push(String(a));const h=await ce(e[a],n?r?.parameters[a]?.component||void 0:t,l,!1,r);i=i.concat(h)})),i}else{if(globalThis.Buffer&&e instanceof globalThis.Buffer||e instanceof Blob)return[{path:s,blob:new Blob([e]),type:t}];if(typeof e=="object"&&e!==null){let i=[];for(const o of Object.keys(e)){const a=[...s,o],l=e[o];i=i.concat(await ce(l,void 0,a,!1,r))}return i}}return[]}function Yt(e,t){let s=t?.dependencies?.find(n=>n.id==e)?.queue;return s!=null?!s:!t.enable_queue}function Qt(e,t){return new Promise((s,n)=>{const r=new MessageChannel;r.port1.onmessage=(({data:i})=>{r.port1.close(),s(i)}),window.parent.postMessage(e,t,[r.port2])})}function Z(e,t,s,n,r=!1){if(n==="input"&&!r)throw new Error("Invalid code path. Cannot skip state inputs for input.");if(n==="output"&&r)return e;let i=[],o=0;const a=n==="input"?t.inputs:t.outputs;for(let l=0;l<a.length;l++){const h=a[l];if(s.find(c=>c.id===h)?.type==="state"){if(r)if(e.length===a.length){const c=e[o];i.push(c),o++}else i.push(null);else{o++;continue}continue}else{const c=e[o];i.push(c),o++}}return i}async function Xt(e,t,s){const n=this;await es(n,t);const r=await ce(t,void 0,[],!0,s);return(await Promise.all(r.map(async({path:o,blob:a,type:l})=>{if(!a)return{path:o,type:l};const h=await n.upload_files(e,[a]),u=h.files&&h.files[0];return{path:o,file_url:u,type:l,name:typeof File<"u"&&a instanceof File?a?.name:void 0}}))).forEach(({path:o,file_url:a,type:l,name:h})=>{if(l==="Gallery")Je(t,a,o);else if(a){const u=new Q({path:a,orig_name:h});Je(t,u,o)}}),t}async function es(e,t){if(!(e.config?.root||e.config?.root_url))throw new Error(Qe);await tt(e,t)}async function tt(e,t,s=[]){for(const n in t)t[n]instanceof Kt?await ts(e,t,n):typeof t[n]=="object"&&t[n]!==null&&await tt(e,t[n],[...s,n])}async function ts(e,t,s){let n=t[s];const r=e.config?.root||e.config?.root_url;if(!r)throw new Error(Qe);try{let i,o;if(typeof process<"u"&&process.versions&&process.versions.node){const u=await K(()=>import("./__vite-browser-external-D7Ct-6yo.js").then(f=>f._),[],import.meta.url);o=(await K(()=>import("./__vite-browser-external-D7Ct-6yo.js").then(f=>f._),[],import.meta.url)).resolve(process.cwd(),n.meta.path),i=await u.readFile(o)}else throw new Error(Nt);const a=new Blob([i],{type:"application/octet-stream"}),l=await e.upload_files(r,[a]),h=l.files&&l.files[0];if(h){const u=new Q({path:h,orig_name:n.meta.name||""});t[s]=u}}catch(i){console.error(xt,i)}}async function ss(e,t,s){const n={"Content-Type":"application/json"};this.options.token&&(n.Authorization=`Bearer ${this.options.token}`);try{var r=await this.fetch(e,{method:"POST",body:JSON.stringify(t),headers:{...n,...s},credentials:"include"})}catch{return[{error:G},500]}let i,o;try{i=await r.json(),o=r.status}catch(a){i={error:`Could not parse server response: ${a}`},o=500}return[i,o]}async function ns(e,t={}){let s=!1,n=!1;if(!this.config)throw new Error("Could not resolve app config");if(typeof e=="number")this.config.dependencies.find(r=>r.id==e);else{const r=e.replace(/^\//,"");this.config.dependencies.find(i=>i.id==this.api_map[r])}return new Promise(async(r,i)=>{const o=this.submit(e,t,null,null,!0);let a;for await(const l of o)l.type==="data"&&(n&&r(a),s=!0,a=l),l.type==="status"&&(l.stage==="error"&&i(l),l.stage==="complete"&&(n=!0,s&&r(a)))})}async function F(e,t,s){let n=t==="subdomain"?`https://huggingface.co/api/spaces/by-subdomain/${e}`:`https://huggingface.co/api/spaces/${e}`,r,i;try{if(r=await fetch(n),i=r.status,i!==200)throw new Error;r=await r.json()}catch{s({status:"error",load_status:"error",message:Ot,detail:"NOT_FOUND"});return}if(!r||i!==200)return;const{runtime:{stage:o},id:a}=r;switch(o){case"STOPPED":case"SLEEPING":s({status:"sleeping",load_status:"pending",message:"Space is asleep. Waking it up...",detail:o}),setTimeout(()=>{F(e,t,s)},1e3);break;case"PAUSED":s({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 He(a)});break;case"RUNNING":case"RUNNING_BUILDING":s({status:"running",load_status:"complete",message:"Space is running.",detail:o});break;case"BUILDING":s({status:"building",load_status:"pending",message:"Space is building...",detail:o}),setTimeout(()=>{F(e,t,s)},1e3);break;case"APP_STARTING":s({status:"starting",load_status:"pending",message:"Space is starting...",detail:o}),setTimeout(()=>{F(e,t,s)},1e3);break;default:s({status:"space_error",load_status:"error",message:"This space is experiencing an issue.",detail:o,discussions_enabled:await He(a)});break}}const st=async(e,t)=>{let s=0;const n=12,r=5e3;return new Promise(i=>{F(e,fe.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")&&(s<n?(s++,setTimeout(()=>{st(e,t).then(i)},r)):i())})})},is=/^(?=[^]*\b[dD]iscussions{0,1}\b)(?=[^]*\b[dD]isabled\b)[^]*$/;async function He(e){try{const t=await fetch(`https://huggingface.co/api/spaces/${e}/discussions`,{method:"HEAD"}),s=t.headers.get("x-error-message");return!(!t.ok||s&&is.test(s))}catch{return!1}}async function rs(e,t){const s={};t&&(s.Authorization=`Bearer ${t}`);try{const n=await fetch(`https://huggingface.co/api/spaces/${e}/${vt}`,{headers:s});if(n.status!==200)throw new Error("Space hardware could not be obtained.");const{hardware:r}=await n.json();return r.current}catch(n){throw new Error(n.message)}}async function os(e,t,s){const n={};s&&(n.Authorization=`Bearer ${s}`);const r={seconds:t};try{const i=await fetch(`https://huggingface.co/api/spaces/${e}/${Et}`,{method:"POST",headers:{"Content-Type":"application/json",...n},body:JSON.stringify(r)});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 Ve=["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 as(e,t){const{token:s,private:n,hardware:r,timeout:i,auth:o}=t;if(r&&!Ve.includes(r))throw new Error(`Invalid hardware type provided. Valid types are: ${Ve.map(y=>`"${y}"`).join(",")}.`);const{http_protocol:a,host:l}=await de(e,s);let h=null;if(o){const y=await Xe(a,l,o,fetch);y&&(h=et(y))}const u={Authorization:`Bearer ${s}`,"Content-Type":"application/json",...h?{Cookie:h.join("; ")}:{}},c=(await(await fetch("https://huggingface.co/api/whoami-v2",{headers:u})).json()).name,f=e.split("/")[1],g={repository:`${c}/${f}`};n&&(g.private=!0);let p;try{r||(p=await rs(e,s))}catch(y){throw Error(he+y.message)}const v=r||p||"cpu-basic";g.hardware=v;try{const y=await fetch(`https://huggingface.co/api/spaces/${e}/duplicate`,{method:"POST",headers:u,body:JSON.stringify(g)});if(y.status===409)try{return await Y.connect(`${c}/${f}`,t)}catch(x){throw console.error("Failed to connect Client instance:",x),x}else if(y.status!==200)throw new Error(y.statusText);const X=await y.json();return await os(`${c}/${f}`,i||300,s),await Y.connect(cs(X.url),t)}catch(y){throw new Error(y)}}function cs(e){const t=/https:\/\/huggingface.co\/spaces\/([^/]+\/[^/]+)/,s=e.match(t);if(s)return s[1]}class ls extends TransformStream{#e="";constructor(t={allowCR:!1}){super({transform:(s,n)=>{for(s=this.#e+s;;){const r=s.indexOf(` 3`),i=t.allowCR?s.indexOf("\r"):-1;if(i!==-1&&i!==s.length-1&&(r===-1||r-1>i)){n.enqueue(s.slice(0,i)),s=s.slice(i+1);continue}if(r===-1)break;const o=s[r-1]==="\r"?r-1:r;n.enqueue(s.slice(0,o)),s=s.slice(r+1)}this.#e=s},flush:s=>{if(this.#e==="")return;const n=t.allowCR&&this.#e.endsWith("\r")?this.#e.slice(0,-1):this.#e;s.enqueue(n)}})}}function us(e){let t=new TextDecoderStream,s=new ls({allowCR:!0});return e.pipeThrough(t).pipeThrough(s)}function ps(e){let s=/[:]\s*/.exec(e),n=s&&s.index;if(n)return[e.substring(0,n),e.substring(n+s[0].length)]}function We(e,t,s){e.get(t)||e.set(t,s)}async function*hs(e,t){if(!e.body)return;let s=us(e.body),n,r=s.getReader(),i;for(;;){if(t&&t.aborted)return r.cancel();if(n=await r.read(),n.done)return;if(!n.value){i&&(yield i),i=void 0;continue}let[o,a]=ps(n.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 fs(e,t){let s=new Request(e,t);We(s.headers,"Accept","text/event-stream"),We(s.headers,"Content-Type","application/json");let n=await fetch(s);if(!n.ok)throw n;return hs(n,s.signal)}async function ds(){let{event_callbacks:e,unclosed_events:t,pending_stream_messages:s,stream_status:n,config:r,jwt:i}=this;const o=this;if(!r)throw new Error("Could not resolve app config");n.open=!0;let a=null,l=new URLSearchParams({session_hash:this.session_hash}).toString(),h=new URL(`${r.root}${this.api_prefix}/${Ze}?${l}`);if(i&&h.searchParams.set("__sign",i),a=this.stream(h),!a){console.warn("Cannot connect to SSE endpoint: "+h.toString());return}a.onmessage=async function(u){let c=JSON.parse(u.data);if(c.msg==="close_stream"){_e(n,o.abort_controller);return}const f=c.event_id;if(!f)await Promise.all(Object.keys(e).map(g=>e[g](c)));else if(e[f]&&r){c.msg==="process_completed"&&["sse","sse_v1","sse_v2","sse_v2.1","sse_v3"].includes(r.protocol)&&t.delete(f);let g=e[f];typeof window<"u"&&typeof document<"u"?setTimeout(g,0,c):g(c)}else s[f]||(s[f]=[]),s[f].push(c)},a.onerror=async function(u){console.error(u),await Promise.all(Object.keys(e).map(c=>e[c]({msg:"broken_connection",message:G})))}}function _e(e,t){e&&(e.open=!1,t?.abort())}function _s(e,t,s){!e[t]?(e[t]=[],s.data.forEach((r,i)=>{e[t][i]=r})):s.data.forEach((r,i)=>{let o=ms(e[t][i],r);e[t][i]=o,s.data[i]=o})}function ms(e,t){return t.forEach(([s,n,r])=>{e=gs(e,n,s,r)}),e}function gs(e,t,s,n){if(t.length===0){if(s==="replace")return n;if(s==="append")return e+n;throw new Error(`Unsupported action: ${s}`)}let r=e;for(let o=0;o<t.length-1;o++)r=r[t[o]];const i=t[t.length-1];switch(s){case"replace":r[i]=n;break;case"append":r[i]+=n;break;case"add":Array.isArray(r)?r.splice(Number(i),0,n):r[i]=n;break;case"delete":Array.isArray(r)?r.splice(Number(i),1):delete r[i];break;default:throw new Error(`Unknown action: ${s}`)}return e}function ws(e,t={}){const s={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 fs(e,t).then(async n=>{s.readyState=s.OPEN;try{for await(const r of n)s.onmessage&&s.onmessage(r);s.readyState=s.CLOSED}catch(r){s.onerror&&s.onerror(r),s.readyState=s.CLOSED}}).catch(n=>{console.error(n),s.onerror&&s.onerror(n),s.readyState=s.CLOSED}),s}function ys(e,t={},s,n,r){try{let i=function(_){(r||at[_.type])&&h(_)},o=function(){for(pt=!0;M.length>0;)M.shift()({value:void 0,done:!0})},a=function(_){M.length>0?M.shift()(_):ie.push(_)},l=function(_){a(bs(_)),o()},h=function(_){a({value:_,done:!1})},u=function(){return ie.length>0?Promise.resolve(ie.shift()):new Promise(_=>M.push(_))};const{token:c}=this.options,{fetch:f,app_reference:g,config:p,session_hash:v,api_info:y,api_map:X,stream_status:x,pending_stream_messages:ee,pending_diff_streams:te,event_callbacks:se,unclosed_events:it,post_data:ne,options:J,api_prefix:A}=this,rt=this;if(!y)throw new Error("No API found");if(!p)throw new Error("Could not resolve app config");let{fn_index:d,endpoint_info:me,dependency:q}=vs(y,e,X,p),ot=Bt(t,me),j,O=p.protocol??"ws";if(O==="ws")throw new Error("WebSocket protocol is not supported in this version");let U="",As=()=>U;const m=typeof e=="number"?"/predict":e;let H,b=null,T=!1,ge={},z=typeof window<"u"&&typeof document<"u"?new URLSearchParams(window.location.search).toString():"";const at=J?.events?.reduce((_,R)=>(_[R]=!0,_),{})||{};async function ct(){let _={},R={};_={event_id:b},R={event_id:b,session_hash:v,fn_index:d};try{if(!p)throw new Error("Could not resolve app config");"event_id"in R&&await f(`${p.root}${A}/${Rt}`,{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify(R)}),await f(`${p.root}${A}/${$t}`,{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify(_)})}catch{console.warn("The `/reset` endpoint could not be called. Subsequent endpoint results may be unreliable.")}}const lt=async _=>{await this._resolve_heartbeat(_)};async function we(_){if(!p)return;let R=_.render_id;p.components=[...p.components.filter(E=>E.props.rendered_in!==R),..._.components],p.dependencies=[...p.dependencies.filter(E=>E.rendered_in!==R),..._.dependencies];const V=p.components.some(E=>E.type==="state"),w=p.dependencies.some(E=>E.targets.some(D=>D[1]==="unload"));p.connect_heartbeat=V||w,await lt(p),i({type:"render",data:_,endpoint:m,fn_index:d})}const ut=this.handle_blob(p.root,ot,me).then(async _=>{if(H={data:Z(_,q,p.components,"input",!0)||[],event_data:s,fn_index:d,trigger_id:n},Yt(d,p))i({type:"status",endpoint:m,stage:"pending",queue:!1,fn_index:d,time:new Date}),ne(`${p.root}${A}/run${m.startsWith("/")?m:`/${m}`}${z?"?"+z:""}`,{...H,session_hash:v}).then(async([w,E])=>{const D=w.data;E==200?(i({type:"data",endpoint:m,fn_index:d,data:Z(D,q,p.components,"output",J.with_null_state),time:new Date,event_data:s,trigger_id:n}),w.render_config&&await we(w.render_config),i({type:"status",endpoint:m,fn_index:d,stage:"complete",eta:w.average_duration,queue:!1,time:new Date})):i({type:"status",stage:"error",endpoint:m,fn_index:d,message:w.error,queue:!1,time:new Date})}).catch(w=>{i({type:"status",stage:"error",message:w.message,endpoint:m,fn_index:d,queue:!1,time:new Date})});else if(O=="sse"){i({type:"status",stage:"pending",queue:!0,endpoint:m,fn_index:d,time:new Date});var V=new URLSearchParams({fn_index:d.toString(),session_hash:v}).toString();let w=new URL(`${p.root}${A}/${Ze}?${z?z+"&":""}${V}`);if(this.jwt&&w.searchParams.set("__sign",this.jwt),j=this.stream(w),!j)return Promise.reject(new Error("Cannot connect to SSE endpoint: "+w.toString()));
4j.onmessage=async function(E){const D=JSON.parse(E.data),{type:I,status:P,data:C}=Fe(D,ge[d]);if(I==="update"&&P&&!T)i({type:"status",endpoint:m,fn_index:d,time:new Date,...P}),P.stage==="error"&&(j?.close(),o());else if(I==="data"){let[L,B]=await ne(`${p.root}${A}/queue/data`,{...H,session_hash:v,event_id:b});B!==200&&(i({type:"status",stage:"error",message:G,queue:!0,endpoint:m,fn_index:d,time:new Date}),j?.close(),o())}else I==="complete"?T=P:I==="log"?i({type:"log",title:C.title,log:C.log,level:C.level,endpoint:m,duration:C.duration,visible:C.visible,fn_index:d}):(I==="generating"||I==="streaming")&&i({type:"status",time:new Date,...P,stage:P?.stage,queue:!0,endpoint:m,fn_index:d});C&&(i({type:"data",time:new Date,data:Z(C.data,q,p.components,"output",J.with_null_state),endpoint:m,fn_index:d,event_data:s,trigger_id:n}),T&&(i({type:"status",time:new Date,...T,stage:P?.stage,queue:!0,endpoint:m,fn_index:d}),j?.close(),o()))}}else if(O=="sse_v1"||O=="sse_v2"||O=="sse_v2.1"||O=="sse_v3"){i({type:"status",stage:"pending",queue:!0,endpoint:m,fn_index:d,time:new Date});let w="";typeof window<"u"&&typeof document<"u"&&(w=window?.location?.hostname);const D=w.includes(".dev.")?`https://moon-${w.split(".")[1]}.dev.spaces.huggingface.tech`:"https://huggingface.co";return(typeof window<"u"&&typeof document<"u"&&window.parent!=window&&window.supports_zerogpu_headers?Qt("zerogpu-headers",D):Promise.resolve(null)).then(L=>ne(`${p.root}${A}/${wt}?${z}`,{...H,session_hash:v},L)).then(async([L,B])=>{if(L.event_id&&(U=L.event_id),B===503)i({type:"status",stage:"error",message:Ke,queue:!0,endpoint:m,fn_index:d,time:new Date,visible:!0});else if(B===422)i({type:"status",stage:"error",message:L.detail,queue:!0,endpoint:m,fn_index:d,code:"validation_error",time:new Date,visible:!0}),o();else if(B!==200)i({type:"status",stage:"error",broken:!1,message:L.detail,queue:!0,endpoint:m,fn_index:d,time:new Date,visible:!0});else{b=L.event_id,U=b;let be=async function(re){try{const{type:S,status:k,data:$,original_msg:ht}=Fe(re,ge[d]);if(S=="heartbeat")return;if(S==="update"&&k&&!T)i({type:"status",endpoint:m,fn_index:d,time:new Date,original_msg:ht,...k});else if(S==="complete")T=k;else if(S=="unexpected_error"||S=="broken_connection"){console.error("Unexpected error",k?.message);const ft=S==="broken_connection";i({type:"status",stage:"error",message:k?.message||"An Unexpected Error Occurred!",queue:!0,endpoint:m,broken:ft,session_not_found:k?.session_not_found,fn_index:d,time:new Date})}else if(S==="log"){i({type:"log",title:$.title,log:$.log,level:$.level,endpoint:m,duration:$.duration,visible:$.visible,fn_index:d});return}else(S==="generating"||S==="streaming")&&(i({type:"status",time:new Date,...k,stage:k?.stage,queue:!0,endpoint:m,fn_index:d}),$&&q.connection!=="stream"&&["sse_v2","sse_v2.1","sse_v3"].includes(O)&&_s(te,b,$));$&&(i({type:"data",time:new Date,data:Z($.data,q,p.components,"output",J.with_null_state),endpoint:m,fn_index:d}),$.render_config&&await we($.render_config),T&&(i({type:"status",time:new Date,...T,stage:k?.stage,queue:!0,endpoint:m,fn_index:d}),o())),(k?.stage==="complete"||k?.stage==="error")&&(se[b]&&delete se[b],b in te&&delete te[b])}catch(S){console.error("Unexpected client exception",S),i({type:"status",stage:"error",message:"An Unexpected Error Occurred!",queue:!0,endpoint:m,fn_index:d,time:new Date}),["sse_v2","sse_v2.1","sse_v3"].includes(O)&&(_e(x,rt.abort_controller),x.open=!1,o())}};b in ee&&(ee[b].forEach(re=>be(re)),delete ee[b]),se[b]=be,it.add(b),x.open||await this.open_stream()}})}});let pt=!1;const ie=[],M=[],ye={[Symbol.asyncIterator]:()=>ye,next:u,throw:async _=>(l(_),u()),return:async()=>(o(),{value:void 0,done:!0}),cancel:ct,send_chunk:_=>{this.post_data(`${p.root}${A}/stream/${U}`,{..._,session_hash:this.session_hash})},close_stream:()=>{this.post_data(`${p.root}${A}/stream/${U}/close`,{}),o()},event_id:()=>U,wait_for_id:async()=>(await ut,b)};return ye}catch(i){throw console.error("Submit function encountered an error:",i),i}}function bs(e){return{then:(t,s)=>s(e)}}function vs(e,t,s,n){let r,i,o;if(typeof t=="number")r=t,i=e.unnamed_endpoints[r],o=n.dependencies.find(a=>a.id==t);else{const a=t.replace(/^\//,"");r=s[a],i=e.named_endpoints[t.trim()],o=n.dependencies.find(l=>l.id==s[a])}if(typeof r!="number")throw new Error("There is no endpoint matching that name of fn_index matching that number.");return{fn_index:r,endpoint_info:i,dependency:o}}class Y{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(N);t===null&&(t=window.location.href);const s=o=>o.replace(/^\/+|\/+$/g,"");let n=s(new URL(this.config.root).pathname),r=s(new URL(t).pathname),i;return r.startsWith(n)?i=s(r.substring(n.length)):i="",this.get_page_config(i)}get_page_config(t){if(!this.config)throw new Error(N);let s=this.config;return t in s.page||(t=""),{...s,current_page:t,layout:s.page[t].layout,components:s.components.filter(n=>
vendor: 1,515 bytes, line 4
4s.page[t].components.includes(n.id)),dependencies:this.config.dependencies.filter(n=>s.page[t].dependencies.includes(n.id))}}fetch(t,s){const n=new Headers(s?.headers||{});if(this&&this.cookies&&n.append("Cookie",this.cookies),this&&this.options.headers)for(const r in this.options.headers)n.append(r,this.options.headers[r]);return fetch(t,{...s,headers:n})}stream(t){const s=new Headers;if(this&&this.cookies&&s.append("Cookie",this.cookies),this&&this.options.headers)for(const n in this.options.headers)s.append(n,this.options.headers[n]);return this&&this.options.token&&s.append("Authorization",`Bearer ${this.options.token}`),this.abort_controller=new AbortController,this.stream_instance=ws(t.toString(),{credentials:"include",headers:s,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,s={events:["data"]}){this.app_reference=t,this.deep_link=s.query_params?.deep_link||null,s.events||(s.events=["data"]),this.options=s,this.current_payload={},this.view_api=Ft.bind(this),this.upload_files=Gt.bind(this),this.handle_blob=Xt.bind(this),this.post_data=ss.bind(this),this.submit=ys.bind(this),this.predict=ns.bind(this),this.open_stream=ds.bind(this),this.resolve_config=It.bind(this),this.resolve_cookies=jt.bind(this),this.upload=Zt.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(){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=Dt(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 Me(this.config.space_id,this.options.token,this.cookies))),t.space_id&&this.options.token&&(this.jwt=await Me(t.space_id,this.options.token)),this.config&&this.config.connect_heartbeat){const s=new URL(`${this.config.root}${this.api_prefix}/${St}/${this.session_hash}`);this.jwt&&s.searchParams.set("__sign",this.jwt),this.heartbeat_event||(this.heartbeat_event=this.stream(s))}}static async connect(t,s={events:["data"]}){const n=new this(t,s);return s.session_hash&&(n.session_hash=s.session_hash),await n.init(),n}async reconnect(){const t=new URL(`${this.config.root}${this.api_prefix}/${At}`);let s;try{const n=await this.fetch(t);if(!n.ok)throw new Error;s=(await n.json()).app_id}catch{return"broken"}return s!==this.config.app_id?"changed":"connected"}close(){this.closed=!0,_e(this.stream_status,this.abort_controller)}set_current_payload(t){this.current_payload=t}static async duplicate(t,s={events:["data"]}){return as(t,s)}async _resolve_config(){const{http_protocol:t,host:s,space_id:n}=await de(this.app_reference,this.options.token),{status_callback:r}=this.options;n&&r&&await st(n,r);let i;try{let o=`${t}//${s}`;if(i=await this.resolve_config(o),!i)throw new Error(N);return this.config_success(i)}catch(o){if(n&&r)F(n,fe.test(n)?"space_name":"subdomain",this.handle_space_success);else throw r&&r({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(s){console.error(Tt+s.message)}return this.prepare_return_obj()}async handle_space_success(t){if(!this)throw new Error(N);const{status_callback:s}=this.options;if(s&&s(t),t.status==="running")try{if(this.config=await this._resolve_config(),this.api_prefix=this?.config?.api_prefix||"",!this.config)throw new Error(N);return await this.config_success(this.config)}catch(n){throw s&&s({status:"error",message:"Could not load this space.",load_status:"error",detail:"NOT_FOUND"}),n}}async component_server(t,s,n){if(!this.config)throw new Error(N);const r={},{token:i}=this.options,{session_hash:o}=this;i&&(r.Authorization=`Bearer ${this.options.token}`);let a,l=this.config.components.find(u=>u.id===t);l?.props?.root_url?a=l.props.root_url:a=this.config.root;let h;if("binary"in n){h=new FormData;for(const u in n.data)u!=="binary"&&h.append(u,n.data[u]);h.set("component_id",t.toString()),h.set("fn_name",s),h.set("session_hash",o)}else h=JSON.stringify({data:n,component_id:t,fn_name:s,session_hash:o}),r["Content-Type"]="application/json";i&&(r.Authorization=`Bearer ${i}`);try{const u=await this.fetch(`${a}${this.api_prefix}/${kt}/`,{method:"POST",body:h,headers:r,credentials:"include"});if(!u.ok)throw new Error("Could not connect to component server: "+u.statusText);return await u.json()}catch(u){console.warn(u)}}set_cookies(t){this.cookies=et(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 Es=typeof window<"u";if(Es){const e={};e.svelte={};for(const t in ve)e.svelte[t]=ve[t];e.svelte_animate={};for(const t in Se)e.svelte_animate[t]=Se[t];e.svelte_attachments={};for(const t in ke)e.svelte_attachments[t]=ke[t];e.svelte_easing={};for(const t in $e)e.svelte_easing[t]=$e[t];e.svelte_internal_client={};for(const t in Re)e.svelte_internal_client[t]=Re[t];e.svelte_internal_flags_async={};for(const t in Ae)e.svelte_internal_flags_async[t]=Ae[t];e.svelte_internal_flags_legacy={};for(const t in Oe)e.svelte_internal_flags_legacy[t]=Oe[t];e.svelte_internal_flags_tracing={};for(const t in Te)e.svelte_internal_flags_tracing[t]=Te[t];e.svelte_internal_server={};for(const t in Pe)e.svelte_internal_server[t]=Pe[t];e.svelte_legacy={};for(const t in Ce)e.svelte_legacy[t]=Ce[t];e.svelte_motion={};for(const t in Le)e.svelte_motion[t]=Le[t];e.svelte_reactivity={};for(const t in Ne)e.svelte_reactivity[t]=Ne[t];e.svelte_reactivity_window={};for(const t in xe)e.svelte_reactivity_window[t]=xe[t];e.svelte_server={};for(const t in De)e.svelte_server[t]=De[t];e.svelte_store={};for(const t in Ie)e.svelte_store[t]=Ie[t];e.svelte_transition={};for(const t in je)e.svelte_transition[t]=je[t];e.svelte_events={};for(const t in Ue)e.svelte_events[t]=Ue[t];window.__gradio__svelte__=e,window.__gradio__svelte__.globals={},window.globals=window}const Ss="./assets/index-D7cRHYCp.css";let le;le=[];let ue,pe,nt,ks=new Promise(e=>{nt=e});async function $s(){const e=await Promise.all([K(()=>import("./Index-Czfua_SX.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]),import.meta.url),K(()=>import("./index-CQPuV1pp.js"),__vite__mapDeps([11,1,2,12,13,14]),import.meta.url)]);ue=e[0].default,pe=e[1].mount_css,nt()}function Rs(){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 $s(),this.loading=!0,this.app&&this.app.$destroy(),typeof le!="string"&&le.forEach(i=>
4pe(i,document.head)),await pe(Ss,document.head);const s=new CustomEvent("domchange",{bubbles:!0,cancelable:!1,composed:!0});new MutationObserver(i=>{this.dispatchEvent(s)}).observe(this,{childList:!0});const r={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-1-0",theme_mode:this.theme_mode,autoscroll:this.autoscroll==="true",control_page_title:this.control_page_title==="true",Client:Y,app_mode:window.__gradio_mode__==="app"}};this.app=Ee(ue,r),this.updating&&this.setAttribute(this.updating.name,this.updating.value),this.loading=!1}static get observedAttributes(){return["src","space","host"]}async attributeChangedCallback(s,n,r){if(await ks,(s==="host"||s==="space"||s==="src")&&r!==n){if(this.updating={name:s,value:r},this.loading)return;this.app&&dt(this.app),this.space=null,this.host=null,this.src=null,s==="host"?this.host=r:s==="space"?this.space=r:s==="src"&&(this.src=r);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-1-0",theme_mode:this.theme_mode,autoscroll:this.autoscroll==="true",control_page_title:this.control_page_title==="true",Client:Y,app_mode:window.__gradio_mode__==="app"}};this.app=Ee(ue,i),this.updating=!1}}}customElements.get("gradio-app")||customElements.define("gradio-app",e)}Rs();export{Q as F,K as _,Ts as p};
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.