PageSourceSearch

https://bonissystems.com/_next/static/chunks/32619.60dc5e9b18a325cf.js

js bonissystems.com collected 2026-10-03 21:15:55 UTC 148,072 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[32619],{3835:(e,t,r)=>{"use strict";function n(e,t){e&&e(t)}function i(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[t,e]))}function a(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}r.d(t,{Nt:()=>a,TR:()=>d,_e:()=>n,bV:()=>o,iu:()=>s,k1:()=>l,ky:()=>c,nK:()=>p,qM:()=>f,t2:()=>h,uY:()=>u,vp:()=>i});let o=class{constructor(){let e=function(...t){return e._call(...t)};return Object.setPrototypeOf(e,new.target.prototype)}_call(){throw Error("Must implement _call method in subclass")}};function s(e){return e?.prototype?.__proto__?.constructor?.name==="TypedArray"}function l(e){return Number.isInteger(e)||"bigint"==typeof e}function h(e){return null!=e}function c(e){let t=[],r=e;for(;Array.isArray(r);)t.push(r.length),r=r[0];return t}function u(e,t,r){let n=e[t];if(void 0!==n)return delete e[t],n;if(void 0===r)throw Error(`Key ${t} does not exist in object.`);return r}function d(...e){return Array.prototype.concat.apply([],e)}function f(...e){return e.reduce((e,t)=>e.flatMap(e=>t.map(t=>[e,t])))}function p(e,t){return Math.abs((e+t)%(2*t)-t)}},9606:(e,t,r)=>{"use strict";r.r(t),r.d(t,{InferenceSession:()=>g,Tensor:()=>p,env:()=>l,registerBackend:()=>a});let n={},i=[],a=(e,t,r)=>{if(t&&"function"==typeof t.init&&"function"==typeof t.createSessionHandler){let a=n[e];if(void 0===a)n[e]={backend:t,priority:r};else if(a.priority>r)return;else if(a.priority===r&&a.backend!==t)throw Error(`cannot register backend "${e}" using priority ${r}`);if(r>=0){let t=i.indexOf(e);-1!==t&&i.splice(t,1);for(let t=0;t<i.length;t++)if(n[i[t]].priority<=r)return void i.splice(t,0,e);i.push(e)}return}throw TypeError("not a valid backend")},o=async e=>{let t=0===e.length?i:e,r=[];for(let e of t){let t=n[e];if(t){if(t.initialized)return t.backend;if(t.aborted)continue;
1let n=!!t.initPromise;try{return n||(t.initPromise=t.backend.init()),await t.initPromise,t.initialized=!0,t.backend}catch(i){n||r.push({name:e,err:i}),t.aborted=!0}finally{delete t.initPromise}}}throw Error(`no available backend found. ERR: ${r.map(e=>`[${e.name}] ${e.err}`).join(", ")}`)};class s{constructor(){this.wasm={},this.webgl={},this.logLevelInternal="warning"}set logLevel(e){if(void 0!==e){if("string"!=typeof e||-1===["verbose","info","warning","error","fatal"].indexOf(e))throw Error(`Unsupported logging level: ${e}`);this.logLevelInternal=e}}get logLevel(){return this.logLevelInternal}}let l=new s,h="undefined"!=typeof BigInt64Array&&"function"==typeof BigInt64Array.from,c="undefined"!=typeof BigUint64Array&&"function"==typeof BigUint64Array.from,u=new Map([["float32",Float32Array],["uint8",Uint8Array],["int8",Int8Array],["uint16",Uint16Array],["int16",Int16Array],["int32",Int32Array],["bool",Uint8Array],["float64",Float64Array],["uint32",Uint32Array]]),d=new Map([[Float32Array,"float32"],[Uint8Array,"uint8"],[Int8Array,"int8"],[Uint16Array,"uint16"],[Int16Array,"int16"],[Int32Array,"int32"],[Float64Array,"float64"],[Uint32Array,"uint32"]]);h&&(u.set("int64",BigInt64Array),d.set(BigInt64Array,"int64")),c&&(u.set("uint64",BigUint64Array),d.set(BigUint64Array,"uint64"));class f{constructor(e,t,r){let n,i,a;if("string"==typeof e)if(n=e,a=r,"string"===e){if(!Array.isArray(t))throw TypeError("A string tensor's data must be a string array.");i=t}else{let r=u.get(e);if(void 0===r)throw TypeError(`Unsupported tensor type: ${e}.`);if(Array.isArray(t))i=r.from(t);else if(t instanceof r)i=t;else throw TypeError(`A ${n} tensor's data must be type of ${r}`)}else if(a=t,Array.isArray(e)){if(0===e.length)throw TypeError("Tensor type cannot be inferred from an empty array.");let t=typeof e[0];if("string"===t)n="string",i=e;else if("boolean"===t)n="bool",i=Uint8Array.from(e);else throw TypeError(`Invalid element type of data array: ${t}.`)}else{let t=d.get(e.constructor);if(void 0===t)throw TypeError(`Unsupported type for tensor data: ${e.constructor}.`);n=t,i=e}if(void 0===a)a=[i.length];else if(!Array.isArray(a))throw TypeError("A tensor's dims must be a number array");let o=(e=>{let t=1;for(let r=0;r<e.length;r++){let n=e[r];if("number"!=typeof n||!Number.isSafeInteger(n))throw TypeError(`dims[${r}] must be an integer, got: ${n}`);if(n<0)throw RangeError(`dims[${r}] must be a non-negative integer, got: ${n}`);t*=n}return t})(a);if(o!==i.length)throw Error(`Tensor's size(${o}) does not match data length(${i.length}).`);this.dims=a,this.type=n,this.data=i,this.size=o}static bufferToTensor(e,t){let r,n;if(void 0===e)throw Error("Image buffer must be defined");if(void 0===t.height||void 0===t.width)throw Error("Image height and width must be defined");let{height:i,width:a}=t,o=t.norm;r=void 0===o||void 0===o.mean?255:o.mean,n=void 0===o||void 0===o.bias?0:o.bias;let s=void 0!==t.bitmapFormat?t.bitmapFormat:"RGBA",l=void 0!==t.tensorFormat&&void 0!==t.tensorFormat?t.tensorFormat:"RGB",h=i*a,c=new Float32Array("RGBA"===l?4*h:3*h),u=4,d=0,p=1,m=2,g=3,_=0,w=h,y=2*h,b=-1;"RGB"===s&&(u=3,d=0,p=1,m=2,g=-1),"RGBA"===l?b=3*h:"RBG"===l?(_=0,y=h,w=2*h):"BGR"===l&&(y=0,w=h,_=2*h);for(let t=0;t<h;t++,d+=u,m+=u,p+=u,g+=u)c[_++]=(e[d]+n)/r,c[w++]=(e[p]+n)/r,c[y++]=(e[m]+n)/r,-1!==b&&-1!==g&&(c[b++]=(e[g]+n)/r);return"RGBA"===l?new f("float32",c,[1,4,i,a]):new f("float32",c,[1,3,i,a])}static async fromImage(e,t){let r,n="undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement,i="undefined"!=typeof ImageData&&e instanceof ImageData,a="undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap,o="undefined"!=typeof String&&(e instanceof String||"string"==typeof e),s={};if(n){let n=document.createElement("canvas"),i=n.getContext("2d");if(null!=i){let a=e.naturalHeight,o=e.naturalWidth;if(void 0!==t&&void 0!==t.resizedHeight&&void 0!==t.resizedWidth&&(a=t.resizedHeight,o=t.resizedWidth),void 0!==t){if(s=t,void 0!==t.tensorFormat)throw Error("Image input config format must be RGBA for HTMLImageElement");if(s.tensorFormat="RGBA",void 0!==t.height&&t.height!==a)throw Error("Image input config height doesn't match HTMLImageElement height");if(s.height=a,void 0!==t.width&&t.width!==o)throw Error("Image input config width doesn't match HTMLImageElement width");s.width=o}else s.tensorFormat="RGBA",s.height=a,s.width=o;n.width=o,n.height=a,i.drawImage(e,0,0,o,a),r=i.getImageData(0,0,o,a).data}else throw Error("Can not access image data")}else if(i){let n,i;if(void 0!==t&&void 0!==t.resizedWidth&&void 0!==t.resizedHeight?(n=t.resizedHeight,i=t.resizedWidth):(n=e.height,i=e.width),void 0!==t){if(s=t,void 0!==t.bitmapFormat&&"RGBA"!==t.bitmapFormat)throw Error("Image input config format must be RGBA for ImageData");s.bitmapFormat="RGBA"}else s.bitmapFormat="RGBA";if(s.height=n,s.width=i,void 0!==t){let t=document.createElement("canvas");t.width=i,t.height=n;let a=t.getContext("2d");if(null!=a)a.putImageData(e,0,0),r=a.getImageData(0,0,i,n).data;else throw Error("Can not access image data")}else r=e.data}else if(a){if(void 0===t)throw Error("Please provide image config with format for Imagebitmap");if(void 0!==t.bitmapFormat)throw Error("Image input config format must be defined for ImageBitmap");let n=document.createElement("canvas").getContext("2d");
1if(null!=n){let i=e.height,a=e.width;if(n.drawImage(e,0,0,a,i),r=n.getImageData(0,0,a,i).data,void 0!==t){if(void 0!==t.height&&t.height!==i)throw Error("Image input config height doesn't match ImageBitmap height");if(s.height=i,void 0!==t.width&&t.width!==a)throw Error("Image input config width doesn't match ImageBitmap width");s.width=a}else s.height=i,s.width=a;return f.bufferToTensor(r,s)}throw Error("Can not access image data")}else if(o)return new Promise((r,n)=>{let i=document.createElement("canvas"),a=i.getContext("2d");if(!e||!a)return n();let o=new Image;o.crossOrigin="Anonymous",o.src=e,o.onload=()=>{i.width=o.width,i.height=o.height,a.drawImage(o,0,0,i.width,i.height);let e=a.getImageData(0,0,i.width,i.height);if(void 0!==t){if(void 0!==t.height&&t.height!==i.height)throw Error("Image input config height doesn't match ImageBitmap height");if(s.height=i.height,void 0!==t.width&&t.width!==i.width)throw Error("Image input config width doesn't match ImageBitmap width");s.width=i.width}else s.height=i.height,s.width=i.width;r(f.bufferToTensor(e.data,s))}});else throw Error("Input data provided is not supported - aborted tensor creation");if(void 0!==r)return f.bufferToTensor(r,s);throw Error("Input data provided is not supported - aborted tensor creation")}toImageData(e){var t,r;let n,i=document.createElement("canvas").getContext("2d");if(null!=i){let a=this.dims[3],o=this.dims[2],s=this.dims[1],l=void 0!==e&&void 0!==e.format?e.format:"RGB",h=void 0!==e&&(null==(t=e.norm)?void 0:t.mean)!==void 0?e.norm.mean:255,c=void 0!==e&&(null==(r=e.norm)?void 0:r.bias)!==void 0?e.norm.bias:0,u=o*a;if(void 0!==e){if(void 0!==e.height&&e.height!==o)throw Error("Image output config height doesn't match tensor height");if(void 0!==e.width&&e.width!==a)throw Error("Image output config width doesn't match tensor width");if(void 0!==e.format&&4===s&&"RGBA"!==e.format||3===s&&"RGB"!==e.format&&"BGR"!==e.format)throw Error("Tensor format doesn't match input tensor dims")}let d=0,f=1,p=2,m=3,g=0,_=u,w=2*u,y=-1;"RGBA"===l?(g=0,_=u,w=2*u,y=3*u):"RGB"===l?(g=0,_=u,w=2*u):"RBG"===l&&(g=0,w=u,_=2*u),n=i.createImageData(a,o);for(let e=0;e<o*a;d+=4,f+=4,p+=4,m+=4,e++)n.data[d]=(this.data[g++]-c)*h,n.data[f]=(this.data[_++]-c)*h,n.data[p]=(this.data[w++]-c)*h,n.data[m]=-1===y?255:(this.data[y++]-c)*h}else throw Error("Can not access image data");return n}reshape(e){return new f(this.type,this.data,e)}}let p=f;class m{constructor(e){this.handler=e}async run(e,t,r){let n={},i={};if("object"!=typeof e||null===e||e instanceof p||Array.isArray(e))throw TypeError("'feeds' must be an object that use input names as keys and OnnxValue as corresponding values.");let a=!0;if("object"==typeof t){if(null===t)throw TypeError("Unexpected argument[1]: cannot be null.");if(t instanceof p)throw TypeError("'fetches' cannot be a Tensor");if(Array.isArray(t)){if(0===t.length)throw TypeError("'fetches' cannot be an empty array.");for(let e of(a=!1,t)){if("string"!=typeof e)throw TypeError("'fetches' must be a string array or an object.");if(-1===this.outputNames.indexOf(e))throw RangeError(`'fetches' contains invalid output name: ${e}.`);n[e]=null}if("object"==typeof r&&null!==r)i=r;else if(void 0!==r)throw TypeError("'options' must be an object.")}else{let e=!1,o=Object.getOwnPropertyNames(t);for(let r of this.outputNames)if(-1!==o.indexOf(r)){let i=t[r];(null===i||i instanceof p)&&(e=!0,a=!1,n[r]=i)}if(e){if("object"==typeof r&&null!==r)i=r;else if(void 0!==r)throw TypeError("'options' must be an object.")}else i=t}}else if(void 0!==t)throw TypeError("Unexpected argument[1]: must be 'fetches' or 'options'.");for(let t of this.inputNames)if(void 0===e[t])throw Error(`input '${t}' is missing in 'feeds'.`);if(a)for(let e of this.outputNames)n[e]=null;let o=await this.handler.run(e,n,i),s={};for(let e in o)Object.hasOwnProperty.call(o,e)&&(s[e]=new p(o[e].type,o[e].data,o[e].dims));return s}static async create(e,t,r,n){let i,a={};if("string"==typeof e){if(i=e,"object"==typeof t&&null!==t)a=t;else if(void 0!==t)throw TypeError("'options' must be an object.")}else if(e instanceof Uint8Array){if(i=e,"object"==typeof t&&null!==t)a=t;else if(void 0!==t)throw TypeError("'options' must be an object.")}else if(e instanceof ArrayBuffer||"undefined"!=typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer){let o=0,s=e.byteLength;if("object"==typeof t&&null!==t)a=t;else if("number"==typeof t){if(!Number.isSafeInteger(o=t))throw RangeError("'byteOffset' must be an integer.");if(o<0||o>=e.byteLength)throw RangeError(`'byteOffset' is out of range [0, ${e.byteLength}).`);if(s=e.byteLength-o,"number"==typeof r){if(!Number.isSafeInteger(s=r))throw RangeError("'byteLength' must be an integer.");if(s<=0||o+s>e.byteLength)throw RangeError(`'byteLength' is out of range (0, ${e.byteLength-o}].`);if("object"==typeof n&&null!==n)a=n;else if(void 0!==n)throw TypeError("'options' must be an object.")}else if(void 0!==r)throw TypeError("'byteLength' must be a number.")}else if(void 0!==t)throw TypeError("'options' must be an object.");i=new Uint8Array(e,o,s)}else throw TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");let s=(a.executionProviders||[]).map(e=>"string"==typeof e?e:e.name),l=await o(s);return new m(await l.createSessionHandler(i,a))}startProfiling(){this.handler.startProfiling()}endProfiling(){this.handler.endProfiling()}get inputNames(){return this.handler.inputNames}
1get outputNames(){return this.handler.outputNames}}let g=m},13655:(e,t,r)=>{"use strict";let n;r.d(t,{M:()=>n,t:()=>h});var i,a,o=r(83052),s=r(15434),l=r(95704);let h=["wasm"];void 0!==l&&l?.release?.name==="node"?(n=o??(i||(i=r.t(o,2))),h.unshift("cpu")):(n=s??(a||(a=r.t(s,2))),"undefined"!=typeof navigator&&/iP(hone|od|ad).+16_4.+AppleWebKit/.test(navigator.userAgent)&&(n.env.wasm.simd=!1))},30519:(e,t,r)=>{"use strict";function n(e,[t,r,i],[a,o],s="bilinear",l=!1){let h=o/i,c=a/r,u=new e.constructor(a*o*t),d=r*i,f=a*o;for(let n=0;n<a;++n)for(let a=0;a<o;++a){let s=n*o+a,l=(a+.5)/h-.5,p=(n+.5)/c-.5,m=Math.floor(l),g=Math.floor(p),_=Math.min(m+1,i-1),w=Math.min(g+1,r-1),y=l-(m=Math.max(m,0)),b=p-(g=Math.max(g,0)),v=(1-y)*(1-b),M=y*(1-b),x=(1-y)*b,k=y*b,E=g*i,T=w*i,C=E+m,A=E+_,F=T+m,S=T+_;for(let r=0;r<t;++r){let t=r*d;u[r*f+s]=v*e[t+C]+M*e[t+A]+x*e[t+F]+k*e[t+S]}}return u}function i(e,t,r){let n=Array(r.length),i=Array(r.length);for(let e=r.length-1,a=1;e>=0;--e)i[e]=a,n[e]=t[r[e]],a*=n[e];let a=r.map((e,t)=>i[r.indexOf(t)]),o=new e.constructor(e.length);for(let r=0;r<e.length;++r){let n=0;for(let e=t.length-1,i=r;e>=0;--e)n+=i%t[e]*a[e],i=Math.floor(i/t[e]);o[n]=e[r]}return[o,n]}function a(e){let t=d(e)[0],r=e.map(e=>Math.exp(e-t)),n=r.reduce((e,t)=>e+t,0);return r.map(e=>e/n)}function o(e){return a(e).map(e=>Math.log(e))}function s(e,t){let r=0;for(let n=0;n<e.length;++n)r+=e[n]*t[n];return r}function l(e,t=0){return e=Array.from(e).map((e,t)=>[t,e]).sort((e,t)=>t[1]-e[1]),null!==t&&t>0&&(e=e.slice(0,t)),e}function h(e,t){let r=s(e,t),n=c(e);return r/(n*c(t))}function c(e){return Math.sqrt(e.reduce((e,t)=>e+t*t,0))}function u(e){if(0===e.length)throw Error("Array must not be empty");let t=e[0],r=0;for(let n=1;n<e.length;++n)e[n]<t&&(t=e[n],r=n);return[t,r]}function d(e){if(0===e.length)throw Error("Array must not be empty");let t=e[0],r=0;for(let n=1;n<e.length;++n)e[n]>t&&(t=e[n],r=n);return[Number(t),r]}function f(e){return e>0&&(e&e-1)==0}r.d(t,{CM:()=>o,Em:()=>l,LI:()=>w,Om:()=>s,SX:()=>i,T9:()=>d,VO:()=>c,Vs:()=>a,gE:()=>y,gJ:()=>h,jV:()=>_,jk:()=>u,rG:()=>g,vd:()=>n});class p{constructor(e){if(this.size=0|e,this.size<=1||!f(this.size))throw Error("FFT size must be a power of two larger than 1");this._csize=e<<1,this.table=new Float64Array(2*this.size);for(let e=0;e<this.table.length;e+=2){let t=Math.PI*e/this.size;this.table[e]=Math.cos(t),this.table[e+1]=-Math.sin(t)}let t=0;for(let e=1;this.size>e;e<<=1)++t;this._width=t%2==0?t-1:t,this._bitrev=new Int32Array(1<<this._width);for(let e=0;e<this._bitrev.length;++e){this._bitrev[e]=0;for(let t=0;t<this._width;t+=2){let r=this._width-t-2;this._bitrev[e]|=(e>>>t&3)<<r}}}createComplexArray(){return new Float64Array(this._csize)}fromComplexArray(e,t){let r=t||Array(e.length>>>1);for(let t=0;t<e.length;t+=2)r[t>>>1]=e[t];return r}toComplexArray(e,t){let r=t||this.createComplexArray();for(let t=0;t<r.length;t+=2)r[t]=e[t>>>1],r[t+1]=0;return r}transform(e,t){if(e===t)throw Error("Input and output buffers must be different");this._transform4(e,t,1)}realTransform(e,t){if(e===t)throw Error("Input and output buffers must be different");this._realTransform4(e,t,1)}inverseTransform(e,t){if(e===t)throw Error("Input and output buffers must be different");this._transform4(e,t,-1);for(let t=0;t<e.length;++t)e[t]/=this.size}_transform4(e,t,r){let n,i,a=this._csize,o=1<<this._width,s=a/o<<1,l=this._bitrev;if(4===s)for(n=0,i=0;n<a;n+=s,++i){let r=l[i];this._singleTransform2(t,e,n,r,o)}else for(n=0,i=0;n<a;n+=s,++i){let a=l[i];this._singleTransform4(t,e,n,a,o,r)}let h=this.table;for(o>>=2;o>=2;o>>=2){let t=(s=a/o<<1)>>>2;for(n=0;n<a;n+=s){let i=n+t-1;for(let a=n,s=0;a<i;a+=2,s+=o){let n=a,i=n+t,o=i+t,l=o+t,c=e[n],u=e[n+1],d=e[i],f=e[i+1],p=e[o],m=e[o+1],g=e[l],_=e[l+1],w=h[s],y=r*h[s+1],b=d*w-f*y,v=d*y+f*w,M=h[2*s],x=r*h[2*s+1],k=p*M-m*x,E=p*x+m*M,T=h[3*s],C=r*h[3*s+1],A=g*T-_*C,F=g*C+_*T,S=c+k,z=u+E,P=c-k,I=u-E,B=b+A,O=v+F,L=r*(b-A),$=r*(v-F);e[n]=S+B,e[n+1]=z+O,e[i]=P+$,e[i+1]=I-L,e[o]=S-B,e[o+1]=z-O,e[l]=P-$,e[l+1]=I+L}}}}_singleTransform2(e,t,r,n,i){let a=e[n],o=e[n+1],s=e[n+i],l=e[n+i+1];t[r]=a+s,t[r+1]=o+l,t[r+2]=a-s,t[r+3]=o-l}_singleTransform4(e,t,r,n,i,a){let o=2*i,s=3*i,l=e[n],h=e[n+1],c=e[n+i],u=e[n+i+1],d=e[n+o],f=e[n+o+1],p=e[n+s],m=e[n+s+1],g=l+d,_=h+f,w=l-d,y=h-f,b=c+p,v=u+m,M=a*(c-p),x=a*(u-m);t[r]=g+b,t[r+1]=_+v,t[r+2]=w+x,t[r+3]=y-M,t[r+4]=g-b,t[r+5]=_-v,t[r+6]=w-x,t[r+7]=y+M}_realTransform4(e,t,r){let n,i,a=this._csize,o=1<<this._width,s=a/o<<1,l=this._bitrev;if(4===s)for(n=0,i=0;n<a;n+=s,++i){let r=l[i];this._singleRealTransform2(t,e,n,r>>>1,o>>>1)}else for(n=0,i=0;n<a;n+=s,++i){let a=l[i];this._singleRealTransform4(t,e,n,a>>>1,o>>>1,r)}let h=this.table;for(o>>=2;o>=2;o>>=2){let t=(s=a/o<<1)>>>1,i=t>>>1,l=i>>>1;for(n=0;n<a;n+=s)for(let a=0,s=0;a<=l;a+=2,s+=o){let o=n+a,c=o+i,u=c+i,d=u+i,f=e[o],p=e[o+1],m=e[c],g=e[c+1],_=e[u],w=e[u+1],y=e[d],b=e[d+1],v=h[s],M=r*h[s+1],x=m*v-g*M,k=m*M+g*v,E=h[2*s],T=r*h[2*s+1],C=_*E-w*T,A=_*T+w*E,F=h[3*s],S=r*h[3*s+1],z=y*F-b*S,P=y*S+b*F,I=f+C,B=p+A,O=f-C,L=p-A,$=x+z,j=k+P,U=r*(x-z),N=r*(k-P);if(e[o]=I+$,e[o+1]=B+j,e[c]=O+N,e[c+1]=L-U,0===a){e[u]=I-$,e[u+1]=B-j;continue}if(a===l)continue;let R=n+i-a,V=n+t-a;e[R]=O-r*N,e[R+1]=-L-r*U,e[V]=I-r*$,e[V+1]=-B+r*j}}let c=a>>>1;for(let t=2;t<c;t+=2)e[a-t]=e[t],e[a-t+1]=-e[t+1]}_singleRealTransform2(e,t,r,n,i){let a=e[n],o=e[n+i];t[r]=a+o,t[r+1]=0,t[r+2]=a-o,t[r+3]=0}_singleRealTransform4(e,t,r,n,i,a){let o=e[n],s=e[n+i],l=e[n+2*i],h=e[n+3*i],c=o+l,u=o-l,d=s+h,f=a*(s-h);t[r]=c+d,t[r+1]=0,t[r+2]=u,t[r+3]=-f,t[r+4]=c-d,t[r+5]=0,t[r+6]=u,t[r+7]=f}}class m{constructor(e){let t=2*(e-1),r=2*(2*e-1),n=2**Math.ceil(Math.log2(r));this.bufferSize=n,this._a=t;let i=new Float64Array(r),a=new Float64Array(n);this._chirpBuffer=new Float64Array(n),this._buffer1=new Float64Array(n),this._buffer2=new Float64Array(n),this._outBuffer1=new Float64Array(n),this._outBuffer2=new Float64Array(n);let o=-2*Math.PI/e,s=Math.cos(o),l=Math.sin(o);for(let t=0;t<r>>1;++t){let r=(t+1-e)**2/2,n=Math.sqrt(s**2+l**2)**r,o=r*Math.atan2(l,s),h=2*t;i[h]=n*Math.cos(o),i[h+1]=n*Math.sin(o),a[h]=i[h],a[h+1]=-i[h+1]}this._slicedChirpBuffer=i.subarray(t,r),this._f=new p(n>>1),this._f.transform(this._chirpBuffer,a)}_transform(e,t,r){let n=this._buffer1,i=this._buffer2,a=this._outBuffer1,o=this._outBuffer2,s=this._chirpBuffer,l=this._slicedChirpBuffer,h=this._a;if(r)for(let e=0;e<l.length;e+=2){let r=e+1,i=t[e>>1];n[e]=i*l[e],n[r]=i*l[r]}else for(let e=0;e<l.length;e+=2){let r=e+1;n[e]=t[e]*l[e]-t[r]*l[r],n[r]=t[e]*l[r]+t[r]*l[e]}this._f.transform(a,n);for(let e=0;e<s.length;e+=2){let t=e+1;i[e]=a[e]*s[e]-a[t]*s[t],i[t]=a[e]*s[t]+a[t]*s[e]}this._f.inverseTransform(o,i);for(let t=0;t<o.length;t+=2){let r=o[t+h],n=o[t+h+1],i=l[t],a=l[t+1];e[t]=r*i-n*a,e[t+1]=r*a+n*i}}transform(e,t){this._transform(e,t,!1)}realTransform(e,t){this._transform(e,t,!0)}}class g{constructor(e){this.fft_length=e,this.isPowerOfTwo=f(e),this.isPowerOfTwo?(this.fft=new p(e),this.outputBufferSize=2*e):(this.fft=new m(e),this.outputBufferSize=this.fft.bufferSize)}realTransform(e,t){this.fft.realTransform(e,t)}transform(e,t){this.fft.transform(e,t)}}function _(e,t){if(t%2==0||t<=0)throw Error("Window size must be a positive odd number");let r=new e.constructor(e.length),n=new e.constructor(t),i=Math.floor(t/2);for(let t=0;t<e.length;++t){let a=0;for(let r=-i;r<=i;++r){let i=t+r;i<0?i=Math.abs(i):i>=e.length&&(i=2*(e.length-1)-i),n[a++]=e[i]}n.sort(),r[t]=n[i]}return r}function w(e,t){let r=Math.pow(10,t);return Math.round(e*r)/r}function y(e){let t=Math.round(e);return Math.abs(e)%1==.5?t%2==0?t:t-1:t}},39539:(e,t,r)=>{"use strict";r.d(t,{Bj:()=>X});var n=Object.freeze({Text:"Text",NumericLiteral:"NumericLiteral",BooleanLiteral:"BooleanLiteral",StringLiteral
1:"StringLiteral",Identifier:"Identifier",Equals:"Equals",OpenParen:"OpenParen",CloseParen:"CloseParen",OpenStatement:"OpenStatement",CloseStatement:"CloseStatement",OpenExpression:"OpenExpression",CloseExpression:"CloseExpression",OpenSquareBracket:"OpenSquareBracket",CloseSquareBracket:"CloseSquareBracket",OpenCurlyBracket:"OpenCurlyBracket",CloseCurlyBracket:"CloseCurlyBracket",Comma:"Comma",Dot:"Dot",Colon:"Colon",Pipe:"Pipe",CallOperator:"CallOperator",AdditiveBinaryOperator:"AdditiveBinaryOperator",MultiplicativeBinaryOperator:"MultiplicativeBinaryOperator",ComparisonBinaryOperator:"ComparisonBinaryOperator",UnaryOperator:"UnaryOperator",Set:"Set",If:"If",For:"For",In:"In",Is:"Is",NotIn:"NotIn",Else:"Else",EndIf:"EndIf",ElseIf:"ElseIf",EndFor:"EndFor",And:"And",Or:"Or",Not:"UnaryOperator"}),i=Object.freeze({set:n.Set,for:n.For,in:n.In,is:n.Is,if:n.If,else:n.Else,endif:n.EndIf,elif:n.ElseIf,endfor:n.EndFor,and:n.And,or:n.Or,not:n.Not,"not in":n.NotIn,true:n.BooleanLiteral,false:n.BooleanLiteral}),a=class{constructor(e,t){this.value=e,this.type=t}};function o(e){return/\w/.test(e)}function s(e){return/[0-9]/.test(e)}var l=[["{%",n.OpenStatement],["%}",n.CloseStatement],["{{",n.OpenExpression],["}}",n.CloseExpression],["(",n.OpenParen],[")",n.CloseParen],["{",n.OpenCurlyBracket],["}",n.CloseCurlyBracket],["[",n.OpenSquareBracket],["]",n.CloseSquareBracket],[",",n.Comma],[".",n.Dot],[":",n.Colon],["|",n.Pipe],["<=",n.ComparisonBinaryOperator],[">=",n.ComparisonBinaryOperator],["==",n.ComparisonBinaryOperator],["!=",n.ComparisonBinaryOperator],["<",n.ComparisonBinaryOperator],[">",n.ComparisonBinaryOperator],["+",n.AdditiveBinaryOperator],["-",n.AdditiveBinaryOperator],["*",n.MultiplicativeBinaryOperator],["/",n.MultiplicativeBinaryOperator],["%",n.MultiplicativeBinaryOperator],["=",n.Equals]],h=new Map([["n","\n"],["t","	"],["r","\r"],["b","\b"],["f","\f"],["v","\v"],["'","'"],['"','"'],["\\","\\"]]),c=class{type="Statement"},u=class extends c{constructor(e){super(),this.body=e}type="Program"},d=class extends c{constructor(e,t,r){super(),this.test=e,this.body=t,this.alternate=r}type="If"},f=class extends c{constructor(e,t,r){super(),this.loopvar=e,this.iterable=t,this.body=r}type="For"},p=class extends c{constructor(e,t){super(),this.assignee=e,this.value=t}type="Set"},m=class extends c{type="Expression"},g=class extends m{constructor(e,t,r){super(),this.object=e,this.property=t,this.computed=r}type="MemberExpression"},_=class extends m{constructor(e,t){super(),this.callee=e,this.args=t}type="CallExpression"},w=class extends m{constructor(e){super(),this.value=e}type="Identifier"},y=class extends m{constructor(e){super(),this.value=e}type="Literal"},b=class extends y{type="NumericLiteral"},v=class extends y{type="StringLiteral"},M=class extends y{type="BooleanLiteral"},x=class extends y{type="ArrayLiteral"},k=class extends y{type="TupleLiteral"},E=class extends y{type="ObjectLiteral"},T=class extends m{constructor(e,t,r){super(),this.operator=e,this.left=t,this.right=r}type="BinaryExpression"},C=class extends m{constructor(e,t){super(),this.operand=e,this.filter=t}type="FilterExpression"},A=class extends m{constructor(e,t,r){super(),this.operand=e,this.negate=t,this.test=r}type="TestExpression"},F=class extends m{constructor(e,t){super(),this.operator=e,this.argument=t}type="UnaryExpression"},S=class extends m{constructor(e,t,r){super(),this.start=e,this.stop=t,this.step=r}type="SliceExpression"},z=class extends m{constructor(e,t){super(),this.key=e,this.value=t}type="KeywordArgumentExpression"};function P(e,t,r=1){void 0===t&&(t=e,e=0);let n=[];for(let i=e;i<t;i+=r)n.push(i);return n}function I(e,t,r,n=1){let i=Math.sign(n);i>=0?(t=(t??=0)<0?Math.max(e.length+t,0):Math.min(t,e.length),r=(r??=e.length)<0?Math.max(e.length+r,0):Math.min(r,e.length)):(t=(t??=e.length-1)<0?Math.max(e.length+t,-1):Math.min(t,e.length-1),r=(r??=-1)<-1?Math.max(e.length+r,-1):Math.min(r,e.length-1));let a=[];for(let o=t;i*o<i*r;o+=n)a.push(e[o]);return a}function B(e){return e.replace(/\b\w/g,e=>e.toUpperCase())}var O=class{type="RuntimeValue";value;builtins=new Map;constructor(e){this.value=e}__bool__(){return new j(!!this.value)}},L=class extends O{type="NumericValue"},$=class extends O{type="StringValue";builtins=new Map([["upper",new V(()=>new $(this.value.toUpperCase()))],["lower",new V(()=>new $(this.value.toLowerCase()))],["strip",new V(()=>new $(this.value.trim()))],["title",new V(()=>new $(B(this.value)))],["length",new L(this.value.length)]])},j=class extends O{type="BooleanValue"},U=class extends O{type="ObjectValue";__bool__(){return new j(this.value.size>0)}builtins=new Map([["get",new V(([e,t])=>
1{if(!(e instanceof $))throw Error(`Object key must be a string: got ${e.type}`);return this.value.get(e.value)??t??new q})],["items",new V(()=>new N(Array.from(this.value.entries()).map(([e,t])=>new N([new $(e),t]))))]])},N=class extends O{type="ArrayValue";builtins=new Map([["length",new L(this.value.length)]]);__bool__(){return new j(this.value.length>0)}},R=class extends N{type="TupleValue"},V=class extends O{type="FunctionValue"},q=class extends O{type="NullValue"},D=class extends O{type="UndefinedValue"},G=class{constructor(e){this.parent=e}variables=new Map([["namespace",new V(e=>{if(0===e.length)return new U(new Map);if(1!==e.length||!(e[0]instanceof U))throw Error("`namespace` expects either zero arguments or a single object argument");return e[0]})]]);tests=new Map([["boolean",e=>"BooleanValue"===e.type],["callable",e=>e instanceof V],["odd",e=>{if("NumericValue"!==e.type)throw Error(`Cannot apply test "odd" to type: ${e.type}`);return e.value%2!=0}],["even",e=>{if("NumericValue"!==e.type)throw Error(`Cannot apply test "even" to type: ${e.type}`);return e.value%2==0}],["false",e=>"BooleanValue"===e.type&&!e.value],["true",e=>"BooleanValue"===e.type&&e.value],["number",e=>"NumericValue"===e.type],["integer",e=>"NumericValue"===e.type&&Number.isInteger(e.value)],["iterable",e=>e instanceof N||e instanceof $],["lower",e=>{let t=e.value;return"StringValue"===e.type&&t===t.toLowerCase()}],["upper",e=>{let t=e.value;return"StringValue"===e.type&&t===t.toUpperCase()}],["none",e=>"NullValue"===e.type],["defined",e=>"UndefinedValue"!==e.type],["undefined",e=>"UndefinedValue"===e.type],["equalto",(e,t)=>e.value===t.value]]);set(e,t){return this.declareVariable(e,function e(t){switch(typeof t){case"number":return new L(t);case"string":return new $(t);case"boolean":return new j(t);case"object":if(null===t)return new q;if(Array.isArray(t))return new N(t.map(e));return new U(new Map(Object.entries(t).map(([t,r])=>[t,e(r)])));case"function":return new V((r,n)=>e(t(...r.map(e=>e.value))??null));default:throw Error(`Cannot convert to runtime value: ${t}`)}}(t))}declareVariable(e,t){if(this.variables.has(e))throw SyntaxError(`Variable already declared: ${e}`);return this.variables.set(e,t),t}setVariable(e,t){return this.variables.set(e,t),t}resolve(e){if(this.variables.has(e))return this;if(this.parent)return this.parent.resolve(e);throw Error(`Unknown variable: ${e}`)}lookupVariable(e){try{return this.resolve(e).variables.get(e)??new D}catch{return new D}}},W=class{global;constructor(e){this.global=e??new G}run(e){return this.evaluate(e,this.global)}evaluateBinaryExpression(e,t){let r=this.evaluate(e.left,t);switch(e.operator.value){case"and":return r.__bool__().value?this.evaluate(e.right,t):r;case"or":return r.__bool__().value?r:this.evaluate(e.right,t)}let n=this.evaluate(e.right,t);switch(e.operator.value){case"==":return new j(r.value==n.value);case"!=":return new j(r.value!=n.value)}if(r instanceof D||n instanceof D)throw Error("Cannot perform operation on undefined values");if(r instanceof q||n instanceof q)throw Error("Cannot perform operation on null values");if(r instanceof L&&n instanceof L)switch(e.operator.value){case"+":return new L(r.value+n.value);case"-":return new L(r.value-n.value);case"*":return new L(r.value*n.value);case"/":return new L(r.value/n.value);case"%":return new L(r.value%n.value);case"<":return new j(r.value<n.value);case">":return new j(r.value>n.value);case">=":return new j(r.value>=n.value);case"<=":return new j(r.value<=n.value)}else if(r instanceof N&&n instanceof N){if("+"===e.operator.value)return new N(r.value.concat(n.value))}else if(n instanceof N){let t=void 0!==n.value.find(e=>e.value===r.value);switch(e.operator.value){case"in":return new j(t);case"not in":return new j(!t)}}if((r instanceof $||n instanceof $)&&"+"===e.operator.value)return new $(r.value.toString()+n.value.toString());if(r instanceof $&&n instanceof $)switch(e.operator.value){case"in":return new j(n.value.includes(r.value));case"not in":return new j(!n.value.includes(r.value))}if(r instanceof $&&n instanceof U)switch(e.operator.value){case"in":return new j(n.value.has(r.value));case"not in":return new j(!n.value.has(r.value))}throw SyntaxError(`Unknown operator "${e.operator.value}" between ${r.type} and ${n.type}`)}evaluateFilterExpression(e,t){let r=this.evaluate(e.operand,t);
1if("Identifier"===e.filter.type){let t=e.filter;if(r instanceof N)switch(t.value){case"list":return r;case"first":return r.value[0];case"last":return r.value[r.value.length-1];case"length":return new L(r.value.length);case"reverse":return new N(r.value.reverse());case"sort":return new N(r.value.sort((e,t)=>{if(e.type!==t.type)throw Error(`Cannot compare different types: ${e.type} and ${t.type}`);switch(e.type){case"NumericValue":return e.value-t.value;case"StringValue":return e.value.localeCompare(t.value);default:throw Error(`Cannot compare type: ${e.type}`)}}));default:throw Error(`Unknown ArrayValue filter: ${t.value}`)}if(r instanceof $)switch(t.value){case"length":return new L(r.value.length);case"upper":return new $(r.value.toUpperCase());case"lower":return new $(r.value.toLowerCase());case"title":return new $(B(r.value));case"capitalize":return new $(r.value.charAt(0).toUpperCase()+r.value.slice(1));case"trim":return new $(r.value.trim());default:throw Error(`Unknown StringValue filter: ${t.value}`)}if(r instanceof L)if("abs"===t.value)return new L(Math.abs(r.value));else throw Error(`Unknown NumericValue filter: ${t.value}`);else if(r instanceof U)switch(t.value){case"items":return new N(Array.from(r.value.entries()).map(([e,t])=>new N([new $(e),t])));case"length":return new L(r.value.size);default:throw Error(`Unknown ObjectValue filter: ${t.value}`)}throw Error(`Cannot apply filter "${t.value}" to type: ${r.type}`)}if("CallExpression"===e.filter.type){let n=e.filter;if("Identifier"!==n.callee.type)throw Error(`Unknown filter: ${n.callee.type}`);let i=n.callee.value;if(r instanceof N){if("selectattr"===i){let e;if(r.value.some(e=>!(e instanceof U)))throw Error("`selectattr` can only be applied to array of objects");if(n.args.some(e=>"StringLiteral"!==e.type))throw Error("arguments of `selectattr` must be strings");let[i,a,o]=n.args.map(e=>this.evaluate(e,t));if(a){let r=t.tests.get(a.value);if(!r)throw Error(`Unknown test: ${a.value}`);e=r}else e=(...e)=>e[0].__bool__().value;return new N(r.value.filter(t=>{let r=t.value.get(i.value);return!!r&&e(r,o)}))}throw Error(`Unknown ArrayValue filter: ${i}`)}throw Error(`Cannot apply filter "${i}" to type: ${r.type}`)}throw Error(`Unknown filter: ${e.filter.type}`)}evaluateTestExpression(e,t){let r=this.evaluate(e.operand,t),n=t.tests.get(e.test.value);if(!n)throw Error(`Unknown test: ${e.test.value}`);let i=n(r);return new j(e.negate?!i:i)}evaluateUnaryExpression(e,t){let r=this.evaluate(e.argument,t);if("not"===e.operator.value)return new j(!r.value);throw SyntaxError(`Unknown operator: ${e.operator.value}`)}evalProgram(e,t){return this.evaluateBlock(e.body,t)}evaluateBlock(e,t){let r="";for(let n of e){let e=this.evaluate(n,t);"NullValue"!==e.type&&"UndefinedValue"!==e.type&&(r+=e.value)}return new $(r)}evaluateIdentifier(e,t){return t.lookupVariable(e.value)}evaluateCallExpression(e,t){let r=[],n=new Map;for(let i of e.args)"KeywordArgumentExpression"===i.type?n.set(i.key.value,this.evaluate(i.value,t)):r.push(this.evaluate(i,t));n.size>0&&r.push(new U(n));let i=this.evaluate(e.callee,t);if("FunctionValue"!==i.type)throw Error(`Cannot call something that is not a function: got ${i.type}`);return i.value(r,t)}evaluateSliceExpression(e,t,r){if(!(e instanceof N||e instanceof $))throw Error("Slice object must be an array or string");let n=this.evaluate(t.start,r),i=this.evaluate(t.stop,r),a=this.evaluate(t.step,r);if(!(n instanceof L||n instanceof D))throw Error("Slice start must be numeric or undefined");if(!(i instanceof L||i instanceof D))throw Error("Slice stop must be numeric or undefined");if(!(a instanceof L||a instanceof D))throw Error("Slice step must be numeric or undefined");return e instanceof N?new N(I(e.value,n.value,i.value,a.value)):new $(I(Array.from(e.value),n.value,i.value,a.value).join(""))}evaluateMemberExpression(e,t){let r,n,i=this.evaluate(e.object,t);if(e.computed)if("SliceExpression"===e.property.type)return this.evaluateSliceExpression(i,e.property,t);else r=this.evaluate(e.property,t);else r=new $(e.property.value);if(i instanceof U){if(!(r instanceof $))throw Error(`Cannot access property with non-string: got ${r.type}`);
1n=i.value.get(r.value)??i.builtins.get(r.value)}else if(i instanceof N||i instanceof $)if(r instanceof L)n=i.value.at(r.value),i instanceof $&&(n=new $(i.value.at(r.value)));else if(r instanceof $)n=i.builtins.get(r.value);else throw Error(`Cannot access property with non-string/non-number: got ${r.type}`);else{if(!(r instanceof $))throw Error(`Cannot access property with non-string: got ${r.type}`);n=i.builtins.get(r.value)}return n instanceof O?n:new D}evaluateSet(e,t){let r=this.evaluate(e.value,t);if("Identifier"===e.assignee.type){let n=e.assignee.value;t.setVariable(n,r)}else if("MemberExpression"===e.assignee.type){let n=e.assignee,i=this.evaluate(n.object,t);if(!(i instanceof U))throw Error("Cannot assign to member of non-object");if("Identifier"!==n.property.type)throw Error("Cannot assign to member with non-identifier property");i.value.set(n.property.value,r)}else throw Error(`Invalid LHS inside assignment expression: ${JSON.stringify(e.assignee)}`);return new q}evaluateIf(e,t){let r=this.evaluate(e.test,t);return this.evaluateBlock(r.__bool__().value?e.body:e.alternate,t)}evaluateFor(e,t){let r=new G(t),n=this.evaluate(e.iterable,r);if(!(n instanceof N))throw Error(`Expected iterable type in for loop: got ${n.type}`);let i="";for(let t=0;t<n.value.length;++t){let a=new Map([["index",new L(t+1)],["index0",new L(t)],["revindex",new L(n.value.length-t)],["revindex0",new L(n.value.length-t-1)],["first",new j(0===t)],["last",new j(t===n.value.length-1)],["length",new L(n.value.length)],["previtem",t>0?n.value[t-1]:new D],["nextitem",t<n.value.length-1?n.value[t+1]:new D]]);r.setVariable("loop",new U(a));let o=n.value[t];if("Identifier"===e.loopvar.type)r.setVariable(e.loopvar.value,o);else if("TupleLiteral"===e.loopvar.type){let t=e.loopvar;if("ArrayValue"!==o.type)throw Error(`Cannot unpack non-iterable type: ${o.type}`);if(t.value.length!==o.value.length)throw Error(`Too ${t.value.length>o.value.length?"few":"many"} items to unpack`);for(let e=0;e<t.value.length;++e){if("Identifier"!==t.value[e].type)throw Error(`Cannot unpack non-identifier type: ${t.value[e].type}`);r.setVariable(t.value[e].value,o.value[e])}}i+=this.evaluateBlock(e.body,r).value}return new $(i)}evaluate(e,t){if(void 0===e)return new D;switch(e.type){case"Program":return this.evalProgram(e,t);case"Set":return this.evaluateSet(e,t);case"If":return this.evaluateIf(e,t);case"For":return this.evaluateFor(e,t);case"NumericLiteral":return new L(Number(e.value));case"StringLiteral":return new $(e.value);case"BooleanLiteral":return new j(e.value);case"ArrayLiteral":return new N(e.value.map(e=>this.evaluate(e,t)));case"TupleLiteral":return new R(e.value.map(e=>this.evaluate(e,t)));case"ObjectLiteral":{let r=new Map;for(let[n,i]of e.value){let e=this.evaluate(n,t);if(!(e instanceof $))throw Error(`Object keys must be strings: got ${e.type}`);r.set(e.value,this.evaluate(i,t))}return new U(r)}case"Identifier":return this.evaluateIdentifier(e,t);case"CallExpression":return this.evaluateCallExpression(e,t);case"MemberExpression":return this.evaluateMemberExpression(e,t);case"UnaryExpression":return this.evaluateUnaryExpression(e,t);case"BinaryExpression":return this.evaluateBinaryExpression(e,t);case"FilterExpression":return this.evaluateFilterExpression(e,t);case"TestExpression":return this.evaluateTestExpression(e,t);default:throw SyntaxError(`Unknown node type: ${e.type}`)}}},X=class{parsed;constructor(e){let t=function(e,t={}){let r=[],c=function(e,t={}){return e.endsWith("\n")&&(e=e.slice(0,-1)),e=e.replace(/{#.*?#}/gs,"{##}"),t.lstrip_blocks&&(e=e.replace(/^[ \t]*({[#%])/gm,"$1")),t.trim_blocks&&(e=e.replace(/([#%]})\n/g,"$1")),e.replace(/{##}/g,"").replace(/-%}\s*/g,"%}").replace(/\s*{%-/g,"{%").replace(/-}}\s*/g,"}}").replace(/\s*{{-/g,"{{")}(e,t),u=0,d=e=>{let t="";for(;e(c[u]);){if("\\"===c[u]){if(++u>=c.length)throw SyntaxError("Unexpected end of input");let e=c[u++],r=h.get(e);if(void 0===r)throw SyntaxError(`Unexpected escaped character: ${e}`);t+=r;continue}if(t+=c[u++],u>=c.length)throw SyntaxError("Unexpected end of input")}return t};e:for(;u<c.length;){let e=r.at(-1)?.type;if(void 0===e||e===n.CloseStatement||e===n.CloseExpression){let e="";for(;u<c.length&&("{"!==c[u]||"%"!==c[u+1]&&"{"!==c[u+1]);)e+=c[u++];if(e.length>0){r.push(new a(e,n.Text));continue}}d(e=>/\s/.test(e));let t=c[u];if("-"===t||"+"===t){let e=r.at(-1)?.type;if(e===n.Text||void 0===e)throw SyntaxError(`Unexpected character: ${t}`);switch(e){case n.Identifier:case n.NumericLiteral:case n.BooleanLiteral:case n.StringLiteral
1:case n.CloseParen:case n.CloseSquareBracket:break;default:{++u;let e=d(s);r.push(new a(`${t}${e}`,e.length>0?n.NumericLiteral:n.UnaryOperator));continue}}}for(let[e,t]of l)if(c.slice(u,u+e.length)===e){r.push(new a(e,t)),u+=e.length;continue e}if("'"===t||'"'===t){++u;let e=d(e=>e!==t);r.push(new a(e,n.StringLiteral)),++u;continue}if(s(t)){let e=d(s);r.push(new a(e,n.NumericLiteral));continue}if(o(t)){let e=d(o),t=Object.hasOwn(i,e)?i[e]:n.Identifier;t===n.In&&r.at(-1)?.type===n.Not?(r.pop(),r.push(new a("not in",n.NotIn))):r.push(new a(e,t));continue}throw SyntaxError(`Unexpected character: ${t}`)}return r}(e,{lstrip_blocks:!0,trim_blocks:!0});this.parsed=function(e){let t=new u([]),r=0;function i(t,n){let i=e[r++];if(!i||i.type!==t)throw Error(`Parser Error: ${n}. ${i.type} !== ${t}.`);return i}function a(...t){return r+t.length<=e.length&&t.every((t,n)=>t===e[r+n].type)}function o(e=!1){let t=e?B:s,i=[t()],l=a(n.Comma);for(;l&&(++r,i.push(t()),a(n.Comma)););return l?new k(i):i[0]}function s(){let e=l();if(a(n.If)){++r;let t=l();return i(n.Else,"Expected else token"),new d(t,[e],[l()])}return e}function l(){let t=h();for(;a(n.Or);){let n=e[r];++r,t=new T(n,t,h())}return t}function h(){let t=c();for(;a(n.And);){let n=e[r];++r,t=new T(n,t,c())}return t}function c(){let t;for(;a(n.Not);){let n=e[r];++r,t=new F(n,c())}return t??function(){let t=m();for(;a(n.ComparisonBinaryOperator)||a(n.In)||a(n.NotIn);){let n=e[r];++r,t=new T(n,t,m())}return t}()}function m(){let t=P();for(;a(n.AdditiveBinaryOperator);){let n=e[r];++r,t=new T(n,t,P())}return t}function y(e){let t=new _(e,function(){i(n.OpenParen,"Expected opening parenthesis for arguments list");let e=function(){let e=[];for(;!a(n.CloseParen);){let t=s();if(a(n.Equals)){if(++r,!(t instanceof w))throw SyntaxError("Expected identifier for keyword argument");t=new z(t,s())}e.push(t),a(n.Comma)&&++r}return e}();return i(n.CloseParen,"Expected closing parenthesis for arguments list"),e}());return a(n.OpenParen)&&(t=y(t)),t}function P(){let t=I();for(;a(n.MultiplicativeBinaryOperator);){let n=e[r];++r,t=new T(n,t,I())}return t}function I(){let t=function(){let t=function(){let t=function(){let t=B();for(;a(n.Dot)||a(n.OpenSquareBracket);){let o,l=e[r];++r;let h=l.type!==n.Dot;if(h)o=function(){let e=[],t=!1;for(;!a(n.CloseSquareBracket);)a(n.Colon)?(e.push(void 0),++r,t=!0):(e.push(s()),a(n.Colon)&&(++r,t=!0));if(0===e.length)throw SyntaxError("Expected at least one argument for member/slice expression");if(t){if(e.length>3)throw SyntaxError("Expected 0-3 arguments for slice expression");return new S(...e)}return e[0]}(),i(n.CloseSquareBracket,"Expected closing square bracket");else if("Identifier"!==(o=B()).type)throw SyntaxError("Expected identifier following dot operator");t=new g(t,o,h)}return t}();return a(n.OpenParen)?y(t):t}();for(;a(n.Pipe);){++r;let e=B();if(!(e instanceof w))throw SyntaxError("Expected identifier for the filter");a(n.OpenParen)&&(e=y(e)),t=new C(t,e)}return t}();for(;a(n.Is);){++r;let e=a(n.Not);e&&++r;let i=B();if(i instanceof M&&(i=new w(i.value.toString())),!(i instanceof w))throw SyntaxError("Expected identifier for the test");t=new A(t,e,i)}return t}function B(){let t=e[r];switch(t.type){case n.NumericLiteral:return++r,new b(Number(t.value));case n.StringLiteral:return++r,new v(t.value);case n.BooleanLiteral:return++r,new M("true"===t.value);case n.Identifier:return++r,new w(t.value);case n.OpenParen:{++r;let t=o();if(e[r].type!==n.CloseParen)throw SyntaxError(`Expected closing parenthesis, got ${e[r].type} instead`);return++r,t}case n.OpenSquareBracket:{++r;let e=[];for(;!a(n.CloseSquareBracket);)e.push(s()),a(n.Comma)&&++r;return++r,new x(e)}case n.OpenCurlyBracket:{++r;let e=new Map;for(;!a(n.CloseCurlyBracket);){let t=s();i(n.Colon,"Expected colon between key and value in object literal");let o=s();e.set(t,o),a(n.Comma)&&++r}return++r,new E(e)}default:throw SyntaxError(`Unexpected token: ${t.type}`)}}for(;r<e.length;)t.body.push(function t(){switch(e[r].type){case n.Text:return new v(i(n.Text,"Expected text token").value);case n.OpenStatement:let l;switch(i(n.OpenStatement,"Expected opening statement token"),e[r].type){case n.Set:++r,l=function e(){let t=s();return a(n.Equals)?(++r,new p(t,e())):t}(),i(n.CloseStatement,"Expected closing statement token");break;case n.If:++r,l=function o(){let l=s();i(n.CloseStatement,"Expected closing statement token");let h=[],c=[];for(;e[r]?.type!==n.OpenStatement||e[r+1]?.type!==n.ElseIf&&e[r+1]?.type!==n.Else&&e[r+1]?.type!==n.EndIf;)h.push(t());if(e[r]?.type===n.OpenStatement&&e[r+1]?.type!==n.EndIf)if(++r,a(n.ElseIf))i(n.ElseIf,"Expected elseif token"),c.push(o());else for(i(n.Else,"Expected else token"),i(n.CloseStatement,"Expected closing statement token");e[r]?.type!==n.OpenStatement||e[r+1]?.type!==n.EndIf;)c.push(t());return new d(l,h,c)}(),i(n.OpenStatement,"Expected {% token"),i(n.EndIf,"Expected endif token"),i(n.CloseStatement,"Expected %} token");break;case n.For:++r,l=function(){let a=o(!0);if(!(a instanceof w||a instanceof k))throw SyntaxError(`Expected identifier/tuple for the loop variable, got ${a.type} instead`);i(n.In,"Expected `in` keyword following loop variable");let l=s();i(n.CloseStatement,"Expected closing statement token");let h=[];for(;function(...t){return r+t.length<=e.length&&t.some((t,n)=>t!==e[r+n].type)}(n.OpenStatement,n.EndFor);)h.push(t());return new f(a,l,h)}(),i(n.OpenStatement,"Expected {% token"),i(n.EndFor,"Expected endfor token"),i(n.CloseStatement,"Expected %} token");break;default:throw SyntaxError(`Unknown statement type: ${e[r].type}`)}return l;case n.OpenExpression:i(n.OpenExpression,"Expected opening expression token");let h=s();return i(n.CloseExpression,"Expected closing expression token"),h;default:throw SyntaxError(`Unexpected token type: ${e[r].type}`)}}());return t}(t)}render(e){let t=new G;for(let[r,n]of(t.set("false",!1),t.set("true",!0),t.set("raise_exception",e=>{throw Error(e)}),t.set("range",P),Object.entries(e)))t.set(r,n);return new W(t).run(this.parsed).value}}},41477:(e,t,r)=>{"use strict";r.d(t,{_:()=>g});var n=r(22009),i=r(6837),a=r(92313);let{env:o}=r(13655).M,s="2.17.2",l="undefined"!=typeof self&&"caches"in self,h=!_(n),c=!_(i),u=h&&c,d=u?i.dirname(i.dirname(a.fileURLToPath("file:///app/node_modules/@xenova/transformers/src/env.js"))):"./",f=u?i.join(d,"/.cache/"):null,p="/models/",m=u?i.join(d,p):p;o?.wasm&&(o.wasm.wasmPaths=u?i.join(d,"/dist/"):`https://cdn.jsdelivr.net/npm/@xenova/transformers@${s}/dist/`);let g={backends:{onnx:o,tfjs:{}},__dirname:d,version:s,allowRemoteModels:!0,remoteHost:"https://huggingface.co/",remotePathTemplate:"{model}/resolve/{revision}/",allowLocalModels:!0,localModelPath:m,useFS:h,useBrowserCache:l,useFSCache:h,cacheDir:f,useCustomCache:!1,customCache:null};function _(e){return 0===Object.keys(e).length}},46413:(e,t,r)=>{"use strict";let n,i,a;r.r(t),r.d(t,{ASTFeatureExtractor:()=>ec,ASTForAudioClassification:()=>s.O0k,ASTModel:()=>s.MRG,ASTPreTrainedModel:()=>s.o57,AlbertForMaskedLM:()=>s.iKv,AlbertForQuestionAnswering:()=>s.ELH,AlbertForSequenceClassification:()=>s.Hi6,AlbertModel:()=>s.G2X,AlbertPreTrainedModel:()=>s.crd,AlbertTokenizer:()=>o.UH,AudioClassificationPipeline:()=>eL,AutoConfig:()=>eZ.E,AutoModel:()=>s.rKH,AutoModelForAudioClassification:()=>s.m68,AutoModelForAudioFrameClassification:()=>s.Plw,AutoModelForCTC:()=>s._TZ,AutoModelForCausalLM:()=>s.W6E,AutoModelForDepthEstimation:()=>s.QNG,AutoModelForDocumentQuestionAnswering:()=>s.nuw,AutoModelForImageClassification:()=>s.JP3,AutoModelForImageFeatureExtraction:()=>s.w0O,AutoModelForImageMatting:()=>s.HMe,AutoModelForImageSegmentation:()=>s.vTA,AutoModelForImageToImage:()=>s.FJW,AutoModelForMaskGeneration:()=>s.qCM,AutoModelForMaskedLM:()=>s.wju,AutoModelForObjectDetection:()=>s.Yd3,AutoModelForQuestionAnswering:()=>s.yGT,AutoModelForSemanticSegmentation:()=>s.wrZ,AutoModelForSeq2SeqLM:()=>s.BRf,AutoModelForSequenceClassification:()=>s.jQR,AutoModelForSpeechSeq2Seq:()=>s.MOY,AutoModelForTextToSpectrogram:()=>s.ZIt,AutoModelForTextToWaveform:()=>s.V9g,AutoModelForTokenClassification:()=>s.TUv,AutoModelForVision2Seq:()=>s.db0,AutoModelForXVector:()=>s.$TP,AutoModelForZeroShotObjectDetection:()=>s.gqD,AutoProcessor:()=>ey,AutoTokenizer:()=>o.v6,AutomaticSpeechRecognitionPipeline:()=>ej,BartForConditionalGeneration:()=>s.F05,BartForSequenceClassification:()=>s.MH$,BartModel:()=>s.vqx,BartPretrainedModel:()=>s.hbt,BartTokenizer:()=>o.hb,BaseModelOutput:()=>s.E9I,BeitFeatureExtractor:()=>Z,BeitForImageClassification:()=>s.Dji,BeitModel:()=>s.EKW,BeitPreTrainedModel:()=>s.oaf,BertForMaskedLM:()=>s.bmk,BertForQuestionAnswering:()=>s.VoY,BertForSequenceClassification:()=>s.MRX,BertForTokenClassification:()=>s.o2t,BertModel:()=>s.rSR,BertPreTrainedModel:()=>s.DIv,BertTokenizer:()=>o.Ft,BitImageProcessor:()=>j,BlenderbotForConditionalGeneration:()=>s.tDL,BlenderbotModel:()=>s.JGb,BlenderbotPreTrainedModel:()=>s.Hvf,BlenderbotSmallForConditionalGeneration:()=>s.IrO,BlenderbotSmallModel:()=>s.wZy,BlenderbotSmallPreTrainedModel:()=>s.Sm3,BlenderbotSmallTokenizer:()=>o.eU,BlenderbotTokenizer:()=>o.Zi,BloomForCausalLM:()=>s.P3b,BloomModel:()=>s.$P2,BloomPreTrainedModel:()=>s.dg9,BloomTokenizer:()=>o.jl,CLIPFeatureExtractor:()=>N,CLIPModel:()=>s.yaC,CLIPPreTrainedModel:()=>s.GEu,CLIPSegForImageSegmentation:()=>s.E_G,CLIPSegModel:()=>s.tUF,CLIPSegPreTrainedModel:()=>s.FIB,CLIPTextModelWithProjection:()=>s.CAk,CLIPTokenizer:()=>o.u2,CLIPVisionModelWithProjection:()=>s.N2L,CamembertForMaskedLM:()=>s.S7g,CamembertForQuestionAnswering:()=>
1s.wc1,CamembertForSequenceClassification:()=>s.h0m,CamembertForTokenClassification:()=>s.LdY,CamembertModel:()=>s.Aib,CamembertPreTrainedModel:()=>s.S9m,CamembertTokenizer:()=>o.kO,CausalLMOutput:()=>s.qtL,CausalLMOutputWithPast:()=>s.mp$,ChineseCLIPFeatureExtractor:()=>R,ChineseCLIPModel:()=>s.XWm,ChineseCLIPPreTrainedModel:()=>s.lHM,ClapAudioModelWithProjection:()=>s.PRX,ClapFeatureExtractor:()=>eu,ClapModel:()=>s.qWZ,ClapPreTrainedModel:()=>s.IVZ,ClapTextModelWithProjection:()=>s.oZ3,CodeGenForCausalLM:()=>s.hFk,CodeGenModel:()=>s.riX,CodeGenPreTrainedModel:()=>s.bOZ,CodeGenTokenizer:()=>o.F$,CodeLlamaTokenizer:()=>o.gG,CohereTokenizer:()=>o.qt,ConvBertForMaskedLM:()=>s.z1x,ConvBertForQuestionAnswering:()=>s.Vx0,ConvBertForSequenceClassification:()=>s.y5s,ConvBertForTokenClassification:()=>s.y_I,ConvBertModel:()=>s.FSH,ConvBertPreTrainedModel:()=>s.jJ4,ConvBertTokenizer:()=>o.fR,ConvNextFeatureExtractor:()=>q,ConvNextForImageClassification:()=>s.aN4,ConvNextImageProcessor:()=>D,ConvNextModel:()=>s.lf8,ConvNextPreTrainedModel:()=>s.NJd,ConvNextV2ForImageClassification:()=>s.OBR,ConvNextV2Model:()=>s.nII,ConvNextV2PreTrainedModel:()=>s.$o$,DPTFeatureExtractor:()=>L,DPTForDepthEstimation:()=>s.YHO,DPTImageProcessor:()=>$,DPTModel:()=>s.c$o,DPTPreTrainedModel:()=>s.C2_,DebertaForMaskedLM:()=>s.XfN,DebertaForQuestionAnswering:()=>s.xNh,DebertaForSequenceClassification:()=>s.w4W,DebertaForTokenClassification:()=>s._yz,DebertaModel:()=>s.L3d,DebertaPreTrainedModel:()=>s.Zip,DebertaTokenizer:()=>o.pG,DebertaV2ForMaskedLM:()=>s.Nmr,DebertaV2ForQuestionAnswering:()=>s.lr8,DebertaV2ForSequenceClassification:()=>s.Qs9,DebertaV2ForTokenClassification:()=>s.Ilc,DebertaV2Model:()=>s.pW7,DebertaV2PreTrainedModel:()=>s.vTy,DebertaV2Tokenizer:()=>o.$V,DeiTFeatureExtractor:()=>J,DeiTForImageClassification:()=>s.Bl1,DeiTModel:()=>s.EPI,DeiTPreTrainedModel:()=>s.cXP,DepthAnythingForDepthEstimation:()=>s.Dki,DepthAnythingPreTrainedModel:()=>s.FoX,DepthEstimationPipeline:()=>eH,DetrFeatureExtractor:()=>er,DetrForObjectDetection:()=>s.Fbv,DetrForSegmentation:()=>s.j9c,DetrModel:()=>s.ZM0,DetrObjectDetectionOutput:()=>s.JFO,DetrPreTrainedModel:()=>s.DDe,DetrSegmentationOutput:()=>s.HaQ,Dinov2ForImageClassification:()=>s.LlQ,Dinov2Model:()=>s.IeB,Dinov2PreTrainedModel:()=>s.s8j,DistilBertForMaskedLM:()=>s.YVy,DistilBertForQuestionAnswering:()=>s.uwI,DistilBertForSequenceClassification:()=>s.NDb,DistilBertForTokenClassification:()=>s.xpG,DistilBertModel:()=>s.yuQ,DistilBertPreTrainedModel:()=>s.cpF,DistilBertTokenizer:()=>o.i8,DocumentQuestionAnsweringPipeline:()=>eG,DonutFeatureExtractor:()=>ee,DonutSwinModel:()=>s.pHg,DonutSwinPreTrainedModel:()=>s.fCQ,EfficientNetForImageClassification:()=>s.X6D,EfficientNetImageProcessor:()=>X,EfficientNetModel:()=>s.muz,EfficientNetPreTrainedModel:()=>s.SIh,ElectraForMaskedLM:()=>s.CF0,ElectraForQuestionAnswering:()=>s.gEj,ElectraForSequenceClassification:()=>s.Nyc,ElectraForTokenClassification:()=>s.vh2,ElectraModel:()=>s.SzV,ElectraPreTrainedModel:()=>s.SPn,ElectraTokenizer:()=>o._v,EsmForMaskedLM:()=>s.nDC,EsmForSequenceClassification:()=>s.QGw,EsmForTokenClassification:()=>s.iGD,EsmModel:()=>s.nD1,EsmPreTrainedModel:()=>s.pSU,EsmTokenizer:()=>o.fz,FFT:()=>c.rG,FalconForCausalLM:()=>s.Hff,FalconModel:()=>s.$ph,FalconPreTrainedModel:()=>s.$Ld,FalconTokenizer:()=>o.nJ,FastViTForImageClassification:()=>s.mvc,FastViTModel:()=>s.vgU,FastViTPreTrainedModel:()=>s.Tk_,FeatureExtractionPipeline:()=>eB,FeatureExtractor:()=>I,FillMaskPipeline:()=>eC,GLPNFeatureExtractor:()=>U,GLPNForDepthEstimation:()=>s.j2j,GLPNModel:()=>s.jt4,GLPNPreTrainedModel:()=>s.vdi,GPT2LMHeadModel:()=>s.Cb2,GPT2Model:()=>s.FuQ,GPT2PreTrainedModel:()=>s.PBg,GPT2Tokenizer:()=>o.pK,GPTBigCodeForCausalLM:()=>s.Shx,GPTBigCodeModel:()=>s.SX4,GPTBigCodePreTrainedModel:()=>s.adp,GPTJForCausalLM:()=>s.Xvs,GPTJModel:()=>s.l2J,GPTJPreTrainedModel:()=>s.DbD,GPTNeoForCausalLM:()=>s.j7p,GPTNeoModel:()=>s.XBq,GPTNeoPreTrainedModel:()=>s.tAq,GPTNeoXForCausalLM:()=>s.bFh,GPTNeoXModel:()=>s.PV9,GPTNeoXPreTrainedModel:()=>s.FqW,GPTNeoXTokenizer:()=>o.pw,GemmaTokenizer:()=>o.VB,Grok1Tokenizer:()=>o.GL,HerbertTokenizer:()=>o.Kw,HubertForCTC:()=>s.qQb,HubertForSequenceClassification:()=>s.vnq,HubertModel:()=>s.gqe,HubertPreTrainedModel:()=>s.oO_,ImageClassificationPipeline:()=>eN,ImageFeatureExtractionPipeline:()=>eO,ImageFeatureExtractor:()=>B,ImageMattingOutput:()=>s.Vkl,ImageSegmentationPipeline:()=>eR,ImageToImagePipeline:()=>eX,ImageToTextPipeline:()=>eU,LlamaForCausalLM:()=>s.jWM,LlamaModel:()=>s.X0l,LlamaPreTrainedModel:()=>s.RvM,LlamaTokenizer:()=>o.Hi,LongT5ForConditionalGeneration:()=>s.LqK,LongT5Model:()=>s.Rcj,LongT5PreTrainedModel:()=>s.tm_,M2M100ForConditionalGeneration:()=>s.VT,M2M100Model:()=>s.HT0,M2M100PreTrainedModel:()=>s.bZR,M2M100Tokenizer:()=>o.Hf,MBart50Tokenizer:()=>o.$o,MBartForCausalLM:()=>s.YZs,MBartForConditionalGeneration:()=>s.UNt,MBartForSequenceClassification:()=>s.Pgx,MBartModel:()=>s.Mt5,MBartPreTrainedModel:()=>s.YR3,MBartTokenizer:()=>o.cj,MPNetForMaskedLM:()=>s.QRP,MPNetForQuestionAnswering:()=>s.OOL,MPNetForSequenceClassification:()=>s.xfe,MPNetForTokenClassification:()=>s.zml,MPNetModel:()=>s.C_m,MPNetPreTrainedModel:()=>s.Mjg,MPNetTokenizer:()=>
1o.Iv,MT5ForConditionalGeneration:()=>s.kPE,MT5Model:()=>s.KcC,MT5PreTrainedModel:()=>s.wXv,MarianMTModel:()=>s.FmT,MarianModel:()=>s.W7k,MarianPreTrainedModel:()=>s.U_I,MarianTokenizer:()=>o.OF,MaskedLMOutput:()=>s.YqH,MistralForCausalLM:()=>s.uA4,MistralModel:()=>s.uKS,MistralPreTrainedModel:()=>s.eQ7,MobileBertForMaskedLM:()=>s.vZB,MobileBertForQuestionAnswering:()=>s.NlK,MobileBertForSequenceClassification:()=>s.CBj,MobileBertModel:()=>s.J_N,MobileBertPreTrainedModel:()=>s.t8g,MobileBertTokenizer:()=>o.jT,MobileViTFeatureExtractor:()=>H,MobileViTForImageClassification:()=>s.qBz,MobileViTImageProcessor:()=>Y,MobileViTModel:()=>s.Z9R,MobileViTPreTrainedModel:()=>s.pBZ,MobileViTV2ForImageClassification:()=>s.IWp,MobileViTV2Model:()=>s.F75,MobileViTV2PreTrainedModel:()=>s.hNN,ModelOutput:()=>s.lX9,MptForCausalLM:()=>s.jZx,MptModel:()=>s.rZ_,MptPreTrainedModel:()=>s.zPm,NllbTokenizer:()=>o.OR,NomicBertModel:()=>s.Paj,NomicBertPreTrainedModel:()=>s.Tc6,NougatImageProcessor:()=>et,NougatTokenizer:()=>o.EV,OPTForCausalLM:()=>s.zEN,OPTModel:()=>s.LGm,OPTPreTrainedModel:()=>s.VD9,ObjectDetectionPipeline:()=>eq,OwlViTFeatureExtractor:()=>Q,OwlViTForObjectDetection:()=>s.$Mx,OwlViTModel:()=>s.jlM,OwlViTPreTrainedModel:()=>s.tU7,OwlViTProcessor:()=>ew,Owlv2ForObjectDetection:()=>s.oKc,Owlv2ImageProcessor:()=>K,Owlv2Model:()=>s.MYn,Owlv2PreTrainedModel:()=>s.WJS,PhiForCausalLM:()=>s.VkI,PhiModel:()=>s.L1Z,PhiPreTrainedModel:()=>s.jbx,Pipeline:()=>ex,PreTrainedModel:()=>s.Y2A,PreTrainedTokenizer:()=>o._d,PretrainedConfig:()=>eZ.T,PretrainedMixin:()=>s.aLA,Processor:()=>ef,QuestionAnsweringModelOutput:()=>s.hf2,QuestionAnsweringPipeline:()=>eT,Qwen2ForCausalLM:()=>s.V2z,Qwen2Model:()=>s.jZD,Qwen2PreTrainedModel:()=>s.f7H,Qwen2Tokenizer:()=>o.XN,RawImage:()=>w,ResNetForImageClassification:()=>s.Giz,ResNetModel:()=>s.d8n,ResNetPreTrainedModel:()=>s.fl$,RoFormerForMaskedLM:()=>s.sns,RoFormerForQuestionAnswering:()=>s.eu8,RoFormerForSequenceClassification:()=>s.Xi0,RoFormerForTokenClassification:()=>s.Xsl,RoFormerModel:()=>s.Ilk,RoFormerPreTrainedModel:()=>s.Ccq,RoFormerTokenizer:()=>o.yQ,RobertaForMaskedLM:()=>s.bpB,RobertaForQuestionAnswering:()=>s.Vnd,RobertaForSequenceClassification:()=>s.MgS,RobertaForTokenClassification:()=>s.sbd,RobertaModel:()=>s.tKX,RobertaPreTrainedModel:()=>s.RIx,RobertaTokenizer:()=>o.Bi,SamImageProcessor:()=>ei,SamImageSegmentationOutput:()=>s.G3L,SamModel:()=>s.fX1,SamPreTrainedModel:()=>s.Xrw,SamProcessor:()=>ep,SeamlessM4TFeatureExtractor:()=>eh,SegformerFeatureExtractor:()=>O,SegformerForImageClassification:()=>s.dBN,SegformerForSemanticSegmentation:()=>s.YjU,SegformerModel:()=>s.U14,SegformerPreTrainedModel:()=>s.g$7,Seq2SeqLMOutput:()=>s.dt5,SequenceClassifierOutput:()=>s.AVh,SiglipImageProcessor:()=>V,SiglipModel:()=>s.gJd,SiglipPreTrainedModel:()=>s.UX7,SiglipTextModel:()=>s.Z83,SiglipTokenizer:()=>o.wR,SiglipVisionModel:()=>s.cR9,SpeechT5FeatureExtractor:()=>ed,SpeechT5ForSpeechToText:()=>s.Pqo,SpeechT5ForTextToSpeech:()=>s.fqH,SpeechT5HifiGan:()=>s.oJL,SpeechT5Model:()=>s.FEt,SpeechT5PreTrainedModel:()=>s.LN6,SpeechT5Processor:()=>e_,SpeechT5Tokenizer:()=>o.Lv,SqueezeBertForMaskedLM:()=>s.D$4,SqueezeBertForQuestionAnswering:()=>s.z45,SqueezeBertForSequenceClassification:()=>s.qvY,SqueezeBertModel:()=>s.rb,SqueezeBertPreTrainedModel:()=>s.RWH,SqueezeBertTokenizer:()=>o.T$,StableLmForCausalLM:()=>s.UaF,StableLmModel:()=>s.E6D,StableLmPreTrainedModel:()=>s.I04,Starcoder2ForCausalLM:()=>s.fjb,Starcoder2Model:()=>s.diq,Starcoder2PreTrainedModel:()=>s.nR6,SummarizationPipeline:()=>eF,Swin2SRForImageSuperResolution:()=>s.Kul,Swin2SRImageProcessor:()=>ea,Swin2SRModel:()=>s.c93,Swin2SRPreTrainedModel:()=>s.qcZ,SwinForImageClassification:()=>s.crA,SwinModel:()=>s.TrS,SwinPreTrainedModel:()=>s.VG4,T5ForConditionalGeneration:()=>s.dAU,T5Model:()=>s.j_7,T5PreTrainedModel:()=>s.j6y,T5Tokenizer:()=>o.fG,TableTransformerForObjectDetection:()=>s.vf1,TableTransformerModel:()=>s.Fzc,TableTransformerObjectDetectionOutput:()=>s.b9b,TableTransformerPreTrainedModel:()=>s.xbg,Tensor:()=>u.qY,Text2TextGenerationPipeline:()=>eA,TextClassificationPipeline:()=>ek,TextGenerationPipeline:()=>eP,TextToAudioPipeline:()=>eW,TokenClassificationPipeline:()=>eE,TokenClassifierOutput:()=>s.sKA,TokenizerModel:()=>o.hT,TrOCRForCausalLM:()=>s.A4X,TrOCRPreTrainedModel:()=>s.SNK,TranslationPipeline:()=>eS,UniSpeechForCTC:()=>s.GNt,UniSpeechForSequenceClassification:()=>s.dp7,UniSpeechModel:()=>s.IzE,UniSpeechPreTrainedModel:()=>s.ct5,UniSpeechSatForAudioFrameClassification:()=>s.bGU,UniSpeechSatForCTC:()=>s.WIq,UniSpeechSatForSequenceClassification:()=>s.xI8,UniSpeechSatModel:()=>s.W5i,UniSpeechSatPreTrainedModel:()=>s.UqB,ViTFeatureExtractor:()=>G,ViTForImageClassification:()=>s.gxi,ViTImageProcessor:()=>W,ViTModel:()=>s.h_s,ViTPreTrainedModel:()=>s.LJl,VisionEncoderDecoderModel:()=>s.qLW,VitMatteForImageMatting:()=>s.ZGD,VitMatteImageProcessor:()=>eo,VitMattePreTrainedModel:()=>
1s.m1H,VitsModel:()=>s.KJ,VitsModelOutput:()=>s.PyP,VitsPreTrainedModel:()=>s.Ct0,VitsTokenizer:()=>o.Kt,Wav2Vec2BertForCTC:()=>s.P_g,Wav2Vec2BertForSequenceClassification:()=>s.cl7,Wav2Vec2BertModel:()=>s.x5Z,Wav2Vec2BertPreTrainedModel:()=>s.fGl,Wav2Vec2CTCTokenizer:()=>o.OQ,Wav2Vec2FeatureExtractor:()=>el,Wav2Vec2ForAudioFrameClassification:()=>s.ltw,Wav2Vec2ForCTC:()=>s.aGV,Wav2Vec2ForSequenceClassification:()=>s.dMI,Wav2Vec2Model:()=>s.i3J,Wav2Vec2PreTrainedModel:()=>s.YyD,Wav2Vec2ProcessorWithLM:()=>eg,WavLMForAudioFrameClassification:()=>s.AyL,WavLMForCTC:()=>s.Xyp,WavLMForSequenceClassification:()=>s.Eh_,WavLMForXVector:()=>s.ag_,WavLMModel:()=>s.Pyv,WavLMPreTrainedModel:()=>s.zys,WhisperFeatureExtractor:()=>es,WhisperForConditionalGeneration:()=>s.EAC,WhisperModel:()=>s.aHU,WhisperPreTrainedModel:()=>s.gSt,WhisperProcessor:()=>em,WhisperTokenizer:()=>o.I_,XLMForQuestionAnswering:()=>s.d7$,XLMForSequenceClassification:()=>s._Dc,XLMForTokenClassification:()=>s.cD,XLMModel:()=>s.v11,XLMPreTrainedModel:()=>s.Pzh,XLMRobertaForMaskedLM:()=>s.QJ0,XLMRobertaForQuestionAnswering:()=>s.czX,XLMRobertaForSequenceClassification:()=>s.vGK,XLMRobertaForTokenClassification:()=>s.pJ8,XLMRobertaModel:()=>s.OK_,XLMRobertaPreTrainedModel:()=>s.klo,XLMRobertaTokenizer:()=>o.gN,XLMTokenizer:()=>o.jN,XLMWithLMHeadModel:()=>s.GXK,XVectorOutput:()=>s.Z0G,YolosFeatureExtractor:()=>en,YolosForObjectDetection:()=>s.ajg,YolosModel:()=>s.mjH,YolosObjectDetectionOutput:()=>s.URg,YolosPreTrainedModel:()=>s.CbL,ZeroShotAudioClassificationPipeline:()=>e$,ZeroShotClassificationPipeline:()=>eI,ZeroShotImageClassificationPipeline:()=>eV,ZeroShotObjectDetectionPipeline:()=>eD,bankers_round:()=>c.gE,cat:()=>u.$q,cos_sim:()=>c.gJ,dot:()=>c.Om,dynamicTimeWarping:()=>u.$y,env:()=>d._,getTopItems:()=>c.Em,hanning:()=>b,interpolate:()=>u.GW,interpolate_data:()=>c.vd,layer_norm:()=>u.l8,log_softmax:()=>c.CM,magnitude:()=>c.VO,max:()=>c.T9,mean:()=>u.i2,mean_pooling:()=>u.X7,medianFilter:()=>c.jV,mel_filter_bank:()=>E,min:()=>c.jk,ones:()=>u.S,ones_like:()=>u.oC,permute:()=>u.Ny,permute_data:()=>c.SX,pipeline:()=>eK,quantize_embeddings:()=>u.J,read_audio:()=>y,round:()=>c.LI,softmax:()=>c.Vs,spectrogram:()=>C,stack:()=>u.t$,std_mean:()=>u.cQ,window_function:()=>A});var o=r(39156),s=r(57924),l=r(3835),h=r(61463),c=r(30519),u=r(59221),d=r(41477),f=r(27806);let p="undefined"!=typeof self,m=p&&"DedicatedWorkerGlobalScope"===self.constructor.name;if(p)n=(e,t)=>{if(!self.OffscreenCanvas)throw Error("OffscreenCanvas not supported by this browser.");return new self.OffscreenCanvas(e,t)},a=self.createImageBitmap,i=self.ImageData;else if(f)a=async e=>{let t=(await e.metadata()).channels,{data:r,info:n}=await e.rotate().raw().toBuffer({resolveWithObject:!0}),i=new w(new Uint8ClampedArray(r),n.width,n.height,n.channels);return void 0!==t&&t!==n.channels&&i.convert(t),i};else throw Error("Unable to load image processing library.");let g={0:"nearest",1:"lanczos",2:"bilinear",3:"bicubic",4:"box",5:"hamming"},_=new Map([["png","image/png"],["jpg","image/jpeg"],["jpeg","image/jpeg"],["gif","image/gif"]]);class w{constructor(e,t,r,n){this.data=e,this.width=t,this.height=r,this.channels=n}get size(){return[this.width,this.height]}static async read(e){if(e instanceof w)return e;if("string"==typeof e||e instanceof URL)return await this.fromURL(e);throw Error(`Unsupported input type: ${typeof e}`)}static async fromURL(e){let t=await (0,h.ly)(e);if(200!==t.status)throw Error(`Unable to read image from "${e}" (${t.status} ${t.statusText})`);let r=await t.blob();return this.fromBlob(r)}static async fromBlob(e){if(p){let t=await a(e),r=n(t.width,t.height).getContext("2d");return r.drawImage(t,0,0),new this(r.getImageData(0,0,t.width,t.height).data,t.width,t.height,4)}{let t=f(await e.arrayBuffer());return await a(t)}}static fromTensor(e,t="CHW"){if(3!==e.dims.length)throw Error(`Tensor should have 3 dimensions, but has ${e.dims.length} dimensions.`);if("CHW"===t)e=e.transpose(1,2,0);else if("HWC"===t);else throw Error(`Unsupported channel format: ${t}`);if(!(e.data instanceof Uint8ClampedArray||e.data instanceof Uint8Array))throw Error(`Unsupported tensor type: ${e.type}`);switch(e.dims[2]){case 1:case 2:case 3:case 4:return new w(e.data,e.dims[1],e.dims[0],e.dims[2]);default:throw Error(`Unsupported number of channels: ${e.dims[2]}`)}}grayscale(){if(1===this.channels)return this;let e=new Uint8ClampedArray(this.width*this.height*1);switch(this.channels){case 3:case 4:for(let t=0,r=0;t<this.data.length;t+=this.channels){let n=this.data[t],i=this.data[t+1],a=this.data[t+2];e[r++]=Math.round(.2989*n+.587*i+.114*a)}break;default:throw Error(`Conversion failed due to unsupported number of channels: ${this.channels}`)}return this._update(e,this.width,this.height,1)}rgb(){if(3===this.channels)return this;let e=new Uint8ClampedArray(this.width*this.height*3);switch(this.channels){case 1:for(let t=0,r=0;t<this.data.length;++t)e[r++]=this.data[t],e[r++]=this.data[t],e[r++]=this.data[t];break;case 4:for(let t=0,r=0;t<this.data.length;t+=4)e[r++]=this.data[t],e[r++]=this.data[t+1],e[r++]=this.data[t+2];break;default:throw Error(`Conversion failed due to unsupported number of channels: ${this.channels}`)}return this._update(e,this.width,this.height,3)}rgba(){if(4===this.channels)return this;let e=new Uint8ClampedArray(this.width*this.height*4);switch(this.channels){case 1:for(let t=0,r=0;t<this.data.length;++t)e[r++]=this.data[t],e[r++]=this.data[t],e[r++]=this.data[t],e[r++]=255;break;case 3:for(let t=0,r=0;t<this.data.length;t+=3)e[r++]=this.data[t],e[r++]=this.data[t+1],e[r++]=this.data[t+2],e[r++]=255;break;default:throw Error(`Conversion failed due to unsupported number of channels: ${this.channels}`)}return this._update(e,this.width,this.height,4)}async resize(e,t,{resample:r=2}={}){let i=g[r]??r;if(p){let r=this.channels,i=this.toCanvas(),a=n(e,t).getContext("2d");return a.drawImage(i,0,0,e,t),new w(a.getImageData(0,0,e,t).data,e,t,4).convert(r)}{let r=this.toSharp();switch(i){case"box":case"hamming":("box"===i||"hamming"===i)&&(console.warn(`Resampling method ${i} is not yet supported. Using bilinear instead.`),i="bilinear");case"nearest":case"bilinear":case"bicubic":r=r.affine([e/this.width,0,0,t/this.height],{interpolator:i});break;case"lanczos":r=r.resize({width:e,height:t,fit:"fill",kernel:"lanczos3"});break;default:throw Error(`Resampling method ${i} is not supported.`)}return await a(r)}}async pad([e,t,r,i]){if(e=Math.max(e,0),t=Math.max(t,0),r=Math.max(r,0),i=Math.max(i,0),0===e&&0===t&&0===r&&0===i)return this;if(p){let a=this.channels,o=this.toCanvas(),s=this.width+e+t,l=this.height+r+i,h=n(s,l).getContext("2d");return h.drawImage(o,0,0,this.width,this.height,e,r,s,l),new w(h.getImageData(0,0,s,l).data,s,l,4).convert(a)}{let n=this.toSharp().extend({left:e,right:t,top:r,bottom:i});return await a(n)}}async crop([e,t,r,i]){if(e=Math.max(e,0),t=Math.max(t,0),r=Math.min(r,this.width-1),i=Math.min(i,this.height-1),0===e&&0===t&&r===this.width-1&&i===this.height-1)return this;let o=r-e+1,s=i-t+1;if(p){let r=this.channels,i=this.toCanvas(),a=n(o,s).getContext("2d");return a.drawImage(i,e,t,o,s,0,0,o,s),new w(a.getImageData(0,0,o,s).data,o,s,4).convert(r)}{let r=this.toSharp().extract({left:e,top:t,width:o,height:s});return await a(r)}}async center_crop(e,t){if(this.width===e&&this.height===t)return this;let r=(this.width-e)/2,i=(this.height-t)/2;if(p){let a=this.channels,o=this.toCanvas(),s=n(e,t).getContext("2d"),l=0,h=0,c=0,u=0;return r>=0?l=r:c=-r,i>=0?h=i:u=-i,s.drawImage(o,l,h,e,t,c,u,e,t),new w(s.getImageData(0,0,e,t).data,e,t,4).convert(a)}{let n=this.toSharp();if(r>=0&&i>=0)n=n.extract({left:Math.floor(r),top:Math.floor(i),width:e,height:t});else if(r<=0&&i<=0){let a=Math.floor(-i),o=Math.floor(-r);n=n.extend({top:a,left:o,right:e-this.width-o,bottom:t-this.height-a})}else{let a=[0,0],o=0;i<0?(a[0]=Math.floor(-i),a[1]=t-this.height-a[0]):o=Math.floor(i);let s=[0,0],l=0;r<0?(s[0]=Math.floor(-r),s[1]=e-this.width-s[0]):l=Math.floor(r),n=n.extend({top:a[0],bottom:a[1],left:s[0],right:s[1]}).extract({left:l,top:o,width:e,height:t})}return await a(n)}}async toBlob(e="image/png",t=1){if(!p)throw Error("toBlob() is only supported in browser environments.");let r=this.toCanvas();return await r.convertToBlob({type:e,quality:t})}toTensor(e="CHW"){let t=new u.qY("uint8",new Uint8Array(this.data),[this.height,this.width,this.channels]);if("HWC"===e);else if("CHW"===e)t=t.permute(2,0,1);else throw Error(`Unsupported channel format: ${e}`);return t}toCanvas(){if(!p)throw Error("toCanvas() is only supported in browser environments.");let e=this.clone().rgba(),t=n(e.width,e.height),r=new i(e.data,e.width,e.height);return t.getContext("2d").putImageData(r,0,0),t}_update(e,t,r,n=null){return this.data=e,this.width=t,this.height=r,null!==n&&(this.channels=n),this}clone(){return new w(this.data.slice(),this.width,this.height,this.channels)}convert(e){if(this.channels===e)return this;switch(e){case 1:this.grayscale();break;case 3:this.rgb();break;case 4:this.rgba();break;default:throw Error(`Conversion failed due to unsupported number of channels: ${this.channels}`)}return this}async save(e){if(p){if(m)throw Error("Unable to save an image from a Web Worker.");let t=e.split(".").pop().toLowerCase(),r=_.get(t)??"image/png",n=await this.toBlob(r),i=URL.createObjectURL(n),a=document.createElement("a");a.href=i,a.download=e,a.click(),a.remove()}else if(d._.useFS){let t=this.toSharp();return await t.toFile(e)}else throw Error("Unable to save the image because filesystem is disabled in this environment.")}toSharp(){if(p)throw Error("toSharp() is only supported in server-side environments.");return f(this.data,{raw:{width:this.width,height:this.height,channels:this.channels}})}}async function y(e,t){let r;if("undefined"==typeof AudioContext)throw Error("Unable to load audio from path/URL since `AudioContext` is not available in your environment. Instead, audio data should be passed directly to the pipeline/processor. For more information and some example code, see https://huggingface.co/docs/transformers.js/guides/node
1-audio-processing.");let n=await (await (0,h.ly)(e)).arrayBuffer(),i=new AudioContext({sampleRate:t});void 0===t&&console.warn(`No sampling rate provided, using default of ${i.sampleRate}Hz.`);let a=await i.decodeAudioData(n);if(2===a.numberOfChannels){let e=Math.sqrt(2),t=a.getChannelData(0),n=a.getChannelData(1);r=new Float32Array(t.length);for(let i=0;i<a.length;++i)r[i]=e*(t[i]+n[i])/2}else r=a.getChannelData(0);return r}function b(e){if(e<1)return new Float64Array;if(1===e)return new Float64Array([1]);let t=e-1,r=Math.PI/t,n=new Float64Array(e);for(let i=0;i<e;++i){let e=2*i-t;n[i]=.5+.5*Math.cos(r*e)}return n}let v={htk:e=>2595*Math.log10(1+e/700),kaldi:e=>1127*Math.log(1+e/700),slaney:(e,t=1e3,r=15,n=27/Math.log(6.4))=>e>=t?r+Math.log(e/t)*n:3*e/200};function M(e,t="htk"){let r=v[t];if(!r)throw Error('mel_scale should be one of "htk", "slaney" or "kaldi".');return"number"==typeof e?r(e):e.map(e=>r(e))}let x={htk:e=>700*(10**(e/2595)-1),kaldi:e=>700*(Math.exp(e/1127)-1),slaney:(e,t=1e3,r=15,n=Math.log(6.4)/27)=>e>=r?t*Math.exp(n*(e-r)):200*e/3};function k(e,t,r){let n=(t-e)/(r-1);return Float64Array.from({length:r},(t,r)=>e+n*r)}function E(e,t,r,n,i,a=null,o="htk",s=!1){let l;if(null!==a&&"slaney"!==a)throw Error('norm must be one of null or "slaney"');let h=k(M(r,o),M(n,o),t+2),c=function(e,t="htk"){let r=x[t];if(!r)throw Error('mel_scale should be one of "htk", "slaney" or "kaldi".');return"number"==typeof e?r(e):e.map(e=>r(e))}(h,o);if(s){let t=i/(2*e);l=M(Float64Array.from({length:e},(e,r)=>r*t),o),c=h}else l=k(0,Math.floor(i/2),e);let u=function(e,t){let r=Float64Array.from({length:t.length-1},(e,r)=>t[r+1]-t[r]),n=Array.from({length:e.length},()=>Array(t.length));for(let r=0;r<e.length;++r){let i=n[r];for(let n=0;n<t.length;++n)i[n]=t[n]-e[r]}let i=t.length-2,a=Array.from({length:i},()=>Array(e.length));for(let t=0;t<e.length;++t){let e=n[t];for(let n=0;n<i;++n){let i=-e[n]/r[n],o=e[n+2]/r[n+1];a[n][t]=Math.max(0,Math.min(i,o))}}return a}(l,c);if(null!==a&&"slaney"===a)for(let r=0;r<t;++r){let t=u[r],n=2/(c[r+2]-c[r]);for(let r=0;r<e;++r)t[r]*=n}return u}function T(e,t,r,n,i){if(r<=0)throw Error("reference must be greater than zero");if(n<=0)throw Error("min_value must be greater than zero");let a=Math.log10(r=Math.max(n,r));for(let r=0;r<e.length;++r)e[r]=t*Math.log10(Math.max(n,e[r])-a);if(null!==i){if(i<=0)throw Error("db_range must be greater than zero");let t=(0,c.T9)(e)[0]-i;for(let r=0;r<e.length;++r)e[r]=Math.max(e[r],t)}return e}function C(e,t,r,n,{fft_length:i=null,power:a=1,center:o=!0,pad_mode:s="reflect",onesided:h=!0,preemphasis:u=null,mel_filters:d=null,mel_floor:f=1e-10,log_mel:p=null,reference:m=1,min_value:g=1e-10,db_range:_=null,remove_dc_offset:w=null,max_num_frames:y=null,do_pad:b=!0,transpose:v=!1}={}){let M=t.length;if(null===i&&(i=r),r>i)throw Error(`frame_length (${r}) may not be larger than fft_length (${i})`);if(M!==r)throw Error(`Length of the window (${M}) must equal frame_length (${r})`);if(n<=0)throw Error("hop_length must be greater than zero");if(null===a&&null!==d)throw Error("You have provided `mel_filters` but `power` is `None`. Mel spectrogram computation is not yet supported for complex-valued spectrogram. Specify `power` to fix this issue.");if(o){if("reflect"!==s)throw Error(`pad_mode="${s}" not implemented yet.`);let t=Math.floor((i-1)/2)+1;e=function(e,t,r){let n=new e.constructor(e.length+t+r),i=e.length-1;for(let r=0;r<e.length;++r)n[t+r]=e[r];for(let r=1;r<=t;++r)n[t-r]=e[(0,l.nK)(r,i)];for(let a=1;a<=r;++a)n[i+t+a]=e[(0,l.nK)(i-a,i)];return n}(e,t,t)}let x=Math.floor(1+Math.floor((e.length-r)/n)),k=h?Math.floor(i/2)+1:i,E=x,A=x;null!==y&&(y>x?b&&(A=y):A=E=y);let F=new c.rG(i),S=new Float64Array(i),z=new Float64Array(F.outputBufferSize),P=Array(E);for(let i=0;i<E;++i){let a=i*n;for(let t=0;t<r;++t)S[t]=e[a+t];if(w){let e=0;for(let t=0;t<r;++t)e+=S[t];let t=e/r;for(let e=0;e<r;++e)S[e]-=t}if(null!==u){for(let e=r-1;e>=1;--e)S[e]-=u*S[e-1];S[0]*=1-u}for(let e=0;e<t.length;++e)S[e]*=t[e];F.realTransform(z,S);let o=Array(k);for(let e=0;e<o.length;++e){let t=e<<1;o[e]=z[t]**2+z[t+1]**2}P[i]=o}if(null!==a&&2!==a){let e=2/a;for(let t=0;t<P.length;++t){let r=P[t];for(let t=0;t<r.length;++t)r[t]**=e}}let I=d.length,B=new Float32Array(I*A),O=v?[A,I]:[I,A];for(let e=0;e<I;++e){let t=d[e];for(let r=0;r<E;++r){let n=P[r],i=0;for(let e=0;e<k;++e)i+=t[e]*n[e];B[v?r*I+e:e*E+r]=Math.max(f,i)}}if(null!==a&&null!==p){let e=Math.min(B.length,E*I);switch(p){case"log":for(let t=0;t<e;++t)B[t]=Math.log(B[t]);break;case"log10":for(let t=0;t<e;++t)B[t]=Math.log10(B[t]);break;case"dB":if(1===a)!function(e,t=1,r=1e-5,n=null){T(e,20,t,r,n)}(B,m,g,_);else if(2===a)!function(e,t=1,r=1e-10,n=null){T(e,10,t,r,n)}(B,m,g,_);else throw Error(`Cannot use log_mel option '${p}' with power ${a}`);break;default:throw Error(`log_mel must be one of null, 'log', 'log10' or 'dB'. Got '${p}'`)}}return{data:B,dims:O}}function A(e,t,{periodic:r=!0,frame_length:n=null,center:i=!0}={}){let a,o=r?e+1:e;switch(t){case"boxcar":a=new Float64Array(o).fill(1);break;case"hann":case"hann_window":a=b(o);break;case"povey":a=b(o).map(e=>Math.pow(e,.85));break;default:throw Error(`Unknown window type ${t}.`)}if(r&&(a=a.subarray(0,e)),null===n)return a;
1if(e>n)throw Error(`Length of the window (${e}) may not be larger than frame_length (${n})`);return a}function F(e,t=.5,r=null,n=!1){let i=e.logits,a=e.pred_boxes,[o,s,l]=i.dims;if(null!==r&&r.length!==o)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");let h=[];for(let e=0;e<o;++e){let o=null!==r?r[e]:null,u={boxes:[],classes:[],scores:[]},d=i[e],f=a[e];for(let e=0;e<s;++e){let r,i=d[e],a=[];if(n){r=i.sigmoid().data;for(let e=0;e<r.length;++e)r[e]>t&&a.push(e)}else{let e=(0,c.T9)(i.data)[1];if(e===l-1)continue;a.push(e),r=(0,c.Vs)(i.data)}for(let t of a){let n=f[e].data;n=function([e,t,r,n]){return[e-r/2,t-n/2,e+r/2,t+n/2]}(n),null!==o&&(n=n.map((e,t)=>e*o[(t+1)%2])),u.boxes.push(n),u.classes.push(t),u.scores.push(r[t])}}h.push(u)}return h}function S(e,t){if(!(e instanceof Float32Array||e instanceof Float64Array))throw Error(`${t} expects input to be a Float32Array or a Float64Array, but got ${e?.constructor?.name??typeof e} instead. If using the feature extractor directly, remember to use \`read_audio(url, sampling_rate)\` to obtain the raw audio data of the file/url.`)}function z(e,t,r=0,n=null){let i=e/t,a=(0,c.gE)(i)*t;return null!==n&&a>n&&(a=Math.floor(i)*t),a<r&&(a=Math.ceil(i)*t),a}function P([e,t],r){return[Math.max(Math.floor(e/r),1)*r,Math.max(Math.floor(t/r),1)*r]}class I extends l.bV{constructor(e){super(),this.config=e}}class B extends I{constructor(e){super(e),this.image_mean=this.config.image_mean??this.config.mean,this.image_std=this.config.image_std??this.config.std,this.resample=this.config.resample??2,this.do_rescale=this.config.do_rescale??!0,this.rescale_factor=this.config.rescale_factor??1/255,this.do_normalize=this.config.do_normalize,this.do_resize=this.config.do_resize,this.do_thumbnail=this.config.do_thumbnail,this.size=this.config.size,this.size_divisibility=this.config.size_divisibility??this.config.size_divisor,this.do_center_crop=this.config.do_center_crop,this.crop_size=this.config.crop_size,this.do_convert_rgb=this.config.do_convert_rgb??!0,this.do_crop_margin=this.config.do_crop_margin,this.pad_size=this.config.pad_size,this.do_pad=this.config.do_pad,this.do_pad&&!this.pad_size&&this.size&&void 0!==this.size.width&&void 0!==this.size.height&&(this.pad_size=this.size),this.do_flip_channel_order=this.config.do_flip_channel_order??!1}async thumbnail(e,t,r=2){let n=e.height,i=e.width,a=t.height,o=t.width,s=Math.min(n,a),l=Math.min(i,o);return s===n&&l===i?e:(n>i?l=Math.floor(i*s/n):i>n&&(s=Math.floor(n*l/i)),await e.resize(l,s,{resample:r}))}async crop_margin(e,t=200){let r=e.clone().grayscale(),n=(0,c.jk)(r.data)[0],i=(0,c.T9)(r.data)[0]-n;if(0===i)return e;let a=t/255,o=r.width,s=r.height,l=0,h=0;for(let e=0;e<r.height;++e){let t=e*r.width;for(let c=0;c<r.width;++c)(r.data[t+c]-n)/i<a&&(o=Math.min(o,c),s=Math.min(s,e),l=Math.max(l,c),h=Math.max(h,e))}return e=await e.crop([o,s,l,h])}pad_image(e,t,r,{mode:n="constant",center:i=!1,constant_values:a=0}={}){let o,s,[h,c,u]=t;if("number"==typeof r?(o=r,s=r):(o=r.width,s=r.height),o!==c||s!==h){let r=new Float32Array(o*s*u);if(Array.isArray(a))for(let e=0;e<r.length;++e)r[e]=a[e%u];else 0!==a&&r.fill(a);let[d,f]=i?[Math.floor((o-c)/2),Math.floor((s-h)/2)]:[0,0];for(let t=0;t<h;++t){let n=(t+f)*o,i=t*c;for(let t=0;t<c;++t){let a=(n+t+d)*u,o=(i+t)*u;for(let t=0;t<u;++t)r[a+t]=e[o+t]}}if("symmetric"===n){if(i)throw Error("`center` padding is not supported when `mode` is set to `symmetric`.");let t=h-1,n=c-1;for(let i=0;i<s;++i){let a=i*o,s=(0,l.nK)(i,t)*c;for(let t=0;t<o;++t){if(i<h&&t<c)continue;let o=(a+t)*u,d=(s+(0,l.nK)(t,n))*u;for(let t=0;t<u;++t)r[o+t]=e[d+t]}}}e=r,t=[s,o,u]}return[e,t]}rescale(e){for(let t=0;t<e.length;++t)e[t]=this.rescale_factor*e[t]}get_resize_output_image_size(e,t){let r,n,[i,a]=e.size;if(this.do_thumbnail){let{height:e,width:n}=t;r=Math.min(e,n)}else Number.isInteger(t)?(r=t,n=this.config.max_size??r):void 0!==t&&(r=t.shortest_edge,n=t.longest_edge);if(void 0!==r||void 0!==n){let e=void 0===r?1:Math.max(r/i,r/a),t=i*e,o=a*e,s=void 0===n?1:Math.min(n/t,n/o),l=Math.floor(Number((t*s).toFixed(2))),h=Math.floor(Number((o*s).toFixed(2)));return void 0!==this.size_divisibility&&([l,h]=P([l,h],this.size_divisibility)),[l,h]}if(void 0!==t&&void 0!==t.width&&void 0!==t.height){let e=t.width,r=t.height;if(this.config.keep_aspect_ratio&&this.config.ensure_multiple_of){let t=r/a,n=e/i;Math.abs(1-n)<Math.abs(1-t)?t=n:n=t,r=z(t*a,this.config.ensure_multiple_of),e=z(n*i,this.config.ensure_multiple_of)}return[e,r]}if(void 0!==this.size_divisibility)return P([i,a],this.size_divisibility);throw Error(`Could not resize image due to unsupported \`this.size\` option in config: ${JSON.stringify(t)}`)}async resize(e){let[t,r]=this.get_resize_output_image_size(e,this.size);return await e.resize(t,r,{resample:this.resample})}async preprocess(e,{do_normalize:t=null,do_pad:r=null,do_convert_rgb:n=null,do_convert_grayscale:i=null,do_flip_channel_order:a=null}={}){this.do_crop_margin&&(e=await this.crop_margin(e));let[o,s]=e.size;if(n??this.do_convert_rgb?e=e.rgb():i&&(e=e.grayscale()),this.do_resize&&(e=await this.resize(e)),this.do_thumbnail&&(e=await this.thumbnail(e,this.size,this.resample)),this.do_center_crop){let t,r;Number.isInteger(this.crop_size)?(t=this.crop_size,r=this.crop_size):(t=this.crop_size.width,r=this.crop_size.height),e=await e.center_crop(t,r)}let l=[e.height,e.width],h=Float32Array.from(e.data),c=[e.height,e.width,e.channels];if(this.do_rescale&&this.rescale(h),t??this.do_normalize){let t=this.image_mean;Array.isArray(this.image_mean)||(t=Array(e.channels).fill(t));let r=this.image_std;if(Array.isArray(this.image_std)||(r=Array(e.channels).fill(t)),t.length!==e.channels||r.length!==e.channels)throw Error(`When set to arrays, the length of \`image_mean\` (${t.length}) and \`image_std\` (${r.length}) must match the number of channels in the image (${e.channels}).`);for(let n=0;n<h.length;n+=e.channels)for(let i=0;i<e.channels;++i)h[n+i]=(h[n+i]-t[i])/r[i]}if(r??this.do_pad){if(this.pad_size){let t=this.pad_image(h,[e.height,e.width,e.channels],this.pad_size);[h,c]=t}else if(this.size_divisibility){let[e,t]=P([c[1],c[0]],this.size_divisibility);[h,c]=this.pad_image(h,c,{width:e,height:t})}}if(a??this.do_flip_channel_order){if(3!==c[2])throw Error("Flipping channel order is only supported for RGB images.");for(let e=0;e<h.length;e+=3){let t=h[e];h[e]=h[e+2],h[e+2]=t}}return{original_size:[s,o],reshaped_input_size:l,pixel_values:new u.qY("float32",h,c).permute(2,0,1)}}async _call(e){Array.isArray(e)||(e=[e]);let t=await Promise.all(e.map(e=>this.preprocess(e)));return{pixel_values:(0,u.t$)(t.map(e=>e.pixel_values),0),original_sizes:t.map(e=>e.original_size),reshaped_input_sizes:t.map(e=>e.reshaped_input_size)}}}class O extends B{post_process_semantic_segmentation(e,t=null){let r=e.logits,n=r.dims[0];if(null!==t&&t.length!==n)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");let i=[];for(let e=0;e<n;++e){let n=null!==t?t[e]:null,a=r[e];null!==n&&(a=(0,u.GW)(a,n,"bilinear",!1));let[o,s]=n??a.dims.slice(-2),l=new u.qY("int32",new Int32Array(o*s),[o,s]),h=a[0].data;for(let e=1;e<a.dims[0];++e){let t=a[e].data;for(let r=0;r<t.length;++r)t[r]>h[r]&&(h[r]=t[r],l.data[r]=e)}let c=Array(a.dims[0]),d=l.data;for(let e=0;e<d.length;++e){let t=d[e];c[t]=t}let f=c.filter(e=>void 0!==e);i.push({segmentation:l,labels:f})}return i}}class L extends B{}class $ extends L{}class j extends B{}class U extends B{}class N extends B{}class R extends B{}class V extends B{}class q extends B{constructor(e){super(e),this.crop_pct=this.config.crop_pct??.875}async resize(e){let t=this.size?.shortest_edge;if(void 0===t)throw Error("Size dictionary must contain 'shortest_edge' key.");if(t<384){let r=Math.floor(t/this.crop_pct),[n,i]=this.get_resize_output_image_size(e,{shortest_edge:r});e=await e.resize(n,i,{resample:this.resample}),e=await e.center_crop(t,t)}else e=await e.resize(t,t,{resample:this.resample});return e}}class D extends q{}class G extends B{}class W extends B{}class X extends B{constructor(e){super(e),this.include_top=this.config.include_top??!0,this.include_top&&(this.image_std=this.image_std.map(e=>e*e))}}class H extends B{}class Y extends H{}class Q extends B{post_process_object_detection(...e){return F(...e)}}class K extends Q{}class J extends B{}class Z extends B{}class ee extends B{pad_image(e,t,r,n={}){let[i,a,o]=t,s=this.image_mean;Array.isArray(this.image_mean)||(s=Array(o).fill(s));let l=this.image_std;Array.isArray(l)||(l=Array(o).fill(s));let h=s.map((e,t)=>-e/l[t]);return super.pad_image(e,t,r,{center:!0,constant_values:h,...n})}}class et extends ee{}class er extends B{async _call(e){let t=await super._call(e),r=[t.pixel_values.dims[0],64,64],n=new u.qY("int64",new BigInt64Array(r.reduce((e,t)=>
1e*t)).fill(1n),r);return{...t,pixel_mask:n}}post_process_object_detection(...e){return F(...e)}remove_low_and_no_objects(e,t,r,n){let i=[],a=[],o=[];for(let s=0;s<e.dims[0];++s){let l=e[s],h=t[s],u=(0,c.T9)(l.data)[1];if(u===n)continue;let d=(0,c.Vs)(l.data)[u];d>r&&(i.push(h),a.push(d),o.push(u))}return[i,a,o]}check_segment_validity(e,t,r,n=.5,i=.8){let a=[],o=0,s=0;for(let i=0;i<e.length;++i)e[i]===r&&(a.push(i),++o),t[r].data[i]>=n&&++s;let l=o>0&&s>0;return l&&(l=o/s>i),[l,a]}compute_segments(e,t,r,n,i,a=null,o=null){let[s,l]=o??e[0].dims,h=new u.qY("int32",new Int32Array(s*l),[s,l]),c=[];if(null!==o)for(let t=0;t<e.length;++t)e[t]=(0,u.GW)(e[t],o,"bilinear",!1);let d=new Int32Array(e[0].data.length),f=new Float32Array(e[0].data.length);for(let r=0;r<e.length;++r){let n=t[r];for(let t=0;t<e[r].data.length;++t)e[r].data[t]*=n,e[r].data[t]>f[t]&&(d[t]=r,f[t]=e[r].data[t])}let p=0;for(let a=0;a<r.length;++a){let o=r[a],[s,l]=this.check_segment_validity(d,e,a,n,i);if(s){for(let e of(++p,l))h.data[e]=p;c.push({id:p,label_id:o,score:t[a]})}}return[h,c]}post_process_panoptic_segmentation(e,t=.5,r=.5,n=.8,i=null,a=null){null===i&&(console.warn("`label_ids_to_fuse` unset. No instance will be fused."),i=new Set);let o=e.logits,s=e.pred_masks.sigmoid(),[l,h,c]=o.dims;if(c-=1,null!==a&&a.length!==l)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");let d=[];for(let e=0;e<l;++e){let l=null!==a?a[e]:null,h=o[e],f=s[e],[p,m,g]=this.remove_low_and_no_objects(h,f,t,c);if(0===g.length){let[e,t]=l??f.dims.slice(-2),r=new u.qY("int32",new Int32Array(e*t).fill(-1),[e,t]);d.push({segmentation:r,segments_info:[]});continue}let[_,w]=this.compute_segments(p,m,g,r,n,i,l);d.push({segmentation:_,segments_info:w})}return d}post_process_instance_segmentation(){throw Error("Not implemented yet")}}class en extends B{post_process_object_detection(...e){return F(...e)}}class ei extends B{reshape_input_points(e,t,r){e=structuredClone(e);let n=(0,l.ky)(e);if(3===n.length)n=[1,...n],e=[e];else if(4!==n.length)throw Error("The input_points must be a 4D tensor of shape `batch_size`, `point_batch_size`, `nb_points_per_image`, `2`.");for(let n=0;n<e.length;++n){let i=t[n],a=r[n],o=[a[0]/i[0],a[1]/i[1]];for(let t=0;t<e[n].length;++t)for(let r=0;r<e[n][t].length;++r)for(let i=0;i<e[n][t][r].length;++i)e[n][t][r][i]*=o[i]}return new u.qY("float32",Float32Array.from(e.flat(1/0)),n)}add_input_labels(e,t){let r=(0,l.ky)(e);if(2===r.length)r=[1,...r],e=[e];else if(3!==r.length)throw Error("The input_points must be a 4D tensor of shape `batch_size`, `point_batch_size`, `nb_points_per_image`, `2`.");if(r.some((e,r)=>e!==t.dims[r]))throw Error(`The first ${r.length} dimensions of 'input_points' and 'input_labels' must be the same.`);return new u.qY("int64",e.flat(1/0).map(BigInt),r)}async _call(e,t=null,r=null){let n=await super._call(e);if(t&&(n.input_points=this.reshape_input_points(t,n.original_sizes,n.reshaped_input_sizes)),r){if(!n.input_points)throw Error("`input_points` must be provided if `input_labels` are provided.");n.input_labels=this.add_input_labels(r,n.input_points)}return n}post_process_masks(e,t,r,{mask_threshold:n=0,binarize:i=!0,pad_size:a=null}={}){let o=[],s=[(a=a??this.pad_size).height,a.width];for(let a=0;a<t.length;++a){let l=t[a],h=r[a],c=e[a],d=[];for(let e=0;e<c.dims[0];++e){let t=c[e],r=(0,u.GW)(t,s,"bilinear",!1);if(r=r.slice(null,[0,h[0]],[0,h[1]]),r=(0,u.GW)(r,l,"bilinear",!1),i){let e=new Uint8Array(r.data.length);for(let t=0;t<r.data.length;++t)r.data[t]>n&&(e[t]=1);r=new u.qY("bool",e,r.dims)}d.push(r)}o.push((0,u.t$)(d))}return o}}class ea extends B{pad_image(e,t,r,n={}){let[i,a,o]=t;return super.pad_image(e,t,{width:a+(r-a%r)%r,height:i+(r-i%r)%r},{mode:"symmetric",center:!1,constant_values:-1,...n})}}class eo extends B{async _call(e,t){Array.isArray(e)||(e=[e]),Array.isArray(t)||(t=[t]);let r=await Promise.all(e.map(e=>this.preprocess(e))),n=await Promise.all(t.map(e=>this.preprocess(e,{do_normalize:!1,do_convert_rgb:!1,do_convert_grayscale:!0})));return{pixel_values:(0,u.t$)(r.map((e,t)=>(0,u.$q)([e.pixel_values,n[t].pixel_values],0)),0),original_sizes:r.map(e=>e.original_size),reshaped_input_sizes:r.map(e=>e.reshaped_input_size)}}}class es extends I{constructor(e){super(e),this.config.mel_filters??=E(Math.floor(1+this.config.n_fft/2),this.config.feature_size,0,8e3,this.config.sampling_rate,"slaney","slaney"),this.window=A(this.config.n_fft,"hann")}_extract_fbank_features(e){let{data:t,dims:r}=C(e,this.window,this.config.n_fft,this.config.hop_length,{power:2,mel_filters:this.config.mel_filters,log_mel:"log10",max_num_frames:this.config.nb_max_frames}),n=(0,c.T9)(t)[0];for(let e=0;e<t.length;++e)t[e]=(Math.max(t[e],n-8)+4)/4;return{data:t,dims:r}}async _call(e){let t;S(e,"WhisperFeatureExtractor"),e.length>this.config.n_samples?(console.warn("Attempting to extract features for audio longer than 30 seconds. If using a pipeline to extract transcript from a long audio clip, remember to specify `chunk_length_s` and/or `stride_length_s`."),t=e.slice(0,this.config.n_samples)):(t=new Float32Array(this.config.n_samples)).set(e);let{data:r,dims:n}=this._extract_fbank_features(t);return{input_features:new u.qY("float32",r,[1,...n])}}}class el extends I{_zero_mean_unit_var_norm(e){let t=e.reduce((e,t)=>
1e+t,0)/e.length,r=e.reduce((e,r)=>e+(r-t)**2,0)/e.length;return e.map(e=>(e-t)/Math.sqrt(r+1e-7))}async _call(e){S(e,"Wav2Vec2FeatureExtractor"),e instanceof Float64Array&&(e=new Float32Array(e));let t=e;this.config.do_normalize&&(t=this._zero_mean_unit_var_norm(t));let r=[1,t.length];return{input_values:new u.qY("float32",t,r),attention_mask:new u.qY("int64",new BigInt64Array(t.length).fill(1n),r)}}}class eh extends I{constructor(e){super(e);let t=this.config.sampling_rate,r=E(256,this.config.num_mel_bins,20,Math.floor(t/2),t,null,"kaldi",!0);for(let e=0;e<r.length;++e)r[e].push(0);this.mel_filters=r,this.window=A(400,"povey",{periodic:!1})}_extract_fbank_features(e,t){return C(e=e.map(e=>32768*e),this.window,400,160,{fft_length:512,power:2,center:!1,preemphasis:.97,mel_filters:this.mel_filters,log_mel:"log",mel_floor:1192092955078125e-22,remove_dc_offset:!0,max_num_frames:t,transpose:!0})}async _call(e,{padding:t=!0,pad_to_multiple_of:r=2,do_normalize_per_mel_bins:n=!0,return_attention_mask:i=!0}={}){let a;S(e,"SeamlessM4TFeatureExtractor");let o=this._extract_fbank_features(e,this.config.max_length);if(n){let[e,t]=o.dims;for(let r=0;r<t;++r){let n=0;for(let i=0;i<e;++i)n+=o.data[i*t+r];let i=n/e,a=0;for(let n=0;n<e;++n)a+=(o.data[n*t+r]-i)**2;let s=Math.sqrt((a/=e-1)+1e-7);for(let n=0;n<e;++n){let e=n*t+r;o.data[e]=(o.data[e]-i)/s}}}if(t){let[e,t]=o.dims,n=e%r;if(n>0){let r=new Float32Array(t*(e+n));r.set(o.data),r.fill(this.config.padding_value,o.data.length);let s=e+n;o={data:r,dims:[s,t]},i&&(a=new u.qY("int64",new BigInt64Array(s),[1,s])).data.fill(1n,0,e)}}let[s,l]=o.dims,h=this.config.stride;if(0!=s%h)throw Error(`The number of frames (${s}) must be a multiple of the stride (${h}).`);let c=new u.qY("float32",o.data,o.dims).view(1,Math.floor(s/h),l*h),d={input_features:c};if(i){let e=c.dims[1],t=new u.qY("int64",new BigInt64Array(e),[1,e]);if(a)for(let e=1,r=0;e<s;e+=h,++r)t.data[r]=a.data[e];else t.data.fill(1n);d.attention_mask=t}return d}}class ec extends I{constructor(e){super(e);let t=this.config.sampling_rate,r=E(256,this.config.num_mel_bins,20,Math.floor(t/2),t,null,"kaldi",!0);for(let e=0;e<r.length;++e)r[e].push(0);this.mel_filters=r,this.window=A(400,"hann",{periodic:!1}),this.mean=this.config.mean,this.std=this.config.std}_extract_fbank_features(e,t){return C(e,this.window,400,160,{fft_length:512,power:2,center:!1,preemphasis:.97,mel_filters:this.mel_filters,log_mel:"log",mel_floor:1192092955078125e-22,remove_dc_offset:!0,max_num_frames:t,transpose:!0})}async _call(e){S(e,"ASTFeatureExtractor");let t=this._extract_fbank_features(e,this.config.max_length);if(this.config.do_normalize){let e=2*this.std;for(let r=0;r<t.data.length;++r)t.data[r]=(t.data[r]-this.mean)/e}return{input_values:new u.qY("float32",t.data,[1,...t.dims])}}}class eu extends I{constructor(e){super(e),this.mel_filters=E(this.config.nb_frequency_bins,this.config.feature_size,this.config.frequency_min,this.config.frequency_max,this.config.sampling_rate,null,"htk"),this.mel_filters_slaney=E(this.config.nb_frequency_bins,this.config.feature_size,this.config.frequency_min,this.config.frequency_max,this.config.sampling_rate,"slaney","slaney"),this.window=A(this.config.fft_window_size,"hann")}_get_input_mel(e,t,r,n){let i,a=!1,o=e.length-t;if(o>0)if("rand_trunc"===r){a=!0;let r=Math.floor(Math.random()*(o+1));e=e.subarray(r,r+t),(i=this._extract_fbank_features(e,this.mel_filters_slaney,this.config.nb_max_samples)).dims=[1,...i.dims]}else throw Error(`Truncation strategy "${r}" not implemented`);else{if(o<0){let r=new Float64Array(t);if(r.set(e),"repeat"===n)for(let n=e.length;n<t;n+=e.length)r.set(e.subarray(0,Math.min(e.length,t-n)),n);else if("repeatpad"===n)for(let t=e.length;t<-o;t+=e.length)r.set(e,t);e=r}if("fusion"===r)throw Error(`Truncation strategy "${r}" not implemented`);(i=this._extract_fbank_features(e,this.mel_filters_slaney,this.config.nb_max_samples)).dims=[1,...i.dims]}return{...i,longer:a}}_extract_fbank_features(e,t,r=null){return C(e,this.window,this.config.fft_window_size,this.config.hop_length,{power:2,mel_filters:t,log_mel:"dB",max_num_frames:r,do_pad:!1,transpose:!0})}async _call(e,{max_length:t=null}={}){S(e,"ClapFeatureExtractor");let r=this._get_input_mel(e,t??this.config.nb_max_samples,this.config.truncation,this.config.padding);return{input_features:new u.qY("float32",r.data,[1,...r.dims])}}}class ed extends I{}class ef extends l.bV{constructor(e){super(),this.feature_extractor=e}async _call(e,...t){return await this.feature_extractor(e,...t)}}class ep extends ef{async _call(...e){return await this.feature_extractor(...e)}post_process_masks(...e){return this.feature_extractor.post_process_masks(...e)}
1reshape_input_points(...e){return this.feature_extractor.reshape_input_points(...e)}}class em extends ef{async _call(e){return await this.feature_extractor(e)}}class eg extends ef{async _call(e){return await this.feature_extractor(e)}}class e_ extends ef{async _call(e){return await this.feature_extractor(e)}}class ew extends ef{}class ey{static FEATURE_EXTRACTOR_CLASS_MAPPING={ImageFeatureExtractor:B,WhisperFeatureExtractor:es,ViTFeatureExtractor:G,MobileViTFeatureExtractor:H,MobileViTImageProcessor:Y,OwlViTFeatureExtractor:Q,Owlv2ImageProcessor:K,CLIPFeatureExtractor:N,ChineseCLIPFeatureExtractor:R,SiglipImageProcessor:V,ConvNextFeatureExtractor:q,ConvNextImageProcessor:D,SegformerFeatureExtractor:O,BitImageProcessor:j,DPTImageProcessor:$,DPTFeatureExtractor:L,GLPNFeatureExtractor:U,BeitFeatureExtractor:Z,DeiTFeatureExtractor:J,DetrFeatureExtractor:er,YolosFeatureExtractor:en,DonutFeatureExtractor:ee,NougatImageProcessor:et,EfficientNetImageProcessor:X,ViTImageProcessor:W,VitMatteImageProcessor:eo,SamImageProcessor:ei,Swin2SRImageProcessor:ea,Wav2Vec2FeatureExtractor:el,SeamlessM4TFeatureExtractor:eh,SpeechT5FeatureExtractor:ed,ASTFeatureExtractor:ec,ClapFeatureExtractor:eu};static PROCESSOR_CLASS_MAPPING={WhisperProcessor:em,Wav2Vec2ProcessorWithLM:eg,SamProcessor:ep,SpeechT5Processor:e_,OwlViTProcessor:ew};static async from_pretrained(e,{progress_callback:t=null,config:r=null,cache_dir:n=null,local_files_only:i=!1,revision:a="main"}={}){let o=r??await (0,h.wc)(e,"preprocessor_config.json",!0,{progress_callback:t,config:r,cache_dir:n,local_files_only:i,revision:a}),s=o.feature_extractor_type??o.image_processor_type,l=this.FEATURE_EXTRACTOR_CLASS_MAPPING[s];if(!l)if(void 0!==o.size)console.warn(`Feature extractor type "${s}" not found, assuming ImageFeatureExtractor due to size parameter in config.`),l=B;else throw Error(`Unknown Feature Extractor type: ${s}`);return new(this.PROCESSOR_CLASS_MAPPING[o.processor_class]??ef)(new l(o))}}async function eb(e){return Array.isArray(e)||(e=[e]),await Promise.all(e.map(e=>w.read(e)))}async function ev(e,t){return Array.isArray(e)||(e=[e]),await Promise.all(e.map(e=>"string"==typeof e||e instanceof URL?y(e,t):e instanceof Float64Array?new Float32Array(e):e))}function eM(e,t){t&&(e=e.map(e=>0|e));let[r,n,i,a]=e;return{xmin:r,ymin:n,xmax:i,ymax:a}}class ex extends l.bV{constructor({task:e,model:t,tokenizer:r=null,processor:n=null}){super(),this.task=e,this.model=t,this.tokenizer=r,this.processor=n}async dispose(){await this.model.dispose()}}class ek extends ex{constructor(e){super(e)}async _call(e,{topk:t=1}={}){let r=this.tokenizer(e,{padding:!0,truncation:!0}),n=await this.model(r),i="multi_label_classification"===this.model.config.problem_type?e=>e.sigmoid().data:e=>(0,c.Vs)(e.data),a=this.model.config.id2label,o=[];for(let e of n.logits){let r=i(e),n=(0,c.Em)(r,t).map(e=>({label:a[e[0]],score:e[1]}));1===t?o.push(...n):o.push(n)}return Array.isArray(e)||1===t?o:o[0]}}class eE extends ex{constructor(e){super(e)}async _call(e,{ignore_labels:t=["O"]}={}){let r=Array.isArray(e),n=this.tokenizer(r?e:[e],{padding:!0,truncation:!0}),i=(await this.model(n)).logits,a=this.model.config.id2label,o=[];for(let e=0;
1e<i.dims[0];++e){let r=n.input_ids[e],s=i[e],l=[];for(let e=0;e<s.dims[0];++e){let n=s[e],i=(0,c.T9)(n.data)[1],o=a?a[i]:`LABEL_${i}`;if(t.includes(o))continue;let h=this.tokenizer.decode([r[e].item()],{skip_special_tokens:!0});if(""===h)continue;let u=(0,c.Vs)(n.data);l.push({entity:o,score:u[i],index:e,word:h,start:null,end:null})}o.push(l)}return r?o:o[0]}}class eT extends ex{constructor(e){super(e)}async _call(e,t,{topk:r=1}={}){let n=this.tokenizer(e,{text_pair:t,padding:!0,truncation:!0}),i=await this.model(n),a=[];for(let e=0;e<i.start_logits.dims[0];++e){let t=n.input_ids[e],o=t.indexOf(this.tokenizer.sep_token_id),s=Array.from((0,c.Vs)(i.start_logits[e].data)).map((e,t)=>[e,t]).filter(e=>e[1]>o),h=Array.from((0,c.Vs)(i.end_logits[e].data)).map((e,t)=>[e,t]).filter(e=>e[1]>o),u=(0,l.qM)(s,h).filter(e=>e[0][1]<=e[1][1]).map(e=>[e[0][1],e[1][1],e[0][0]*e[1][0]]).sort((e,t)=>t[2]-e[2]);for(let e=0;e<Math.min(u.length,r);++e){let[r,n,i]=u[e],o=[...t].slice(r,n+1),s=this.tokenizer.decode(o,{skip_special_tokens:!0});a.push({answer:s,score:i})}}return 1===r?a[0]:a}}class eC extends ex{constructor(e){super(e)}async _call(e,{topk:t=5}={}){let r=this.tokenizer(e,{padding:!0,truncation:!0}),n=await this.model(r),i=[];for(let e=0;e<r.input_ids.dims[0];++e){let a=r.input_ids[e],o=a.indexOf(this.tokenizer.mask_token_id);if(-1===o)throw Error(`Mask token (${this.tokenizer.mask_token}) not found in text.`);let s=n.logits[e][o],l=(0,c.Em)((0,c.Vs)(s.data),t);i.push(l.map(e=>{let t=[...a];return t[o]=e[0],{score:e[1],token:e[0],token_str:this.tokenizer.model.vocab[e[0]],sequence:this.tokenizer.decode(t,{skip_special_tokens:!0})}}))}return Array.isArray(e)?i:i[0]}}class eA extends ex{_key="generated_text";constructor(e){super(e)}async _call(e,t={}){let r;Array.isArray(e)||(e=[e]),this.model.config.prefix&&(e=e.map(e=>this.model.config.prefix+e));let n=this.model.config.task_specific_params;n&&n[this.task]&&n[this.task].prefix&&(e=e.map(e=>n[this.task].prefix+e));let i=this.tokenizer,a={padding:!0,truncation:!0};r=this instanceof eS&&"_build_translation_inputs"in i?i._build_translation_inputs(e,a,t).input_ids:i(e,a).input_ids;let o=await this.model.generate(r,t);return i.batch_decode(o,{skip_special_tokens:!0}).map(e=>({[this._key]:e}))}}class eF extends eA{_key="summary_text";constructor(e){super(e)}}class eS extends eA{_key="translation_text";constructor(e){super(e)}}function ez(e){return Array.isArray(e)&&e.every(e=>"role"in e&&"content"in e)}class eP extends ex{constructor(e){super(e)}async _call(e,t={}){let r,n,i=!1,a=!1;if("string"==typeof e)r=e=[e];else if(Array.isArray(e)&&e.every(e=>"string"==typeof e))i=!0,r=e;else{if(ez(e))e=[e];else if(Array.isArray(e)&&e.every(ez))i=!0;else throw Error("Input must be a string, an array of strings, a Chat, or an array of Chats");a=!0,r=e.map(e=>this.tokenizer.apply_chat_template(e,{tokenize:!1,add_generation_prompt:!0}))}let o=t.add_special_tokens??!1,s=!a&&(t.return_full_text??!0);this.tokenizer.padding_side="left";let{input_ids:l,attention_mask:h}=this.tokenizer(r,{add_special_tokens:o,padding:!0,truncation:!0}),c=await this.model.generate(l,t,null,{inputs_attention_mask:h}),u=this.tokenizer.batch_decode(c,{skip_special_tokens:!0});!s&&l.dims.at(-1)>0&&(n=this.tokenizer.batch_decode(l,{skip_special_tokens:!0}).map(e=>e.length));let d=Array.from({length:e.length},e=>[]);for(let t=0;t<u.length;++t){let r=Math.floor(t/c.length*e.length);n&&(u[t]=u[t].slice(n[r])),d[r].push({generated_text:a?[...e[r],{role:"assistant",content:u[t]}]:u[t]})}return i||1!==d.length?d:d[0]}}class eI extends ex{constructor(e){super(e),this.label2id=Object.fromEntries(Object.entries(this.model.config.label2id).map(([e,t])=>[e.toLowerCase(),t])),this.entailment_id=this.label2id.entailment,void 0===this.entailment_id&&(console.warn("Could not find 'entailment' in label2id mapping. Using 2 as entailment_id."),this.entailment_id=2),this.contradiction_id=this.label2id.contradiction??this.label2id.not_entailment,void 0===this.contradiction_id&&(console.warn("Could not find 'contradiction' in label2id mapping. Using 0 as contradiction_id."),this.contradiction_id=0)}async _call(e,t,{hypothesis_template:r="This example is {}.",multi_label:n=!1}={}){let i=Array.isArray(e);i||(e=[e]),Array.isArray(t)||(t=[t]);let a=t.map(e=>r.replace("{}",e)),o=n||1===t.length,s=[];for(let r of e){let e=[];for(let t of a){let n=this.tokenizer(r,{text_pair:t,padding:!0,truncation:!0}
1),i=await this.model(n);o?e.push([i.logits.data[this.contradiction_id],i.logits.data[this.entailment_id]]):e.push(i.logits.data[this.entailment_id])}let n=(o?e.map(e=>(0,c.Vs)(e)[1]):(0,c.Vs)(e)).map((e,t)=>[e,t]).sort((e,t)=>t[0]-e[0]);s.push({sequence:r,labels:n.map(e=>t[e[1]]),scores:n.map(e=>e[0])})}return i?s:s[0]}}class eB extends ex{constructor(e){super(e)}async _call(e,{pooling:t="none",normalize:r=!1,quantize:n=!1,precision:i="binary"}={}){let a=this.tokenizer(e,{padding:!0,truncation:!0}),o=await this.model(a),s=o.last_hidden_state??o.logits??o.token_embeddings;if("none"===t);else if("mean"===t)s=(0,u.X7)(s,a.attention_mask);else if("cls"===t)s=s.slice(null,0);else throw Error(`Pooling method '${t}' not supported.`);return r&&(s=s.normalize(2,-1)),n&&(s=(0,u.J)(s,i)),s}}class eO extends ex{constructor(e){super(e)}async _call(e,{pool:t=null}={}){let r,n=await eb(e),{pixel_values:i}=await this.processor(n),a=await this.model({pixel_values:i});if(t){if(!("pooler_output"in a))throw Error("No pooled output was returned. Make sure the model has a 'pooler' layer when using the 'pool' option.");r=a.pooler_output}else r=a.last_hidden_state??a.logits??a.image_embeds;return r}}class eL extends ex{constructor(e){super(e)}async _call(e,{topk:t=null}={}){let r=!Array.isArray(e),n=this.processor.feature_extractor.config.sampling_rate,i=await ev(e,n),a=this.model.config.id2label,o=[];for(let e of i){let r=await this.processor(e),n=(await this.model(r)).logits[0],i=(0,c.Em)((0,c.Vs)(n.data),t).map(e=>({label:a[e[0]],score:e[1]}));1===t?o.push(...i):o.push(i)}return r&&1!==t?o[0]:o}}class e$ extends ex{constructor(e){super(e)}async _call(e,t,{hypothesis_template:r="This is a sound of {}."}={}){let n=!Array.isArray(e);n&&(e=[e]);let i=t.map(e=>r.replace("{}",e)),a=this.tokenizer(i,{padding:!0,truncation:!0}),o=this.processor.feature_extractor.config.sampling_rate,s=await ev(e,o),l=[];for(let e of s){let r=await this.processor(e),n=await this.model({...a,...r}),i=(0,c.Vs)(n.logits_per_audio.data);l.push([...i].map((e,r)=>({score:e,label:t[r]})))}return n?l[0]:l}}class ej extends ex{constructor(e){super(e)}async _call(e,t={}){switch(this.model.config.model_type){case"whisper":return this._call_whisper(e,t);case"wav2vec2":case"wav2vec2-bert":case"unispeech":case"unispeech-sat":case"hubert":return this._call_wav2vec2(e,t);default:throw Error(`AutomaticSpeechRecognitionPipeline does not support model type '${this.model.config.model_type}'.`)}}async _call_wav2vec2(e,t={}){t.language&&console.warn('`language` parameter is not yet supported for `wav2vec2` models, defaulting to "English".'),t.task&&console.warn('`task` parameter is not yet supported for `wav2vec2` models, defaulting to "transcribe".');let r=!Array.isArray(e);r&&(e=[e]);let n=this.processor.feature_extractor.config.sampling_rate,i=await ev(e,n),a=[];for(let e of i){let t=await this.processor(e),r=(await this.model(t)).logits[0],n=[];for(let e of r)n.push((0,c.T9)(e.data)[1]);let i=this.tokenizer.decode(n);a.push({text:i})}return r?a[0]:a}async _call_whisper(e,t={}){let r=t.return_timestamps??!1,n=t.chunk_length_s??0,i=t.chunk_callback??null,a=t.force_full_sequences??!1,o=t.stride_length_s??null;"word"===r&&(t.return_token_timestamps=!0);let s=(0,l.uY)(t,"language",null),h=(0,l.uY)(t,"task",null);if(s||h||r){if(t.forced_decoder_ids)throw Error("Cannot specify `language`/`task`/`return_timestamps` and `forced_decoder_ids` at the same time.");let e=this.tokenizer.get_decoder_prompt_ids({language:s,task:h,no_timestamps:!r});e.length>0&&(t.forced_decoder_ids=e)}let u=!Array.isArray(e);u&&(e=[e]);let d=this.processor.feature_extractor.config.chunk_length/this.model.config.max_source_positions,f=this.processor.feature_extractor.config.hop_length,p=this.processor.feature_extractor.config.sampling_rate,m=await ev(e,p),g=[];for(let e of m){let s=[];if(n>0){if(null===o)o=n/6;else if(n<=o)throw Error("`chunk_length_s` must be larger than `stride_length_s`.");let t=p*n,r=p*o,i=t-2*r,a=0;for(;a<e.length;){let n=e.subarray(a,a+t),o=await this.processor(n),l=0===a,h=a+i>=e.length;s.push({stride:[n.length,l?0:r,h?0:r],input_features:o.input_features,is_last:h}),a+=i}}else s=[{stride:[e.length,0,0],input_features:(await this.processor(e)).input_features,is_last:!0}];for(let e of s){t.num_frames=Math.floor(e.stride[0]/f);let n=await this.model.generate(e.input_features,t);"word"===r?(e.tokens=n.sequences[0],e.token_timestamps=n.token_timestamps.tolist()[0].map(e=>(0,c.LI)(e,2))):e.tokens=n[0],e.stride=e.stride.map(e=>e/p),null!==i&&i(e)}let[l,h]=this.tokenizer._decode_asr(s,{time_precision:d,return_timestamps:r,force_full_sequences:a});g.push({text:l,...h})}return u?g[0]:g}}class eU extends ex{constructor(e){super(e)}async _call(e,t={}){let r=Array.isArray(e),n=await eb(e),{pixel_values:i}=await this.processor(n),a=[];for(let e of i){e.dims=[1,...e.dims];let r=await this.model.generate(e,t),n=this.tokenizer.batch_decode(r,{skip_special_tokens:!0}).map(e=>({generated_text:e.trim()}));a.push(n)}return r?a:a[0]}}class eN extends ex{constructor(e){super(e)}async _call(e,{topk:t=1}={}){let r=Array.isArray(e),n=await eb(e),{pixel_values:i}=await this.processor(n),a=await this.model({pixel_values:i}),o=this.model.config.id2label,s=[];for(let e of a.logits){let r=(0,c.Em)((0,c.Vs)(e.data),t).map(e=>({label:o[e[0]],score:e[1]}));1===t?s.push(...r):s.push(r)}return r||1===t?s:s[0]}}class eR extends ex{constructor(e){super(e),this.subtasks_mapping={panoptic:"post_process_panoptic_segmentation",instance:"post_process_instance_segmentation",semantic:"post_process_semantic_segmentation"}}async _call(e,{threshold:t=.5,mask_threshold:r=.5,overlap_mask_area_threshold:n=.8,label_ids_to_fuse:i=null,target_sizes:a=null,subtask:o=null}={}){if(Array.isArray(e)&&1!==e.length)throw Error("Image segmentation pipeline currently only supports a batch size of 1.");let s=await eb(e),l=s.map(e=>[e.height,e.width]),{pixel_values:h,pixel_mask:c}=await this.processor(s),u=await this.model({pixel_values:h,pixel_mask:c}),d=null;
1if(null!==o)d=this.subtasks_mapping[o];else for(let[e,t]of Object.entries(this.subtasks_mapping))if(t in this.processor.feature_extractor){d=this.processor.feature_extractor[t].bind(this.processor.feature_extractor),o=e;break}let f=this.model.config.id2label,p=[];if("panoptic"===o||"instance"===o){let e=d(u,t,r,n,i,a??l)[0],o=e.segmentation;for(let t of e.segments_info){let e=new Uint8ClampedArray(o.data.length);for(let r=0;r<o.data.length;++r)o.data[r]===t.id&&(e[r]=255);let r=new w(e,o.dims[1],o.dims[0],1);p.push({score:t.score,label:f[t.label_id],mask:r})}}else if("semantic"===o){let{segmentation:e,labels:t}=d(u,a??l)[0];for(let r of t){let t=new Uint8ClampedArray(e.data.length);for(let n=0;n<e.data.length;++n)e.data[n]===r&&(t[n]=255);let n=new w(t,e.dims[1],e.dims[0],1);p.push({score:null,label:f[r],mask:n})}}else throw Error(`Subtask ${o} not supported.`);return p}}class eV extends ex{constructor(e){super(e)}async _call(e,t,{hypothesis_template:r="This is a photo of {}"}={}){let n=Array.isArray(e),i=await eb(e),a=t.map(e=>r.replace("{}",e)),o=this.tokenizer(a,{padding:"siglip"!==this.model.config.model_type||"max_length",truncation:!0}),{pixel_values:s}=await this.processor(i),l=await this.model({...o,pixel_values:s}),h="siglip"===this.model.config.model_type?e=>e.sigmoid().data:e=>(0,c.Vs)(e.data),u=[];for(let e of l.logits_per_image){let r=[...h(e)].map((e,r)=>({score:e,label:t[r]}));r.sort((e,t)=>t.score-e.score),u.push(r)}return n?u:u[0]}}class eq extends ex{constructor(e){super(e)}async _call(e,{threshold:t=.9,percentage:r=!1}={}){let n=Array.isArray(e);if(n&&1!==e.length)throw Error("Object detection pipeline currently only supports a batch size of 1.");let i=await eb(e),a=r?null:i.map(e=>[e.height,e.width]),{pixel_values:o,pixel_mask:s}=await this.processor(i),l=await this.model({pixel_values:o,pixel_mask:s}),h=this.processor.feature_extractor.post_process_object_detection(l,t,a),c=this.model.config.id2label,u=h.map(e=>e.boxes.map((t,n)=>({score:e.scores[n],label:c[e.classes[n]],box:eM(t,!r)})));return n?u:u[0]}}class eD extends ex{constructor(e){super(e)}async _call(e,t,{threshold:r=.1,topk:n=null,percentage:i=!1}={}){let a=Array.isArray(e),o=await eb(e),s=this.tokenizer(t,{padding:!0,truncation:!0}),l=await this.processor(o),h=[];for(let e=0;e<o.length;++e){let a=o[e],c=i?null:[[a.height,a.width]],u=l.pixel_values[e].unsqueeze_(0),d=await this.model({...s,pixel_values:u}),f=this.processor.feature_extractor.post_process_object_detection(d,r,c,!0)[0],p=f.boxes.map((e,r)=>({score:f.scores[r],label:t[f.classes[r]],box:eM(e,!i)})).sort((e,t)=>t.score-e.score);null!==n&&(p=p.slice(0,n)),h.push(p)}return a?h:h[0]}}class eG extends ex{constructor(e){super(e)}async _call(e,t,r={}){let n=(await eb(e))[0],{pixel_values:i}=await this.processor(n),a=`<s_docvqa><s_question>${t}</s_question><s_answer>`,o=this.tokenizer(a,{add_special_tokens:!1,padding:!0,truncation:!0}).input_ids,s=await this.model.generate(i,{...r,decoder_input_ids:o,max_length:this.model.config.decoder.max_position_embeddings}),l=this.tokenizer.batch_decode(s)[0].match(/<s_answer>(.*?)<\/s_answer>/),h=null;return l&&l.length>=2&&(h=l[1].trim()),[{answer:h}]}}class eW extends ex{DEFAULT_VOCODER_ID="Xenova/speecht5_hifigan";constructor(e){super(e),this.vocoder=e.vocoder??null}async _call(e,{speaker_embeddings:t=null}={}){return this.processor?this._call_text_to_spectrogram(e,{speaker_embeddings:t}):this._call_text_to_waveform(e)}async _call_text_to_waveform(e){let t=this.tokenizer(e,{padding:!0,truncation:!0}),{waveform:r}=await this.model(t),n=this.model.config.sampling_rate;return{audio:r.data,sampling_rate:n}}async _call_text_to_spectrogram(e,{speaker_embeddings:t}){if(this.vocoder||(console.log("No vocoder specified, using default HifiGan vocoder."),this.vocoder=await s.rKH.from_pretrained(this.DEFAULT_VOCODER_ID,{quantized:!1})),("string"==typeof t||t instanceof URL)&&(t=new Float32Array(await (await fetch(t)).arrayBuffer())),t instanceof Float32Array)t=new u.qY("float32",t,[1,t.length]);else if(!(t instanceof u.qY))throw Error("Speaker embeddings must be a `Tensor`, `Float32Array`, `string`, or `URL`.");let{input_ids:r}=this.tokenizer(e,{padding:!0,truncation:!0}
1),{waveform:n}=await this.model.generate_speech(r,t,{vocoder:this.vocoder}),i=this.processor.feature_extractor.config.sampling_rate;return{audio:n.data,sampling_rate:i}}}class eX extends ex{constructor(e){super(e)}async _call(e){let t=await eb(e),r=await this.processor(t),n=await this.model(r),i=[];for(let e of n.reconstruction){let t=e.squeeze().clamp_(0,1).mul_(255).round_().to("uint8");i.push(w.fromTensor(t))}return i.length>1?i:i[0]}}class eH extends ex{constructor(e){super(e)}async _call(e){let t=await eb(e),r=await this.processor(t),{predicted_depth:n}=await this.model(r),i=[];for(let e=0;e<t.length;++e){let r=(0,u.GW)(n[e],t[e].size.reverse(),"bilinear",!1),a=r.mul_(255/(0,c.T9)(r.data)[0]).to("uint8");i.push({predicted_depth:n[e],depth:w.fromTensor(a)})}return i.length>1?i:i[0]}}let eY=Object.freeze({"text-classification":{tokenizer:o.v6,pipeline:ek,model:s.jQR,default:{model:"Xenova/distilbert-base-uncased-finetuned-sst-2-english"},type:"text"},"token-classification":{tokenizer:o.v6,pipeline:eE,model:s.TUv,default:{model:"Xenova/bert-base-multilingual-cased-ner-hrl"},type:"text"},"question-answering":{tokenizer:o.v6,pipeline:eT,model:s.yGT,default:{model:"Xenova/distilbert-base-cased-distilled-squad"},type:"text"},"fill-mask":{tokenizer:o.v6,pipeline:eC,model:s.wju,default:{model:"Xenova/bert-base-uncased"},type:"text"},summarization:{tokenizer:o.v6,pipeline:eF,model:s.BRf,default:{model:"Xenova/distilbart-cnn-6-6"},type:"text"},translation:{tokenizer:o.v6,pipeline:eS,model:s.BRf,default:{model:"Xenova/t5-small"},type:"text"},"text2text-generation":{tokenizer:o.v6,pipeline:eA,model:s.BRf,default:{model:"Xenova/flan-t5-small"},type:"text"},"text-generation":{tokenizer:o.v6,pipeline:eP,model:s.W6E,default:{model:"Xenova/gpt2"},type:"text"},"zero-shot-classification":{tokenizer:o.v6,pipeline:eI,model:s.jQR,default:{model:"Xenova/distilbert-base-uncased-mnli"},type:"text"},"audio-classification":{pipeline:eL,model:s.m68,processor:ey,default:{model:"Xenova/wav2vec2-base-superb-ks"},type:"audio"},"zero-shot-audio-classification":{tokenizer:o.v6,pipeline:e$,model:s.rKH,processor:ey,default:{model:"Xenova/clap-htsat-unfused"},type:"multimodal"},"automatic-speech-recognition":{tokenizer:o.v6,pipeline:ej,model:[s.MOY,s._TZ],processor:ey,default:{model:"Xenova/whisper-tiny.en"},type:"multimodal"},"text-to-audio":{tokenizer:o.v6,pipeline:eW,model:[s.V9g,s.ZIt],processor:[ey,null],default:{model:"Xenova/speecht5_tts"},type:"text"},"image-to-text":{tokenizer:o.v6,pipeline:eU,model:s.db0,processor:ey,default:{model:"Xenova/vit-gpt2-image-captioning"},type:"multimodal"},"image-classification":{pipeline:eN,model:s.JP3,processor:ey,default:{model:"Xenova/vit-base-patch16-224"},type:"multimodal"},"image-segmentation":{pipeline:eR,model:[s.vTA,s.wrZ],processor:ey,default:{model:"Xenova/detr-resnet-50-panoptic"},type:"multimodal"},"zero-shot-image-classification":{tokenizer:o.v6,pipeline:eV,model:s.rKH,processor:ey,default:{model:"Xenova/clip-vit-base-patch32"},type:"multimodal"},"object-detection":{pipeline:eq,model:s.Yd3,processor:ey,default:{model:"Xenova/detr-resnet-50"},type:"multimodal"},"zero-shot-object-detection":{tokenizer:o.v6,pipeline:eD,model:s.gqD,processor:ey,default:{model:"Xenova/owlvit-base-patch32"},type:"multimodal"},"document-question-answering":{tokenizer:o.v6,pipeline:eG,model:s.nuw,processor:ey,default:{model:"Xenova/donut-base-finetuned-docvqa"},type:"multimodal"},"image-to-image":{pipeline:eX,model:s.FJW,processor:ey,default:{model:"Xenova/swin2SR-classical-sr-x2-64"},type:"image"},"depth-estimation":{pipeline:eH,model:s.QNG,processor:ey,default:{model:"Xenova/dpt-large"},type:"image"},"feature-extraction":{tokenizer:o.v6,pipeline:eB,model:s.rKH,default:{model:"Xenova/all-MiniLM-L6-v2"},type:"text"},"image-feature-extraction":{processor:ey,pipeline:eO,model:[s.w0O,s.rKH],default:{model:"Xenova/vit-base-patch16-224-in21k"},type:"image"}}),eQ=Object.freeze({"sentiment-analysis":"text-classification",ner:"token-classification",asr:"automatic-speech-recognition","text-to-speech":"text-to-audio",embeddings:"feature-extraction"});async function eK(e,t=null,{quantized:r=!0,progress_callback:n=null,config:i=null,cache_dir:a=null,local_files_only:o=!1,revision:s="main",model_file_name:h=null}={}){let c=eY[(e=eQ[e]??e).split("_",1)[0]];if(!c)throw Error(`Unsupported pipeline: ${e}. Must be one of [${Object.keys(eY)}]`);t||(t=c.default.model,console.log(`No model specified. Using default model: "${t}".`));let u=new Map([["tokenizer",c.tokenizer],["model",c.model],["processor",c.processor]]),d=await eJ(u,t,{quantized:r,progress_callback:n,config:i,cache_dir:a,local_files_only:o,revision:s,model_file_name:h});return d.task=e,(0,l._e)(n,{status:"ready",task:e,model:t}),new c.pipeline(d)}async function eJ(e,t,r){let n=Object.create(null),i=[];for(let[a,o]of e.entries()){let e;o&&(e=Array.isArray(o)?new Promise(async(e,n)=>{let i;for(let n of o){if(null===n)return void e(null);try{e(await n.from_pretrained(t,r));return}catch(e){i=e}}n(i)}):o.from_pretrained(t,r),n[a]=e,i.push(e))}for(let[e,t]of(await Promise.all(i),Object.entries(n)))n[e]=await t;return n}var eZ=r(53437)},50513:(e,t,r)=>{"use strict";r.d(t,{Ah:()=>o,Mr:()=>n,N_:()=>i});
1class n{constructor(e=(e,t)=>e>t){this._heap=[],this._comparator=e}get size(){return this._heap.length}isEmpty(){return 0===this.size}peek(){return this._heap[0]}push(...e){return this.extend(e)}extend(e){for(let t of e)this._heap.push(t),this._siftUp();return this.size}pop(){let e=this.peek(),t=this.size-1;return t>0&&this._swap(0,t),this._heap.pop(),this._siftDown(),e}replace(e){let t=this.peek();return this._heap[0]=e,this._siftDown(),t}_parent(e){return(e+1>>>1)-1}_left(e){return(e<<1)+1}_right(e){return e+1<<1}_greater(e,t){return this._comparator(this._heap[e],this._heap[t])}_swap(e,t){let r=this._heap[e];this._heap[e]=this._heap[t],this._heap[t]=r}_siftUp(){let e=this.size-1;for(;e>0&&this._greater(e,this._parent(e));)this._swap(e,this._parent(e)),e=this._parent(e)}_siftDown(){let e=0;for(;this._left(e)<this.size&&this._greater(this._left(e),e)||this._right(e)<this.size&&this._greater(this._right(e),e);){let t=this._right(e)<this.size&&this._greater(this._right(e),this._left(e))?this._right(e):this._left(e);this._swap(e,t),e=t}}}class i{constructor(){this.root=a.default()}extend(e){for(let t of e)this.push(t)}push(e){let t=this.root;for(let r of e){let e=t.children.get(r);void 0===e&&(e=a.default(),t.children.set(r,e)),t=e}t.isLeaf=!0}*commonPrefixSearch(e){let t=this.root,r="";for(let n=0;n<e.length&&void 0!==t;++n){let i=e[n];r+=i,void 0!==(t=t.children.get(i))&&t.isLeaf&&(yield r)}}}class a{constructor(e,t){this.isLeaf=e,this.children=t}static default(){return new a(!1,new Map)}}class o{constructor(e,t,r){this.sentence=e,this.len=e.length,this.bosTokenId=t,this.eosTokenId=r,this.nodes=[],this.beginNodes=Array.from({length:this.len+1},()=>[]),this.endNodes=Array.from({length:this.len+1},()=>[]);let n=new s(this.bosTokenId,0,0,0,0),i=new s(this.eosTokenId,1,this.len,0,0);this.nodes.push(n.clone()),this.nodes.push(i.clone()),this.beginNodes[this.len].push(i),this.endNodes[0].push(n)}insert(e,t,r,n){let i=new s(n,this.nodes.length,e,t,r);this.beginNodes[e].push(i),this.endNodes[e+t].push(i),this.nodes.push(i)}viterbi(){let e=this.len,t=0;for(;t<=e;){if(0==this.beginNodes[t].length)return[];for(let e of this.beginNodes[t]){e.prev=null;let r=0,n=null;for(let i of this.endNodes[t]){let t=i.backtraceScore+e.score;(null===n||t>r)&&(n=i.clone(),r=t)}if(null===n)return[];e.prev=n,e.backtraceScore=r}++t}let r=[],n=this.beginNodes[e][0].prev;if(null===n)return[];let i=n.clone();for(;null!==i.prev;)r.push(i.clone()),i=i.clone().prev.clone();return r.reverse(),r}piece(e){return this.sentence.slice(e.pos,e.pos+e.length)}tokens(){return this.viterbi().map(e=>this.piece(e))}tokenIds(){return this.viterbi().map(e=>e.tokenId)}}class s{constructor(e,t,r,n,i){this.tokenId=e,this.nodeId=t,this.pos=r,this.length=n,this.score=i,this.prev=null,this.backtraceScore=0}clone(){let e=new s(this.tokenId,this.nodeId,this.pos,this.length,this.score);return e.prev=this.prev,e.backtraceScore=this.backtraceScore,e}}},53437:(e,t,r)=>{"use strict";r.d(t,{E:()=>o,T:()=>a});var n=r(61463);async function i(e,t){return await (0,n.wc)(e,"config.json",!0,t)}class a{constructor(e){this.model_type=null,this.is_encoder_decoder=!1,Object.assign(this,e)}static async from_pretrained(e,{progress_callback:t=null,config:r=null,cache_dir:n=null,local_files_only:a=!1,revision:o="main"}={}){return new this(r??await i(e,{progress_callback:t,config:r,cache_dir:n,local_files_only:a,revision:o}))}}class o{static async from_pretrained(...e){return a.from_pretrained(...e)}}},59221:(e,t,r)=>{"use strict";r.d(t,{$q:()=>m,$y:()=>y,GW:()=>h,J:()=>M,Ny:()=>l,S:()=>b,X7:()=>c,cQ:()=>_,i2:()=>w,l8:()=>u,oC:()=>v,qY:()=>s,t$:()=>g});var n=r(13655),i=r(30519);let a=Object.freeze({float32:Float32Array,float64:Float64Array,string:Array,int8:Int8Array,uint8:Uint8Array,int16:Int16Array,uint16:Uint16Array,int32:Int32Array,uint32:Uint32Array,int64:BigInt64Array,uint64:BigUint64Array,bool:Uint8Array}),o=n.M.Tensor;class s{dims;type;data;size;constructor(...e){return e[0]instanceof o?Object.assign(this,e[0]):Object.assign(this,new o(e[0],e[1],e[2])),new Proxy(this,{get:(e,t)=>{if("string"==typeof t){let r=Number(t);if(Number.isInteger(r))return e._getitem(r)}return e[t]},set:(e,t,r)=>e[t]=r})}*[Symbol.iterator](){let[e,...t]=this.dims;if(t.length>0){let r=t.reduce((e,t)=>
1e*t);for(let n=0;n<e;++n)yield this._subarray(n,r,t)}else yield*this.data}_getitem(e){let[t,...r]=this.dims;if(e=p(e,t),!(r.length>0))return new s(this.type,[this.data[e]],r);{let t=r.reduce((e,t)=>e*t);return this._subarray(e,t,r)}}indexOf(e){for(let t=0;t<this.data.length;++t)if(this.data[t]==e)return t;return -1}_subarray(e,t,r){let n=e*t,i=(e+1)*t,a="subarray"in this.data?this.data.subarray(n,i):this.data.slice(n,i);return new s(this.type,a,r)}item(){if(1!==this.data.length)throw Error(`a Tensor with ${this.data.length} elements cannot be converted to Scalar`);return this.data[0]}tolist(){return function(e,t){let r=e.length;if(r!==t.reduce((e,t)=>e*t))throw Error(`cannot reshape array of size ${r} into shape (${t})`);let n=e;for(let e=t.length-1;e>=0;e--)n=n.reduce((r,n)=>{let i=r[r.length-1];return i.length<t[e]?i.push(n):r.push([n]),r},[[]]);return n[0]}(this.data,this.dims)}sigmoid(){return this.clone().sigmoid_()}sigmoid_(){for(let e=0;e<this.data.length;++e)this.data[e]=1/(1+Math.exp(-this.data[e]));return this}mul(e){return this.clone().mul_(e)}mul_(e){for(let t=0;t<this.data.length;++t)this.data[t]*=e;return this}add(e){return this.clone().add_(e)}add_(e){for(let t=0;t<this.data.length;++t)this.data[t]+=e;return this}clone(){return new s(this.type,this.data.slice(),this.dims.slice())}slice(...e){let t=[],r=[];for(let n=0;n<this.dims.length;++n){let i=e[n];if(null==i)r.push([0,this.dims[n]]),t.push(this.dims[n]);else if("number"==typeof i)i=p(i,this.dims[n],n),r.push([i,i+1]);else if(Array.isArray(i)&&2===i.length){if(i[0]>i[1])throw Error(`Invalid slice: ${i}`);let e=[Math.max(i[0],0),Math.min(i[1],this.dims[n])];
1r.push(e),t.push(e[1]-e[0])}else throw Error(`Invalid slice: ${i}`)}let n=r.map(([e,t])=>t-e),i=n.reduce((e,t)=>e*t),a=new this.data.constructor(i),o=this.stride();for(let e=0;e<i;++e){let t=0;for(let i=n.length-1,a=e;i>=0;--i){let e=n[i];t+=(a%e+r[i][0])*o[i],a=Math.floor(a/e)}a[e]=this.data[t]}return new s(this.type,a,t)}permute(...e){return l(this,e)}transpose(...e){return this.permute(...e)}sum(e=null,t=!1){return this.norm(1,e,t)}norm(e="fro",t=null,r=!1){if("fro"===e)e=2;else if("string"==typeof e)throw Error(`Unsupported norm: ${e}`);if(null===t){let t=this.data.reduce((t,r)=>t+r**e,0)**(1/e);return new s(this.type,[t],[])}t=p(t,this.dims.length);let n=this.dims.slice();n[t]=1;let i=new this.data.constructor(this.data.length/this.dims[t]);for(let r=0;r<this.data.length;++r){let a=0;for(let e=this.dims.length-1,i=r,o=1;e>=0;--e){let r=this.dims[e];e!==t&&(a+=i%r*o,o*=n[e]),i=Math.floor(i/r)}i[a]+=this.data[r]**e}if(1!==e)for(let t=0;t<i.length;++t)i[t]=i[t]**(1/e);return r||n.splice(t,1),new s(this.type,i,n)}normalize_(e=2,t=1){t=p(t,this.dims.length);let r=this.norm(e,t,!0);for(let e=0;e<this.data.length;++e){let n=0;for(let r=this.dims.length-1,i=e,a=1;r>=0;--r){let e=this.dims[r];r!==t&&(n+=i%e*a,a*=this.dims[r]),i=Math.floor(i/e)}this.data[e]/=r.data[n]}return this}normalize(e=2,t=1){return this.clone().normalize_(e,t)}stride(){return function(e){let t=Array(e.length);for(let r=e.length-1,n=1;r>=0;--r)t[r]=n,n*=e[r];return t}(this.dims)}squeeze(e=null){return new s(this.type,this.data,d(this.dims,e))}squeeze_(e=null){return this.dims=d(this.dims,e),this}unsqueeze(e=null){return new s(this.type,this.data,f(this.dims,e))}unsqueeze_(e=null){return this.dims=f(this.dims,e),this}flatten_(e=0,t=-1){t=(t+this.dims.length)%this.dims.length;let r=this.dims.slice(0,e),n=this.dims.slice(e,t+1),i=this.dims.slice(t+1);return this.dims=[...r,n.reduce((e,t)=>e*t,1),...i],this}flatten(e=0,t=-1){return this.clone().flatten_(e,t)}view(...e){let t=-1;for(let r=0;r<e.length;++r)if(-1===e[r]){if(-1!==t)throw Error("Only one dimension can be inferred");t=r}if(-1!==t){let r=e.reduce((e,r,n)=>n!==t?e*r:e,1);e[t]=this.data.length/r}return new s(this.type,this.data,e)}neg_(){for(let e=0;e<this.data.length;++e)this.data[e]=-this.data[e];return this}neg(){return this.clone().neg_()}clamp_(e,t){for(let r=0;r<this.data.length;++r)this.data[r]=Math.min(Math.max(this.data[r],e),t);return this}clamp(e,t){return this.clone().clamp_(e,t)}round_(){for(let e=0;e<this.data.length;++e)this.data[e]=Math.round(this.data[e]);return this}round(){return this.clone().round_()}to(e){if(this.type===e)return this;if(!a.hasOwnProperty(e))throw Error(`Unsupported type: ${e}`);return new s(e,a[e].from(this.data),this.dims)}}function l(e,t){let[r,n]=(0,i.SX)(e.data,e.dims,t);return new s(e.type,r,n)}function h(e,[t,r],n="bilinear",a=!1){let o=e.dims.at(-3)??1,l=e.dims.at(-2),c=e.dims.at(-1),u=(0,i.vd)(e.data,[o,l,c],[t,r],n,a);return new s(e.type,u,[o,t,r])}function c(e,t){let r=[e.dims[0],e.dims[2]],n=new e.data.constructor(r[0]*r[1]),[i,a,o]=e.dims,l=0;for(let r=0;r<i;++r){let i=r*o*a;for(let s=0;s<o;++s){let h=0,c=0,u=r*a,d=i+s;for(let r=0;r<a;++r){let n=Number(t.data[u+r]);c+=n,h+=e.data[d+r*o]*n}let f=h/c;n[l++]=f}}return new s(e.type,n,r)}function u(e,t,{eps:r=1e-5}={}){if(2!==e.dims.length)throw Error("`layer_norm` currently only supports 2D input.");let[n,i]=e.dims;if(1!==t.length&&t[0]!==i)throw Error("`normalized_shape` must be a 1D array with shape `[input.dims[1]]`.");let[a,o]=_(e,1,0,!0),l=new e.data.constructor(e.data.length);for(let t=0;t<n;++t){let n=t*i;for(let s=0;s<i;++s){let i=n+s;l[i]=(e.data[i]-o.data[t])/(a.data[t]+r)}}return new s(e.type,l,e.dims)}function d(e,t){return e=e.slice(),null===t?e=e.filter(e=>1!==e):"number"==typeof t?1===e[t]&&e.splice(t,1):Array.isArray(t)&&(e=e.filter((e,r)=>1!==e||!t.includes(r))),e}function f(e,t){return t=p(t,e.length+1),(e=e.slice()).splice(t,0,1),e}function p(e,t,r=null){if(e<-t||e>=t)throw Error(`IndexError: index ${e} is out of bounds for dimension${null===r?"":" "+r} with size ${t}`);return e<0&&(e=(e%t+t)%t),e}function m(e,t=0){t=p(t,e[0].dims.length);let r=e[0].dims.slice();r[t]=e.reduce((e,r)=>e+r.dims[t],0);let n=r.reduce((e,t)=>
1e*t,1),i=new e[0].data.constructor(n),a=e[0].type;if(0===t){let t=0;for(let r of e)i.set(r.data,t),t+=r.data.length}else{let n=0;for(let a=0;a<e.length;++a){let o=e[a];for(let e=0;e<o.data.length;++e){let a=0;for(let i=o.dims.length-1,s=e,l=1;i>=0;--i){let e=o.dims[i],h=s%e;i===t&&(h+=n),a+=h*l,l*=r[i],s=Math.floor(s/e)}i[a]=o.data[e]}n+=o.dims[t]}}return new s(a,i,r)}function g(e,t=0){return m(e.map(e=>e.unsqueeze(t)),t)}function _(e,t=null,r=1,n=!1){if(null===t){let t=e.data.reduce((e,t)=>e+t,0)/e.data.length,n=Math.sqrt(e.data.reduce((e,r)=>e+(r-t)**2,0)/(e.data.length-r)),i=new s(e.type,[t],[]);return[new s(e.type,[n],[]),i]}t=p(t,e.dims.length);let i=w(e,t,n),a=e.dims.slice();a[t]=1;let o=new e.data.constructor(e.data.length/e.dims[t]);for(let r=0;r<e.data.length;++r){let n=0;for(let i=e.dims.length-1,o=r,s=1;i>=0;--i){let r=e.dims[i];i!==t&&(n+=o%r*s,s*=a[i]),o=Math.floor(o/r)}o[n]+=(e.data[r]-i.data[n])**2}for(let n=0;n<o.length;++n)o[n]=Math.sqrt(o[n]/(e.dims[t]-r));return n||a.splice(t,1),[new s(e.type,o,a),i]}function w(e,t=null,r=!1){if(null===t){let t=e.data.reduce((e,t)=>e+t,0);return new s(e.type,[t/e.data.length],[])}t=p(t,e.dims.length);let n=e.dims.slice();n[t]=1;let i=new e.data.constructor(e.data.length/e.dims[t]);for(let r=0;r<e.data.length;++r){let a=0;for(let i=e.dims.length-1,o=r,s=1;i>=0;--i){let r=e.dims[i];i!==t&&(a+=o%r*s,s*=n[i]),o=Math.floor(o/r)}i[a]+=e.data[r]}if(1!==e.dims[t])for(let r=0;r<i.length;++r)i[r]=i[r]/e.dims[t];return r||n.splice(t,1),new s(e.type,i,n)}function y(e){let[t,r]=e.dims,n=[t+1,r+1],i=new s("float32",new Float32Array(n[0]*n[1]).fill(1/0),n),a=new s("float32",new Float32Array(n[0]*n[1]).fill(-1),n);i[0].data[0]=0;for(let n=1;n<r+1;++n)for(let r=1;r<t+1;++r){let t,o,s=i[r-1][n-1].item(),l=i[r-1][n].item(),h=i[r][n-1].item();s<l&&s<h?(t=s,o=0):l<s&&l<h?(t=l,o=1):(t=h,o=2),i[r].data[n]=e[r-1][n-1].item()+t,a[r].data[n]=o}let o=t,l=r;a.data.fill(2,0,n[1]);for(let e=0;e<n[0];++e)a[e].data[0]=1;let h=[],c=[];for(;o>0||l>0;)switch(h.push(o-1),c.push(l-1),a[o][l].item()){case 0:--o,--l;break;case 1:--o;break;case 2:--l;break;default:throw Error(`Internal error in dynamic time warping. Unexpected trace[${o}, ${l}]. Please file a bug report.`)}return h.reverse(),c.reverse(),[h,c]}function b(e){return new s("int64",new BigInt64Array(e.reduce((e,t)=>e*t,1)).fill(1n),e)}function v(e){return b(e.dims)}function M(e,t){if(2!==e.dims.length)throw Error("The tensor must have 2 dimensions");if(e.dims.at(-1)%8!=0)throw Error("The last dimension of the tensor must be a multiple of 8");if(!["binary","ubinary"].includes(t))throw Error("The precision must be either 'binary' or 'ubinary'");
1let r="binary"===t,n=r?Int8Array:Uint8Array,i=e.data,a=new n(i.length/8);for(let e=0;e<i.length;++e){let t=+(i[e]>0),n=Math.floor(e/8),o=e%8;a[n]|=t<<7-o,r&&0===o&&(a[n]-=128)}return new s(r?"int8":"uint8",a,[e.dims[0],e.dims[1]/8])}},59726:(e,t,r)=>{"use strict";r.d(t,{Fg:()=>u,Fq:()=>_,LC:()=>w,S3:()=>c,SP:()=>g,VT:()=>a,Y8:()=>d,hK:()=>f,kU:()=>s,pe:()=>p,uB:()=>h,zM:()=>l,z_:()=>m}),r(59221);var n=r(3835),i=r(30519);class a extends n.bV{constructor(){super(),this.processors=[]}push(e){this.processors.push(e)}extend(e){this.processors.push(...e)}_call(e,t){for(let r of t)this.processors.forEach(t=>t(e,r))}[Symbol.iterator](){return this.processors.values()}}class o extends n.bV{_call(e,t){throw Error("`_call` should be implemented in a subclass")}}class s extends o{constructor(e){super(),this.force_token_map=Object.fromEntries(e??[])}_call(e,t){let r=this.force_token_map[e.length];return(0,n.t2)(r)&&(t.data.fill(-1/0),t.data[r]=0),t}}class l extends o{constructor(e){super(),this.bos_token_id=e}_call(e,t){return 1===e.length&&(t.data.fill(-1/0),t.data[this.bos_token_id]=0),t}}class h extends o{constructor(e,t){super(),this.max_length=e,this.forced_eos_token_id=t}_call(e,t){}}class c extends o{constructor(e,t){super(),this.begin_suppress_tokens=e,this.begin_index=t}_call(e,t){if(e.length===this.begin_index)for(let e of this.begin_suppress_tokens)t.data[e]=-1/0;return t}}class u extends o{constructor(e){super(),this.eos_token_id=e.eos_token_id,this.no_timestamps_token_id=e.no_timestamps_token_id,this.timestamp_begin=this.no_timestamps_token_id+1,this.begin_index=(e.forced_decoder_ids||[]).length+2,e.forced_decoder_ids.slice(-1)[0][1]===this.no_timestamps_token_id&&(this.begin_index-=1),this.max_initial_timestamp_index=e.max_initial_timestamp_index}_call(e,t){let r=t.data;if(r[this.no_timestamps_token_id]=-1/0,e.length===this.begin_index-1)return r.fill(-1/0),r[this.timestamp_begin]=0,t;let n=e.slice(this.begin_index),a=n.length>=1&&n[n.length-1]>=this.timestamp_begin,o=n.length<2||n[n.length-2]>=this.timestamp_begin;if(a&&(o?r.subarray(this.timestamp_begin).fill(-1/0):r.subarray(0,this.eos_token_id).fill(-1/0)),e.length===this.begin_index&&null!==this.max_initial_timestamp_index){let e=this.timestamp_begin+this.max_initial_timestamp_index;r.subarray(e+1).fill(-1/0)}let s=(0,i.CM)(r);return Math.log(s.subarray(this.timestamp_begin).map(Math.exp).reduce((e,t)=>e+t))>(0,i.T9)(s.subarray(0,this.timestamp_begin))[0]&&r.subarray(0,this.timestamp_begin).fill(-1/0),t}}class d extends o{constructor(e){super(),this.no_repeat_ngram_size=e}getNgrams(e){let t=e.length,r=[];for(let n=0;n<t+1-this.no_repeat_ngram_size;++n){let t=[];for(let r=0;r<this.no_repeat_ngram_size;++r)t.push(e[n+r]);r.push(t)}let n=new Map;for(let e of r){let t=JSON.stringify(e.slice(0,e.length-1)),r=n.get(t)??[];r.push(e[e.length-1]),n.set(t,r)}return n}getGeneratedNgrams(e,t){let r=t.slice(t.length+1-this.no_repeat_ngram_size,t.length);return e.get(JSON.stringify(r))??[]}calcBannedNgramTokens(e){if(e.length+1<this.no_repeat_ngram_size)return[];{let t=this.getNgrams(e);return this.getGeneratedNgrams(t,e)}}_call(e,t){for(let r of this.calcBannedNgramTokens(e))t.data[r]=-1/0;return t}}class f extends o{constructor(e){super(),this.penalty=e}_call(e,t){for(let r of e)t.data[r]<0?t.data[r]*=this.penalty:t.data[r]/=this.penalty;return t}}class p extends o{constructor(e,t){super(),this.min_length=e,this.eos_token_id=Array.isArray(t)?t:[t]}_call(e,t){if(e.length<this.min_length)for(let e of this.eos_token_id)t.data[e]=-1/0;return t}}class m extends o{constructor(e,t,r){super(),this.prompt_length_to_skip=e,this.min_new_tokens=t,this.eos_token_id=Array.isArray(r)?r:[r]}_call(e,t){if(e.length-this.prompt_length_to_skip<this.min_new_tokens)for(let e of this.eos_token_id)t.data[e]=-1/0;return t}}class g extends o{constructor(e,t){super(),this.bad_words_ids=e,this.eos_token_id=Array.isArray(t)?t:[t]}_call(e,t){for(let r of this.bad_words_ids){let n=!0;for(let t=1;t<=r.length-1&&r.length<e.length;++t)if(r.at(-t-1)!==e.at(-t)){n=!1;break}n&&(t.data[r.at(-1)]=-1/0)}return t}}let _=class{constructor(e={}){this.max_length=e.max_length??20,this.max_new_tokens=e.max_new_tokens??null,this.min_length=e.min_length??0,this.min_new_tokens=e.min_new_tokens??null,this.early_stopping=e.early_stopping??!1,this.max_time=e.max_time??null,this.do_sample=e.do_sample??!1,this.num_beams=e.num_beams??1,this.num_beam_groups=e.num_beam_groups??1,this.penalty_alpha=e.penalty_alpha??null,this.use_cache=e.use_cache??!0,this.temperature=e.temperature??1,this.top_k=e.top_k??50,this.top_p=e.top_p??1,this.typical_p=e.typical_p??1,this.epsilon_cutoff=e.epsilon_cutoff??0,this.eta_cutoff=e.eta_cutoff??0,this.diversity_penalty=e.diversity_penalty??0,this.repetition_penalty=e.repetition_penalty??1,this.encoder_repetition_penalty=e.encoder_repetition_penalty??1,this.length_penalty=e.length_penalty??1,this.no_repeat_ngram_size=e.no_repeat_ngram_size??0,this.bad_words_ids=e.bad_words_ids??null,this.force_words_ids=e.force_words_ids??null,this.renormalize_logits=e.renormalize_logits??!1,this.constraints=e.constraints??null,this.forced_bos_token_id=e.forced_bos_token_id??null,this.forced_eos_token_id=e.forced_eos_token_id??null,this.remove_invalid_values=e.remove_invalid_values??!1,this.exponential_decay_length_penalty=e.exponential_decay_length_penalty??null,this.suppress_tokens=e.suppress_tokens??null,this.begin_suppress_tokens=e.begin_suppress_tokens??null,this.forced_decoder_ids=e.forced_decoder_ids??null,this.num_return_sequences=e.num_return_sequences??1,this.output_attentions=e.output_attentions??!1,this.output_hidden_states=e.output_hidden_states??!1,this.output_scores=e.output_scores??!1,this.return_dict_in_generate=e.return_dict_in_generate??!1,this.pad_token_id=e.pad_token_id??null,this.bos_token_id=e.bos_token_id??null,this.eos_token_id=e.eos_token_id??null,this.encoder_no_repeat_ngram_size=e.encoder_no_repeat_ngram_size??0,this.decoder_start_token_id=e.decoder_start_token_id??null,this.generation_kwargs=e.generation_kwargs??{}}};class w extends n.bV{constructor(e){super(),this.generation_config=e}_call(e,t=-1){return this.sample(e,t)}sample(e,t){throw Error("sample should be implemented in subclasses.")}getLogits(e,t){let r=e.dims.at(-1),n=e.data;if(-1===t)n=n.slice(-r);else{let e=t*r;n=n.slice(e,e+r)}return this.generation_config.temperature>0&&(n=n.map(e=>e/this.generation_config.temperature)),n}randomSelect(e){let t=Math.random()*e.reduce((e,t)=>
1e+t,0);for(let r=0;r<e.length;++r)if((t-=e[r])<=0)return r;return 0}static getSampler(e){if(e.do_sample)return new b(e);if(e.num_beams>1)return new v(e);if(e.num_return_sequences>1)throw Error(`num_return_sequences has to be 1 when doing greedy search, but is ${e.num_return_sequences}.`);return new y(e)}}class y extends w{sample(e,t=-1){let r=this.getLogits(e,t);return[[(0,i.T9)(r)[1],0]]}}class b extends w{sample(e,t=-1){let r=e.dims.at(-1);this.generation_config.top_k>0&&(r=Math.min(this.generation_config.top_k,r));let n=this.getLogits(e,t),a=(0,i.Em)(n,r),o=(0,i.Vs)(a.map(e=>e[1]));return Array.from({length:this.generation_config.num_beams},()=>{let e=this.randomSelect(o);return[a[e][0],Math.log(o[e])]})}}class v extends w{sample(e,t=-1){let r=e.dims.at(-1);this.generation_config.top_k>0&&(r=Math.min(this.generation_config.top_k,r));let n=this.getLogits(e,t),a=(0,i.Em)(n,r),o=(0,i.Vs)(a.map(e=>e[1]));return Array.from({length:this.generation_config.num_beams},(e,t)=>[a[t][0],Math.log(o[t])])}}},61463:(e,t,r)=>{"use strict";r.d(t,{Yw:()=>m,ly:()=>u,wc:()=>g});var n=r(60143),i=r(72603),a=r(41477),o=r(3835),s=r(95704),l=r(15376).Buffer;class h{_CONTENT_TYPE_MAP={txt:"text/plain",html:"text/html",css:"text/css",js:"text/javascript",json:"application/json",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif"};constructor(e){if(this.filePath=e,this.headers=new Headers,this.exists=n.existsSync(e),this.exists){this.status=200,this.statusText="OK";let t=n.statSync(e);this.headers.set("content-length",t.size.toString()),this.updateContentType();let r=this;this.body=new ReadableStream({start(e){r.arrayBuffer().then(t=>{e.enqueue(new Uint8Array(t)),e.close()})}})}else this.status=404,this.statusText="Not Found",this.body=null}updateContentType(){let e=this.filePath.toString().split(".").pop().toLowerCase();this.headers.set("content-type",this._CONTENT_TYPE_MAP[e]??"application/octet-stream")}clone(){let e=new h(this.filePath);return e.exists=this.exists,e.status=this.status,e.statusText=this.statusText,e.headers=new Headers(this.headers),e}async arrayBuffer(){return(await n.promises.readFile(this.filePath)).buffer}async blob(){return new Blob([await n.promises.readFile(this.filePath)],{type:this.headers.get("content-type")})}async text(){return await n.promises.readFile(this.filePath,"utf8")}async json(){return JSON.parse(await this.text())}}function c(e,t=null,r=null){let n;try{n=new URL(e)}catch(e){return!1}return(!t||!!t.includes(n.protocol))&&(!r||!!r.includes(n.hostname))}async function u(e){if(a._.useFS&&!c(e,["http:","https:","blob:"]))return new h(e);if(void 0===s||s?.release?.name!=="node")return fetch(e);{let t=!!s.env?.TESTING_REMOTELY,r=a._.version,n=new Headers;if(n.set("User-Agent",`transformers.js/${r}; is_ci/${t};`),c(e,["http:","https:"],["huggingface.co","hf.co"])){let e=s.env?.HF_TOKEN??s.env?.HF_ACCESS_TOKEN;e&&n.set("Authorization",`Bearer ${e}`)}return fetch(e,{headers:n})}}let d={400:"Bad request error occurred while trying to load file",401:"Unauthorized access to file",403:"Forbidden access to file",404:"Could not locate file",408:"Request timeout error occurred while trying to load file",500:"Internal server error error occurred while trying to load file",502:"Bad gateway error occurred while trying to load file",503:"Service unavailable error occurred while trying to load file",504:"Gateway timeout error occurred while trying to load file"};class f{constructor(e){this.path=e}async match(e){let t=new h(i.join(this.path,e));return t.exists?t:void 0}async put(e,t){let r=l.from(await t.arrayBuffer()),a=i.join(this.path,e);try{await n.promises.mkdir(i.dirname(a),{recursive:!0}),await n.promises.writeFile(a,r)}catch(e){console.warn("An error occurred while writing the file to cache:",e)}}}async function p(e,...t){for(let r of t)try{let t=await e.match(r);if(t)return t}catch(e){continue}}async function m(e,t,r=!0,n={}){let i,s,l,h;if(!a._.allowLocalModels){if(n.local_files_only)throw Error("Invalid configuration detected: local models are disabled (`env.allowLocalModels=false`) but you have requested to only use local models (`local_files_only=true`).");else if(!a._.allowRemoteModels)throw Error("Invalid configuration detected: both local and remote models are disabled. Fix by setting `env.allowLocalModels` or `env.allowRemoteModels` to `true`.")}if((0,o._e)(n.progress_callback,{status:"initiate",name:e,file:t}),!i&&a._.useBrowserCache){if("undefined"==typeof caches)throw Error("Browser cache is not available in this environment.");try{i=await caches.open("transformers-cache")}catch(e){console.warn("An error occurred while opening the browser cache:",e)}}if(!i&&a._.useFSCache&&(i=new f(n.cache_dir??a._.cacheDir)),!i&&a._.useCustomCache){if(!a._.customCache)throw Error("`env.useCustomCache=true`, but `env.customCache` is not defined.");if(!a._.customCache.match||!a._.customCache.put)throw Error("`env.customCache` must be an object which implements the `match` and `put` functions of the Web Cache API. For more information, see https://developer.mozilla.org/en-US/docs/Web/API/Cache");i=a._.customCache}let g=n.revision??"main",y=w(e,t),b=w(a._.localModelPath,y),v=w(a._.remoteHost,a._.remotePathTemplate.replaceAll("{model}",e).replaceAll("{revision}",encodeURIComponent(g)),t),M="main"===g?y:w(e,g,t),x=i instanceof f?M:v,k=!1;i&&(l=await p(i,b,x));let E=void 0!==l;if(void 0===l){if(a._.allowLocalModels)if(c(y,["http:","https:"])){if(n.local_files_only)throw Error(`\`local_files_only=true\`, but attempted to load a remote file from: ${y}.`);else if(!a._.allowRemoteModels)throw Error(`\`env.allowRemoteModels=false\`, but attempted to load a remote file from: ${y}.`)}else try{l=await u(b),s=b}catch(e){console.warn(`Unable to load from local path "${b}": "${e}"`)}if(void 0===l||404===l.status){if(n.local_files_only||!a._.allowRemoteModels)if(!r)return null;else throw Error(`\`local_files_only=true\` or \`env.allowRemoteModels=false\` and file was not found locally at "${b}".`);if(200!==(l=await u(v)).status){var T=l.status;if(!r)return null;let e=d[T]??`Error (${T}) occurred while trying to load file`;throw Error(`${e}: "${v}".`)}s=x}k=i&&"undefined"!=typeof Response&&l instanceof Response&&200===l.status}(0,o._e)(n.progress_callback,{status:"download",name:e,file:t});let C={status:"progress",name:e,file:t};return n.progress_callback?E&&"undefined"!=typeof navigator&&/firefox/i.test(navigator.userAgent)?(h=new Uint8Array(await l.arrayBuffer()),(0,o._e)(n.progress_callback,{...C,progress:100,loaded:h.length,total:h.length})):h=await _(l,e=>{(0,o._e)(n.progress_callback,{...C,...e})}):h=new Uint8Array(await l.arrayBuffer()),k&&s&&await i.match(s)===void 0&&await i.put(s,new Response(h,{headers:l.headers})).catch(e=>{console.warn(`Unable to add response to browser cache: ${e}.`)}),(0,o._e)(n.progress_callback,{status:"done",name:e,file:t}),h}async function g(e,t,r=!0,n={}){let i=await m(e,t,r,n);return null===i?{}:JSON.parse(new TextDecoder("utf-8").decode(i))}async function _(e,t){let r=e.headers.get("Content-Length");null===r&&console.warn("Unable to determine content-length from response headers. Will expand buffer when needed.");let n=parseInt(r??"0"),i=new Uint8Array(n),a=0,o=e.body.getReader();async function s(){let{done:e,value:r}=await o.read();if(e)return;let l=a+r.length;if(l>n){let e=new Uint8Array(n=l);e.set(i),i=e}return i.set(r,a),t({progress:(a=l)/n*100,loaded:a,total:n}
1),s()}return await s(),i}function w(...e){return(e=e.map((t,r)=>(r&&(t=t.replace(RegExp("^/"),"")),r!==e.length-1&&(t=t.replace(RegExp("/$"),"")),t))).join("/")}},62521:e=>{!function(){"use strict";var t={815:function(e){e.exports=function(e,r,n,i){r=r||"&",n=n||"=";var a={};if("string"!=typeof e||0===e.length)return a;var o=/\+/g;e=e.split(r);var s=1e3;i&&"number"==typeof i.maxKeys&&(s=i.maxKeys);var l=e.length;s>0&&l>s&&(l=s);for(var h=0;h<l;++h){var c,u,d,f,p=e[h].replace(o,"%20"),m=p.indexOf(n);(m>=0?(c=p.substr(0,m),u=p.substr(m+1)):(c=p,u=""),d=decodeURIComponent(c),f=decodeURIComponent(u),Object.prototype.hasOwnProperty.call(a,d))?t(a[d])?a[d].push(f):a[d]=[a[d],f]:a[d]=f}return a};var t=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},577:function(e){var t=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,a,o,s){return(a=a||"&",o=o||"=",null===e&&(e=void 0),"object"==typeof e)?n(i(e),function(i){var s=encodeURIComponent(t(i))+o;return r(e[i])?n(e[i],function(e){return s+encodeURIComponent(t(e))}).join(a):s+encodeURIComponent(t(e[i]))}).join(a):s?encodeURIComponent(t(s))+o+encodeURIComponent(t(e)):""};var r=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function n(e,t){if(e.map)return e.map(t);for(var r=[],n=0;n<e.length;n++)r.push(t(e[n],n));return r}var i=Object.keys||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t}}},r={};function n(e){var i=r[e];if(void 0!==i)return i.exports;var a=r[e]={exports:{}},o=!0;try{t[e](a,a.exports,n),o=!1}finally{o&&delete r[e]}return a.exports}n.ab="//";var i={};i.decode=i.parse=n(815),i.encode=i.stringify=n(577),e.exports=i}()},92313:(e,t,r)=>{!function(){var t={452:function(e){"use strict";e.exports=r(62521)}},n={};function i(e){var r=n[e];if(void 0!==r)return r.exports;var a=n[e]={exports:{}},o=!0;try{t[e](a,a.exports,i),o=!1}finally{o&&delete n[e]}return a.exports}i.ab="//";var a={};!function(){var e,t=(e=i(452))&&"object"==typeof e&&"default"in e?e.default:e,r=/https?|ftp|gopher|file/;function n(e){"string"==typeof e&&(e=_(e));var n,i,a,o,s,l,h,c,u,d=(i=(n=e).auth,a=n.hostname,o=n.protocol||"",s=n.pathname||"",l=n.hash||"",h=n.query||"",c=!1,i=i?encodeURIComponent(i).replace(/%3A/i,":")+"@":"",n.host?c=i+n.host:a&&(c=i+(~a.indexOf(":")?"["+a+"]":a),n.port&&(c+=":"+n.port)),h&&"object"==typeof h&&(h=t.encode(h)),u=n.search||h&&"?"+h||"",o&&":"!==o.substr(-1)&&(o+=":"),n.slashes||(!o||r.test(o))&&!1!==c?(c="//"+(c||""),s&&"/"!==s[0]&&(s="/"+s)):c||(c=""),l&&"#"!==l[0]&&(l="#"+l),u&&"?"!==u[0]&&(u="?"+u),{protocol:o,host:c,pathname:s=s.replace(/[?#]/g,encodeURIComponent),search:u=u.replace("#","%23"),hash:l});return""+d.protocol+d.host+d.pathname+d.search+d.hash}var o="http://",s=o+"w.w",l=/^([a-z0-9.+-]*:\/\/\/)([a-z0-9.+-]:\/*)?/i,h=/https?|ftp|gopher|file/;function c(e,t){var r="string"==typeof e?_(e):e;e="object"==typeof e?n(e):e;var i=_(t),a="";r.protocol&&!r.slashes&&(a=r.protocol,e=e.replace(r.protocol,""),a+="/"===t[0]||"/"===e[0]?"/":""),a&&i.protocol&&(a="",i.slashes||(a=i.protocol,t=t.replace(i.protocol,"")));var c=e.match(l);c&&!i.protocol&&(e=e.substr((a=c[1]+(c[2]||"")).length),/^\/\/[^/]/.test(t)&&(a=a.slice(0,-1)));var u=new URL(e,s+"/"),d=new URL(t,u).toString().replace(s,""),f=i.protocol||r.protocol;return f+=r.slashes||i.slashes?"//":"",!a&&f?d=d.replace(o,f):a&&(d=d.replace(o,"")),h.test(d)||~t.indexOf(".")||"/"===e.slice(-1)||"/"===t.slice(-1)||"/"!==d.slice(-1)||(d=d.slice(0,-1)),a&&(d=a+("/"===d[0]?d.substr(1):d)),d}function u(){}u.prototype.parse=_,u.prototype.format=n,u.prototype.resolve=c,u.prototype.resolveObject=c;var d=/^https?|ftp|gopher|file/,f=/^(.*?)([#?].*)/,p=/^([a-z0-9.+-]*:)(\/{0,3})(.*)/i,m=/^([a-z0-9.+-]*:)?\/\/\/*/i,g=/^([a-z0-9.+-]*:)(\/{0,2})\[(.*)\]$/i;function _(e,r,i){if(void 0===r&&(r=!1),void 0===i&&(i=!1),e&&"object"==typeof e&&e instanceof u)return e;var a=(e=e.trim()).match(f);e=a?a[1].replace(/\\/g,"/")+a[2]:e.replace(/\\/g,"/"),g.test(e)&&"/"!==e.slice(-1)&&(e+="/");var o=!/(^javascript)/.test(e)&&e.match(p),l=m.test(e),h="";o&&(d.test(o[1])||(h=o[1].toLowerCase(),e=""+o[2]+o[3]),o[2]||(l=!1,d.test(o[1])?(h=o[1],e=""+o[3]):e="//"+o[3]),3!==o[2].length&&1!==o[2].length||(h=o[1],e="/"+o[3]));var c,_=(a?a[1]:e).match(/^https?:\/\/[^/]+(:[0-9]+)(?=\/|$)/),w=_&&_[1],y=new u,b="",v="";try{c=new URL(e)}catch(t){b=t,h||i||!/^\/\//.test(e)||/^\/\/.+[@.]/.test(e)||(v="/",e=e.substr(1));try{c=new URL(e,s)}catch(e){return y.protocol=h,y.href=h,y}}y.slashes=l&&!v,y.host="w.w"===c.host?"":c.host,y.hostname="w.w"===c.hostname?"":c.hostname.replace(/(\[|\])/g,""),y.protocol=b?h||null:c.protocol,y.search=c.search.replace(/\\/g,"%5C"),y.hash=c.hash.replace(/\\/g,"%5C");var M=e.split("#");!y.search&&~M[0].indexOf("?")&&(y.search="?"),y.hash||""!==M[1]||(y.hash="#"),y.query=r?t.decode(c.search.substr(1)):y.search.substr(1),y.pathname=v+(o?c.pathname.replace(/['^|`]/g,function(e){return"%"+e.charCodeAt().toString(16).toUpperCase()}).replace(/((?:%[0-9A-F]{2})+)/g,function(e,t){try{return decodeURIComponent(t).split("").map(function(e){var t=e.charCodeAt();return t>256||/^[a-z0-9]$/i.test(e)?e:"%"+t.toString(16).toUpperCase()}).join("")}catch(e){return t}}):c.pathname),"about:"===y.protocol&&"blank"===y.pathname&&(y.protocol="",y.pathname=""),b&&"/"!==e[0]&&(y.pathname=y.pathname.substr(1)),h&&!
1d.test(h)&&"/"!==e.slice(-1)&&"/"===y.pathname&&(y.pathname=""),y.path=y.pathname+y.search,y.auth=[c.username,c.password].map(decodeURIComponent).filter(Boolean).join(":"),y.port=c.port,w&&!y.host.endsWith(w)&&(y.host+=w,y.port=w.slice(1)),y.href=v?""+y.pathname+y.search+y.hash:n(y);var x=/^(file)/.test(y.href)?["host","hostname"]:[];return Object.keys(y).forEach(function(e){~x.indexOf(e)||(y[e]=y[e]||null)}),y}a.parse=_,a.format=n,a.resolve=c,a.resolveObject=function(e,t){return _(c(e,t))},a.Url=u}(),e.exports=a}()}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.