diff --git "a/demo/ort-phi3/dist/esm/ort.wasm.min.js" "b/demo/ort-phi3/dist/esm/ort.wasm.min.js" new file mode 100644--- /dev/null +++ "b/demo/ort-phi3/dist/esm/ort.wasm.min.js" @@ -0,0 +1,11 @@ +/*! + * ONNX Runtime Web v1.18.0 + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. + */ +var tr=Object.defineProperty;var Ta=Object.getOwnPropertyDescriptor;var Ma=Object.getOwnPropertyNames;var Ra=Object.prototype.hasOwnProperty;var H=(n,r)=>()=>(n&&(r=n(n=0)),r);var nt=(n,r)=>()=>(r||n((r={exports:{}}).exports,r),r.exports),vt=(n,r)=>{for(var t in r)tr(n,t,{get:r[t],enumerable:!0})},Ca=(n,r,t,f)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of Ma(r))!Ra.call(n,s)&&s!==t&&tr(n,s,{get:()=>r[s],enumerable:!(f=Ta(r,s))||f.enumerable});return n};var at=n=>Ca(tr({},"__esModule",{value:!0}),n);var Dt,ze,Ot,xa,It,Ut=H(()=>{"use strict";Dt=new Map,ze=[],Ot=(n,r,t)=>{if(r&&typeof r.init=="function"&&typeof r.createInferenceSessionHandler=="function"){let f=Dt.get(n);if(f===void 0)Dt.set(n,{backend:r,priority:t});else{if(f.priority>t)return;if(f.priority===t&&f.backend!==r)throw new Error(`cannot register backend "${n}" using priority ${t}`)}if(t>=0){let s=ze.indexOf(n);s!==-1&&ze.splice(s,1);for(let m=0;m{let r=Dt.get(n);if(!r)return"backend not found.";if(r.initialized)return r.backend;if(r.aborted)return r.error;{let t=!!r.initPromise;try{return t||(r.initPromise=r.backend.init(n)),await r.initPromise,r.initialized=!0,r.backend}catch(f){return t||(r.error=`${f}`,r.aborted=!0),r.error}finally{delete r.initPromise}}},It=async n=>{let r=n.executionProviders||[],t=r.map(h=>typeof h=="string"?h:h.name),f=t.length===0?ze:t,s,m=[],c=new Set;for(let h of f){let g=await xa(h);typeof g=="string"?m.push({name:h,err:g}):(s||(s=g),s===g&&c.add(h))}if(!s)throw new Error(`no available backend found. ERR: ${m.map(h=>`[${h.name}] ${h.err}`).join(", ")}`);for(let{name:h,err:g}of m)t.includes(h)&&console.warn(`removing requested execution provider "${h}" from session options because it is not available: ${g}`);let o=r.filter(h=>c.has(typeof h=="string"?h:h.name));return[s,new Proxy(n,{get:(h,g)=>g==="executionProviders"?o:Reflect.get(h,g)})]}});var Jr=H(()=>{"use strict";Ut()});var Zr,Qr=H(()=>{"use strict";Zr="1.18.0"});var Kr,Oe,rr=H(()=>{"use strict";Qr();Kr="warning",Oe={wasm:{},webgl:{},webgpu:{},versions:{common:Zr},set logLevel(n){if(n!==void 0){if(typeof n!="string"||["verbose","info","warning","error","fatal"].indexOf(n)===-1)throw new Error(`Unsupported logging level: ${n}`);Kr=n}},get logLevel(){return Kr}};Object.defineProperty(Oe,"logLevel",{enumerable:!0})});var $,en=H(()=>{"use strict";rr();$=Oe});var tn,rn,nn=H(()=>{"use strict";tn=(n,r)=>{let t=typeof document<"u"?document.createElement("canvas"):new OffscreenCanvas(1,1);t.width=n.dims[3],t.height=n.dims[2];let f=t.getContext("2d");if(f!=null){let s,m;r?.tensorLayout!==void 0&&r.tensorLayout==="NHWC"?(s=n.dims[2],m=n.dims[3]):(s=n.dims[3],m=n.dims[2]);let c=r?.format!==void 0?r.format:"RGB",o=r?.norm,h,g;o===void 0||o.mean===void 0?h=[255,255,255,255]:typeof o.mean=="number"?h=[o.mean,o.mean,o.mean,o.mean]:(h=[o.mean[0],o.mean[1],o.mean[2],0],o.mean[3]!==void 0&&(h[3]=o.mean[3])),o===void 0||o.bias===void 0?g=[0,0,0,0]:typeof o.bias=="number"?g=[o.bias,o.bias,o.bias,o.bias]:(g=[o.bias[0],o.bias[1],o.bias[2],0],o.bias[3]!==void 0&&(g[3]=o.bias[3]));let O=m*s,_=0,v=O,R=O*2,C=-1;c==="RGBA"?(_=0,v=O,R=O*2,C=O*3):c==="RGB"?(_=0,v=O,R=O*2):c==="RBG"&&(_=0,R=O,v=O*2);for(let x=0;x{let t=typeof document<"u"?document.createElement("canvas").getContext("2d"):new OffscreenCanvas(1,1).getContext("2d"),f;if(t!=null){let s,m,c;r?.tensorLayout!==void 0&&r.tensorLayout==="NHWC"?(s=n.dims[2],m=n.dims[1],c=n.dims[3]):(s=n.dims[3],m=n.dims[2],c=n.dims[1]);let o=r!==void 0&&r.format!==void 0?r.format:"RGB",h=r?.norm,g,O;h===void 0||h.mean===void 0?g=[255,255,255,255]:typeof h.mean=="number"?g=[h.mean,h.mean,h.mean,h.mean]:(g=[h.mean[0],h.mean[1],h.mean[2],255],h.mean[3]!==void 0&&(g[3]=h.mean[3])),h===void 0||h.bias===void 0?O=[0,0,0,0]:typeof h.bias=="number"?O=[h.bias,h.bias,h.bias,h.bias]:(O=[h.bias[0],h.bias[1],h.bias[2],0],h.bias[3]!==void 0&&(O[3]=h.bias[3]));let _=m*s;if(r!==void 0&&(r.format!==void 0&&c===4&&r.format!=="RGBA"||c===3&&r.format!=="RGB"&&r.format!=="BGR"))throw new Error("Tensor format doesn't match input tensor dims");let v=4,R=0,C=1,x=2,S=3,B=0,L=_,W=_*2,V=-1;o==="RGBA"?(B=0,L=_,W=_*2,V=_*3):o==="RGB"?(B=0,L=_,W=_*2):o==="RBG"&&(B=0,W=_,L=_*2),f=t.createImageData(s,m);for(let I=0;I{"use strict";Ft();nr=(n,r)=>{if(n===void 0)throw new Error("Image buffer must be defined");if(r.height===void 0||r.width===void 0)throw new Error("Image height and width must be defined");if(r.tensorLayout==="NHWC")throw new Error("NHWC Tensor layout is not supported yet");let{height:t,width:f}=r,s=r.norm??{mean:255,bias:0},m,c;typeof s.mean=="number"?m=[s.mean,s.mean,s.mean,s.mean]:m=[s.mean[0],s.mean[1],s.mean[2],s.mean[3]??255],typeof s.bias=="number"?c=[s.bias,s.bias,s.bias,s.bias]:c=[s.bias[0],s.bias[1],s.bias[2],s.bias[3]??0];let o=r.format!==void 0?r.format:"RGBA",h=r.tensorFormat!==void 0&&r.tensorFormat!==void 0?r.tensorFormat:"RGB",g=t*f,O=h==="RGBA"?new Float32Array(g*4):new Float32Array(g*3),_=4,v=0,R=1,C=2,x=3,S=0,B=g,L=g*2,W=-1;o==="RGB"&&(_=3,v=0,R=1,C=2,x=-1),h==="RGBA"?W=g*3:h==="RBG"?(S=0,L=g,B=g*2):h==="BGR"&&(L=0,B=g,S=g*2);for(let I=0;I{let t=typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement,f=typeof ImageData<"u"&&n instanceof ImageData,s=typeof ImageBitmap<"u"&&n instanceof ImageBitmap,m=typeof n=="string",c,o=r??{},h=()=>{if(typeof document<"u")return document.createElement("canvas");if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(1,1);throw new Error("Canvas is not supported")},g=O=>O instanceof HTMLCanvasElement||O instanceof OffscreenCanvas?O.getContext("2d"):null;if(t){let O=h();O.width=n.width,O.height=n.height;let _=g(O);if(_!=null){let v=n.height,R=n.width;if(r!==void 0&&r.resizedHeight!==void 0&&r.resizedWidth!==void 0&&(v=r.resizedHeight,R=r.resizedWidth),r!==void 0){if(o=r,r.tensorFormat!==void 0)throw new Error("Image input config format must be RGBA for HTMLImageElement");o.tensorFormat="RGBA",o.height=v,o.width=R}else o.tensorFormat="RGBA",o.height=v,o.width=R;_.drawImage(n,0,0),c=_.getImageData(0,0,R,v).data}else throw new Error("Can not access image data")}else if(f){let O,_;if(r!==void 0&&r.resizedWidth!==void 0&&r.resizedHeight!==void 0?(O=r.resizedHeight,_=r.resizedWidth):(O=n.height,_=n.width),r!==void 0&&(o=r),o.format="RGBA",o.height=O,o.width=_,r!==void 0){let v=h();v.width=_,v.height=O;let R=g(v);if(R!=null)R.putImageData(n,0,0),c=R.getImageData(0,0,_,O).data;else throw new Error("Can not access image data")}else c=n.data}else if(s){if(r===void 0)throw new Error("Please provide image config with format for Imagebitmap");let O=h();O.width=n.width,O.height=n.height;let _=g(O);if(_!=null){let v=n.height,R=n.width;return _.drawImage(n,0,0,R,v),c=_.getImageData(0,0,R,v).data,o.height=v,o.width=R,nr(c,o)}else throw new Error("Can not access image data")}else{if(m)return new Promise((O,_)=>{let v=h(),R=g(v);if(!n||!R)return _();let C=new Image;C.crossOrigin="Anonymous",C.src=n,C.onload=()=>{v.width=C.width,v.height=C.height,R.drawImage(C,0,0,v.width,v.height);let x=R.getImageData(0,0,v.width,v.height);o.height=v.height,o.width=v.width,O(nr(x.data,o))}});throw new Error("Input data provided is not supported - aborted tensor creation")}if(c!==void 0)return nr(c,o);throw new Error("Input data provided is not supported - aborted tensor creation")},on=(n,r)=>{let{width:t,height:f,download:s,dispose:m}=r,c=[1,f,t,4];return new me({location:"texture",type:"float32",texture:n,dims:c,download:s,dispose:m})},sn=(n,r)=>{let{dataType:t,dims:f,download:s,dispose:m}=r;return new me({location:"gpu-buffer",type:t??"float32",gpuBuffer:n,dims:f,download:s,dispose:m})},un=(n,r,t)=>new me({location:"cpu-pinned",type:n,data:r,dims:t??[r.length]})});var $e,_t,ln,cn,dn=H(()=>{"use strict";$e=new Map([["float32",Float32Array],["uint8",Uint8Array],["int8",Int8Array],["uint16",Uint16Array],["int16",Int16Array],["int32",Int32Array],["bool",Uint8Array],["float64",Float64Array],["uint32",Uint32Array]]),_t=new Map([[Float32Array,"float32"],[Uint8Array,"uint8"],[Int8Array,"int8"],[Uint16Array,"uint16"],[Int16Array,"int16"],[Int32Array,"int32"],[Float64Array,"float64"],[Uint32Array,"uint32"]]),ln=!1,cn=()=>{if(!ln){ln=!0;let n=typeof BigInt64Array<"u"&&BigInt64Array.from,r=typeof BigUint64Array<"u"&&BigUint64Array.from,t=typeof Float16Array<"u"&&Float16Array.from;n&&($e.set("int64",BigInt64Array),_t.set(BigInt64Array,"int64")),r&&($e.set("uint64",BigUint64Array),_t.set(BigUint64Array,"uint64")),t?($e.set("float16",Float16Array),_t.set(Float16Array,"float16")):$e.set("float16",Uint16Array)}}});var pn,mn,hn=H(()=>{"use strict";Ft();pn=n=>{let r=1;for(let t=0;t{switch(n.location){case"cpu":return new me(n.type,n.data,r);case"cpu-pinned":return new me({location:"cpu-pinned",data:n.data,type:n.type,dims:r});case"texture":return new me({location:"texture",texture:n.texture,type:n.type,dims:r});case"gpu-buffer":return new me({location:"gpu-buffer",gpuBuffer:n.gpuBuffer,type:n.type,dims:r});default:throw new Error(`tensorReshape: tensor location ${n.location} is not supported`)}}});var me,Ft=H(()=>{"use strict";nn();fn();dn();hn();me=class{constructor(r,t,f){cn();let s,m;if(typeof r=="object"&&"location"in r)switch(this.dataLocation=r.location,s=r.type,m=r.dims,r.location){case"cpu-pinned":{let o=$e.get(s);if(!o)throw new TypeError(`unsupported type "${s}" to create tensor from pinned buffer`);if(!(r.data instanceof o))throw new TypeError(`buffer should be of type ${o.name}`);this.cpuData=r.data;break}case"texture":{if(s!=="float32")throw new TypeError(`unsupported type "${s}" to create tensor from texture`);this.gpuTextureData=r.texture,this.downloader=r.download,this.disposer=r.dispose;break}case"gpu-buffer":{if(s!=="float32"&&s!=="float16"&&s!=="int32"&&s!=="int64"&&s!=="uint32"&&s!=="uint8"&&s!=="bool")throw new TypeError(`unsupported type "${s}" to create tensor from gpu buffer`);this.gpuBufferData=r.gpuBuffer,this.downloader=r.download,this.disposer=r.dispose;break}default:throw new Error(`Tensor constructor: unsupported location '${this.dataLocation}'`)}else{let o,h;if(typeof r=="string")if(s=r,h=f,r==="string"){if(!Array.isArray(t))throw new TypeError("A string tensor's data must be a string array.");o=t}else{let g=$e.get(r);if(g===void 0)throw new TypeError(`Unsupported tensor type: ${r}.`);if(Array.isArray(t)){if(r==="float16"&&g===Uint16Array)throw new TypeError("Creating a float16 tensor from number array is not supported. Please use Uint16Array as data.");r==="uint64"||r==="int64"?o=g.from(t,BigInt):o=g.from(t)}else if(t instanceof g)o=t;else throw new TypeError(`A ${s} tensor's data must be type of ${g}`)}else if(h=t,Array.isArray(r)){if(r.length===0)throw new TypeError("Tensor type cannot be inferred from an empty array.");let g=typeof r[0];if(g==="string")s="string",o=r;else if(g==="boolean")s="bool",o=Uint8Array.from(r);else throw new TypeError(`Invalid element type of data array: ${g}.`)}else{let g=_t.get(r.constructor);if(g===void 0)throw new TypeError(`Unsupported type for tensor data: ${r.constructor}.`);s=g,o=r}if(h===void 0)h=[o.length];else if(!Array.isArray(h))throw new TypeError("A tensor's dims must be a number array");m=h,this.cpuData=o,this.dataLocation="cpu"}let c=pn(m);if(this.cpuData&&c!==this.cpuData.length)throw new Error(`Tensor's size(${c}) does not match data length(${this.cpuData.length}).`);this.type=s,this.dims=m,this.size=c}static async fromImage(r,t){return an(r,t)}static fromTexture(r,t){return on(r,t)}static fromGpuBuffer(r,t){return sn(r,t)}static fromPinnedBuffer(r,t,f){return un(r,t,f)}toDataURL(r){return tn(this,r)}toImageData(r){return rn(this,r)}get data(){if(this.ensureValid(),!this.cpuData)throw new Error("The data is not on CPU. Use `getData()` to download GPU data to CPU, or use `texture` or `gpuBuffer` property to access the GPU data directly.");return this.cpuData}get location(){return this.dataLocation}get texture(){if(this.ensureValid(),!this.gpuTextureData)throw new Error("The data is not stored as a WebGL texture.");return this.gpuTextureData}get gpuBuffer(){if(this.ensureValid(),!this.gpuBufferData)throw new Error("The data is not stored as a WebGPU buffer.");return this.gpuBufferData}async getData(r){switch(this.ensureValid(),this.dataLocation){case"cpu":case"cpu-pinned":return this.data;case"texture":case"gpu-buffer":{if(!this.downloader)throw new Error("The current tensor is not created with a specified data downloader.");if(this.isDownloading)throw new Error("The current tensor is being downloaded.");try{this.isDownloading=!0;let t=await this.downloader();return this.downloader=void 0,this.dataLocation="cpu",this.cpuData=t,r&&this.disposer&&(this.disposer(),this.disposer=void 0),t}finally{this.isDownloading=!1}}default:throw new Error(`cannot get data from location: ${this.dataLocation}`)}}dispose(){if(this.isDownloading)throw new Error("The current tensor is being downloaded.");this.disposer&&(this.disposer(),this.disposer=void 0),this.cpuData=void 0,this.gpuTextureData=void 0,this.gpuBufferData=void 0,this.downloader=void 0,this.isDownloading=void 0,this.dataLocation="none"}ensureValid(){if(this.dataLocation==="none")throw new Error("The tensor is disposed.")}reshape(r){if(this.ensureValid(),this.downloader||this.disposer)throw new Error("Cannot reshape a tensor that owns GPU resource.");return mn(this,r)}}});var le,Bt=H(()=>{"use strict";Ft();le=me});var gn,yn,Ye,Ve,ar=H(()=>{"use strict";rr();gn=(n,r)=>{(typeof Oe.trace>"u"?!Oe.wasm.trace:!Oe.trace)||console.timeStamp(`${n}::ORT::${r}`)},yn=(n,r)=>{let t=new Error().stack?.split(/\r\n|\r|\n/g)||[],f=!1;for(let s=0;s{(typeof Oe.trace>"u"?!Oe.wasm.trace:!Oe.trace)||yn("BEGIN",n)},Ve=n=>{(typeof Oe.trace>"u"?!Oe.wasm.trace:!Oe.trace)||yn("END",n)}});var Lt,wn=H(()=>{"use strict";Ut();Bt();ar();Lt=class n{constructor(r){this.handler=r}async run(r,t,f){Ye();let s={},m={};if(typeof r!="object"||r===null||r instanceof le||Array.isArray(r))throw new TypeError("'feeds' must be an object that use input names as keys and OnnxValue as corresponding values.");let c=!0;if(typeof t=="object"){if(t===null)throw new TypeError("Unexpected argument[1]: cannot be null.");if(t instanceof le)throw new TypeError("'fetches' cannot be a Tensor");if(Array.isArray(t)){if(t.length===0)throw new TypeError("'fetches' cannot be an empty array.");c=!1;for(let g of t){if(typeof g!="string")throw new TypeError("'fetches' must be a string array or an object.");if(this.outputNames.indexOf(g)===-1)throw new RangeError(`'fetches' contains invalid output name: ${g}.`);s[g]=null}if(typeof f=="object"&&f!==null)m=f;else if(typeof f<"u")throw new TypeError("'options' must be an object.")}else{let g=!1,O=Object.getOwnPropertyNames(t);for(let _ of this.outputNames)if(O.indexOf(_)!==-1){let v=t[_];(v===null||v instanceof le)&&(g=!0,c=!1,s[_]=v)}if(g){if(typeof f=="object"&&f!==null)m=f;else if(typeof f<"u")throw new TypeError("'options' must be an object.")}else m=t}}else if(typeof t<"u")throw new TypeError("Unexpected argument[1]: must be 'fetches' or 'options'.");for(let g of this.inputNames)if(typeof r[g]>"u")throw new Error(`input '${g}' is missing in 'feeds'.`);if(c)for(let g of this.outputNames)s[g]=null;let o=await this.handler.run(r,s,m),h={};for(let g in o)if(Object.hasOwnProperty.call(o,g)){let O=o[g];O instanceof le?h[g]=O:h[g]=new le(O.type,O.data,O.dims)}return Ve(),h}async release(){return this.handler.dispose()}static async create(r,t,f,s){Ye();let m,c={};if(typeof r=="string"){if(m=r,typeof t=="object"&&t!==null)c=t;else if(typeof t<"u")throw new TypeError("'options' must be an object.")}else if(r instanceof Uint8Array){if(m=r,typeof t=="object"&&t!==null)c=t;else if(typeof t<"u")throw new TypeError("'options' must be an object.")}else if(r instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&r instanceof SharedArrayBuffer){let O=r,_=0,v=r.byteLength;if(typeof t=="object"&&t!==null)c=t;else if(typeof t=="number"){if(_=t,!Number.isSafeInteger(_))throw new RangeError("'byteOffset' must be an integer.");if(_<0||_>=O.byteLength)throw new RangeError(`'byteOffset' is out of range [0, ${O.byteLength}).`);if(v=r.byteLength-_,typeof f=="number"){if(v=f,!Number.isSafeInteger(v))throw new RangeError("'byteLength' must be an integer.");if(v<=0||_+v>O.byteLength)throw new RangeError(`'byteLength' is out of range (0, ${O.byteLength-_}].`);if(typeof s=="object"&&s!==null)c=s;else if(typeof s<"u")throw new TypeError("'options' must be an object.")}else if(typeof f<"u")throw new TypeError("'byteLength' must be a number.")}else if(typeof t<"u")throw new TypeError("'options' must be an object.");m=new Uint8Array(O,_,v)}else throw new TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");let[o,h]=await It(c),g=await o.createInferenceSessionHandler(m,h);return Ve(),new n(g)}startProfiling(){this.handler.startProfiling()}endProfiling(){this.handler.endProfiling()}get inputNames(){return this.handler.inputNames}get outputNames(){return this.handler.outputNames}}});var Pa,bn=H(()=>{"use strict";wn();Pa=Lt});var vn=H(()=>{"use strict"});var On=H(()=>{"use strict"});var _n=H(()=>{"use strict"});var En=H(()=>{"use strict"});var Da,kt,An=H(()=>{"use strict";Ut();Bt();Da="Training backend could not be resolved. Make sure you're using the correct configuration & WebAssembly files.",kt=class n{constructor(r,t,f){this.handler=r,this.hasOptimizerModel=t,this.hasEvalModel=f}get trainingInputNames(){return this.handler.inputNames}get trainingOutputNames(){return this.handler.outputNames}get evalInputNames(){if(this.hasEvalModel)return this.handler.evalInputNames;throw new Error("This training session has no evalModel loaded.")}get evalOutputNames(){if(this.hasEvalModel)return this.handler.evalOutputNames;throw new Error("This training session has no evalModel loaded.")}static async create(r,t){let f=r.evalModel||"",s=r.optimizerModel||"",m=t||{},[c,o]=await It(m);if(c.createTrainingSessionHandler){let h=await c.createTrainingSessionHandler(r.checkpointState,r.trainModel,f,s,o);return new n(h,!!r.optimizerModel,!!r.evalModel)}else throw new Error(Da)}typeNarrowingForRunStep(r,t,f,s,m){let c={},o={};if(typeof f!="object"||f===null||f instanceof le||Array.isArray(f))throw new TypeError("'feeds' must be an object that use input names as keys and OnnxValue as corresponding values.");let h=!0;if(typeof s=="object"){if(s===null)throw new TypeError("Unexpected argument[1]: cannot be null.");if(s instanceof le)throw new TypeError("'fetches' cannot be a Tensor");if(Array.isArray(s)){if(s.length===0)throw new TypeError("'fetches' cannot be an empty array.");h=!1;for(let g of s){if(typeof g!="string")throw new TypeError("'fetches' must be a string array or an object.");if(t.indexOf(g)===-1)throw new RangeError(`'fetches' contains invalid output name: ${g}.`);c[g]=null}if(typeof m=="object"&&m!==null)o=m;else if(typeof m<"u")throw new TypeError("'options' must be an object.")}else{let g=!1,O=Object.getOwnPropertyNames(s);for(let _ of t)if(O.indexOf(_)!==-1){let v=s[_];(v===null||v instanceof le)&&(g=!0,h=!1,c[_]=v)}if(g){if(typeof m=="object"&&m!==null)o=m;else if(typeof m<"u")throw new TypeError("'options' must be an object.")}else o=s}}else if(typeof s<"u")throw new TypeError("Unexpected argument[1]: must be 'fetches' or 'options'.");for(let g of r)if(typeof f[g]>"u")throw new Error(`input '${g}' is missing in 'feeds'.`);if(h)for(let g of t)c[g]=null;return[c,o]}convertHandlerReturnTypeToMapOfTensors(r){let t={};for(let f in r)if(Object.hasOwnProperty.call(r,f)){let s=r[f];s instanceof le?t[f]=s:t[f]=new le(s.type,s.data,s.dims)}return t}async lazyResetGrad(){await this.handler.lazyResetGrad()}async runTrainStep(r,t,f){let[s,m]=this.typeNarrowingForRunStep(this.trainingInputNames,this.trainingOutputNames,r,t,f),c=await this.handler.runTrainStep(r,s,m);return this.convertHandlerReturnTypeToMapOfTensors(c)}async runOptimizerStep(r){if(this.hasOptimizerModel)await this.handler.runOptimizerStep(r||{});else throw new Error("This TrainingSession has no OptimizerModel loaded.")}async runEvalStep(r,t,f){if(this.hasEvalModel){let[s,m]=this.typeNarrowingForRunStep(this.evalInputNames,this.evalOutputNames,r,t,f),c=await this.handler.runEvalStep(r,s,m);return this.convertHandlerReturnTypeToMapOfTensors(c)}else throw new Error("This TrainingSession has no EvalModel loaded.")}async getParametersSize(r=!0){return this.handler.getParametersSize(r)}async loadParametersBuffer(r,t=!0){let f=await this.getParametersSize(t);if(r.length!==4*f)throw new Error("Size of the buffer passed into loadParametersBuffer must match the number of parameters in the model. Please use getParametersSize method to check.");return this.handler.loadParametersBuffer(r,t)}async getContiguousParameters(r=!0){return this.handler.getContiguousParameters(r)}async release(){return this.handler.dispose()}}});var Ia,Sn=H(()=>{"use strict";An();Ia=kt});var or={};vt(or,{InferenceSession:()=>Pa,TRACE:()=>gn,TRACE_FUNC_BEGIN:()=>Ye,TRACE_FUNC_END:()=>Ve,Tensor:()=>le,TrainingSession:()=>Ia,env:()=>$,registerBackend:()=>Ot});var qe=H(()=>{"use strict";Jr();en();bn();Bt();vn();On();ar();_n();En();Sn()});var ir={};vt(ir,{createReadStream:()=>Mn,readFile:()=>Ua,readFileSync:()=>Fa});var Ua,Fa,Mn,sr=H(()=>{Ua=void 0,Fa=void 0,Mn=void 0});var ur={};vt(ur,{join:()=>Ba});var Ba,fr=H(()=>{Ba=void 0});var xn=nt((Cn,lr)=>{"use strict";var Rn=(()=>{var n=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(n=n||__filename),function(r={}){var t=r,f,s;t.ready=new Promise((i,l)=>{f=i,s=l});var m=Object.assign({},t),c="./this.program",o=typeof window=="object",h=typeof importScripts=="function",g=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",O="",_,v,R;if(g){var C=(sr(),at(ir)),x=(fr(),at(ur));O=h?x.dirname(O)+"/":__dirname+"/",_=(i,l)=>(i=i.startsWith("file://")?new URL(i):x.normalize(i),C.readFileSync(i,l?void 0:"utf8")),R=i=>(i=_(i,!0),i.buffer||(i=new Uint8Array(i)),i),v=(i,l,d,b=!0)=>{i=i.startsWith("file://")?new URL(i):x.normalize(i),C.readFile(i,b?void 0:"utf8",(T,U)=>{T?d(T):l(b?U.buffer:U)})},!t.thisProgram&&1"[Emscripten Module object]"}else(o||h)&&(h?O=self.location.href:typeof document<"u"&&document.currentScript&&(O=document.currentScript.src),n&&(O=n),O.indexOf("blob:")!==0?O=O.substr(0,O.replace(/[?#].*/,"").lastIndexOf("/")+1):O="",_=i=>{var l=new XMLHttpRequest;return l.open("GET",i,!1),l.send(null),l.responseText},h&&(R=i=>{var l=new XMLHttpRequest;return l.open("GET",i,!1),l.responseType="arraybuffer",l.send(null),new Uint8Array(l.response)}),v=(i,l,d)=>{var b=new XMLHttpRequest;b.open("GET",i,!0),b.responseType="arraybuffer",b.onload=()=>{b.status==200||b.status==0&&b.response?l(b.response):d()},b.onerror=d,b.send(null)});var S=t.print||console.log.bind(console),B=t.printErr||console.error.bind(console);Object.assign(t,m),m=null,t.thisProgram&&(c=t.thisProgram);var L;t.wasmBinary&&(L=t.wasmBinary);var W=t.noExitRuntime||!0;typeof WebAssembly!="object"&&ae("no native wasm support detected");var V,I,Me=!1,Te,he,D,j;function se(){var i=V.buffer;t.HEAP8=Te=new Int8Array(i),t.HEAP16=new Int16Array(i),t.HEAP32=D=new Int32Array(i),t.HEAPU8=he=new Uint8Array(i),t.HEAPU16=new Uint16Array(i),t.HEAPU32=j=new Uint32Array(i),t.HEAPF32=new Float32Array(i),t.HEAPF64=new Float64Array(i)}var Re=[],ke=[],Q=[];function P(){var i=t.preRun.shift();Re.unshift(i)}var k=0,ge=null,ce=null;function ae(i){throw t.onAbort&&t.onAbort(i),i="Aborted("+i+")",B(i),Me=!0,i=new WebAssembly.RuntimeError(i+". Build with -sASSERTIONS for more info."),s(i),i}function Ce(i){return i.startsWith("data:application/octet-stream;base64,")}var K;if(K="ort-wasm.wasm",!Ce(K)){var de=K;K=t.locateFile?t.locateFile(de,O):O+de}function Je(i){if(i==K&&L)return new Uint8Array(L);if(R)return R(i);throw"both async and sync fetching of the wasm failed"}function ye(i){if(!L&&(o||h)){if(typeof fetch=="function"&&!i.startsWith("file://"))return fetch(i,{credentials:"same-origin"}).then(l=>{if(!l.ok)throw"failed to load wasm binary file at '"+i+"'";return l.arrayBuffer()}).catch(()=>Je(i));if(v)return new Promise((l,d)=>{v(i,b=>l(new Uint8Array(b)),d)})}return Promise.resolve().then(()=>Je(i))}function xe(i,l,d){return ye(i).then(b=>WebAssembly.instantiate(b,l)).then(b=>b).then(d,b=>{B("failed to asynchronously prepare wasm: "+b),ae(b)})}function Ne(i,l){var d=K;return L||typeof WebAssembly.instantiateStreaming!="function"||Ce(d)||d.startsWith("file://")||g||typeof fetch!="function"?xe(d,i,l):fetch(d,{credentials:"same-origin"}).then(b=>WebAssembly.instantiateStreaming(b,i).then(l,function(T){return B("wasm streaming compile failed: "+T),B("falling back to ArrayBuffer instantiation"),xe(d,i,l)}))}var _e,be=i=>{for(;0>2>>>0]=l},this.za=function(l){j[this.va+8>>2>>>0]=l},this.xa=function(l,d){this.ya(),this.Ea(l),this.za(d)},this.ya=function(){j[this.va+16>>2>>>0]=0}}var Fe=0,ne=0,q=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,ve=(i,l,d)=>{l>>>=0;var b=l+d;for(d=l;i[d]&&!(d>=b);)++d;if(16T?b+=String.fromCharCode(T):(T-=65536,b+=String.fromCharCode(55296|T>>10,56320|T&1023))}}else b+=String.fromCharCode(T)}return b},Ee=(i,l)=>(i>>>=0)?ve(he,i,l):"",Be=i=>{for(var l=0,d=0;d=b?l++:2047>=b?l+=2:55296<=b&&57343>=b?(l+=4,++d):l+=3}return l},Ze=(i,l,d,b)=>{if(d>>>=0,!(0=N){var oe=i.charCodeAt(++U);N=65536+((N&1023)<<10)|oe&1023}if(127>=N){if(d>=b)break;l[d++>>>0]=N}else{if(2047>=N){if(d+1>=b)break;l[d++>>>0]=192|N>>6}else{if(65535>=N){if(d+2>=b)break;l[d++>>>0]=224|N>>12}else{if(d+3>=b)break;l[d++>>>0]=240|N>>18,l[d++>>>0]=128|N>>12&63}l[d++>>>0]=128|N>>6&63}l[d++>>>0]=128|N&63}}return l[d>>>0]=0,d-T},Ae=i=>i%4===0&&(i%100!==0||i%400===0),ft=[0,31,60,91,121,152,182,213,244,274,305,335],Ue=[0,31,59,90,120,151,181,212,243,273,304,334],lt=i=>{var l=Be(i)+1,d=ht(l);return d&&Ze(i,he,d,l),d},ct={},dt=()=>{if(!pt){var i={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:c||"./this.program"},l;for(l in ct)ct[l]===void 0?delete i[l]:i[l]=ct[l];var d=[];for(l in i)d.push(`${l}=${i[l]}`);pt=d}return pt},pt,Le=[null,[],[]],We=[31,29,31,30,31,30,31,31,30,31,30,31],Qe=[31,28,31,30,31,30,31,31,30,31,30,31];function Tt(i){var l=Array(Be(i)+1);return Ze(i,l,0,l.length),l}function mt(i,l,d,b){function T(y,G,Y){for(y=typeof y=="number"?y.toString():y||"";y.lengthbt?-1:0De-y.getDate())G-=De-y.getDate()+1,y.setDate(1),11>Y?y.setMonth(Y+1):(y.setMonth(0),y.setFullYear(y.getFullYear()+1));else{y.setDate(y.getDate()+G);break}}return Y=new Date(y.getFullYear()+1,0,4),G=oe(new Date(y.getFullYear(),0,4)),Y=oe(Y),0>=N(G,y)?0>=N(Y,y)?y.getFullYear()+1:y.getFullYear():y.getFullYear()-1}i>>>=0,l>>>=0,d>>>=0,b>>>=0;var ue=D[b+40>>2>>>0];b={Ca:D[b>>2>>>0],Ba:D[b+4>>2>>>0],ta:D[b+8>>2>>>0],wa:D[b+12>>2>>>0],ua:D[b+16>>2>>>0],sa:D[b+20>>2>>>0],ma:D[b+24>>2>>>0],ra:D[b+28>>2>>>0],Fa:D[b+32>>2>>>0],Aa:D[b+36>>2>>>0],Da:ue?Ee(ue):""},d=Ee(d),ue={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var fe in ue)d=d.replace(new RegExp(fe,"g"),ue[fe]);var yt="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),wt="January February March April May June July August September October November December".split(" ");ue={"%a":y=>yt[y.ma].substring(0,3),"%A":y=>yt[y.ma],"%b":y=>wt[y.ua].substring(0,3),"%B":y=>wt[y.ua],"%C":y=>U((y.sa+1900)/100|0,2),"%d":y=>U(y.wa,2),"%e":y=>T(y.wa,2," "),"%g":y=>pe(y).toString().substring(2),"%G":y=>pe(y),"%H":y=>U(y.ta,2),"%I":y=>(y=y.ta,y==0?y=12:12{for(var G=0,Y=0;Y<=y.ua-1;G+=(Ae(y.sa+1900)?We:Qe)[Y++]);return U(y.wa+G,3)},"%m":y=>U(y.ua+1,2),"%M":y=>U(y.Ba,2),"%n":()=>` +`,"%p":y=>0<=y.ta&&12>y.ta?"AM":"PM","%S":y=>U(y.Ca,2),"%t":()=>" ","%u":y=>y.ma||7,"%U":y=>U(Math.floor((y.ra+7-y.ma)/7),2),"%V":y=>{var G=Math.floor((y.ra+7-(y.ma+6)%7)/7);if(2>=(y.ma+371-y.ra-2)%7&&G++,G)G==53&&(Y=(y.ma+371-y.ra)%7,Y==4||Y==3&&Ae(y.sa)||(G=1));else{G=52;var Y=(y.ma+7-y.ra-1)%7;(Y==4||Y==5&&Ae(y.sa%400-1))&&G++}return U(G,2)},"%w":y=>y.ma,"%W":y=>U(Math.floor((y.ra+7-(y.ma+6)%7)/7),2),"%y":y=>(y.sa+1900).toString().substring(2),"%Y":y=>y.sa+1900,"%z":y=>{y=y.Aa;var G=0<=y;return y=Math.abs(y)/60,(G?"+":"-")+("0000"+(y/60*100+y%60)).slice(-4)},"%Z":y=>y.Da,"%%":()=>"%"},d=d.replace(/%%/g,"\0\0");for(fe in ue)d.includes(fe)&&(d=d.replace(new RegExp(fe,"g"),ue[fe](b)));return d=d.replace(/\0\0/g,"%"),fe=Tt(d),fe.length>l?0:(Te.set(fe,i>>>0),fe.length-1)}var Mt={a:function(i,l,d){throw i>>>=0,new Pe(i).xa(l>>>0,d>>>0),Fe=i,ne++,Fe},e:function(){return 0},H:function(){},x:function(){},z:function(){},k:function(){return 0},F:function(){},B:function(){},E:function(){},g:function(){},y:function(){},v:function(){},G:function(){},w:function(){},l:()=>!0,o:function(i,l,d){i=l+2097152>>>0<4194305-!!i?(i>>>0)+4294967296*l:NaN,d>>>=0,i=new Date(1e3*i),D[d>>2>>>0]=i.getUTCSeconds(),D[d+4>>2>>>0]=i.getUTCMinutes(),D[d+8>>2>>>0]=i.getUTCHours(),D[d+12>>2>>>0]=i.getUTCDate(),D[d+16>>2>>>0]=i.getUTCMonth(),D[d+20>>2>>>0]=i.getUTCFullYear()-1900,D[d+24>>2>>>0]=i.getUTCDay(),D[d+28>>2>>>0]=(i.getTime()-Date.UTC(i.getUTCFullYear(),0,1,0,0,0,0))/864e5|0},p:function(i,l,d){i=l+2097152>>>0<4194305-!!i?(i>>>0)+4294967296*l:NaN,d>>>=0,i=new Date(1e3*i),D[d>>2>>>0]=i.getSeconds(),D[d+4>>2>>>0]=i.getMinutes(),D[d+8>>2>>>0]=i.getHours(),D[d+12>>2>>>0]=i.getDate(),D[d+16>>2>>>0]=i.getMonth(),D[d+20>>2>>>0]=i.getFullYear()-1900,D[d+24>>2>>>0]=i.getDay(),D[d+28>>2>>>0]=(Ae(i.getFullYear())?ft:Ue)[i.getMonth()]+i.getDate()-1|0,D[d+36>>2>>>0]=-(60*i.getTimezoneOffset()),l=new Date(i.getFullYear(),6,1).getTimezoneOffset();var b=new Date(i.getFullYear(),0,1).getTimezoneOffset();D[d+32>>2>>>0]=(l!=b&&i.getTimezoneOffset()==Math.min(b,l))|0},q:function(i){i>>>=0;var l=new Date(D[i+20>>2>>>0]+1900,D[i+16>>2>>>0],D[i+12>>2>>>0],D[i+8>>2>>>0],D[i+4>>2>>>0],D[i>>2>>>0],0),d=D[i+32>>2>>>0],b=l.getTimezoneOffset(),T=new Date(l.getFullYear(),6,1).getTimezoneOffset(),U=new Date(l.getFullYear(),0,1).getTimezoneOffset(),N=Math.min(U,T);return 0>d?D[i+32>>2>>>0]=+(T!=U&&N==b):0>2>>>0]=l.getDay(),D[i+28>>2>>>0]=(Ae(l.getFullYear())?ft:Ue)[l.getMonth()]+l.getDate()-1|0,D[i>>2>>>0]=l.getSeconds(),D[i+4>>2>>>0]=l.getMinutes(),D[i+8>>2>>>0]=l.getHours(),D[i+12>>2>>>0]=l.getDate(),D[i+16>>2>>>0]=l.getMonth(),D[i+20>>2>>>0]=l.getYear(),i=l.getTime()/1e3,Ke((_e=i,1<=+Math.abs(_e)?0<_e?+Math.floor(_e/4294967296)>>>0:~~+Math.ceil((_e-+(~~_e>>>0))/4294967296)>>>0:0)),i>>>0},m:function(){return-52},n:function(){},t:function(i,l,d){function b(pe){return(pe=pe.toTimeString().match(/\(([A-Za-z ]+)\)$/))?pe[1]:"GMT"}d>>>=0;var T=new Date().getFullYear(),U=new Date(T,0,1),N=new Date(T,6,1);T=U.getTimezoneOffset();var oe=N.getTimezoneOffset();j[i>>>0>>2>>>0]=60*Math.max(T,oe),D[l>>>0>>2>>>0]=+(T!=oe),i=b(U),l=b(N),i=lt(i),l=lt(l),oe>2>>>0]=i,j[d+4>>2>>>0]=l):(j[d>>2>>>0]=l,j[d+4>>2>>>0]=i)},d:()=>{ae("")},h:function(){return Date.now()},u:function(){return 4294901760},b:()=>performance.now(),I:function(i,l,d){return l>>>=0,he.copyWithin(i>>>0>>>0,l>>>0,l+(d>>>0)>>>0)},s:function(i){i>>>=0;var l=he.length;if(4294901760=d;d*=2){var b=l*(1+.2/d);b=Math.min(b,i+100663296);var T=Math;b=Math.max(i,b);e:{T=T.min.call(T,4294901760,b+(65536-b%65536)%65536)-V.buffer.byteLength+65535>>>16;try{V.grow(T),se();var U=1;break e}catch{}U=void 0}if(U)return!0}return!1},C:function(i,l){i>>>=0,l>>>=0;var d=0;return dt().forEach(function(b,T){var U=l+d;for(T=j[i+4*T>>2>>>0]=U,U=0;U>0>>>0]=b.charCodeAt(U);Te[T>>0>>>0]=0,d+=b.length+1}),0},D:function(i,l){i>>>=0,l>>>=0;var d=dt();j[i>>2>>>0]=d.length;var b=0;return d.forEach(function(T){b+=T.length+1}),j[l>>2>>>0]=b,0},f:()=>52,j:function(){return 52},r:function(){return 70},i:function(i,l,d,b){l>>>=0,d>>>=0,b>>>=0;for(var T=0,U=0;U>2>>>0],oe=j[l+4>>2>>>0];l+=8;for(var pe=0;pe>>0],fe=Le[i];ue===0||ue===10?((i===1?S:B)(ve(fe,0)),fe.length=0):fe.push(ue)}T+=oe}return j[b>>2>>>0]=T,0},A:mt,c:function(i,l,d,b){return mt(i>>>0,l>>>0,d>>>0,b>>>0)}};(function(){function i(d){if(d=d.exports,I=d=tt(d),V=I.J,se(),ke.unshift(I.K),k--,t.monitorRunDependencies&&t.monitorRunDependencies(k),k==0&&(ge!==null&&(clearInterval(ge),ge=null),ce)){var b=ce;ce=null,b()}return d}var l={a:Mt};if(k++,t.monitorRunDependencies&&t.monitorRunDependencies(k),t.instantiateWasm)try{return t.instantiateWasm(l,i)}catch(d){B("Module.instantiateWasm callback failed with error: "+d),s(d)}return Ne(l,function(d){i(d.instance)}).catch(s),{}})(),t._OrtInit=(i,l)=>(t._OrtInit=I.L)(i,l),t._OrtGetLastError=(i,l)=>(t._OrtGetLastError=I.M)(i,l),t._OrtCreateSessionOptions=(i,l,d,b,T,U,N,oe,pe,ue)=>(t._OrtCreateSessionOptions=I.N)(i,l,d,b,T,U,N,oe,pe,ue),t._OrtAppendExecutionProvider=(i,l)=>(t._OrtAppendExecutionProvider=I.O)(i,l),t._OrtAddFreeDimensionOverride=(i,l,d)=>(t._OrtAddFreeDimensionOverride=I.P)(i,l,d),t._OrtAddSessionConfigEntry=(i,l,d)=>(t._OrtAddSessionConfigEntry=I.Q)(i,l,d),t._OrtReleaseSessionOptions=i=>(t._OrtReleaseSessionOptions=I.R)(i),t._OrtCreateSession=(i,l,d)=>(t._OrtCreateSession=I.S)(i,l,d),t._OrtReleaseSession=i=>(t._OrtReleaseSession=I.T)(i),t._OrtGetInputOutputCount=(i,l,d)=>(t._OrtGetInputOutputCount=I.U)(i,l,d),t._OrtGetInputName=(i,l)=>(t._OrtGetInputName=I.V)(i,l),t._OrtGetOutputName=(i,l)=>(t._OrtGetOutputName=I.W)(i,l),t._OrtFree=i=>(t._OrtFree=I.X)(i),t._OrtCreateTensor=(i,l,d,b,T,U)=>(t._OrtCreateTensor=I.Y)(i,l,d,b,T,U),t._OrtGetTensorData=(i,l,d,b,T)=>(t._OrtGetTensorData=I.Z)(i,l,d,b,T),t._OrtReleaseTensor=i=>(t._OrtReleaseTensor=I._)(i),t._OrtCreateRunOptions=(i,l,d,b)=>(t._OrtCreateRunOptions=I.$)(i,l,d,b),t._OrtAddRunConfigEntry=(i,l,d)=>(t._OrtAddRunConfigEntry=I.aa)(i,l,d),t._OrtReleaseRunOptions=i=>(t._OrtReleaseRunOptions=I.ba)(i),t._OrtCreateBinding=i=>(t._OrtCreateBinding=I.ca)(i),t._OrtBindInput=(i,l,d)=>(t._OrtBindInput=I.da)(i,l,d),t._OrtBindOutput=(i,l,d,b)=>(t._OrtBindOutput=I.ea)(i,l,d,b),t._OrtClearBoundOutputs=i=>(t._OrtClearBoundOutputs=I.fa)(i),t._OrtReleaseBinding=i=>(t._OrtReleaseBinding=I.ga)(i),t._OrtRunWithBinding=(i,l,d,b,T)=>(t._OrtRunWithBinding=I.ha)(i,l,d,b,T),t._OrtRun=(i,l,d,b,T,U,N,oe)=>(t._OrtRun=I.ia)(i,l,d,b,T,U,N,oe),t._OrtEndProfiling=i=>(t._OrtEndProfiling=I.ja)(i);var ht=t._malloc=i=>(ht=t._malloc=I.ka)(i);t._free=i=>(t._free=I.la)(i);var Ke=i=>(Ke=I.na)(i),gt=()=>(gt=I.oa)(),et=i=>(et=I.pa)(i),F=i=>(F=I.qa)(i);function tt(i){i=Object.assign({},i);var l=b=>()=>b()>>>0,d=b=>T=>b(T)>>>0;return i.__errno_location=l(i.__errno_location),i.malloc=d(i.malloc),i.stackSave=l(i.stackSave),i.stackAlloc=d(i.stackAlloc),i}t.stackAlloc=F,t.stackSave=gt,t.stackRestore=et,t.UTF8ToString=Ee,t.stringToUTF8=(i,l,d)=>Ze(i,he,l,d),t.lengthBytesUTF8=Be;var He;ce=function i(){He||Ge(),He||(ce=i)};function Ge(){function i(){if(!He&&(He=!0,t.calledRun=!0,!Me)){if(be(ke),f(t),t.onRuntimeInitialized&&t.onRuntimeInitialized(),t.postRun)for(typeof t.postRun=="function"&&(t.postRun=[t.postRun]);t.postRun.length;){var l=t.postRun.shift();Q.unshift(l)}be(Q)}}if(!(0Rn)});var Pn=nt(()=>{});var Dn=nt(()=>{});var In={};vt(In,{cpus:()=>La});var La,Un=H(()=>{La=void 0});var Ln=nt((Bn,cr)=>{"use strict";var Fn=(()=>{var n=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(n=n||__filename),function(r={}){function t(){return Q.buffer!=ae.buffer&&ye(),ae}function f(){return Q.buffer!=ae.buffer&&ye(),Ce}function s(){return Q.buffer!=ae.buffer&&ye(),K}function m(){return Q.buffer!=ae.buffer&&ye(),de}function c(){return Q.buffer!=ae.buffer&&ye(),Je}var o=r,h,g;o.ready=new Promise((e,a)=>{h=e,g=a});var O=Object.assign({},o),_="./this.program",v=(e,a)=>{throw a},R=typeof window=="object",C=typeof importScripts=="function",x=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",S=o.ENVIRONMENT_IS_PTHREAD||!1,B="";function L(e){return o.locateFile?o.locateFile(e,B):B+e}var W,V,I;if(x){var Me=(sr(),at(ir)),Te=(fr(),at(ur));B=C?Te.dirname(B)+"/":__dirname+"/",W=(a,u)=>(a=a.startsWith("file://")?new URL(a):Te.normalize(a),Me.readFileSync(a,u?void 0:"utf8")),I=a=>(a=W(a,!0),a.buffer||(a=new Uint8Array(a)),a),V=(a,u,p,A=!0)=>{a=a.startsWith("file://")?new URL(a):Te.normalize(a),Me.readFile(a,A?void 0:"utf8",(E,M)=>{E?p(E):u(A?M.buffer:M)})},!o.thisProgram&&1{throw process.exitCode=a,u},o.inspect=()=>"[Emscripten Module object]";let e;try{e=Pn()}catch(a){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),a}global.Worker=e.Worker}else(R||C)&&(C?B=self.location.href:typeof document<"u"&&document.currentScript&&(B=document.currentScript.src),typeof n<"u"&&n&&(B=n),B.indexOf("blob:")!==0?B=B.substr(0,B.replace(/[?#].*/,"").lastIndexOf("/")+1):B="",x||(W=e=>{var a=new XMLHttpRequest;return a.open("GET",e,!1),a.send(null),a.responseText},C&&(I=e=>{var a=new XMLHttpRequest;return a.open("GET",e,!1),a.responseType="arraybuffer",a.send(null),new Uint8Array(a.response)}),V=(e,a,u)=>{var p=new XMLHttpRequest;p.open("GET",e,!0),p.responseType="arraybuffer",p.onload=()=>{p.status==200||p.status==0&&p.response?a(p.response):u()},p.onerror=u,p.send(null)}));x&&typeof performance>"u"&&(global.performance=Dn().performance);var he=console.log.bind(console),D=console.error.bind(console);x&&(he=(...e)=>Me.writeSync(1,e.join(" ")+` +`),D=(...e)=>Me.writeSync(2,e.join(" ")+` +`));var j=o.print||he,se=o.printErr||D;Object.assign(o,O),O=null,o.thisProgram&&(_=o.thisProgram),o.quit&&(v=o.quit);var Re;o.wasmBinary&&(Re=o.wasmBinary);var ke=o.noExitRuntime||!0;typeof WebAssembly!="object"&&Ae("no native wasm support detected");var Q,P,k,ge=!1,ce,ae,Ce,K,de,Je;function ye(){var e=Q.buffer;o.HEAP8=ae=new Int8Array(e),o.HEAP16=new Int16Array(e),o.HEAP32=K=new Int32Array(e),o.HEAPU8=Ce=new Uint8Array(e),o.HEAPU16=new Uint16Array(e),o.HEAPU32=de=new Uint32Array(e),o.HEAPF32=new Float32Array(e),o.HEAPF64=Je=new Float64Array(e)}var xe=o.INITIAL_MEMORY||16777216;if(5242880<=xe||Ae("INITIAL_MEMORY should be larger than STACK_SIZE, was "+xe+"! (STACK_SIZE=5242880)"),S)Q=o.wasmMemory;else if(o.wasmMemory)Q=o.wasmMemory;else if(Q=new WebAssembly.Memory({initial:xe/65536,maximum:65536,shared:!0}),!(Q.buffer instanceof SharedArrayBuffer))throw se("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),x&&se("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and/or recent version)"),Error("bad memory");ye(),xe=Q.buffer.byteLength;var Ne,_e=[],be=[],Pe=[],Fe=0;function ne(){return ke||0{if(!a.ok)throw"failed to load wasm binary file at '"+e+"'";return a.arrayBuffer()}).catch(()=>lt(e));if(V)return new Promise((a,u)=>{V(e,p=>a(new Uint8Array(p)),u)})}return Promise.resolve().then(()=>lt(e))}function dt(e,a,u){return ct(e).then(p=>WebAssembly.instantiate(p,a)).then(p=>p).then(u,p=>{se("failed to asynchronously prepare wasm: "+p),Ae(p)})}function pt(e,a){var u=Ue;return Re||typeof WebAssembly.instantiateStreaming!="function"||ft(u)||u.startsWith("file://")||x||typeof fetch!="function"?dt(u,e,a):fetch(u,{credentials:"same-origin"}).then(p=>WebAssembly.instantiateStreaming(p,e).then(a,function(A){return se("wasm streaming compile failed: "+A),se("falling back to ArrayBuffer instantiation"),dt(u,e,a)}))}var Le;function We(e){this.name="ExitStatus",this.message=`Program terminated with exit(${e})`,this.status=e}function Qe(e){e.terminate(),e.onmessage=()=>{}}function Tt(e){(e=F.La[e])||Ae(),F.lb(e)}function mt(e){var a=F.fb();if(!a)return 6;F.Oa.push(a),F.La[e.Na]=a,a.Na=e.Na;var u={cmd:"run",start_routine:e.mb,arg:e.eb,pthread_ptr:e.Na};return x&&a.unref(),a.postMessage(u,e.sb),0}var Mt=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,ht=(e,a,u)=>{a>>>=0;var p=a+u;for(u=a;e[u]&&!(u>=p);)++u;if(16A?p+=String.fromCharCode(A):(A-=65536,p+=String.fromCharCode(55296|A>>10,56320|A&1023))}}else p+=String.fromCharCode(A)}return p},Ke=(e,a)=>(e>>>=0)?ht(f(),e,a):"";function gt(e){if(S)return X(1,1,e);ce=e,ne()||(F.nb(),o.onExit&&o.onExit(e),ge=!0),v(e,new We(e))}var et=e=>{if(ce=e,S)throw He(e),"unwind";gt(e)},F={Ra:[],Oa:[],Za:[],La:{},Va:function(){S?F.hb():F.gb()},gb:function(){_e.unshift(()=>{Be(),F.ib(()=>Ze())})},hb:function(){F.receiveObjectTransfer=F.kb,F.threadInitTLS=F.Ya,F.setExitStatus=F.Xa,ke=!1},Xa:function(e){ce=e},xb:["$terminateWorker"],nb:function(){for(var e of F.Oa)Qe(e);for(e of F.Ra)Qe(e);F.Ra=[],F.Oa=[],F.La=[]},lb:function(e){var a=e.Na;delete F.La[a],F.Ra.push(e),F.Oa.splice(F.Oa.indexOf(e),1),e.Na=0,Zt(a)},kb:function(){},Ya:function(){F.Za.forEach(e=>e())},jb:e=>new Promise(a=>{e.onmessage=E=>{E=E.data;var M=E.cmd;if(E.targetThread&&E.targetThread!=Ct()){var ee=F.La[E.wb];ee?ee.postMessage(E,E.transferList):se('Internal error! Worker sent a message "'+M+'" to target pthread '+E.targetThread+", but that thread no longer exists!")}else M==="checkMailbox"?Rt():M==="spawnThread"?mt(E):M==="cleanupThread"?Tt(E.thread):M==="killThread"?(E=E.thread,M=F.La[E],delete F.La[E],Qe(M),Zt(E),F.Oa.splice(F.Oa.indexOf(M),1),M.Na=0):M==="cancelThread"?F.La[E.thread].postMessage({cmd:"cancel"}):M==="loaded"?(e.loaded=!0,a(e)):M==="alert"?alert("Thread "+E.threadId+": "+E.text):E.target==="setimmediate"?e.postMessage(E):M==="callHandler"?o[E.handler](...E.args):M&&se("worker sent an unknown command "+M)},e.onerror=E=>{throw se("worker sent an error! "+E.filename+":"+E.lineno+": "+E.message),E},x&&(e.on("message",function(E){e.onmessage({data:E})}),e.on("error",function(E){e.onerror(E)}));var u=[],p=["onExit","onAbort","print","printErr"],A;for(A of p)o.hasOwnProperty(A)&&u.push(A);e.postMessage({cmd:"load",handlers:u,urlOrBlob:o.mainScriptUrlOrBlob||n,wasmMemory:Q,wasmModule:k})}),ib:function(e){e()},cb:function(){var e=L("ort-wasm-threaded.worker.js");e=new Worker(e),F.Ra.push(e)},fb:function(){return F.Ra.length==0&&(F.cb(),F.jb(F.Ra[0])),F.Ra.pop()}};o.PThread=F;var tt=e=>{for(;0>2>>>0];e=s()[e+56>>2>>>0],$r(a,a-e),xt(a)};function He(e){if(S)return X(2,0,e);et(e)}var Ge=[];o.invokeEntryPoint=function(e,a){var u=Ge[e];u||(e>=Ge.length&&(Ge.length=e+1),Ge[e]=u=Ne.get(e)),e=u(a),ne()?F.Xa(e):Qt(e)};function i(e){this.Ua=e-24,this.bb=function(a){m()[this.Ua+4>>2>>>0]=a},this.ab=function(a){m()[this.Ua+8>>2>>>0]=a},this.Va=function(a,u){this.$a(),this.bb(a),this.ab(u)},this.$a=function(){m()[this.Ua+16>>2>>>0]=0}}var l=0,d=0;function b(e,a,u,p){return S?X(3,1,e,a,u,p):T(e,a,u,p)}function T(e,a,u,p){if(e>>>=0,a>>>=0,u>>>=0,p>>>=0,typeof SharedArrayBuffer>"u")return se("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var A=[];return S&&A.length===0?b(e,a,u,p):(e={mb:u,Na:e,eb:p,sb:A},S?(e.ub="spawnThread",postMessage(e,A),0):mt(e))}function U(e,a,u){return S?X(4,1,e,a,u):0}function N(e,a){if(S)return X(5,1,e,a)}var oe=e=>{for(var a=0,u=0;u=p?a++:2047>=p?a+=2:55296<=p&&57343>=p?(a+=4,++u):a+=3}return a},pe=(e,a,u,p)=>{if(u>>>=0,!(0=M){var ee=e.charCodeAt(++E);M=65536+((M&1023)<<10)|ee&1023}if(127>=M){if(u>=p)break;a[u++>>>0]=M}else{if(2047>=M){if(u+1>=p)break;a[u++>>>0]=192|M>>6}else{if(65535>=M){if(u+2>=p)break;a[u++>>>0]=224|M>>12}else{if(u+3>=p)break;a[u++>>>0]=240|M>>18,a[u++>>>0]=128|M>>12&63}a[u++>>>0]=128|M>>6&63}a[u++>>>0]=128|M&63}}return a[u>>>0]=0,u-A},ue=(e,a,u)=>pe(e,f(),a,u);function fe(e,a){if(S)return X(6,1,e,a)}function yt(e,a,u){if(S)return X(7,1,e,a,u)}function wt(e,a,u){return S?X(8,1,e,a,u):0}function y(e,a){if(S)return X(9,1,e,a)}function G(e,a,u){if(S)return X(10,1,e,a,u)}function Y(e,a,u,p){if(S)return X(11,1,e,a,u,p)}function De(e,a,u,p){if(S)return X(12,1,e,a,u,p)}function bt(e,a,u,p){if(S)return X(13,1,e,a,u,p)}function _r(e){if(S)return X(14,1,e)}function Er(e,a){if(S)return X(15,1,e,a)}function Ar(e,a,u){if(S)return X(16,1,e,a,u)}var wa=e=>{if(!ge)try{if(e(),!ne())try{S?Qt(ce):et(ce)}catch(a){a instanceof We||a=="unwind"||v(1,a)}}catch(a){a instanceof We||a=="unwind"||v(1,a)}};function Vt(e){e>>>=0,typeof Atomics.tb=="function"&&(Atomics.tb(s(),e>>2,e).value.then(Rt),e+=128,Atomics.store(s(),e>>2,1))}o.__emscripten_thread_mailbox_await=Vt;function Rt(){var e=Ct();e&&(Vt(e),wa(()=>jr()))}o.checkMailbox=Rt;var rt=e=>e%4===0&&(e%100!==0||e%400===0),Sr=[0,31,60,91,121,152,182,213,244,274,305,335],Tr=[0,31,59,90,120,151,181,212,243,273,304,334];function Mr(e,a,u,p,A,E,M,ee){return S?X(17,1,e,a,u,p,A,E,M,ee):-52}function Rr(e,a,u,p,A,E,M){if(S)return X(18,1,e,a,u,p,A,E,M)}var Cr=e=>{var a=oe(e)+1,u=Wr(a);return u&&ue(e,u,a),u},ba=e=>{var a=Kt();return e=e(),xt(a),e};function X(e,a){var u=arguments.length-2,p=arguments;return ba(()=>{for(var A=er(8*u),E=A>>3,M=0;M>>0]=ee}return Gr(e,u,A,a)})}var qt=[],Xt={},xr=()=>{if(!Jt){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:_||"./this.program"},a;for(a in Xt)Xt[a]===void 0?delete e[a]:e[a]=Xt[a];var u=[];for(a in e)u.push(`${a}=${e[a]}`);Jt=u}return Jt},Jt;function Pr(e,a){if(S)return X(19,1,e,a);e>>>=0,a>>>=0;var u=0;return xr().forEach(function(p,A){var E=a+u;for(A=m()[e+4*A>>2>>>0]=E,E=0;E>0>>>0]=p.charCodeAt(E);t()[A>>0>>>0]=0,u+=p.length+1}),0}function Dr(e,a){if(S)return X(20,1,e,a);e>>>=0,a>>>=0;var u=xr();m()[e>>2>>>0]=u.length;var p=0;return u.forEach(function(A){p+=A.length+1}),m()[a>>2>>>0]=p,0}function Ir(e){return S?X(21,1,e):52}function Ur(e,a,u,p){return S?X(22,1,e,a,u,p):52}function Fr(e,a,u,p,A){return S?X(23,1,e,a,u,p,A):70}var va=[null,[],[]];function Br(e,a,u,p){if(S)return X(24,1,e,a,u,p);a>>>=0,u>>>=0,p>>>=0;for(var A=0,E=0;E>2>>>0],ee=m()[a+4>>2>>>0];a+=8;for(var Ie=0;Ie>>0],we=va[e];ie===0||ie===10?((e===1?j:se)(ht(we,0)),we.length=0):we.push(ie)}A+=ee}return m()[p>>2>>>0]=A,0}var Lr=[31,29,31,30,31,30,31,31,30,31,30,31],kr=[31,28,31,30,31,30,31,31,30,31,30,31];function Oa(e){var a=Array(oe(e)+1);return pe(e,a,0,a.length),a}var _a=(e,a)=>{t().set(e,a>>>0)};function Nr(e,a,u,p){function A(w,z,te){for(w=typeof w=="number"?w.toString():w||"";w.lengthXr?-1:0je-w.getDate())z-=je-w.getDate()+1,w.setDate(1),11>te?w.setMonth(te+1):(w.setMonth(0),w.setFullYear(w.getFullYear()+1));else{w.setDate(w.getDate()+z);break}}return te=new Date(w.getFullYear()+1,0,4),z=ee(new Date(w.getFullYear(),0,4)),te=ee(te),0>=M(z,w)?0>=M(te,w)?w.getFullYear()+1:w.getFullYear():w.getFullYear()-1}e>>>=0,a>>>=0,u>>>=0,p>>>=0;var ie=s()[p+40>>2>>>0];p={qb:s()[p>>2>>>0],pb:s()[p+4>>2>>>0],Sa:s()[p+8>>2>>>0],Wa:s()[p+12>>2>>>0],Ta:s()[p+16>>2>>>0],Qa:s()[p+20>>2>>>0],Ma:s()[p+24>>2>>>0],Pa:s()[p+28>>2>>>0],yb:s()[p+32>>2>>>0],ob:s()[p+36>>2>>>0],rb:ie?Ke(ie):""},u=Ke(u),ie={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var we in ie)u=u.replace(new RegExp(we,"g"),ie[we]);var Vr="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),qr="January February March April May June July August September October November December".split(" ");ie={"%a":w=>Vr[w.Ma].substring(0,3),"%A":w=>Vr[w.Ma],"%b":w=>qr[w.Ta].substring(0,3),"%B":w=>qr[w.Ta],"%C":w=>E((w.Qa+1900)/100|0,2),"%d":w=>E(w.Wa,2),"%e":w=>A(w.Wa,2," "),"%g":w=>Ie(w).toString().substring(2),"%G":w=>Ie(w),"%H":w=>E(w.Sa,2),"%I":w=>(w=w.Sa,w==0?w=12:12{for(var z=0,te=0;te<=w.Ta-1;z+=(rt(w.Qa+1900)?Lr:kr)[te++]);return E(w.Wa+z,3)},"%m":w=>E(w.Ta+1,2),"%M":w=>E(w.pb,2),"%n":()=>` +`,"%p":w=>0<=w.Sa&&12>w.Sa?"AM":"PM","%S":w=>E(w.qb,2),"%t":()=>" ","%u":w=>w.Ma||7,"%U":w=>E(Math.floor((w.Pa+7-w.Ma)/7),2),"%V":w=>{var z=Math.floor((w.Pa+7-(w.Ma+6)%7)/7);if(2>=(w.Ma+371-w.Pa-2)%7&&z++,z)z==53&&(te=(w.Ma+371-w.Pa)%7,te==4||te==3&&rt(w.Qa)||(z=1));else{z=52;var te=(w.Ma+7-w.Pa-1)%7;(te==4||te==5&&rt(w.Qa%400-1))&&z++}return E(z,2)},"%w":w=>w.Ma,"%W":w=>E(Math.floor((w.Pa+7-(w.Ma+6)%7)/7),2),"%y":w=>(w.Qa+1900).toString().substring(2),"%Y":w=>w.Qa+1900,"%z":w=>{w=w.ob;var z=0<=w;return w=Math.abs(w)/60,(z?"+":"-")+("0000"+(w/60*100+w%60)).slice(-4)},"%Z":w=>w.rb,"%%":()=>"%"},u=u.replace(/%%/g,"\0\0");for(we in ie)u.includes(we)&&(u=u.replace(new RegExp(we,"g"),ie[we](p)));return u=u.replace(/\0\0/g,"%"),we=Oa(u),we.length>a?0:(_a(we,e),we.length-1)}F.Va();var Ea=[null,gt,He,b,U,N,fe,yt,wt,y,G,Y,De,bt,_r,Er,Ar,Mr,Rr,Pr,Dr,Ir,Ur,Fr,Br],Aa={b:function(e,a,u){throw e>>>=0,new i(e).Va(a>>>0,u>>>0),l=e,d++,l},N:function(e){Hr(e>>>0,!C,1,!R,131072,!1),F.Ya()},j:function(e){e>>>=0,S?postMessage({cmd:"cleanupThread",thread:e}):Tt(e)},I:T,h:U,T:N,D:fe,F:yt,U:wt,R:y,J:G,Q:Y,n:De,E:bt,B:_r,S:Er,C:Ar,q:()=>!0,z:function(e,a){e>>>=0,e==a>>>0?setTimeout(()=>Rt()):S?postMessage({targetThread:e,cmd:"checkMailbox"}):(e=F.La[e])&&e.postMessage({cmd:"checkMailbox"})},L:function(){return-1},M:Vt,p:function(e){x&&F.La[e>>>0].ref()},t:function(e,a,u){e=a+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*a:NaN,u>>>=0,e=new Date(1e3*e),s()[u>>2>>>0]=e.getUTCSeconds(),s()[u+4>>2>>>0]=e.getUTCMinutes(),s()[u+8>>2>>>0]=e.getUTCHours(),s()[u+12>>2>>>0]=e.getUTCDate(),s()[u+16>>2>>>0]=e.getUTCMonth(),s()[u+20>>2>>>0]=e.getUTCFullYear()-1900,s()[u+24>>2>>>0]=e.getUTCDay(),e=(e.getTime()-Date.UTC(e.getUTCFullYear(),0,1,0,0,0,0))/864e5|0,s()[u+28>>2>>>0]=e},u:function(e,a,u){e=a+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*a:NaN,u>>>=0,e=new Date(1e3*e),s()[u>>2>>>0]=e.getSeconds(),s()[u+4>>2>>>0]=e.getMinutes(),s()[u+8>>2>>>0]=e.getHours(),s()[u+12>>2>>>0]=e.getDate(),s()[u+16>>2>>>0]=e.getMonth(),s()[u+20>>2>>>0]=e.getFullYear()-1900,s()[u+24>>2>>>0]=e.getDay(),a=(rt(e.getFullYear())?Sr:Tr)[e.getMonth()]+e.getDate()-1|0,s()[u+28>>2>>>0]=a,s()[u+36>>2>>>0]=-(60*e.getTimezoneOffset()),a=new Date(e.getFullYear(),6,1).getTimezoneOffset();var p=new Date(e.getFullYear(),0,1).getTimezoneOffset();e=(a!=p&&e.getTimezoneOffset()==Math.min(p,a))|0,s()[u+32>>2>>>0]=e},v:function(e){e>>>=0;var a=new Date(s()[e+20>>2>>>0]+1900,s()[e+16>>2>>>0],s()[e+12>>2>>>0],s()[e+8>>2>>>0],s()[e+4>>2>>>0],s()[e>>2>>>0],0),u=s()[e+32>>2>>>0],p=a.getTimezoneOffset(),A=new Date(a.getFullYear(),6,1).getTimezoneOffset(),E=new Date(a.getFullYear(),0,1).getTimezoneOffset(),M=Math.min(E,A);return 0>u?s()[e+32>>2>>>0]=+(A!=E&&M==p):0>2>>>0]=a.getDay(),u=(rt(a.getFullYear())?Sr:Tr)[a.getMonth()]+a.getDate()-1|0,s()[e+28>>2>>>0]=u,s()[e>>2>>>0]=a.getSeconds(),s()[e+4>>2>>>0]=a.getMinutes(),s()[e+8>>2>>>0]=a.getHours(),s()[e+12>>2>>>0]=a.getDate(),s()[e+16>>2>>>0]=a.getMonth(),s()[e+20>>2>>>0]=a.getYear(),e=a.getTime()/1e3,zr((Le=e,1<=+Math.abs(Le)?0>>0:~~+Math.ceil((Le-+(~~Le>>>0))/4294967296)>>>0:0)),e>>>0},r:Mr,s:Rr,y:function(e,a,u){function p(ie){return(ie=ie.toTimeString().match(/\(([A-Za-z ]+)\)$/))?ie[1]:"GMT"}e>>>=0,a>>>=0,u>>>=0;var A=new Date().getFullYear(),E=new Date(A,0,1),M=new Date(A,6,1);A=E.getTimezoneOffset();var ee=M.getTimezoneOffset(),Ie=Math.max(A,ee);m()[e>>2>>>0]=60*Ie,s()[a>>2>>>0]=+(A!=ee),e=p(E),a=p(M),e=Cr(e),a=Cr(a),ee>2>>>0]=e,m()[u+4>>2>>>0]=a):(m()[u>>2>>>0]=a,m()[u+4>>2>>>0]=e)},c:()=>{Ae("")},k:function(){},i:function(){return Date.now()},o:()=>{throw Fe+=1,"unwind"},A:function(){return 4294901760},e:()=>performance.timeOrigin+performance.now(),f:function(){return x?(Un(),at(In)).cpus().length:navigator.hardwareConcurrency},K:function(e,a,u,p){for(F.vb=a>>>0,qt.length=u,a=p>>>0>>3,p=0;p>>0];return Ea[e].apply(null,qt)},x:function(e){e>>>=0;var a=f().length;if(e<=a||4294901760=u;u*=2){var p=a*(1+.2/u);p=Math.min(p,e+100663296);var A=Math;p=Math.max(e,p);e:{A=A.min.call(A,4294901760,p+(65536-p%65536)%65536)-Q.buffer.byteLength+65535>>>16;try{Q.grow(A),ye();var E=1;break e}catch{}E=void 0}if(E)return!0}return!1},O:Pr,P:Dr,H:et,g:Ir,m:Ur,w:Fr,l:Br,a:Q||o.wasmMemory,G:Nr,d:function(e,a,u,p){return Nr(e>>>0,a>>>0,u>>>0,p>>>0)}};(function(){function e(u,p){return u=u.exports,P=u=Sa(u),F.Za.push(P.ya),Ne=P.za,be.unshift(P.V),k=p,Ze(),u}var a={a:Aa};if(Be(),o.instantiateWasm)try{return o.instantiateWasm(a,e)}catch(u){se("Module.instantiateWasm callback failed with error: "+u),g(u)}return pt(a,function(u){e(u.instance,u.module)}).catch(g),{}})(),o._OrtInit=(e,a)=>(o._OrtInit=P.W)(e,a),o._OrtGetLastError=(e,a)=>(o._OrtGetLastError=P.X)(e,a),o._OrtCreateSessionOptions=(e,a,u,p,A,E,M,ee,Ie,ie)=>(o._OrtCreateSessionOptions=P.Y)(e,a,u,p,A,E,M,ee,Ie,ie),o._OrtAppendExecutionProvider=(e,a)=>(o._OrtAppendExecutionProvider=P.Z)(e,a),o._OrtAddFreeDimensionOverride=(e,a,u)=>(o._OrtAddFreeDimensionOverride=P._)(e,a,u),o._OrtAddSessionConfigEntry=(e,a,u)=>(o._OrtAddSessionConfigEntry=P.$)(e,a,u),o._OrtReleaseSessionOptions=e=>(o._OrtReleaseSessionOptions=P.aa)(e),o._OrtCreateSession=(e,a,u)=>(o._OrtCreateSession=P.ba)(e,a,u),o._OrtReleaseSession=e=>(o._OrtReleaseSession=P.ca)(e),o._OrtGetInputOutputCount=(e,a,u)=>(o._OrtGetInputOutputCount=P.da)(e,a,u),o._OrtGetInputName=(e,a)=>(o._OrtGetInputName=P.ea)(e,a),o._OrtGetOutputName=(e,a)=>(o._OrtGetOutputName=P.fa)(e,a),o._OrtFree=e=>(o._OrtFree=P.ga)(e),o._OrtCreateTensor=(e,a,u,p,A,E)=>(o._OrtCreateTensor=P.ha)(e,a,u,p,A,E),o._OrtGetTensorData=(e,a,u,p,A)=>(o._OrtGetTensorData=P.ia)(e,a,u,p,A),o._OrtReleaseTensor=e=>(o._OrtReleaseTensor=P.ja)(e),o._OrtCreateRunOptions=(e,a,u,p)=>(o._OrtCreateRunOptions=P.ka)(e,a,u,p),o._OrtAddRunConfigEntry=(e,a,u)=>(o._OrtAddRunConfigEntry=P.la)(e,a,u),o._OrtReleaseRunOptions=e=>(o._OrtReleaseRunOptions=P.ma)(e),o._OrtCreateBinding=e=>(o._OrtCreateBinding=P.na)(e),o._OrtBindInput=(e,a,u)=>(o._OrtBindInput=P.oa)(e,a,u),o._OrtBindOutput=(e,a,u,p)=>(o._OrtBindOutput=P.pa)(e,a,u,p),o._OrtClearBoundOutputs=e=>(o._OrtClearBoundOutputs=P.qa)(e),o._OrtReleaseBinding=e=>(o._OrtReleaseBinding=P.ra)(e),o._OrtRunWithBinding=(e,a,u,p,A)=>(o._OrtRunWithBinding=P.sa)(e,a,u,p,A),o._OrtRun=(e,a,u,p,A,E,M,ee)=>(o._OrtRun=P.ta)(e,a,u,p,A,E,M,ee),o._OrtEndProfiling=e=>(o._OrtEndProfiling=P.ua)(e);var Ct=o._pthread_self=()=>(Ct=o._pthread_self=P.va)(),Wr=o._malloc=e=>(Wr=o._malloc=P.wa)(e);o._free=e=>(o._free=P.xa)(e),o.__emscripten_tls_init=()=>(o.__emscripten_tls_init=P.ya)();var Hr=o.__emscripten_thread_init=(e,a,u,p,A,E)=>(Hr=o.__emscripten_thread_init=P.Aa)(e,a,u,p,A,E);o.__emscripten_thread_crashed=()=>(o.__emscripten_thread_crashed=P.Ba)();var Gr=(e,a,u,p)=>(Gr=P.Ca)(e,a,u,p),Zt=e=>(Zt=P.Da)(e),Qt=o.__emscripten_thread_exit=e=>(Qt=o.__emscripten_thread_exit=P.Ea)(e),jr=o.__emscripten_check_mailbox=()=>(jr=o.__emscripten_check_mailbox=P.Fa)(),zr=e=>(zr=P.Ga)(e),$r=(e,a)=>($r=P.Ha)(e,a),Kt=()=>(Kt=P.Ia)(),xt=e=>(xt=P.Ja)(e),er=e=>(er=P.Ka)(e);function Sa(e){e=Object.assign({},e);var a=p=>()=>p()>>>0,u=p=>A=>p(A)>>>0;return e.__errno_location=a(e.__errno_location),e.pthread_self=a(e.pthread_self),e.malloc=u(e.malloc),e.stackSave=a(e.stackSave),e.stackAlloc=u(e.stackAlloc),e}o.keepRuntimeAlive=ne,o.wasmMemory=Q,o.stackAlloc=er,o.stackSave=Kt,o.stackRestore=xt,o.UTF8ToString=Ke,o.stringToUTF8=ue,o.lengthBytesUTF8=oe,o.ExitStatus=We,o.PThread=F;var Pt;Ee=function e(){Pt||Yr(),Pt||(Ee=e)};function Yr(){function e(){if(!Pt&&(Pt=!0,o.calledRun=!0,!ge)&&(S||tt(be),h(o),o.onRuntimeInitialized&&o.onRuntimeInitialized(),!S)){if(o.postRun)for(typeof o.postRun=="function"&&(o.postRun=[o.postRun]);o.postRun.length;){var a=o.postRun.shift();Pe.unshift(a)}tt(Pe)}}if(!(0Fn)});var kn=nt((Qo,ka)=>{ka.exports='"use strict";var Module={},ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";if(ENVIRONMENT_IS_NODE){var nodeWorkerThreads=require("worker_threads"),parentPort=nodeWorkerThreads.parentPort;parentPort.on("message",e=>onmessage({data:e}));var fs=require("fs");Object.assign(global,{self:global,require,Module,location:{href:__filename},Worker:nodeWorkerThreads.Worker,importScripts:e=>(0,eval)(fs.readFileSync(e,"utf8")+"//# sourceURL="+e),postMessage:e=>parentPort.postMessage(e),performance:global.performance||{now:Date.now}})}var initializedJS=!1;function threadPrintErr(){var e=Array.prototype.slice.call(arguments).join(" ");if(ENVIRONMENT_IS_NODE){fs.writeSync(2,e+`\n`);return}console.error(e)}function threadAlert(){var e=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:e,threadId:Module._pthread_self()})}var err=threadPrintErr;self.alert=threadAlert,Module.instantiateWasm=(e,t)=>{var a=Module.wasmModule;Module.wasmModule=null;var r=new WebAssembly.Instance(a,e);return t(r)},self.onunhandledrejection=e=>{throw e.reason??e};function handleMessage(e){try{if(e.data.cmd==="load"){let a=[];self.onmessage=r=>a.push(r),self.startWorker=r=>{Module=r,postMessage({cmd:"loaded"});for(let s of a)handleMessage(s);self.onmessage=handleMessage},Module.wasmModule=e.data.wasmModule;for(const r of e.data.handlers)Module[r]=(...s)=>{postMessage({cmd:"callHandler",handler:r,args:s})};if(Module.wasmMemory=e.data.wasmMemory,Module.buffer=Module.wasmMemory.buffer,Module.ENVIRONMENT_IS_PTHREAD=!0,typeof e.data.urlOrBlob=="string")importScripts(e.data.urlOrBlob);else{var t=URL.createObjectURL(e.data.urlOrBlob);importScripts(t),URL.revokeObjectURL(t)}ortWasmThreaded(Module)}else if(e.data.cmd==="run"){Module.__emscripten_thread_init(e.data.pthread_ptr,0,0,1),Module.__emscripten_thread_mailbox_await(e.data.pthread_ptr),Module.establishStackSpace(),Module.PThread.receiveObjectTransfer(e.data),Module.PThread.threadInitTLS(),initializedJS||(initializedJS=!0);try{Module.invokeEntryPoint(e.data.start_routine,e.data.arg)}catch(a){if(a!="unwind")throw a}}else e.data.cmd==="cancel"?Module._pthread_self()&&Module.__emscripten_thread_exit(-1):e.data.target==="setimmediate"||(e.data.cmd==="checkMailbox"?initializedJS&&Module.checkMailbox():e.data.cmd&&(err("worker.js received unknown command "+e.data.cmd),err(e.data)))}catch(a){throw Module.__emscripten_thread_crashed&&Module.__emscripten_thread_crashed(),a}}self.onmessage=handleMessage;\n'});var Wn,Na,dr,pr,Nt,Nn,Wa,Ha,Ga,Hn,re,ot=H(()=>{"use strict";Wn=xn();Na=Ln(),pr=!1,Nt=!1,Nn=!1,Wa=n=>{if(n===1)return!1;if(typeof SharedArrayBuffer>"u")return typeof self<"u"&&!self.crossOriginIsolated&&console.warn("env.wasm.numThreads is set to "+n+", but this will not work unless you enable crossOriginIsolated mode. See https://web.dev/cross-origin-isolation-guide/ for more info."),!1;typeof process<"u"&&process.versions&&process.versions.node&&console.warn("env.wasm.numThreads is set to "+n+", however, currently onnxruntime-web does not support multi-threads in Node.js. Please consider using onnxruntime-node for performance critical scenarios.");try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]))}catch{return!1}},Ha=()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,30,1,28,0,65,0,253,15,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,186,1,26,11]))}catch{return!1}},Ga=(n,r)=>n?r?"ort-wasm-simd-threaded.wasm":"ort-wasm-simd.wasm":r?"ort-wasm-threaded.wasm":"ort-wasm.wasm",Hn=async n=>{if(pr)return Promise.resolve();if(Nt)throw new Error("multiple calls to 'initializeWebAssembly()' detected.");if(Nn)throw new Error("previous call to 'initializeWebAssembly()' failed.");Nt=!0;let r=n.initTimeout,t=n.numThreads,f=n.simd,s=Wa(t),m=f&&Ha(),c=n.wasmPaths,o=typeof c=="string"?c:void 0,h=Ga(m,s),g=typeof c=="object"?c[h]:void 0,O=!1,_=[];if(r>0&&_.push(new Promise(v=>{setTimeout(()=>{O=!0,v()},r)})),_.push(new Promise((v,R)=>{let C=s?Na:Wn,x={locateFile:(S,B)=>s&&S.endsWith(".worker.js")&&typeof Blob<"u"?URL.createObjectURL(new Blob([kn()],{type:"text/javascript"})):S.endsWith(".wasm")?g||(o??B)+h:B+S};if(s)if(x.numThreads=t,typeof Blob>"u")x.mainScriptUrlOrBlob=(void 0)(__dirname,"ort-wasm-threaded.js");else{let S=`var ortWasmThreaded=${C.toString()};`;x.mainScriptUrlOrBlob=new Blob([S],{type:"text/javascript"})}C(x).then(S=>{Nt=!1,pr=!0,dr=S,v()},S=>{Nt=!1,Nn=!0,R(S)})})),await Promise.race(_),O)throw new Error(`WebAssembly backend initializing failed due to timeout: ${r}ms`)},re=()=>{if(pr&&dr)return dr;throw new Error("WebAssembly is not initialized yet.")}});var J,Et,Z,Wt=H(()=>{"use strict";ot();J=(n,r)=>{let t=re(),f=t.lengthBytesUTF8(n)+1,s=t._malloc(f);return t.stringToUTF8(n,s,f),r.push(s),s},Et=(n,r,t,f)=>{if(typeof n=="object"&&n!==null){if(t.has(n))throw new Error("Circular reference in options");t.add(n)}Object.entries(n).forEach(([s,m])=>{let c=r?r+s:s;if(typeof m=="object")Et(m,c+".",t,f);else if(typeof m=="string"||typeof m=="number")f(c,m.toString());else if(typeof m=="boolean")f(c,m?"1":"0");else throw new Error(`Can't handle extra config type: ${typeof m}`)})},Z=n=>{let r=re(),t=r.stackSave();try{let f=r.stackAlloc(8);r._OrtGetLastError(f,f+4);let s=r.HEAP32[f/4],m=r.HEAPU32[f/4+1],c=m?r.UTF8ToString(m):"";throw new Error(`${n} ERROR_CODE: ${s}, ERROR_MESSAGE: ${c}`)}finally{r.stackRestore(t)}}});var Gn,jn=H(()=>{"use strict";ot();Wt();Gn=n=>{let r=re(),t=0,f=[],s=n||{};try{if(n?.logSeverityLevel===void 0)s.logSeverityLevel=2;else if(typeof n.logSeverityLevel!="number"||!Number.isInteger(n.logSeverityLevel)||n.logSeverityLevel<0||n.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${n.logSeverityLevel}`);if(n?.logVerbosityLevel===void 0)s.logVerbosityLevel=0;else if(typeof n.logVerbosityLevel!="number"||!Number.isInteger(n.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${n.logVerbosityLevel}`);n?.terminate===void 0&&(s.terminate=!1);let m=0;return n?.tag!==void 0&&(m=J(n.tag,f)),t=r._OrtCreateRunOptions(s.logSeverityLevel,s.logVerbosityLevel,!!s.terminate,m),t===0&&Z("Can't create run options."),n?.extra!==void 0&&Et(n.extra,"",new WeakSet,(c,o)=>{let h=J(c,f),g=J(o,f);r._OrtAddRunConfigEntry(t,h,g)!==0&&Z(`Can't set a run config entry: ${c} - ${o}.`)}),[t,f]}catch(m){throw t!==0&&r._OrtReleaseRunOptions(t),f.forEach(c=>r._free(c)),m}}});var ja,za,$a,Ya,zn,$n=H(()=>{"use strict";ot();Wt();ja=n=>{switch(n){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${n}`)}},za=n=>{switch(n){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${n}`)}},$a=n=>{n.extra||(n.extra={}),n.extra.session||(n.extra.session={});let r=n.extra.session;r.use_ort_model_bytes_directly||(r.use_ort_model_bytes_directly="1"),n.executionProviders&&n.executionProviders.some(t=>(typeof t=="string"?t:t.name)==="webgpu")&&(n.enableMemPattern=!1)},Ya=(n,r,t)=>{for(let f of r){let s=typeof f=="string"?f:f.name;switch(s){case"webnn":if(s="WEBNN",typeof f!="string"){let c=f;if(c?.deviceType){let o=J("deviceType",t),h=J(c.deviceType,t);re()._OrtAddSessionConfigEntry(n,o,h)!==0&&Z(`Can't set a session config entry: 'deviceType' - ${c.deviceType}.`)}if(c?.numThreads){let o=c.numThreads;(typeof o!="number"||!Number.isInteger(o)||o<0)&&(o=0);let h=J("numThreads",t),g=J(o.toString(),t);re()._OrtAddSessionConfigEntry(n,h,g)!==0&&Z(`Can't set a session config entry: 'numThreads' - ${c.numThreads}.`)}if(c?.powerPreference){let o=J("powerPreference",t),h=J(c.powerPreference,t);re()._OrtAddSessionConfigEntry(n,o,h)!==0&&Z(`Can't set a session config entry: 'powerPreference' - ${c.powerPreference}.`)}}break;case"webgpu":if(s="JS",typeof f!="string"){let c=f;if(c?.preferredLayout){if(c.preferredLayout!=="NCHW"&&c.preferredLayout!=="NHWC")throw new Error(`preferredLayout must be either 'NCHW' or 'NHWC': ${c.preferredLayout}`);let o=J("preferredLayout",t),h=J(c.preferredLayout,t);re()._OrtAddSessionConfigEntry(n,o,h)!==0&&Z(`Can't set a session config entry: 'preferredLayout' - ${c.preferredLayout}.`)}}break;case"wasm":case"cpu":continue;default:throw new Error(`not supported execution provider: ${s}`)}let m=J(s,t);re()._OrtAppendExecutionProvider(n,m)!==0&&Z(`Can't append execution provider: ${s}.`)}},zn=n=>{let r=re(),t=0,f=[],s=n||{};$a(s);try{let m=ja(s.graphOptimizationLevel??"all"),c=za(s.executionMode??"sequential"),o=typeof s.logId=="string"?J(s.logId,f):0,h=s.logSeverityLevel??2;if(!Number.isInteger(h)||h<0||h>4)throw new Error(`log serverity level is not valid: ${h}`);let g=s.logVerbosityLevel??0;if(!Number.isInteger(g)||g<0||g>4)throw new Error(`log verbosity level is not valid: ${g}`);let O=typeof s.optimizedModelFilePath=="string"?J(s.optimizedModelFilePath,f):0;if(t=r._OrtCreateSessionOptions(m,!!s.enableCpuMemArena,!!s.enableMemPattern,c,!!s.enableProfiling,0,o,h,g,O),t===0&&Z("Can't create session options."),s.executionProviders&&Ya(t,s.executionProviders,f),s.enableGraphCapture!==void 0){if(typeof s.enableGraphCapture!="boolean")throw new Error(`enableGraphCapture must be a boolean value: ${s.enableGraphCapture}`);let _=J("enableGraphCapture",f),v=J(s.enableGraphCapture.toString(),f);r._OrtAddSessionConfigEntry(t,_,v)!==0&&Z(`Can't set a session config entry: 'enableGraphCapture' - ${s.enableGraphCapture}.`)}if(s.freeDimensionOverrides)for(let[_,v]of Object.entries(s.freeDimensionOverrides)){if(typeof _!="string")throw new Error(`free dimension override name must be a string: ${_}`);if(typeof v!="number"||!Number.isInteger(v)||v<0)throw new Error(`free dimension override value must be a non-negative integer: ${v}`);let R=J(_,f);r._OrtAddFreeDimensionOverride(t,R,v)!==0&&Z(`Can't set a free dimension override: ${_} - ${v}.`)}return s.extra!==void 0&&Et(s.extra,"",new WeakSet,(_,v)=>{let R=J(_,f),C=J(v,f);r._OrtAddSessionConfigEntry(t,R,C)!==0&&Z(`Can't set a session config entry: ${_} - ${v}.`)}),[t,f]}catch(m){throw t!==0&&r._OrtReleaseSessionOptions(t),f.forEach(c=>r._free(c)),m}}});var mr,Yn,hr,Vn,qn,Ht,Xn,gr=H(()=>{"use strict";mr=n=>{switch(n){case"int8":return 3;case"uint8":return 2;case"bool":return 9;case"int16":return 5;case"uint16":return 4;case"int32":return 6;case"uint32":return 12;case"float16":return 10;case"float32":return 1;case"float64":return 11;case"string":return 8;case"int64":return 7;case"uint64":return 13;default:throw new Error(`unsupported data type: ${n}`)}},Yn=n=>{switch(n){case 3:return"int8";case 2:return"uint8";case 9:return"bool";case 5:return"int16";case 4:return"uint16";case 6:return"int32";case 12:return"uint32";case 10:return"float16";case 1:return"float32";case 11:return"float64";case 8:return"string";case 7:return"int64";case 13:return"uint64";default:throw new Error(`unsupported data type: ${n}`)}},hr=n=>[void 0,4,1,1,2,2,4,8,void 0,1,2,8,4,8,void 0,void 0,void 0][n],Vn=n=>{switch(n){case"float16":return typeof Float16Array<"u"&&Float16Array.from?Float16Array:Uint16Array;case"float32":return Float32Array;case"uint8":return Uint8Array;case"int8":return Int8Array;case"uint16":return Uint16Array;case"int16":return Int16Array;case"int32":return Int32Array;case"bool":return Uint8Array;case"float64":return Float64Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"uint64":return BigUint64Array;default:throw new Error(`unsupported type: ${n}`)}},qn=n=>{switch(n){case"verbose":return 0;case"info":return 1;case"warning":return 2;case"error":return 3;case"fatal":return 4;default:throw new Error(`unsupported logging level: ${n}`)}},Ht=n=>n==="float32"||n==="float16"||n==="int32"||n==="int64"||n==="uint32"||n==="uint8"||n==="bool",Xn=n=>{switch(n){case"none":return 0;case"cpu":return 1;case"cpu-pinned":return 2;case"texture":return 3;case"gpu-buffer":return 4;default:throw new Error(`unsupported data location: ${n}`)}}});var At,yr=H(()=>{"use strict";At=async n=>{if(typeof n=="string")if(typeof process<"u"&&process.versions&&process.versions.node)try{return new Uint8Array(await(void 0)(n))}catch(r){if(r.code==="ERR_FS_FILE_TOO_LARGE"){let t=(void 0)(n),f=[];for await(let s of t)f.push(s);return new Uint8Array(Buffer.concat(f))}throw r}else{let r=await fetch(n);if(!r.ok)throw new Error(`failed to load external data file: ${n}`);let t=r.headers.get("Content-Length"),f=t?parseInt(t,10):0;if(f<1073741824)return new Uint8Array(await r.arrayBuffer());{if(!r.body)throw new Error(`failed to load external data file: ${n}, no response body.`);let s=r.body.getReader(),m;try{m=new ArrayBuffer(f)}catch(o){if(o instanceof RangeError){let h=Math.ceil(f/65536);m=new WebAssembly.Memory({initial:h,maximum:h}).buffer}else throw o}let c=0;for(;;){let{done:o,value:h}=await s.read();if(o)break;let g=h.byteLength;new Uint8Array(m,c,g).set(h),c+=g}return new Uint8Array(m,0,f)}}else return n instanceof Blob?new Uint8Array(await n.arrayBuffer()):n instanceof Uint8Array?n:new Uint8Array(n)}});var Va,Zn,Qn,it,qa,wr,Kn,ea,Jn,ta,ra,na,aa=H(()=>{"use strict";jn();$n();gr();ot();Wt();yr();Va=(n,r)=>{re()._OrtInit(n,r)!==0&&Z("Can't initialize onnxruntime.")},Zn=async n=>{Va(n.wasm.numThreads,qn(n.logLevel))},Qn=async(n,r)=>{},it=new Map,qa=n=>{let r=re(),t=r.stackSave();try{let f=r.stackAlloc(8);return r._OrtGetInputOutputCount(n,f,f+4)!==0&&Z("Can't get session input/output count."),[r.HEAP32[f/4],r.HEAP32[f/4+1]]}finally{r.stackRestore(t)}},wr=n=>{let r=re(),t=r._malloc(n.byteLength);if(t===0)throw new Error(`Can't create a session. failed to allocate a buffer of size ${n.byteLength}.`);return r.HEAPU8.set(n,t),[t,n.byteLength]},Kn=async(n,r)=>{let t,f,s=re();Array.isArray(n)?[t,f]=n:n.buffer===s.HEAPU8.buffer?[t,f]=[n.byteOffset,n.byteLength]:[t,f]=wr(n);let m=0,c=0,o=0,h=[],g=[],O=[];try{if([c,h]=zn(r),r?.externalData&&s.mountExternalData){let L=[];for(let W of r.externalData){let V=typeof W=="string"?W:W.path;L.push(At(typeof W=="string"?W:W.data).then(I=>{s.mountExternalData(V,I)}))}await Promise.all(L)}m=await s._OrtCreateSession(t,f,c),m===0&&Z("Can't create a session.");let[_,v]=qa(m),R=!!r?.enableGraphCapture,C=[],x=[],S=[];for(let L=0;L<_;L++){let W=s._OrtGetInputName(m,L);W===0&&Z("Can't get an input name."),g.push(W),C.push(s.UTF8ToString(W))}for(let L=0;Ls._OrtFree(v)),O.forEach(v=>s._OrtFree(v)),o!==0&&s._OrtReleaseBinding(o),m!==0&&s._OrtReleaseSession(m),_}finally{s._free(t),c!==0&&s._OrtReleaseSessionOptions(c),h.forEach(_=>s._free(_)),s.unmountExternalData?.()}},ea=n=>{let r=re(),t=it.get(n);if(!t)throw new Error(`cannot release session. invalid session id: ${n}`);let[f,s,m,c,o]=t;c&&(o&&r._OrtClearBoundOutputs(c.handle),r._OrtReleaseBinding(c.handle)),r.jsepOnReleaseSession?.(n),s.forEach(h=>r._OrtFree(h)),m.forEach(h=>r._OrtFree(h)),r._OrtReleaseSession(f),it.delete(n)},Jn=(n,r,t,f,s,m=!1)=>{if(!n){r.push(0);return}let c=re(),o=n[0],h=n[1],g=n[3],O,_;if(o==="string"&&g==="gpu-buffer")throw new Error("String tensor is not supported on GPU.");if(m&&g!=="gpu-buffer")throw new Error(`External buffer must be provided for input/output index ${s} when enableGraphCapture is true.`);if(g==="gpu-buffer"){let C=n[2].gpuBuffer,x=hr(mr(o));_=h.reduce((B,L)=>B*L,1)*x;let S=c.jsepRegisterBuffer;if(!S)throw new Error('Tensor location "gpu-buffer" is not supported without using WebGPU.');O=S(f,s,C,_)}else{let C=n[2];if(Array.isArray(C)){_=4*C.length,O=c._malloc(_),t.push(O);let x=O/4;for(let S=0;Sc.HEAP32[C++]=S);let x=c._OrtCreateTensor(mr(o),O,_,R,h.length,Xn(g));x===0&&Z(`Can't create tensor for input/output. session=${f}, index=${s}.`),r.push(x)}finally{c.stackRestore(v)}},ta=async(n,r,t,f,s,m)=>{let c=re(),o=it.get(n);if(!o)throw new Error(`cannot run inference. invalid session id: ${n}`);let h=o[0],g=o[1],O=o[2],_=o[3],v=o[4],R=o[5],C=r.length,x=f.length,S=0,B=[],L=[],W=[],V=[],I=c.stackSave(),Me=c.stackAlloc(C*4),Te=c.stackAlloc(C*4),he=c.stackAlloc(x*4),D=c.stackAlloc(x*4);try{[S,B]=Gn(m);for(let k=0;kne*q,1);K=Yn(xe);let Fe=_?.outputPreferredLocations[f[k]];if(K==="string"){if(Fe==="gpu-buffer")throw new Error("String tensor is not supported on GPU.");let ne=[],q=de/4;for(let ve=0;ve0){let ne=c.jsepGetBuffer;if(!ne)throw new Error('preferredLocation "gpu-buffer" is not supported without using WebGPU.');let q=ne(de),ve=hr(xe);if(ve===void 0||!Ht(K))throw new Error(`Unsupported data type: ${K}`);Ce=!0,P.push([K,be,{gpuBuffer:q,download:c.jsepCreateDownloader(q,Pe*ve,K),dispose:()=>{c._OrtReleaseTensor(ge)}},"gpu-buffer"])}else{let ne=Vn(K),q=new ne(Pe);new Uint8Array(q.buffer,q.byteOffset,q.byteLength).set(c.HEAPU8.subarray(de,de+q.byteLength)),P.push([K,be,q,"cpu"])}}finally{c.stackRestore(ce),K==="string"&&de&&c._free(de),Ce||c._OrtReleaseTensor(ge)}}return _&&!v&&(c._OrtClearBoundOutputs(_.handle),it.set(n,[h,g,O,_,v,!1])),P}finally{c.stackRestore(I),L.forEach(j=>c._OrtReleaseTensor(j)),W.forEach(j=>c._OrtReleaseTensor(j)),V.forEach(j=>c._free(j)),S!==0&&c._OrtReleaseRunOptions(S),B.forEach(j=>c._free(j))}},ra=n=>{let r=re(),t=it.get(n);if(!t)throw new Error("invalid session id");let f=t[0],s=r._OrtEndProfiling(f);s===0&&Z("Can't get an profile file name."),r._OrtFree(s)},na=n=>{let r=[];for(let t of n){let f=t[2];!Array.isArray(f)&&"buffer"in f&&r.push(f.buffer)}return r}});var oa=nt((wi,Ja)=>{Ja.exports='/*!\n * ONNX Runtime Web v1.18.0\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n"use strict";(()=>{var vt=Object.defineProperty;var Vr=Object.getOwnPropertyDescriptor;var Jr=Object.getOwnPropertyNames;var Xr=Object.prototype.hasOwnProperty;var _t=(s,c)=>()=>(s&&(c=s(s=0)),c);var nt=(s,c)=>()=>(c||s((c={exports:{}}).exports,c),c.exports),Et=(s,c)=>{for(var o in c)vt(s,o,{get:c[o],enumerable:!0})},Zr=(s,c,o,h)=>{if(c&&typeof c=="object"||typeof c=="function")for(let f of Jr(c))!Xr.call(s,f)&&f!==o&&vt(s,f,{get:()=>c[f],enumerable:!(h=Vr(c,f))||h.enumerable});return s};var ot=s=>Zr(vt({},"__esModule",{value:!0}),s);var St={};Et(St,{createReadStream:()=>fr,readFile:()=>Qr,readFileSync:()=>Kr});var Qr,Kr,fr,At=_t(()=>{Qr=void 0,Kr=void 0,fr=void 0});var Tt={};Et(Tt,{join:()=>en});var en,Mt=_t(()=>{en=void 0});var dr=nt((cr,Ct)=>{"use strict";var lr=(()=>{var s=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(s=s||__filename),function(c={}){var o=c,h,f;o.ready=new Promise((r,i)=>{h=r,f=i});var w=Object.assign({},o),g="./this.program",a=typeof window=="object",E=typeof importScripts=="function",x=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",P="",R,D,K;if(x){var I=(At(),ot(St)),L=(Mt(),ot(Tt));P=E?L.dirname(P)+"/":__dirname+"/",R=(r,i)=>(r=r.startsWith("file://")?new URL(r):L.normalize(r),I.readFileSync(r,i?void 0:"utf8")),K=r=>(r=R(r,!0),r.buffer||(r=new Uint8Array(r)),r),D=(r,i,u,m=!0)=>{r=r.startsWith("file://")?new URL(r):L.normalize(r),I.readFile(r,m?void 0:"utf8",(O,T)=>{O?u(O):i(m?T.buffer:T)})},!o.thisProgram&&1"[Emscripten Module object]"}else(a||E)&&(E?P=self.location.href:typeof document<"u"&&document.currentScript&&(P=document.currentScript.src),s&&(P=s),P.indexOf("blob:")!==0?P=P.substr(0,P.replace(/[?#].*/,"").lastIndexOf("/")+1):P="",R=r=>{var i=new XMLHttpRequest;return i.open("GET",r,!1),i.send(null),i.responseText},E&&(K=r=>{var i=new XMLHttpRequest;return i.open("GET",r,!1),i.responseType="arraybuffer",i.send(null),new Uint8Array(i.response)}),D=(r,i,u)=>{var m=new XMLHttpRequest;m.open("GET",r,!0),m.responseType="arraybuffer",m.onload=()=>{m.status==200||m.status==0&&m.response?i(m.response):u()},m.onerror=u,m.send(null)});var v=o.print||console.log.bind(console),k=o.printErr||console.error.bind(console);Object.assign(o,w),w=null,o.thisProgram&&(g=o.thisProgram);var W;o.wasmBinary&&(W=o.wasmBinary);var j=o.noExitRuntime||!0;typeof WebAssembly!="object"&&te("no native wasm support detected");var oe,C,ve=!1,Oe,ce,A,N;function ae(){var r=oe.buffer;o.HEAP8=Oe=new Int8Array(r),o.HEAP16=new Int16Array(r),o.HEAP32=A=new Int32Array(r),o.HEAPU8=ce=new Uint8Array(r),o.HEAPU16=new Uint16Array(r),o.HEAPU32=N=new Uint32Array(r),o.HEAPF32=new Float32Array(r),o.HEAPF64=new Float64Array(r)}var _e=[],xe=[],V=[];function S(){var r=o.preRun.shift();_e.unshift(r)}var F=0,de=null,ue=null;function te(r){throw o.onAbort&&o.onAbort(r),r="Aborted("+r+")",k(r),ve=!0,r=new WebAssembly.RuntimeError(r+". Build with -sASSERTIONS for more info."),f(r),r}function Ee(r){return r.startsWith("data:application/octet-stream;base64,")}var J;if(J="ort-wasm.wasm",!Ee(J)){var fe=J;J=o.locateFile?o.locateFile(fe,P):P+fe}function ke(r){if(r==J&&W)return new Uint8Array(W);if(K)return K(r);throw"both async and sync fetching of the wasm failed"}function pe(r){if(!W&&(a||E)){if(typeof fetch=="function"&&!r.startsWith("file://"))return fetch(r,{credentials:"same-origin"}).then(i=>{if(!i.ok)throw"failed to load wasm binary file at \'"+r+"\'";return i.arrayBuffer()}).catch(()=>ke(r));if(D)return new Promise((i,u)=>{D(r,m=>i(new Uint8Array(m)),u)})}return Promise.resolve().then(()=>ke(r))}function Se(r,i,u){return pe(r).then(m=>WebAssembly.instantiate(m,i)).then(m=>m).then(u,m=>{k("failed to asynchronously prepare wasm: "+m),te(m)})}function Pe(r,i){var u=J;return W||typeof WebAssembly.instantiateStreaming!="function"||Ee(u)||u.startsWith("file://")||x||typeof fetch!="function"?Se(u,r,i):fetch(u,{credentials:"same-origin"}).then(m=>WebAssembly.instantiateStreaming(m,r).then(i,function(O){return k("wasm streaming compile failed: "+O),k("falling back to ArrayBuffer instantiation"),Se(u,r,i)}))}var ye,ge=r=>{for(;0>2>>>0]=i},this.za=function(i){N[this.va+8>>2>>>0]=i},this.xa=function(i,u){this.ya(),this.Ea(i),this.za(u)},this.ya=function(){N[this.va+16>>2>>>0]=0}}var Re=0,ee=0,Y=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,he=(r,i,u)=>{i>>>=0;var m=i+u;for(u=i;r[u]&&!(u>=m);)++u;if(16O?m+=String.fromCharCode(O):(O-=65536,m+=String.fromCharCode(55296|O>>10,56320|O&1023))}}else m+=String.fromCharCode(O)}return m},be=(r,i)=>(r>>>=0)?he(ce,r,i):"",De=r=>{for(var i=0,u=0;u=m?i++:2047>=m?i+=2:55296<=m&&57343>=m?(i+=4,++u):i+=3}return i},We=(r,i,u,m)=>{if(u>>>=0,!(0=U){var re=r.charCodeAt(++T);U=65536+((U&1023)<<10)|re&1023}if(127>=U){if(u>=m)break;i[u++>>>0]=U}else{if(2047>=U){if(u+1>=m)break;i[u++>>>0]=192|U>>6}else{if(65535>=U){if(u+2>=m)break;i[u++>>>0]=224|U>>12}else{if(u+3>=m)break;i[u++>>>0]=240|U>>18,i[u++>>>0]=128|U>>12&63}i[u++>>>0]=128|U>>6&63}i[u++>>>0]=128|U&63}}return i[u>>>0]=0,u-O},we=r=>r%4===0&&(r%100!==0||r%400===0),$e=[0,31,60,91,121,152,182,213,244,274,305,335],Ce=[0,31,59,90,120,151,181,212,243,273,304,334],qe=r=>{var i=De(r)+1,u=Qe(i);return u&&We(r,ce,u,i),u},Ve={},Je=()=>{if(!Xe){var r={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:g||"./this.program"},i;for(i in Ve)Ve[i]===void 0?delete r[i]:r[i]=Ve[i];var u=[];for(i in r)u.push(`${i}=${r[i]}`);Xe=u}return Xe},Xe,Fe=[null,[],[]],Ie=[31,29,31,30,31,30,31,31,30,31,30,31],Ne=[31,28,31,30,31,30,31,31,30,31,30,31];function it(r){var i=Array(De(r)+1);return We(r,i,0,i.length),i}function Ze(r,i,u,m){function O(d,B,G){for(d=typeof d=="number"?d.toString():d||"";d.lengthrt?-1:0Te-d.getDate())B-=Te-d.getDate()+1,d.setDate(1),11>G?d.setMonth(G+1):(d.setMonth(0),d.setFullYear(d.getFullYear()+1));else{d.setDate(d.getDate()+B);break}}return G=new Date(d.getFullYear()+1,0,4),B=re(new Date(d.getFullYear(),0,4)),G=re(G),0>=U(B,d)?0>=U(G,d)?d.getFullYear()+1:d.getFullYear():d.getFullYear()-1}r>>>=0,i>>>=0,u>>>=0,m>>>=0;var ie=A[m+40>>2>>>0];m={Ca:A[m>>2>>>0],Ba:A[m+4>>2>>>0],ta:A[m+8>>2>>>0],wa:A[m+12>>2>>>0],ua:A[m+16>>2>>>0],sa:A[m+20>>2>>>0],ma:A[m+24>>2>>>0],ra:A[m+28>>2>>>0],Fa:A[m+32>>2>>>0],Aa:A[m+36>>2>>>0],Da:ie?be(ie):""},u=be(u),ie={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var se in ie)u=u.replace(new RegExp(se,"g"),ie[se]);var et="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),tt="January February March April May June July August September October November December".split(" ");ie={"%a":d=>et[d.ma].substring(0,3),"%A":d=>et[d.ma],"%b":d=>tt[d.ua].substring(0,3),"%B":d=>tt[d.ua],"%C":d=>T((d.sa+1900)/100|0,2),"%d":d=>T(d.wa,2),"%e":d=>O(d.wa,2," "),"%g":d=>le(d).toString().substring(2),"%G":d=>le(d),"%H":d=>T(d.ta,2),"%I":d=>(d=d.ta,d==0?d=12:12{for(var B=0,G=0;G<=d.ua-1;B+=(we(d.sa+1900)?Ie:Ne)[G++]);return T(d.wa+B,3)},"%m":d=>T(d.ua+1,2),"%M":d=>T(d.Ba,2),"%n":()=>`\n`,"%p":d=>0<=d.ta&&12>d.ta?"AM":"PM","%S":d=>T(d.Ca,2),"%t":()=>" ","%u":d=>d.ma||7,"%U":d=>T(Math.floor((d.ra+7-d.ma)/7),2),"%V":d=>{var B=Math.floor((d.ra+7-(d.ma+6)%7)/7);if(2>=(d.ma+371-d.ra-2)%7&&B++,B)B==53&&(G=(d.ma+371-d.ra)%7,G==4||G==3&&we(d.sa)||(B=1));else{B=52;var G=(d.ma+7-d.ra-1)%7;(G==4||G==5&&we(d.sa%400-1))&&B++}return T(B,2)},"%w":d=>d.ma,"%W":d=>T(Math.floor((d.ra+7-(d.ma+6)%7)/7),2),"%y":d=>(d.sa+1900).toString().substring(2),"%Y":d=>d.sa+1900,"%z":d=>{d=d.Aa;var B=0<=d;return d=Math.abs(d)/60,(B?"+":"-")+("0000"+(d/60*100+d%60)).slice(-4)},"%Z":d=>d.Da,"%%":()=>"%"},u=u.replace(/%%/g,"\\0\\0");for(se in ie)u.includes(se)&&(u=u.replace(new RegExp(se,"g"),ie[se](m)));return u=u.replace(/\\0\\0/g,"%"),se=it(u),se.length>i?0:(Oe.set(se,r>>>0),se.length-1)}var st={a:function(r,i,u){throw r>>>=0,new Ae(r).xa(i>>>0,u>>>0),Re=r,ee++,Re},e:function(){return 0},H:function(){},x:function(){},z:function(){},k:function(){return 0},F:function(){},B:function(){},E:function(){},g:function(){},y:function(){},v:function(){},G:function(){},w:function(){},l:()=>!0,o:function(r,i,u){r=i+2097152>>>0<4194305-!!r?(r>>>0)+4294967296*i:NaN,u>>>=0,r=new Date(1e3*r),A[u>>2>>>0]=r.getUTCSeconds(),A[u+4>>2>>>0]=r.getUTCMinutes(),A[u+8>>2>>>0]=r.getUTCHours(),A[u+12>>2>>>0]=r.getUTCDate(),A[u+16>>2>>>0]=r.getUTCMonth(),A[u+20>>2>>>0]=r.getUTCFullYear()-1900,A[u+24>>2>>>0]=r.getUTCDay(),A[u+28>>2>>>0]=(r.getTime()-Date.UTC(r.getUTCFullYear(),0,1,0,0,0,0))/864e5|0},p:function(r,i,u){r=i+2097152>>>0<4194305-!!r?(r>>>0)+4294967296*i:NaN,u>>>=0,r=new Date(1e3*r),A[u>>2>>>0]=r.getSeconds(),A[u+4>>2>>>0]=r.getMinutes(),A[u+8>>2>>>0]=r.getHours(),A[u+12>>2>>>0]=r.getDate(),A[u+16>>2>>>0]=r.getMonth(),A[u+20>>2>>>0]=r.getFullYear()-1900,A[u+24>>2>>>0]=r.getDay(),A[u+28>>2>>>0]=(we(r.getFullYear())?$e:Ce)[r.getMonth()]+r.getDate()-1|0,A[u+36>>2>>>0]=-(60*r.getTimezoneOffset()),i=new Date(r.getFullYear(),6,1).getTimezoneOffset();var m=new Date(r.getFullYear(),0,1).getTimezoneOffset();A[u+32>>2>>>0]=(i!=m&&r.getTimezoneOffset()==Math.min(m,i))|0},q:function(r){r>>>=0;var i=new Date(A[r+20>>2>>>0]+1900,A[r+16>>2>>>0],A[r+12>>2>>>0],A[r+8>>2>>>0],A[r+4>>2>>>0],A[r>>2>>>0],0),u=A[r+32>>2>>>0],m=i.getTimezoneOffset(),O=new Date(i.getFullYear(),6,1).getTimezoneOffset(),T=new Date(i.getFullYear(),0,1).getTimezoneOffset(),U=Math.min(T,O);return 0>u?A[r+32>>2>>>0]=+(O!=T&&U==m):0>2>>>0]=i.getDay(),A[r+28>>2>>>0]=(we(i.getFullYear())?$e:Ce)[i.getMonth()]+i.getDate()-1|0,A[r>>2>>>0]=i.getSeconds(),A[r+4>>2>>>0]=i.getMinutes(),A[r+8>>2>>>0]=i.getHours(),A[r+12>>2>>>0]=i.getDate(),A[r+16>>2>>>0]=i.getMonth(),A[r+20>>2>>>0]=i.getYear(),r=i.getTime()/1e3,He((ye=r,1<=+Math.abs(ye)?0>>0:~~+Math.ceil((ye-+(~~ye>>>0))/4294967296)>>>0:0)),r>>>0},m:function(){return-52},n:function(){},t:function(r,i,u){function m(le){return(le=le.toTimeString().match(/\\(([A-Za-z ]+)\\)$/))?le[1]:"GMT"}u>>>=0;var O=new Date().getFullYear(),T=new Date(O,0,1),U=new Date(O,6,1);O=T.getTimezoneOffset();var re=U.getTimezoneOffset();N[r>>>0>>2>>>0]=60*Math.max(O,re),A[i>>>0>>2>>>0]=+(O!=re),r=m(T),i=m(U),r=qe(r),i=qe(i),re>2>>>0]=r,N[u+4>>2>>>0]=i):(N[u>>2>>>0]=i,N[u+4>>2>>>0]=r)},d:()=>{te("")},h:function(){return Date.now()},u:function(){return 4294901760},b:()=>performance.now(),I:function(r,i,u){return i>>>=0,ce.copyWithin(r>>>0>>>0,i>>>0,i+(u>>>0)>>>0)},s:function(r){r>>>=0;var i=ce.length;if(4294901760=u;u*=2){var m=i*(1+.2/u);m=Math.min(m,r+100663296);var O=Math;m=Math.max(r,m);e:{O=O.min.call(O,4294901760,m+(65536-m%65536)%65536)-oe.buffer.byteLength+65535>>>16;try{oe.grow(O),ae();var T=1;break e}catch{}T=void 0}if(T)return!0}return!1},C:function(r,i){r>>>=0,i>>>=0;var u=0;return Je().forEach(function(m,O){var T=i+u;for(O=N[r+4*O>>2>>>0]=T,T=0;T>0>>>0]=m.charCodeAt(T);Oe[O>>0>>>0]=0,u+=m.length+1}),0},D:function(r,i){r>>>=0,i>>>=0;var u=Je();N[r>>2>>>0]=u.length;var m=0;return u.forEach(function(O){m+=O.length+1}),N[i>>2>>>0]=m,0},f:()=>52,j:function(){return 52},r:function(){return 70},i:function(r,i,u,m){i>>>=0,u>>>=0,m>>>=0;for(var O=0,T=0;T>2>>>0],re=N[i+4>>2>>>0];i+=8;for(var le=0;le>>0],se=Fe[r];ie===0||ie===10?((r===1?v:k)(he(se,0)),se.length=0):se.push(ie)}O+=re}return N[m>>2>>>0]=O,0},A:Ze,c:function(r,i,u,m){return Ze(r>>>0,i>>>0,u>>>0,m>>>0)}};(function(){function r(u){if(u=u.exports,C=u=je(u),oe=C.J,ae(),xe.unshift(C.K),F--,o.monitorRunDependencies&&o.monitorRunDependencies(F),F==0&&(de!==null&&(clearInterval(de),de=null),ue)){var m=ue;ue=null,m()}return u}var i={a:st};if(F++,o.monitorRunDependencies&&o.monitorRunDependencies(F),o.instantiateWasm)try{return o.instantiateWasm(i,r)}catch(u){k("Module.instantiateWasm callback failed with error: "+u),f(u)}return Pe(i,function(u){r(u.instance)}).catch(f),{}})(),o._OrtInit=(r,i)=>(o._OrtInit=C.L)(r,i),o._OrtGetLastError=(r,i)=>(o._OrtGetLastError=C.M)(r,i),o._OrtCreateSessionOptions=(r,i,u,m,O,T,U,re,le,ie)=>(o._OrtCreateSessionOptions=C.N)(r,i,u,m,O,T,U,re,le,ie),o._OrtAppendExecutionProvider=(r,i)=>(o._OrtAppendExecutionProvider=C.O)(r,i),o._OrtAddFreeDimensionOverride=(r,i,u)=>(o._OrtAddFreeDimensionOverride=C.P)(r,i,u),o._OrtAddSessionConfigEntry=(r,i,u)=>(o._OrtAddSessionConfigEntry=C.Q)(r,i,u),o._OrtReleaseSessionOptions=r=>(o._OrtReleaseSessionOptions=C.R)(r),o._OrtCreateSession=(r,i,u)=>(o._OrtCreateSession=C.S)(r,i,u),o._OrtReleaseSession=r=>(o._OrtReleaseSession=C.T)(r),o._OrtGetInputOutputCount=(r,i,u)=>(o._OrtGetInputOutputCount=C.U)(r,i,u),o._OrtGetInputName=(r,i)=>(o._OrtGetInputName=C.V)(r,i),o._OrtGetOutputName=(r,i)=>(o._OrtGetOutputName=C.W)(r,i),o._OrtFree=r=>(o._OrtFree=C.X)(r),o._OrtCreateTensor=(r,i,u,m,O,T)=>(o._OrtCreateTensor=C.Y)(r,i,u,m,O,T),o._OrtGetTensorData=(r,i,u,m,O)=>(o._OrtGetTensorData=C.Z)(r,i,u,m,O),o._OrtReleaseTensor=r=>(o._OrtReleaseTensor=C._)(r),o._OrtCreateRunOptions=(r,i,u,m)=>(o._OrtCreateRunOptions=C.$)(r,i,u,m),o._OrtAddRunConfigEntry=(r,i,u)=>(o._OrtAddRunConfigEntry=C.aa)(r,i,u),o._OrtReleaseRunOptions=r=>(o._OrtReleaseRunOptions=C.ba)(r),o._OrtCreateBinding=r=>(o._OrtCreateBinding=C.ca)(r),o._OrtBindInput=(r,i,u)=>(o._OrtBindInput=C.da)(r,i,u),o._OrtBindOutput=(r,i,u,m)=>(o._OrtBindOutput=C.ea)(r,i,u,m),o._OrtClearBoundOutputs=r=>(o._OrtClearBoundOutputs=C.fa)(r),o._OrtReleaseBinding=r=>(o._OrtReleaseBinding=C.ga)(r),o._OrtRunWithBinding=(r,i,u,m,O)=>(o._OrtRunWithBinding=C.ha)(r,i,u,m,O),o._OrtRun=(r,i,u,m,O,T,U,re)=>(o._OrtRun=C.ia)(r,i,u,m,O,T,U,re),o._OrtEndProfiling=r=>(o._OrtEndProfiling=C.ja)(r);var Qe=o._malloc=r=>(Qe=o._malloc=C.ka)(r);o._free=r=>(o._free=C.la)(r);var He=r=>(He=C.na)(r),Ke=()=>(Ke=C.oa)(),Ge=r=>(Ge=C.pa)(r),M=r=>(M=C.qa)(r);function je(r){r=Object.assign({},r);var i=m=>()=>m()>>>0,u=m=>O=>m(O)>>>0;return r.__errno_location=i(r.__errno_location),r.malloc=u(r.malloc),r.stackSave=i(r.stackSave),r.stackAlloc=u(r.stackAlloc),r}o.stackAlloc=M,o.stackSave=Ke,o.stackRestore=Ge,o.UTF8ToString=be,o.stringToUTF8=(r,i,u)=>We(r,ce,i,u),o.lengthBytesUTF8=De;var Ue;ue=function r(){Ue||Le(),Ue||(ue=r)};function Le(){function r(){if(!Ue&&(Ue=!0,o.calledRun=!0,!ve)){if(ge(xe),h(o),o.onRuntimeInitialized&&o.onRuntimeInitialized(),o.postRun)for(typeof o.postRun=="function"&&(o.postRun=[o.postRun]);o.postRun.length;){var i=o.postRun.shift();V.unshift(i)}ge(V)}}if(!(0lr)});var pr=nt(()=>{});var mr=nt(()=>{});var gr={};Et(gr,{cpus:()=>tn});var tn,hr=_t(()=>{tn=void 0});var wr=nt((br,Rt)=>{"use strict";var yr=(()=>{var s=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(s=s||__filename),function(c={}){function o(){return V.buffer!=te.buffer&&pe(),te}function h(){return V.buffer!=te.buffer&&pe(),Ee}function f(){return V.buffer!=te.buffer&&pe(),J}function w(){return V.buffer!=te.buffer&&pe(),fe}function g(){return V.buffer!=te.buffer&&pe(),ke}var a=c,E,x;a.ready=new Promise((e,t)=>{E=e,x=t});var P=Object.assign({},a),R="./this.program",D=(e,t)=>{throw t},K=typeof window=="object",I=typeof importScripts=="function",L=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",v=a.ENVIRONMENT_IS_PTHREAD||!1,k="";function W(e){return a.locateFile?a.locateFile(e,k):k+e}var j,oe,C;if(L){var ve=(At(),ot(St)),Oe=(Mt(),ot(Tt));k=I?Oe.dirname(k)+"/":__dirname+"/",j=(t,n)=>(t=t.startsWith("file://")?new URL(t):Oe.normalize(t),ve.readFileSync(t,n?void 0:"utf8")),C=t=>(t=j(t,!0),t.buffer||(t=new Uint8Array(t)),t),oe=(t,n,l,b=!0)=>{t=t.startsWith("file://")?new URL(t):Oe.normalize(t),ve.readFile(t,b?void 0:"utf8",(y,_)=>{y?l(y):n(b?_.buffer:_)})},!a.thisProgram&&1{throw process.exitCode=t,n},a.inspect=()=>"[Emscripten Module object]";let e;try{e=pr()}catch(t){throw console.error(\'The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?\'),t}global.Worker=e.Worker}else(K||I)&&(I?k=self.location.href:typeof document<"u"&&document.currentScript&&(k=document.currentScript.src),typeof s<"u"&&s&&(k=s),k.indexOf("blob:")!==0?k=k.substr(0,k.replace(/[?#].*/,"").lastIndexOf("/")+1):k="",L||(j=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},I&&(C=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),oe=(e,t,n)=>{var l=new XMLHttpRequest;l.open("GET",e,!0),l.responseType="arraybuffer",l.onload=()=>{l.status==200||l.status==0&&l.response?t(l.response):n()},l.onerror=n,l.send(null)}));L&&typeof performance>"u"&&(global.performance=mr().performance);var ce=console.log.bind(console),A=console.error.bind(console);L&&(ce=(...e)=>ve.writeSync(1,e.join(" ")+`\n`),A=(...e)=>ve.writeSync(2,e.join(" ")+`\n`));var N=a.print||ce,ae=a.printErr||A;Object.assign(a,P),P=null,a.thisProgram&&(R=a.thisProgram),a.quit&&(D=a.quit);var _e;a.wasmBinary&&(_e=a.wasmBinary);var xe=a.noExitRuntime||!0;typeof WebAssembly!="object"&&we("no native wasm support detected");var V,S,F,de=!1,ue,te,Ee,J,fe,ke;function pe(){var e=V.buffer;a.HEAP8=te=new Int8Array(e),a.HEAP16=new Int16Array(e),a.HEAP32=J=new Int32Array(e),a.HEAPU8=Ee=new Uint8Array(e),a.HEAPU16=new Uint16Array(e),a.HEAPU32=fe=new Uint32Array(e),a.HEAPF32=new Float32Array(e),a.HEAPF64=ke=new Float64Array(e)}var Se=a.INITIAL_MEMORY||16777216;if(5242880<=Se||we("INITIAL_MEMORY should be larger than STACK_SIZE, was "+Se+"! (STACK_SIZE=5242880)"),v)V=a.wasmMemory;else if(a.wasmMemory)V=a.wasmMemory;else if(V=new WebAssembly.Memory({initial:Se/65536,maximum:65536,shared:!0}),!(V.buffer instanceof SharedArrayBuffer))throw ae("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),L&&ae("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and/or recent version)"),Error("bad memory");pe(),Se=V.buffer.byteLength;var Pe,ye=[],ge=[],Ae=[],Re=0;function ee(){return xe||0{if(!t.ok)throw"failed to load wasm binary file at \'"+e+"\'";return t.arrayBuffer()}).catch(()=>qe(e));if(oe)return new Promise((t,n)=>{oe(e,l=>t(new Uint8Array(l)),n)})}return Promise.resolve().then(()=>qe(e))}function Je(e,t,n){return Ve(e).then(l=>WebAssembly.instantiate(l,t)).then(l=>l).then(n,l=>{ae("failed to asynchronously prepare wasm: "+l),we(l)})}function Xe(e,t){var n=Ce;return _e||typeof WebAssembly.instantiateStreaming!="function"||$e(n)||n.startsWith("file://")||L||typeof fetch!="function"?Je(n,e,t):fetch(n,{credentials:"same-origin"}).then(l=>WebAssembly.instantiateStreaming(l,e).then(t,function(b){return ae("wasm streaming compile failed: "+b),ae("falling back to ArrayBuffer instantiation"),Je(n,e,t)}))}var Fe;function Ie(e){this.name="ExitStatus",this.message=`Program terminated with exit(${e})`,this.status=e}function Ne(e){e.terminate(),e.onmessage=()=>{}}function it(e){(e=M.La[e])||we(),M.lb(e)}function Ze(e){var t=M.fb();if(!t)return 6;M.Oa.push(t),M.La[e.Na]=t,t.Na=e.Na;var n={cmd:"run",start_routine:e.mb,arg:e.eb,pthread_ptr:e.Na};return L&&t.unref(),t.postMessage(n,e.sb),0}var st=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,Qe=(e,t,n)=>{t>>>=0;var l=t+n;for(n=t;e[n]&&!(n>=l);)++n;if(16b?l+=String.fromCharCode(b):(b-=65536,l+=String.fromCharCode(55296|b>>10,56320|b&1023))}}else l+=String.fromCharCode(b)}return l},He=(e,t)=>(e>>>=0)?Qe(h(),e,t):"";function Ke(e){if(v)return z(1,1,e);ue=e,ee()||(M.nb(),a.onExit&&a.onExit(e),de=!0),D(e,new Ie(e))}var Ge=e=>{if(ue=e,v)throw Ue(e),"unwind";Ke(e)},M={Ra:[],Oa:[],Za:[],La:{},Va:function(){v?M.hb():M.gb()},gb:function(){ye.unshift(()=>{De(),M.ib(()=>We())})},hb:function(){M.receiveObjectTransfer=M.kb,M.threadInitTLS=M.Ya,M.setExitStatus=M.Xa,xe=!1},Xa:function(e){ue=e},xb:["$terminateWorker"],nb:function(){for(var e of M.Oa)Ne(e);for(e of M.Ra)Ne(e);M.Ra=[],M.Oa=[],M.La=[]},lb:function(e){var t=e.Na;delete M.La[t],M.Ra.push(e),M.Oa.splice(M.Oa.indexOf(e),1),e.Na=0,yt(t)},kb:function(){},Ya:function(){M.Za.forEach(e=>e())},jb:e=>new Promise(t=>{e.onmessage=y=>{y=y.data;var _=y.cmd;if(y.targetThread&&y.targetThread!=ft()){var X=M.La[y.wb];X?X.postMessage(y,y.transferList):ae(\'Internal error! Worker sent a message "\'+_+\'" to target pthread \'+y.targetThread+", but that thread no longer exists!")}else _==="checkMailbox"?ut():_==="spawnThread"?Ze(y):_==="cleanupThread"?it(y.thread):_==="killThread"?(y=y.thread,_=M.La[y],delete M.La[y],Ne(_),yt(y),M.Oa.splice(M.Oa.indexOf(_),1),_.Na=0):_==="cancelThread"?M.La[y.thread].postMessage({cmd:"cancel"}):_==="loaded"?(e.loaded=!0,t(e)):_==="alert"?alert("Thread "+y.threadId+": "+y.text):y.target==="setimmediate"?e.postMessage(y):_==="callHandler"?a[y.handler](...y.args):_&&ae("worker sent an unknown command "+_)},e.onerror=y=>{throw ae("worker sent an error! "+y.filename+":"+y.lineno+": "+y.message),y},L&&(e.on("message",function(y){e.onmessage({data:y})}),e.on("error",function(y){e.onerror(y)}));var n=[],l=["onExit","onAbort","print","printErr"],b;for(b of l)a.hasOwnProperty(b)&&n.push(b);e.postMessage({cmd:"load",handlers:n,urlOrBlob:a.mainScriptUrlOrBlob||s,wasmMemory:V,wasmModule:F})}),ib:function(e){e()},cb:function(){var e=W("ort-wasm-threaded.worker.js");e=new Worker(e),M.Ra.push(e)},fb:function(){return M.Ra.length==0&&(M.cb(),M.jb(M.Ra[0])),M.Ra.pop()}};a.PThread=M;var je=e=>{for(;0>2>>>0];e=f()[e+56>>2>>>0],or(t,t-e),lt(t)};function Ue(e){if(v)return z(2,0,e);Ge(e)}var Le=[];a.invokeEntryPoint=function(e,t){var n=Le[e];n||(e>=Le.length&&(Le.length=e+1),Le[e]=n=Pe.get(e)),e=n(t),ee()?M.Xa(e):bt(e)};function r(e){this.Ua=e-24,this.bb=function(t){w()[this.Ua+4>>2>>>0]=t},this.ab=function(t){w()[this.Ua+8>>2>>>0]=t},this.Va=function(t,n){this.$a(),this.bb(t),this.ab(n)},this.$a=function(){w()[this.Ua+16>>2>>>0]=0}}var i=0,u=0;function m(e,t,n,l){return v?z(3,1,e,t,n,l):O(e,t,n,l)}function O(e,t,n,l){if(e>>>=0,t>>>=0,n>>>=0,l>>>=0,typeof SharedArrayBuffer>"u")return ae("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var b=[];return v&&b.length===0?m(e,t,n,l):(e={mb:n,Na:e,eb:l,sb:b},v?(e.ub="spawnThread",postMessage(e,b),0):Ze(e))}function T(e,t,n){return v?z(4,1,e,t,n):0}function U(e,t){if(v)return z(5,1,e,t)}var re=e=>{for(var t=0,n=0;n=l?t++:2047>=l?t+=2:55296<=l&&57343>=l?(t+=4,++n):t+=3}return t},le=(e,t,n,l)=>{if(n>>>=0,!(0=_){var X=e.charCodeAt(++y);_=65536+((_&1023)<<10)|X&1023}if(127>=_){if(n>=l)break;t[n++>>>0]=_}else{if(2047>=_){if(n+1>=l)break;t[n++>>>0]=192|_>>6}else{if(65535>=_){if(n+2>=l)break;t[n++>>>0]=224|_>>12}else{if(n+3>=l)break;t[n++>>>0]=240|_>>18,t[n++>>>0]=128|_>>12&63}t[n++>>>0]=128|_>>6&63}t[n++>>>0]=128|_&63}}return t[n>>>0]=0,n-b},ie=(e,t,n)=>le(e,h(),t,n);function se(e,t){if(v)return z(6,1,e,t)}function et(e,t,n){if(v)return z(7,1,e,t,n)}function tt(e,t,n){return v?z(8,1,e,t,n):0}function d(e,t){if(v)return z(9,1,e,t)}function B(e,t,n){if(v)return z(10,1,e,t,n)}function G(e,t,n,l){if(v)return z(11,1,e,t,n,l)}function Te(e,t,n,l){if(v)return z(12,1,e,t,n,l)}function rt(e,t,n,l){if(v)return z(13,1,e,t,n,l)}function Ut(e){if(v)return z(14,1,e)}function Lt(e,t){if(v)return z(15,1,e,t)}function Bt(e,t,n){if(v)return z(16,1,e,t,n)}var Nr=e=>{if(!de)try{if(e(),!ee())try{v?bt(ue):Ge(ue)}catch(t){t instanceof Ie||t=="unwind"||D(1,t)}}catch(t){t instanceof Ie||t=="unwind"||D(1,t)}};function pt(e){e>>>=0,typeof Atomics.tb=="function"&&(Atomics.tb(f(),e>>2,e).value.then(ut),e+=128,Atomics.store(f(),e>>2,1))}a.__emscripten_thread_mailbox_await=pt;function ut(){var e=ft();e&&(pt(e),Nr(()=>rr()))}a.checkMailbox=ut;var Ye=e=>e%4===0&&(e%100!==0||e%400===0),kt=[0,31,60,91,121,152,182,213,244,274,305,335],Wt=[0,31,59,90,120,151,181,212,243,273,304,334];function Nt(e,t,n,l,b,y,_,X){return v?z(17,1,e,t,n,l,b,y,_,X):-52}function Ht(e,t,n,l,b,y,_){if(v)return z(18,1,e,t,n,l,b,y,_)}var Gt=e=>{var t=re(e)+1,n=Kt(t);return n&&ie(e,n,t),n},Hr=e=>{var t=wt();return e=e(),lt(t),e};function z(e,t){var n=arguments.length-2,l=arguments;return Hr(()=>{for(var b=Ot(8*n),y=b>>3,_=0;_>>0]=X}return tr(e,n,b,t)})}var mt=[],gt={},jt=()=>{if(!ht){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:R||"./this.program"},t;for(t in gt)gt[t]===void 0?delete e[t]:e[t]=gt[t];var n=[];for(t in e)n.push(`${t}=${e[t]}`);ht=n}return ht},ht;function Yt(e,t){if(v)return z(19,1,e,t);e>>>=0,t>>>=0;var n=0;return jt().forEach(function(l,b){var y=t+n;for(b=w()[e+4*b>>2>>>0]=y,y=0;y>0>>>0]=l.charCodeAt(y);o()[b>>0>>>0]=0,n+=l.length+1}),0}function zt(e,t){if(v)return z(20,1,e,t);e>>>=0,t>>>=0;var n=jt();w()[e>>2>>>0]=n.length;var l=0;return n.forEach(function(b){l+=b.length+1}),w()[t>>2>>>0]=l,0}function $t(e){return v?z(21,1,e):52}function qt(e,t,n,l){return v?z(22,1,e,t,n,l):52}function Vt(e,t,n,l,b){return v?z(23,1,e,t,n,l,b):70}var Gr=[null,[],[]];function Jt(e,t,n,l){if(v)return z(24,1,e,t,n,l);t>>>=0,n>>>=0,l>>>=0;for(var b=0,y=0;y>2>>>0],X=w()[t+4>>2>>>0];t+=8;for(var Me=0;Me>>0],me=Gr[e];ne===0||ne===10?((e===1?N:ae)(Qe(me,0)),me.length=0):me.push(ne)}b+=X}return w()[l>>2>>>0]=b,0}var Xt=[31,29,31,30,31,30,31,31,30,31,30,31],Zt=[31,28,31,30,31,30,31,31,30,31,30,31];function jr(e){var t=Array(re(e)+1);return le(e,t,0,t.length),t}var Yr=(e,t)=>{o().set(e,t>>>0)};function Qt(e,t,n,l){function b(p,H,Z){for(p=typeof p=="number"?p.toString():p||"";p.lengthur?-1:0Be-p.getDate())H-=Be-p.getDate()+1,p.setDate(1),11>Z?p.setMonth(Z+1):(p.setMonth(0),p.setFullYear(p.getFullYear()+1));else{p.setDate(p.getDate()+H);break}}return Z=new Date(p.getFullYear()+1,0,4),H=X(new Date(p.getFullYear(),0,4)),Z=X(Z),0>=_(H,p)?0>=_(Z,p)?p.getFullYear()+1:p.getFullYear():p.getFullYear()-1}e>>>=0,t>>>=0,n>>>=0,l>>>=0;var ne=f()[l+40>>2>>>0];l={qb:f()[l>>2>>>0],pb:f()[l+4>>2>>>0],Sa:f()[l+8>>2>>>0],Wa:f()[l+12>>2>>>0],Ta:f()[l+16>>2>>>0],Qa:f()[l+20>>2>>>0],Ma:f()[l+24>>2>>>0],Pa:f()[l+28>>2>>>0],yb:f()[l+32>>2>>>0],ob:f()[l+36>>2>>>0],rb:ne?He(ne):""},n=He(n),ne={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var me in ne)n=n.replace(new RegExp(me,"g"),ne[me]);var ir="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),sr="January February March April May June July August September October November December".split(" ");ne={"%a":p=>ir[p.Ma].substring(0,3),"%A":p=>ir[p.Ma],"%b":p=>sr[p.Ta].substring(0,3),"%B":p=>sr[p.Ta],"%C":p=>y((p.Qa+1900)/100|0,2),"%d":p=>y(p.Wa,2),"%e":p=>b(p.Wa,2," "),"%g":p=>Me(p).toString().substring(2),"%G":p=>Me(p),"%H":p=>y(p.Sa,2),"%I":p=>(p=p.Sa,p==0?p=12:12{for(var H=0,Z=0;Z<=p.Ta-1;H+=(Ye(p.Qa+1900)?Xt:Zt)[Z++]);return y(p.Wa+H,3)},"%m":p=>y(p.Ta+1,2),"%M":p=>y(p.pb,2),"%n":()=>`\n`,"%p":p=>0<=p.Sa&&12>p.Sa?"AM":"PM","%S":p=>y(p.qb,2),"%t":()=>" ","%u":p=>p.Ma||7,"%U":p=>y(Math.floor((p.Pa+7-p.Ma)/7),2),"%V":p=>{var H=Math.floor((p.Pa+7-(p.Ma+6)%7)/7);if(2>=(p.Ma+371-p.Pa-2)%7&&H++,H)H==53&&(Z=(p.Ma+371-p.Pa)%7,Z==4||Z==3&&Ye(p.Qa)||(H=1));else{H=52;var Z=(p.Ma+7-p.Pa-1)%7;(Z==4||Z==5&&Ye(p.Qa%400-1))&&H++}return y(H,2)},"%w":p=>p.Ma,"%W":p=>y(Math.floor((p.Pa+7-(p.Ma+6)%7)/7),2),"%y":p=>(p.Qa+1900).toString().substring(2),"%Y":p=>p.Qa+1900,"%z":p=>{p=p.ob;var H=0<=p;return p=Math.abs(p)/60,(H?"+":"-")+("0000"+(p/60*100+p%60)).slice(-4)},"%Z":p=>p.rb,"%%":()=>"%"},n=n.replace(/%%/g,"\\0\\0");for(me in ne)n.includes(me)&&(n=n.replace(new RegExp(me,"g"),ne[me](l)));return n=n.replace(/\\0\\0/g,"%"),me=jr(n),me.length>t?0:(Yr(me,e),me.length-1)}M.Va();var zr=[null,Ke,Ue,m,T,U,se,et,tt,d,B,G,Te,rt,Ut,Lt,Bt,Nt,Ht,Yt,zt,$t,qt,Vt,Jt],$r={b:function(e,t,n){throw e>>>=0,new r(e).Va(t>>>0,n>>>0),i=e,u++,i},N:function(e){er(e>>>0,!I,1,!K,131072,!1),M.Ya()},j:function(e){e>>>=0,v?postMessage({cmd:"cleanupThread",thread:e}):it(e)},I:O,h:T,T:U,D:se,F:et,U:tt,R:d,J:B,Q:G,n:Te,E:rt,B:Ut,S:Lt,C:Bt,q:()=>!0,z:function(e,t){e>>>=0,e==t>>>0?setTimeout(()=>ut()):v?postMessage({targetThread:e,cmd:"checkMailbox"}):(e=M.La[e])&&e.postMessage({cmd:"checkMailbox"})},L:function(){return-1},M:pt,p:function(e){L&&M.La[e>>>0].ref()},t:function(e,t,n){e=t+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*t:NaN,n>>>=0,e=new Date(1e3*e),f()[n>>2>>>0]=e.getUTCSeconds(),f()[n+4>>2>>>0]=e.getUTCMinutes(),f()[n+8>>2>>>0]=e.getUTCHours(),f()[n+12>>2>>>0]=e.getUTCDate(),f()[n+16>>2>>>0]=e.getUTCMonth(),f()[n+20>>2>>>0]=e.getUTCFullYear()-1900,f()[n+24>>2>>>0]=e.getUTCDay(),e=(e.getTime()-Date.UTC(e.getUTCFullYear(),0,1,0,0,0,0))/864e5|0,f()[n+28>>2>>>0]=e},u:function(e,t,n){e=t+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*t:NaN,n>>>=0,e=new Date(1e3*e),f()[n>>2>>>0]=e.getSeconds(),f()[n+4>>2>>>0]=e.getMinutes(),f()[n+8>>2>>>0]=e.getHours(),f()[n+12>>2>>>0]=e.getDate(),f()[n+16>>2>>>0]=e.getMonth(),f()[n+20>>2>>>0]=e.getFullYear()-1900,f()[n+24>>2>>>0]=e.getDay(),t=(Ye(e.getFullYear())?kt:Wt)[e.getMonth()]+e.getDate()-1|0,f()[n+28>>2>>>0]=t,f()[n+36>>2>>>0]=-(60*e.getTimezoneOffset()),t=new Date(e.getFullYear(),6,1).getTimezoneOffset();var l=new Date(e.getFullYear(),0,1).getTimezoneOffset();e=(t!=l&&e.getTimezoneOffset()==Math.min(l,t))|0,f()[n+32>>2>>>0]=e},v:function(e){e>>>=0;var t=new Date(f()[e+20>>2>>>0]+1900,f()[e+16>>2>>>0],f()[e+12>>2>>>0],f()[e+8>>2>>>0],f()[e+4>>2>>>0],f()[e>>2>>>0],0),n=f()[e+32>>2>>>0],l=t.getTimezoneOffset(),b=new Date(t.getFullYear(),6,1).getTimezoneOffset(),y=new Date(t.getFullYear(),0,1).getTimezoneOffset(),_=Math.min(y,b);return 0>n?f()[e+32>>2>>>0]=+(b!=y&&_==l):0>2>>>0]=t.getDay(),n=(Ye(t.getFullYear())?kt:Wt)[t.getMonth()]+t.getDate()-1|0,f()[e+28>>2>>>0]=n,f()[e>>2>>>0]=t.getSeconds(),f()[e+4>>2>>>0]=t.getMinutes(),f()[e+8>>2>>>0]=t.getHours(),f()[e+12>>2>>>0]=t.getDate(),f()[e+16>>2>>>0]=t.getMonth(),f()[e+20>>2>>>0]=t.getYear(),e=t.getTime()/1e3,nr((Fe=e,1<=+Math.abs(Fe)?0>>0:~~+Math.ceil((Fe-+(~~Fe>>>0))/4294967296)>>>0:0)),e>>>0},r:Nt,s:Ht,y:function(e,t,n){function l(ne){return(ne=ne.toTimeString().match(/\\(([A-Za-z ]+)\\)$/))?ne[1]:"GMT"}e>>>=0,t>>>=0,n>>>=0;var b=new Date().getFullYear(),y=new Date(b,0,1),_=new Date(b,6,1);b=y.getTimezoneOffset();var X=_.getTimezoneOffset(),Me=Math.max(b,X);w()[e>>2>>>0]=60*Me,f()[t>>2>>>0]=+(b!=X),e=l(y),t=l(_),e=Gt(e),t=Gt(t),X>2>>>0]=e,w()[n+4>>2>>>0]=t):(w()[n>>2>>>0]=t,w()[n+4>>2>>>0]=e)},c:()=>{we("")},k:function(){},i:function(){return Date.now()},o:()=>{throw Re+=1,"unwind"},A:function(){return 4294901760},e:()=>performance.timeOrigin+performance.now(),f:function(){return L?(hr(),ot(gr)).cpus().length:navigator.hardwareConcurrency},K:function(e,t,n,l){for(M.vb=t>>>0,mt.length=n,t=l>>>0>>3,l=0;l>>0];return zr[e].apply(null,mt)},x:function(e){e>>>=0;var t=h().length;if(e<=t||4294901760=n;n*=2){var l=t*(1+.2/n);l=Math.min(l,e+100663296);var b=Math;l=Math.max(e,l);e:{b=b.min.call(b,4294901760,l+(65536-l%65536)%65536)-V.buffer.byteLength+65535>>>16;try{V.grow(b),pe();var y=1;break e}catch{}y=void 0}if(y)return!0}return!1},O:Yt,P:zt,H:Ge,g:$t,m:qt,w:Vt,l:Jt,a:V||a.wasmMemory,G:Qt,d:function(e,t,n,l){return Qt(e>>>0,t>>>0,n>>>0,l>>>0)}};(function(){function e(n,l){return n=n.exports,S=n=qr(n),M.Za.push(S.ya),Pe=S.za,ge.unshift(S.V),F=l,We(),n}var t={a:$r};if(De(),a.instantiateWasm)try{return a.instantiateWasm(t,e)}catch(n){ae("Module.instantiateWasm callback failed with error: "+n),x(n)}return Xe(t,function(n){e(n.instance,n.module)}).catch(x),{}})(),a._OrtInit=(e,t)=>(a._OrtInit=S.W)(e,t),a._OrtGetLastError=(e,t)=>(a._OrtGetLastError=S.X)(e,t),a._OrtCreateSessionOptions=(e,t,n,l,b,y,_,X,Me,ne)=>(a._OrtCreateSessionOptions=S.Y)(e,t,n,l,b,y,_,X,Me,ne),a._OrtAppendExecutionProvider=(e,t)=>(a._OrtAppendExecutionProvider=S.Z)(e,t),a._OrtAddFreeDimensionOverride=(e,t,n)=>(a._OrtAddFreeDimensionOverride=S._)(e,t,n),a._OrtAddSessionConfigEntry=(e,t,n)=>(a._OrtAddSessionConfigEntry=S.$)(e,t,n),a._OrtReleaseSessionOptions=e=>(a._OrtReleaseSessionOptions=S.aa)(e),a._OrtCreateSession=(e,t,n)=>(a._OrtCreateSession=S.ba)(e,t,n),a._OrtReleaseSession=e=>(a._OrtReleaseSession=S.ca)(e),a._OrtGetInputOutputCount=(e,t,n)=>(a._OrtGetInputOutputCount=S.da)(e,t,n),a._OrtGetInputName=(e,t)=>(a._OrtGetInputName=S.ea)(e,t),a._OrtGetOutputName=(e,t)=>(a._OrtGetOutputName=S.fa)(e,t),a._OrtFree=e=>(a._OrtFree=S.ga)(e),a._OrtCreateTensor=(e,t,n,l,b,y)=>(a._OrtCreateTensor=S.ha)(e,t,n,l,b,y),a._OrtGetTensorData=(e,t,n,l,b)=>(a._OrtGetTensorData=S.ia)(e,t,n,l,b),a._OrtReleaseTensor=e=>(a._OrtReleaseTensor=S.ja)(e),a._OrtCreateRunOptions=(e,t,n,l)=>(a._OrtCreateRunOptions=S.ka)(e,t,n,l),a._OrtAddRunConfigEntry=(e,t,n)=>(a._OrtAddRunConfigEntry=S.la)(e,t,n),a._OrtReleaseRunOptions=e=>(a._OrtReleaseRunOptions=S.ma)(e),a._OrtCreateBinding=e=>(a._OrtCreateBinding=S.na)(e),a._OrtBindInput=(e,t,n)=>(a._OrtBindInput=S.oa)(e,t,n),a._OrtBindOutput=(e,t,n,l)=>(a._OrtBindOutput=S.pa)(e,t,n,l),a._OrtClearBoundOutputs=e=>(a._OrtClearBoundOutputs=S.qa)(e),a._OrtReleaseBinding=e=>(a._OrtReleaseBinding=S.ra)(e),a._OrtRunWithBinding=(e,t,n,l,b)=>(a._OrtRunWithBinding=S.sa)(e,t,n,l,b),a._OrtRun=(e,t,n,l,b,y,_,X)=>(a._OrtRun=S.ta)(e,t,n,l,b,y,_,X),a._OrtEndProfiling=e=>(a._OrtEndProfiling=S.ua)(e);var ft=a._pthread_self=()=>(ft=a._pthread_self=S.va)(),Kt=a._malloc=e=>(Kt=a._malloc=S.wa)(e);a._free=e=>(a._free=S.xa)(e),a.__emscripten_tls_init=()=>(a.__emscripten_tls_init=S.ya)();var er=a.__emscripten_thread_init=(e,t,n,l,b,y)=>(er=a.__emscripten_thread_init=S.Aa)(e,t,n,l,b,y);a.__emscripten_thread_crashed=()=>(a.__emscripten_thread_crashed=S.Ba)();var tr=(e,t,n,l)=>(tr=S.Ca)(e,t,n,l),yt=e=>(yt=S.Da)(e),bt=a.__emscripten_thread_exit=e=>(bt=a.__emscripten_thread_exit=S.Ea)(e),rr=a.__emscripten_check_mailbox=()=>(rr=a.__emscripten_check_mailbox=S.Fa)(),nr=e=>(nr=S.Ga)(e),or=(e,t)=>(or=S.Ha)(e,t),wt=()=>(wt=S.Ia)(),lt=e=>(lt=S.Ja)(e),Ot=e=>(Ot=S.Ka)(e);function qr(e){e=Object.assign({},e);var t=l=>()=>l()>>>0,n=l=>b=>l(b)>>>0;return e.__errno_location=t(e.__errno_location),e.pthread_self=t(e.pthread_self),e.malloc=n(e.malloc),e.stackSave=t(e.stackSave),e.stackAlloc=n(e.stackAlloc),e}a.keepRuntimeAlive=ee,a.wasmMemory=V,a.stackAlloc=Ot,a.stackSave=wt,a.stackRestore=lt,a.UTF8ToString=He,a.stringToUTF8=ie,a.lengthBytesUTF8=re,a.ExitStatus=Ie,a.PThread=M;var ct;be=function e(){ct||ar(),ct||(be=e)};function ar(){function e(){if(!ct&&(ct=!0,a.calledRun=!0,!de)&&(v||je(ge),E(a),a.onRuntimeInitialized&&a.onRuntimeInitialized(),!v)){if(a.postRun)for(typeof a.postRun=="function"&&(a.postRun=[a.postRun]);a.postRun.length;){var t=a.postRun.shift();Ae.unshift(t)}je(Ae)}}if(!(0yr)});var Or=nt((wn,rn)=>{rn.exports=\'"use strict";var Module={},ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";if(ENVIRONMENT_IS_NODE){var nodeWorkerThreads=require("worker_threads"),parentPort=nodeWorkerThreads.parentPort;parentPort.on("message",e=>onmessage({data:e}));var fs=require("fs");Object.assign(global,{self:global,require,Module,location:{href:__filename},Worker:nodeWorkerThreads.Worker,importScripts:e=>(0,eval)(fs.readFileSync(e,"utf8")+"//# sourceURL="+e),postMessage:e=>parentPort.postMessage(e),performance:global.performance||{now:Date.now}})}var initializedJS=!1;function threadPrintErr(){var e=Array.prototype.slice.call(arguments).join(" ");if(ENVIRONMENT_IS_NODE){fs.writeSync(2,e+`\\n`);return}console.error(e)}function threadAlert(){var e=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:e,threadId:Module._pthread_self()})}var err=threadPrintErr;self.alert=threadAlert,Module.instantiateWasm=(e,t)=>{var a=Module.wasmModule;Module.wasmModule=null;var r=new WebAssembly.Instance(a,e);return t(r)},self.onunhandledrejection=e=>{throw e.reason??e};function handleMessage(e){try{if(e.data.cmd==="load"){let a=[];self.onmessage=r=>a.push(r),self.startWorker=r=>{Module=r,postMessage({cmd:"loaded"});for(let s of a)handleMessage(s);self.onmessage=handleMessage},Module.wasmModule=e.data.wasmModule;for(const r of e.data.handlers)Module[r]=(...s)=>{postMessage({cmd:"callHandler",handler:r,args:s})};if(Module.wasmMemory=e.data.wasmMemory,Module.buffer=Module.wasmMemory.buffer,Module.ENVIRONMENT_IS_PTHREAD=!0,typeof e.data.urlOrBlob=="string")importScripts(e.data.urlOrBlob);else{var t=URL.createObjectURL(e.data.urlOrBlob);importScripts(t),URL.revokeObjectURL(t)}ortWasmThreaded(Module)}else if(e.data.cmd==="run"){Module.__emscripten_thread_init(e.data.pthread_ptr,0,0,1),Module.__emscripten_thread_mailbox_await(e.data.pthread_ptr),Module.establishStackSpace(),Module.PThread.receiveObjectTransfer(e.data),Module.PThread.threadInitTLS(),initializedJS||(initializedJS=!0);try{Module.invokeEntryPoint(e.data.start_routine,e.data.arg)}catch(a){if(a!="unwind")throw a}}else e.data.cmd==="cancel"?Module._pthread_self()&&Module.__emscripten_thread_exit(-1):e.data.target==="setimmediate"||(e.data.cmd==="checkMailbox"?initializedJS&&Module.checkMailbox():e.data.cmd&&(err("worker.js received unknown command "+e.data.cmd),err(e.data)))}catch(a){throw Module.__emscripten_thread_crashed&&Module.__emscripten_thread_crashed(),a}}self.onmessage=handleMessage;\\n\'});var _r;_r=dr();var nn=wr(),Dt,Ft=!1,dt=!1,vr=!1,on=s=>{if(s===1)return!1;if(typeof SharedArrayBuffer>"u")return typeof self<"u"&&!self.crossOriginIsolated&&console.warn("env.wasm.numThreads is set to "+s+", but this will not work unless you enable crossOriginIsolated mode. See https://web.dev/cross-origin-isolation-guide/ for more info."),!1;typeof process<"u"&&process.versions&&process.versions.node&&console.warn("env.wasm.numThreads is set to "+s+", however, currently onnxruntime-web does not support multi-threads in Node.js. Please consider using onnxruntime-node for performance critical scenarios.");try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]))}catch{return!1}},an=()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,30,1,28,0,65,0,253,15,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,186,1,26,11]))}catch{return!1}},sn=(s,c)=>s?c?"ort-wasm-simd-threaded.wasm":"ort-wasm-simd.wasm":c?"ort-wasm-threaded.wasm":"ort-wasm.wasm",Er=async s=>{if(Ft)return Promise.resolve();if(dt)throw new Error("multiple calls to \'initializeWebAssembly()\' detected.");if(vr)throw new Error("previous call to \'initializeWebAssembly()\' failed.");dt=!0;let c=s.initTimeout,o=s.numThreads,h=s.simd,f=on(o),w=h&&an(),g=s.wasmPaths,a=typeof g=="string"?g:void 0,E=sn(w,f),x=typeof g=="object"?g[E]:void 0,P=!1,R=[];if(c>0&&R.push(new Promise(D=>{setTimeout(()=>{P=!0,D()},c)})),R.push(new Promise((D,K)=>{let I=f?nn:_r,L={locateFile:(v,k)=>f&&v.endsWith(".worker.js")&&typeof Blob<"u"?URL.createObjectURL(new Blob([Or()],{type:"text/javascript"})):v.endsWith(".wasm")?x||(a??k)+E:k+v};if(f)if(L.numThreads=o,typeof Blob>"u")L.mainScriptUrlOrBlob=(void 0)(__dirname,"ort-wasm-threaded.js");else{let v=`var ortWasmThreaded=${I.toString()};`;L.mainScriptUrlOrBlob=new Blob([v],{type:"text/javascript"})}I(L).then(v=>{dt=!1,Ft=!0,Dt=v,D()},v=>{dt=!1,vr=!0,K(v)})})),await Promise.race(R),P)throw new Error(`WebAssembly backend initializing failed due to timeout: ${c}ms`)},Q=()=>{if(Ft&&Dt)return Dt;throw new Error("WebAssembly is not initialized yet.")};var $=(s,c)=>{let o=Q(),h=o.lengthBytesUTF8(s)+1,f=o._malloc(h);return o.stringToUTF8(s,f,h),c.push(f),f},at=(s,c,o,h)=>{if(typeof s=="object"&&s!==null){if(o.has(s))throw new Error("Circular reference in options");o.add(s)}Object.entries(s).forEach(([f,w])=>{let g=c?c+f:f;if(typeof w=="object")at(w,g+".",o,h);else if(typeof w=="string"||typeof w=="number")h(g,w.toString());else if(typeof w=="boolean")h(g,w?"1":"0");else throw new Error(`Can\'t handle extra config type: ${typeof w}`)})},q=s=>{let c=Q(),o=c.stackSave();try{let h=c.stackAlloc(8);c._OrtGetLastError(h,h+4);let f=c.HEAP32[h/4],w=c.HEAPU32[h/4+1],g=w?c.UTF8ToString(w):"";throw new Error(`${s} ERROR_CODE: ${f}, ERROR_MESSAGE: ${g}`)}finally{c.stackRestore(o)}};var Sr=s=>{let c=Q(),o=0,h=[],f=s||{};try{if(s?.logSeverityLevel===void 0)f.logSeverityLevel=2;else if(typeof s.logSeverityLevel!="number"||!Number.isInteger(s.logSeverityLevel)||s.logSeverityLevel<0||s.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${s.logSeverityLevel}`);if(s?.logVerbosityLevel===void 0)f.logVerbosityLevel=0;else if(typeof s.logVerbosityLevel!="number"||!Number.isInteger(s.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${s.logVerbosityLevel}`);s?.terminate===void 0&&(f.terminate=!1);let w=0;return s?.tag!==void 0&&(w=$(s.tag,h)),o=c._OrtCreateRunOptions(f.logSeverityLevel,f.logVerbosityLevel,!!f.terminate,w),o===0&&q("Can\'t create run options."),s?.extra!==void 0&&at(s.extra,"",new WeakSet,(g,a)=>{let E=$(g,h),x=$(a,h);c._OrtAddRunConfigEntry(o,E,x)!==0&&q(`Can\'t set a run config entry: ${g} - ${a}.`)}),[o,h]}catch(w){throw o!==0&&c._OrtReleaseRunOptions(o),h.forEach(g=>c._free(g)),w}};var un=s=>{switch(s){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${s}`)}},fn=s=>{switch(s){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${s}`)}},ln=s=>{s.extra||(s.extra={}),s.extra.session||(s.extra.session={});let c=s.extra.session;c.use_ort_model_bytes_directly||(c.use_ort_model_bytes_directly="1"),s.executionProviders&&s.executionProviders.some(o=>(typeof o=="string"?o:o.name)==="webgpu")&&(s.enableMemPattern=!1)},cn=(s,c,o)=>{for(let h of c){let f=typeof h=="string"?h:h.name;switch(f){case"webnn":if(f="WEBNN",typeof h!="string"){let g=h;if(g?.deviceType){let a=$("deviceType",o),E=$(g.deviceType,o);Q()._OrtAddSessionConfigEntry(s,a,E)!==0&&q(`Can\'t set a session config entry: \'deviceType\' - ${g.deviceType}.`)}if(g?.numThreads){let a=g.numThreads;(typeof a!="number"||!Number.isInteger(a)||a<0)&&(a=0);let E=$("numThreads",o),x=$(a.toString(),o);Q()._OrtAddSessionConfigEntry(s,E,x)!==0&&q(`Can\'t set a session config entry: \'numThreads\' - ${g.numThreads}.`)}if(g?.powerPreference){let a=$("powerPreference",o),E=$(g.powerPreference,o);Q()._OrtAddSessionConfigEntry(s,a,E)!==0&&q(`Can\'t set a session config entry: \'powerPreference\' - ${g.powerPreference}.`)}}break;case"webgpu":if(f="JS",typeof h!="string"){let g=h;if(g?.preferredLayout){if(g.preferredLayout!=="NCHW"&&g.preferredLayout!=="NHWC")throw new Error(`preferredLayout must be either \'NCHW\' or \'NHWC\': ${g.preferredLayout}`);let a=$("preferredLayout",o),E=$(g.preferredLayout,o);Q()._OrtAddSessionConfigEntry(s,a,E)!==0&&q(`Can\'t set a session config entry: \'preferredLayout\' - ${g.preferredLayout}.`)}}break;case"wasm":case"cpu":continue;default:throw new Error(`not supported execution provider: ${f}`)}let w=$(f,o);Q()._OrtAppendExecutionProvider(s,w)!==0&&q(`Can\'t append execution provider: ${f}.`)}},Ar=s=>{let c=Q(),o=0,h=[],f=s||{};ln(f);try{let w=un(f.graphOptimizationLevel??"all"),g=fn(f.executionMode??"sequential"),a=typeof f.logId=="string"?$(f.logId,h):0,E=f.logSeverityLevel??2;if(!Number.isInteger(E)||E<0||E>4)throw new Error(`log serverity level is not valid: ${E}`);let x=f.logVerbosityLevel??0;if(!Number.isInteger(x)||x<0||x>4)throw new Error(`log verbosity level is not valid: ${x}`);let P=typeof f.optimizedModelFilePath=="string"?$(f.optimizedModelFilePath,h):0;if(o=c._OrtCreateSessionOptions(w,!!f.enableCpuMemArena,!!f.enableMemPattern,g,!!f.enableProfiling,0,a,E,x,P),o===0&&q("Can\'t create session options."),f.executionProviders&&cn(o,f.executionProviders,h),f.enableGraphCapture!==void 0){if(typeof f.enableGraphCapture!="boolean")throw new Error(`enableGraphCapture must be a boolean value: ${f.enableGraphCapture}`);let R=$("enableGraphCapture",h),D=$(f.enableGraphCapture.toString(),h);c._OrtAddSessionConfigEntry(o,R,D)!==0&&q(`Can\'t set a session config entry: \'enableGraphCapture\' - ${f.enableGraphCapture}.`)}if(f.freeDimensionOverrides)for(let[R,D]of Object.entries(f.freeDimensionOverrides)){if(typeof R!="string")throw new Error(`free dimension override name must be a string: ${R}`);if(typeof D!="number"||!Number.isInteger(D)||D<0)throw new Error(`free dimension override value must be a non-negative integer: ${D}`);let K=$(R,h);c._OrtAddFreeDimensionOverride(o,K,D)!==0&&q(`Can\'t set a free dimension override: ${R} - ${D}.`)}return f.extra!==void 0&&at(f.extra,"",new WeakSet,(R,D)=>{let K=$(R,h),I=$(D,h);c._OrtAddSessionConfigEntry(o,K,I)!==0&&q(`Can\'t set a session config entry: ${R} - ${D}.`)}),[o,h]}catch(w){throw o!==0&&c._OrtReleaseSessionOptions(o),h.forEach(g=>c._free(g)),w}};var xt=s=>{switch(s){case"int8":return 3;case"uint8":return 2;case"bool":return 9;case"int16":return 5;case"uint16":return 4;case"int32":return 6;case"uint32":return 12;case"float16":return 10;case"float32":return 1;case"float64":return 11;case"string":return 8;case"int64":return 7;case"uint64":return 13;default:throw new Error(`unsupported data type: ${s}`)}},Tr=s=>{switch(s){case 3:return"int8";case 2:return"uint8";case 9:return"bool";case 5:return"int16";case 4:return"uint16";case 6:return"int32";case 12:return"uint32";case 10:return"float16";case 1:return"float32";case 11:return"float64";case 8:return"string";case 7:return"int64";case 13:return"uint64";default:throw new Error(`unsupported data type: ${s}`)}},Pt=s=>[void 0,4,1,1,2,2,4,8,void 0,1,2,8,4,8,void 0,void 0,void 0][s],Mr=s=>{switch(s){case"float16":return typeof Float16Array<"u"&&Float16Array.from?Float16Array:Uint16Array;case"float32":return Float32Array;case"uint8":return Uint8Array;case"int8":return Int8Array;case"uint16":return Uint16Array;case"int16":return Int16Array;case"int32":return Int32Array;case"bool":return Uint8Array;case"float64":return Float64Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"uint64":return BigUint64Array;default:throw new Error(`unsupported type: ${s}`)}},Cr=s=>{switch(s){case"verbose":return 0;case"info":return 1;case"warning":return 2;case"error":return 3;case"fatal":return 4;default:throw new Error(`unsupported logging level: ${s}`)}},Rr=s=>s==="float32"||s==="float16"||s==="int32"||s==="int64"||s==="uint32"||s==="uint8"||s==="bool",Dr=s=>{switch(s){case"none":return 0;case"cpu":return 1;case"cpu-pinned":return 2;case"texture":return 3;case"gpu-buffer":return 4;default:throw new Error(`unsupported data location: ${s}`)}};var Fr=async s=>{if(typeof s=="string")if(typeof process<"u"&&process.versions&&process.versions.node)try{return new Uint8Array(await(void 0)(s))}catch(c){if(c.code==="ERR_FS_FILE_TOO_LARGE"){let o=(void 0)(s),h=[];for await(let f of o)h.push(f);return new Uint8Array(Buffer.concat(h))}throw c}else{let c=await fetch(s);if(!c.ok)throw new Error(`failed to load external data file: ${s}`);let o=c.headers.get("Content-Length"),h=o?parseInt(o,10):0;if(h<1073741824)return new Uint8Array(await c.arrayBuffer());{if(!c.body)throw new Error(`failed to load external data file: ${s}, no response body.`);let f=c.body.getReader(),w;try{w=new ArrayBuffer(h)}catch(a){if(a instanceof RangeError){let E=Math.ceil(h/65536);w=new WebAssembly.Memory({initial:E,maximum:E}).buffer}else throw a}let g=0;for(;;){let{done:a,value:E}=await f.read();if(a)break;let x=E.byteLength;new Uint8Array(w,g,x).set(E),g+=x}return new Uint8Array(w,0,h)}}else return s instanceof Blob?new Uint8Array(await s.arrayBuffer()):s instanceof Uint8Array?s:new Uint8Array(s)};var dn=(s,c)=>{Q()._OrtInit(s,c)!==0&&q("Can\'t initialize onnxruntime.")},Pr=async s=>{dn(s.wasm.numThreads,Cr(s.logLevel))},Ir=async(s,c)=>{},ze=new Map,pn=s=>{let c=Q(),o=c.stackSave();try{let h=c.stackAlloc(8);return c._OrtGetInputOutputCount(s,h,h+4)!==0&&q("Can\'t get session input/output count."),[c.HEAP32[h/4],c.HEAP32[h/4+1]]}finally{c.stackRestore(o)}},It=s=>{let c=Q(),o=c._malloc(s.byteLength);if(o===0)throw new Error(`Can\'t create a session. failed to allocate a buffer of size ${s.byteLength}.`);return c.HEAPU8.set(s,o),[o,s.byteLength]},Ur=async(s,c)=>{let o,h,f=Q();Array.isArray(s)?[o,h]=s:s.buffer===f.HEAPU8.buffer?[o,h]=[s.byteOffset,s.byteLength]:[o,h]=It(s);let w=0,g=0,a=0,E=[],x=[],P=[];try{if([g,E]=Ar(c),c?.externalData&&f.mountExternalData){let W=[];for(let j of c.externalData){let oe=typeof j=="string"?j:j.path;W.push(Fr(typeof j=="string"?j:j.data).then(C=>{f.mountExternalData(oe,C)}))}await Promise.all(W)}w=await f._OrtCreateSession(o,h,g),w===0&&q("Can\'t create a session.");let[R,D]=pn(w),K=!!c?.enableGraphCapture,I=[],L=[],v=[];for(let W=0;Wf._OrtFree(D)),P.forEach(D=>f._OrtFree(D)),a!==0&&f._OrtReleaseBinding(a),w!==0&&f._OrtReleaseSession(w),R}finally{f._free(o),g!==0&&f._OrtReleaseSessionOptions(g),E.forEach(R=>f._free(R)),f.unmountExternalData?.()}},Lr=s=>{let c=Q(),o=ze.get(s);if(!o)throw new Error(`cannot release session. invalid session id: ${s}`);let[h,f,w,g,a]=o;g&&(a&&c._OrtClearBoundOutputs(g.handle),c._OrtReleaseBinding(g.handle)),c.jsepOnReleaseSession?.(s),f.forEach(E=>c._OrtFree(E)),w.forEach(E=>c._OrtFree(E)),c._OrtReleaseSession(h),ze.delete(s)},xr=(s,c,o,h,f,w=!1)=>{if(!s){c.push(0);return}let g=Q(),a=s[0],E=s[1],x=s[3],P,R;if(a==="string"&&x==="gpu-buffer")throw new Error("String tensor is not supported on GPU.");if(w&&x!=="gpu-buffer")throw new Error(`External buffer must be provided for input/output index ${f} when enableGraphCapture is true.`);if(x==="gpu-buffer"){let I=s[2].gpuBuffer,L=Pt(xt(a));R=E.reduce((k,W)=>k*W,1)*L;let v=g.jsepRegisterBuffer;if(!v)throw new Error(\'Tensor location "gpu-buffer" is not supported without using WebGPU.\');P=v(h,f,I,R)}else{let I=s[2];if(Array.isArray(I)){R=4*I.length,P=g._malloc(R),o.push(P);let L=P/4;for(let v=0;vg.HEAP32[I++]=v);let L=g._OrtCreateTensor(xt(a),P,R,K,E.length,Dr(x));L===0&&q(`Can\'t create tensor for input/output. session=${h}, index=${f}.`),c.push(L)}finally{g.stackRestore(D)}},Br=async(s,c,o,h,f,w)=>{let g=Q(),a=ze.get(s);if(!a)throw new Error(`cannot run inference. invalid session id: ${s}`);let E=a[0],x=a[1],P=a[2],R=a[3],D=a[4],K=a[5],I=c.length,L=h.length,v=0,k=[],W=[],j=[],oe=[],C=g.stackSave(),ve=g.stackAlloc(I*4),Oe=g.stackAlloc(I*4),ce=g.stackAlloc(L*4),A=g.stackAlloc(L*4);try{[v,k]=Sr(w);for(let F=0;Fee*Y,1);J=Tr(Se);let Re=R?.outputPreferredLocations[h[F]];if(J==="string"){if(Re==="gpu-buffer")throw new Error("String tensor is not supported on GPU.");let ee=[],Y=fe/4;for(let he=0;he0){let ee=g.jsepGetBuffer;if(!ee)throw new Error(\'preferredLocation "gpu-buffer" is not supported without using WebGPU.\');let Y=ee(fe),he=Pt(Se);if(he===void 0||!Rr(J))throw new Error(`Unsupported data type: ${J}`);Ee=!0,S.push([J,ge,{gpuBuffer:Y,download:g.jsepCreateDownloader(Y,Ae*he,J),dispose:()=>{g._OrtReleaseTensor(de)}},"gpu-buffer"])}else{let ee=Mr(J),Y=new ee(Ae);new Uint8Array(Y.buffer,Y.byteOffset,Y.byteLength).set(g.HEAPU8.subarray(fe,fe+Y.byteLength)),S.push([J,ge,Y,"cpu"])}}finally{g.stackRestore(ue),J==="string"&&fe&&g._free(fe),Ee||g._OrtReleaseTensor(de)}}return R&&!D&&(g._OrtClearBoundOutputs(R.handle),ze.set(s,[E,x,P,R,D,!1])),S}finally{g.stackRestore(C),W.forEach(N=>g._OrtReleaseTensor(N)),j.forEach(N=>g._OrtReleaseTensor(N)),oe.forEach(N=>g._free(N)),v!==0&&g._OrtReleaseRunOptions(v),k.forEach(N=>g._free(N))}},kr=s=>{let c=Q(),o=ze.get(s);if(!o)throw new Error("invalid session id");let h=o[0],f=c._OrtEndProfiling(h);f===0&&q("Can\'t get an profile file name."),c._OrtFree(f)},Wr=s=>{let c=[];for(let o of s){let h=o[2];!Array.isArray(h)&&"buffer"in h&&c.push(h.buffer)}return c};self.onmessage=s=>{let{type:c,in:o}=s.data;try{switch(c){case"init-wasm":Er(o.wasm).then(()=>{Pr(o).then(()=>{postMessage({type:c})},h=>{postMessage({type:c,err:h})})},h=>{postMessage({type:c,err:h})});break;case"init-ep":{let{epName:h,env:f}=o;Ir(f,h).then(()=>{postMessage({type:c})},w=>{postMessage({type:c,err:w})});break}case"copy-from":{let{buffer:h}=o,f=It(h);postMessage({type:c,out:f});break}case"create":{let{model:h,options:f}=o;Ur(h,f).then(w=>{postMessage({type:c,out:w})},w=>{postMessage({type:c,err:w})});break}case"release":Lr(o),postMessage({type:c});break;case"run":{let{sessionId:h,inputIndices:f,inputs:w,outputIndices:g,options:a}=o;Br(h,f,w,g,new Array(g.length).fill(null),a).then(E=>{E.some(x=>x[3]!=="cpu")?postMessage({type:c,err:"Proxy does not support non-cpu tensor location."}):postMessage({type:c,out:E},Wr([...w,...E]))},E=>{postMessage({type:c,err:E})});break}case"end-profiling":kr(o),postMessage({type:c});break;default:}}catch(h){postMessage({type:c,err:h})}};})();\n'});var Xe,Se,St,jt,zt,br,vr,st,ut,Za,Gt,ia,sa,ua,fa,la,ca,da,Or=H(()=>{"use strict";qe();aa();ot();Xe=()=>!!$.wasm.proxy&&typeof document<"u",St=!1,jt=!1,zt=!1,vr=new Map,st=(n,r)=>{let t=vr.get(n);t?t.push(r):vr.set(n,[r])},ut=()=>{if(St||!jt||zt||!Se)throw new Error("worker not ready")},Za=n=>{switch(n.data.type){case"init-wasm":St=!1,n.data.err?(zt=!0,br[1](n.data.err)):(jt=!0,br[0]());break;case"init-ep":case"copy-from":case"create":case"release":case"run":case"end-profiling":{let r=vr.get(n.data.type);n.data.err?r.shift()[1](n.data.err):r.shift()[0](n.data.out);break}default:}},Gt=typeof document<"u"?document?.currentScript?.src:void 0,ia=async()=>{if(!jt){if(St)throw new Error("multiple calls to 'initWasm()' detected.");if(zt)throw new Error("previous call to 'initWasm()' failed.");if(St=!0,Xe())return $.wasm.wasmPaths===void 0&&Gt&&Gt.indexOf("blob:")!==0&&($.wasm.wasmPaths=Gt.substr(0,+Gt.lastIndexOf("/")+1)),new Promise((n,r)=>{Se?.terminate();let t=URL.createObjectURL(new Blob([oa()],{type:"text/javascript"}));Se=new Worker(t,{name:"ort-wasm-proxy-worker"}),Se.onerror=s=>r(s),Se.onmessage=Za,URL.revokeObjectURL(t),br=[n,r];let f={type:"init-wasm",in:$};Se.postMessage(f)});try{await Hn($.wasm),await Zn($),jt=!0}catch(n){throw zt=!0,n}finally{St=!1}}},sa=async n=>{if(Xe())return ut(),new Promise((r,t)=>{st("init-ep",[r,t]);let f={type:"init-ep",in:{epName:n,env:$}};Se.postMessage(f)});await Qn($,n)},ua=async n=>Xe()?(ut(),new Promise((r,t)=>{st("copy-from",[r,t]);let f={type:"copy-from",in:{buffer:n}};Se.postMessage(f,[n.buffer])})):wr(n),fa=async(n,r)=>{if(Xe()){if(r?.preferredOutputLocation)throw new Error('session option "preferredOutputLocation" is not supported for proxy.');return ut(),new Promise((t,f)=>{st("create",[t,f]);let s={type:"create",in:{model:n,options:{...r}}},m=[];n instanceof Uint8Array&&m.push(n.buffer),Se.postMessage(s,m)})}else return Kn(n,r)},la=async n=>{if(Xe())return ut(),new Promise((r,t)=>{st("release",[r,t]);let f={type:"release",in:n};Se.postMessage(f)});ea(n)},ca=async(n,r,t,f,s,m)=>{if(Xe()){if(t.some(c=>c[3]!=="cpu"))throw new Error("input tensor on GPU is not supported for proxy.");if(s.some(c=>c))throw new Error("pre-allocated output tensor is not supported for proxy.");return ut(),new Promise((c,o)=>{st("run",[c,o]);let h=t,g={type:"run",in:{sessionId:n,inputIndices:r,inputs:h,outputIndices:f,options:m}};Se.postMessage(g,na(h))})}else return ta(n,r,t,f,s,m)},da=async n=>{if(Xe())return ut(),new Promise((r,t)=>{st("end-profiling",[r,t]);let f={type:"end-profiling",in:n};Se.postMessage(f)});ra(n)}});var pa,Qa,$t,ma=H(()=>{"use strict";qe();Or();gr();yr();pa=(n,r)=>{switch(n.location){case"cpu":return[n.type,n.dims,n.data,"cpu"];case"gpu-buffer":return[n.type,n.dims,{gpuBuffer:n.gpuBuffer},"gpu-buffer"];default:throw new Error(`invalid data location: ${n.location} for ${r()}`)}},Qa=n=>{switch(n[3]){case"cpu":return new le(n[0],n[2],n[1]);case"gpu-buffer":{let r=n[0];if(!Ht(r))throw new Error(`not supported data type: ${r} for deserializing GPU tensor`);let{gpuBuffer:t,download:f,dispose:s}=n[2];return le.fromGpuBuffer(t,{dataType:r,dims:n[1],download:f,dispose:s})}default:throw new Error(`invalid data location: ${n[3]}`)}},$t=class{async fetchModelAndCopyToWasmMemory(r){return ua(await At(r))}async loadModel(r,t){Ye();let f;typeof r=="string"?typeof process<"u"&&process.versions&&process.versions.node?f=await At(r):f=await this.fetchModelAndCopyToWasmMemory(r):f=r,[this.sessionId,this.inputNames,this.outputNames]=await fa(f,t),Ve()}async dispose(){return la(this.sessionId)}async run(r,t,f){Ye();let s=[],m=[];Object.entries(r).forEach(v=>{let R=v[0],C=v[1],x=this.inputNames.indexOf(R);if(x===-1)throw new Error(`invalid input '${R}'`);s.push(C),m.push(x)});let c=[],o=[];Object.entries(t).forEach(v=>{let R=v[0],C=v[1],x=this.outputNames.indexOf(R);if(x===-1)throw new Error(`invalid output '${R}'`);c.push(C),o.push(x)});let h=s.map((v,R)=>pa(v,()=>`input "${this.inputNames[m[R]]}"`)),g=c.map((v,R)=>v?pa(v,()=>`output "${this.outputNames[o[R]]}"`):null),O=await ca(this.sessionId,m,h,o,g,f),_={};for(let v=0;v{"use strict";qe();Or();ma();Ka=()=>{if((typeof $.wasm.initTimeout!="number"||$.wasm.initTimeout<0)&&($.wasm.initTimeout=0),typeof $.wasm.simd!="boolean"&&($.wasm.simd=!0),typeof $.wasm.proxy!="boolean"&&($.wasm.proxy=!1),typeof $.wasm.trace!="boolean"&&($.wasm.trace=!1),typeof $.wasm.numThreads!="number"||!Number.isInteger($.wasm.numThreads)||$.wasm.numThreads<=0){(typeof self<"u"&&!self.crossOriginIsolated||typeof process<"u"&&process.versions&&process.versions.node)&&($.wasm.numThreads=1);let n=typeof navigator>"u"?(void 0)().length:navigator.hardwareConcurrency;$.wasm.numThreads=Math.min(4,Math.ceil((n||1)/2))}},Yt=class{async init(r){Ka(),await ia(),await sa(r)}async createInferenceSessionHandler(r,t){let f=new $t;return await f.loadModel(r,t),Promise.resolve(f)}}});var ga={};vt(ga,{wasmBackend:()=>eo});var eo,ya=H(()=>{"use strict";ha();eo=new Yt});qe();qe();qe();var Tn="1.18.0";var Wi=or;{let n=(ya(),at(ga)).wasmBackend;Ot("cpu",n,10),Ot("wasm",n,10)}Object.defineProperty($.versions,"web",{value:Tn,enumerable:!0});export{Pa as InferenceSession,gn as TRACE,Ye as TRACE_FUNC_BEGIN,Ve as TRACE_FUNC_END,le as Tensor,Ia as TrainingSession,Wi as default,$ as env,Ot as registerBackend}; +//# sourceMappingURL=ort.wasm.min.js.map