diff --git "a/_app/immutable/nodes/2.7e90e579.js" "b/_app/immutable/nodes/2.7e90e579.js" deleted file mode 100644--- "a/_app/immutable/nodes/2.7e90e579.js" +++ /dev/null @@ -1,70 +0,0 @@ -var oa=Object.defineProperty;var la=(r,e,t)=>e in r?oa(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var pt=(r,e,t)=>(la(r,typeof e!="symbol"?e+"":e,t),t);import{S as Ve,i as Re,s as Fe,J as le,K as ce,m as _,h as v,n as g,b as I,G as b,H as z,k as O,a as j,l as A,c as V,L as tt,M as N,q as U,r as B,u as Qe,N as Ur,O as ca,P as ua,Q as ot,w as Se,R as da,e as rt,T as at,U as Pe,I as Ye,o as fa,V as $e,W as Xt,y as Ue,z as Be,A as xe,X as ze,g as ae,d as ue,f as Br,Y as ha,B as Me,v as xr}from"../chunks/index.972f6cff.js";import{w as Mt,j as pa}from"../chunks/singletons.2db0ced3.js";function ma(r){let e,t,a,n,d,l,i,s,c,u,o,f;return{c(){e=le("svg"),t=le("path"),a=le("path"),n=le("path"),d=le("mask"),l=le("path"),i=le("g"),s=le("path"),c=le("path"),u=le("path"),o=le("path"),f=le("path"),this.h()},l(h){e=ce(h,"svg",{class:!0,xmlns:!0,width:!0,height:!0,fill:!0,viewBox:!0});var p=_(e);t=ce(p,"path",{fill:!0,d:!0}),_(t).forEach(v),a=ce(p,"path",{fill:!0,d:!0}),_(a).forEach(v),n=ce(p,"path",{fill:!0,d:!0}),_(n).forEach(v),d=ce(p,"mask",{id:!0,width:!0,height:!0,x:!0,y:!0,maskUnits:!0});var m=_(d);l=ce(m,"path",{fill:!0,d:!0}),_(l).forEach(v),m.forEach(v),i=ce(p,"g",{mask:!0});var y=_(i);s=ce(y,"path",{fill:!0,d:!0}),_(s).forEach(v),y.forEach(v),c=ce(p,"path",{fill:!0,d:!0}),_(c).forEach(v),u=ce(p,"path",{fill:!0,d:!0}),_(u).forEach(v),o=ce(p,"path",{fill:!0,d:!0}),_(o).forEach(v),f=ce(p,"path",{fill:!0,d:!0}),_(f).forEach(v),p.forEach(v),this.h()},h(){g(t,"fill","#FFD21E"),g(t,"d","M47.21 76.5a34.75 34.75 0 1 0 0-69.5 34.75 34.75 0 0 0 0 69.5Z"),g(a,"fill","#FF9D0B"),g(a,"d","M81.96 41.75a34.75 34.75 0 1 0-69.5 0 34.75 34.75 0 0 0 69.5 0Zm-73.5 0a38.75 38.75 0 1 1 77.5 0 38.75 38.75 0 0 1-77.5 0Z"),g(n,"fill","#3A3B45"),g(n,"d","M58.5 32.3c1.28.44 1.78 3.06 3.07 2.38a5 5 0 1 0-6.76-2.07c.61 1.15 2.55-.72 3.7-.32ZM34.95 32.3c-1.28.44-1.79 3.06-3.07 2.38a5 5 0 1 1 6.76-2.07c-.61 1.15-2.56-.72-3.7-.32ZM46.96 56.29c9.83 0 13-8.76 13-13.26 0-2.34-1.57-1.6-4.09-.36-2.33 1.15-5.46 2.74-8.9 2.74-7.19 0-13-6.88-13-2.38s3.16 13.26 13 13.26Z"),g(l,"fill","#fff"),g(l,"d","M46.96 56.29c9.83 0 13-8.76 13-13.26 0-2.34-1.57-1.6-4.09-.36-2.33 1.15-5.46 2.74-8.9 2.74-7.19 0-13-6.88-13-2.38s3.16 13.26 13 13.26Z"),g(d,"id","a"),g(d,"width","27"),g(d,"height","16"),g(d,"x","33"),g(d,"y","41"),g(d,"maskUnits","userSpaceOnUse"),g(s,"fill","#F94040"),g(s,"d","M47.21 66.5a8.67 8.67 0 0 0 2.65-16.94c-.84-.26-1.73 2.6-2.65 2.6-.86 0-1.7-2.88-2.48-2.65a8.68 8.68 0 0 0 2.48 16.99Z"),g(i,"mask","url(#a)"),g(c,"fill","#FF9D0B"),g(c,"d","M70.71 37a3.25 3.25 0 1 0 0-6.5 3.25 3.25 0 0 0 0 6.5ZM24.21 37a3.25 3.25 0 1 0 0-6.5 3.25 3.25 0 0 0 0 6.5ZM17.52 48c-1.62 0-3.06.66-4.07 1.87a5.97 5.97 0 0 0-1.33 3.76 7.1 7.1 0 0 0-1.94-.3c-1.55 0-2.95.59-3.94 1.66a5.8 5.8 0 0 0-.8 7 5.3 5.3 0 0 0-1.79 2.82c-.24.9-.48 2.8.8 4.74a5.22 5.22 0 0 0-.37 5.02c1.02 2.32 3.57 4.14 8.52 6.1 3.07 1.22 5.89 2 5.91 2.01a44.33 44.33 0 0 0 10.93 1.6c5.86 0 10.05-1.8 12.46-5.34 3.88-5.69 3.33-10.9-1.7-15.92-2.77-2.78-4.62-6.87-5-7.77-.78-2.66-2.84-5.62-6.25-5.62a5.7 5.7 0 0 0-4.6 2.46c-1-1.26-1.98-2.25-2.86-2.82A7.4 7.4 0 0 0 17.52 48Zm0 4c.51 0 1.14.22 1.82.65 2.14 1.36 6.25 8.43 7.76 11.18.5.92 1.37 1.31 2.14 1.31 1.55 0 2.75-1.53.15-3.48-3.92-2.93-2.55-7.72-.68-8.01.08-.02.17-.02.24-.02 1.7 0 2.45 2.93 2.45 2.93s2.2 5.52 5.98 9.3c3.77 3.77 3.97 6.8 1.22 10.83-1.88 2.75-5.47 3.58-9.16 3.58-3.81 0-7.73-.9-9.92-1.46-.11-.03-13.45-3.8-11.76-7 .28-.54.75-.76 1.34-.76 2.38 0 6.7 3.54 8.57 3.54.41 0 .7-.17.83-.6.79-2.85-12.06-4.05-10.98-8.17.2-.73.71-1.02 1.44-1.02 3.14 0 10.2 5.53 11.68 5.53.11 0 .2-.03.24-.1.74-1.2.33-2.04-4.9-5.2-5.21-3.16-8.88-5.06-6.8-7.33.24-.26.58-.38 1-.38 3.17 0 10.66 6.82 10.66 6.82s2.02 2.1 3.25 2.1c.28 0 .52-.1.68-.38.86-1.46-8.06-8.22-8.56-11.01-.34-1.9.24-2.85 1.31-2.85Z"),g(u,"fill","#FFD21E"),g(u,"d","M38.6 76.69c2.75-4.04 2.55-7.07-1.22-10.84-3.78-3.77-5.98-9.3-5.98-9.3s-.82-3.2-2.69-2.9c-1.87.3-3.24 5.08.68 8.01 3.91 2.93-.78 4.92-2.29 2.17-1.5-2.75-5.62-9.82-7.76-11.18-2.13-1.35-3.63-.6-3.13 2.2.5 2.79 9.43 9.55 8.56 11-.87 1.47-3.93-1.71-3.93-1.71s-9.57-8.71-11.66-6.44c-2.08 2.27 1.59 4.17 6.8 7.33 5.23 3.16 5.64 4 4.9 5.2-.75 1.2-12.28-8.53-13.36-4.4-1.08 4.11 11.77 5.3 10.98 8.15-.8 2.85-9.06-5.38-10.74-2.18-1.7 3.21 11.65 6.98 11.76 7.01 4.3 1.12 15.25 3.49 19.08-2.12Z"),g(o,"fill","#FF9D0B"),g(o,"d","M77.4 48c1.62 0 3.07.66 4.07 1.87a5.97 5.97 0 0 1 1.33 3.76 7.1 7.1 0 0 1 1.95-.3c1.55 0 2.95.59 3.94 1.66a5.8 5.8 0 0 1 .8 7 5.3 5.3 0 0 1 1.78 2.82c.24.9.48 2.8-.8 4.74a5.22 5.22 0 0 1 .37 5.02c-1.02 2.32-3.57 4.14-8.51 6.1-3.08 1.22-5.9 2-5.92 2.01a44.33 44.33 0 0 1-10.93 1.6c-5.86 0-10.05-1.8-12.46-5.34-3.88-5.69-3.33-10.9 1.7-15.92 2.78-2.78 4.63-6.87 5.01-7.77.78-2.66 2.83-5.62 6.24-5.62a5.7 5.7 0 0 1 4.6 2.46c1-1.26 1.98-2.25 2.87-2.82A7.4 7.4 0 0 1 77.4 48Zm0 4c-.51 0-1.13.22-1.82.65-2.13 1.36-6.25 8.43-7.76 11.18a2.43 2.43 0 0 1-2.14 1.31c-1.54 0-2.75-1.53-.14-3.48 3.91-2.93 2.54-7.72.67-8.01a1.54 1.54 0 0 0-.24-.02c-1.7 0-2.45 2.93-2.45 2.93s-2.2 5.52-5.97 9.3c-3.78 3.77-3.98 6.8-1.22 10.83 1.87 2.75 5.47 3.58 9.15 3.58 3.82 0 7.73-.9 9.93-1.46.1-.03 13.45-3.8 11.76-7-.29-.54-.75-.76-1.34-.76-2.38 0-6.71 3.54-8.57 3.54-.42 0-.71-.17-.83-.6-.8-2.85 12.05-4.05 10.97-8.17-.19-.73-.7-1.02-1.44-1.02-3.14 0-10.2 5.53-11.68 5.53-.1 0-.19-.03-.23-.1-.74-1.2-.34-2.04 4.88-5.2 5.23-3.16 8.9-5.06 6.8-7.33-.23-.26-.57-.38-.98-.38-3.18 0-10.67 6.82-10.67 6.82s-2.02 2.1-3.24 2.1a.74.74 0 0 1-.68-.38c-.87-1.46 8.05-8.22 8.55-11.01.34-1.9-.24-2.85-1.31-2.85Z"),g(f,"fill","#FFD21E"),g(f,"d","M56.33 76.69c-2.75-4.04-2.56-7.07 1.22-10.84 3.77-3.77 5.97-9.3 5.97-9.3s.82-3.2 2.7-2.9c1.86.3 3.23 5.08-.68 8.01-3.92 2.93.78 4.92 2.28 2.17 1.51-2.75 5.63-9.82 7.76-11.18 2.13-1.35 3.64-.6 3.13 2.2-.5 2.79-9.42 9.55-8.55 11 .86 1.47 3.92-1.71 3.92-1.71s9.58-8.71 11.66-6.44c2.08 2.27-1.58 4.17-6.8 7.33-5.23 3.16-5.63 4-4.9 5.2.75 1.2 12.28-8.53 13.36-4.4 1.08 4.11-11.76 5.3-10.97 8.15.8 2.85 9.05-5.38 10.74-2.18 1.69 3.21-11.65 6.98-11.76 7.01-4.31 1.12-15.26 3.49-19.08-2.12Z"),g(e,"class",r[0]),g(e,"xmlns","http://www.w3.org/2000/svg"),g(e,"width","1em"),g(e,"height","1em"),g(e,"fill","none"),g(e,"viewBox","0 0 95 88")},m(h,p){I(h,e,p),b(e,t),b(e,a),b(e,n),b(e,d),b(d,l),b(e,i),b(i,s),b(e,c),b(e,u),b(e,o),b(e,f)},p(h,[p]){p&1&&g(e,"class",h[0])},i:z,o:z,d(h){h&&v(e)}}}function ba(r,e,t){let{classNames:a=""}=e;return r.$$set=n=>{"classNames"in n&&t(0,a=n.classNames)},[a]}class ga extends Ve{constructor(e){super(),Re(this,e,ba,ma,Fe,{classNames:0})}}function va(r){let e;return{c(){e=U("Upload a file (image or audio)")},l(t){e=B(t,"Upload a file (image or audio)")},m(t,a){I(t,e,a)},p:z,d(t){t&&v(e)}}}function ya(r){let e=r[0][0].type.split("/")[0]+"",t,a,n,d,l,i;return{c(){t=U(e),a=U(` detected - `),n=O("button"),d=U("clear"),this.h()},l(s){t=B(s,e),a=B(s,` detected - `),n=A(s,"BUTTON",{class:!0});var c=_(n);d=B(c,"clear"),c.forEach(v),this.h()},h(){g(n,"class","btn-sm btn btn-ghost")},m(s,c){I(s,t,c),I(s,a,c),I(s,n,c),b(n,d),l||(i=N(n,"click",r[1]),l=!0)},p(s,c){c&1&&e!==(e=s[0][0].type.split("/")[0]+"")&&Qe(t,e)},d(s){s&&v(t),s&&v(a),s&&v(n),l=!1,i()}}}function _a(r){let e,t,a,n,d,l,i,s;function c(f,h){return f[0]&&f[0].length>0?ya:va}let u=c(r),o=u(r);return{c(){e=O("div"),t=O("div"),a=O("label"),n=O("span"),o.c(),d=j(),l=O("input"),this.h()},l(f){e=A(f,"DIV",{class:!0});var h=_(e);t=A(h,"DIV",{class:!0});var p=_(t);a=A(p,"LABEL",{class:!0});var m=_(a);n=A(m,"SPAN",{class:!0});var y=_(n);o.l(y),y.forEach(v),m.forEach(v),d=V(p),l=A(p,"INPUT",{type:!0,accept:!0,class:!0}),p.forEach(v),h.forEach(v),this.h()},h(){g(n,"class","label-text"),g(a,"class","label"),g(l,"type","file"),g(l,"accept","audio/*, image/*"),g(l,"class","mt-auto file-input file-input-bordered max-w-xs"),tt(l,"file-input-primary",r[0]&&r[0].length>0),g(t,"class","form-control"),g(e,"class","grid grid-cols-2 gap-5")},m(f,h){I(f,e,h),b(e,t),b(t,a),b(a,n),o.m(n,null),b(t,d),b(t,l),i||(s=N(l,"change",r[2]),i=!0)},p(f,[h]){u===(u=c(f))&&o?o.p(f,h):(o.d(1),o=u(f),o&&(o.c(),o.m(n,null))),h&1&&tt(l,"file-input-primary",f[0]&&f[0].length>0)},i:z,o:z,d(f){f&&v(e),o.d(),i=!1,s()}}}function Oa(r,e,t){let{files:a=null}=e;const n=()=>t(0,a=null);function d(){a=this.files,t(0,a)}return r.$$set=l=>{"files"in l&&t(0,a=l.files)},[a,n,d]}class Aa extends Ve{constructor(e){super(),Re(this,e,Oa,_a,Fe,{files:0})}}var wa=Object.defineProperty,Ea=(r,e)=>{for(var t in e)wa(r,t,{get:e[t],enumerable:!0})},qt={};Ea(qt,{audioClassification:()=>Ra,audioToAudio:()=>Ia,automaticSpeechRecognition:()=>Fa,conversational:()=>Ha,documentQuestionAnswering:()=>en,featureExtraction:()=>La,fillMask:()=>Na,imageClassification:()=>Ca,imageSegmentation:()=>Ua,imageToImage:()=>qa,imageToText:()=>Ba,objectDetection:()=>xa,questionAnswering:()=>$a,request:()=>q,sentenceSimilarity:()=>za,streamingRequest:()=>Dt,summarization:()=>Ya,tableQuestionAnswering:()=>Qa,tabularClassification:()=>an,tabularRegression:()=>rn,textClassification:()=>Ja,textGeneration:()=>Ka,textGenerationStream:()=>Ga,textToImage:()=>Ma,textToSpeech:()=>ka,tokenClassification:()=>Wa,translation:()=>Za,visualQuestionAnswering:()=>tn,zeroShotClassification:()=>Xa,zeroShotImageClassification:()=>Da});function Mr(r){return/^http(s?):/.test(r)||r.startsWith("/")}var He=new Map,Ta=10*60*1e3,Pa=1e3,qr="https://huggingface.co";async function Dr(r,e){if(Mr(r))return null;const t=`${r}:${e}`;let a=He.get(t);if(a&&a.dated.json()).then(d=>d.pipeline_tag).catch(()=>null);if(!n)return null;a={task:n,date:new Date},He.set(t,{task:n,date:new Date}),He.size>Pa&&He.delete(He.keys().next().value)}return a.task}var er="https://api-inference.huggingface.co",Ze=null;async function Hr(r,e){const{accessToken:t,model:a,...n}=r;let{model:d}=r;const{forceTask:l,includeCredentials:i,taskHint:s,...c}=e??{},u={};if(t&&(u.Authorization=`Bearer ${t}`),!d&&!Ze&&s){const p=await fetch(`${qr}/api/tasks`);p.ok&&(Ze=await p.json())}if(!d&&Ze&&s){const p=Ze[s];p&&(d=p.models[0].id)}if(!d)throw new Error("No model provided, and no default model found for this task");const o="data"in r&&!!r.data;o?(e!=null&&e.wait_for_model&&(u["X-Wait-For-Model"]="true"),(e==null?void 0:e.use_cache)===!1&&(u["X-Use-Cache"]="false"),e!=null&&e.dont_load_model&&(u["X-Load-Model"]="0")):u["Content-Type"]="application/json";const f=(()=>Mr(d)?d:l?`${er}/pipeline/${l}/${d}`:`${er}/models/${d}`)(),h={headers:u,method:"POST",body:o?r.data:JSON.stringify({...n,options:e&&c}),credentials:i?"include":"same-origin"};return{url:f,info:h}}async function q(r,e){var d,l;const{url:t,info:a}=await Hr(r,e),n=await((e==null?void 0:e.fetch)??fetch)(t,a);if((e==null?void 0:e.retry_on_error)!==!1&&n.status===503&&!(e!=null&&e.wait_for_model))return q(r,{...e,wait_for_model:!0});if(!n.ok){if((d=n.headers.get("Content-Type"))!=null&&d.startsWith("application/json")){const i=await n.json();if(i.error)throw new Error(i.error)}throw new Error("An error occurred while fetching the blob")}return(l=n.headers.get("Content-Type"))!=null&&l.startsWith("application/json")?await n.json():await n.blob()}function Sa(r){let e,t,a,n=!1;return function(l){e===void 0?(e=l,t=0,a=-1):e=Va(e,l);const i=e.length;let s=0;for(;t0){const s=n.decode(l.subarray(0,i)),c=i+(l[i+1]===32?2:1),u=n.decode(l.subarray(c));switch(s){case"data":a.data=a.data?a.data+` -`+u:u;break;case"event":a.event=u;break;case"id":r(a.id=u);break;case"retry":const o=parseInt(u,10);isNaN(o)||e(a.retry=o);break}}}}function Va(r,e){const t=new Uint8Array(r.length+e.length);return t.set(r),t.set(e,r.length),t}function tr(){return{data:"",event:"",id:"",retry:void 0}}async function*Dt(r,e){var c;const{url:t,info:a}=await Hr({...r,stream:!0},e),n=await((e==null?void 0:e.fetch)??fetch)(t,a);if((e==null?void 0:e.retry_on_error)!==!1&&n.status===503&&!(e!=null&&e.wait_for_model))return Dt(r,{...e,wait_for_model:!0});if(!n.ok){if((c=n.headers.get("Content-Type"))!=null&&c.startsWith("application/json")){const u=await n.json();if(u.error)throw new Error(u.error)}throw new Error(`Server response contains error: ${n.status}`)}if(n.headers.get("content-type")!=="text/event-stream")throw new Error("Server does not support event stream content type, it returned "+n.headers.get("content-type"));if(!n.body)return;const d=n.body.getReader();let l=[];const s=Sa(ja(()=>{},()=>{},u=>{l.push(u)}));try{for(;;){const{done:u,value:o}=await d.read();if(u)return;s(o);for(const f of l)if(f.data.length>0){const h=JSON.parse(f.data);if(typeof h=="object"&&h!==null&&"error"in h)throw new Error(h.error);yield h}l=[]}}finally{d.releaseLock()}}var H=class extends TypeError{constructor(r){super(`Invalid inference output: ${r}. Use the 'request' method with the same parameters to do a custom call with no type checking.`),this.name="InferenceOutputError"}};async function Ra(r,e){const t=await q(r,{...e,taskHint:"audio-classification"});if(!(Array.isArray(t)&&t.every(n=>typeof n.label=="string"&&typeof n.score=="number")))throw new H("Expected Array<{label: string, score: number}>");return t}async function Fa(r,e){const t=await q(r,{...e,taskHint:"automatic-speech-recognition"});if(!(typeof(t==null?void 0:t.text)=="string"))throw new H("Expected {text: string}");return t}async function ka(r,e){const t=await q(r,{...e,taskHint:"text-to-speech"});if(!(t&&t instanceof Blob))throw new H("Expected Blob");return t}async function Ia(r,e){const t=await q(r,{...e,taskHint:"audio-to-audio"});if(!(Array.isArray(t)&&t.every(n=>typeof n.label=="string"&&typeof n.blob=="string"&&typeof n["content-type"]=="string")))throw new H("Expected Array<{label: string, blob: string, content-type: string}>");return t}async function Ca(r,e){const t=await q(r,{...e,taskHint:"image-classification"});if(!(Array.isArray(t)&&t.every(n=>typeof n.label=="string"&&typeof n.score=="number")))throw new H("Expected Array<{label: string, score: number}>");return t}async function Ua(r,e){const t=await q(r,{...e,taskHint:"image-segmentation"});if(!(Array.isArray(t)&&t.every(n=>typeof n.label=="string"&&typeof n.mask=="string"&&typeof n.score=="number")))throw new H("Expected Array<{label: string, mask: string, score: number}>");return t}async function Ba(r,e){var a;const t=(a=await q(r,{...e,taskHint:"image-to-text"}))==null?void 0:a[0];if(typeof(t==null?void 0:t.generated_text)!="string")throw new H("Expected {generated_text: string}");return t}async function xa(r,e){const t=await q(r,{...e,taskHint:"object-detection"});if(!(Array.isArray(t)&&t.every(n=>typeof n.label=="string"&&typeof n.score=="number"&&typeof n.box.xmin=="number"&&typeof n.box.ymin=="number"&&typeof n.box.xmax=="number"&&typeof n.box.ymax=="number")))throw new H("Expected Array<{label:string; score:number; box:{xmin:number; ymin:number; xmax:number; ymax:number}}>");return t}async function Ma(r,e){const t=await q(r,{...e,taskHint:"text-to-image"});if(!(t&&t instanceof Blob))throw new H("Expected Blob");return t}function lt(r){if(globalThis.Buffer)return globalThis.Buffer.from(r).toString("base64");{const e=[];return r.forEach(t=>{e.push(String.fromCharCode(t))}),globalThis.btoa(e.join(""))}}async function qa(r,e){let t;r.parameters?t={...r,inputs:lt(new Uint8Array(r.inputs instanceof ArrayBuffer?r.inputs:await r.inputs.arrayBuffer()))}:t={accessToken:r.accessToken,model:r.model,data:r.inputs};const a=await q(t,{...e,taskHint:"image-to-image"});if(!(a&&a instanceof Blob))throw new H("Expected Blob");return a}async function Da(r,e){const t={...r,inputs:{image:lt(new Uint8Array(r.inputs.image instanceof ArrayBuffer?r.inputs.image:await r.inputs.image.arrayBuffer()))}},a=await q(t,{...e,taskHint:"zero-shot-image-classification"});if(!(Array.isArray(a)&&a.every(d=>typeof d.label=="string"&&typeof d.score=="number")))throw new H("Expected Array<{label: string, score: number}>");return a}async function Ha(r,e){const t=await q(r,{...e,taskHint:"conversational"});if(!(Array.isArray(t.conversation.generated_responses)&&t.conversation.generated_responses.every(n=>typeof n=="string")&&Array.isArray(t.conversation.past_user_inputs)&&t.conversation.past_user_inputs.every(n=>typeof n=="string")&&typeof t.generated_text=="string"&&(typeof t.warnings>"u"||Array.isArray(t.warnings)&&t.warnings.every(n=>typeof n=="string"))))throw new H("Expected {conversation: {generated_responses: string[], past_user_inputs: string[]}, generated_text: string, warnings: string[]}");return t}async function La(r,e){const t=r.model?await Dr(r.model,r.accessToken):void 0,a=await q(r,{...e,taskHint:"feature-extraction",...t==="sentence-similarity"&&{forceTask:"feature-extraction"}});let n=!0;const d=(l,i,s=0)=>s>i?!1:l.every(c=>Array.isArray(c))?l.every(c=>d(c,i,s+1)):l.every(c=>typeof c=="number");if(n=Array.isArray(a)&&d(a,3,0),!n)throw new H("Expected Array");return a}async function Na(r,e){const t=await q(r,{...e,taskHint:"fill-mask"});if(!(Array.isArray(t)&&t.every(n=>typeof n.score=="number"&&typeof n.sequence=="string"&&typeof n.token=="number"&&typeof n.token_str=="string")))throw new H("Expected Array<{score: number, sequence: string, token: number, token_str: string}>");return t}async function $a(r,e){const t=await q(r,{...e,taskHint:"question-answering"});if(!(typeof t=="object"&&!!t&&typeof t.answer=="string"&&typeof t.end=="number"&&typeof t.score=="number"&&typeof t.start=="number"))throw new H("Expected {answer: string, end: number, score: number, start: number}");return t}async function za(r,e){const t=r.model?await Dr(r.model,r.accessToken):void 0,a=await q(r,{...e,taskHint:"sentence-similarity",...t==="feature-extraction"&&{forceTask:"sentence-similarity"}});if(!(Array.isArray(a)&&a.every(d=>typeof d=="number")))throw new H("Expected number[]");return a}async function Ya(r,e){const t=await q(r,{...e,taskHint:"summarization"});if(!(Array.isArray(t)&&t.every(n=>typeof(n==null?void 0:n.summary_text)=="string")))throw new H("Expected Array<{summary_text: string}>");return t==null?void 0:t[0]}async function Qa(r,e){const t=await q(r,{...e,taskHint:"table-question-answering"});if(!(typeof(t==null?void 0:t.aggregator)=="string"&&typeof t.answer=="string"&&Array.isArray(t.cells)&&t.cells.every(n=>typeof n=="string")&&Array.isArray(t.coordinates)&&t.coordinates.every(n=>Array.isArray(n)&&n.every(d=>typeof d=="number"))))throw new H("Expected {aggregator: string, answer: string, cells: string[], coordinates: number[][]}");return t}async function Ja(r,e){var n;const t=(n=await q(r,{...e,taskHint:"text-classification"}))==null?void 0:n[0];if(!(Array.isArray(t)&&t.every(d=>typeof(d==null?void 0:d.label)=="string"&&typeof d.score=="number")))throw new H("Expected Array<{label: string, score: number}>");return t}async function Ka(r,e){const t=await q(r,{...e,taskHint:"text-generation"});if(!(Array.isArray(t)&&t.every(n=>typeof(n==null?void 0:n.generated_text)=="string")))throw new H("Expected Array<{generated_text: string}>");return t==null?void 0:t[0]}async function*Ga(r,e){yield*Dt(r,{...e,taskHint:"text-generation"})}function Ht(r){return Array.isArray(r)?r:[r]}async function Wa(r,e){const t=Ht(await q(r,{...e,taskHint:"token-classification"}));if(!(Array.isArray(t)&&t.every(n=>typeof n.end=="number"&&typeof n.entity_group=="string"&&typeof n.score=="number"&&typeof n.start=="number"&&typeof n.word=="string")))throw new H("Expected Array<{end: number, entity_group: string, score: number, start: number, word: string}>");return t}async function Za(r,e){const t=await q(r,{...e,taskHint:"translation"});if(!(Array.isArray(t)&&t.every(n=>typeof(n==null?void 0:n.translation_text)=="string")))throw new H("Expected type Array<{translation_text: string}>");return t==null?void 0:t[0]}async function Xa(r,e){const t=Ht(await q(r,{...e,taskHint:"zero-shot-classification"}));if(!(Array.isArray(t)&&t.every(n=>Array.isArray(n.labels)&&n.labels.every(d=>typeof d=="string")&&Array.isArray(n.scores)&&n.scores.every(d=>typeof d=="number")&&typeof n.sequence=="string")))throw new H("Expected Array<{labels: string[], scores: number[], sequence: string}>");return t}async function en(r,e){var d;const t={...r,inputs:{question:r.inputs.question,image:lt(new Uint8Array(r.inputs.image instanceof ArrayBuffer?r.inputs.image:await r.inputs.image.arrayBuffer()))}},a=(d=Ht(await q(t,{...e,taskHint:"document-question-answering"})))==null?void 0:d[0];if(!(typeof(a==null?void 0:a.answer)=="string"&&(typeof a.end=="number"||typeof a.end>"u")&&(typeof a.score=="number"||typeof a.score>"u")&&(typeof a.start=="number"||typeof a.start>"u")))throw new H("Expected Array<{answer: string, end?: number, score?: number, start?: number}>");return a}async function tn(r,e){var d;const t={...r,inputs:{question:r.inputs.question,image:lt(new Uint8Array(r.inputs.image instanceof ArrayBuffer?r.inputs.image:await r.inputs.image.arrayBuffer()))}},a=(d=await q(t,{...e,taskHint:"visual-question-answering"}))==null?void 0:d[0];if(!(typeof(a==null?void 0:a.answer)=="string"&&typeof a.score=="number"))throw new H("Expected Array<{answer: string, score: number}>");return a}async function rn(r,e){const t=await q(r,{...e,taskHint:"tabular-regression"});if(!(Array.isArray(t)&&t.every(n=>typeof n=="number")))throw new H("Expected number[]");return t}async function an(r,e){const t=await q(r,{...e,taskHint:"tabular-classification"});if(!(Array.isArray(t)&&t.every(n=>typeof n=="number")))throw new H("Expected number[]");return t}var Lt=class{constructor(r="",e={}){pt(this,"accessToken");pt(this,"defaultOptions");this.accessToken=r,this.defaultOptions=e;for(const[t,a]of Object.entries(qt))Object.defineProperty(this,t,{enumerable:!1,value:(n,d)=>a({...n,accessToken:r},{...e,...d})})}endpoint(r){return new nn(r,this.accessToken,this.defaultOptions)}},nn=class{constructor(r,e="",t={}){for(const[a,n]of Object.entries(qt))Object.defineProperty(this,a,{enumerable:!1,value:(d,l)=>n({...d,accessToken:e,model:r},{...t,...l})})}},sn=Object.defineProperty,on=(r,e,t)=>e in r?sn(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,mt=(r,e,t)=>(on(r,typeof e!="symbol"?e+"":e,t),t);async function ln(r,e,t,a,n){async function d(){t&&t.length>0&&(globalThis.file=await t[0]);for(const i of e){const s=c=>{var u;return(u=i.call)==null?void 0:u.call(i,c,new Lt(n??""))};globalThis[i.name]=s}globalThis.message=a;let l="";t&&t.length>0?l=` -return await generate(file);`:l=` - return await generate();`,await Object.getPrototypeOf(async function(){}).constructor(r+l)();for(const i of e)delete globalThis[i.name],delete globalThis.file,delete globalThis.message}return d}var cn=[{prompt:"Caption the image and give me the caption read out loud.",code:`async function generate(image) { - const caption = await imageToText(image); - message("First we caption the image", caption); - const output = await textToSpeech(caption); - message("Then we read the caption out loud", output); - return output; -}`,tools:["imageToText","textToSpeech"],inputs:{image:!0}},{prompt:"Display an image of a yellow dog wearing a top hat",code:`async function generate() { - const output = await textToImage("yellow dog wearing a top hat"); - message("We generate the dog picture", output); - return output; -}`,tools:["textToImage"]},{prompt:"transcribe the attached audio and only if it contains the word 'dog' generate an image of a dog wearing a top hat",code:`async function generate(audio) { -const output = await speechToText(audio); -message("We read the text", output); - -if (output.includes("dog")) { - const image = await textToImage("dog wearing a top hat"); - message("We generate the dog picture", image); - return image; -} else { - return null; -}};`,tools:["speechToText","textToImage"],inputs:{audio:!0}},{prompt:"Caption the image and generate an image based on the caption, but in a medieval fantasy style.",code:`async function generate(image) { - const caption = await imageToText(image); - message("First we caption the image", caption); - const output = await textToImage(caption + " medieval fantasy"); - message("Then we generate an image based on the caption", output); - return output; -}`,tools:["imageToText","textToImage"],inputs:{image:!0}}],un=cn;function dn(r){let e=`name: ${r.name} -description: ${r.description}`;const t=r.examples.slice(0,1).map(a=>`prompt: ${a.prompt} -command generated: \`${a.code}\``);return e+=` -`+t.join(` -`),e}function Lr(r,e,t){if(e.length===0)throw new Error("no tools selected");let a="";t.image&&(a+="image"),t.audio&&(a+=a?",":"",a+="audio");const n=un.map(i=>` -user: ${i.prompt} -function: -\`\`\`js -${i.code} -\`\`\``).join(` -------- -`),d=e.map(i=>dn(i)).join(` -------- -`);return` -Create a javascript function that does the following: "${r}" - -In order to help in answering the above prompt, the function has access to the following methods to generate outputs. - -${d} - -Examples: -${n} - -If you need to send information to the user use \`message("message", data)\` and NOT \`console.log\`. - -Use the above methods and only the above methods to answer the prompt: ${r}. - -The generated function must match the following signature: -\`\`\`js -async function generate(${a}) { -// your code here -return output; -}; -\`\`\``}var Nr={name:"message",description:"Send data back to the user.",examples:[{prompt:"Display the created image",code:'message("we display the image", image)',tools:["message"],inputs:{image:!0}},{prompt:"Display the generated text",code:'message("we render the text", text)',tools:["message"]},{prompt:'Display the text "hello world"',code:'message("hello world")',tools:["message"]}]};async function fn(r,e,t,a){var n;const d=Lr(r,[...e,Nr],{image:!!t&&t[0].type.startsWith("image"),audio:!!t&&t[0].type.startsWith("audio")}),l=await a(d);try{const i=/```(.*?)```/gs;return(n=[...l.matchAll(i)].map(u=>u[1])[0].replace("js","").replace("javascript","").trim())!=null?n:"nothing"}catch{throw new Error("The generated text doesn't contain any code blocks.")}}var hn={name:"textToImage",description:"Generate an image from a text prompt.",examples:[{prompt:"Generate an image of a cat wearing a top hat",code:"textToImage('cat wearing a top hat')",tools:["textToImage"]},{prompt:"Draw a brown dog on a beach",code:"textToImage('drawing of a brown dog on a beach')",tools:["textToImage"]}],call:async(r,e)=>{const t=await r;if(typeof t!="string")throw"Input must be a string.";return await e.textToImage({inputs:t,model:"stabilityai/stable-diffusion-2"},{wait_for_model:!0})}},pn={name:"imageToText",description:"Caption an image.",examples:[{prompt:"Describe the image",code:"imageToText(image)",tools:["imageToText"]}],call:async(r,e)=>{const t=await r;if(typeof t=="string")throw"Input must be a blob.";return(await e.imageToText({data:t,model:"nlpconnect/vit-gpt2-image-captioning"},{wait_for_model:!0})).generated_text}},mn={name:"textToSpeech",description:"This tool takes a text input and turns it into an audio file.",examples:[{prompt:'Say the following out loud:"Hello world!"',code:"textToSpeech('Hello world!')",tools:["textToSpeech"]},{prompt:"Say the content of the string txt out loud",code:"textToSpeech(txt)",tools:["textToSpeech"]}],call:async(r,e)=>{const t=await r;if(typeof t!="string")throw"Input must be a string.";return e.textToSpeech({inputs:t,model:"espnet/kan-bayashi_ljspeech_vits"},{wait_for_model:!0})}},bn={name:"speechToText",description:"Transcribe an audio file and returns its text content.",examples:[{prompt:"Transcribe the sound file",code:"speechToText(audio)",tools:["speechToText"]}],call:async(r,e)=>{const t=await r;if(typeof t=="string")throw"Input must be a blob.";return(await e.automaticSpeechRecognition({data:t,model:"facebook/wav2vec2-large-960h-lv60-self"},{wait_for_model:!0})).text}},qe=[hn,pn,mn,bn];function $r(r,e){const t=new Lt(r);return async a=>{const n="<|user|>"+a+"<|end|><|assistant|>";return(await t.textGeneration({inputs:n,model:e??"OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5",parameters:{max_new_tokens:900}})).generated_text.slice(n.length)}}function gn(r,e){const t=new Lt(r).endpoint(e);return async a=>{const n="<|user|>"+a+"<|end|><|assistant|>";return(await t.textGeneration({inputs:n,parameters:{max_new_tokens:900}})).generated_text.slice(n.length)}}var rr=class{constructor(r="",e,t){mt(this,"accessToken"),mt(this,"llm"),mt(this,"tools"),this.accessToken=r,this.llm=e??$r(r),this.tools=t??qe}generatePrompt(r,e){return Lr(r,[...this.tools,Nr],{image:!!e&&e[0].type.startsWith("image"),audio:!!e&&e[0].type.startsWith("audio")})}async generateCode(r,e){return await fn(r,this.tools,e,this.llm.bind(this))}async evaluateCode(r,e){const t=[],a=(d,l)=>{t.push({message:d,data:l})},n=await ln(r,this.tools,e,a,this.accessToken);try{await n()}catch(d){d instanceof Error&&t.push({message:"An error occurred",data:d.message})}return t}async run(r,e){const t=await this.generateCode(r,e);return await this.evaluateCode(t,e)}};function ar(r,e,t){const a=r.slice();return a[5]=e[t],a}function nr(r){let e,t,a=r[5].name+"",n,d,l,i,s,c,u;return s=ca(r[2][0]),{c(){e=O("label"),t=O("span"),n=U(a),d=j(),l=O("input"),i=j(),this.h()},l(o){e=A(o,"LABEL",{class:!0});var f=_(e);t=A(f,"SPAN",{class:!0});var h=_(t);n=B(h,a),h.forEach(v),d=V(f),l=A(f,"INPUT",{class:!0,type:!0,name:!0}),i=V(f),f.forEach(v),this.h()},h(){g(t,"class","label-text"),g(l,"class","checkbox"),g(l,"type","checkbox"),g(l,"name","tools"),l.__value=r[5].name,l.value=l.__value,g(e,"class","label cursor-pointer gap-2"),s.p(l)},m(o,f){I(o,e,f),b(e,t),b(t,n),b(e,d),b(e,l),l.checked=~(r[0]||[]).indexOf(l.__value),b(e,i),c||(u=N(l,"change",r[1]),c=!0)},p(o,f){f&1&&(l.checked=~(o[0]||[]).indexOf(l.__value))},d(o){o&&v(e),s.r(),c=!1,u()}}}function vn(r){let e,t,a,n;return{c(){e=O("button"),t=U("select all"),this.h()},l(d){e=A(d,"BUTTON",{class:!0});var l=_(e);t=B(l,"select all"),l.forEach(v),this.h()},h(){g(e,"class","btn btn-ghost inline-block w-fit btn-sm")},m(d,l){I(d,e,l),b(e,t),a||(n=N(e,"click",r[4]),a=!0)},p:z,d(d){d&&v(e),a=!1,n()}}}function yn(r){let e,t,a,n;return{c(){e=O("button"),t=U("clear"),this.h()},l(d){e=A(d,"BUTTON",{class:!0});var l=_(e);t=B(l,"clear"),l.forEach(v),this.h()},h(){g(e,"class","btn btn-ghost inline-block w-fit btn-sm")},m(d,l){I(d,e,l),b(e,t),a||(n=N(e,"click",r[3]),a=!0)},p:z,d(d){d&&v(e),a=!1,n()}}}function _n(r){let e,t,a,n,d,l,i,s=qe,c=[];for(let h=0;ht(0,a=[]),i=()=>t(0,a=qe.map(s=>s.name));return r.$$set=s=>{"selectedTools"in s&&t(0,a=s.selectedTools)},[a,d,n,l,i]}class An extends Ve{constructor(e){super(),Re(this,e,On,_n,Fe,{selectedTools:0})}}function wn(r){let e,t;return{c(){e=O("code"),t=U(r[0])},l(a){e=A(a,"CODE",{});var n=_(e);t=B(n,r[0]),n.forEach(v)},m(a,n){I(a,e,n),b(e,t)},p(a,n){n&1&&Qe(t,a[0])},d(a){a&&v(e)}}}function En(r){let e,t,a;return{c(){e=O("code"),this.h()},l(n){e=A(n,"CODE",{contenteditable:!0}),_(e).forEach(v),this.h()},h(){g(e,"contenteditable",""),r[0]===void 0&&da(()=>r[6].call(e))},m(n,d){I(n,e,d),r[0]!==void 0&&(e.textContent=r[0]),r[7](e),t||(a=N(e,"input",r[6]),t=!0)},p(n,d){d&1&&n[0]!==e.textContent&&(e.textContent=n[0])},d(n){n&&v(e),r[7](null),t=!1,a()}}}function Tn(r){let e,t,a,n,d,l,i,s=r[2]?"done":"edit",c,u,o,f,h,p,m,y,E,T,F;function w(P,M){return P[2]?En:wn}let x=w(r),k=x(r);return{c(){e=O("div"),t=j(),a=O("div"),n=O("h3"),d=U("Check the code"),l=j(),i=O("button"),c=U(s),u=j(),o=O("div"),f=O("pre"),h=U(" "),k.c(),p=U(` - `),m=j(),y=O("button"),E=U("run code"),this.h()},l(P){e=A(P,"DIV",{class:!0}),_(e).forEach(v),t=V(P),a=A(P,"DIV",{});var M=_(a);n=A(M,"H3",{class:!0});var K=_(n);d=B(K,"Check the code"),K.forEach(v),l=V(M),i=A(M,"BUTTON",{class:!0});var D=_(i);c=B(D,s),D.forEach(v),M.forEach(v),u=V(P),o=A(P,"DIV",{class:!0});var R=_(o);f=A(R,"PRE",{class:!0});var $=_(f);h=B($," "),k.l($),p=B($,` - `),$.forEach(v),R.forEach(v),m=V(P),y=A(P,"BUTTON",{class:!0});var Q=_(y);E=B(Q,"run code"),Q.forEach(v),this.h()},h(){g(e,"class","divider"),g(n,"class","text-lg inline-block"),g(i,"class","btn btn-ghost inline-block w-min"),g(f,"class","ml-4"),g(o,"class","mockup-code text-sm focus:outline-none"),tt(o,"bg-base-200",r[2]),g(y,"class","btn btn-primary w-fit mx-auto")},m(P,M){I(P,e,M),I(P,t,M),I(P,a,M),b(a,n),b(n,d),b(a,l),b(a,i),b(i,c),I(P,u,M),I(P,o,M),b(o,f),b(f,h),k.m(f,null),b(f,p),I(P,m,M),I(P,y,M),b(y,E),T||(F=[N(i,"click",r[4]),N(i,"keypress",r[5]),N(f,"click",r[8]),N(f,"keypress",r[9]),N(o,"dblclick",r[10]),N(y,"click",r[11])],T=!0)},p(P,[M]){M&4&&s!==(s=P[2]?"done":"edit")&&Qe(c,s),x===(x=w(P))&&k?k.p(P,M):(k.d(1),k=x(P),k&&(k.c(),k.m(f,p))),M&4&&tt(o,"bg-base-200",P[2])},i:z,o:z,d(P){P&&v(e),P&&v(t),P&&v(a),P&&v(u),P&&v(o),k.d(),P&&v(m),P&&v(y),T=!1,ot(F)}}}function Pn(r,e,t){let{code:a}=e,{onRun:n}=e,d=!1,l;const i=()=>t(2,d=!d),s=()=>t(2,d=!d);function c(){a=this.textContent,t(0,a)}function u(m){Se[m?"unshift":"push"](()=>{l=m,t(3,l)})}const o=()=>l&&l.focus(),f=()=>l&&l.focus(),h=()=>t(2,d=!0),p=()=>{n(a)};return r.$$set=m=>{"code"in m&&t(0,a=m.code),"onRun"in m&&t(1,n=m.onRun)},[a,n,d,l,i,s,c,u,o,f,h,p]}class Sn extends Ve{constructor(e){super(),Re(this,e,Pn,Tn,Fe,{code:0,onRun:1})}}function sr(r,e,t){const a=r.slice();return a[2]=e[t],a}function jn(r){let e,t=r[2].data+"",a;return{c(){e=O("p"),a=U(t),this.h()},l(n){e=A(n,"P",{class:!0});var d=_(e);a=B(d,t),d.forEach(v),this.h()},h(){g(e,"class","text-mono mx-auto text-light w-full")},m(n,d){I(n,e,d),b(e,a)},p(n,d){d&1&&t!==(t=n[2].data+"")&&Qe(a,t)},d(n){n&&v(e)}}}function Vn(r){let e,t,a;function n(i,s){return s&1&&(e=null),s&1&&(t=null),e==null&&(e=!!i[2].data.type.startsWith("image")),e?kn:(t==null&&(t=!!i[2].data.type.startsWith("audio")),t?Fn:Rn)}let d=n(r,-1),l=d(r);return{c(){l.c(),a=rt()},l(i){l.l(i),a=rt()},m(i,s){l.m(i,s),I(i,a,s)},p(i,s){d===(d=n(i,s))&&l?l.p(i,s):(l.d(1),l=d(i),l&&(l.c(),l.m(a.parentNode,a)))},d(i){l.d(i),i&&v(a)}}}function Rn(r){let e,t;return{c(){e=O("p"),t=U("blob type unknown"),this.h()},l(a){e=A(a,"P",{class:!0});var n=_(e);t=B(n,"blob type unknown"),n.forEach(v),this.h()},h(){g(e,"class","text-mono text-light w-full")},m(a,n){I(a,e,n),b(e,t)},p:z,d(a){a&&v(e)}}}function Fn(r){let e,t;return{c(){e=O("audio"),this.h()},l(a){e=A(a,"AUDIO",{src:!0}),_(e).forEach(v),this.h()},h(){e.controls=!0,at(e.src,t=URL.createObjectURL(r[2].data))||g(e,"src",t)},m(a,n){I(a,e,n)},p(a,n){n&1&&!at(e.src,t=URL.createObjectURL(a[2].data))&&g(e,"src",t)},d(a){a&&v(e)}}}function kn(r){let e,t,a;return{c(){e=O("div"),t=O("img"),this.h()},l(n){e=A(n,"DIV",{class:!0});var d=_(e);t=A(d,"IMG",{class:!0,alt:!0,src:!0}),d.forEach(v),this.h()},h(){g(t,"class","p-1 w-fit"),g(t,"alt","generated"),at(t.src,a=URL.createObjectURL(r[2].data))||g(t,"src",a),g(e,"class","mx-auto border-2 border-neutral-focus w-full")},m(n,d){I(n,e,d),b(e,t)},p(n,d){d&1&&!at(t.src,a=URL.createObjectURL(n[2].data))&&g(t,"src",a)},d(n){n&&v(e)}}}function ir(r){let e,t,a,n,d=r[2].message+"",l,i,s,c,u;function o(p,m){if(m&1&&(c=null),c==null&&(c=!!(p[2].data&&p[1](p[2].data))),c)return Vn;if(p[2].data)return jn}let f=o(r,-1),h=f&&f(r);return{c(){e=O("div"),t=O("input"),a=j(),n=O("div"),l=U(d),i=j(),s=O("div"),h&&h.c(),u=j(),this.h()},l(p){e=A(p,"DIV",{class:!0});var m=_(e);t=A(m,"INPUT",{type:!0}),a=V(m),n=A(m,"DIV",{class:!0});var y=_(n);l=B(y,d),y.forEach(v),i=V(m),s=A(m,"DIV",{class:!0});var E=_(s);h&&h.l(E),E.forEach(v),u=V(m),m.forEach(v),this.h()},h(){g(t,"type","checkbox"),g(n,"class","collapse-title text-xl font-medium"),g(s,"class","collapse-content"),g(e,"class","collapse bg-base-200 collapse-plus")},m(p,m){I(p,e,m),b(e,t),b(e,a),b(e,n),b(n,l),b(e,i),b(e,s),h&&h.m(s,null),b(e,u)},p(p,m){m&1&&d!==(d=p[2].message+"")&&Qe(l,d),f===(f=o(p,m))&&h?h.p(p,m):(h&&h.d(1),h=f&&f(p),h&&(h.c(),h.m(s,null)))},d(p){p&&v(e),h&&h.d()}}}function In(r){let e,t,a,n,d,l=r[0],i=[];for(let s=0;sd instanceof Blob;return r.$$set=d=>{"messages"in d&&t(0,a=d.messages)},[a,n]}class Un extends Ve{constructor(e){super(),Re(this,e,Cn,In,Fe,{messages:0})}}function Bn(r){let e,t,a,n,d,l,i,s,c,u,o,f,h,p,m,y,E;return{c(){e=O("h3"),t=U("Select your LLM"),a=j(),n=O("div"),d=O("label"),l=O("span"),i=U("OpenAI"),s=j(),c=O("input"),u=j(),o=O("label"),f=O("span"),h=U("Hugging Face"),p=j(),m=O("input"),this.h()},l(T){e=A(T,"H3",{class:!0});var F=_(e);t=B(F,"Select your LLM"),F.forEach(v),a=V(T),n=A(T,"DIV",{class:!0});var w=_(n);d=A(w,"LABEL",{class:!0});var x=_(d);l=A(x,"SPAN",{class:!0});var k=_(l);i=B(k,"OpenAI"),k.forEach(v),s=V(x),c=A(x,"INPUT",{type:!0,name:!0,class:!0}),x.forEach(v),u=V(w),o=A(w,"LABEL",{class:!0});var P=_(o);f=A(P,"SPAN",{class:!0});var M=_(f);h=B(M,"Hugging Face"),M.forEach(v),p=V(P),m=A(P,"INPUT",{type:!0,name:!0,class:!0}),P.forEach(v),w.forEach(v),this.h()},h(){g(e,"class","text-lg"),g(l,"class","label-text pr-2"),g(c,"type","radio"),g(c,"name","radio-10"),g(c,"class","radio checked:bg-primary-500"),c.checked=!0,g(d,"class","label cursor-pointer"),g(f,"class","label-text pr-2"),g(m,"type","radio"),g(m,"name","radio-10"),g(m,"class","radio checked:bg-primary-500"),m.checked=!0,g(o,"class","label cursor-pointer"),g(n,"class","join mx-auto gap-5")},m(T,F){I(T,e,F),b(e,t),I(T,a,F),I(T,n,F),b(n,d),b(d,l),b(l,i),b(d,s),b(d,c),b(n,u),b(n,o),b(o,f),b(f,h),b(o,p),b(o,m),y||(E=[N(d,"click",r[1]),N(d,"keypress",r[2]),N(o,"click",r[3]),N(o,"keypress",r[4])],y=!0)},p:z,i:z,o:z,d(T){T&&v(e),T&&v(a),T&&v(n),y=!1,ot(E)}}}function xn(r,e,t){let{llm:a}=e;const n=()=>t(0,a="openai"),d=()=>t(0,a="openai"),l=()=>t(0,a="hf"),i=()=>t(0,a="hf");return r.$$set=s=>{"llm"in s&&t(0,a=s.llm)},[a,n,d,l,i]}class Mn extends Ve{constructor(e){super(),Re(this,e,xn,Bn,Fe,{llm:0})}}const nt=Mt(localStorage.HF_ACCESS_TOKEN||""),st=Mt(localStorage.OPENAI_API_KEY||""),it=Mt(localStorage.HF_ENDPOINT||"");nt.subscribe(r=>localStorage.content=r),st.subscribe(r=>localStorage.content=r),it.subscribe(r=>localStorage.content=r);const qn=pa("goto");function Dn(r){let e,t,a,n,d,l,i,s,c,u,o,f,h,p,m,y,E,T,F,w,x,k,P,M,K,D,R,$,Q,G,be,_e,ee,de,Oe,ge,fe,se,Ie,te,ve,pe,ye,Je,De,Y;return{c(){e=O("dialog"),t=O("form"),a=O("h3"),n=U("API keys needed"),d=j(),l=O("div"),i=O("form"),s=O("div"),c=O("h3"),u=U("HF API Token"),o=j(),f=O("span"),h=U("*"),p=j(),m=O("label"),y=U("In order for this demo to work you need your HF API token."),E=j(),T=O("input"),F=j(),w=O("div"),x=j(),k=O("form"),P=O("h3"),M=U("HF Inference endpoint"),K=j(),D=O("label"),R=U(`Optionally you can specify a HF inference endpoint. If you leave this - empty the default endpoint will be used.`),$=j(),Q=O("input"),G=j(),be=O("div"),_e=j(),ee=O("form"),de=O("h3"),Oe=U("OpenAI key"),ge=j(),fe=O("label"),se=U("Optionally you can add your OpenAI key to use it as your LLM."),Ie=j(),te=O("input"),ve=j(),pe=O("div"),ye=O("button"),Je=U("Close"),this.h()},l(re){e=A(re,"DIALOG",{id:!0,class:!0});var he=_(e);t=A(he,"FORM",{method:!0,class:!0});var Ae=_(t);a=A(Ae,"H3",{class:!0});var Ke=_(a);n=B(Ke,"API keys needed"),Ke.forEach(v),d=V(Ae),l=A(Ae,"DIV",{class:!0});var L=_(l);i=A(L,"FORM",{"aria-label":!0,class:!0});var we=_(i);s=A(we,"DIV",{});var Ce=_(s);c=A(Ce,"H3",{class:!0});var W=_(c);u=B(W,"HF API Token"),W.forEach(v),o=V(Ce),f=A(Ce,"SPAN",{class:!0});var C=_(f);h=B(C,"*"),C.forEach(v),Ce.forEach(v),p=V(we),m=A(we,"LABEL",{for:!0,class:!0});var S=_(m);y=B(S,"In order for this demo to work you need your HF API token."),S.forEach(v),E=V(we),T=A(we,"INPUT",{class:!0,name:!0,type:!0,placeholder:!0}),we.forEach(v),F=V(L),w=A(L,"DIV",{class:!0}),_(w).forEach(v),x=V(L),k=A(L,"FORM",{"aria-label":!0,class:!0});var Z=_(k);P=A(Z,"H3",{class:!0});var Ee=_(P);M=B(Ee,"HF Inference endpoint"),Ee.forEach(v),K=V(Z),D=A(Z,"LABEL",{for:!0,class:!0});var Te=_(D);R=B(Te,`Optionally you can specify a HF inference endpoint. If you leave this - empty the default endpoint will be used.`),Te.forEach(v),$=V(Z),Q=A(Z,"INPUT",{class:!0,name:!0,type:!0,placeholder:!0}),Z.forEach(v),G=V(L),be=A(L,"DIV",{class:!0}),_(be).forEach(v),_e=V(L),ee=A(L,"FORM",{"aria-label":!0,class:!0});var oe=_(ee);de=A(oe,"H3",{class:!0});var Ge=_(de);Oe=B(Ge,"OpenAI key"),Ge.forEach(v),ge=V(oe),fe=A(oe,"LABEL",{for:!0,class:!0});var Gt=_(fe);se=B(Gt,"Optionally you can add your OpenAI key to use it as your LLM."),Gt.forEach(v),Ie=V(oe),te=A(oe,"INPUT",{class:!0,name:!0,type:!0,placeholder:!0}),oe.forEach(v),L.forEach(v),ve=V(Ae),pe=A(Ae,"DIV",{class:!0});var Wt=_(pe);ye=A(Wt,"BUTTON",{class:!0});var Zt=_(ye);Je=B(Zt,"Close"),Zt.forEach(v),Wt.forEach(v),Ae.forEach(v),he.forEach(v),this.h()},h(){g(a,"class","font-bold text-xl pb-5"),g(c,"class","font-bold inline"),g(f,"class","inline text-base-content"),g(m,"for","hf_key"),g(m,"class","label-text pb-2"),g(T,"class","input input-primary"),g(T,"name","hf_key"),g(T,"type","text"),g(T,"placeholder","hf_***"),g(i,"aria-label","HF API"),g(i,"class","form-control"),g(w,"class","divider"),g(P,"class","font-bold"),g(D,"for","hf_endpoint"),g(D,"class","label-text pb-2"),g(Q,"class","input"),g(Q,"name","hf_endpoint"),g(Q,"type","text"),g(Q,"placeholder","http://***"),g(k,"aria-label","HF ENDPOINT"),g(k,"class","form-control"),g(be,"class","divider"),g(de,"class","font-bold"),g(fe,"for","oai_key"),g(fe,"class","label-text pb-2"),g(te,"class","input"),g(te,"name","oai_key"),g(te,"type","text"),g(te,"placeholder","sk-***"),g(ee,"aria-label","OPENAI API"),g(ee,"class","form-control"),g(l,"class","w-full flex flex-col"),g(ye,"class","btn btn-neutral w-fit mx-auto"),g(pe,"class","modal-action"),g(t,"method","dialog"),g(t,"class","modal-box bg-base-300 shadow-xl border-base-content border-2"),g(e,"id","api_modal"),g(e,"class","modal")},m(re,he){I(re,e,he),b(e,t),b(t,a),b(a,n),b(t,d),b(t,l),b(l,i),b(i,s),b(s,c),b(c,u),b(s,o),b(s,f),b(f,h),b(i,p),b(i,m),b(m,y),b(i,E),b(i,T),Pe(T,r[1]),b(l,F),b(l,w),b(l,x),b(l,k),b(k,P),b(P,M),b(k,K),b(k,D),b(D,R),b(k,$),b(k,Q),Pe(Q,r[3]),b(l,G),b(l,be),b(l,_e),b(l,ee),b(ee,de),b(de,Oe),b(ee,ge),b(ee,fe),b(fe,se),b(ee,Ie),b(ee,te),Pe(te,r[2]),b(t,ve),b(t,pe),b(pe,ye),b(ye,Je),r[7](e),De||(Y=[N(T,"input",r[4]),N(Q,"input",r[5]),N(te,"input",r[6]),N(e,"close",r[8])],De=!0)},p(re,[he]){he&2&&T.value!==re[1]&&Pe(T,re[1]),he&8&&Q.value!==re[3]&&Pe(Q,re[3]),he&4&&te.value!==re[2]&&Pe(te,re[2])},i:z,o:z,d(re){re&&v(e),r[7](null),De=!1,ot(Y)}}}function Hn(r,e,t){let a,n,d;Ye(r,nt,f=>t(1,a=f)),Ye(r,st,f=>t(2,n=f)),Ye(r,it,f=>t(3,d=f));let{dialogElement:l}=e;fa(()=>{a===""&&l.showModal()});function i(){a=this.value,nt.set(a)}function s(){d=this.value,it.set(d)}function c(){n=this.value,st.set(n)}function u(f){Se[f?"unshift":"push"](()=>{l=f,t(0,l)})}const o=()=>{a===""?l.showModal():(localStorage.setItem("HF_ACCESS_TOKEN",a),localStorage.setItem("OPENAI_API_KEY",n),localStorage.setItem("HF_ENDPOINT",d),qn("/"))};return r.$$set=f=>{"dialogElement"in f&&t(0,l=f.dialogElement)},[l,a,n,d,i,s,c,u,o]}class Ln extends Ve{constructor(e){super(),Re(this,e,Hn,Dn,Fe,{dialogElement:0})}}var je=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Ct={},zr={},Nt={exports:{}},Yr=function(e,t){return function(){for(var n=new Array(arguments.length),d=0;d"u"}function $n(r){return r!==null&&!Ut(r)&&r.constructor!==null&&!Ut(r.constructor)&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function Qr(r){return ke.call(r)==="[object ArrayBuffer]"}function zn(r){return ke.call(r)==="[object FormData]"}function Yn(r){var e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&Qr(r.buffer),e}function Qn(r){return typeof r=="string"}function Jn(r){return typeof r=="number"}function Jr(r){return r!==null&&typeof r=="object"}function Xe(r){if(ke.call(r)!=="[object Object]")return!1;var e=Object.getPrototypeOf(r);return e===null||e===Object.prototype}function Kn(r){return ke.call(r)==="[object Date]"}function Gn(r){return ke.call(r)==="[object File]"}function Wn(r){return ke.call(r)==="[object Blob]"}function Kr(r){return ke.call(r)==="[object Function]"}function Zn(r){return Jr(r)&&Kr(r.pipe)}function Xn(r){return ke.call(r)==="[object URLSearchParams]"}function es(r){return r.trim?r.trim():r.replace(/^\s+|\s+$/g,"")}function ts(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function zt(r,e){if(!(r===null||typeof r>"u"))if(typeof r!="object"&&(r=[r]),$t(r))for(var t=0,a=r.length;t"u"||(Le.isArray(s)?c=c+"[]":s=[s],Le.forEach(s,function(o){Le.isDate(o)?o=o.toISOString():Le.isObject(o)&&(o=JSON.stringify(o)),d.push(or(c)+"="+or(o))}))}),n=d.join("&")}if(n){var l=e.indexOf("#");l!==-1&&(e=e.slice(0,l)),e+=(e.indexOf("?")===-1?"?":"&")+n}return e},ns=ne;function ct(){this.handlers=[]}ct.prototype.use=function(e,t,a){return this.handlers.push({fulfilled:e,rejected:t,synchronous:a?a.synchronous:!1,runWhen:a?a.runWhen:null}),this.handlers.length-1};ct.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};ct.prototype.forEach=function(e){ns.forEach(this.handlers,function(a){a!==null&&e(a)})};var ss=ct,is=ne,os=function(e,t){is.forEach(e,function(n,d){d!==t&&d.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[d])})},Wr=function(e,t,a,n,d){return e.config=t,a&&(e.code=a),e.request=n,e.response=d,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e},Zr={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},bt,lr;function Xr(){if(lr)return bt;lr=1;var r=Wr;return bt=function(t,a,n,d,l){var i=new Error(t);return r(i,a,n,d,l)},bt}var gt,cr;function ls(){if(cr)return gt;cr=1;var r=Xr();return gt=function(t,a,n){var d=n.config.validateStatus;!n.status||!d||d(n.status)?t(n):a(r("Request failed with status code "+n.status,n.config,null,n.request,n))},gt}var vt,ur;function cs(){if(ur)return vt;ur=1;var r=ne;return vt=r.isStandardBrowserEnv()?function(){return{write:function(a,n,d,l,i,s){var c=[];c.push(a+"="+encodeURIComponent(n)),r.isNumber(d)&&c.push("expires="+new Date(d).toGMTString()),r.isString(l)&&c.push("path="+l),r.isString(i)&&c.push("domain="+i),s===!0&&c.push("secure"),document.cookie=c.join("; ")},read:function(a){var n=document.cookie.match(new RegExp("(^|;\\s*)("+a+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(a){this.write(a,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}(),vt}var yt,dr;function us(){return dr||(dr=1,yt=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}),yt}var _t,fr;function ds(){return fr||(fr=1,_t=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}),_t}var Ot,hr;function fs(){if(hr)return Ot;hr=1;var r=us(),e=ds();return Ot=function(a,n){return a&&!r(n)?e(a,n):n},Ot}var At,pr;function hs(){if(pr)return At;pr=1;var r=ne,e=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];return At=function(a){var n={},d,l,i;return a&&r.forEach(a.split(` -`),function(c){if(i=c.indexOf(":"),d=r.trim(c.substr(0,i)).toLowerCase(),l=r.trim(c.substr(i+1)),d){if(n[d]&&e.indexOf(d)>=0)return;d==="set-cookie"?n[d]=(n[d]?n[d]:[]).concat([l]):n[d]=n[d]?n[d]+", "+l:l}}),n},At}var wt,mr;function ps(){if(mr)return wt;mr=1;var r=ne;return wt=r.isStandardBrowserEnv()?function(){var t=/(msie|trident)/i.test(navigator.userAgent),a=document.createElement("a"),n;function d(l){var i=l;return t&&(a.setAttribute("href",i),i=a.href),a.setAttribute("href",i),{href:a.href,protocol:a.protocol?a.protocol.replace(/:$/,""):"",host:a.host,search:a.search?a.search.replace(/^\?/,""):"",hash:a.hash?a.hash.replace(/^#/,""):"",hostname:a.hostname,port:a.port,pathname:a.pathname.charAt(0)==="/"?a.pathname:"/"+a.pathname}}return n=d(window.location.href),function(i){var s=r.isString(i)?d(i):i;return s.protocol===n.protocol&&s.host===n.host}}():function(){return function(){return!0}}(),wt}var Et,br;function ut(){if(br)return Et;br=1;function r(e){this.message=e}return r.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},r.prototype.__CANCEL__=!0,Et=r,Et}var Tt,gr;function vr(){if(gr)return Tt;gr=1;var r=ne,e=ls(),t=cs(),a=Gr,n=fs(),d=hs(),l=ps(),i=Xr(),s=Zr,c=ut();return Tt=function(o){return new Promise(function(h,p){var m=o.data,y=o.headers,E=o.responseType,T;function F(){o.cancelToken&&o.cancelToken.unsubscribe(T),o.signal&&o.signal.removeEventListener("abort",T)}r.isFormData(m)&&delete y["Content-Type"];var w=new XMLHttpRequest;if(o.auth){var x=o.auth.username||"",k=o.auth.password?unescape(encodeURIComponent(o.auth.password)):"";y.Authorization="Basic "+btoa(x+":"+k)}var P=n(o.baseURL,o.url);w.open(o.method.toUpperCase(),a(P,o.params,o.paramsSerializer),!0),w.timeout=o.timeout;function M(){if(w){var D="getAllResponseHeaders"in w?d(w.getAllResponseHeaders()):null,R=!E||E==="text"||E==="json"?w.responseText:w.response,$={data:R,status:w.status,statusText:w.statusText,headers:D,config:o,request:w};e(function(G){h(G),F()},function(G){p(G),F()},$),w=null}}if("onloadend"in w?w.onloadend=M:w.onreadystatechange=function(){!w||w.readyState!==4||w.status===0&&!(w.responseURL&&w.responseURL.indexOf("file:")===0)||setTimeout(M)},w.onabort=function(){w&&(p(i("Request aborted",o,"ECONNABORTED",w)),w=null)},w.onerror=function(){p(i("Network Error",o,null,w)),w=null},w.ontimeout=function(){var R=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded",$=o.transitional||s;o.timeoutErrorMessage&&(R=o.timeoutErrorMessage),p(i(R,o,$.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",w)),w=null},r.isStandardBrowserEnv()){var K=(o.withCredentials||l(P))&&o.xsrfCookieName?t.read(o.xsrfCookieName):void 0;K&&(y[o.xsrfHeaderName]=K)}"setRequestHeader"in w&&r.forEach(y,function(R,$){typeof m>"u"&&$.toLowerCase()==="content-type"?delete y[$]:w.setRequestHeader($,R)}),r.isUndefined(o.withCredentials)||(w.withCredentials=!!o.withCredentials),E&&E!=="json"&&(w.responseType=o.responseType),typeof o.onDownloadProgress=="function"&&w.addEventListener("progress",o.onDownloadProgress),typeof o.onUploadProgress=="function"&&w.upload&&w.upload.addEventListener("progress",o.onUploadProgress),(o.cancelToken||o.signal)&&(T=function(D){w&&(p(!D||D&&D.type?new c("canceled"):D),w.abort(),w=null)},o.cancelToken&&o.cancelToken.subscribe(T),o.signal&&(o.signal.aborted?T():o.signal.addEventListener("abort",T))),m||(m=null),w.send(m)})},Tt}var X=ne,yr=os,ms=Wr,bs=Zr,gs={"Content-Type":"application/x-www-form-urlencoded"};function _r(r,e){!X.isUndefined(r)&&X.isUndefined(r["Content-Type"])&&(r["Content-Type"]=e)}function vs(){var r;return(typeof XMLHttpRequest<"u"||typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]")&&(r=vr()),r}function ys(r,e,t){if(X.isString(r))try{return(e||JSON.parse)(r),X.trim(r)}catch(a){if(a.name!=="SyntaxError")throw a}return(t||JSON.stringify)(r)}var dt={transitional:bs,adapter:vs(),transformRequest:[function(e,t){return yr(t,"Accept"),yr(t,"Content-Type"),X.isFormData(e)||X.isArrayBuffer(e)||X.isBuffer(e)||X.isStream(e)||X.isFile(e)||X.isBlob(e)?e:X.isArrayBufferView(e)?e.buffer:X.isURLSearchParams(e)?(_r(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):X.isObject(e)||t&&t["Content-Type"]==="application/json"?(_r(t,"application/json"),ys(e)):e}],transformResponse:[function(e){var t=this.transitional||dt.transitional,a=t&&t.silentJSONParsing,n=t&&t.forcedJSONParsing,d=!a&&this.responseType==="json";if(d||n&&X.isString(e)&&e.length)try{return JSON.parse(e)}catch(l){if(d)throw l.name==="SyntaxError"?ms(l,this,"E_JSON_PARSE"):l}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};X.forEach(["delete","get","head"],function(e){dt.headers[e]={}});X.forEach(["post","put","patch"],function(e){dt.headers[e]=X.merge(gs)});var Yt=dt,_s=ne,Os=Yt,As=function(e,t,a){var n=this||Os;return _s.forEach(a,function(l){e=l.call(n,e,t)}),e},Pt,Or;function ea(){return Or||(Or=1,Pt=function(e){return!!(e&&e.__CANCEL__)}),Pt}var Ar=ne,St=As,ws=ea(),Es=Yt,Ts=ut();function jt(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new Ts("canceled")}var Ps=function(e){jt(e),e.headers=e.headers||{},e.data=St.call(e,e.data,e.headers,e.transformRequest),e.headers=Ar.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Ar.forEach(["delete","get","head","post","put","patch","common"],function(n){delete e.headers[n]});var t=e.adapter||Es.adapter;return t(e).then(function(n){return jt(e),n.data=St.call(e,n.data,n.headers,e.transformResponse),n},function(n){return ws(n)||(jt(e),n&&n.response&&(n.response.data=St.call(e,n.response.data,n.response.headers,e.transformResponse))),Promise.reject(n)})},ie=ne,ta=function(e,t){t=t||{};var a={};function n(u,o){return ie.isPlainObject(u)&&ie.isPlainObject(o)?ie.merge(u,o):ie.isPlainObject(o)?ie.merge({},o):ie.isArray(o)?o.slice():o}function d(u){if(ie.isUndefined(t[u])){if(!ie.isUndefined(e[u]))return n(void 0,e[u])}else return n(e[u],t[u])}function l(u){if(!ie.isUndefined(t[u]))return n(void 0,t[u])}function i(u){if(ie.isUndefined(t[u])){if(!ie.isUndefined(e[u]))return n(void 0,e[u])}else return n(void 0,t[u])}function s(u){if(u in t)return n(e[u],t[u]);if(u in e)return n(void 0,e[u])}var c={url:l,method:l,data:l,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:s};return ie.forEach(Object.keys(e).concat(Object.keys(t)),function(o){var f=c[o]||d,h=f(o);ie.isUndefined(h)&&f!==s||(a[o]=h)}),a},Vt,wr;function ra(){return wr||(wr=1,Vt={version:"0.26.1"}),Vt}var Ss=ra().version,Qt={};["object","boolean","number","function","string","symbol"].forEach(function(r,e){Qt[r]=function(a){return typeof a===r||"a"+(e<1?"n ":" ")+r}});var Er={};Qt.transitional=function(e,t,a){function n(d,l){return"[Axios v"+Ss+"] Transitional option '"+d+"'"+l+(a?". "+a:"")}return function(d,l,i){if(e===!1)throw new Error(n(l," has been removed"+(t?" in "+t:"")));return t&&!Er[l]&&(Er[l]=!0,console.warn(n(l," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(d,l,i):!0}};function js(r,e,t){if(typeof r!="object")throw new TypeError("options must be an object");for(var a=Object.keys(r),n=a.length;n-- >0;){var d=a[n],l=e[d];if(l){var i=r[d],s=i===void 0||l(i,d,r);if(s!==!0)throw new TypeError("option "+d+" must be "+s);continue}if(t!==!0)throw Error("Unknown option "+d)}}var Vs={assertOptions:js,validators:Qt},aa=ne,Rs=Gr,Tr=ss,Pr=Ps,ft=ta,na=Vs,Ne=na.validators;function We(r){this.defaults=r,this.interceptors={request:new Tr,response:new Tr}}We.prototype.request=function(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=ft(this.defaults,t),t.method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var a=t.transitional;a!==void 0&&na.assertOptions(a,{silentJSONParsing:Ne.transitional(Ne.boolean),forcedJSONParsing:Ne.transitional(Ne.boolean),clarifyTimeoutError:Ne.transitional(Ne.boolean)},!1);var n=[],d=!0;this.interceptors.request.forEach(function(h){typeof h.runWhen=="function"&&h.runWhen(t)===!1||(d=d&&h.synchronous,n.unshift(h.fulfilled,h.rejected))});var l=[];this.interceptors.response.forEach(function(h){l.push(h.fulfilled,h.rejected)});var i;if(!d){var s=[Pr,void 0];for(Array.prototype.unshift.apply(s,n),s=s.concat(l),i=Promise.resolve(t);s.length;)i=i.then(s.shift(),s.shift());return i}for(var c=t;n.length;){var u=n.shift(),o=n.shift();try{c=u(c)}catch(f){o(f);break}}try{i=Pr(c)}catch(f){return Promise.reject(f)}for(;l.length;)i=i.then(l.shift(),l.shift());return i};We.prototype.getUri=function(e){return e=ft(this.defaults,e),Rs(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};aa.forEach(["delete","get","head","options"],function(e){We.prototype[e]=function(t,a){return this.request(ft(a||{},{method:e,url:t,data:(a||{}).data}))}});aa.forEach(["post","put","patch"],function(e){We.prototype[e]=function(t,a,n){return this.request(ft(n||{},{method:e,url:t,data:a}))}});var Fs=We,Rt,Sr;function ks(){if(Sr)return Rt;Sr=1;var r=ut();function e(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var a;this.promise=new Promise(function(l){a=l});var n=this;this.promise.then(function(d){if(n._listeners){var l,i=n._listeners.length;for(l=0;lxt(r,a,t)):Object.keys(e).forEach(a=>xt(r,e[a],`${t}${t!==""?".":""}${a}`)):r.has(t)?r.append(t,e):r.set(t,e))}J.setSearchParams=function(r,...e){const t=new URLSearchParams(r.search);xt(t,e),r.search=t.toString()};J.serializeDataIfNeeded=function(r,e,t){const a=typeof r!="string";return(a&&t&&t.isJsonMime?t.isJsonMime(e.headers["Content-Type"]):a)?JSON.stringify(r!==void 0?r:{}):r||""};J.toPathString=function(r){return r.pathname+r.search+r.hash};J.createRequestFunction=function(r,e,t,a){return(n=e,d=t)=>{const l=Object.assign(Object.assign({},r.options),{url:((a==null?void 0:a.basePath)||d)+r.url});return n.request(l)}};(function(r){var e=je&&je.__awaiter||function(l,i,s,c){function u(o){return o instanceof s?o:new s(function(f){f(o)})}return new(s||(s=Promise))(function(o,f){function h(y){try{m(c.next(y))}catch(E){f(E)}}function p(y){try{m(c.throw(y))}catch(E){f(E)}}function m(y){y.done?o(y.value):u(y.value).then(h,p)}m((c=c.apply(l,i||[])).next())})};Object.defineProperty(r,"__esModule",{value:!0}),r.OpenAIApi=r.OpenAIApiFactory=r.OpenAIApiFp=r.OpenAIApiAxiosParamCreator=r.CreateImageRequestResponseFormatEnum=r.CreateImageRequestSizeEnum=r.ChatCompletionResponseMessageRoleEnum=r.ChatCompletionRequestMessageRoleEnum=void 0;const t=ia,a=J,n=Jt;r.ChatCompletionRequestMessageRoleEnum={System:"system",User:"user",Assistant:"assistant",Function:"function"},r.ChatCompletionResponseMessageRoleEnum={System:"system",User:"user",Assistant:"assistant",Function:"function"},r.CreateImageRequestSizeEnum={_256x256:"256x256",_512x512:"512x512",_1024x1024:"1024x1024"},r.CreateImageRequestResponseFormatEnum={Url:"url",B64Json:"b64_json"},r.OpenAIApiAxiosParamCreator=function(l){return{cancelFineTune:(i,s={})=>e(this,void 0,void 0,function*(){a.assertParamExists("cancelFineTune","fineTuneId",i);const c="/fine-tunes/{fine_tune_id}/cancel".replace("{fine_tune_id}",encodeURIComponent(String(i))),u=new URL(c,a.DUMMY_BASE_URL);let o;l&&(o=l.baseOptions);const f=Object.assign(Object.assign({method:"POST"},o),s),h={},p={};a.setSearchParams(u,p);let m=o&&o.headers?o.headers:{};return f.headers=Object.assign(Object.assign(Object.assign({},h),m),s.headers),{url:a.toPathString(u),options:f}}),createAnswer:(i,s={})=>e(this,void 0,void 0,function*(){a.assertParamExists("createAnswer","createAnswerRequest",i);const c="/answers",u=new URL(c,a.DUMMY_BASE_URL);let o;l&&(o=l.baseOptions);const f=Object.assign(Object.assign({method:"POST"},o),s),h={},p={};h["Content-Type"]="application/json",a.setSearchParams(u,p);let m=o&&o.headers?o.headers:{};return f.headers=Object.assign(Object.assign(Object.assign({},h),m),s.headers),f.data=a.serializeDataIfNeeded(i,f,l),{url:a.toPathString(u),options:f}}),createChatCompletion:(i,s={})=>e(this,void 0,void 0,function*(){a.assertParamExists("createChatCompletion","createChatCompletionRequest",i);const c="/chat/completions",u=new URL(c,a.DUMMY_BASE_URL);let o;l&&(o=l.baseOptions);const f=Object.assign(Object.assign({method:"POST"},o),s),h={},p={};h["Content-Type"]="application/json",a.setSearchParams(u,p);let m=o&&o.headers?o.headers:{};return f.headers=Object.assign(Object.assign(Object.assign({},h),m),s.headers),f.data=a.serializeDataIfNeeded(i,f,l),{url:a.toPathString(u),options:f}}),createClassification:(i,s={})=>e(this,void 0,void 0,function*(){a.assertParamExists("createClassification","createClassificationRequest",i);const c="/classifications",u=new URL(c,a.DUMMY_BASE_URL);let o;l&&(o=l.baseOptions);const f=Object.assign(Object.assign({method:"POST"},o),s),h={},p={};h["Content-Type"]="application/json",a.setSearchParams(u,p);let m=o&&o.headers?o.headers:{};return f.headers=Object.assign(Object.assign(Object.assign({},h),m),s.headers),f.data=a.serializeDataIfNeeded(i,f,l),{url:a.toPathString(u),options:f}}),createCompletion:(i,s={})=>e(this,void 0,void 0,function*(){a.assertParamExists("createCompletion","createCompletionRequest",i);const c="/completions",u=new URL(c,a.DUMMY_BASE_URL);let o;l&&(o=l.baseOptions);const f=Object.assign(Object.assign({method:"POST"},o),s),h={},p={};h["Content-Type"]="application/json",a.setSearchParams(u,p);let m=o&&o.headers?o.headers:{};return f.headers=Object.assign(Object.assign(Object.assign({},h),m),s.headers),f.data=a.serializeDataIfNeeded(i,f,l),{url:a.toPathString(u),options:f}}),createEdit:(i,s={})=>e(this,void 0,void 0,function*(){a.assertParamExists("createEdit","createEditRequest",i);const c="/edits",u=new URL(c,a.DUMMY_BASE_URL);let o;l&&(o=l.baseOptions);const f=Object.assign(Object.assign({method:"POST"},o),s),h={},p={};h["Content-Type"]="application/json",a.setSearchParams(u,p);let m=o&&o.headers?o.headers:{};return f.headers=Object.assign(Object.assign(Object.assign({},h),m),s.headers),f.data=a.serializeDataIfNeeded(i,f,l),{url:a.toPathString(u),options:f}}),createEmbedding:(i,s={})=>e(this,void 0,void 0,function*(){a.assertParamExists("createEmbedding","createEmbeddingRequest",i);const c="/embeddings",u=new URL(c,a.DUMMY_BASE_URL);let o;l&&(o=l.baseOptions);const f=Object.assign(Object.assign({method:"POST"},o),s),h={},p={};h["Content-Type"]="application/json",a.setSearchParams(u,p);let m=o&&o.headers?o.headers:{};return f.headers=Object.assign(Object.assign(Object.assign({},h),m),s.headers),f.data=a.serializeDataIfNeeded(i,f,l),{url:a.toPathString(u),options:f}}),createFile:(i,s,c={})=>e(this,void 0,void 0,function*(){a.assertParamExists("createFile","file",i),a.assertParamExists("createFile","purpose",s);const u="/files",o=new URL(u,a.DUMMY_BASE_URL);let f;l&&(f=l.baseOptions);const h=Object.assign(Object.assign({method:"POST"},f),c),p={},m={},y=new(l&&l.formDataCtor||FormData);i!==void 0&&y.append("file",i),s!==void 0&&y.append("purpose",s),p["Content-Type"]="multipart/form-data",a.setSearchParams(o,m);let E=f&&f.headers?f.headers:{};return h.headers=Object.assign(Object.assign(Object.assign(Object.assign({},p),y.getHeaders()),E),c.headers),h.data=y,{url:a.toPathString(o),options:h}}),createFineTune:(i,s={})=>e(this,void 0,void 0,function*(){a.assertParamExists("createFineTune","createFineTuneRequest",i);const c="/fine-tunes",u=new URL(c,a.DUMMY_BASE_URL);let o;l&&(o=l.baseOptions);const f=Object.assign(Object.assign({method:"POST"},o),s),h={},p={};h["Content-Type"]="application/json",a.setSearchParams(u,p);let m=o&&o.headers?o.headers:{};return f.headers=Object.assign(Object.assign(Object.assign({},h),m),s.headers),f.data=a.serializeDataIfNeeded(i,f,l),{url:a.toPathString(u),options:f}}),createImage:(i,s={})=>e(this,void 0,void 0,function*(){a.assertParamExists("createImage","createImageRequest",i);const c="/images/generations",u=new URL(c,a.DUMMY_BASE_URL);let o;l&&(o=l.baseOptions);const f=Object.assign(Object.assign({method:"POST"},o),s),h={},p={};h["Content-Type"]="application/json",a.setSearchParams(u,p);let m=o&&o.headers?o.headers:{};return f.headers=Object.assign(Object.assign(Object.assign({},h),m),s.headers),f.data=a.serializeDataIfNeeded(i,f,l),{url:a.toPathString(u),options:f}}),createImageEdit:(i,s,c,u,o,f,h,p={})=>e(this,void 0,void 0,function*(){a.assertParamExists("createImageEdit","image",i),a.assertParamExists("createImageEdit","prompt",s);const m="/images/edits",y=new URL(m,a.DUMMY_BASE_URL);let E;l&&(E=l.baseOptions);const T=Object.assign(Object.assign({method:"POST"},E),p),F={},w={},x=new(l&&l.formDataCtor||FormData);i!==void 0&&x.append("image",i),c!==void 0&&x.append("mask",c),s!==void 0&&x.append("prompt",s),u!==void 0&&x.append("n",u),o!==void 0&&x.append("size",o),f!==void 0&&x.append("response_format",f),h!==void 0&&x.append("user",h),F["Content-Type"]="multipart/form-data",a.setSearchParams(y,w);let k=E&&E.headers?E.headers:{};return T.headers=Object.assign(Object.assign(Object.assign(Object.assign({},F),x.getHeaders()),k),p.headers),T.data=x,{url:a.toPathString(y),options:T}}),createImageVariation:(i,s,c,u,o,f={})=>e(this,void 0,void 0,function*(){a.assertParamExists("createImageVariation","image",i);const h="/images/variations",p=new URL(h,a.DUMMY_BASE_URL);let m;l&&(m=l.baseOptions);const y=Object.assign(Object.assign({method:"POST"},m),f),E={},T={},F=new(l&&l.formDataCtor||FormData);i!==void 0&&F.append("image",i),s!==void 0&&F.append("n",s),c!==void 0&&F.append("size",c),u!==void 0&&F.append("response_format",u),o!==void 0&&F.append("user",o),E["Content-Type"]="multipart/form-data",a.setSearchParams(p,T);let w=m&&m.headers?m.headers:{};return y.headers=Object.assign(Object.assign(Object.assign(Object.assign({},E),F.getHeaders()),w),f.headers),y.data=F,{url:a.toPathString(p),options:y}}),createModeration:(i,s={})=>e(this,void 0,void 0,function*(){a.assertParamExists("createModeration","createModerationRequest",i);const c="/moderations",u=new URL(c,a.DUMMY_BASE_URL);let o;l&&(o=l.baseOptions);const f=Object.assign(Object.assign({method:"POST"},o),s),h={},p={};h["Content-Type"]="application/json",a.setSearchParams(u,p);let m=o&&o.headers?o.headers:{};return f.headers=Object.assign(Object.assign(Object.assign({},h),m),s.headers),f.data=a.serializeDataIfNeeded(i,f,l),{url:a.toPathString(u),options:f}}),createSearch:(i,s,c={})=>e(this,void 0,void 0,function*(){a.assertParamExists("createSearch","engineId",i),a.assertParamExists("createSearch","createSearchRequest",s);const u="/engines/{engine_id}/search".replace("{engine_id}",encodeURIComponent(String(i))),o=new URL(u,a.DUMMY_BASE_URL);let f;l&&(f=l.baseOptions);const h=Object.assign(Object.assign({method:"POST"},f),c),p={},m={};p["Content-Type"]="application/json",a.setSearchParams(o,m);let y=f&&f.headers?f.headers:{};return h.headers=Object.assign(Object.assign(Object.assign({},p),y),c.headers),h.data=a.serializeDataIfNeeded(s,h,l),{url:a.toPathString(o),options:h}}),createTranscription:(i,s,c,u,o,f,h={})=>e(this,void 0,void 0,function*(){a.assertParamExists("createTranscription","file",i),a.assertParamExists("createTranscription","model",s);const p="/audio/transcriptions",m=new URL(p,a.DUMMY_BASE_URL);let y;l&&(y=l.baseOptions);const E=Object.assign(Object.assign({method:"POST"},y),h),T={},F={},w=new(l&&l.formDataCtor||FormData);i!==void 0&&w.append("file",i),s!==void 0&&w.append("model",s),c!==void 0&&w.append("prompt",c),u!==void 0&&w.append("response_format",u),o!==void 0&&w.append("temperature",o),f!==void 0&&w.append("language",f),T["Content-Type"]="multipart/form-data",a.setSearchParams(m,F);let x=y&&y.headers?y.headers:{};return E.headers=Object.assign(Object.assign(Object.assign(Object.assign({},T),w.getHeaders()),x),h.headers),E.data=w,{url:a.toPathString(m),options:E}}),createTranslation:(i,s,c,u,o,f={})=>e(this,void 0,void 0,function*(){a.assertParamExists("createTranslation","file",i),a.assertParamExists("createTranslation","model",s);const h="/audio/translations",p=new URL(h,a.DUMMY_BASE_URL);let m;l&&(m=l.baseOptions);const y=Object.assign(Object.assign({method:"POST"},m),f),E={},T={},F=new(l&&l.formDataCtor||FormData);i!==void 0&&F.append("file",i),s!==void 0&&F.append("model",s),c!==void 0&&F.append("prompt",c),u!==void 0&&F.append("response_format",u),o!==void 0&&F.append("temperature",o),E["Content-Type"]="multipart/form-data",a.setSearchParams(p,T);let w=m&&m.headers?m.headers:{};return y.headers=Object.assign(Object.assign(Object.assign(Object.assign({},E),F.getHeaders()),w),f.headers),y.data=F,{url:a.toPathString(p),options:y}}),deleteFile:(i,s={})=>e(this,void 0,void 0,function*(){a.assertParamExists("deleteFile","fileId",i);const c="/files/{file_id}".replace("{file_id}",encodeURIComponent(String(i))),u=new URL(c,a.DUMMY_BASE_URL);let o;l&&(o=l.baseOptions);const f=Object.assign(Object.assign({method:"DELETE"},o),s),h={},p={};a.setSearchParams(u,p);let m=o&&o.headers?o.headers:{};return f.headers=Object.assign(Object.assign(Object.assign({},h),m),s.headers),{url:a.toPathString(u),options:f}}),deleteModel:(i,s={})=>e(this,void 0,void 0,function*(){a.assertParamExists("deleteModel","model",i);const c="/models/{model}".replace("{model}",encodeURIComponent(String(i))),u=new URL(c,a.DUMMY_BASE_URL);let o;l&&(o=l.baseOptions);const f=Object.assign(Object.assign({method:"DELETE"},o),s),h={},p={};a.setSearchParams(u,p);let m=o&&o.headers?o.headers:{};return f.headers=Object.assign(Object.assign(Object.assign({},h),m),s.headers),{url:a.toPathString(u),options:f}}),downloadFile:(i,s={})=>e(this,void 0,void 0,function*(){a.assertParamExists("downloadFile","fileId",i);const c="/files/{file_id}/content".replace("{file_id}",encodeURIComponent(String(i))),u=new URL(c,a.DUMMY_BASE_URL);let o;l&&(o=l.baseOptions);const f=Object.assign(Object.assign({method:"GET"},o),s),h={},p={};a.setSearchParams(u,p);let m=o&&o.headers?o.headers:{};return f.headers=Object.assign(Object.assign(Object.assign({},h),m),s.headers),{url:a.toPathString(u),options:f}}),listEngines:(i={})=>e(this,void 0,void 0,function*(){const s="/engines",c=new URL(s,a.DUMMY_BASE_URL);let u;l&&(u=l.baseOptions);const o=Object.assign(Object.assign({method:"GET"},u),i),f={},h={};a.setSearchParams(c,h);let p=u&&u.headers?u.headers:{};return o.headers=Object.assign(Object.assign(Object.assign({},f),p),i.headers),{url:a.toPathString(c),options:o}}),listFiles:(i={})=>e(this,void 0,void 0,function*(){const s="/files",c=new URL(s,a.DUMMY_BASE_URL);let u;l&&(u=l.baseOptions);const o=Object.assign(Object.assign({method:"GET"},u),i),f={},h={};a.setSearchParams(c,h);let p=u&&u.headers?u.headers:{};return o.headers=Object.assign(Object.assign(Object.assign({},f),p),i.headers),{url:a.toPathString(c),options:o}}),listFineTuneEvents:(i,s,c={})=>e(this,void 0,void 0,function*(){a.assertParamExists("listFineTuneEvents","fineTuneId",i);const u="/fine-tunes/{fine_tune_id}/events".replace("{fine_tune_id}",encodeURIComponent(String(i))),o=new URL(u,a.DUMMY_BASE_URL);let f;l&&(f=l.baseOptions);const h=Object.assign(Object.assign({method:"GET"},f),c),p={},m={};s!==void 0&&(m.stream=s),a.setSearchParams(o,m);let y=f&&f.headers?f.headers:{};return h.headers=Object.assign(Object.assign(Object.assign({},p),y),c.headers),{url:a.toPathString(o),options:h}}),listFineTunes:(i={})=>e(this,void 0,void 0,function*(){const s="/fine-tunes",c=new URL(s,a.DUMMY_BASE_URL);let u;l&&(u=l.baseOptions);const o=Object.assign(Object.assign({method:"GET"},u),i),f={},h={};a.setSearchParams(c,h);let p=u&&u.headers?u.headers:{};return o.headers=Object.assign(Object.assign(Object.assign({},f),p),i.headers),{url:a.toPathString(c),options:o}}),listModels:(i={})=>e(this,void 0,void 0,function*(){const s="/models",c=new URL(s,a.DUMMY_BASE_URL);let u;l&&(u=l.baseOptions);const o=Object.assign(Object.assign({method:"GET"},u),i),f={},h={};a.setSearchParams(c,h);let p=u&&u.headers?u.headers:{};return o.headers=Object.assign(Object.assign(Object.assign({},f),p),i.headers),{url:a.toPathString(c),options:o}}),retrieveEngine:(i,s={})=>e(this,void 0,void 0,function*(){a.assertParamExists("retrieveEngine","engineId",i);const c="/engines/{engine_id}".replace("{engine_id}",encodeURIComponent(String(i))),u=new URL(c,a.DUMMY_BASE_URL);let o;l&&(o=l.baseOptions);const f=Object.assign(Object.assign({method:"GET"},o),s),h={},p={};a.setSearchParams(u,p);let m=o&&o.headers?o.headers:{};return f.headers=Object.assign(Object.assign(Object.assign({},h),m),s.headers),{url:a.toPathString(u),options:f}}),retrieveFile:(i,s={})=>e(this,void 0,void 0,function*(){a.assertParamExists("retrieveFile","fileId",i);const c="/files/{file_id}".replace("{file_id}",encodeURIComponent(String(i))),u=new URL(c,a.DUMMY_BASE_URL);let o;l&&(o=l.baseOptions);const f=Object.assign(Object.assign({method:"GET"},o),s),h={},p={};a.setSearchParams(u,p);let m=o&&o.headers?o.headers:{};return f.headers=Object.assign(Object.assign(Object.assign({},h),m),s.headers),{url:a.toPathString(u),options:f}}),retrieveFineTune:(i,s={})=>e(this,void 0,void 0,function*(){a.assertParamExists("retrieveFineTune","fineTuneId",i);const c="/fine-tunes/{fine_tune_id}".replace("{fine_tune_id}",encodeURIComponent(String(i))),u=new URL(c,a.DUMMY_BASE_URL);let o;l&&(o=l.baseOptions);const f=Object.assign(Object.assign({method:"GET"},o),s),h={},p={};a.setSearchParams(u,p);let m=o&&o.headers?o.headers:{};return f.headers=Object.assign(Object.assign(Object.assign({},h),m),s.headers),{url:a.toPathString(u),options:f}}),retrieveModel:(i,s={})=>e(this,void 0,void 0,function*(){a.assertParamExists("retrieveModel","model",i);const c="/models/{model}".replace("{model}",encodeURIComponent(String(i))),u=new URL(c,a.DUMMY_BASE_URL);let o;l&&(o=l.baseOptions);const f=Object.assign(Object.assign({method:"GET"},o),s),h={},p={};a.setSearchParams(u,p);let m=o&&o.headers?o.headers:{};return f.headers=Object.assign(Object.assign(Object.assign({},h),m),s.headers),{url:a.toPathString(u),options:f}})}},r.OpenAIApiFp=function(l){const i=r.OpenAIApiAxiosParamCreator(l);return{cancelFineTune(s,c){return e(this,void 0,void 0,function*(){const u=yield i.cancelFineTune(s,c);return a.createRequestFunction(u,t.default,n.BASE_PATH,l)})},createAnswer(s,c){return e(this,void 0,void 0,function*(){const u=yield i.createAnswer(s,c);return a.createRequestFunction(u,t.default,n.BASE_PATH,l)})},createChatCompletion(s,c){return e(this,void 0,void 0,function*(){const u=yield i.createChatCompletion(s,c);return a.createRequestFunction(u,t.default,n.BASE_PATH,l)})},createClassification(s,c){return e(this,void 0,void 0,function*(){const u=yield i.createClassification(s,c);return a.createRequestFunction(u,t.default,n.BASE_PATH,l)})},createCompletion(s,c){return e(this,void 0,void 0,function*(){const u=yield i.createCompletion(s,c);return a.createRequestFunction(u,t.default,n.BASE_PATH,l)})},createEdit(s,c){return e(this,void 0,void 0,function*(){const u=yield i.createEdit(s,c);return a.createRequestFunction(u,t.default,n.BASE_PATH,l)})},createEmbedding(s,c){return e(this,void 0,void 0,function*(){const u=yield i.createEmbedding(s,c);return a.createRequestFunction(u,t.default,n.BASE_PATH,l)})},createFile(s,c,u){return e(this,void 0,void 0,function*(){const o=yield i.createFile(s,c,u);return a.createRequestFunction(o,t.default,n.BASE_PATH,l)})},createFineTune(s,c){return e(this,void 0,void 0,function*(){const u=yield i.createFineTune(s,c);return a.createRequestFunction(u,t.default,n.BASE_PATH,l)})},createImage(s,c){return e(this,void 0,void 0,function*(){const u=yield i.createImage(s,c);return a.createRequestFunction(u,t.default,n.BASE_PATH,l)})},createImageEdit(s,c,u,o,f,h,p,m){return e(this,void 0,void 0,function*(){const y=yield i.createImageEdit(s,c,u,o,f,h,p,m);return a.createRequestFunction(y,t.default,n.BASE_PATH,l)})},createImageVariation(s,c,u,o,f,h){return e(this,void 0,void 0,function*(){const p=yield i.createImageVariation(s,c,u,o,f,h);return a.createRequestFunction(p,t.default,n.BASE_PATH,l)})},createModeration(s,c){return e(this,void 0,void 0,function*(){const u=yield i.createModeration(s,c);return a.createRequestFunction(u,t.default,n.BASE_PATH,l)})},createSearch(s,c,u){return e(this,void 0,void 0,function*(){const o=yield i.createSearch(s,c,u);return a.createRequestFunction(o,t.default,n.BASE_PATH,l)})},createTranscription(s,c,u,o,f,h,p){return e(this,void 0,void 0,function*(){const m=yield i.createTranscription(s,c,u,o,f,h,p);return a.createRequestFunction(m,t.default,n.BASE_PATH,l)})},createTranslation(s,c,u,o,f,h){return e(this,void 0,void 0,function*(){const p=yield i.createTranslation(s,c,u,o,f,h);return a.createRequestFunction(p,t.default,n.BASE_PATH,l)})},deleteFile(s,c){return e(this,void 0,void 0,function*(){const u=yield i.deleteFile(s,c);return a.createRequestFunction(u,t.default,n.BASE_PATH,l)})},deleteModel(s,c){return e(this,void 0,void 0,function*(){const u=yield i.deleteModel(s,c);return a.createRequestFunction(u,t.default,n.BASE_PATH,l)})},downloadFile(s,c){return e(this,void 0,void 0,function*(){const u=yield i.downloadFile(s,c);return a.createRequestFunction(u,t.default,n.BASE_PATH,l)})},listEngines(s){return e(this,void 0,void 0,function*(){const c=yield i.listEngines(s);return a.createRequestFunction(c,t.default,n.BASE_PATH,l)})},listFiles(s){return e(this,void 0,void 0,function*(){const c=yield i.listFiles(s);return a.createRequestFunction(c,t.default,n.BASE_PATH,l)})},listFineTuneEvents(s,c,u){return e(this,void 0,void 0,function*(){const o=yield i.listFineTuneEvents(s,c,u);return a.createRequestFunction(o,t.default,n.BASE_PATH,l)})},listFineTunes(s){return e(this,void 0,void 0,function*(){const c=yield i.listFineTunes(s);return a.createRequestFunction(c,t.default,n.BASE_PATH,l)})},listModels(s){return e(this,void 0,void 0,function*(){const c=yield i.listModels(s);return a.createRequestFunction(c,t.default,n.BASE_PATH,l)})},retrieveEngine(s,c){return e(this,void 0,void 0,function*(){const u=yield i.retrieveEngine(s,c);return a.createRequestFunction(u,t.default,n.BASE_PATH,l)})},retrieveFile(s,c){return e(this,void 0,void 0,function*(){const u=yield i.retrieveFile(s,c);return a.createRequestFunction(u,t.default,n.BASE_PATH,l)})},retrieveFineTune(s,c){return e(this,void 0,void 0,function*(){const u=yield i.retrieveFineTune(s,c);return a.createRequestFunction(u,t.default,n.BASE_PATH,l)})},retrieveModel(s,c){return e(this,void 0,void 0,function*(){const u=yield i.retrieveModel(s,c);return a.createRequestFunction(u,t.default,n.BASE_PATH,l)})}}},r.OpenAIApiFactory=function(l,i,s){const c=r.OpenAIApiFp(l);return{cancelFineTune(u,o){return c.cancelFineTune(u,o).then(f=>f(s,i))},createAnswer(u,o){return c.createAnswer(u,o).then(f=>f(s,i))},createChatCompletion(u,o){return c.createChatCompletion(u,o).then(f=>f(s,i))},createClassification(u,o){return c.createClassification(u,o).then(f=>f(s,i))},createCompletion(u,o){return c.createCompletion(u,o).then(f=>f(s,i))},createEdit(u,o){return c.createEdit(u,o).then(f=>f(s,i))},createEmbedding(u,o){return c.createEmbedding(u,o).then(f=>f(s,i))},createFile(u,o,f){return c.createFile(u,o,f).then(h=>h(s,i))},createFineTune(u,o){return c.createFineTune(u,o).then(f=>f(s,i))},createImage(u,o){return c.createImage(u,o).then(f=>f(s,i))},createImageEdit(u,o,f,h,p,m,y,E){return c.createImageEdit(u,o,f,h,p,m,y,E).then(T=>T(s,i))},createImageVariation(u,o,f,h,p,m){return c.createImageVariation(u,o,f,h,p,m).then(y=>y(s,i))},createModeration(u,o){return c.createModeration(u,o).then(f=>f(s,i))},createSearch(u,o,f){return c.createSearch(u,o,f).then(h=>h(s,i))},createTranscription(u,o,f,h,p,m,y){return c.createTranscription(u,o,f,h,p,m,y).then(E=>E(s,i))},createTranslation(u,o,f,h,p,m){return c.createTranslation(u,o,f,h,p,m).then(y=>y(s,i))},deleteFile(u,o){return c.deleteFile(u,o).then(f=>f(s,i))},deleteModel(u,o){return c.deleteModel(u,o).then(f=>f(s,i))},downloadFile(u,o){return c.downloadFile(u,o).then(f=>f(s,i))},listEngines(u){return c.listEngines(u).then(o=>o(s,i))},listFiles(u){return c.listFiles(u).then(o=>o(s,i))},listFineTuneEvents(u,o,f){return c.listFineTuneEvents(u,o,f).then(h=>h(s,i))},listFineTunes(u){return c.listFineTunes(u).then(o=>o(s,i))},listModels(u){return c.listModels(u).then(o=>o(s,i))},retrieveEngine(u,o){return c.retrieveEngine(u,o).then(f=>f(s,i))},retrieveFile(u,o){return c.retrieveFile(u,o).then(f=>f(s,i))},retrieveFineTune(u,o){return c.retrieveFineTune(u,o).then(f=>f(s,i))},retrieveModel(u,o){return c.retrieveModel(u,o).then(f=>f(s,i))}}};class d extends n.BaseAPI{cancelFineTune(i,s){return r.OpenAIApiFp(this.configuration).cancelFineTune(i,s).then(c=>c(this.axios,this.basePath))}createAnswer(i,s){return r.OpenAIApiFp(this.configuration).createAnswer(i,s).then(c=>c(this.axios,this.basePath))}createChatCompletion(i,s){return r.OpenAIApiFp(this.configuration).createChatCompletion(i,s).then(c=>c(this.axios,this.basePath))}createClassification(i,s){return r.OpenAIApiFp(this.configuration).createClassification(i,s).then(c=>c(this.axios,this.basePath))}createCompletion(i,s){return r.OpenAIApiFp(this.configuration).createCompletion(i,s).then(c=>c(this.axios,this.basePath))}createEdit(i,s){return r.OpenAIApiFp(this.configuration).createEdit(i,s).then(c=>c(this.axios,this.basePath))}createEmbedding(i,s){return r.OpenAIApiFp(this.configuration).createEmbedding(i,s).then(c=>c(this.axios,this.basePath))}createFile(i,s,c){return r.OpenAIApiFp(this.configuration).createFile(i,s,c).then(u=>u(this.axios,this.basePath))}createFineTune(i,s){return r.OpenAIApiFp(this.configuration).createFineTune(i,s).then(c=>c(this.axios,this.basePath))}createImage(i,s){return r.OpenAIApiFp(this.configuration).createImage(i,s).then(c=>c(this.axios,this.basePath))}createImageEdit(i,s,c,u,o,f,h,p){return r.OpenAIApiFp(this.configuration).createImageEdit(i,s,c,u,o,f,h,p).then(m=>m(this.axios,this.basePath))}createImageVariation(i,s,c,u,o,f){return r.OpenAIApiFp(this.configuration).createImageVariation(i,s,c,u,o,f).then(h=>h(this.axios,this.basePath))}createModeration(i,s){return r.OpenAIApiFp(this.configuration).createModeration(i,s).then(c=>c(this.axios,this.basePath))}createSearch(i,s,c){return r.OpenAIApiFp(this.configuration).createSearch(i,s,c).then(u=>u(this.axios,this.basePath))}createTranscription(i,s,c,u,o,f,h){return r.OpenAIApiFp(this.configuration).createTranscription(i,s,c,u,o,f,h).then(p=>p(this.axios,this.basePath))}createTranslation(i,s,c,u,o,f){return r.OpenAIApiFp(this.configuration).createTranslation(i,s,c,u,o,f).then(h=>h(this.axios,this.basePath))}deleteFile(i,s){return r.OpenAIApiFp(this.configuration).deleteFile(i,s).then(c=>c(this.axios,this.basePath))}deleteModel(i,s){return r.OpenAIApiFp(this.configuration).deleteModel(i,s).then(c=>c(this.axios,this.basePath))}downloadFile(i,s){return r.OpenAIApiFp(this.configuration).downloadFile(i,s).then(c=>c(this.axios,this.basePath))}listEngines(i){return r.OpenAIApiFp(this.configuration).listEngines(i).then(s=>s(this.axios,this.basePath))}listFiles(i){return r.OpenAIApiFp(this.configuration).listFiles(i).then(s=>s(this.axios,this.basePath))}listFineTuneEvents(i,s,c){return r.OpenAIApiFp(this.configuration).listFineTuneEvents(i,s,c).then(u=>u(this.axios,this.basePath))}listFineTunes(i){return r.OpenAIApiFp(this.configuration).listFineTunes(i).then(s=>s(this.axios,this.basePath))}listModels(i){return r.OpenAIApiFp(this.configuration).listModels(i).then(s=>s(this.axios,this.basePath))}retrieveEngine(i,s){return r.OpenAIApiFp(this.configuration).retrieveEngine(i,s).then(c=>c(this.axios,this.basePath))}retrieveFile(i,s){return r.OpenAIApiFp(this.configuration).retrieveFile(i,s).then(c=>c(this.axios,this.basePath))}retrieveFineTune(i,s){return r.OpenAIApiFp(this.configuration).retrieveFineTune(i,s).then(c=>c(this.axios,this.basePath))}retrieveModel(i,s){return r.OpenAIApiFp(this.configuration).retrieveModel(i,s).then(c=>c(this.axios,this.basePath))}}r.OpenAIApi=d})(zr);var ht={};const Ds="openai",Hs="3.3.0",Ls="Node.js library for the OpenAI API",Ns={type:"git",url:"git@github.com:openai/openai-node.git"},$s=["openai","open","ai","gpt-3","gpt3"],zs="OpenAI",Ys="MIT",Qs="./dist/index.js",Js="./dist/index.d.ts",Ks={build:"tsc --outDir dist/"},Gs={axios:"^0.26.0","form-data":"^4.0.0"},Ws={"@types/node":"^12.11.5",typescript:"^3.6.4"},Zs={name:Ds,version:Hs,description:Ls,repository:Ns,keywords:$s,author:zs,license:Ys,main:Qs,types:Js,scripts:Ks,dependencies:Gs,devDependencies:Ws};var It,Fr;function Xs(){return Fr||(Fr=1,It=typeof self=="object"?self.FormData:window.FormData),It}Object.defineProperty(ht,"__esModule",{value:!0});ht.Configuration=void 0;const ei=Zs;class ti{constructor(e={}){this.apiKey=e.apiKey,this.organization=e.organization,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor,this.baseOptions||(this.baseOptions={}),this.baseOptions.headers=Object.assign({"User-Agent":`OpenAI/NodeJS/${ei.version}`,Authorization:`Bearer ${this.apiKey}`},this.baseOptions.headers),this.organization&&(this.baseOptions.headers["OpenAI-Organization"]=this.organization),this.formDataCtor||(this.formDataCtor=Xs())}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(;.*)?$","i");return e!==null&&(t.test(e)||e.toLowerCase()==="application/json-patch+json")}}ht.Configuration=ti;(function(r){var e=je&&je.__createBinding||(Object.create?function(a,n,d,l){l===void 0&&(l=d),Object.defineProperty(a,l,{enumerable:!0,get:function(){return n[d]}})}:function(a,n,d,l){l===void 0&&(l=d),a[l]=n[d]}),t=je&&je.__exportStar||function(a,n){for(var d in a)d!=="default"&&!n.hasOwnProperty(d)&&e(n,a,d)};Object.defineProperty(r,"__esModule",{value:!0}),t(zr,r),t(ht,r)})(Ct);function ri(r){const e=new Ct.OpenAIApi(new Ct.Configuration({apiKey:r}));return async t=>(await e.createCompletion({model:"text-davinci-003",prompt:t,max_tokens:1e3})).data.choices[0].text??""}function kr(r){let e,t,a,n,d;function l(s){r[15](s)}let i={};return r[2]!==void 0&&(i.llm=r[2]),a=new Mn({props:i}),Se.push(()=>$e(a,"llm",l)),{c(){e=O("div"),t=j(),Ue(a.$$.fragment),this.h()},l(s){e=A(s,"DIV",{class:!0}),_(e).forEach(v),t=V(s),Be(a.$$.fragment,s),this.h()},h(){g(e,"class","divider")},m(s,c){I(s,e,c),I(s,t,c),xe(a,s,c),d=!0},p(s,c){const u={};!n&&c&4&&(n=!0,u.llm=s[2],ze(()=>n=!1)),a.$set(u)},i(s){d||(ae(a.$$.fragment,s),d=!0)},o(s){ue(a.$$.fragment,s),d=!1},d(s){s&&v(e),s&&v(t),Me(a,s)}}}function ai(r){let e,t,a,n,d,l=r[24].message+"",i;return{c(){e=O("div"),t=O("p"),a=U("Error"),n=j(),d=O("p"),i=U(l),this.h()},l(s){e=A(s,"DIV",{class:!0});var c=_(e);t=A(c,"P",{class:!0});var u=_(t);a=B(u,"Error"),u.forEach(v),n=V(c),d=A(c,"P",{});var o=_(d);i=B(o,l),o.forEach(v),c.forEach(v),this.h()},h(){g(t,"class","font-bold"),g(e,"class","alert alert-error mx-auto")},m(s,c){I(s,e,c),b(e,t),b(t,a),b(e,n),b(e,d),b(d,i)},p(s,c){c&8&&l!==(l=s[24].message+"")&&Qe(i,l)},i:z,o:z,d(s){s&&v(e)}}}function ni(r){let e,t,a=r[4]!==""&&Ir(r);return{c(){a&&a.c(),e=rt()},l(n){a&&a.l(n),e=rt()},m(n,d){a&&a.m(n,d),I(n,e,d),t=!0},p(n,d){n[4]!==""?a?(a.p(n,d),d&16&&ae(a,1)):(a=Ir(n),a.c(),ae(a,1),a.m(e.parentNode,e)):a&&(xr(),ue(a,1,1,()=>{a=null}),Br())},i(n){t||(ae(a),t=!0)},o(n){ue(a),t=!1},d(n){a&&a.d(n),n&&v(e)}}}function Ir(r){let e,t,a;function n(l){r[19](l)}let d={onRun:r[11]};return r[4]!==void 0&&(d.code=r[4]),e=new Sn({props:d}),Se.push(()=>$e(e,"code",n)),{c(){Ue(e.$$.fragment)},l(l){Be(e.$$.fragment,l)},m(l,i){xe(e,l,i),a=!0},p(l,i){const s={};!t&&i&16&&(t=!0,s.code=l[4],ze(()=>t=!1)),e.$set(s)},i(l){a||(ae(e.$$.fragment,l),a=!0)},o(l){ue(e.$$.fragment,l),a=!1},d(l){Me(e,l)}}}function si(r){let e;return{c(){e=O("div"),this.h()},l(t){e=A(t,"DIV",{class:!0}),_(e).forEach(v),this.h()},h(){g(e,"class","loading loading-lg mx-auto")},m(t,a){I(t,e,a)},p:z,i:z,o:z,d(t){t&&v(e)}}}function Cr(r){let e;return{c(){e=O("div"),this.h()},l(t){e=A(t,"DIV",{class:!0}),_(e).forEach(v),this.h()},h(){g(e,"class","loading loading-lg mx-auto")},m(t,a){I(t,e,a)},d(t){t&&v(e)}}}function ii(r){let e,t,a,n,d,l,i,s,c,u,o,f,h,p,m,y,E,T,F,w,x,k,P,M,K,D,R,$,Q,G,be,_e,ee,de,Oe,ge,fe,se,Ie,te,ve,pe,ye;function Je(C){r[12](C)}let De={};r[8]!==void 0&&(De.dialogElement=r[8]),e=new Ln({props:De}),Se.push(()=>$e(e,"dialogElement",Je)),l=new ga({props:{classNames:"text-4xl"}});let Y=r[9]!==""&&kr(r);function re(C){r[16](C)}let he={};r[1]!==void 0&&(he.selectedTools=r[1]),E=new An({props:he}),Se.push(()=>$e(E,"selectedTools",re));function Ae(C){r[18](C)}let Ke={};r[6]!==void 0&&(Ke.files=r[6]),R=new Aa({props:Ke}),Se.push(()=>$e(R,"files",Ae));let L={ctx:r,current:null,token:null,hasCatch:!0,pending:si,then:ni,catch:ai,error:24,blocks:[,,,]};Xt(de=r[3],L);function we(C){r[20](C)}let Ce={};r[5]!==void 0&&(Ce.messages=r[5]),se=new Un({props:Ce}),Se.push(()=>$e(se,"messages",we));let W=r[7]&&Cr();return{c(){Ue(e.$$.fragment),a=j(),n=O("div"),d=O("div"),Ue(l.$$.fragment),i=j(),s=O("h1"),c=U("Agents.js"),u=j(),o=O("button"),f=U("API keys"),h=j(),Y&&Y.c(),p=j(),m=O("div"),y=j(),Ue(E.$$.fragment),F=j(),w=O("div"),x=j(),k=O("span"),P=U("Input your request"),M=j(),K=O("textarea"),D=j(),Ue(R.$$.fragment),Q=j(),G=O("button"),be=U("generate"),ee=j(),L.block.c(),Oe=j(),ge=O("div"),fe=j(),Ue(se.$$.fragment),te=j(),W&&W.c(),this.h()},l(C){Be(e.$$.fragment,C),a=V(C),n=A(C,"DIV",{class:!0});var S=_(n);d=A(S,"DIV",{class:!0});var Z=_(d);Be(l.$$.fragment,Z),i=V(Z),s=A(Z,"H1",{class:!0});var Ee=_(s);c=B(Ee,"Agents.js"),Ee.forEach(v),u=V(Z),o=A(Z,"BUTTON",{class:!0});var Te=_(o);f=B(Te,"API keys"),Te.forEach(v),Z.forEach(v),h=V(S),Y&&Y.l(S),p=V(S),m=A(S,"DIV",{class:!0}),_(m).forEach(v),y=V(S),Be(E.$$.fragment,S),F=V(S),w=A(S,"DIV",{class:!0}),_(w).forEach(v),x=V(S),k=A(S,"SPAN",{class:!0});var oe=_(k);P=B(oe,"Input your request"),oe.forEach(v),M=V(S),K=A(S,"TEXTAREA",{class:!0,placeholder:!0}),_(K).forEach(v),D=V(S),Be(R.$$.fragment,S),Q=V(S),G=A(S,"BUTTON",{class:!0});var Ge=_(G);be=B(Ge,"generate"),Ge.forEach(v),ee=V(S),L.block.l(S),Oe=V(S),ge=A(S,"DIV",{class:!0}),_(ge).forEach(v),fe=V(S),Be(se.$$.fragment,S),te=V(S),W&&W.l(S),S.forEach(v),this.h()},h(){g(s,"class","text-3xl font-semibold mx-auto"),g(o,"class","btn btn-ghost"),g(d,"class","flex flex-row"),g(m,"class","divider"),g(w,"class","divider"),g(k,"class","label-text text-lg"),g(K,"class","textarea border-base-300 bg-base-300"),g(K,"placeholder","Ask something here"),g(G,"class","btn btn-primary mt-auto w-fit mx-auto"),G.disabled=_e=r[1].length===0,g(ge,"class","divider"),g(n,"class","flex flex-col space-y-4 max-w-xl")},m(C,S){xe(e,C,S),I(C,a,S),I(C,n,S),b(n,d),xe(l,d,null),b(d,i),b(d,s),b(s,c),b(d,u),b(d,o),b(o,f),b(n,h),Y&&Y.m(n,null),b(n,p),b(n,m),b(n,y),xe(E,n,null),b(n,F),b(n,w),b(n,x),b(n,k),b(k,P),b(n,M),b(n,K),Pe(K,r[0]),b(n,D),xe(R,n,null),b(n,Q),b(n,G),b(G,be),b(n,ee),L.block.m(n,L.anchor=null),L.mount=()=>n,L.anchor=Oe,b(n,Oe),b(n,ge),b(n,fe),xe(se,n,null),b(n,te),W&&W.m(n,null),ve=!0,pe||(ye=[N(o,"click",r[13]),N(o,"keydown",r[14]),N(K,"input",r[17]),N(G,"click",r[10]),N(G,"keypress",r[10])],pe=!0)},p(C,[S]){r=C;const Z={};!t&&S&256&&(t=!0,Z.dialogElement=r[8],ze(()=>t=!1)),e.$set(Z),r[9]!==""?Y?(Y.p(r,S),S&512&&ae(Y,1)):(Y=kr(r),Y.c(),ae(Y,1),Y.m(n,p)):Y&&(xr(),ue(Y,1,1,()=>{Y=null}),Br());const Ee={};!T&&S&2&&(T=!0,Ee.selectedTools=r[1],ze(()=>T=!1)),E.$set(Ee),S&1&&Pe(K,r[0]);const Te={};!$&&S&64&&($=!0,Te.files=r[6],ze(()=>$=!1)),R.$set(Te),(!ve||S&2&&_e!==(_e=r[1].length===0))&&(G.disabled=_e),L.ctx=r,S&8&&de!==(de=r[3])&&Xt(de,L)||ha(L,r,S);const oe={};!Ie&&S&32&&(Ie=!0,oe.messages=r[5],ze(()=>Ie=!1)),se.$set(oe),r[7]?W||(W=Cr(),W.c(),W.m(n,null)):W&&(W.d(1),W=null)},i(C){ve||(ae(e.$$.fragment,C),ae(l.$$.fragment,C),ae(Y),ae(E.$$.fragment,C),ae(R.$$.fragment,C),ae(L.block),ae(se.$$.fragment,C),ve=!0)},o(C){ue(e.$$.fragment,C),ue(l.$$.fragment,C),ue(Y),ue(E.$$.fragment,C),ue(R.$$.fragment,C);for(let S=0;S<3;S+=1){const Z=L.blocks[S];ue(Z)}ue(se.$$.fragment,C),ve=!1},d(C){Me(e,C),C&&v(a),C&&v(n),Me(l),Y&&Y.d(),Me(E),Me(R),L.block.d(),L.token=null,L=null,Me(se),W&&W.d(),pe=!1,ot(ye)}}}function oi(r,e,t){let a,n,d;Ye(r,nt,R=>t(21,a=R)),Ye(r,st,R=>t(9,n=R)),Ye(r,it,R=>t(22,d=R));let l="Draw a picture of a cat wearing a top hat and display it. Then caption the picture and read it out loud.",i=[],s="hf",c=null,u="",o=[],f,h=!1;const p=()=>{if(s==="hf")return d?gn(a,d):$r(a);if(s==="openai")return ri(n)},m=async()=>{const R=new rr(a,p(),qe.filter($=>i.includes($.name)));t(5,o=[]),t(3,c=R.generateCode(l,f)),t(4,u=await c)},y=async R=>{t(7,h=!0),t(5,o=[]);const $=new rr(a,p(),qe.filter(Q=>i.includes(Q.name)));t(5,o=await $.evaluateCode(R,f)),t(7,h=!1)};let E;function T(R){E=R,t(8,E)}const F=()=>E.showModal(),w=()=>E.showModal();function x(R){s=R,t(2,s)}function k(R){i=R,t(1,i)}function P(){l=this.value,t(0,l)}function M(R){f=R,t(6,f)}function K(R){u=R,t(4,u)}function D(R){o=R,t(5,o)}return[l,i,s,c,u,o,f,h,E,n,m,y,T,F,w,x,k,P,M,K,D]}class di extends Ve{constructor(e){super(),Re(this,e,oi,ii,Fe,{})}}export{di as component};