diff --git "a/FINAL_LOGO/IllusionDiffusion - a Hugging Face Space by AP123_6_files/a_data/index-59874607.js" "b/FINAL_LOGO/IllusionDiffusion - a Hugging Face Space by AP123_6_files/a_data/index-59874607.js" new file mode 100644--- /dev/null +++ "b/FINAL_LOGO/IllusionDiffusion - a Hugging Face Space by AP123_6_files/a_data/index-59874607.js" @@ -0,0 +1,18 @@ +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))o(n);new MutationObserver(n=>{for(const i of n)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&o(a)}).observe(document,{childList:!0,subtree:!0});function r(n){const i={};return n.integrity&&(i.integrity=n.integrity),n.referrerPolicy&&(i.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?i.credentials="include":n.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function o(n){if(n.ep)return;n.ep=!0;const i=r(n);fetch(n.href,i)}})();var Ac=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function so(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Et={},et={},sr={exports:{}},F=String,lo=function(){return{isColorSupported:!1,reset:F,bold:F,dim:F,italic:F,underline:F,inverse:F,hidden:F,strikethrough:F,black:F,red:F,green:F,yellow:F,blue:F,magenta:F,cyan:F,white:F,gray:F,bgBlack:F,bgRed:F,bgGreen:F,bgYellow:F,bgBlue:F,bgMagenta:F,bgCyan:F,bgWhite:F}};sr.exports=lo();sr.exports.createColors=lo;var Hi=sr.exports;Object.defineProperty(et,"__esModule",{value:!0});et.dim=Ni;et.default=void 0;var ve=Ci(Hi);function Ci(e){return e&&e.__esModule?e:{default:e}}let gr=new Set;function Ht(e,t,r){typeof process<"u"&&{}.JEST_WORKER_ID||r&&gr.has(r)||(r&&gr.add(r),console.warn(""),t.forEach(o=>console.warn(e,"-",o)))}function Ni(e){return ve.default.dim(e)}var Oi={info(e,t){Ht(ve.default.bold(ve.default.cyan("info")),...Array.isArray(e)?[e]:[t,e])},warn(e,t){Ht(ve.default.bold(ve.default.yellow("warn")),...Array.isArray(e)?[e]:[t,e])},risk(e,t){Ht(ve.default.bold(ve.default.magenta("risk")),...Array.isArray(e)?[e]:[t,e])}};et.default=Oi;Object.defineProperty(Et,"__esModule",{value:!0});Et.default=void 0;var Mi=Ii(et);function Ii(e){return e&&e.__esModule?e:{default:e}}function qe({version:e,from:t,to:r}){Mi.default.warn(`${t}-color-renamed`,[`As of Tailwind CSS ${e}, \`${t}\` has been renamed to \`${r}\`.`,"Update your configuration file to silence this warning."])}var Li={inherit:"inherit",current:"currentColor",transparent:"transparent",black:"#000",white:"#fff",slate:{50:"#f8fafc",100:"#f1f5f9",200:"#e2e8f0",300:"#cbd5e1",400:"#94a3b8",500:"#64748b",600:"#475569",700:"#334155",800:"#1e293b",900:"#0f172a"},gray:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#1f2937",900:"#111827"},zinc:{50:"#fafafa",100:"#f4f4f5",200:"#e4e4e7",300:"#d4d4d8",400:"#a1a1aa",500:"#71717a",600:"#52525b",700:"#3f3f46",800:"#27272a",900:"#18181b"},neutral:{50:"#fafafa",100:"#f5f5f5",200:"#e5e5e5",300:"#d4d4d4",400:"#a3a3a3",500:"#737373",600:"#525252",700:"#404040",800:"#262626",900:"#171717"},stone:{50:"#fafaf9",100:"#f5f5f4",200:"#e7e5e4",300:"#d6d3d1",400:"#a8a29e",500:"#78716c",600:"#57534e",700:"#44403c",800:"#292524",900:"#1c1917"},red:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d"},orange:{50:"#fff7ed",100:"#ffedd5",200:"#fed7aa",300:"#fdba74",400:"#fb923c",500:"#f97316",600:"#ea580c",700:"#c2410c",800:"#9a3412",900:"#7c2d12"},amber:{50:"#fffbeb",100:"#fef3c7",200:"#fde68a",300:"#fcd34d",400:"#fbbf24",500:"#f59e0b",600:"#d97706",700:"#b45309",800:"#92400e",900:"#78350f"},yellow:{50:"#fefce8",100:"#fef9c3",200:"#fef08a",300:"#fde047",400:"#facc15",500:"#eab308",600:"#ca8a04",700:"#a16207",800:"#854d0e",900:"#713f12"},lime:{50:"#f7fee7",100:"#ecfccb",200:"#d9f99d",300:"#bef264",400:"#a3e635",500:"#84cc16",600:"#65a30d",700:"#4d7c0f",800:"#3f6212",900:"#365314"},green:{50:"#f0fdf4",100:"#dcfce7",200:"#bbf7d0",300:"#86efac",400:"#4ade80",500:"#22c55e",600:"#16a34a",700:"#15803d",800:"#166534",900:"#14532d"},emerald:{50:"#ecfdf5",100:"#d1fae5",200:"#a7f3d0",300:"#6ee7b7",400:"#34d399",500:"#10b981",600:"#059669",700:"#047857",800:"#065f46",900:"#064e3b"},teal:{50:"#f0fdfa",100:"#ccfbf1",200:"#99f6e4",300:"#5eead4",400:"#2dd4bf",500:"#14b8a6",600:"#0d9488",700:"#0f766e",800:"#115e59",900:"#134e4a"},cyan:{50:"#ecfeff",100:"#cffafe",200:"#a5f3fc",300:"#67e8f9",400:"#22d3ee",500:"#06b6d4",600:"#0891b2",700:"#0e7490",800:"#155e75",900:"#164e63"},sky:{50:"#f0f9ff",100:"#e0f2fe",200:"#bae6fd",300:"#7dd3fc",400:"#38bdf8",500:"#0ea5e9",600:"#0284c7",700:"#0369a1",800:"#075985",900:"#0c4a6e"},blue:{50:"#eff6ff",100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#3b82f6",600:"#2563eb",700:"#1d4ed8",800:"#1e40af",900:"#1e3a8a"},indigo:{50:"#eef2ff",100:"#e0e7ff",200:"#c7d2fe",300:"#a5b4fc",400:"#818cf8",500:"#6366f1",600:"#4f46e5",700:"#4338ca",800:"#3730a3",900:"#312e81"},violet:{50:"#f5f3ff",100:"#ede9fe",200:"#ddd6fe",300:"#c4b5fd",400:"#a78bfa",500:"#8b5cf6",600:"#7c3aed",700:"#6d28d9",800:"#5b21b6",900:"#4c1d95"},purple:{50:"#faf5ff",100:"#f3e8ff",200:"#e9d5ff",300:"#d8b4fe",400:"#c084fc",500:"#a855f7",600:"#9333ea",700:"#7e22ce",800:"#6b21a8",900:"#581c87"},fuchsia:{50:"#fdf4ff",100:"#fae8ff",200:"#f5d0fe",300:"#f0abfc",400:"#e879f9",500:"#d946ef",600:"#c026d3",700:"#a21caf",800:"#86198f",900:"#701a75"},pink:{50:"#fdf2f8",100:"#fce7f3",200:"#fbcfe8",300:"#f9a8d4",400:"#f472b6",500:"#ec4899",600:"#db2777",700:"#be185d",800:"#9d174d",900:"#831843"},rose:{50:"#fff1f2",100:"#ffe4e6",200:"#fecdd3",300:"#fda4af",400:"#fb7185",500:"#f43f5e",600:"#e11d48",700:"#be123c",800:"#9f1239",900:"#881337"},get lightBlue(){return qe({version:"v2.2",from:"lightBlue",to:"sky"}),this.sky},get warmGray(){return qe({version:"v3.0",from:"warmGray",to:"stone"}),this.stone},get trueGray(){return qe({version:"v3.0",from:"trueGray",to:"neutral"}),this.neutral},get coolGray(){return qe({version:"v3.0",from:"coolGray",to:"gray"}),this.gray},get blueGray(){return qe({version:"v3.0",from:"blueGray",to:"slate"}),this.slate}};Et.default=Li;let Ct=Et;var Ri=(Ct.__esModule?Ct:{default:Ct}).default;const mr=so(Ri),Tc=["red","green","blue","yellow","purple","teal","orange","cyan","lime","pink"],zi=[{color:"red",primary:600,secondary:100},{color:"green",primary:600,secondary:100},{color:"blue",primary:600,secondary:100},{color:"yellow",primary:500,secondary:100},{color:"purple",primary:600,secondary:100},{color:"teal",primary:600,secondary:100},{color:"orange",primary:600,secondary:100},{color:"cyan",primary:600,secondary:100},{color:"lime",primary:500,secondary:100},{color:"pink",primary:600,secondary:100}],Bc=zi.reduce((e,{color:t,primary:r,secondary:o})=>({...e,[t]:{primary:mr[t][r],secondary:mr[t][o]}}),{}),Di="modulepreload",ji=function(e,t){return new URL(e,t).href},br={},pt=function(t,r,o){if(!r||r.length===0)return t();const n=document.getElementsByTagName("link");return Promise.all(r.map(i=>{if(i=ji(i,o),i in br)return;br[i]=!0;const a=i.endsWith(".css"),l=a?'[rel="stylesheet"]':"";if(!!o)for(let c=n.length-1;c>=0;c--){const f=n[c];if(f.href===i&&(!a||f.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${i}"]${l}`))return;const s=document.createElement("link");if(s.rel=a?"stylesheet":Di,a||(s.as="script",s.crossOrigin=""),s.href=i,document.head.appendChild(s),a)return new Promise((c,f)=>{s.addEventListener("load",c),s.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${i}`)))})})).then(()=>t())};var Nt=new Intl.Collator(0,{numeric:1}).compare;function yr(e,t,r){return e=e.split("."),t=t.split("."),Nt(e[0],t[0])||Nt(e[1],t[1])||(t[2]=t.slice(2).join("."),r=/[.-]/.test(e[2]=e.slice(2).join(".")),r==/[.-]/.test(t[2])?Nt(e[2],t[2]):r?-1:1)}function Ot(e){if(e.startsWith("http")){const{protocol:t,host:r}=new URL(e);return r.endsWith("hf.space")?{ws_protocol:"wss",host:r,http_protocol:t}:{ws_protocol:t==="https:"?"wss":"ws",http_protocol:t,host:r}}return{ws_protocol:"wss",http_protocol:"https:",host:e}}const co=/^[^\/]*\/[^\/]*$/,Ui=/.*hf\.space\/{0,1}$/;async function Gi(e,t){const r={};t&&(r.Authorization=`Bearer ${t}`);const o=e.trim();if(co.test(o))try{const n=await fetch(`https://huggingface.co/api/spaces/${o}/host`,{headers:r});if(n.status!==200)throw new Error("Space metadata could not be loaded.");const i=(await n.json()).host;return{space_id:e,...Ot(i)}}catch(n){throw new Error("Space metadata could not be loaded."+n.message)}if(Ui.test(o)){const{ws_protocol:n,http_protocol:i,host:a}=Ot(o);return{space_id:a.replace(".hf.space",""),ws_protocol:n,http_protocol:i,host:a}}return{space_id:!1,...Ot(o)}}function Fi(e){let t={};return e.forEach(({api_name:r},o)=>{r&&(t[r]=o)}),t}const qi=/^(?=[^]*\b[dD]iscussions{0,1}\b)(?=[^]*\b[dD]isabled\b)[^]*$/;async function vr(e){try{const r=(await fetch(`https://huggingface.co/api/spaces/${e}/discussions`,{method:"HEAD"})).headers.get("x-error-message");return!(r&&qi.test(r))}catch{return!1}}const Vi="This application is too busy. Keep trying!",it="Connection errored out.";let uo;function Xi(e){return{post_data:t,upload_files:r,client:o,handle_blob:n};async function t(i,a,l){const u={"Content-Type":"application/json"};l&&(u.Authorization=`Bearer ${l}`);try{var s=await e(i,{method:"POST",body:JSON.stringify(a),headers:u})}catch{return[{error:it},500]}return[await s.json(),s.status]}async function r(i,a,l){const u={};l&&(u.Authorization=`Bearer ${l}`);const s=1e3,c=[];for(let d=0;d{p.append("files",y)});try{var f=await e(`${i}/upload`,{method:"POST",body:p,headers:u})}catch{return{error:it}}const g=await f.json();c.push(...g)}return{files:c}}async function o(i,a={normalise_files:!0}){return new Promise(async l=>{const{status_callback:u,hf_token:s,normalise_files:c}=a,f={predict:j,submit:X,view_api:U},d=c??!0;if(typeof window>"u"||!("WebSocket"in window)){const C=await pt(()=>import("./wrapper-6f348d45-38be7a64.js"),["./wrapper-6f348d45-38be7a64.js","./__vite-browser-external-b25bb000.js"],import.meta.url);uo=(await pt(()=>import("./__vite-browser-external-b25bb000.js"),[],import.meta.url)).Blob,global.WebSocket=C.WebSocket}const{ws_protocol:_,http_protocol:p,host:g,space_id:y}=await Gi(i,s),w=Math.random().toString(36).substring(2),E={};let h,v={},A=!1;s&&y&&(A=await Zi(y,s));async function I(C){if(h=C,v=Fi(C?.dependencies||[]),h.auth_required)return{config:h,...f};try{S=await U(h)}catch(R){console.error(`Could not get api details: ${R.message}`)}return{config:h,...f}}let S;async function H(C){if(u&&u(C),C.status==="running")try{h=await Ar(e,`${p}//${g}`,s);const R=await I(h);l(R)}catch(R){console.error(R),u&&u({status:"error",message:"Could not load this space.",load_status:"error",detail:"NOT_FOUND"})}}try{h=await Ar(e,`${p}//${g}`,s);const C=await I(h);l(C)}catch(C){console.error(C),y?qt(y,co.test(y)?"space_name":"subdomain",H):u&&u({status:"error",message:"Could not load this space.",load_status:"error",detail:"NOT_FOUND"})}function j(C,R,oe){let P=!1,ue=!1,W;if(typeof C=="number")W=h.dependencies[C];else{const L=C.replace(/^\//,"");W=h.dependencies[v[L]]}if(W.types.continuous)throw new Error("Cannot call predict on this function as it may run forever. Use submit instead");return new Promise((L,ee)=>{const le=X(C,R,oe);let fe;le.on("data",G=>{ue&&(le.destroy(),L(G)),P=!0,fe=G}).on("status",G=>{G.stage==="error"&&ee(G),G.stage==="complete"&&(ue=!0,le.destroy(),P&&L(fe))})})}function X(C,R,oe){let P,ue;if(typeof C=="number")P=C,ue=S.unnamed_endpoints[P];else{const J=C.replace(/^\//,"");P=v[J],ue=S.named_endpoints[C.trim()]}if(typeof P!="number")throw new Error("There is no endpoint matching that name of fn_index matching that number.");let W;const L=typeof C=="number"?"/predict":C;let ee,le=!1;const fe={};n(`${p}//${g+h.path}`,R,ue,s).then(J=>{if(ee={data:J||[],event_data:oe,fn_index:P},Yi(P,h))G({type:"status",endpoint:L,stage:"pending",queue:!1,fn_index:P,time:new Date}),t(`${p}//${g+h.path}/run${L.startsWith("/")?L:`/${L}`}`,{...ee,session_hash:w},s).then(([Q,ne])=>{const ie=d?Er(Q.data,ue,h.root,h.root_url):Q.data;ne==200?(G({type:"data",endpoint:L,fn_index:P,data:ie,time:new Date}),G({type:"status",endpoint:L,fn_index:P,stage:"complete",eta:Q.average_duration,queue:!1,time:new Date})):G({type:"status",stage:"error",endpoint:L,fn_index:P,message:Q.error,queue:!1,time:new Date})}).catch(Q=>{G({type:"status",stage:"error",message:Q.message,endpoint:L,fn_index:P,queue:!1,time:new Date})});else{G({type:"status",stage:"pending",queue:!0,endpoint:L,fn_index:P,time:new Date});let Q=new URL(`${_}://${g}${h.path} + /queue/join`);A&&Q.searchParams.set("__sign",A),W=new WebSocket(Q),W.onclose=ne=>{ne.wasClean||G({type:"status",stage:"error",broken:!0,message:it,queue:!0,endpoint:L,fn_index:P,time:new Date})},W.onmessage=function(ne){const ie=JSON.parse(ne.data),{type:m,status:Z,data:V}=Qi(ie,E[P]);if(m==="update"&&Z&&!le)G({type:"status",endpoint:L,fn_index:P,time:new Date,...Z}),Z.stage==="error"&&W.close();else if(m==="hash"){W.send(JSON.stringify({fn_index:P,session_hash:w}));return}else m==="data"?W.send(JSON.stringify({...ee,session_hash:w})):m==="complete"?le=Z:m==="log"?G({type:"log",log:V.log,level:V.level,endpoint:L,fn_index:P}):m==="generating"&&G({type:"status",time:new Date,...Z,stage:Z?.stage,queue:!0,endpoint:L,fn_index:P});V&&(G({type:"data",time:new Date,data:d?Er(V.data,ue,h.root,h.root_url):V.data,endpoint:L,fn_index:P}),le&&(G({type:"status",time:new Date,...le,stage:Z?.stage,queue:!0,endpoint:L,fn_index:P}),W.close()))},yr(h.version||"2.0.0","3.6")<0&&addEventListener("open",()=>W.send(JSON.stringify({hash:w})))}});function G(J){const ne=fe[J.type]||[];ne?.forEach(ie=>ie(J))}function x(J,Q){const ne=fe,ie=ne[J]||[];return ne[J]=ie,ie?.push(Q),{on:x,off:Ae,cancel:Ge,destroy:Fe}}function Ae(J,Q){const ne=fe;let ie=ne[J]||[];return ie=ie?.filter(m=>m!==Q),ne[J]=ie,{on:x,off:Ae,cancel:Ge,destroy:Fe}}async function Ge(){const J={stage:"complete",queue:!1,time:new Date};le=J,G({...J,type:"status",endpoint:L,fn_index:P}),W&&W.readyState===0?W.addEventListener("open",()=>{W.close()}):W.close();try{await e(`${p}//${g+h.path}/reset`,{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify({fn_index:P,session_hash:w})})}catch{console.warn("The `/reset` endpoint could not be called. Subsequent endpoint results may be unreliable.")}}function Fe(){for(const J in fe)fe[J].forEach(Q=>{Ae(J,Q)})}return{on:x,off:Ae,cancel:Ge,destroy:Fe}}async function U(C){if(S)return S;const R={"Content-Type":"application/json"};s&&(R.Authorization=`Bearer ${s}`);let oe;if(yr(C.version||"2.0.0","3.30")<0?oe=await e("https://gradio-space-api-fetcher-v2.hf.space/api",{method:"POST",body:JSON.stringify({serialize:!1,config:JSON.stringify(C)}),headers:R}):oe=await e(`${C.root}/info`,{headers:R}),!oe.ok)throw new Error(it);let P=await oe.json();return"api"in P&&(P=P.api),P.named_endpoints["/predict"]&&!P.unnamed_endpoints[0]&&(P.unnamed_endpoints[0]=P.named_endpoints["/predict"]),Wi(P,C,v)}})}async function n(i,a,l,u){const s=await Ft(a,void 0,[],!0,l);return Promise.all(s.map(async({path:c,blob:f,data:d,type:_})=>{if(f){const p=(await r(i,[f],u)).files[0];return{path:c,file_url:p,type:_}}return{path:c,base64:d,type:_}})).then(c=>(c.forEach(({path:f,file_url:d,base64:_,type:p})=>{if(_)Mt(a,_,f);else if(p==="Gallery")Mt(a,d,f);else if(d){const g={is_file:!0,name:`${d}`,data:null};Mt(a,g,f)}}),a))}}const{post_data:Pc,upload_files:wr,client:xr,handle_blob:Hc}=Xi(fetch);function Er(e,t,r,o){return e.map((n,i)=>{var a,l,u,s;return((l=(a=t?.returns)==null?void 0:a[i])==null?void 0:l.component)==="File"?We(n,r,o):((s=(u=t?.returns)==null?void 0:u[i])==null?void 0:s.component)==="Gallery"?n.map(c=>Array.isArray(c)?[We(c[0],r,o),c[1]]:[We(c,r,o),null]):typeof n=="object"&&n?.is_file?We(n,r,o):n})}function We(e,t,r){if(e==null)return null;if(typeof e=="string")return{name:"file_data",data:e};if(Array.isArray(e)){const o=[];for(const n of e)n===null?o.push(null):o.push(We(n,t,r));return o}else e.is_file&&(r?e.data="/proxy="+r+"file="+e.name:e.data=t+"/file="+e.name);return e}function Sr(e,t,r,o){switch(e.type){case"string":return"string";case"boolean":return"boolean";case"number":return"number"}if(r==="JSONSerializable"||r==="StringSerializable")return"any";if(r==="ListStringSerializable")return"string[]";if(t==="Image")return o==="parameter"?"Blob | File | Buffer":"string";if(r==="FileSerializable")return e?.type==="array"?o==="parameter"?"(Blob | File | Buffer)[]":"{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}[]":o==="parameter"?"Blob | File | Buffer":"{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}";if(r==="GallerySerializable")return o==="parameter"?"[(Blob | File | Buffer), (string | null)][]":"[{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}, (string | null))][]"}function kr(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 Wi(e,t,r){const o={named_endpoints:{},unnamed_endpoints:{}};for(const n in e){const i=e[n];for(const a in i){const l=t.dependencies[a]?a:r[a.replace("/","")],u=i[a];o[n][a]={},o[n][a].parameters={},o[n][a].returns={},o[n][a].type=t.dependencies[l].types,o[n][a].parameters=u.parameters.map(({label:s,component:c,type:f,serializer:d})=>({label:s,component:c,type:Sr(f,c,d,"parameter"),description:kr(f,d)})),o[n][a].returns=u.returns.map(({label:s,component:c,type:f,serializer:d})=>({label:s,component:c,type:Sr(f,c,d,"return"),description:kr(f,d)}))}}return o}async function Zi(e,t){try{return(await(await fetch(`https://huggingface.co/api/spaces/${e}/jwt`,{headers:{Authorization:`Bearer ${t}`}})).json()).token||!1}catch(r){return console.error(r),!1}}function Mt(e,t,r){for(;r.length>1;)e=e[r.shift()];e[r.shift()]=t}async function Ft(e,t=void 0,r=[],o=!1,n=void 0){if(Array.isArray(e)){let i=[];return await Promise.all(e.map(async(a,l)=>{var u;let s=r.slice();s.push(l);const c=await Ft(e[l],o?((u=n?.parameters[l])==null?void 0:u.component)||void 0:t,s,!1,n);i=i.concat(c)})),i}else if(globalThis.Buffer&&e instanceof globalThis.Buffer){const i=t==="Image";return[{path:r,blob:i?!1:new uo([e]),data:i?`${e.toString("base64")}`:!1,type:t}]}else if(e instanceof Blob||typeof window<"u"&&e instanceof File){if(t==="Image"){let i;if(typeof window<"u")i=await Ji(e);else{const a=await e.arrayBuffer();i=Buffer.from(a).toString("base64")}return[{path:r,data:i,type:t,blob:!1}]}return[{path:r,blob:e,type:t,data:!1}]}else if(typeof e=="object"){let i=[];for(let a in e)if(e.hasOwnProperty(a)){let l=r.slice();l.push(a),i=i.concat(await Ft(e[a],void 0,l,!1,n))}return i}return[]}function Ji(e){return new Promise((t,r)=>{const o=new FileReader;o.onloadend=()=>t(o.result),o.readAsDataURL(e)})}function Yi(e,t){var r,o,n,i;return!(((o=(r=t?.dependencies)==null?void 0:r[e])==null?void 0:o.queue)===null?t.enable_queue:(i=(n=t?.dependencies)==null?void 0:n[e])!=null&&i.queue)||!1}async function Ar(e,t,r){const o={};if(r&&(o.Authorization=`Bearer ${r}`),typeof window<"u"&&window.gradio_config&&location.origin!=="http://localhost:9876"&&!window.gradio_config.dev_mode){const n=window.gradio_config.root,i=window.gradio_config;return i.root=t+i.root,{...i,path:n}}else if(t){let n=await e(`${t}/config`,{headers:o});if(n.status===200){const i=await n.json();return i.path=i.path??"",i.root=t,i}throw new Error("Could not get config.")}throw new Error("No config or app endpoint found")}async function qt(e,t,r){let o=t==="subdomain"?`https://huggingface.co/api/spaces/by-subdomain/${e}`:`https://huggingface.co/api/spaces/${e}`,n,i;try{if(n=await fetch(o),i=n.status,i!==200)throw new Error;n=await n.json()}catch{r({status:"error",load_status:"error",message:"Could not get space status",detail:"NOT_FOUND"});return}if(!n||i!==200)return;const{runtime:{stage:a},id:l}=n;switch(a){case"STOPPED":case"SLEEPING":r({status:"sleeping",load_status:"pending",message:"Space is asleep. Waking it up...",detail:a}),setTimeout(()=>{qt(e,t,r)},1e3);break;case"PAUSED":r({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:a,discussions_enabled:await vr(l)});break;case"RUNNING":case"RUNNING_BUILDING":r({status:"running",load_status:"complete",message:"",detail:a});break;case"BUILDING":r({status:"building",load_status:"pending",message:"Space is building...",detail:a}),setTimeout(()=>{qt(e,t,r)},1e3);break;default:r({status:"space_error",load_status:"error",message:"This space is experiencing an issue.",detail:a,discussions_enabled:await vr(l)});break}}function Qi(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:Vi,stage:"error",code:e.code,success:e.success}};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},data:e.success?e.output:null};case"process_completed":return"error"in e.output?{type:"update",status:{queue:!0,message:e.output.error,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,eta:e.output.average_duration},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}}}return{type:"none",status:{stage:"error",queue:!0}}}function Vt(e,t){if(document.querySelector(`link[href='${e}']`))return Promise.resolve();const o=document.createElement("link");return o.rel="stylesheet",o.href=e,new Promise((n,i)=>{o.addEventListener("load",()=>n()),o.addEventListener("error",()=>{console.error(`Unable to preload CSS for ${e}`),n()}),t.appendChild(o)})}function K(){}const lr=e=>e;function fo(e,t){for(const r in t)e[r]=t[r];return e}function ho(e){return e()}function Tr(){return Object.create(null)}function pe(e){e.forEach(ho)}function Ee(e){return typeof e=="function"}function tt(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}let at;function Ki(e,t){return at||(at=document.createElement("a")),at.href=t,e===at.href}function $i(e){return Object.keys(e).length===0}function po(e,...t){if(e==null){for(const o of t)o(void 0);return K}const r=e.subscribe(...t);return r.unsubscribe?()=>r.unsubscribe():r}function xe(e,t,r){e.$$.on_destroy.push(po(t,r))}function _o(e,t,r,o){if(e){const n=go(e,t,r,o);return e[0](n)}}function go(e,t,r,o){return e[1]&&o?fo(r.ctx.slice(),e[1](o(t))):r.ctx}function mo(e,t,r,o){if(e[2]&&o){const n=e[2](o(r));if(t.dirty===void 0)return n;if(typeof n=="object"){const i=[],a=Math.max(t.dirty.length,n.length);for(let l=0;l32){const t=[],r=e.ctx.length/32;for(let o=0;owindow.performance.now():()=>Date.now(),cr=vo?e=>requestAnimationFrame(e):K;const Ce=new Set;function wo(e){Ce.forEach(t=>{t.c(e)||(Ce.delete(t),t.f())}),Ce.size!==0&&cr(wo)}function St(e){let t;return Ce.size===0&&cr(wo),{promise:new Promise(r=>{Ce.add(t={c:e,f:r})}),abort(){Ce.delete(t)}}}const ea=typeof window<"u"?window:typeof globalThis<"u"?globalThis:global;"WeakMap"in ea;function B(e,t){e.appendChild(t)}function xo(e){if(!e)return document;const t=e.getRootNode?e.getRootNode():e.ownerDocument;return t&&t.host?t:e.ownerDocument}function ta(e){const t=D("style");return t.textContent="/* empty */",ra(xo(e),t),t.sheet}function ra(e,t){return B(e.head||e,t),t.sheet}function T(e,t,r){e.insertBefore(t,r||null)}function k(e){e.parentNode&&e.parentNode.removeChild(e)}function Eo(e,t){for(let r=0;re.removeEventListener(t,r,o)}function Ic(e){return function(t){return t.preventDefault(),e.call(this,t)}}function Lc(e){return function(t){return t.stopPropagation(),e.call(this,t)}}function b(e,t,r){r==null?e.removeAttribute(t):e.getAttribute(t)!==r&&e.setAttribute(t,r)}const oa=["width","height"];function na(e,t){const r=Object.getOwnPropertyDescriptors(e.__proto__);for(const o in t)t[o]==null?e.removeAttribute(o):o==="style"?e.style.cssText=t[o]:o==="__value"?e.value=e[o]=t[o]:r[o]&&r[o].set&&oa.indexOf(o)===-1?e[o]=t[o]:b(e,o,t[o])}function ia(e,t){Object.keys(t).forEach(r=>{aa(e,r,t[r])})}function aa(e,t,r){t in e?e[t]=typeof e[t]=="boolean"&&r===""?!0:r:b(e,t,r)}function Rc(e){return/-/.test(e)?ia:na}function zc(e){let t;return{p(...r){t=r,t.forEach(o=>e.push(o))},r(){t.forEach(r=>e.splice(e.indexOf(r),1))}}}function Dc(e){return e===""?null:+e}function sa(e){return Array.from(e.childNodes)}function re(e,t){t=""+t,e.data!==t&&(e.data=t)}function jc(e,t){e.value=t??""}function ae(e,t,r,o){r==null?e.style.removeProperty(t):e.style.setProperty(t,r,o?"important":"")}let st;function la(){if(st===void 0){st=!1;try{typeof window<"u"&&window.parent&&window.parent.document}catch{st=!0}}return st}function Uc(e,t){getComputedStyle(e).position==="static"&&(e.style.position="relative");const o=D("iframe");o.setAttribute("style","display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;"),o.setAttribute("aria-hidden","true"),o.tabIndex=-1;const n=la();let i;return n?(o.src="data:text/html,