1var e={m:{},d:(t,a)=>{for(var r in a)e.o(a,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:a[r]})},u:e=>e+".js",o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};(()=>{var t;if("string"==typeof import.meta.url&&(t=import.meta.url),!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),e.p=t})(),e.b=document.baseURI||self.location.href;var t={};e.d(t,{I:()=>a});class a{constructor(e,t,a,r,s){this.type=e,this.url=t,this.init_callback=a,this.write_result_callback=r,this.on_complete_callback=s}load_worker(){"GGUF_CPU"===this.type&&(this.worker=new Worker(new URL(e.p+e.u(117),e.b),{type:"module"})),this.worker.onmessage=e=>{switch(e.data.event){case 1:this.init_callback&&this.init_callback();break;case 3:this.write_result_callback&&this.write_result_callback(e.data.line);break;case 4:this.on_complete_callback&&this.on_complete_callback()}},async function(e,t){let a=null,r=self;if(void 0===r)console.log("Oops, `window` is not defined");else if(r&&r.caches){a=await r.caches.open("llmjs-cache");const s=await a.match(e);if(s){const e=await s.arrayBuffer(),a=new Uint8Array(e);return void t(a)}}const s=new XMLHttpRequest;s.open("GET",e,!0),s.responseType="arraybuffer",s.onload=async r=>{const o=s.response;if(o){const r=new Uint8Array(o);a&&await a.put(e,new Response(o)),t(r)}},s.send(null)}(this.url,(e=>{this.worker.postMessage({event:0,model_bytes:e})}))}run({prompt:e,seed:t=-1,max_token_len:a=50,top_k:r=40,top_p:s=.9,temp:o=1,repeat_last_n:n=32,repeat_penalty:l=1.2,context_size:c=256,grammar:i="",json_schema:p="",regex:_=""}={}){this.worker.postMessage({event:2,prompt:e,seed:t,max_token_len:a,top_k:r,top_p:s,temp:o,repeat_last_n:n,repeat_penalty:l,context_size:c,grammar:i,json_schema:p,regex:_})}}var r=t.I;export{r as LLM};