PageSourceSearch

https://prompthub.xin/_next/static/chunks/adda3502.ec2b044103e011bd.js

js prompthub.xin collected 2026-09-24 12:31:12 UTC 428,651 bytes, 12 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4803],{49911:(e,t,r)=>{r.d(t,{env:()=>u,pipeline:()=>m});var s=r(72141),o=r(84932),a=r(95704),n=r(81029).hp,i={"onnxruntime-common":e=>{e.exports=s},"onnxruntime-web":e=>{e.exports=o},"?2ce3":()=>{},"?7992":()=>{},"?5af5":()=>{},"?2b25":()=>{},"?db59":()=>{},"?383f":()=>{},"?fa4b":()=>{},
vendor: 41,396 bytes, line 1
1"./node_modules/@huggingface/jinja/dist/index.js":(e,t,r)=>{r.r(t),r.d(t,{Environment:()=>ea,Interpreter:()=>en,Template:()=>ed,parse:()=>G,tokenize:()=>c});var s=Object.freeze({Text:"Text",NumericLiteral:"NumericLiteral",StringLiteral:"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",Comment:"Comment"}),o=class{constructor(e,t){this.value=e,this.type=t}};function a(e){return/\w/.test(e)}function n(e){return/[0-9]/.test(e)}var i=[["{%",s.OpenStatement],["%}",s.CloseStatement],["{{",s.OpenExpression],["}}",s.CloseExpression],["(",s.OpenParen],[")",s.CloseParen],["{",s.OpenCurlyBracket],["}",s.CloseCurlyBracket],["[",s.OpenSquareBracket],["]",s.CloseSquareBracket],[",",s.Comma],[".",s.Dot],[":",s.Colon],["|",s.Pipe],["<=",s.ComparisonBinaryOperator],[">=",s.ComparisonBinaryOperator],["==",s.ComparisonBinaryOperator],["!=",s.ComparisonBinaryOperator],["<",s.ComparisonBinaryOperator],[">",s.ComparisonBinaryOperator],["+",s.AdditiveBinaryOperator],["-",s.AdditiveBinaryOperator],["~",s.AdditiveBinaryOperator],["*",s.MultiplicativeBinaryOperator],["/",s.MultiplicativeBinaryOperator],["%",s.MultiplicativeBinaryOperator],["=",s.Equals]],l=new Map([["n","\n"],["t","	"],["r","\r"],["b","\b"],["f","\f"],["v","\v"],["'","'"],['"','"'],["\\","\\"]]);function c(e,t={}){let r=[],d=function(e,t={}){return e.endsWith("\n")&&(e=e.slice(0,-1)),t.lstrip_blocks&&(e=e.replace(/^[ \t]*({[#%-])/gm,"$1")),t.trim_blocks&&(e=e.replace(/([#%-]})\n/g,"$1")),e.replace(/-%}\s*/g,"%}").replace(/\s*{%-/g,"{%").replace(/-}}\s*/g,"}}").replace(/\s*{{-/g,"{{").replace(/-#}\s*/g,"#}").replace(/\s*{#-/g,"{#").replace(/{%\s*(end)?generation\s*%}/gs,"")}(e,t),u=0,m=0,_=e=>{let t="";for(;e(d[u]);){if("\\"===d[u]){if(++u>=d.length)throw SyntaxError("Unexpected end of input");let e=d[u++],r=l.get(e);if(void 0===r)throw SyntaxError(`Unexpected escaped character: ${e}`);t+=r;continue}if(t+=d[u++],u>=d.length)throw SyntaxError("Unexpected end of input")}return t};e:for(;u<d.length;){let e=r.at(-1)?.type;if(void 0===e||e===s.CloseStatement||e===s.CloseExpression||e===s.Comment){let e="";for(;u<d.length&&("{"!==d[u]||"%"!==d[u+1]&&"{"!==d[u+1]&&"#"!==d[u+1]);)e+=d[u++];if(e.length>0){r.push(new o(e,s.Text));continue}}if("{"===d[u]&&"#"===d[u+1]){u+=2;let e="";for(;"#"!==d[u]||"}"!==d[u+1];){if(u+2>=d.length)throw SyntaxError("Missing end of comment tag");e+=d[u++]}r.push(new o(e,s.Comment)),u+=2;continue}_(e=>/\s/.test(e));let t=d[u];if("-"===t||"+"===t){let e=r.at(-1)?.type;if(e===s.Text||void 0===e)throw SyntaxError(`Unexpected character: ${t}`);switch(e){case s.Identifier:case s.NumericLiteral:case s.StringLiteral:case s.CloseParen:case s.CloseSquareBracket:break;default:{++u;let e=_(n);r.push(new o(`${t}${e}`,e.length>0?s.NumericLiteral:s.UnaryOperator));continue}}}for(let[e,t]of i)if(("}}"!==e||!(m>0))&&d.slice(u,u+e.length)===e){r.push(new o(e,t)),t===s.OpenExpression?m=0:t===s.OpenCurlyBracket?++m:t===s.CloseCurlyBracket&&--m,u+=e.length;continue e}if("'"===t||'"'===t){++u;let e=_(e=>e!==t);r.push(new o(e,s.StringLiteral)),++u;continue}if(n(t)){let e=_(n);if("."===d[u]&&n(d[u+1])){++u;let t=_(n);e=`${e}.${t}`}r.push(new o(e,s.NumericLiteral));continue}if(a(t)){let e=_(a);r.push(new o(e,s.Identifier));continue}throw SyntaxError(`Unexpected character: ${t}`)}return r}var d=class{type="Statement"},u=class extends d{constructor(e){super(),this.body=e}type="Program"},m=class extends d{constructor(e,t,r){super(),this.test=e,this.body=t,this.alternate=r}type="If"},_=class extends d{constructor(e,t,r,s){super(),this.loopvar=e,this.iterable=t,this.body=r,this.defaultBlock=s}type="For"},p=class extends d{type="Break"},h=class extends d{type="Continue"},f=class extends d{constructor(e,t,r){super(),this.assignee=e,this.value=t,this.body=r}type="Set"},g=class extends d{constructor(e,t,r){super(),this.name=e,this.args=t,this.body=r}type="Macro"},M=class extends d{constructor(e){super(),this.value=e}type="Comment"},w=class extends d{type="Expression"},x=class extends w{constructor(e,t,r){super(),this.object=e,this.property=t,this.computed=r}type="MemberExpression"},b=class extends w{constructor(e,t){super(),this.callee=e,this.args=t}type="CallExpression"},T=class extends w{constructor(e){super(),this.value=e}type="Identifier"},P=class extends w{constructor(e){super(),this.value=e}type="Literal"},y=class extends P{type="IntegerLiteral"},k=class extends P{type="FloatLiteral"},v=class extends P{type="StringLiteral"},F=class extends P{type="ArrayLiteral"},C=class extends P{type="TupleLiteral"},S=class extends P{type="ObjectLiteral"},E=class extends w{constructor(e,t,r){super(),this.operator=e,this.left=t,this.right=r}type="BinaryExpression"},A=class extends w{constructor(e,t){super(),this.operand=e,this.filter=t}type="FilterExpression"},L=class extends d{constructor(e,t){super(),this.filter=e,this.body=t}type="FilterStatement"},I=class extends w{constructor(e,t){super(),this.lhs=e,this.test=t}type="SelectExpression"},j=class extends w{constructor(e,t,r){super(),this.operand=e,this.negate=t,this.test=r}type="TestExpression"},z=class extends w{constructor(e,t){super(),this.operator=e,this.argument=t}type="UnaryExpression"},D=class extends w{constructor(e,t,r){super(),this.start=e,this.stop=t,this.step=r}type="SliceExpression"},V=class extends w{constructor(e,t){super(),this.key=e,this.value=t}type="KeywordArgumentExpression"},O=class extends w{constructor(e){super(),this.argument=e}type="SpreadExpression"},N=class extends d{constructor(e,t,r){super(),this.call=e,this.callerArgs=t,this.body=r}type="CallStatement"},B=class extends w{constructor(e,t,r){super(),this.condition=e,this.trueExpr=t,this.falseExpr=r}type="Ternary"};function G(e){let t=new u([]),r=0;function a(t,s){let o=e[r++];if(!o||o.type!==t)throw Error(`Parser Error: ${s}. ${o.type} !== ${t}.`);return o}function n(e){if(!c(e))throw SyntaxError(`Expected ${e}`);++r}function i(...t){return r+t.length<=e.length&&t.every((t,s)=>t===e[r+s].type)}function l(...t){return e[r]?.type===s.OpenStatement&&e[r+1]?.type===s.Identifier&&t.includes(e[r+1]?.value)}function c(...t){return r+t.length<=e.length&&t.every((t,s)=>"Identifier"===e[r+s].type&&t===e[r+s].value)}function d(e=!1){let t=e?H:w,o=[t()],a=i(s.Comma);for(;a&&(++r,o.push(t()),i(s.Comma)););return a?new C(o):o[0]}function w(){return function e(){let t=P();if(c("if")){++r;let s=P();return c("else")?(++r,new B(s,t,e())):new I(t,s)}return t}()}function P(){let t=G();for(;c("or");){let s=e[r];++r,t=new E(s,t,G())}return t}function G(){let t=R();for(;c("and");){let s=e[r];++r,t=new E(s,t,R())}return t}function R(){let t;for(;c("not");){let s=e[r];++r,t=new z(s,R())}return t??function(){let t=q();for(;;){let a;if(c("not","in"))a=new o("not in",s.Identifier),r+=2;else if(c("in"))a=e[r++];else if(i(s.ComparisonBinaryOperator))a=e[r++];else break;t=new E(a,t,q())}return t}()}function q(){let t=Q();for(;i(s.AdditiveBinaryOperator);){let s=e[r];++r,t=new E(s,t,Q())}return t}function $(e){let t=new b(e,W());return t=U(t),i(s.OpenParen)&&(t=$(t)),t}function W(){a(s.OpenParen,"Expected opening parenthesis for arguments list");let t=function(){let t=[];for(;!i(s.CloseParen);){let o;if(e[r].type===s.MultiplicativeBinaryOperator&&"*"===e[r].value)++r,o=new O(w());else if(o=w(),i(s.Equals)){if(++r,!(o instanceof T))throw SyntaxError("Expected identifier for keyword argument");o=new V(o,w())}t.push(o),i(s.Comma)&&++r}return t}();return a(s.CloseParen,"Expected closing parenthesis for arguments list"),t}function U(t){for(;i(s.Dot)||i(s.OpenSquareBracket);){let o,n=e[r];++r;let l=n.type===s.OpenSquareBracket;if(l)o=function(){let e=[],t=!1;for(;!i(s.CloseSquareBracket);)i(s.Colon)?(e.push(void 0),++r,t=!0):(e.push(w()),i(s.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 D(...e)}return e[0]}(),a(s.CloseSquareBracket,"Expected closing square bracket");else if("Identifier"!==(o=H()).type)throw SyntaxError("Expected identifier following dot operator");t=new x(t,o,l)}return t}function Q(){let t=X();for(;i(s.MultiplicativeBinaryOperator);)t=new E(e[r++],t,X());return t}function X(){let e=function(){let e=function(){let e=U(H());return i(s.OpenParen)?$(e):e}();for(;i(s.Pipe);){++r;let t=H();if(!(t instanceof T))throw SyntaxError("Expected identifier for the filter");i(s.OpenParen)&&(t=$(t)),e=new A(e,t)}return e}();for(;c("is");){++r;let t=c("not");t&&++r;let s=H();if(!(s instanceof T))throw SyntaxError("Expected identifier for the test");e=new j(e,t,s)}return e}function H(){let t=e[r++];switch(t.type){case s.NumericLiteral:{let e=t.value;return e.includes(".")?new k(Number(e)):new y(Number(e))}case s.StringLiteral:{let o=t.value;for(;i(s.StringLiteral);)o+=e[r++].value;return new v(o)}case s.Identifier:return new T(t.value);case s.OpenParen:{let e=d();return a(s.CloseParen,"Expected closing parenthesis, got ${tokens[current].type} instead."),e}case s.OpenSquareBracket:{let e=[];for(;!i(s.CloseSquareBracket);)e.push(w()),i(s.Comma)&&++r;return++r,new F(e)}case s.OpenCurlyBracket:{let e=new Map;for(;!i(s.CloseCurlyBracket);){let t=w();a(s.Colon,"Expected colon between key and value in object literal");let o=w();e.set(t,o),i(s.Comma)&&++r}return++r,new S(e)}default:throw SyntaxError(`Unexpected token: ${t.type}`)}}for(;r<e.length;)t.body.push(function t(){switch(e[r].type){case s.Comment:return new M(e[r++].value);case s.Text:return new v(a(s.Text,"Expected text token").value);case s.OpenStatement:return function(){let o;if(a(s.OpenStatement,"Expected opening statement token"),e[r].type!==s.Identifier)throw SyntaxError(`Unknown statement, got ${e[r].type}`);let u=e[r].value;switch(u){case"set":++r,o=function(){let e=d(),o=null,c=[];if(i(s.Equals))++r,o=d();else{for(a(s.CloseStatement,"Expected %} token");!l("endset");)c.push(t());a(s.OpenStatement,"Expected {% token"),n("endset")}return a(s.CloseStatement,"Expected closing statement token"),new f(e,o,c)}();break;case"if":++r,o=function e(){let o=w();a(s.CloseStatement,"Expected closing statement token");let n=[],i=[];for(;!l("elif","else","endif");)n.push(t());if(l("elif")){++r,++r;let t=e();i.push(t)}else if(l("else"))for(++r,++r,a(s.CloseStatement,"Expected closing statement token");!l("endif");)i.push(t());return new m(o,n,i)}(),a(s.OpenStatement,"Expected {% token"),n("endif"),a(s.CloseStatement,"Expected %} token");break;case"macro":++r,o=function(){let e=H();if("Identifier"!==e.type)throw SyntaxError("Expected identifier following macro statement");let r=W();a(s.CloseStatement,"Expected closing statement token");let o=[];for(;!l("endmacro");)o.push(t());return new g(e,r,o)}(),a(s.OpenStatement,"Expected {% token"),n("endmacro"),a(s.CloseStatement,"Expected %} token");break;case"for":++r,o=function(){let e=d(!0);if(!(e instanceof T||e instanceof C))throw SyntaxError(`Expected identifier/tuple for the loop variable, got ${e.type} instead`);if(!c("in"))throw SyntaxError("Expected `in` keyword following loop variable");++r;let o=w();a(s.CloseStatement,"Expected closing statement token");let n=[];for(;!l("endfor","else");)n.push(t());let i=[];if(l("else"))for(++r,++r,a(s.CloseStatement,"Expected closing statement token");!l("endfor");)i.push(t());return new _(e,o,n,i)}(),a(s.OpenStatement,"Expected {% token"),n("endfor"),a(s.CloseStatement,"Expected %} token");break;case"call":{++r;let e=null;i(s.OpenParen)&&(e=W());let c=H();if("Identifier"!==c.type)throw SyntaxError("Expected identifier following call statement");let d=W();a(s.CloseStatement,"Expected closing statement token");let u=[];for(;!l("endcall");)u.push(t());a(s.OpenStatement,"Expected '{%'"),n("endcall"),a(s.CloseStatement,"Expected closing statement token"),o=new N(new b(c,d),e,u);break}case"break":++r,a(s.CloseStatement,"Expected closing statement token"),o=new p;break;case"continue":++r,a(s.CloseStatement,"Expected closing statement token"),o=new h;break;case"filter":{++r;let e=H();e instanceof T&&i(s.OpenParen)&&(e=$(e)),a(s.CloseStatement,"Expected closing statement token");let c=[];for(;!l("endfilter");)c.push(t());a(s.OpenStatement,"Expected '{%'"),n("endfilter"),a(s.CloseStatement,"Expected '%}'"),o=new L(e,c);break}default:throw SyntaxError(`Unknown statement type: ${u}`)}return o}();case s.OpenExpression:a(s.OpenExpression,"Expected opening expression token");let o=w();return a(s.CloseExpression,"Expected closing expression token"),o;default:throw SyntaxError(`Unexpected token type: ${e[r].type}`)}}());return t}function R(e,t,r=1){void 0===t&&(t=e,e=0);let s=[];for(let o=e;o<t;o+=r)s.push(o);return s}function q(e,t,r,s=1){let o=Math.sign(s);o>=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 n=t;o*n<o*r;n+=s)a.push(e[n]);return a}function $(e){return function(e,t){let r=new Intl.DateTimeFormat(void 0,{month:"long"}),s=new Intl.DateTimeFormat(void 0,{month:"short"}),o=e=>e<10?"0"+e:e.toString();return t.replace(/%[YmdbBHM%]/g,t=>{switch(t){case"%Y":return e.getFullYear().toString();case"%m":return o(e.getMonth()+1);case"%d":return o(e.getDate());case"%b":return s.format(e);case"%B":return r.format(e);case"%H":return o(e.getHours());case"%M":return o(e.getMinutes());case"%%":return"%";default:return t}})}(new Date,e)}var W=class extends Error{},U=class extends Error{},Q=class{type="RuntimeValue";value;builtins=new Map;constructor(e){this.value=e}__bool__(){return new Y(!!this.value)}toString(){return String(this.value)}},X=class extends Q{type="IntegerValue"},H=class extends Q{type="FloatValue";toString(){return this.value%1==0?this.value.toFixed(1):this.value.toString()}},J=class extends Q{type="StringValue";builtins=new Map([["upper",new er(()=>new J(this.value.toUpperCase()))],["lower",new er(()=>new J(this.value.toLowerCase()))],["strip",new er(()=>new J(this.value.trim()))],["title",new er(()=>new J(this.value.replace(/\b\w/g,e=>e.toUpperCase())))],["capitalize",new er(()=>new J(this.value.charAt(0).toUpperCase()+this.value.slice(1)))],["length",new X(this.value.length)],["rstrip",new er(()=>new J(this.value.trimEnd()))],["lstrip",new er(()=>new J(this.value.trimStart()))],["startswith",new er(e=>{if(0===e.length)throw Error("startswith() requires at least one argument");let t=e[0];if(t instanceof J)return new Y(this.value.startsWith(t.value));if(t instanceof ee){for(let e of t.value){if(!(e instanceof J))throw Error("startswith() tuple elements must be strings");if(this.value.startsWith(e.value))return new Y(!0)}return new Y(!1)}throw Error("startswith() argument must be a string or tuple of strings")})],["endswith",new er(e=>{if(0===e.length)throw Error("endswith() requires at least one argument");let t=e[0];if(t instanceof J)return new Y(this.value.endsWith(t.value));if(t instanceof ee){for(let e of t.value){if(!(e instanceof J))throw Error("endswith() tuple elements must be strings");if(this.value.endsWith(e.value))return new Y(!0)}return new Y(!1)}throw Error("endswith() argument must be a string or tuple of strings")})],["split",new er(e=>{let t=e[0]??new es;if(!(t instanceof J||t instanceof es))throw Error("sep argument must be a string or null");let r=e[1]??new X(-1);if(!(r instanceof X))throw Error("maxsplit argument must be a number");let s=[];if(t instanceof es){let e=this.value.trimStart();for(let{0:t,index:o}of e.matchAll(/\S+/g)){if(-1!==r.value&&s.length>=r.value&&void 0!==o){s.push(t+e.slice(o+t.length));break}s.push(t)}}else{if(""===t.value)throw Error("empty separator");s=this.value.split(t.value),-1!==r.value&&s.length>r.value&&s.push(s.splice(r.value).join(t.value))}return new ee(s.map(e=>new J(e)))})],["replace",new er(e=>{let t;if(e.length<2)throw Error("replace() requires at least two arguments");let r=e[0],s=e[1];if(!(r instanceof J&&s instanceof J))throw Error("replace() arguments must be strings");if(!((t=e.length>2?"KeywordArgumentsValue"===e[2].type?e[2].value.get("count")??new es:e[2]:new es)instanceof X||t instanceof es))throw Error("replace() count argument must be a number or null");return new J(function(e,t,r,s){if(0===s)return e;let o=null==s||s<0?1/0:s,a=0===t.length?RegExp("(?=)","gu"):RegExp(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gu");return e.replaceAll(a,e=>o>0?(--o,r):e)}(this.value,r.value,s.value,t.value))})]])},Y=class extends Q{type="BooleanValue"},K=class extends Q{type="ObjectValue";__bool__(){return new Y(this.value.size>0)}builtins=new Map([["get",new er(([e,t])=>{if(!(e instanceof J))throw Error(`Object key must be a string: got ${e.type}`);return this.value.get(e.value)??t??new es})],["items",new er(()=>this.items())],["keys",new er(()=>this.keys())],["values",new er(()=>this.values())]]);items(){return new ee(Array.from(this.value.entries()).map(([e,t])=>new ee([new J(e),t])))}keys(){return new ee(Array.from(this.value.keys()).map(e=>new J(e)))}values(){return new ee(Array.from(this.value.values()))}},Z=class extends K{type="KeywordArgumentsValue"},ee=class extends Q{type="ArrayValue";builtins=new Map([["length",new X(this.value.length)]]);__bool__(){return new Y(this.value.length>0)}},et=class extends ee{type="TupleValue"},er=class extends Q{type="FunctionValue"},es=class extends Q{type="NullValue"},eo=class extends Q{type="UndefinedValue"},ea=class{constructor(e){this.parent=e}variables=new Map([["namespace",new er(e=>{if(0===e.length)return new K(new Map);if(1!==e.length||!(e[0]instanceof K))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 er],["odd",e=>{if(!(e instanceof X))throw Error(`cannot odd on ${e.type}`);return e.value%2!=0}],["even",e=>{if(!(e instanceof X))throw Error(`cannot even on ${e.type}`);return e.value%2==0}],["false",e=>"BooleanValue"===e.type&&!e.value],["true",e=>"BooleanValue"===e.type&&e.value],["none",e=>"NullValue"===e.type],["string",e=>"StringValue"===e.type],["number",e=>e instanceof X||e instanceof H],["integer",e=>e instanceof X],["iterable",e=>"ArrayValue"===e.type||"StringValue"===e.type],["mapping",e=>"ObjectValue"===e.type],["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],["eq",(e,t)=>e.value===t.value]]);set(e,t){return this.declareVariable(e,function e(t){switch(typeof t){case"number":return Number.isInteger(t)?new X(t):new H(t);case"string":return new J(t);case"boolean":return new Y(t);case"undefined":return new eo;case"object":if(null===t)return new es;if(Array.isArray(t))return new ee(t.map(e));return new K(new Map(Object.entries(t).map(([t,r])=>[t,e(r)])));case"function":return new er((r,s)=>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 eo}catch{return new eo}}},en=class{global;constructor(e){this.global=e??new ea}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 s=this.evaluate(e.right,t);switch(e.operator.value){case"==":return new Y(r.value==s.value);case"!=":return new Y(r.value!=s.value)}if(r instanceof eo||s instanceof eo){if(s instanceof eo&&["in","not in"].includes(e.operator.value))return new Y("not in"===e.operator.value);throw Error(`Cannot perform operation ${e.operator.value} on undefined values`)}if(r instanceof es||s instanceof es)throw Error("Cannot perform operation on null values");if("~"===e.operator.value)return new J(r.value.toString()+s.value.toString());if((r instanceof X||r instanceof H)&&(s instanceof X||s instanceof H)){let t=r.value,o=s.value;switch(e.operator.value){case"+":case"-":case"*":{let a="+"===e.operator.value?t+o:"-"===e.operator.value?t-o:t*o;return r instanceof H||s instanceof H?new H(a):new X(a)}case"/":return new H(t/o);case"%":{let e=t%o;return r instanceof H||s instanceof H?new H(e):new X(e)}case"<":return new Y(t<o);case">":return new Y(t>o);case">=":return new Y(t>=o);case"<=":return new Y(t<=o)}}else if(r instanceof ee&&s instanceof ee){if("+"===e.operator.value)return new ee(r.value.concat(s.value))}else if(s instanceof ee){let t=void 0!==s.value.find(e=>e.value===r.value);switch(e.operator.value){case"in":return new Y(t);case"not in":return new Y(!t)}}if((r instanceof J||s instanceof J)&&"+"===e.operator.value)return new J(r.value.toString()+s.value.toString());if(r instanceof J&&s instanceof J)switch(e.operator.value){case"in":return new Y(s.value.includes(r.value));case"not in":return new Y(!s.value.includes(r.value))}if(r instanceof J&&s instanceof K)switch(e.operator.value){case"in":return new Y(s.value.has(r.value));case"not in":return new Y(!s.value.has(r.value))}throw SyntaxError(`Unknown operator "${e.operator.value}" between ${r.type} and ${s.type}`)}evaluateArguments(e,t){let r=[],s=new Map;for(let o of e)if("SpreadExpression"===o.type){let e=this.evaluate(o.argument,t);if(!(e instanceof ee))throw Error(`Cannot unpack non-iterable type: ${e.type}`);for(let t of e.value)r.push(t)}else if("KeywordArgumentExpression"===o.type)s.set(o.key.value,this.evaluate(o.value,t));else{if(s.size>0)throw Error("Positional arguments must come before keyword arguments");r.push(this.evaluate(o,t))}return[r,s]}applyFilter(e,t,r){if("Identifier"===t.type){if("tojson"===t.value)return new J(ei(e));if(e instanceof ee)switch(t.value){case"list":return e;case"first":return e.value[0];case"last":return e.value[e.value.length-1];case"length":return new X(e.value.length);case"reverse":return new ee(e.value.reverse());case"sort":return new ee(e.value.sort((e,t)=>{if(e.type!==t.type)throw Error(`Cannot compare different types: ${e.type} and ${t.type}`);switch(e.type){case"IntegerValue":case"FloatValue":return e.value-t.value;case"StringValue":return e.value.localeCompare(t.value);default:throw Error(`Cannot compare type: ${e.type}`)}}));case"join":return new J(e.value.map(e=>e.value).join(""));case"string":return new J(ei(e));case"unique":{let t=new Set,r=[];for(let s of e.value)t.has(s.value)||(t.add(s.value),r.push(s));return new ee(r)}default:throw Error(`Unknown ArrayValue filter: ${t.value}`)}if(e instanceof J)switch(t.value){case"length":case"upper":case"lower":case"title":case"capitalize":{let s=e.builtins.get(t.value);if(s instanceof er)return s.value([],r);if(s instanceof X)return s;throw Error(`Unknown StringValue filter: ${t.value}`)}case"trim":return new J(e.value.trim());case"indent":return new J(e.value.split("\n").map((e,t)=>0===t||0===e.length?e:"    "+e).join("\n"));case"join":case"string":return e;case"int":{let t=parseInt(e.value,10);return new X(isNaN(t)?0:t)}case"float":{let t=parseFloat(e.value);return new H(isNaN(t)?0:t)}default:throw Error(`Unknown StringValue filter: ${t.value}`)}if(e instanceof X||e instanceof H)switch(t.value){case"abs":return e instanceof X?new X(Math.abs(e.value)):new H(Math.abs(e.value));case"int":return new X(Math.floor(e.value));case"float":return new H(e.value);default:throw Error(`Unknown NumericValue filter: ${t.value}`)}else if(e instanceof K)switch(t.value){case"items":return new ee(Array.from(e.value.entries()).map(([e,t])=>new ee([new J(e),t])));case"length":return new X(e.value.size);default:throw Error(`Unknown ObjectValue filter: ${t.value}`)}else if(e instanceof Y)switch(t.value){case"bool":return new Y(e.value);case"int":return new X(+!!e.value);case"float":return new H(+!!e.value);case"string":return new J(e.value?"true":"false");default:throw Error(`Unknown BooleanValue filter: ${t.value}`)}throw Error(`Cannot apply filter "${t.value}" to type: ${e.type}`)}if("CallExpression"===t.type){if("Identifier"!==t.callee.type)throw Error(`Unknown filter: ${t.callee.type}`);let s=t.callee.value;if("tojson"===s){let[,s]=this.evaluateArguments(t.args,r),o=s.get("indent")??new es;if(!(o instanceof X||o instanceof es))throw Error("If set, indent must be a number");return new J(ei(e,o.value))}if("join"===s){let o;if(e instanceof J)o=Array.from(e.value);else if(e instanceof ee)o=e.value.map(e=>e.value);else throw Error(`Cannot apply filter "${s}" to type: ${e.type}`);let[a,n]=this.evaluateArguments(t.args,r),i=a.at(0)??n.get("separator")??new J("");if(!(i instanceof J))throw Error("separator must be a string");return new J(o.join(i.value))}if("int"===s||"float"===s){let[o,a]=this.evaluateArguments(t.args,r),n=o.at(0)??a.get("default")??("int"===s?new X(0):new H(0));if(e instanceof J){let t="int"===s?parseInt(e.value,10):parseFloat(e.value);return isNaN(t)?n:"int"===s?new X(t):new H(t)}if(e instanceof X||e instanceof H)return e;if(e instanceof Y)return"int"===s?new X(+!!e.value):new H(+!!e.value);else throw Error(`Cannot apply filter "${s}" to type: ${e.type}`)}else if("default"===s){let[s,o]=this.evaluateArguments(t.args,r),a=s[0]??new J(""),n=s[1]??o.get("boolean")??new Y(!1);if(!(n instanceof Y))throw Error("`default` filter flag must be a boolean");return e instanceof eo||n.value&&!e.__bool__().value?a:e}if(e instanceof ee){switch(s){case"selectattr":case"rejectattr":{let o,a="selectattr"===s;if(e.value.some(e=>!(e instanceof K)))throw Error(`\`${s}\` can only be applied to array of objects`);if(t.args.some(e=>"StringLiteral"!==e.type))throw Error(`arguments of \`${s}\` must be strings`);let[n,i,l]=t.args.map(e=>this.evaluate(e,r));if(i){let e=r.tests.get(i.value);if(!e)throw Error(`Unknown test: ${i.value}`);o=e}else o=(...e)=>e[0].__bool__().value;return new ee(e.value.filter(e=>{let t=e.value.get(n.value),r=!!t&&o(t,l);return a?r:!r}))}case"map":{let[,s]=this.evaluateArguments(t.args,r);if(s.has("attribute")){let t=s.get("attribute");if(!(t instanceof J))throw Error("attribute must be a string");let r=s.get("default");return new ee(e.value.map(e=>{if(!(e instanceof K))throw Error("items in map must be an object");return e.value.get(t.value)??r??new eo}))}throw Error("`map` expressions without `attribute` set are not currently supported.")}}throw Error(`Unknown ArrayValue filter: ${s}`)}if(e instanceof J){switch(s){case"indent":{let[s,o]=this.evaluateArguments(t.args,r),a=s.at(0)??o.get("width")??new X(4);if(!(a instanceof X))throw Error("width must be a number");let n=s.at(1)??o.get("first")??new Y(!1),i=s.at(2)??o.get("blank")??new Y(!1),l=e.value.split("\n"),c=" ".repeat(a.value);return new J(l.map((e,t)=>(n.value||0!==t)&&(i.value||0!==e.length)?c+e:e).join("\n"))}case"replace":{let s=e.builtins.get("replace");if(!(s instanceof er))throw Error("replace filter not available");let[o,a]=this.evaluateArguments(t.args,r);return s.value([...o,new Z(a)],r)}}throw Error(`Unknown StringValue filter: ${s}`)}throw Error(`Cannot apply filter "${s}" to type: ${e.type}`)}throw Error(`Unknown filter: ${t.type}`)}evaluateFilterExpression(e,t){let r=this.evaluate(e.operand,t);return this.applyFilter(r,e.filter,t)}evaluateTestExpression(e,t){let r=this.evaluate(e.operand,t),s=t.tests.get(e.test.value);if(!s)throw Error(`Unknown test: ${e.test.value}`);let o=s(r);return new Y(e.negate?!o:o)}evaluateSelectExpression(e,t){return this.evaluate(e.test,t).__bool__().value?this.evaluate(e.lhs,t):new eo}evaluateUnaryExpression(e,t){let r=this.evaluate(e.argument,t);if("not"===e.operator.value)return new Y(!r.value);throw SyntaxError(`Unknown operator: ${e.operator.value}`)}evaluateTernaryExpression(e,t){return this.evaluate(e.condition,t).__bool__().value?this.evaluate(e.trueExpr,t):this.evaluate(e.falseExpr,t)}evalProgram(e,t){return this.evaluateBlock(e.body,t)}evaluateBlock(e,t){let r="";for(let s of e){let e=this.evaluate(s,t);"NullValue"!==e.type&&"UndefinedValue"!==e.type&&(r+=e.toString())}return new J(r)}evaluateIdentifier(e,t){return t.lookupVariable(e.value)}evaluateCallExpression(e,t){let[r,s]=this.evaluateArguments(e.args,t);s.size>0&&r.push(new Z(s));let o=this.evaluate(e.callee,t);if("FunctionValue"!==o.type)throw Error(`Cannot call something that is not a function: got ${o.type}`);return o.value(r,t)}evaluateSliceExpression(e,t,r){if(!(e instanceof ee||e instanceof J))throw Error("Slice object must be an array or string");let s=this.evaluate(t.start,r),o=this.evaluate(t.stop,r),a=this.evaluate(t.step,r);if(!(s instanceof X||s instanceof eo))throw Error("Slice start must be numeric or undefined");if(!(o instanceof X||o instanceof eo))throw Error("Slice stop must be numeric or undefined");if(!(a instanceof X||a instanceof eo))throw Error("Slice step must be numeric or undefined");return e instanceof ee?new ee(q(e.value,s.value,o.value,a.value)):new J(q(Array.from(e.value),s.value,o.value,a.value).join(""))}evaluateMemberExpression(e,t){let r,s,o=this.evaluate(e.object,t);if(e.computed)if("SliceExpression"===e.property.type)return this.evaluateSliceExpression(o,e.property,t);else r=this.evaluate(e.property,t);else r=new J(e.property.value);if(o instanceof K){if(!(r instanceof J))throw Error(`Cannot access property with non-string: got ${r.type}`);s=o.value.get(r.value)??o.builtins.get(r.value)}else if(o instanceof ee||o instanceof J)if(r instanceof X)s=o.value.at(r.value),o instanceof J&&(s=new J(o.value.at(r.value)));else if(r instanceof J)s=o.builtins.get(r.value);else throw Error(`Cannot access property with non-string/non-number: got ${r.type}`);else{if(!(r instanceof J))throw Error(`Cannot access property with non-string: got ${r.type}`);s=o.builtins.get(r.value)}return s instanceof Q?s:new eo}evaluateSet(e,t){let r=e.value?this.evaluate(e.value,t):this.evaluateBlock(e.body,t);if("Identifier"===e.assignee.type){let s=e.assignee.value;t.setVariable(s,r)}else if("TupleLiteral"===e.assignee.type){let s=e.assignee;if(!(r instanceof ee))throw Error(`Cannot unpack non-iterable type in set: ${r.type}`);let o=r.value;if(o.length!==s.value.length)throw Error(`Too ${s.value.length>o.length?"few":"many"} items to unpack in set`);for(let e=0;e<s.value.length;++e){let r=s.value[e];if("Identifier"!==r.type)throw Error(`Cannot unpack to non-identifier in set: ${r.type}`);t.setVariable(r.value,o[e])}}else if("MemberExpression"===e.assignee.type){let s=e.assignee,o=this.evaluate(s.object,t);if(!(o instanceof K))throw Error("Cannot assign to member of non-object");if("Identifier"!==s.property.type)throw Error("Cannot assign to member with non-identifier property");o.value.set(s.property.value,r)}else throw Error(`Invalid LHS inside assignment expression: ${JSON.stringify(e.assignee)}`);return new es}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,s,o=new ea(t);if("SelectExpression"===e.iterable.type){let t=e.iterable;s=this.evaluate(t.lhs,o),r=t.test}else s=this.evaluate(e.iterable,o);if(!(s instanceof ee||s instanceof K))throw Error(`Expected iterable or object type in for loop: got ${s.type}`);s instanceof K&&(s=s.keys());let a=[],n=[];for(let t=0;t<s.value.length;++t){let i,l=new ea(o),c=s.value[t];if("Identifier"===e.loopvar.type)i=t=>t.setVariable(e.loopvar.value,c);else if("TupleLiteral"===e.loopvar.type){let t=e.loopvar;if("ArrayValue"!==c.type)throw Error(`Cannot unpack non-iterable type: ${c.type}`);if(t.value.length!==c.value.length)throw Error(`Too ${t.value.length>c.value.length?"few":"many"} items to unpack`);i=e=>{for(let r=0;r<t.value.length;++r){if("Identifier"!==t.value[r].type)throw Error(`Cannot unpack non-identifier type: ${t.value[r].type}`);e.setVariable(t.value[r].value,c.value[r])}}}else throw Error(`Invalid loop variable(s): ${e.loopvar.type}`);(!r||(i(l),this.evaluate(r,l).__bool__().value))&&(a.push(c),n.push(i))}let i="",l=!0;for(let t=0;t<a.length;++t){let r=new Map([["index",new X(t+1)],["index0",new X(t)],["revindex",new X(a.length-t)],["revindex0",new X(a.length-t-1)],["first",new Y(0===t)],["last",new Y(t===a.length-1)],["length",new X(a.length)],["previtem",t>0?a[t-1]:new eo],["nextitem",t<a.length-1?a[t+1]:new eo]]);o.setVariable("loop",new K(r)),n[t](o);try{let t=this.evaluateBlock(e.body,o);i+=t.value}catch(e){if(e instanceof U)continue;if(e instanceof W)break;throw e}l=!1}return l&&(i+=this.evaluateBlock(e.defaultBlock,o).value),new J(i)}evaluateMacro(e,t){return t.setVariable(e.name.value,new er((t,r)=>{let s,o=new ea(r);t=t.slice(),t.at(-1)?.type==="KeywordArgumentsValue"&&(s=t.pop());for(let r=0;r<e.args.length;++r){let a=e.args[r],n=t[r];if("Identifier"===a.type){if(!n)throw Error(`Missing positional argument: ${a.value}`);o.setVariable(a.value,n)}else if("KeywordArgumentExpression"===a.type){let e=n??s?.value.get(a.key.value)??this.evaluate(a.value,o);o.setVariable(a.key.value,e)}else throw Error(`Unknown argument type: ${a.type}`)}return this.evaluateBlock(e.body,o)})),new es}evaluateCallStatement(e,t){let r=new er((t,r)=>{let s=new ea(r);if(e.callerArgs)for(let r=0;r<e.callerArgs.length;++r){let o=e.callerArgs[r];if("Identifier"!==o.type)throw Error(`Caller parameter must be an identifier, got ${o.type}`);s.setVariable(o.value,t[r]??new eo)}return this.evaluateBlock(e.body,s)}),[s,o]=this.evaluateArguments(e.call.args,t);s.push(new Z(o));let a=this.evaluate(e.call.callee,t);if("FunctionValue"!==a.type)throw Error(`Cannot call something that is not a function: got ${a.type}`);let n=new ea(t);return n.setVariable("caller",r),a.value(s,n)}evaluateFilterStatement(e,t){let r=this.evaluateBlock(e.body,t);return this.applyFilter(r,e.filter,t)}evaluate(e,t){if(!e)return new eo;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"Macro":return this.evaluateMacro(e,t);case"CallStatement":return this.evaluateCallStatement(e,t);case"Break":throw new W;case"Continue":throw new U;case"IntegerLiteral":return new X(e.value);case"FloatLiteral":return new H(e.value);case"StringLiteral":return new J(e.value);case"ArrayLiteral":return new ee(e.value.map(e=>this.evaluate(e,t)));case"TupleLiteral":return new et(e.value.map(e=>this.evaluate(e,t)));case"ObjectLiteral":{let r=new Map;for(let[s,o]of e.value){let e=this.evaluate(s,t);if(!(e instanceof J))throw Error(`Object keys must be strings: got ${e.type}`);r.set(e.value,this.evaluate(o,t))}return new K(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"FilterStatement":return this.evaluateFilterStatement(e,t);case"TestExpression":return this.evaluateTestExpression(e,t);case"SelectExpression":return this.evaluateSelectExpression(e,t);case"Ternary":return this.evaluateTernaryExpression(e,t);case"Comment":return new es;default:throw SyntaxError(`Unknown node type: ${e.type}`)}}};function ei(e,t,r){let s=r??0;switch(e.type){case"NullValue":case"UndefinedValue":return"null";case"IntegerValue":case"FloatValue":case"StringValue":case"BooleanValue":return JSON.stringify(e.value);case"ArrayValue":case"ObjectValue":{let r=t?" ".repeat(t):"",o="\n"+r.repeat(s),a=o+r;if("ArrayValue"===e.type){let r=e.value.map(e=>ei(e,t,s+1));return t?`[${a}${r.join(`,${a}`)}${o}]`:`[${r.join(", ")}]`}{let r=Array.from(e.value.entries()).map(([e,r])=>{let o=`"${e}": ${ei(r,t,s+1)}`;return t?`${a}${o}`:o});return t?`{${r.join(",")}${o}}`:`{${r.join(", ")}}`}}default:throw Error(`Cannot convert to JSON: ${e.type}`)}}function el(...e){return"{%- "+e.join(" ")+" -%}"}function ec(e,t=-1){switch(e.type){case"SpreadExpression":return`*${ec(e.argument)}`;case"Identifier":return e.value;case"IntegerLiteral":case"FloatLiteral":return`${e.value}`;case"StringLiteral":return JSON.stringify(e.value);case"BinaryExpression":{let r=function(e){switch(e.operator.type){case"MultiplicativeBinaryOperator":return 4;case"AdditiveBinaryOperator":return 3;case"ComparisonBinaryOperator":return 2;case"Identifier":if("and"===e.operator.value)return 1;if("in"===e.operator.value||"not in"===e.operator.value)return 2}return 0}(e),s=ec(e.left,r),o=ec(e.right,r+1),a=`${s} ${e.operator.value} ${o}`;return r<t?`(${a})`:a}case"UnaryExpression":return e.operator.value+("not"===e.operator.value?" ":"")+ec(e.argument,1/0);case"CallExpression":{let t=e.args.map(ec).join(", ");return`${ec(e.callee)}(${t})`}case"MemberExpression":{let t=ec(e.object);["Identifier","MemberExpression","CallExpression","StringLiteral","IntegerLiteral","FloatLiteral","ArrayLiteral","TupleLiteral","ObjectLiteral"].includes(e.object.type)||(t=`(${t})`);let r=ec(e.property);return e.computed||"Identifier"===e.property.type||(r=`(${r})`),e.computed?`${t}[${r}]`:`${t}.${r}`}case"FilterExpression":{let t=ec(e.operand,1/0);if("CallExpression"===e.filter.type)return`${t} | ${ec(e.filter)}`;return`${t} | ${e.filter.value}`}case"SelectExpression":return`${ec(e.lhs)} if ${ec(e.test)}`;case"TestExpression":return`${ec(e.operand)} is${e.negate?" not":""} ${e.test.value}`;case"ArrayLiteral":case"TupleLiteral":{let t=e.value.map(ec),r="ArrayLiteral"===e.type?"[]":"()";return`${r[0]}${t.join(", ")}${r[1]}`}case"ObjectLiteral":{let t=Array.from(e.value.entries()).map(([e,t])=>`${ec(e)}: ${ec(t)}`);return`{${t.join(", ")}}`}case"SliceExpression":{let t=e.start?ec(e.start):"",r=e.stop?ec(e.stop):"",s=e.step?`:${ec(e.step)}`:"";return`${t}:${r}${s}`}case"KeywordArgumentExpression":return`${e.key.value}=${ec(e.value)}`;case"Ternary":{let r=`${ec(e.trueExpr)} if ${ec(e.condition,0)} else ${ec(e.falseExpr)}`;return t>-1?`(${r})`:r}default:throw Error(`Unknown expression type: ${e.type}`)}}var ed=class{parsed;constructor(e){let t=c(e,{lstrip_blocks:!0,trim_blocks:!0});this.parsed=G(t)}render(e){let t=new ea;if(t.set("false",!1),t.set("true",!0),t.set("none",null),t.set("raise_exception",e=>{throw Error(e)}),t.set("range",R),t.set("strftime_now",$),t.set("True",!0),t.set("False",!1),t.set("None",null),e)for(let[r,s]of Object.entries(e))t.set(r,s);return new en(t).run(this.parsed).value}format(e){return function(e,t="	"){let r="number"==typeof t?" ".repeat(t):t;return(function e(t,r,s){return t.map(t=>(function(t,r,s){let o=s.repeat(r);switch(t.type){case"Program":return e(t.body,r,s);case"If":return function(t,r,s){let o=s.repeat(r),a=[],n=t;for(;n;)if(a.push({test:n.test,body:n.body}),1===n.alternate.length&&"If"===n.alternate[0].type)n=n.alternate[0];else break;let i=o+el("if",ec(a[0].test))+"\n"+e(a[0].body,r+1,s);for(let t=1;t<a.length;++t)i+="\n"+o+el("elif",ec(a[t].test))+"\n"+e(a[t].body,r+1,s);return n&&n.alternate.length>0&&(i+="\n"+o+el("else")+"\n"+e(n.alternate,r+1,s)),i+="\n"+o+el("endif")}(t,r,s);case"For":var a=t,n=r,i=s;let l=i.repeat(n),c="";if("SelectExpression"===a.iterable.type){let e=a.iterable;c=`${ec(e.lhs)} if ${ec(e.test)}`}else c=ec(a.iterable);let d=l+el("for",ec(a.loopvar),"in",c)+"\n"+e(a.body,n+1,i);return a.defaultBlock.length>0&&(d+="\n"+l+el("else")+"\n"+e(a.defaultBlock,n+1,i)),d+="\n"+l+el("endfor");case"Set":var u=t,m=r,_=s;let p=_.repeat(m),h=ec(u.assignee),f=u.value?ec(u.value):"",g=p+el("set",`${h}${u.value?" = "+f:""}`);return 0===u.body.length?g:g+"\n"+e(u.body,m+1,_)+"\n"+p+el("endset");case"Macro":var M=t,w=r,x=s;let b=x.repeat(w),T=M.args.map(ec).join(", ");return b+el("macro",`${M.name.value}(${T})`)+"\n"+e(M.body,w+1,x)+"\n"+b+el("endmacro");case"Break":return o+el("break");case"Continue":return o+el("continue");case"CallStatement":var P=t,y=r,k=s;let v=k.repeat(y),F=P.callerArgs&&P.callerArgs.length>0?`(${P.callerArgs.map(ec).join(", ")})`:"",C=v+el(`call${F}`,ec(P.call))+"\n";return C+=e(P.body,y+1,k)+"\n",C+=v+el("endcall");case"FilterStatement":var S=t,E=r,A=s;let L=A.repeat(E),I=L+el("filter","Identifier"===S.filter.type?S.filter.value:ec(S.filter))+"\n";return I+=e(S.body,E+1,A)+"\n",I+=L+el("endfilter");case"Comment":return o+"{# "+t.value+" #}";default:return o+"{{- "+ec(t)+" -}}"}})(t,r,s)).join("\n")})(e.body,0,r).replace(/\n$/,"")}(this.parsed,e?.indent||"	")}}},
1"./src/backends/onnx.js":(e,t,r)=>{let s,o;r.r(t),r.d(t,{Tensor:()=>d.Tensor,createInferenceSession:()=>g,deviceToExecutionProviders:()=>h,isONNXProxy:()=>P,isONNXTensor:()=>b,runInferenceSession:()=>x});var n,i=r("./src/env.js"),l=r("?2ce3"),c=r("onnxruntime-web"),d=r("onnxruntime-common");let u=Object.freeze({auto:null,gpu:null,cpu:"cpu",wasm:"wasm",webgpu:"webgpu",cuda:"cuda",dml:"dml",webnn:{name:"webnn",deviceType:"cpu"},"webnn-npu":{name:"webnn",deviceType:"npu"},"webnn-gpu":{name:"webnn",deviceType:"gpu"},"webnn-cpu":{name:"webnn",deviceType:"cpu"}}),m=[],_=Symbol.for("onnxruntime");if(_ in globalThis)o=globalThis[_];else if(i.apis.IS_NODE_ENV){switch(o=l??(n||(n=r.t(l,2))),a.platform){case"win32":m.push("dml");break;case"linux":"x64"===a.arch&&m.push("cuda")}m.push("cpu"),s=["cpu"]}else o=c,i.apis.IS_WEBNN_AVAILABLE&&m.push("webnn-npu","webnn-gpu","webnn-cpu","webnn"),i.apis.IS_WEBGPU_AVAILABLE&&m.push("webgpu"),m.push("wasm"),s=["wasm"];let p=o.InferenceSession;function h(e=null){if(!e)return s;switch(e){case"auto":return m;case"gpu":return m.filter(e=>["webgpu","cuda","dml","webnn-gpu"].includes(e))}if(m.includes(e))return[u[e]??e];throw Error(`Unsupported device: "${e}". Should be one of: ${m.join(", ")}.`)}let f=null;async function g(e,t,r){f&&await f;let s=p.create(e,t);f??=s;let o=await s;return o.config=r,o}let M=Promise.resolve(),w=i.apis.IS_BROWSER_ENV||i.apis.IS_WEBWORKER_ENV;async function x(e,t){let r=()=>e.run(t);return await (w?M=M.then(r):r())}function b(e){return e instanceof o.Tensor}let T=o?.env;function P(){return T?.wasm?.proxy}T?.wasm&&("undefined"!=typeof ServiceWorkerGlobalScope&&self instanceof ServiceWorkerGlobalScope||T.wasm.wasmPaths||(T.wasm.wasmPaths=`https://cdn.jsdelivr.net/npm/@huggingface/transformers@${i.env.version}/dist/`),T.wasm.proxy=!1),T?.webgpu&&(T.webgpu.powerPreference="high-performance"),i.env.backends.onnx=T},
1"./src/base/feature_extraction_utils.js":(e,t,r)=>{r.r(t),r.d(t,{FeatureExtractor:()=>n,validate_audio_inputs:()=>i});var s=r("./src/utils/constants.js"),o=r("./src/utils/generic.js"),a=r("./src/utils/hub.js");class n extends o.Callable{constructor(e){super(),this.config=e}static async from_pretrained(e,t={}){return new this(await (0,a.getModelJSON)(e,s.FEATURE_EXTRACTOR_NAME,!0,t))}}function i(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.`)}},
1"./src/base/image_processors_utils.js":(e,t,r)=>{r.r(t),r.d(t,{ImageProcessor:()=>f,center_to_corners_format:()=>u,post_process_instance_segmentation:()=>h,post_process_object_detection:()=>m,post_process_panoptic_segmentation:()=>p,post_process_semantic_segmentation:()=>_});var s=r("./src/utils/generic.js"),o=r("./src/utils/tensor.js"),a=r("./src/utils/maths.js");r("./src/utils/image.js");var n=r("./src/utils/core.js"),i=r("./src/utils/hub.js"),l=r("./src/utils/constants.js");function c(e,t,r=0,s=null){let o=e/t,n=(0,a.bankers_round)(o)*t;return null!==s&&n>s&&(n=Math.floor(o)*t),n<r&&(n=Math.ceil(o)*t),n}function d([e,t],r){return[Math.max(Math.floor(e/r),1)*r,Math.max(Math.floor(t/r),1)*r]}function u([e,t,r,s]){return[e-r/2,t-s/2,e+r/2,t+s/2]}function m(e,t=.5,r=null,s=!1){let o=e.logits,n=e.pred_boxes,[i,l,c]=o.dims;if(null!==r&&r.length!==i)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<i;++e){let i=null!==r?r[e]:null,m={boxes:[],classes:[],scores:[]},_=o[e],p=n[e];for(let e=0;e<l;++e){let r,o=_[e],n=[];if(s){r=o.sigmoid().data;for(let e=0;e<r.length;++e)r[e]>t&&n.push(e)}else{let e=(0,a.max)(o.data)[1];if(e===c-1||(r=(0,a.softmax)(o.data))[e]<t)continue;n.push(e)}for(let t of n){let s=p[e].data;s=u(s),null!==i&&(s=s.map((e,t)=>e*i[(t+1)%2])),m.boxes.push(s),m.classes.push(t),m.scores.push(r[t])}}d.push(m)}return d}function _(e,t=null){let r=e.logits,s=r.dims[0];if(null!==t&&t.length!==s)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");let a=[];for(let e=0;e<s;++e){let s=null!==t?t[e]:null,n=r[e];null!==s&&(n=(0,o.interpolate)(n,s,"bilinear",!1));let[i,l]=s??n.dims.slice(-2),c=new o.Tensor("int32",new Int32Array(i*l),[i,l]),d=n[0].data,u=c.data;for(let e=1;e<n.dims[0];++e){let t=n[e].data;for(let r=0;r<t.length;++r)t[r]>d[r]&&(d[r]=t[r],u[r]=e)}let m=Array(n.dims[0]);for(let e=0;e<u.length;++e){let t=u[e];m[t]=t}let _=m.filter(e=>void 0!==e);a.push({segmentation:c,labels:_})}return a}function p(e,t=.5,r=.5,s=.8,n=null,i=null){null===n&&(console.warn("`label_ids_to_fuse` unset. No instance will be fused."),n=new Set);let l=e.class_queries_logits??e.logits,c=(e.masks_queries_logits??e.pred_masks).sigmoid(),[d,u,m]=l.dims;if(m-=1,null!==i&&i.length!==d)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");let _=[];for(let e=0;e<d;++e){let d=null!==i?i[e]:null,u=l[e],p=c[e],[h,f,g]=function(e,t,r,s){let o=[],n=[],i=[];for(let l=0;l<e.dims[0];++l){let c=e[l],d=t[l],u=(0,a.max)(c.data)[1];if(u===s)continue;let m=(0,a.softmax)(c.data)[u];m>r&&(o.push(d),n.push(m),i.push(u))}return[o,n,i]}(u,p,t,m);if(0===g.length){let[e,t]=d??p.dims.slice(-2),r=new o.Tensor("int32",new Int32Array(e*t).fill(-1),[e,t]);_.push({segmentation:r,segments_info:[]});continue}let[M,w]=function(e,t,r,s,a,n=null,i=null){let[l,c]=i??e[0].dims,d=new o.Tensor("int32",new Int32Array(l*c),[l,c]),u=[];if(null!==i)for(let t=0;t<e.length;++t)e[t]=(0,o.interpolate)(e[t],i,"bilinear",!1);let m=new Int32Array(e[0].data.length),_=new Float32Array(e[0].data.length);for(let r=0;r<e.length;++r){let s=t[r],o=e[r].data;for(let e=0;e<o.length;++e)o[e]*=s,o[e]>_[e]&&(m[e]=r,_[e]=o[e])}let p=0,h=d.data;for(let o=0;o<r.length;++o){let n=r[o],[i,l]=function(e,t,r,s=.5,o=.8){let a=[],n=0,i=0,l=t[r].data;for(let t=0;t<e.length;++t)e[t]===r&&(a.push(t),++n),l[t]>=s&&++i;let c=n>0&&i>0;return c&&(c=n/i>o),[c,a]}(m,e,o,s,a);if(i){for(let e of(++p,l))h[e]=p;u.push({id:p,label_id:n,score:t[o]})}}return[d,u]}(h,f,g,r,s,n,d);_.push({segmentation:M,segments_info:w})}return _}function h(e,t=.5,r=null){throw Error("`post_process_instance_segmentation` is not yet implemented.")}class f extends s.Callable{constructor(e){super(),this.image_mean=e.image_mean??e.mean,this.image_std=e.image_std??e.std,this.resample=e.resample??2,this.do_rescale=e.do_rescale??!0,this.rescale_factor=e.rescale_factor??1/255,this.do_normalize=e.do_normalize,this.do_thumbnail=e.do_thumbnail,this.size=e.size??e.image_size,this.do_resize=e.do_resize??void 0!==this.size,this.size_divisibility=e.size_divisibility??e.size_divisor,this.do_center_crop=e.do_center_crop,this.crop_size=e.crop_size,this.do_convert_rgb=e.do_convert_rgb??!0,this.do_crop_margin=e.do_crop_margin,this.pad_size=e.pad_size,this.do_pad=e.do_pad,this.min_pixels=e.min_pixels,this.max_pixels=e.max_pixels,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=e.do_flip_channel_order??!1,this.config=e}
1async thumbnail(e,t,r=2){let s=e.height,o=e.width,a=t.height,n=t.width,i=Math.min(s,a),l=Math.min(o,n);return i===s&&l===o?e:(s>o?l=Math.floor(o*i/s):o>s&&(i=Math.floor(s*l/o)),await e.resize(l,i,{resample:r}))}async crop_margin(e,t=200){let r=e.clone().grayscale(),s=(0,a.min)(r.data)[0],o=(0,a.max)(r.data)[0]-s;if(0===o)return e;let n=t/255,i=r.width,l=r.height,c=0,d=0,u=r.data;for(let e=0;e<r.height;++e){let t=e*r.width;for(let a=0;a<r.width;++a)(u[t+a]-s)/o<n&&(i=Math.min(i,a),l=Math.min(l,e),c=Math.max(c,a),d=Math.max(d,e))}return e=await e.crop([i,l,c,d])}pad_image(e,t,r,{mode:s="constant",center:o=!1,constant_values:a=0}={}){let i,l,[c,d,u]=t;if("number"==typeof r?(i=r,l=r):"square"===r?i=l=Math.max(c,d):(i=r.width,l=r.height),i!==d||l!==c){let r=new Float32Array(i*l*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[m,_]=o?[Math.floor((i-d)/2),Math.floor((l-c)/2)]:[0,0];for(let t=0;t<c;++t){let s=(t+_)*i,o=t*d;for(let t=0;t<d;++t){let a=(s+t+m)*u,n=(o+t)*u;for(let t=0;t<u;++t)r[a+t]=e[n+t]}}if("symmetric"===s){if(o)throw Error("`center` padding is not supported when `mode` is set to `symmetric`.");let t=c-1,s=d-1;for(let o=0;o<l;++o){let a=o*i,l=(0,n.calculateReflectOffset)(o,t)*d;for(let t=0;t<i;++t){if(o<c&&t<d)continue;let i=(a+t)*u,m=(l+(0,n.calculateReflectOffset)(t,s))*u;for(let t=0;t<u;++t)r[i+t]=e[m+t]}}}e=r,t=[l,i,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,s,[o,a]=e.size;if(this.do_thumbnail){let{height:e,width:s}=t;r=Math.min(e,s)}else Number.isInteger(t)?(r=t,s=this.config.max_size??r):void 0!==t&&(r=t.shortest_edge,s=t.longest_edge);if(void 0!==r||void 0!==s){let e=void 0===r?1:Math.max(r/o,r/a),t=o*e,n=a*e,i=void 0===s?1:Math.min(s/t,s/n),l=Math.floor(Number((t*i).toFixed(2))),c=Math.floor(Number((n*i).toFixed(2)));return void 0!==this.size_divisibility&&([l,c]=d([l,c],this.size_divisibility)),[l,c]}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,s=e/o;Math.abs(1-s)<Math.abs(1-t)?t=s:s=t,r=c(t*a,this.config.ensure_multiple_of),e=c(s*o,this.config.ensure_multiple_of)}return[e,r]}if(void 0!==this.size_divisibility)return d([o,a],this.size_divisibility);if(void 0!==this.min_pixels&&void 0!==this.max_pixels)return function(e,t,r=28,s=3136,o=1003520){if(e<r||t<r)throw Error(`height:${e} or width:${t} must be larger than factor:${r}`);if(Math.max(e,t)/Math.min(e,t)>200)throw Error(`absolute aspect ratio must be smaller than 200, got ${Math.max(e,t)/Math.min(e,t)}`);let a=Math.round(e/r)*r,n=Math.round(t/r)*r;if(a*n>o){let s=Math.sqrt(e*t/o);a=Math.floor(e/s/r)*r,n=Math.floor(t/s/r)*r}else if(a*n<s){let o=Math.sqrt(s/(e*t));a=Math.ceil(e*o/r)*r,n=Math.ceil(t*o/r)*r}return[a,n]}(a,o,this.config.patch_size*this.config.merge_size,this.min_pixels,this.max_pixels);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:s=null,do_convert_grayscale:a=null,do_flip_channel_order:n=null}={}){this.do_crop_margin&&(e=await this.crop_margin(e));let[i,l]=e.size;if(s??this.do_convert_rgb?e=e.rgb():a&&(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 c=[e.height,e.width],u=Float32Array.from(e.data),m=[e.height,e.width,e.channels];if(this.do_rescale&&this.rescale(u),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 s=0;s<u.length;s+=e.channels)for(let o=0;o<e.channels;++o)u[s+o]=(u[s+o]-t[o])/r[o]}if(r??this.do_pad){if(this.pad_size){let t=this.pad_image(u,[e.height,e.width,e.channels],this.pad_size);[u,m]=t}else if(this.size_divisibility){let[e,t]=d([m[1],m[0]],this.size_divisibility);[u,m]=this.pad_image(u,m,{width:e,height:t})}}if(n??this.do_flip_channel_order){if(3!==m[2])throw Error("Flipping channel order is only supported for RGB images.");for(let e=0;e<u.length;e+=3){let t=u[e];u[e]=u[e+2],u[e+2]=t}}return{original_size:[l,i],reshaped_input_size:c,pixel_values:new o.Tensor("float32",u,m).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,o.stack)(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)}}static async from_pretrained(e,t={}){return new this(await (0,i.getModelJSON)(e,l.IMAGE_PROCESSOR_NAME,!0,t))}}},
1"./src/base/processing_utils.js":(e,t,r)=>{r.r(t),r.d(t,{Processor:()=>n});var s=r("./src/utils/constants.js"),o=r("./src/utils/generic.js"),a=r("./src/utils/hub.js");class n extends o.Callable{static classes=["image_processor_class","tokenizer_class","feature_extractor_class"];static uses_processor_config=!1;static uses_chat_template_file=!1;constructor(e,t,r){super(),this.config=e,this.components=t,this.chat_template=r}get image_processor(){return this.components.image_processor}get tokenizer(){return this.components.tokenizer}get feature_extractor(){return this.components.feature_extractor}apply_chat_template(e,t={}){if(!this.tokenizer)throw Error("Unable to apply chat template without a tokenizer.");return this.tokenizer.apply_chat_template(e,{tokenize:!1,chat_template:this.chat_template??void 0,...t})}batch_decode(...e){if(!this.tokenizer)throw Error("Unable to decode without a tokenizer.");return this.tokenizer.batch_decode(...e)}decode(...e){if(!this.tokenizer)throw Error("Unable to decode without a tokenizer.");return this.tokenizer.decode(...e)}async _call(e,...t){for(let r of[this.image_processor,this.feature_extractor,this.tokenizer])if(r)return r(e,...t);throw Error("No image processor, feature extractor, or tokenizer found.")}static async from_pretrained(e,t={}){let[r,o,n]=await Promise.all([this.uses_processor_config?(0,a.getModelJSON)(e,s.PROCESSOR_NAME,!0,t):{},Promise.all(this.classes.filter(e=>e in this).map(async r=>{let s=await this[r].from_pretrained(e,t);return[r.replace(/_class$/,""),s]})).then(Object.fromEntries),this.uses_chat_template_file?(0,a.getModelText)(e,s.CHAT_TEMPLATE_NAME,!0,t):null]);return new this(r,o,n)}}},
1"./src/configs.js":(e,t,r)=>{r.r(t),r.d(t,{AutoConfig:()=>l,PretrainedConfig:()=>i,getCacheShapes:()=>n});var s=r("./src/utils/core.js"),o=r("./src/utils/hub.js");async function a(e,t){return await (0,o.getModelJSON)(e,"config.json",!0,t)}function n(e,t){if("lfm2"===e.model_type){let r=t?.prefix??"past_key_values",s="present"===r?"present":"past",o={},{layer_types:a,num_attention_heads:n,num_key_value_heads:i,hidden_size:l,conv_L_cache:c}=e,d=l/n,u=t?.batch_size??1;for(let e=0;e<a.length;++e)if("full_attention"===a[e])for(let t of["key","value"])o[`${r}.${e}.${t}`]=[u,i,0,d];else if("conv"===a[e])o[`${s}_conv.${e}`]=[u,l,c];else throw Error(`Unsupported layer type: ${a[e]}`);return o}return function(e,{prefix:t="past_key_values",batch_size:r=1}={}){let s={},o=e.normalized_config;if(o.is_encoder_decoder&&"num_encoder_heads"in o&&"num_decoder_heads"in o){let e=o.encoder_dim_kv??o.encoder_hidden_size/o.num_encoder_heads,a=o.decoder_dim_kv??o.decoder_hidden_size/o.num_decoder_heads,n=[r,o.num_encoder_heads,0,e],i=[r,o.num_decoder_heads,0,a];for(let e=0;e<o.num_decoder_layers;++e)s[`${t}.${e}.encoder.key`]=n,s[`${t}.${e}.encoder.value`]=n,s[`${t}.${e}.decoder.key`]=i,s[`${t}.${e}.decoder.value`]=i}else{let e=o.num_heads,a=o.num_layers,n=o.dim_kv??o.hidden_size/(o.num_attention_heads??e);if("falcon"===o.model_type){let o=[r*e,0,n];for(let e=0;e<a;++e)s[`${t}.${e}.key`]=o,s[`${t}.${e}.value`]=o}else if(o.multi_query){let o=[r*e,0,2*n];for(let e=0;e<a;++e)s[`${t}.${e}.key_value`]=o}else if("bloom"===o.model_type){let o=[r*e,n,0],i=[r*e,0,n];for(let e=0;e<a;++e)s[`${t}.${e}.key`]=o,s[`${t}.${e}.value`]=i}else if("openelm"===o.model_type)for(let o=0;o<a;++o){let a=[r,e[o],0,n];s[`${t}.${o}.key`]=a,s[`${t}.${o}.value`]=a}else{let o=[r,e,0,n];for(let e=0;e<a;++e)s[`${t}.${e}.key`]=o,s[`${t}.${e}.value`]=o}}return s}(e,t)}class i{model_type=null;is_encoder_decoder=!1;max_position_embeddings;"transformers.js_config";constructor(e){Object.assign(this,e),this.normalized_config=function e(t){let r={},o={};switch(t.model_type){case"llava":case"paligemma":case"gemma3":case"florence2":case"llava_onevision":case"idefics3":case"ultravox":case"voxtral":case"smolvlm":case"gemma3n":o=e(t.text_config);break;case"moondream1":o=e(t.phi_config);break;case"musicgen":o=e(t.decoder);break;case"multi_modality":o=e(t.language_config);break;case"gpt2":case"gptj":case"jais":case"codegen":case"gpt_bigcode":r.num_heads="n_head",r.num_layers="n_layer",r.hidden_size="n_embd";break;case"gpt_neox":case"stablelm":case"opt":case"falcon":case"modernbert-decoder":r.num_heads="num_attention_heads",r.num_layers="num_hidden_layers",r.hidden_size="hidden_size";break;case"llama":case"llama4_text":case"nanochat":case"arcee":case"lfm2":case"smollm3":case"olmo":case"olmo2":case"mobilellm":case"granite":case"granitemoehybrid":case"cohere":case"mistral":case"starcoder2":case"qwen2":case"qwen2_vl":case"phi":case"phi3":case"phi3_v":case"llava_qwen2":r.num_heads="num_key_value_heads",r.num_layers="num_hidden_layers",r.hidden_size="hidden_size",r.num_attention_heads="num_attention_heads",r.dim_kv="head_dim";break;case"qwen3":case"gemma":case"gemma2":case"vaultgemma":case"gemma3_text":case"gemma3n_text":case"glm":case"helium":case"ernie4_5":r.num_heads="num_key_value_heads",r.num_layers="num_hidden_layers",r.dim_kv="head_dim";break;case"openelm":r.num_heads="num_kv_heads",r.num_layers="num_transformer_layers",r.dim_kv="head_dim";break;case"gpt_neo":case"donut-swin":r.num_heads="num_heads",r.num_layers="num_layers",r.hidden_size="hidden_size";break;case"bloom":r.num_heads="n_head",r.num_layers="n_layer",r.hidden_size="hidden_size";break;case"mpt":r.num_heads="n_heads",r.num_layers="n_layers",r.hidden_size="d_model";break;case"exaone":r.num_heads="num_key_value_heads",r.num_layers="num_layers",r.dim_kv="head_dim",r.num_attention_heads="num_attention_heads";break;case"t5":case"mt5":case"longt5":r.num_decoder_layers="num_decoder_layers",r.num_decoder_heads="num_heads",r.decoder_dim_kv="d_kv",r.num_encoder_layers="num_layers",r.num_encoder_heads="num_heads",r.encoder_dim_kv="d_kv";break;case"bart":case"mbart":case"marian":case"whisper":case"lite-whisper":case"m2m_100":case"blenderbot":case"blenderbot-small":case"florence2_language":r.num_decoder_layers="decoder_layers",r.num_decoder_heads="decoder_attention_heads",r.decoder_hidden_size="d_model",r.num_encoder_layers="encoder_layers",r.num_encoder_heads="encoder_attention_heads",r.encoder_hidden_size="d_model";break;case"speecht5":r.num_decoder_layers="decoder_layers",r.num_decoder_heads="decoder_attention_heads",r.decoder_hidden_size="hidden_size",r.num_encoder_layers="encoder_layers",r.num_encoder_heads="encoder_attention_heads",r.encoder_hidden_size="hidden_size";break;case"trocr":r.num_encoder_layers=r.num_decoder_layers="decoder_layers",r.num_encoder_heads=r.num_decoder_heads="decoder_attention_heads",r.encoder_hidden_size=r.decoder_hidden_size="d_model";break;case"musicgen_decoder":r.num_encoder_layers=r.num_decoder_layers="num_hidden_layers",r.num_encoder_heads=r.num_decoder_heads="num_attention_heads",r.encoder_hidden_size=r.decoder_hidden_size="hidden_size";break;case"moonshine":r.num_decoder_layers="decoder_num_hidden_layers",r.num_decoder_heads="decoder_num_key_value_heads",r.num_encoder_layers="encoder_num_hidden_layers",r.num_encoder_heads="encoder_num_key_value_heads",r.encoder_hidden_size=r.decoder_hidden_size="hidden_size";break;case"vision-encoder-decoder":let a=e(t.decoder),n="num_decoder_layers"in a,i=(0,s.pick)(t,["model_type","is_encoder_decoder"]);return n?(i.num_decoder_layers=a.num_decoder_layers,i.num_decoder_heads=a.num_decoder_heads,i.decoder_hidden_size=a.decoder_hidden_size,i.num_encoder_layers=a.num_encoder_layers,i.num_encoder_heads=a.num_encoder_heads,i.encoder_hidden_size=a.encoder_hidden_size):(i.num_layers=a.num_layers,i.num_heads=a.num_heads,i.hidden_size=a.hidden_size),i}let l={...o,...(0,s.pick)(t,["model_type","multi_query","is_encoder_decoder"])};for(let e in r)l[e]=t[r[e]];return l}(this)}static async from_pretrained(e,{progress_callback:t=null,config:r=null,cache_dir:s=null,local_files_only:o=!1,revision:n="main"}={}){return!r||r instanceof i||(r=new i(r)),new this(r??await a(e,{progress_callback:t,config:r,cache_dir:s,local_files_only:o,revision:n}))}}class l{static async from_pretrained(...e){return i.from_pretrained(...e)}
1}},
1"./src/env.js":(e,t,r)=>{r.r(t),r.d(t,{apis:()=>g,env:()=>T});var s=r("?db59"),o=r("?383f"),n=r("?fa4b");let i="undefined"!=typeof window&&void 0!==window.document,l="undefined"!=typeof self&&["DedicatedWorkerGlobalScope","ServiceWorkerGlobalScope","SharedWorkerGlobalScope"].includes(self.constructor?.name),c="undefined"!=typeof self&&"caches"in self,d="undefined"!=typeof navigator&&"gpu"in navigator,u="undefined"!=typeof navigator&&"ml"in navigator,m=void 0!==a,_=m&&a?.release?.name==="node",p=!P(s),h=!P(o),f=void 0!==globalThis.Deno;globalThis.Bun;let g=Object.freeze({IS_BROWSER_ENV:i,IS_WEBWORKER_ENV:l,IS_WEB_CACHE_AVAILABLE:c,IS_WEBGPU_AVAILABLE:d,IS_WEBNN_AVAILABLE:u,IS_PROCESS_AVAILABLE:m,IS_NODE_ENV:_,IS_FS_AVAILABLE:p,IS_PATH_AVAILABLE:h}),M=p&&h,w="./";if(M){let e=Object({}).url;e?w=o.dirname(o.dirname(n.fileURLToPath(e))):"undefined"!=typeof __dirname&&(w=o.dirname(__dirname))}let x=M?o.join(w,"/.cache/"):null,b="/models/",T={version:"3.7.6",backends:{onnx:{}},allowRemoteModels:!0,remoteHost:"https://huggingface.co/",remotePathTemplate:"{model}/resolve/{revision}/",allowLocalModels:!(i||l),localModelPath:M?o.join(w,b):b,useFS:p,useBrowserCache:c&&!f,useFSCache:p,cacheDir:x,useCustomCache:!1,customCache:null};function P(e){return 0===Object.keys(e).length}},
1"./src/generation/configuration_utils.js":(e,t,r)=>{r.r(t),r.d(t,{GenerationConfig:()=>o});var s=r("./src/utils/core.js");class o{max_length=20;max_new_tokens=null;min_length=0;min_new_tokens=null;early_stopping=!1;max_time=null;do_sample=!1;num_beams=1;num_beam_groups=1;penalty_alpha=null;use_cache=!0;temperature=1;top_k=50;top_p=1;typical_p=1;epsilon_cutoff=0;eta_cutoff=0;diversity_penalty=0;repetition_penalty=1;encoder_repetition_penalty=1;length_penalty=1;no_repeat_ngram_size=0;bad_words_ids=null;force_words_ids=null;renormalize_logits=!1;constraints=null;forced_bos_token_id=null;forced_eos_token_id=null;remove_invalid_values=!1;exponential_decay_length_penalty=null;suppress_tokens=null;streamer=null;begin_suppress_tokens=null;forced_decoder_ids=null;guidance_scale=null;num_return_sequences=1;output_attentions=!1;output_hidden_states=!1;output_scores=!1;return_dict_in_generate=!1;pad_token_id=null;bos_token_id=null;eos_token_id=null;encoder_no_repeat_ngram_size=0;decoder_start_token_id=null;generation_kwargs={};constructor(e){Object.assign(this,(0,s.pick)(e,Object.getOwnPropertyNames(this)))}}},
1"./src/generation/logits_process.js":(e,t,r)=>{r.r(t),r.d(t,{ClassifierFreeGuidanceLogitsProcessor:()=>g,ForcedBOSTokenLogitsProcessor:()=>l,ForcedEOSTokenLogitsProcessor:()=>c,LogitsProcessor:()=>a,LogitsProcessorList:()=>i,LogitsWarper:()=>n,MinLengthLogitsProcessor:()=>p,MinNewTokensLengthLogitsProcessor:()=>h,NoBadWordsLogitsProcessor:()=>f,NoRepeatNGramLogitsProcessor:()=>m,RepetitionPenaltyLogitsProcessor:()=>_,SuppressTokensAtBeginLogitsProcessor:()=>d,TemperatureLogitsWarper:()=>M,TopKLogitsWarper:()=>x,TopPLogitsWarper:()=>w,WhisperTimeStampLogitsProcessor:()=>u});var s=r("./src/utils/generic.js");r("./src/utils/tensor.js");var o=r("./src/utils/maths.js");class a extends s.Callable{_call(e,t){throw Error("`_call` should be implemented in a subclass")}}class n extends s.Callable{_call(e,t){throw Error("`_call` should be implemented in a subclass")}}class i extends s.Callable{constructor(){super(),this.processors=[]}push(e){this.processors.push(e)}extend(e){this.processors.push(...e)}_call(e,t){let r=t;for(let t of this.processors)r=t(e,r);return r}[Symbol.iterator](){return this.processors.values()}}class l extends a{constructor(e){super(),this.bos_token_id=e}_call(e,t){for(let r=0;r<e.length;++r)if(1===e[r].length){let e=t[r].data;e.fill(-1/0),e[this.bos_token_id]=0}return t}}class c extends a{constructor(e,t){super(),this.max_length=e,this.eos_token_id=Array.isArray(t)?t:[t]}_call(e,t){for(let r=0;r<e.length;++r)if(e[r].length===this.max_length-1){let e=t[r].data;for(let t of(e.fill(-1/0),this.eos_token_id))e[t]=0}return t}}class d extends a{constructor(e,t){super(),this.begin_suppress_tokens=e,this.begin_index=t}_call(e,t){for(let r=0;r<e.length;++r)if(e[r].length===this.begin_index){let e=t[r].data;for(let t of this.begin_suppress_tokens)e[t]=-1/0}return t}}class u extends a{constructor(e,t){super(),this.eos_token_id=Array.isArray(e.eos_token_id)?e.eos_token_id[0]: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=t.length,t.at(-1)===this.no_timestamps_token_id&&(this.begin_index-=1),this.max_initial_timestamp_index=e.max_initial_timestamp_index}_call(e,t){for(let r=0;r<e.length;++r){let s=t[r].data;if(s[this.no_timestamps_token_id]=-1/0,e[r].length===this.begin_index-1){s.fill(-1/0),s[this.timestamp_begin]=0;continue}let a=e[r].slice(this.begin_index),n=a.length>=1&&a[a.length-1]>=this.timestamp_begin,i=a.length<2||a[a.length-2]>=this.timestamp_begin;if(n&&(i?s.subarray(this.timestamp_begin).fill(-1/0):s.subarray(0,this.eos_token_id).fill(-1/0)),e[r].length===this.begin_index&&null!==this.max_initial_timestamp_index){let e=this.timestamp_begin+this.max_initial_timestamp_index;s.subarray(e+1).fill(-1/0)}let l=(0,o.log_softmax)(s);Math.log(l.subarray(this.timestamp_begin).map(Math.exp).reduce((e,t)=>e+t))>(0,o.max)(l.subarray(0,this.timestamp_begin))[0]&&s.subarray(0,this.timestamp_begin).fill(-1/0)}return t}}class m extends a{constructor(e){super(),this.no_repeat_ngram_size=e}getNgrams(e){let t=e.length,r=[];for(let s=0;s<t+1-this.no_repeat_ngram_size;++s){let t=[];for(let r=0;r<this.no_repeat_ngram_size;++r)t.push(e[s+r]);r.push(t.map(Number))}let s=new Map;for(let e of r){let t=JSON.stringify(e.slice(0,e.length-1)),r=s.get(t)??[];r.push(e[e.length-1]),s.set(t,r)}return s}getGeneratedNgrams(e,t){let r=t.slice(t.length+1-this.no_repeat_ngram_size,t.length);return e.get(JSON.stringify(r.map(Number)))??[]}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=0;r<e.length;++r){let s=t[r].data;for(let t of this.calcBannedNgramTokens(e[r]))s[t]=-1/0}return t}}class _ extends a{constructor(e){super(),this.penalty=e}_call(e,t){for(let r=0;r<e.length;++r){let s=t[r].data;for(let t of new Set(e[r])){let e=Number(t);s[e]<0?s[e]*=this.penalty:s[e]/=this.penalty}}return t}}class p extends a{constructor(e,t){super(),this.min_length=e,this.eos_token_id=Array.isArray(t)?t:[t]}_call(e,t){for(let r=0;r<e.length;++r)if(e[r].length<this.min_length){let e=t[r].data;for(let t of this.eos_token_id)e[t]=-1/0}return t}}class h extends a{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){for(let r=0;r<e.length;++r)if(e[r].length-this.prompt_length_to_skip<this.min_new_tokens){let e=t[r].data;for(let t of this.eos_token_id)e[t]=-1/0}return t}}class f extends a{constructor(e,t){super(),this.bad_words_ids=e,this.eos_token_id=Array.isArray(t)?t:[t]}_call(e,t){for(let r=0;r<e.length;++r){let s=t[r].data,o=e[r];for(let e of this.bad_words_ids){if(o.length<e.length-1)continue;let t=!0;for(let r=1;r<=e.length-1;++r)if(e.at(-r-1)!=o.at(-r)){t=!1;break}t&&(s[e.at(-1)]=-1/0)}}return t}}class g extends a{constructor(e){if(super(),e<=1)throw Error(`Require guidance scale >1 to use the classifier free guidance processor, got guidance scale ${e}.`);this.guidance_scale=e}_call(e,t){if(t.dims[0]!==2*e.length)throw Error(`Logits should have twice the batch size of the input ids, the first half of batches corresponding to the conditional inputs, and the second half of batches corresponding to the unconditional inputs. Got batch size ${t.dims[0]} for the logits and ${e.length} for the input ids.`);let r=e.length,s=t.slice([0,r],null),o=t.slice([r,t.dims[0]],null);for(let e=0;e<o.data.length;++e)o.data[e]+=(s.data[e]-o.data[e])*this.guidance_scale;return o}}class M extends n{constructor(e){super(),"number"!=typeof e||e<=0,this.temperature=e}_call(e,t){let r=t.data;for(let e=0;e<r.length;++e)r[e]/=this.temperature;return t}}class w extends n{constructor(e,{filter_value:t=-1/0,min_tokens_to_keep:r=1}={}){if(super(),e<0||e>1)throw Error(`\`top_p\` must be a float > 0 and < 1, but is ${e}`);if(!Number.isInteger(r)||r<1)throw Error(`\`min_tokens_to_keep\` must be a positive integer, but is ${r}`);this.top_p=e,this.filter_value=t,this.min_tokens_to_keep=r}}class x extends n{constructor(e,{filter_value:t=-1/0,min_tokens_to_keep:r=1}={}){if(super(),!Number.isInteger(e)||e<0)throw Error(`\`top_k\` must be a positive integer, but is ${e}`);this.top_k=Math.max(e,r),this.filter_value=t}}},
1"./src/generation/logits_sampler.js":(e,t,r)=>{r.r(t),r.d(t,{LogitsSampler:()=>n});var s=r("./src/utils/generic.js"),o=r("./src/utils/tensor.js"),a=r("./src/utils/maths.js");r("./src/generation/configuration_utils.js");class n extends s.Callable{constructor(e){super(),this.generation_config=e}async _call(e){return this.sample(e)}async sample(e){throw Error("sample should be implemented in subclasses.")}getLogits(e,t){let r=e.dims.at(-1),s=e.data;if(-1===t)s=s.slice(-r);else{let e=t*r;s=s.slice(e,e+r)}return s}randomSelect(e){let t=0;for(let r=0;r<e.length;++r)t+=e[r];let r=Math.random()*t;for(let t=0;t<e.length;++t)if((r-=e[t])<=0)return t;return 0}static getSampler(e){if(e.do_sample)return new l(e);if(e.num_beams>1)return new c(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 i(e)}}class i extends n{async sample(e){return[[BigInt((0,a.max)(e.data)[1]),0]]}}class l extends n{async sample(e){let t=e.dims.at(-1);this.generation_config.top_k>0&&(t=Math.min(this.generation_config.top_k,t));let[r,s]=await (0,o.topk)(e,t),n=(0,a.softmax)(r.data);return Array.from({length:this.generation_config.num_beams},()=>{let e=this.randomSelect(n);return[s.data[e],Math.log(n[e])]})}}class c extends n{async sample(e){let t=e.dims.at(-1);this.generation_config.top_k>0&&(t=Math.min(this.generation_config.top_k,t));let[r,s]=await (0,o.topk)(e,t),n=(0,a.softmax)(r.data);return Array.from({length:this.generation_config.num_beams},(e,t)=>[s.data[t],Math.log(n[t])])}}},
1"./src/generation/stopping_criteria.js":(e,t,r)=>{r.r(t),r.d(t,{EosTokenCriteria:()=>i,InterruptableStoppingCriteria:()=>l,MaxLengthCriteria:()=>n,StoppingCriteria:()=>o,StoppingCriteriaList:()=>a});var s=r("./src/utils/generic.js");class o extends s.Callable{_call(e,t){throw Error("StoppingCriteria needs to be subclassed")}}class a extends s.Callable{constructor(){super(),this.criteria=[]}push(e){this.criteria.push(e)}extend(e){e instanceof a?e=e.criteria:e instanceof o&&(e=[e]),this.criteria.push(...e)}_call(e,t){let r=Array(e.length).fill(!1);for(let s of this.criteria){let o=s(e,t);for(let e=0;e<r.length;++e)r[e]||=o[e]}return r}[Symbol.iterator](){return this.criteria.values()}}class n extends o{constructor(e,t=null){super(),this.max_length=e,this.max_position_embeddings=t}_call(e){return e.map(e=>e.length>=this.max_length)}}class i extends o{constructor(e){super(),Array.isArray(e)||(e=[e]),this.eos_token_id=e}_call(e,t){return e.map(e=>{let t=e.at(-1);return this.eos_token_id.some(e=>t==e)})}}class l extends o{constructor(){super(),this.interrupted=!1}interrupt(){this.interrupted=!0}reset(){this.interrupted=!1}_call(e,t){return Array(e.length).fill(this.interrupted)}}},
1"./src/generation/streamers.js":(e,t,r)=>{r.r(t),r.d(t,{BaseStreamer:()=>i,TextStreamer:()=>c,WhisperTextStreamer:()=>d});var s=r("./src/utils/core.js"),o=r("./src/tokenizers.js"),n=r("./src/env.js");class i{put(e){throw Error("Not implemented")}end(){throw Error("Not implemented")}}let l=n.apis.IS_PROCESS_AVAILABLE?e=>a.stdout.write(e):e=>console.log(e);class c extends i{constructor(e,{skip_prompt:t=!1,callback_function:r=null,token_callback_function:s=null,skip_special_tokens:o=!0,decode_kwargs:a={},...n}={}){super(),this.tokenizer=e,this.skip_prompt=t,this.callback_function=r??l,this.token_callback_function=s,this.decode_kwargs={skip_special_tokens:o,...a,...n},this.token_cache=[],this.print_len=0,this.next_tokens_are_prompt=!0}put(e){let t;if(e.length>1)throw Error("TextStreamer only supports batch size of 1");let r=this.next_tokens_are_prompt;if(r&&(this.next_tokens_are_prompt=!1,this.skip_prompt))return;let a=e[0];this.token_callback_function?.(a),this.token_cache=(0,s.mergeArrays)(this.token_cache,a);let n=this.tokenizer.decode(this.token_cache,this.decode_kwargs);r||n.endsWith("\n")?(t=n.slice(this.print_len),this.token_cache=[],this.print_len=0):(t=n.length>0&&(0,o.is_chinese_char)(n.charCodeAt(n.length-1))?n.slice(this.print_len):n.slice(this.print_len,n.lastIndexOf(" ")+1),this.print_len+=t.length),this.on_finalized_text(t,!1)}end(){let e;this.token_cache.length>0?(e=this.tokenizer.decode(this.token_cache,this.decode_kwargs).slice(this.print_len),this.token_cache=[],this.print_len=0):e="",this.next_tokens_are_prompt=!0,this.on_finalized_text(e,!0)}on_finalized_text(e,t){e.length>0&&this.callback_function?.(e),t&&this.callback_function===l&&n.apis.IS_PROCESS_AVAILABLE&&this.callback_function?.("\n")}}class d extends c{constructor(e,{skip_prompt:t=!1,callback_function:r=null,token_callback_function:s=null,on_chunk_start:o=null,on_chunk_end:a=null,on_finalize:n=null,time_precision:i=.02,skip_special_tokens:l=!0,decode_kwargs:c={}}={}){super(e,{skip_prompt:t,skip_special_tokens:l,callback_function:r,token_callback_function:s,decode_kwargs:c}),this.timestamp_begin=e.timestamp_begin,this.on_chunk_start=o,this.on_chunk_end=a,this.on_finalize=n,this.time_precision=i,this.waiting_for_timestamp=!1}put(e){if(e.length>1)throw Error("WhisperTextStreamer only supports batch size of 1");let t=e[0];if(1===t.length){let e=Number(t[0])-this.timestamp_begin;if(e>=0){let r=e*this.time_precision;this.waiting_for_timestamp?this.on_chunk_end?.(r):this.on_chunk_start?.(r),this.waiting_for_timestamp=!this.waiting_for_timestamp,this.token_callback_function?.(t);return}}return super.put(e)}end(){super.end(),this.on_finalize?.()}}},
1"./src/models.js":(e,t,r)=>{r.r(t),r.d(t,{ASTForAudioClassification:()=>re,ASTModel:()=>t7,ASTPreTrainedModel:()=>t9,AlbertForMaskedLM:()=>tw,AlbertForQuestionAnswering:()=>tM,AlbertForSequenceClassification:()=>tg,AlbertModel:()=>tf,AlbertPreTrainedModel:()=>th,ArceeForCausalLM:()=>su,ArceeModel:()=>sd,ArceePreTrainedModel:()=>sc,AutoModel:()=>l6,AutoModelForAudioClassification:()=>cf,AutoModelForAudioFrameClassification:()=>cM,AutoModelForAudioTextToText:()=>cF,AutoModelForCTC:()=>ch,AutoModelForCausalLM:()=>co,AutoModelForDepthEstimation:()=>cT,AutoModelForDocumentQuestionAnswering:()=>cw,AutoModelForImageClassification:()=>cl,AutoModelForImageFeatureExtraction:()=>ck,AutoModelForImageMatting:()=>cx,AutoModelForImageSegmentation:()=>cc,AutoModelForImageTextToText:()=>cv,AutoModelForImageToImage:()=>cb,AutoModelForMaskGeneration:()=>cp,AutoModelForMaskedLM:()=>ca,AutoModelForNormalEstimation:()=>cP,AutoModelForObjectDetection:()=>cm,AutoModelForPoseEstimation:()=>cy,AutoModelForQuestionAnswering:()=>cn,AutoModelForSemanticSegmentation:()=>cd,AutoModelForSeq2SeqLM:()=>ce,AutoModelForSequenceClassification:()=>l9,AutoModelForSpeechSeq2Seq:()=>ct,AutoModelForTextToSpectrogram:()=>cr,AutoModelForTextToWaveform:()=>cs,AutoModelForTokenClassification:()=>l7,AutoModelForUniversalSegmentation:()=>cu,AutoModelForVision2Seq:()=>ci,AutoModelForXVector:()=>cg,AutoModelForZeroShotObjectDetection:()=>c_,BartForConditionalGeneration:()=>tA,BartForSequenceClassification:()=>tL,BartModel:()=>tE,BartPretrainedModel:()=>tS,BaseModelOutput:()=>Q,BeitForImageClassification:()=>o2,BeitModel:()=>o1,BeitPreTrainedModel:()=>o0,BertForMaskedLM:()=>J,BertForQuestionAnswering:()=>Z,BertForSequenceClassification:()=>Y,BertForTokenClassification:()=>K,BertModel:()=>H,BertPreTrainedModel:()=>X,BlenderbotForConditionalGeneration:()=>tB,BlenderbotModel:()=>tN,BlenderbotPreTrainedModel:()=>tO,BlenderbotSmallForConditionalGeneration:()=>tq,BlenderbotSmallModel:()=>tR,BlenderbotSmallPreTrainedModel:()=>tG,BloomForCausalLM:()=>om,BloomModel:()=>ou,BloomPreTrainedModel:()=>od,CLIPModel:()=>rv,CLIPPreTrainedModel:()=>rk,CLIPSegForImageSegmentation:()=>rq,CLIPSegModel:()=>rR,CLIPSegPreTrainedModel:()=>rG,CLIPTextModel:()=>rF,CLIPTextModelWithProjection:()=>rC,CLIPVisionModel:()=>rS,CLIPVisionModelWithProjection:()=>rE,CamembertForMaskedLM:()=>eD,CamembertForQuestionAnswering:()=>eN,CamembertForSequenceClassification:()=>eV,CamembertForTokenClassification:()=>eO,CamembertModel:()=>ez,CamembertPreTrainedModel:()=>ej,CausalLMOutput:()=>cj,CausalLMOutputWithPast:()=>cz,ChineseCLIPModel:()=>rD,ChineseCLIPPreTrainedModel:()=>rz,ClapAudioModelWithProjection:()=>ib,ClapModel:()=>iw,ClapPreTrainedModel:()=>iM,ClapTextModelWithProjection:()=>ix,CodeGenForCausalLM:()=>se,CodeGenModel:()=>r7,CodeGenPreTrainedModel:()=>r9,CohereForCausalLM:()=>s$,CohereModel:()=>sq,CoherePreTrainedModel:()=>sR,ConvBertForMaskedLM:()=>ey,ConvBertForQuestionAnswering:()=>eF,ConvBertForSequenceClassification:()=>ek,ConvBertForTokenClassification:()=>ev,ConvBertModel:()=>eP,ConvBertPreTrainedModel:()=>eT,ConvNextForImageClassification:()=>a8,ConvNextModel:()=>a4,ConvNextPreTrainedModel:()=>a3,ConvNextV2ForImageClassification:()=>a9,ConvNextV2Model:()=>a6,ConvNextV2PreTrainedModel:()=>a5,DFineForObjectDetection:()=>a_,DFineModel:()=>am,DFinePreTrainedModel:()=>au,DINOv3ConvNextModel:()=>nl,DINOv3ConvNextPreTrainedModel:()=>ni,DINOv3ViTModel:()=>nn,DINOv3ViTPreTrainedModel:()=>na,DPTForDepthEstimation:()=>aD,DPTModel:()=>az,DPTPreTrainedModel:()=>aj,DacDecoderModel:()=>lg,DacDecoderOutput:()=>lp,DacEncoderModel:()=>lf,DacEncoderOutput:()=>l_,DacModel:()=>lh,DacPreTrainedModel:()=>lm,DebertaForMaskedLM:()=>eR,DebertaForQuestionAnswering:()=>eW,DebertaForSequenceClassification:()=>eq,DebertaForTokenClassification:()=>e$,DebertaModel:()=>eG,DebertaPreTrainedModel:()=>eB,DebertaV2ForMaskedLM:()=>eX,DebertaV2ForQuestionAnswering:()=>eY,DebertaV2ForSequenceClassification:()=>eH,DebertaV2ForTokenClassification:()=>eJ,DebertaV2Model:()=>eQ,DebertaV2PreTrainedModel:()=>eU,DecisionTransformerModel:()=>i1,DecisionTransformerPreTrainedModel:()=>i0,DeiTForImageClassification:()=>ax,DeiTModel:()=>aw,DeiTPreTrainedModel:()=>aM,DepthAnythingForDepthEstimation:()=>aO,DepthAnythingPreTrainedModel:()=>aV,DepthProForDepthEstimation:()=>a$,DepthProPreTrainedModel:()=>aq,DetrForObjectDetection:()=>o8,DetrForSegmentation:()=>o5,DetrModel:()=>o4,DetrObjectDetectionOutput:()=>o6,DetrPreTrainedModel:()=>o3,DetrSegmentationOutput:()=>o9,Dinov2ForImageClassification:()=>nt,Dinov2Model:()=>ne,Dinov2PreTrainedModel:()=>a7,Dinov2WithRegistersForImageClassification:()=>no,Dinov2WithRegistersModel:()=>ns,Dinov2WithRegistersPreTrainedModel:()=>nr,DistilBertForMaskedLM:()=>e3,DistilBertForQuestionAnswering:()=>e2,DistilBertForSequenceClassification:()=>e0,DistilBertForTokenClassification:()=>e1,DistilBertModel:()=>eZ,DistilBertPreTrainedModel:()=>eK,DonutSwinModel:()=>a2,DonutSwinPreTrainedModel:()=>a1,EfficientNetForImageClassification:()=>iI,EfficientNetModel:()=>iL,EfficientNetPreTrainedModel:()=>
1iA,ElectraForMaskedLM:()=>eE,ElectraForQuestionAnswering:()=>eI,ElectraForSequenceClassification:()=>eA,ElectraForTokenClassification:()=>eL,ElectraModel:()=>eS,ElectraPreTrainedModel:()=>eC,Ernie4_5_ForCausalLM:()=>id,Ernie4_5_Model:()=>ic,Ernie4_5_PretrainedModel:()=>il,EsmForMaskedLM:()=>e5,EsmForSequenceClassification:()=>e6,EsmForTokenClassification:()=>e9,EsmModel:()=>e8,EsmPreTrainedModel:()=>e4,ExaoneForCausalLM:()=>sv,ExaoneModel:()=>sk,ExaonePreTrainedModel:()=>sy,FalconForCausalLM:()=>ig,FalconModel:()=>ih,FalconPreTrainedModel:()=>ip,FastViTForImageClassification:()=>oN,FastViTModel:()=>oO,FastViTPreTrainedModel:()=>oV,Florence2ForConditionalGeneration:()=>rp,Florence2PreTrainedModel:()=>r_,GLPNForDepthEstimation:()=>a0,GLPNModel:()=>aZ,GLPNPreTrainedModel:()=>aK,GPT2LMHeadModel:()=>rU,GPT2Model:()=>rW,GPT2PreTrainedModel:()=>r$,GPTBigCodeForCausalLM:()=>r6,GPTBigCodeModel:()=>r5,GPTBigCodePreTrainedModel:()=>r8,GPTJForCausalLM:()=>r4,GPTJModel:()=>r3,GPTJPreTrainedModel:()=>r2,GPTNeoForCausalLM:()=>rK,GPTNeoModel:()=>rY,GPTNeoPreTrainedModel:()=>rJ,GPTNeoXForCausalLM:()=>r1,GPTNeoXModel:()=>r0,GPTNeoXPreTrainedModel:()=>rZ,Gemma2ForCausalLM:()=>sJ,Gemma2Model:()=>sH,Gemma2PreTrainedModel:()=>sX,Gemma3ForCausalLM:()=>s2,Gemma3Model:()=>s1,Gemma3PreTrainedModel:()=>s0,Gemma3nForConditionalGeneration:()=>rw,Gemma3nPreTrainedModel:()=>rM,GemmaForCausalLM:()=>sQ,GemmaModel:()=>sU,GemmaPreTrainedModel:()=>sW,GlmForCausalLM:()=>sP,GlmModel:()=>sT,GlmPreTrainedModel:()=>sb,GraniteForCausalLM:()=>sO,GraniteModel:()=>sV,GraniteMoeHybridForCausalLM:()=>sG,GraniteMoeHybridModel:()=>sB,GraniteMoeHybridPreTrainedModel:()=>sN,GranitePreTrainedModel:()=>sD,GroundingDinoForObjectDetection:()=>nd,GroundingDinoPreTrainedModel:()=>nc,GroupViTModel:()=>oD,GroupViTPreTrainedModel:()=>oz,HeliumForCausalLM:()=>sx,HeliumModel:()=>sw,HeliumPreTrainedModel:()=>sM,HieraForImageClassification:()=>aP,HieraModel:()=>aT,HieraPreTrainedModel:()=>ab,HubertForCTC:()=>nY,HubertForSequenceClassification:()=>nK,HubertModel:()=>nJ,HubertPreTrainedModel:()=>nH,IJepaForImageClassification:()=>oy,IJepaModel:()=>oP,IJepaPreTrainedModel:()=>oT,Idefics3ForConditionalGeneration:()=>rb,Idefics3PreTrainedModel:()=>rx,ImageMattingOutput:()=>cD,JAISLMHeadModel:()=>rH,JAISModel:()=>rX,JAISPreTrainedModel:()=>rQ,JinaCLIPModel:()=>rO,JinaCLIPPreTrainedModel:()=>rV,JinaCLIPTextModel:()=>rN,JinaCLIPVisionModel:()=>rB,Lfm2ForCausalLM:()=>sp,Lfm2Model:()=>s_,Lfm2PreTrainedModel:()=>sm,LiteWhisperForConditionalGeneration:()=>ro,Llama4ForCausalLM:()=>sa,Llama4PreTrainedModel:()=>so,LlamaForCausalLM:()=>ss,LlamaModel:()=>sr,LlamaPreTrainedModel:()=>st,LlavaForConditionalGeneration:()=>rd,LlavaOnevisionForConditionalGeneration:()=>ru,LlavaPreTrainedModel:()=>rc,LlavaQwen2ForCausalLM:()=>rg,LongT5ForConditionalGeneration:()=>tk,LongT5Model:()=>ty,LongT5PreTrainedModel:()=>tP,M2M100ForConditionalGeneration:()=>nP,M2M100Model:()=>nT,M2M100PreTrainedModel:()=>nb,MBartForCausalLM:()=>tV,MBartForConditionalGeneration:()=>tz,MBartForSequenceClassification:()=>tD,MBartModel:()=>tj,MBartPreTrainedModel:()=>tI,MPNetForMaskedLM:()=>tn,MPNetForQuestionAnswering:()=>tc,MPNetForSequenceClassification:()=>ti,MPNetForTokenClassification:()=>tl,MPNetModel:()=>ta,MPNetPreTrainedModel:()=>to,MT5ForConditionalGeneration:()=>tC,MT5Model:()=>tF,MT5PreTrainedModel:()=>tv,MarianMTModel:()=>nx,MarianModel:()=>nw,MarianPreTrainedModel:()=>nM,MaskFormerForInstanceSegmentation:()=>aY,MaskFormerModel:()=>aJ,MaskFormerPreTrainedModel:()=>aH,MaskedLMOutput:()=>cL,Metric3DForDepthEstimation:()=>aU,Metric3DPreTrainedModel:()=>aW,Metric3Dv2ForDepthEstimation:()=>aX,Metric3Dv2PreTrainedModel:()=>aQ,MgpstrForSceneTextRecognition:()=>i5,MgpstrModelOutput:()=>i4,MgpstrPreTrainedModel:()=>i8,MimiDecoderModel:()=>lu,MimiDecoderOutput:()=>ll,MimiEncoderModel:()=>ld,MimiEncoderOutput:()=>li,MimiModel:()=>lc,MimiPreTrainedModel:()=>ln,MistralForCausalLM:()=>ii,MistralModel:()=>ia,MistralPreTrainedModel:()=>io,MobileBertForMaskedLM:()=>tt,MobileBertForQuestionAnswering:()=>ts,MobileBertForSequenceClassification:()=>tr,MobileBertModel:()=>te,MobileBertPreTrainedModel:()=>e7,MobileLLMForCausalLM:()=>sS,MobileLLMModel:()=>sC,MobileLLMPreTrainedModel:()=>sF,MobileNetV1ForImageClassification:()=>iB,MobileNetV1ForSemanticSegmentation:()=>iG,MobileNetV1Model:()=>iN,MobileNetV1PreTrainedModel:()=>iO,MobileNetV2ForImageClassification:()=>i$,MobileNetV2ForSemanticSegmentation:()=>iW,MobileNetV2Model:()=>iq,MobileNetV2PreTrainedModel:()=>iR,MobileNetV3ForImageClassification:()=>iX,MobileNetV3ForSemanticSegmentation:()=>iH,MobileNetV3Model:()=>iQ,MobileNetV3PreTrainedModel:()=>iU,MobileNetV4ForImageClassification:()=>iK,MobileNetV4ForSemanticSegmentation:()=>iZ,MobileNetV4Model:()=>iY,MobileNetV4PreTrainedModel:()=>iJ,MobileViTForImageClassification:()=>o$,MobileViTModel:()=>oq,MobileViTPreTrainedModel:()=>oR,MobileViTV2ForImageClassification:()=>oQ,MobileViTV2Model:()=>oU,MobileViTV2PreTrainedModel:()=>oW,ModelOutput:()=>U,ModernBertDecoderForCausalLM:()=>e_,ModernBertDecoderModel:()=>em,ModernBertDecoderPreTrainedModel:()=>eu,ModernBertForMaskedLM:()=>el,ModernBertForSequenceClassification:()=>ec,ModernBertForTokenClassification:()=>ed,ModernBertModel:()=>ei,ModernBertPreTrainedModel:()=>en,Moondream1ForConditionalGeneration:()=>rm,MoonshineForConditionalGeneration:()=>ri,MoonshineModel:()=>rn,MoonshinePreTrainedModel:()=>ra,MptForCausalLM:()=>oh,MptModel:()=>op,MptPreTrainedModel:()=>o_,MultiModalityCausalLM:()=>i3,MultiModalityPreTrainedModel:()=>i2,MusicgenForCausalLM:()=>iD,MusicgenForConditionalGeneration:()=>iV,MusicgenModel:()=>iz,MusicgenPreTrainedModel:()=>ij,NanoChatForCausalLM:()=>sl,NanoChatModel:()=>si,NanoChatPreTrainedModel:()=>sn,NeoBertForMaskedLM:()=>er,NeoBertForQuestionAnswering:()=>ea,NeoBertForSequenceClassification:()=>es,NeoBertForTokenClassification:()=>eo,NeoBertModel:()=>et,NeoBertPreTrainedModel:()=>ee,NomicBertModel:()=>eh,NomicBertPreTrainedModel:()=>ep,OPTForCausalLM:()=>oM,OPTModel:()=>og,OPTPreTrainedModel:()=>of,Olmo2ForCausalLM:()=>sz,Olmo2Model:()=>sj,Olmo2PreTrainedModel:()=>sI,OlmoForCausalLM:()=>sL,OlmoModel:()=>sA,OlmoPreTrainedModel:()=>sE,OpenELMForCausalLM:()=>s8,OpenELMModel:()=>s4,OpenELMPreTrainedModel:()=>s3,OwlViTForObjectDetection:()=>oJ,OwlViTModel:()=>oH,OwlViTPreTrainedModel:()=>oX,Owlv2ForObjectDetection:()=>oZ,Owlv2Model:()=>oK,Owlv2PreTrainedModel:()=>oY,PaliGemmaForConditionalGeneration:()=>rf,PaliGemmaPreTrainedModel:()=>rh,ParakeetForCTC:()=>nE,ParakeetPreTrainedModel:()=>nS,PatchTSMixerForPrediction:()=>lr,PatchTSMixerModel:()=>lt,PatchTSMixerPreTrainedModel:()=>le,PatchTSTForPrediction:()=>i7,PatchTSTModel:()=>i9,PatchTSTPreTrainedModel:()=>i6,Phi3ForCausalLM:()=>oc,Phi3Model:()=>ol,Phi3PreTrainedModel:()=>oi,Phi3VForCausalLM:()=>ry,Phi3VPreTrainedModel:()=>rP,PhiForCausalLM:()=>on,PhiModel:()=>oa,PhiPreTrainedModel:()=>oo,PreTrainedModel:()=>W,PretrainedMixin:()=>lT,PvtForImageClassification:()=>oS,PvtModel:()=>oC,PvtPreTrainedModel:()=>oF,PyAnnoteForAudioFrameClassification:()=>nI,PyAnnoteModel:()=>nL,PyAnnotePreTrainedModel:()=>nA,QuestionAnsweringModelOutput:()=>cI,Qwen2ForCausalLM:()=>s9,Qwen2Model:()=>
1s6,Qwen2PreTrainedModel:()=>s5,Qwen2VLForConditionalGeneration:()=>os,Qwen2VLPreTrainedModel:()=>or,Qwen3ForCausalLM:()=>ot,Qwen3Model:()=>oe,Qwen3PreTrainedModel:()=>s7,RFDetrForObjectDetection:()=>ac,RFDetrModel:()=>al,RFDetrObjectDetectionOutput:()=>ad,RFDetrPreTrainedModel:()=>ai,RTDetrForObjectDetection:()=>at,RTDetrModel:()=>ae,RTDetrObjectDetectionOutput:()=>ar,RTDetrPreTrainedModel:()=>o7,RTDetrV2ForObjectDetection:()=>aa,RTDetrV2Model:()=>ao,RTDetrV2ObjectDetectionOutput:()=>an,RTDetrV2PreTrainedModel:()=>as,ResNetForImageClassification:()=>av,ResNetModel:()=>ak,ResNetPreTrainedModel:()=>ay,RoFormerForMaskedLM:()=>eM,RoFormerForQuestionAnswering:()=>eb,RoFormerForSequenceClassification:()=>ew,RoFormerForTokenClassification:()=>ex,RoFormerModel:()=>eg,RoFormerPreTrainedModel:()=>ef,RobertaForMaskedLM:()=>tU,RobertaForQuestionAnswering:()=>tH,RobertaForSequenceClassification:()=>tQ,RobertaForTokenClassification:()=>tX,RobertaModel:()=>tW,RobertaPreTrainedModel:()=>t$,SamImageSegmentationOutput:()=>ng,SamModel:()=>nf,SamPreTrainedModel:()=>nh,SapiensForDepthEstimation:()=>aG,SapiensForNormalEstimation:()=>aR,SapiensForSemanticSegmentation:()=>aB,SapiensPreTrainedModel:()=>aN,SegformerForImageClassification:()=>iv,SegformerForSemanticSegmentation:()=>iF,SegformerModel:()=>ik,SegformerPreTrainedModel:()=>iy,Seq2SeqLMOutput:()=>cC,SequenceClassifierOutput:()=>cS,SiglipModel:()=>rL,SiglipPreTrainedModel:()=>rA,SiglipTextModel:()=>rI,SiglipVisionModel:()=>rj,SmolLM3ForCausalLM:()=>sg,SmolLM3Model:()=>sf,SmolLM3PreTrainedModel:()=>sh,SmolVLMForConditionalGeneration:()=>rT,SnacDecoderModel:()=>lb,SnacEncoderModel:()=>lx,SnacModel:()=>lw,SnacPreTrainedModel:()=>lM,SpeechT5ForSpeechToText:()=>n7,SpeechT5ForTextToSpeech:()=>ie,SpeechT5HifiGan:()=>it,SpeechT5Model:()=>n9,SpeechT5PreTrainedModel:()=>n6,SqueezeBertForMaskedLM:()=>tm,SqueezeBertForQuestionAnswering:()=>tp,SqueezeBertForSequenceClassification:()=>t_,SqueezeBertModel:()=>tu,SqueezeBertPreTrainedModel:()=>td,StableLmForCausalLM:()=>iE,StableLmModel:()=>iS,StableLmPreTrainedModel:()=>iC,Starcoder2ForCausalLM:()=>i_,Starcoder2Model:()=>im,Starcoder2PreTrainedModel:()=>iu,StyleTextToSpeech2Model:()=>n5,StyleTextToSpeech2PreTrainedModel:()=>n8,Swin2SRForImageSuperResolution:()=>aI,Swin2SRModel:()=>aL,Swin2SRPreTrainedModel:()=>aA,SwinForImageClassification:()=>aS,SwinForSemanticSegmentation:()=>aE,SwinModel:()=>aC,SwinPreTrainedModel:()=>aF,T5ForConditionalGeneration:()=>tT,T5Model:()=>tb,T5PreTrainedModel:()=>tx,TableTransformerForObjectDetection:()=>af,TableTransformerModel:()=>ah,TableTransformerObjectDetectionOutput:()=>ag,TableTransformerPreTrainedModel:()=>ap,TokenClassifierOutput:()=>cA,TrOCRForCausalLM:()=>is,TrOCRPreTrainedModel:()=>ir,UltravoxModel:()=>lo,UltravoxPreTrainedModel:()=>ls,UniSpeechForCTC:()=>nO,UniSpeechForSequenceClassification:()=>nN,UniSpeechModel:()=>nV,UniSpeechPreTrainedModel:()=>nD,UniSpeechSatForAudioFrameClassification:()=>n$,UniSpeechSatForCTC:()=>nR,UniSpeechSatForSequenceClassification:()=>nq,UniSpeechSatModel:()=>nG,UniSpeechSatPreTrainedModel:()=>nB,VaultGemmaForCausalLM:()=>sZ,VaultGemmaModel:()=>sK,VaultGemmaPreTrainedModel:()=>sY,ViTForImageClassification:()=>ob,ViTMAEModel:()=>oA,ViTMAEPreTrainedModel:()=>oE,ViTMSNForImageClassification:()=>oj,ViTMSNModel:()=>oI,ViTMSNPreTrainedModel:()=>oL,ViTModel:()=>ox,ViTPreTrainedModel:()=>ow,VisionEncoderDecoderModel:()=>rl,VitMatteForImageMatting:()=>oG,VitMattePreTrainedModel:()=>oB,VitPoseForPoseEstimation:()=>ov,VitPosePreTrainedModel:()=>ok,VitsModel:()=>iP,VitsModelOutput:()=>cV,VitsPreTrainedModel:()=>iT,VoxtralForConditionalGeneration:()=>la,Wav2Vec2BertForCTC:()=>nQ,Wav2Vec2BertForSequenceClassification:()=>nX,Wav2Vec2BertModel:()=>nU,Wav2Vec2BertPreTrainedModel:()=>nW,Wav2Vec2ForAudioFrameClassification:()=>nC,Wav2Vec2ForCTC:()=>nv,Wav2Vec2ForSequenceClassification:()=>nF,Wav2Vec2Model:()=>nk,Wav2Vec2PreTrainedModel:()=>ny,WavLMForAudioFrameClassification:()=>n4,WavLMForCTC:()=>n1,WavLMForSequenceClassification:()=>n2,WavLMForXVector:()=>n3,WavLMModel:()=>n0,WavLMPreTrainedModel:()=>nZ,WeSpeakerResNetModel:()=>nz,WeSpeakerResNetPreTrainedModel:()=>nj,WhisperForConditionalGeneration:()=>rs,WhisperModel:()=>rr,WhisperPreTrainedModel:()=>rt,XLMForQuestionAnswering:()=>t1,XLMForSequenceClassification:()=>tZ,XLMForTokenClassification:()=>t0,XLMModel:()=>tY,XLMPreTrainedModel:()=>tJ,XLMRobertaForMaskedLM:()=>t4,XLMRobertaForQuestionAnswering:()=>t6,XLMRobertaForSequenceClassification:()=>t8,XLMRobertaForTokenClassification:()=>t5,XLMRobertaModel:()=>t3,XLMRobertaPreTrainedModel:()=>t2,XLMWithLMHeadModel:()=>tK,XVectorOutput:()=>cE,YolosForObjectDetection:()=>n_,YolosModel:()=>nm,YolosObjectDetectionOutput:()=>np,YolosPreTrainedModel:()=>nu});var s=r("./src/configs.js"),o=r("./src/backends/onnx.js"),a=r("./src/utils/dtypes.js"),n=r("./src/utils/generic.js"),i=r("./src/utils/core.js"),l=r("./src/utils/hub.js"),c=r("./src/utils/constants.js"),d=r("./src/generation/logits_process.js"),u=r("./src/generation/configuration_utils.js"),m=r("./src/utils/tensor.js"),_=r("./src/utils/image.js"),p=r("./src/utils/maths.js"),h=r("./src/generation/stopping_criteria.js"),f=r("./src/generation/logits_sampler.js"),g=r("./src/env.js"),M=r("./src/models/whisper/generation_whisper.js"),w=r("./src/models/whisper/common_whisper.js");let x={EncoderOnly:0,EncoderDecoder:1,Seq2Seq:2,Vision2Seq:3,DecoderOnly:4,MaskGeneration:5,ImageTextToText:6,Musicgen:7,MultiModality:8,Phi3V:9,AudioTextToText:10,AutoEncoder:11,ImageAudioTextToText:12},b=new Map,T=new Map,P=new Map;async function y(e,t,r){let n=r.config?.["transformers.js_config"]??{},i=r.device??n.device;i&&"string"!=typeof i&&(i.hasOwnProperty(t)?i=i[t]:(console.warn(`device not specified for "${t}". Using the default device.`),i=null));let c=i??(g.apis.IS_NODE_ENV?"cpu":"wasm"),d=(0,o.deviceToExecutionProviders)(c),u=n.device_config??{};u.hasOwnProperty(c)&&(n={...n,...u[c]});let m=r.dtype??n.dtype;if("string"!=typeof m&&(m&&m.hasOwnProperty(t)?m=m[t]:(m=a.DEFAULT_DEVICE_DTYPE_MAPPING[c]??a.DATA_TYPES.fp32,console.warn(`dtype not specified for "${t}". Using the default dtype (${m}) for this device (${c}).`))),m===a.DATA_TYPES.auto){let e=n.dtype;"string"!=typeof e&&(e=e?.[t]),m=e&&e!==a.DATA_TYPES.auto&&a.DATA_TYPES.hasOwnProperty(e)?e:a.DEFAULT_DEVICE_DTYPE_MAPPING[c]??a.DATA_TYPES.fp32}let _=m;if(a.DEFAULT_DTYPE_SUFFIX_MAPPING.hasOwnProperty(_)){if(_===a.DATA_TYPES.fp16&&"webgpu"===c&&!await (0,a.isWebGpuFp16Supported)())throw Error(`The device (${c}) does not support fp16.`)}else throw Error(`Invalid dtype: ${_}. Should be one of: ${Object.keys(a.DATA_TYPES).join(", ")}`);let p=n.kv_cache_dtype,h=p?"string"==typeof p?p:p[_]??"float32":void 0;if(h&&!["float32","float16"].includes(h))throw Error(`Invalid kv_cache_dtype: ${h}. Should be one of: float32, float16`);let f=a.DEFAULT_DTYPE_SUFFIX_MAPPING[_],M=`${t}${f}.onnx`,w=`${r.subfolder??""}/${M}`,x={...r.session_options};x.executionProviders??=d;let b=n.free_dimension_overrides;b?x.freeDimensionOverrides??=b:c.startsWith("webnn")&&!x.freeDimensionOverrides&&console.warn(`WebNN does not currently support dynamic shapes and requires 'free_dimension_overrides' to be set in config.json, preferably as a field within config["transformers.js_config"]["device_config"]["${c}"]. When 'free_dimension_overrides' is not set, you may experience significant performance degradation.`);let T=g.apis.IS_NODE_ENV&&g.env.useFSCache,P=(0,l.getModelFile)(e,w,!0,r,T),y=r.use_external_data_format??n.use_external_data_format,k=[];if(y){let s=+("object"==typeof y?y.hasOwnProperty(M)?y[M]:!!y.hasOwnProperty(t)&&y[t]:y);if(s>l.MAX_EXTERNAL_DATA_CHUNKS)throw Error(`The number of external data chunks (${s}) exceeds the maximum allowed value (${l.MAX_EXTERNAL_DATA_CHUNKS}).`);for(let t=0;t<s;++t){let s=`${M}_data${0===t?"":"_"+t}`,o=`${r.subfolder??""}/${s}`;k.push(new Promise(async(t,a)=>{let n=await (0,l.getModelFile)(e,o,!0,r,T);t(n instanceof Uint8Array?{path:s,data:n}:s)}))}}else void 0!==x.externalData&&(k=x.externalData.map(async t=>{if("string"==typeof t.data){let s=await (0,l.getModelFile)(e,t.data,!0,r);return{...t,data:s}}return t}));if(k.length>0){let e=await Promise.all(k);g.apis.IS_NODE_ENV||(x.externalData=e)}if("webgpu"===c){let e=(0,s.getCacheShapes)(r.config,{prefix:"present"});if(Object.keys(e).length>0&&!(0,o.isONNXProxy)()){let t={};for(let r in e)t[r]="gpu-buffer";x.preferredOutputLocation=t}}return{buffer_or_path:await P,session_options:x,session_config:{dtype:_,kv_cache_dtype:h,device:c}}}async function k(e,t,r){return Object.fromEntries(await Promise.all(Object.keys(t).map(async s=>{let{buffer_or_path:a,session_options:n,session_config:i}=await y(e,t[s],r);return[s,await (0,o.createInferenceSession)(a,n,i)]})))}async function v(e,t,r){return Object.fromEntries(await Promise.all(Object.keys(t).map(async s=>{let o=await (0,l.getModelJSON)(e,t[s],!1,r);return[s,o]})))}async function F(e,t){let r=function(e,t){let r=Object.create(null),s=[];for(let a of e.inputNames){let e=t[a];if(!(e instanceof m.Tensor)){s.push(a);continue}r[a]=(0,o.isONNXProxy)()?e.clone():e}if(s.length>0)throw Error(`An error occurred during model execution: "Missing the following inputs: ${s.join(", ")}.`);let a=Object.keys(t).length,n=e.inputNames.length;if(a>n){let r=Object.keys(t).filter(t=>!e.inputNames.includes(t));console.warn(`WARNING: Too many inputs were provided (${a} > ${n}). The following inputs will be ignored: "${r.join(", ")}".`)}return r}(e,t);try{let t=Object.fromEntries(Object.entries(r).map(([e,t])=>[e,t.ort_tensor])),s=await (0,o.runInferenceSession)(e,t);return function e(t){for(let r in t)(0,o.isONNXTensor)(t[r])?t[r]=new m.Tensor(t[r]):"object"==typeof t[r]&&e(t[r]);return t}(s)}catch(t){let e=Object.fromEntries(Object.entries(r).map(([e,t])=>{let r={type:t.type,dims:t.dims,location:t.location};return"gpu-buffer"!==r.location&&(r.data=t.data),[e,r]}));throw console.error(`An error occurred during model execution: "${t}".`),console.error("Inputs given to model:",e),t}}function C(e){if(e instanceof m.Tensor)return e;if(0===e.length)throw Error("items must be non-empty");if(!Array.isArray(e[0]))return new m.Tensor("int64",BigInt64Array.from(e.map(e=>BigInt(e))),[1,e.length]);if(e.some(t=>t.length!==e[0].length))throw Error("Unable to create tensor, you should probably activate truncation and/or padding with 'padding=True' and/or 'truncation=True' to have batched tensors with the same length.");return new m.Tensor("int64",BigInt64Array.from(e.flat().map(e=>BigInt(e))),[e.length,e[0].length])}function S(e){return new m.Tensor("bool",[e],[1])}async function E(e,t){let{encoder_outputs:r,input_ids:s,decoder_input_ids:o,...a}=t;if(!r){let s=(0,i.pick)(t,e.sessions.model.inputNames);r=(await A(e,s)).last_hidden_state}return a.input_ids=o,a.encoder_hidden_states=r,e.sessions.decoder_model_merged.inputNames.includes("encoder_attention_mask")&&(a.encoder_attention_mask=t.attention_mask),await I(e,a,!0)}async function A(e,t){let r=e.sessions.model,s=(0,i.pick)(t,r.inputNames);if(r.inputNames.includes("inputs_embeds")&&!s.inputs_embeds){if(!t.input_ids)throw Error("Both `input_ids` and `inputs_embeds` are missing in the model inputs.");s.inputs_embeds=await e.encode_text({input_ids:t.input_ids})}if(r.inputNames.includes("token_type_ids")&&!s.token_type_ids){if(!s.input_ids)throw Error("Both `input_ids` and `token_type_ids` are missing in the model inputs.");s.token_type_ids=(0,m.zeros_like)(s.input_ids)}if(r.inputNames.includes("pixel_mask")&&!s.pixel_mask){if(!s.pixel_values)throw Error("Both `pixel_values` and `pixel_mask` are missing in the model inputs.");let e=s.pixel_values.dims;s.pixel_mask=(0,m.ones)([e[0],e[2],e[3]])}return await F(r,s)}async function L(e,t){let r=await e.encode(t);return await e.decode(r)}async function I(e,t,r=!1){let s=e.sessions[r?"decoder_model_merged":"model"],{past_key_values:o,...a}=t;s.inputNames.includes("use_cache_branch")&&(a.use_cache_branch=S(!!o)),s.inputNames.includes("position_ids")&&a.attention_mask&&!a.position_ids&&(a.position_ids=function(e,t=null,r=0){let{input_ids:s,inputs_embeds:o,attention_mask:a}=e,{data:n,dims:i}=B(a,r),l=new m.Tensor("int64",n,i);if(t){let e=-(s??o).dims.at(1);l=l.slice(null,[e,null])}return l}(a,o,+!!["paligemma","gemma3_text","gemma3"].includes(e.config.model_type))),e.addPastKeyValues(a,o);let n=(0,i.pick)(a,s.inputNames);return await F(s,n)}
1function j({modality_token_id:e,inputs_embeds:t,modality_features:r,input_ids:s,attention_mask:o}){let a=s.tolist().map(t=>t.reduce((t,r,s)=>(r==e&&t.push(s),t),[])),n=a.reduce((e,t)=>e+t.length,0),i=r.dims[0];if(n!==i)throw Error(`Number of tokens and features do not match: tokens: ${n}, features ${i}`);let l=0;for(let e=0;e<a.length;++e){let s=a[e],o=t[e];for(let e=0;e<s.length;++e)o[s[e]].data.set(r[l++].data)}return{inputs_embeds:t,attention_mask:o}}function z({image_token_id:e,inputs_embeds:t,image_features:r,input_ids:s,attention_mask:o}){return j({modality_token_id:e,inputs_embeds:t,modality_features:r,input_ids:s,attention_mask:o})}function D({audio_token_id:e,inputs_embeds:t,audio_features:r,input_ids:s,attention_mask:o}){return j({modality_token_id:e,inputs_embeds:t,modality_features:r,input_ids:s,attention_mask:o})}async function V(e,{encode_function:t,merge_function:r,modality_input_name:s,modality_output_name:o,input_ids:a=null,attention_mask:n=null,position_ids:i=null,inputs_embeds:l=null,past_key_values:c=null,generation_config:d=null,logits_processor:u=null,..._}){let p=_[s];if(!l){if(l=await e.encode_text({input_ids:a,..._}),p&&1!==a.dims[1]){let e=await t({[s]:p,..._});({inputs_embeds:l,attention_mask:n}=r({[o]:e,inputs_embeds:l,input_ids:a,attention_mask:n}))}else if(c&&p&&1===a.dims[1]){let e=a.dims[1],t=Object.values(c)[0].dims.at(-2);n=(0,m.cat)([(0,m.ones)([a.dims[0],t]),n.slice(null,[n.dims[1]-e,n.dims[1]])],1)}}if(!i&&"qwen2_vl"===e.config.model_type){let{image_grid_thw:t,video_grid_thw:r}=_;[i]=e.get_rope_index(a,t,r,n)}return await I(e,{inputs_embeds:l,past_key_values:c,attention_mask:n,position_ids:i,generation_config:d,logits_processor:u},!0)}async function O(e,t){return await V(e,{...t,modality_input_name:"audio_values",modality_output_name:"audio_features",encode_function:e.encode_audio.bind(e),merge_function:e._merge_input_ids_with_audio_features.bind(e)})}async function N(e,t){return await V(e,{...t,modality_input_name:"pixel_values",modality_output_name:"image_features",encode_function:e.encode_image.bind(e),merge_function:e._merge_input_ids_with_image_features.bind(e)})}function B(e,t=0){let[r,s]=e.dims,o=e.data,a=new BigInt64Array(o.length);for(let e=0;e<r;++e){let r=e*s,n=BigInt(t);for(let e=0;e<s;++e){let t=r+e;0n===o[t]?a[t]=BigInt(1):(a[t]=n,n+=o[t])}}return{data:a,dims:e.dims}}function G(e,t,r,s){let o=r.past_key_values?Object.values(r.past_key_values)[0].dims.at(-2):0;if(!r.attention_mask){let e;for(let t of["input_ids","inputs_embeds","position_ids"])if(r[t]){e=r[t].dims;break}if(!e)throw Error("attention_mask is not provided, and unable to infer its shape from model inputs.");r.attention_mask=(0,m.ones)([e[0],o+e[1]])}if(r.past_key_values){let{input_ids:e,attention_mask:t}=r;t&&t.dims[1]>e.dims[1]||o<e.dims[1]&&(r.input_ids=e.slice(null,[o,null]))}return r}function R(e,t,r,s){return r.past_key_values&&(t=t.map(e=>[e.at(-1)])),{...r,decoder_input_ids:C(t)}}function q(e,...t){return e.config.is_encoder_decoder?R(e,...t):G(e,...t)}function $(e,t,r,s){let o=!!r.past_key_values;return null!==s.guidance_scale&&s.guidance_scale>1&&(o?r.input_ids=(0,m.cat)([r.input_ids,r.input_ids],0):(r.input_ids=(0,m.cat)([r.input_ids,(0,m.full_like)(r.input_ids,BigInt(s.pad_token_id))],0),r.attention_mask=(0,m.cat)([r.attention_mask,(0,m.full_like)(r.attention_mask,0n)],0))),(o||!r.pixel_values)&&(r.pixel_values=(0,m.full)([0,0,3,384,384],1)),o&&(r.images_seq_mask=new m.Tensor("bool",[,].fill(!0).fill(!1,0,1),[1,1]),r.images_emb_mask=new m.Tensor("bool",[].fill(!1),[1,1,0])),r}class W extends n.Callable{main_input_name="input_ids";forward_params=["input_ids","attention_mask"];constructor(e,t,r){super(),this.config=e,this.sessions=t,this.configs=r;let s=P.get(this.constructor),o=b.get(s);switch(this.can_generate=!1,this._forward=null,this._prepare_inputs_for_generation=null,o){case x.DecoderOnly:this.can_generate=!0,this._forward=I,this._prepare_inputs_for_generation=G;break;case x.Seq2Seq:case x.Vision2Seq:case x.Musicgen:this.can_generate=!0,this._forward=E,this._prepare_inputs_for_generation=R;break;case x.EncoderDecoder:this._forward=E;break;case x.ImageTextToText:this.can_generate=!0,this._forward=N,this._prepare_inputs_for_generation=q;break;case x.AudioTextToText:this.can_generate=!0,this._forward=O,this._prepare_inputs_for_generation=q;break;case x.Phi3V:case x.ImageAudioTextToText:this.can_generate=!0,this._prepare_inputs_for_generation=q;break;case x.MultiModality:this.can_generate=!0,this._prepare_inputs_for_generation=$;break;case x.AutoEncoder:this._forward=L;break;default:this._forward=A}this.can_generate&&this.forward_params.push("past_key_values"),this.custom_config=this.config["transformers.js_config"]??{}}async dispose(){let e=[];for(let t of Object.values(this.sessions))t?.handler?.dispose&&e.push(t.handler.dispose());return await Promise.all(e)}static async from_pretrained(e,{progress_callback:t=null,config:r=null,cache_dir:o=null,local_files_only:a=!1,revision:n="main",model_file_name:i=null,subfolder:l="onnx",device:d=null,dtype:u=null,use_external_data_format:m=null,session_options:_={}}={}){let p,h={progress_callback:t,config:r,cache_dir:o,local_files_only:a,revision:n,model_file_name:i,subfolder:l,device:d,dtype:u,use_external_data_format:m,session_options:_},f=P.get(this),g=b.get(f);if(r=h.config=await s.AutoConfig.from_pretrained(e,h),g===x.DecoderOnly)p=await Promise.all([k(e,{model:h.model_file_name??"model"},h),v(e,{generation_config:"generation_config.json"},h)]);else if(g===x.Seq2Seq||g===x.Vision2Seq)p=await Promise.all([k(e,{model:"encoder_model",decoder_model_merged:"decoder_model_merged"},h),v(e,{generation_config:"generation_config.json"},h)]);else if(g===x.MaskGeneration)p=await Promise.all([k(e,{model:"vision_encoder",prompt_encoder_mask_decoder:"prompt_encoder_mask_decoder"},h)]);else if(g===x.EncoderDecoder)p=await Promise.all([k(e,{model:"encoder_model",decoder_model_merged:"decoder_model_merged"},h)]);else if(g===x.ImageTextToText){let t={embed_tokens:"embed_tokens",vision_encoder:"vision_encoder",decoder_model_merged:"decoder_model_merged"};r.is_encoder_decoder&&(t.model="encoder_model"),p=await Promise.all([k(e,t,h),v(e,{generation_config:"generation_config.json"},h)])}else if(g===x.AudioTextToText)p=await Promise.all([k(e,{embed_tokens:"embed_tokens",audio_encoder:"audio_encoder",decoder_model_merged:"decoder_model_merged"},h),v(e,{generation_config:"generation_config.json"},h)]);else if(g===x.ImageAudioTextToText)p=await Promise.all([k(e,{embed_tokens:"embed_tokens",audio_encoder:"audio_encoder",vision_encoder:"vision_encoder",decoder_model_merged:"decoder_model_merged"},h),v(e,{generation_config:"generation_config.json"},h)]);else if(g===x.Musicgen)p=await Promise.all([k(e,{model:"text_encoder",decoder_model_merged:"decoder_model_merged",encodec_decode:"encodec_decode"},h),v(e,{generation_config:"generation_config.json"},h)]);else if(g===x.MultiModality)p=await Promise.all([k(e,{prepare_inputs_embeds:"prepare_inputs_embeds",model:"language_model",lm_head:"lm_head",gen_head:"gen_head",gen_img_embeds:"gen_img_embeds",image_decode:"image_decode"},h),v(e,{generation_config:"generation_config.json"},h)]);else if(g===x.Phi3V)p=await Promise.all([k(e,{prepare_inputs_embeds:"prepare_inputs_embeds",model:"model",vision_encoder:"vision_encoder"},h),v(e,{generation_config:"generation_config.json"},h)]);else if(g===x.AutoEncoder)p=await Promise.all([k(e,{encoder_model:"encoder_model",decoder_model:"decoder_model"},h)]);else{if(g!==x.EncoderOnly){let e=f??r?.model_type;"custom"!==e&&console.warn(`Model type for '${e}' not found, assuming encoder-only architecture. Please report this at ${c.GITHUB_ISSUE_URL}.`)}p=await Promise.all([k(e,{model:h.model_file_name??"model"},h)])}return new this(r,...p)}async _call(e){return await this.forward(e)}async forward(e){return await this._forward(this,e)}get generation_config(){return this.configs?.generation_config??null}_get_logits_processor(e,t,r=null){let s=new d.LogitsProcessorList;if(null!==e.repetition_penalty&&1!==e.repetition_penalty&&s.push(new d.RepetitionPenaltyLogitsProcessor(e.repetition_penalty)),null!==e.no_repeat_ngram_size&&e.no_repeat_ngram_size>0&&s.push(new d.NoRepeatNGramLogitsProcessor(e.no_repeat_ngram_size)),null!==e.bad_words_ids&&s.push(new d.NoBadWordsLogitsProcessor(e.bad_words_ids,e.eos_token_id)),null!==e.min_length&&null!==e.eos_token_id&&e.min_length>0&&s.push(new d.MinLengthLogitsProcessor(e.min_length,e.eos_token_id)),null!==e.min_new_tokens&&null!==e.eos_token_id&&e.min_new_tokens>0&&s.push(new d.MinNewTokensLengthLogitsProcessor(t,e.min_new_tokens,e.eos_token_id)),null!==e.forced_bos_token_id&&s.push(new d.ForcedBOSTokenLogitsProcessor(e.forced_bos_token_id)),null!==e.forced_eos_token_id&&s.push(new d.ForcedEOSTokenLogitsProcessor(e.max_length,e.forced_eos_token_id)),null!==e.begin_suppress_tokens){let r=t>1||null===e.forced_bos_token_id?t:t+1;s.push(new d.SuppressTokensAtBeginLogitsProcessor(e.begin_suppress_tokens,r))}return null!==e.guidance_scale&&e.guidance_scale>1&&s.push(new d.ClassifierFreeGuidanceLogitsProcessor(e.guidance_scale)),0===e.temperature&&e.do_sample&&(console.warn("`do_sample` changed to fal
1se because `temperature: 0` implies greedy sampling (always selecting the most likely token), which is incompatible with `do_sample: true`."),e.do_sample=!1),e.do_sample&&null!==e.temperature&&1!==e.temperature&&s.push(new d.TemperatureLogitsWarper(e.temperature)),null!==r&&s.extend(r),s}_prepare_generation_config(e,t,r=u.GenerationConfig){let s={...this.config};for(let e of["decoder","generator","text_config"])e in s&&Object.assign(s,s[e]);let o=new r(s);return Object.assign(o,this.generation_config??{}),e&&Object.assign(o,e),t&&Object.assign(o,(0,i.pick)(t,Object.getOwnPropertyNames(o))),o}_get_stopping_criteria(e,t=null){let r=new h.StoppingCriteriaList;return null!==e.max_length&&r.push(new h.MaxLengthCriteria(e.max_length,this.config.max_position_embeddings??null)),null!==e.eos_token_id&&r.push(new h.EosTokenCriteria(e.eos_token_id)),t&&r.extend(t),r}_validate_model_class(){if(!this.can_generate){let e=P.get(this.constructor),t=new Set,r=this.config.model_type;for(let e of[lI,lV,lL,lF]){let s=e.get(r);s&&t.add(s[0])}let s=`The current model class (${e}) is not compatible with \`.generate()\`, as it doesn't have a language model head.`;throw t.size>0&&(s+=` Please use the following class instead: ${[...t].join(", ")}`),Error(s)}}prepare_inputs_for_generation(...e){return this._prepare_inputs_for_generation(this,...e)}_update_model_kwargs_for_generation({generated_input_ids:e,outputs:t,model_inputs:r,is_encoder_decoder:s}){return r.past_key_values=this.getPastKeyValues(t,r.past_key_values),r.input_ids=new m.Tensor("int64",e.flat(),[e.length,1]),s?"decoder_attention_mask"in r:r.attention_mask=(0,m.cat)([r.attention_mask,(0,m.ones)([r.attention_mask.dims[
10],1])],1),r.position_ids=null,r}_prepare_model_inputs({inputs:e,bos_token_id:t,model_kwargs:r}){let s=(0,i.pick)(r,this.forward_params),o=this.main_input_name;if(o in s){if(e)throw Error("`inputs`: {inputs}` were passed alongside {input_name} which is not allowed. Make sure to either pass {inputs} or {input_name}=...")}else s[o]=e;return{inputs_tensor:s[o],model_inputs:s,model_input_name:o}}async _prepare_encoder_decoder_kwargs_for_generation({inputs_tensor:e,model_inputs:t,model_input_name:r,generation_config:s}){if(this.sessions.model.inputNames.includes("inputs_embeds")&&!t.inputs_embeds&&"_prepare_inputs_embeds"in this){let{input_ids:e,pixel_values:r,attention_mask:s,...o}=t,a=await this._prepare_inputs_embeds(t);t={...o,...(0,i.pick)(a,["inputs_embeds","attention_mask"])}}let{last_hidden_state:o}=await A(this,t);if(null!==s.guidance_scale&&s.guidance_scale>1)o=(0,m.cat)([o,(0,m.full_like)(o,0)],0),"attention_mask"in t&&(t.attention_mask=(0,m.cat)([t.attention_mask,(0,m.zeros_like)(t.attention_mask)],0));else if(t.decoder_input_ids){let e=C(t.decoder_input_ids).dims[0];if(e!==o.dims[0]){if(1!==o.dims[0])throw Error(`The encoder outputs have a different batch size (${o.dims[0]}) than the decoder inputs (${e}).`);o=(0,m.cat)(Array.from({length:e},()=>o),0)}}return t.encoder_outputs=o,t}_prepare_decoder_input_ids_for_generation({batch_size:e,model_input_name:t,model_kwargs:r,decoder_start_token_id:s,bos_token_id:o,generation_config:a}){let{decoder_input_ids:n,...i}=r;if(!(n instanceof m.Tensor)){if(n)Array.isArray(n[0])||(n=Array.from({length:e},()=>n));else if(s??=o,"musicgen"===this.config.model_type)n=Array.from({length:e*this.config.decoder.num_codebooks},()=>[s]);else if(Array.isArray(s)){if(s.length!==e)throw Error(`\`decoder_start_token_id\` expcted to have length ${e} but got ${s.length}`);n=s}else n=Array.from({length:e},()=>[s]);n=C(n)}return r.decoder_attention_mask=(0,m.ones_like)(n),{input_ids:n,model_inputs:i}}async generate({inputs:e=null,generation_config:t=null,logits_processor:r=null,stopping_criteria:s=null,streamer:o=null,...a}){let n,i;this._validate_model_class(),t=this._prepare_generation_config(t,a);let{inputs_tensor:l,model_inputs:c,model_input_name:d}=this._prepare_model_inputs({inputs:e,model_kwargs:a}),u=this.config.is_encoder_decoder;u&&("encoder_outputs"in c||(c=await this._prepare_encoder_decoder_kwargs_for_generation({inputs_tensor:l,model_inputs:c,model_input_name:d,generation_config:t}))),u?{input_ids:n,model_inputs:c}=this._prepare_decoder_input_ids_for_generation({batch_size:c[d].dims.at(0),model_input_name:d,model_kwargs:c,decoder_start_token_id:t.decoder_start_token_id,bos_token_id:t.bos_token_id,generation_config:t}):n=c[d];let _=n.dims.at(-1);null!==t.max_new_tokens&&(t.max_length=_+t.max_new_tokens);let p=this._get_logits_processor(t,_,r),h=this._get_stopping_criteria(t,s),g=c[d].dims.at(0),M=f.LogitsSampler.getSampler(t),w=Array(g).fill(0),x=n.tolist();o&&o.put(x);let b={};for(;;){if(c=this.prepare_inputs_for_generation(x,c,t),i=await this.forward(c),t.output_attentions&&t.return_dict_in_generate){let e=this.getAttentions(i);for(let t in e)t in b||(b[t]=[]),b[t].push(e[t])}let e=p(x,i.logits.slice(null,-1,null)),r=[];for(let t=0;t<e.dims.at(0);++t){let s=e[t];for(let[e,o]of(await M(s))){let s=BigInt(e);w[t]+=o,x[t].push(s),r.push([s]);break}}if(o&&o.put(r),h(x).every(e=>e))break;c=this._update_model_kwargs_for_generation({generated_input_ids:r,outputs:i,model_inputs:c,is_encoder_decoder:u})}o&&o.end();let T=this.getPastKeyValues(i,c.past_key_values,!0),P=new m.Tensor("int64",x.flat(),[x.length,x[0].length]);if(t.return_dict_in_generate)return{sequences:P,past_key_values:T,...b};for(let e of Object.values(i))"gpu-buffer"===e.location&&e.dispose();return P}getPastKeyValues(e,t,r=!1){let s=Object.create(null);for(let o in e)if(o.startsWith("present")){let a=o.replace("present_conv","past_conv").replace("present","past_key_values"),n=o.includes("encoder");if(n&&t?s[a]=t[a]:s[a]=e[o],t&&(!n||r)){let e=t[a];"gpu-buffer"===e.location&&e.dispose()}}return s}getAttentions(e){let t={};for(let r of["cross_attentions","encoder_attentions","decoder_attentions"])for(let s in e)s.startsWith(r)&&(r in t||(t[r]=[]),t[r].push(e[s]));return t}addPastKeyValues(e,t){if(t)Object.assign(e,t);else{let t=this.sessions.decoder_model_merged??this.sessions.model,r=(e[this.main_input_name]??e.attention_mask)?.dims?.[0]??1,o=t?.config?.kv_cache_dtype??"float32",a="float16"===o?m.DataTypeMap.float16:m.DataTypeMap.float32,n=(0,s.getCacheShapes)(this.config,{batch_size:r});for(let t in n){let r=n[t].reduce((e,t)=>
1e*t,1);e[t]=new m.Tensor(o,new a(r),n[t])}}}async encode_image({pixel_values:e}){return(await F(this.sessions.vision_encoder,{pixel_values:e})).image_features}async encode_text({input_ids:e}){return(await F(this.sessions.embed_tokens,{input_ids:e})).inputs_embeds}async encode_audio({audio_values:e}){return(await F(this.sessions.audio_encoder,{audio_values:e})).audio_features}}class U{}class Q extends U{constructor({last_hidden_state:e,hidden_states:t=null,attentions:r=null}){super(),this.last_hidden_state=e,this.hidden_states=t,this.attentions=r}}class X extends W{}class H extends X{}class J extends X{async _call(e){return new cL(await super._call(e))}}class Y extends X{async _call(e){return new cS(await super._call(e))}}class K extends X{async _call(e){return new cA(await super._call(e))}}class Z extends X{async _call(e){return new cI(await super._call(e))}}class ee extends W{}class et extends ee{}class er extends ee{async _call(e){return new cL(await super._call(e))}}class es extends ee{async _call(e){return new cS(await super._call(e))}}class eo extends ee{async _call(e){return new cA(await super._call(e))}}class ea extends ee{async _call(e){return new cI(await super._call(e))}}class en extends W{}class ei extends en{}class el extends en{async _call(e){return new cL(await super._call(e))}}class ec extends en{async _call(e){return new cS(await super._call(e))}}class ed extends en{async _call(e){return new cA(await super._call(e))}}class eu extends W{}class em extends eu{}class e_ extends eu{}class ep extends W{}class eh extends ep{}class ef extends W{}class eg extends ef{}class eM extends ef{async _call(e){return new cL(await super._call(e))}}class ew extends ef{async _call(e){return new cS(await super._call(e))}}class ex extends ef{async _call(e){return new cA(await super._call(e))}}class eb extends ef{async _call(e){return new cI(await super._call(e))}}class eT extends W{}class eP extends eT{}class ey extends eT{async _call(e){return new cL(await super._call(e))}}class ek extends eT{async _call(e){return new cS(await super._call(e))}}class ev extends eT{async _call(e){return new cA(await super._call(e))}}class eF extends eT{async _call(e){return new cI(await super._call(e))}}class eC extends W{}class eS extends eC{}class eE extends eC{async _call(e){return new cL(await super._call(e))}}class eA extends eC{async _call(e){return new cS(await super._call(e))}}class eL extends eC{async _call(e){return new cA(await super._call(e))}}class eI extends eC{async _call(e){return new cI(await super._call(e))}}class ej extends W{}class ez extends ej{}class eD extends ej{async _call(e){return new cL(await super._call(e))}}class eV extends ej{async _call(e){return new cS(await super._call(e))}}class eO extends ej{async _call(e){return new cA(await super._call(e))}}class eN extends ej{async _call(e){return new cI(await super._call(e))}}class eB extends W{}class eG extends eB{}class eR extends eB{async _call(e){return new cL(await super._call(e))}}class eq extends eB{async _call(e){return new cS(await super._call(e))}}class e$ extends eB{async _call(e){return new cA(await super._call(e))}}class eW extends eB{async _call(e){return new cI(await super._call(e))}}class eU extends W{}class eQ extends eU{}class eX extends eU{async _call(e){return new cL(await super._call(e))}}class eH extends eU{async _call(e){return new cS(await super._call(e))}}class eJ extends eU{async _call(e){return new cA(await super._call(e))}}class eY extends eU{async _call(e){return new cI(await super._call(e))}}class eK extends W{}class eZ extends eK{}class e0 extends eK{async _call(e){return new cS(await super._call(e))}}class e1 extends eK{async _call(e){return new cA(await super._call(e))}}class e2 extends eK{async _call(e){return new cI(await super._call(e))}}class e3 extends eK{async _call(e){return new cL(await super._call(e))}}class e4 extends W{}class e8 extends e4{}class e5 extends e4{async _call(e){return new cL(await super._call(e))}}class e6 extends e4{async _call(e){return new cS(await super._call(e))}}class e9 extends e4{async _call(e){return new cA(await super._call(e))}}class e7 extends W{}class te extends e7{}class tt extends e7{async _call(e){return new cL(await super._call(e))}}class tr extends e7{async _call(e){return new cS(await super._call(e))}}class ts extends e7{async _call(e){return new cI(await super._call(e))}}class to extends W{}class ta extends to{}class tn extends to{async _call(e){return new cL(await super._call(e))}}class ti extends to{async _call(e){return new cS(await super._call(e))}}class tl extends to{async _call(e){return new cA(await super._call(e))}}class tc extends to{async _call(e){return new cI(await super._call(e))}}class td extends W{}class tu extends td{}class tm extends td{async _call(e){return new cL(await super._call(e))}}class t_ extends td{async _call(e){return new cS(await super._call(e))}}class tp extends td{async _call(e){return new cI(await super._call(e))}}class th extends W{}class tf extends th{}class tg extends th{async _call(e){return new cS(await super._call(e))}}class tM extends th{async _call(e){return new cI(await super._call(e))}}class tw extends th{async _call(e){return new cL(await super._call(e))}}class tx extends W{forward_params=["input_ids","attention_mask","encoder_outputs","decoder_input_ids","decoder_attention_mask","past_key_values"]}class tb extends tx{}class tT extends tx{}class tP extends W{}class ty extends tP{}class tk extends tP{}class tv extends W{}class tF extends tv{}class tC extends tv{}class tS extends W{}class tE extends tS{}class tA extends tS{}class tL extends tS{async _call(e){return new cS(await super._call(e))}}class tI extends W{}class tj extends tI{}class tz extends tI{}class tD extends tI{async _call(e){return new cS(await super._call(e))}}class tV extends tI{}class tO extends W{}class tN extends tO{}class tB extends tO{}class tG extends W{}class tR extends tG{}class tq extends tG{}class t$ extends W{}class tW extends t${}class tU extends t${async _call(e){return new cL(await super._call(e))}}class tQ extends t${async _call(e){return new cS(await super._call(e))}}class tX extends t${async _call(e){return new cA(await super._call(e))}}class tH extends t${async _call(e){return new cI(await super._call(e))}}class tJ extends W{}class tY extends tJ{}class tK extends tJ{async _call(e){return new cL(await super._call(e))}}class tZ extends tJ{async _call(e){return new cS(await super._call(e))}}class t0 extends tJ{async _call(e){return new cA(await super._call(e))}}class t1 extends tJ{async _call(e){return new cI(await super._call(e))}}class t2 extends W{}class t3 extends t2{}class t4 extends t2{async _call(e){return new cL(await super._call(e))}}class t8 extends t2{async _call(e){return new cS(await super._call(e))}}class t5 extends t2{async _call(e){return new cA(await super._call(e))}}class t6 extends t2{async _call(e){return new cI(await super._call(e))}}class t9 extends W{}class t7 extends t9{}class re extends t9{}class rt extends W{requires_attention_mask=!1;main_input_name="input_features";forward_params=["input_features","attention_mask","decoder_input_ids","decoder_attention_mask","past_key_values"]}class rr extends rt{}class rs extends rt{_prepare_generation_config(e,t){return super._prepare_generation_config(e,t,M.WhisperGenerationConfig)}_retrieve_init_tokens(e){let t=[e.decoder_start_token_id],r=e.language,s=e.task;if(e.is_multilingual){r||(console.warn("No language specified - defaulting to English (en)."),r="en");let o=(0,w.whisper_language_to_code)(r),a=`<|${o}|>`;t.push(e.lang_to_id[a]),t.push(e.task_to_id[s??"transcribe"])}else if(r||s)throw Error("Cannot specify `task` or `language` for an English-only model. If the model is intended to be multilingual, pass `is_multilingual=true` to generate, or update the generation config.");return!e.return_timestamps&&e.no_timestamps_token_id&&t.at(-1)!==e.no_timestamps_token_id?t.push(e.no_timestamps_token_id):e.return_timestamps&&t.at(-1)===e.no_timestamps_token_id&&(console.warn("<|notimestamps|> prompt token is removed from generation_config since `return_timestamps` is set to `true`."),t.pop()),t.filter(e=>null!=e)}async generate({inputs:e=null,generation_config:t=null,logits_processor:r=null,stopping_criteria:s=null,...o}){t=this._prepare_generation_config(t,o);let a=o.decoder_input_ids??this._retrieve_init_tokens(t);if(t.return_timestamps&&(r??=new d.LogitsProcessorList).push(new d.WhisperTimeStampLogitsProcessor(t,a)),t.begin_suppress_tokens&&(r??=new d.LogitsProcessorList).push(new d.SuppressTokensAtBeginLogitsProcessor(t.begin_suppress_tokens,a.length)),t.return_token_timestamps){if(!t.alignment_heads)throw Error("Model generation config has no `alignment_heads`, token-level timestamps not available. See https://gist.github.com/hollance/42e32852f24243b748ae6bc1f985b13a on how to add this property to the generation config.");"translate"===t.task&&console.warn("Token-level timestamps may not be reliable for task 'translate'."),t.output_attentions=!0,t.return_dict_in_generate=!0}let n=await super.generate({inputs:e,generation_config:t,logits_processor:r,decoder_input_ids:a,...o});return t.return_token_timestamps&&(n.token_timestamps=this._extract_token_timestamps(n,t.alignment_heads,t.num_frames)),n}_extract_token_timestamps(e,t,r=null,s=.02){if(!e.cross_attentions)throw Error("Model outputs must contain cross attentions to extract timestamps. This is most likely because the model was not exported with `output_attentions=True`.");null==r&&console.warn("`num_frames` has not been set, meaning the entire audio will be analyzed. This may lead to inaccurate token-level timestamps for short audios (< 30 seconds).");let o=this.config.median_filter_width;void 0===o&&(console.warn("Model config has no `median_filter_width`, using default value of 7."),o=7);let a=e.cross_attentions,n=Array.from({length:this.config.decoder_layers},(e,t)=>(0,m.cat)(a.map(e=>e[t]),2)),l=(0,m.stack)(t.map(([e,t])=>
1{if(e>=n.length)throw Error(`Layer index ${e} is out of bounds for cross attentions (length ${n.length}).`);return r?n[e].slice(null,t,null,[0,r]):n[e].slice(null,t)})).transpose(1,0,2,3),[c,d]=(0,m.std_mean)(l,-2,0,!0),u=l.clone();for(let e=0;e<u.dims[0];++e){let t=u[e];for(let r=0;r<t.dims[0];++r){let s=t[r],a=c[e][r][0].data,n=d[e][r][0].data;for(let e=0;e<s.dims[0];++e){let t=s[e].data;for(let e=0;e<t.length;++e)t[e]=(t[e]-n[e])/a[e];t.set((0,p.medianFilter)(t,o))}}}let _=[(0,m.mean)(u,1)],h=e.sequences.dims,f=new m.Tensor("float32",new Float32Array(h[0]*h[1]),h);for(let e=0;e<h[0];++e){let t=_[e].neg().squeeze_(0),[r,o]=(0,p.dynamic_time_warping)(t.tolist()),a=Array.from({length:r.length-1},(e,t)=>r[t+1]-r[t]),n=(0,i.mergeArrays)([1],a).map(e=>!!e),l=[];for(let e=0;e<n.length;++e)n[e]&&l.push(o[e]*s);f[e].data.set(l,1)}return f}}class ro extends rs{}class ra extends W{requires_attention_mask=!1;main_input_name="input_values";forward_params=["input_values","decoder_input_ids","past_key_values"]}class rn extends ra{}class ri extends ra{}class rl extends W{main_input_name="pixel_values";forward_params=["pixel_values","decoder_input_ids","encoder_hidden_states","past_key_values"]}class rc extends W{forward_params=["input_ids","attention_mask","pixel_values","position_ids","past_key_values"]}class rd extends rc{_merge_input_ids_with_image_features(e){let t=e.image_features.dims.at(-1),r=e.image_features.view(-1,t);return z({image_token_id:this.config.image_token_index,...e,image_features:r})}}class ru extends rd{}class rm extends rd{}class r_ extends W{forward_params=["input_ids","inputs_embeds","attention_mask","pixel_values","encoder_outputs","decoder_input_ids","decoder_inputs_embeds","decoder_attention_mask","past_key_values"];main_input_name="inputs_embeds"}class rp extends r_{_merge_input_ids_with_image_features({inputs_embeds:e,image_features:t,input_ids:r,attention_mask:s}){return{inputs_embeds:(0,m.cat)([t,e],1),attention_mask:(0,m.cat)([(0,m.ones)(t.dims.slice(0,2)),s],1)}}async _prepare_inputs_embeds({input_ids:e,pixel_values:t,inputs_embeds:r,attention_mask:s}){let o,a;if(!e&&!t)throw Error("Either `input_ids` or `pixel_values` should be provided.");return e&&(o=await this.encode_text({input_ids:e})),t&&(a=await this.encode_image({pixel_values:t})),o&&a?{inputs_embeds:r,attention_mask:s}=this._merge_input_ids_with_image_features({inputs_embeds:o,image_features:a,input_ids:e,attention_mask:s}):r=o||a,{inputs_embeds:r,attention_mask:s}}async forward({input_ids:e,pixel_values:t,attention_mask:r,decoder_input_ids:s,decoder_attention_mask:o,encoder_outputs:a,past_key_values:n,inputs_embeds:i,decoder_inputs_embeds:l}){if(i||({inputs_embeds:i,attention_mask:r}=await this._prepare_inputs_embeds({input_ids:e,pixel_values:t,inputs_embeds:i,attention_mask:r})),!a){let{last_hidden_state:e}=await A(this,{inputs_embeds:i,attention_mask:r});a=e}if(!l){if(!s)throw Error("Either `decoder_input_ids` or `decoder_inputs_embeds` should be provided.");l=await this.encode_text({input_ids:s})}let c={inputs_embeds:l,attention_mask:o,encoder_attention_mask:r,encoder_hidden_states:a,past_key_values:n};return await I(this,c,!0)}}class rh extends W{forward_params=["input_ids","attention_mask","pixel_values","position_ids","past_key_values"]}class rf extends rh{_merge_input_ids_with_image_features(e){let t=e.image_features.dims.at(-1),r=e.image_features.view(-1,t);return z({image_token_id:this.config.image_token_index,...e,image_features:r})}}class rg extends rc{_merge_input_ids_with_image_features(e){let t=e.image_features.dims.at(-1),r=e.image_features.view(-1,t);return z({image_token_id:this.config.image_token_index,...e,image_features:r})}}class rM extends W{forward_params=["input_ids","attention_mask","inputs_embeds","per_layer_inputs","position_ids","pixel_values","input_features","input_features_mask","past_key_values"]}class rw extends rM{async forward({input_ids:e=null,attention_mask:t=null,pixel_values:r=null,input_features:s=null,input_features_mask:o=null,position_ids:a=null,inputs_embeds:n=null,per_layer_inputs:i=null,past_key_values:l=null,generation_config:c=null,logits_processor:d=null,...u}){if((!n||!i)&&({inputs_embeds:n,per_layer_inputs:i}=await F(this.sessions.embed_tokens,{input_ids:e}),1!==e.dims[1])){if(r){let{image_features:s}=await F(this.sessions.vision_encoder,{pixel_values:r});({inputs_embeds:n,attention_mask:t}=this._merge_input_ids_with_image_features({image_features:s,inputs_embeds:n,input_ids:e,attention_mask:t}))}if(s){let{audio_features:r}=await F(this.sessions.audio_encoder,{input_features:s,input_features_mask:o});({inputs_embeds:n,attention_mask:t}=this._merge_input_ids_with_audio_features({audio_features:r,inputs_embeds:n,input_ids:e,attention_mask:t}))}}return await I(this,{inputs_embeds:n,per_layer_inputs:i,past_key_values:l,attention_mask:t,position_ids:a,generation_config:c,logits_processor:d},!0)}_merge_input_ids_with_image_features(e){let t=e.image_features.dims.at(-1),r=e.image_features.view(-1,t);return z({image_token_id:this.config.image_token_id,...e,image_features:r})}_merge_input_ids_with_audio_features(e){let t=e.audio_features.dims.at(-1),r=e.audio_features.view(-1,t);return D({audio_token_id:this.config.audio_token_id,...e,audio_features:r})}}class rx extends W{forward_params=["input_ids","attention_mask","pixel_values","pixel_attention_mask","position_ids","past_key_values"]}class rb extends rx{async encode_image({pixel_values:e,pixel_attention_mask:t}){return(await F(this.sessions.vision_encoder,{pixel_values:e,pixel_attention_mask:t})).image_features}_merge_input_ids_with_image_features(e){let t=e.image_features.dims.at(-1),r=e.image_features.view(-1,t);return z({image_token_id:this.config.image_token_id,...e,image_features:r})}}class rT extends rb{}class rP extends W{forward_params=["input_ids","inputs_embeds","attention_mask","position_ids","pixel_values","image_sizes","past_key_values"]}class ry extends rP{async forward({input_ids:e=null,attention_mask:t=null,pixel_values:r=null,image_sizes:s=null,position_ids:o=null,inputs_embeds:a=null,past_key_values:n=null,generation_config:i=null,logits_processor:l=null,...c}){if(!a){let t;
1if(r&&1!==e.dims[1]){if(!s)throw Error("`image_sizes` must be provided when `pixel_values` is provided.");({image_features:t}=await F(this.sessions.vision_encoder,{pixel_values:r,image_sizes:s}))}else{let e=this.config.normalized_config.hidden_size;t=new m.Tensor("float32",[],[0,e])}({inputs_embeds:a}=await F(this.sessions.prepare_inputs_embeds,{input_ids:e,image_features:t}))}return await I(this,{inputs_embeds:a,past_key_values:n,attention_mask:t,position_ids:o,generation_config:i,logits_processor:l},!1)}}class rk extends W{}class rv extends rk{}class rF extends rk{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"text_model"})}}class rC extends rk{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"text_model"})}}class rS extends rk{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"vision_model"})}}class rE extends rk{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"vision_model"})}}class rA extends W{}class rL extends rA{}class rI extends rA{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"text_model"})}}class rj extends rk{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"vision_model"})}}class rz extends W{}class rD extends rz{}class rV extends W{}class rO extends rV{async forward(e){let t=!e.input_ids,r=!e.pixel_values;if(t&&r)throw Error("Either `input_ids` or `pixel_values` should be provided.");if(t&&(e.input_ids=(0,m.ones)([e.pixel_values.dims[0],1])),r){let{image_size:t}=this.config.vision_config;e.pixel_values=(0,m.full)([0,3,t,t],0)}let{text_embeddings:s,image_embeddings:o,l2norm_text_embeddings:a,l2norm_image_embeddings:n}=await super.forward(e),i={};return t||(i.text_embeddings=s,i.l2norm_text_embeddings=a),r||(i.image_embeddings=o,i.l2norm_image_embeddings=n),i}}class rN extends rV{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"text_model"})}}class rB extends rV{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"vision_model"})}}class rG extends W{}class rR extends rG{}class rq extends rG{}class r$ extends W{}class rW extends r${}class rU extends r${}class rQ extends W{}class rX extends rQ{}class rH extends rQ{}class rJ extends W{}class rY extends rJ{}class rK extends rJ{}class rZ extends W{}class r0 extends rZ{}class r1 extends rZ{}class r2 extends W{}class r3 extends r2{}class r4 extends r2{}class r8 extends W{}class r5 extends r8{}class r6 extends r8{}class r9 extends W{}class r7 extends r9{}class se extends r9{}class st extends W{}class sr extends st{}class ss extends st{}class so extends W{}class sa extends so{}class sn extends W{}class si extends sn{}class sl extends sn{}class sc extends W{}class sd extends sc{}class su extends sc{}class sm extends W{}class s_ extends sm{}class sp extends sm{}class sh extends W{}class sf extends sh{}class sg extends sh{}class sM extends W{}class sw extends sM{}class sx extends sM{}class sb extends W{}class sT extends sb{}class sP extends sb{}class sy extends W{}class sk extends sy{}class sv extends sy{}class sF extends W{}class sC extends sF{}class sS extends sF{}class sE extends W{}class sA extends sE{}class sL extends sE{}class sI extends W{}class sj extends sI{}class sz extends sI{}class sD extends W{}class sV extends sD{}class sO extends sD{}class sN extends W{}class sB extends sN{}class sG extends sN{}class sR extends W{}class sq extends sR{}class s$ extends sR{}class sW extends W{}class sU extends sW{}class sQ extends sW{}class sX extends W{}class sH extends sX{}class sJ extends sX{}class sY extends W{}class sK extends sY{}class sZ extends sY{}class s0 extends W{}class s1 extends s0{}class s2 extends s0{}class s3 extends W{}class s4 extends s3{}class s8 extends s3{}class s5 extends W{}class s6 extends s5{}class s9 extends s5{}class s7 extends W{}class oe extends s7{}class ot extends s7{}class or extends W{forward_params=["input_ids","attention_mask","position_ids","past_key_values","pixel_values","image_grid_thw"]}class os extends or{get_rope_index(e,t,r,s){let{vision_config:o,image_token_id:a,video_token_id:n,vision_start_token_id:i}=this.config,l=o.spatial_merge_size??2,c=[];if(t||r){let o=e.tolist();s||(s=(0,m.ones_like)(e));let d=s.tolist(),u=Array.from({length:3},t=>Array.from({length:e.dims[0]},t=>Array.from({length:e.dims[1]},e=>1))),_=t?t.tolist():[],h=r?r.tolist():[],f=0,g=0;for(let e=0;e<o.length;++e){let t=o[e].filter((t,r)=>1==d[e][r]),r=t.reduce((e,t,r)=>(t==i&&e.push(r),e),[]).map(e=>t[e+1]),s=r.filter(e=>e==a).length,m=r.filter(e=>e==n).length,M=[],w=0,x=s,b=m;for(let e=0;e<r.length;++e){let e,r,s,o,i=t.findIndex((e,t)=>t>w&&e==a),c=t.findIndex((e,t)=>t>w&&e==n),d=x>0&&-1!==i?i:t.length+1,u=b>0&&-1!==c?c:t.length+1;d<u?([r,s,o]=_[f],++f,--x,e=d):([r,s,o]=h[g],++g,--b,e=u);let[m,T,P]=[Number(r),Math.floor(Number(s)/l),Math.floor(Number(o)/l)],y=e-w,k=M.length>0?(0,p.max)(M.at(-1))[0]+1:0;M.push(Array.from({length:3*y},(e,t)=>k+t%y));let v=y+k,F=m*T*P,C=Array.from({length:F},(e,t)=>v+Math.floor(t/(T*P))),S=Array.from({length:F},(e,t)=>v+Math.floor(t/P)%T),E=Array.from({length:F},(e,t)=>v+t%P);M.push([C,S,E].flat()),w=e+F}if(w<t.length){let e=M.length>0?(0,p.max)(M.at(-1))[0]+1:0,r=t.length-w;M.push(Array.from({length:3*r},(t,s)=>e+s%r))}let T=M.reduce((e,t)=>
1e+t.length,0),P=Array(T),y=0;for(let e=0;e<3;++e)for(let t=0;t<M.length;++t){let r=M[t],s=r.length/3;for(let t=e*s;t<(e+1)*s;++t)P[y++]=r[t]}let k=0,v=d[e];for(let t=0;t<v.length;++t)if(1==v[t]){for(let r=0;r<3;++r)u[r][e][t]=P[r*T/3+k];++k}let F=(0,p.max)(P)[0];c.push(F+1-o[e].length)}return[new m.Tensor("int64",u.flat(1/0),[3,e.dims[0],e.dims[1]]),new m.Tensor("int64",c,[c.length,1])]}if(s){let{data:e,dims:t}=B(s),r=BigInt64Array.from({length:3*e.length},(t,r)=>e[r%e.length]),o=Array.from({length:t[0]},(r,s)=>(0,p.max)(e.subarray(t[1]*s,t[1]*(s+1)))[0]+1n+BigInt(t[1]));return[new m.Tensor("int64",r,[3,...t]),new m.Tensor("int64",o,[o.length,1])]}{let[t,r]=e.dims,s=BigInt64Array.from({length:3*t*r},(e,s)=>BigInt(Math.floor(s%r/t)));return[new m.Tensor("int64",s,[3,...e.dims]),(0,m.zeros)([t,1])]}}async encode_image({pixel_values:e,image_grid_thw:t}){return(await F(this.sessions.vision_encoder,{pixel_values:e,grid_thw:t})).image_features}_merge_input_ids_with_image_features(e){return z({image_token_id:this.config.image_token_id,...e})}prepare_inputs_for_generation(e,t,r){if(t.attention_mask&&!t.position_ids)if(t.past_key_values){t.pixel_values=null;let e=BigInt(Object.values(t.past_key_values)[0].dims.at(-2)),r=t.rope_deltas.map(t=>e+t);t.position_ids=(0,m.stack)([r,r,r],0)}else[t.position_ids,t.rope_deltas]=this.get_rope_index(t.input_ids,t.image_grid_thw,t.video_grid_thw,t.attention_mask);return t}}class oo extends W{}class oa extends oo{}class on extends oo{}class oi extends W{}class ol extends oi{}class oc extends oi{}class od extends W{}class ou extends od{}class om extends od{}class o_ extends W{}class op extends o_{}class oh extends o_{}class of extends W{}class og extends of{}class oM extends of{}class ow extends W{}class ox extends ow{}class ob extends ow{async _call(e){return new cS(await super._call(e))}}class oT extends W{}class oP extends oT{}class oy extends oT{async _call(e){return new cS(await super._call(e))}}class ok extends W{}class ov extends ok{}class oF extends W{}class oC extends oF{}class oS extends oF{async _call(e){return new cS(await super._call(e))}}class oE extends W{}class oA extends oE{}class oL extends W{}class oI extends oL{}class oj extends oL{async _call(e){return new cS(await super._call(e))}}class oz extends W{}class oD extends oz{}class oV extends W{}class oO extends oV{}class oN extends oV{async _call(e){return new cS(await super._call(e))}}class oB extends W{}class oG extends oB{async _call(e){return new cD(await super._call(e))}}class oR extends W{}class oq extends oR{}class o$ extends oR{async _call(e){return new cS(await super._call(e))}}class oW extends W{}class oU extends oW{}class oQ extends oW{async _call(e){return new cS(await super._call(e))}}class oX extends W{}class oH extends oX{}class oJ extends oX{}class oY extends W{}class oK extends oY{}class oZ extends oY{}class o0 extends W{}class o1 extends o0{}class o2 extends o0{async _call(e){return new cS(await super._call(e))}}class o3 extends W{}class o4 extends o3{}class o8 extends o3{async _call(e){return new o6(await super._call(e))}}class o5 extends o3{async _call(e){return new o9(await super._call(e))}}class o6 extends U{constructor({logits:e,pred_boxes:t}){super(),this.logits=e,this.pred_boxes=t}}class o9 extends U{constructor({logits:e,pred_boxes:t,pred_masks:r}){super(),this.logits=e,this.pred_boxes=t,this.pred_masks=r}}class o7 extends W{}class ae extends o7{}class at extends o7{async _call(e){return new ar(await super._call(e))}}class ar extends U{constructor({logits:e,pred_boxes:t}){super(),this.logits=e,this.pred_boxes=t}}class as extends W{}class ao extends as{}class aa extends as{async _call(e){return new an(await super._call(e))}}class an extends ar{}class ai extends W{}class al extends ai{}class ac extends ai{async _call(e){return new ad(await super._call(e))}}class ad extends ar{}class au extends W{}class am extends au{}class a_ extends au{async _call(e){return new ar(await super._call(e))}}class ap extends W{}class ah extends ap{}class af extends ap{async _call(e){return new ag(await super._call(e))}}class ag extends o6{}class aM extends W{}class aw extends aM{}class ax extends aM{async _call(e){return new cS(await super._call(e))}}class ab extends W{}class aT extends ab{}class aP extends ab{async _call(e){return new cS(await super._call(e))}}class ay extends W{}class ak extends ay{}class av extends ay{async _call(e){return new cS(await super._call(e))}}class aF extends W{}class aC extends aF{}class aS extends aF{async _call(e){return new cS(await super._call(e))}}class aE extends aF{}class aA extends W{}class aL extends aA{}class aI extends aA{}class aj extends W{}class az extends aj{}class aD extends aj{}class aV extends W{}class aO extends aV{}class aN extends W{}class aB extends aN{}class aG extends aN{}class aR extends aN{}class aq extends W{}class a$ extends aq{}class aW extends W{}class aU extends aW{}class aQ extends W{}class aX extends aQ{}class aH extends W{}class aJ extends aH{}class aY extends aH{}class aK extends W{}class aZ extends aK{}class a0 extends aK{}class a1 extends W{}class a2 extends a1{}class a3 extends W{}class a4 extends a3{}class a8 extends a3{async _call(e){return new cS(await super._call(e))}}class a5 extends W{}class a6 extends a5{}class a9 extends a5{async _call(e){return new cS(await super._call(e))}}class a7 extends W{}
1class ne extends a7{}class nt extends a7{async _call(e){return new cS(await super._call(e))}}class nr extends W{}class ns extends nr{}class no extends nr{async _call(e){return new cS(await super._call(e))}}class na extends W{}class nn extends na{}class ni extends W{}class nl extends ni{}class nc extends W{}class nd extends nc{}class nu extends W{}class nm extends nu{}class n_ extends nu{async _call(e){return new np(await super._call(e))}}class np extends U{constructor({logits:e,pred_boxes:t}){super(),this.logits=e,this.pred_boxes=t}}class nh extends W{}class nf extends nh{async get_image_embeddings({pixel_values:e}){return await A(this,{pixel_values:e})}async forward(e){if(e.image_embeddings&&e.image_positional_embeddings||(e={...e,...await this.get_image_embeddings(e)}),!e.input_labels&&e.input_points){let t=e.input_points.dims.slice(0,-1),r=t.reduce((e,t)=>e*t,1);e.input_labels=new m.Tensor("int64",new BigInt64Array(r).fill(1n),t)}let t={image_embeddings:e.image_embeddings,image_positional_embeddings:e.image_positional_embeddings};return e.input_points&&(t.input_points=e.input_points),e.input_labels&&(t.input_labels=e.input_labels),e.input_boxes&&(t.input_boxes=e.input_boxes),await F(this.sessions.prompt_encoder_mask_decoder,t)}async _call(e){return new ng(await super._call(e))}}class ng extends U{constructor({iou_scores:e,pred_masks:t}){super(),this.iou_scores=e,this.pred_masks=t}}class nM extends W{}class nw extends nM{}class nx extends nM{}class nb extends W{}class nT extends nb{}class nP extends nb{}class ny extends W{}class nk extends ny{}class nv extends ny{async _call(e){return new cj(await super._call(e))}}class nF extends ny{async _call(e){return new cS(await super._call(e))}}class nC extends ny{async _call(e){return new cA(await super._call(e))}}class nS extends W{}class nE extends nS{async _call(e){return new cj(await super._call(e))}}class nA extends W{}class nL extends nA{}class nI extends nA{async _call(e){return new cA(await super._call(e))}}class nj extends W{}class nz extends nj{}class nD extends W{}class nV extends nD{}class nO extends nD{async _call(e){return new cj(await super._call(e))}}class nN extends nD{async _call(e){return new cS(await super._call(e))}}class nB extends W{}class nG extends nB{}class nR extends nB{async _call(e){return new cj(await super._call(e))}}class nq extends nB{async _call(e){return new cS(await super._call(e))}}class n$ extends nB{async _call(e){return new cA(await super._call(e))}}class nW extends W{}class nU extends nW{}class nQ extends nW{async _call(e){return new cj(await super._call(e))}}class nX extends nW{async _call(e){return new cS(await super._call(e))}}class nH extends W{}class nJ extends ny{}class nY extends ny{async _call(e){return new cj(await super._call(e))}}class nK extends ny{async _call(e){return new cS(await super._call(e))}}class nZ extends W{}class n0 extends nZ{}class n1 extends nZ{async _call(e){return new cj(await super._call(e))}}class n2 extends nZ{async _call(e){return new cS(await super._call(e))}}class n3 extends nZ{async _call(e){return new cE(await super._call(e))}}class n4 extends nZ{async _call(e){return new cA(await super._call(e))}}class n8 extends W{}class n5 extends n8{}class n6 extends W{}class n9 extends n6{}class n7 extends n6{}class ie extends n6{async generate_speech(e,t,{threshold:r=.5,minlenratio:s=0,maxlenratio:o=20,vocoder:a=null}={}){let{encoder_outputs:n,encoder_attention_mask:i}=await A(this,{input_ids:e}),l=n.dims[1]/this.config.reduction_factor,c=Math.floor(l*o),d=Math.floor(l*s),u=this.config.num_mel_bins,_=[],p=null,h=null,f=0;for(;;){++f;let e={use_cache_branch:S(!!h),output_sequence:h?h.output_sequence_out:new m.Tensor("float32",new Float32Array(u),[1,1,u]),encoder_attention_mask:i,speaker_embeddings:t,encoder_hidden_states:n};this.addPastKeyValues(e,p),h=await F(this.sessions.decoder_model_merged,e),p=this.getPastKeyValues(h,p);let{prob:s,spectrum:o}=h;if(_.push(o),f>=d&&(Array.from(s.data).filter(e=>e>=r).length>0||f>=c))break}let g=(0,m.cat)(_),{waveform:M}=await F(a.sessions.model,{spectrogram:g});return{spectrogram:g,waveform:M}}}class it extends W{main_input_name="spectrogram"}class ir extends W{}class is extends ir{}class io extends W{}class ia extends io{}class ii extends io{}class il extends W{}class ic extends il{}class id extends il{}class iu extends W{}class im extends iu{}class i_ extends iu{}class ip extends W{}class ih extends ip{}class ig extends ip{}class iM extends W{}class iw extends iM{}class ix extends iM{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"text_model"})}}class ib extends iM{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"audio_model"})}}class iT extends W{}class iP extends iT{async _call(e){return new cV(await super._call(e))}}class iy extends W{}class ik extends iy{}class iv extends iy{}class iF extends iy{}class iC extends W{}class iS extends iC{}class iE extends iC{}class iA extends W{}class iL extends iA{}class iI extends iA{async _call(e){return new cS(await super._call(e))}}class ij extends W{}class iz extends ij{}class iD extends ij{}class iV extends W{forward_params=["input_ids","attention_mask","encoder_outputs","decoder_input_ids","decoder_attention_mask","past_key_values"];_apply_and_filter_by_delay_pattern_mask(e){let[t,r]=e.dims,s=this.config.decoder.num_codebooks,o=r-s,a=0;for(let t=0;t<e.size;++t){if(e.data[t]===this.config.decoder.pad_token_id)continue;let n=t%r-Math.floor(t/r)%s;n>0&&n<=o&&(e.data[a++]=e.data[t])}let n=Math.floor(t/s),i=a/(n*s);return new m.Tensor(e.type,e.data.slice(0,a),[n,s,i])}prepare_inputs_for_generation(e,t,r){let s=structuredClone(e);for(let e=0;e<s.length;++e)for(let t=0;t<s[e].length;++t)e%this.config.decoder.num_codebooks>=t&&(s[e][t]=BigInt(this.config.decoder.pad_token_id));
1return null!==r.guidance_scale&&r.guidance_scale>1&&(s=s.concat(s)),super.prepare_inputs_for_generation(s,t,r)}async generate(e){let t=await super.generate(e),r=this._apply_and_filter_by_delay_pattern_mask(t).unsqueeze_(0),{audio_values:s}=await F(this.sessions.encodec_decode,{audio_codes:r});return s}}class iO extends W{}class iN extends iO{}class iB extends iO{async _call(e){return new cS(await super._call(e))}}class iG extends iO{}class iR extends W{}class iq extends iR{}class i$ extends iR{async _call(e){return new cS(await super._call(e))}}class iW extends iR{}class iU extends W{}class iQ extends iU{}class iX extends iU{async _call(e){return new cS(await super._call(e))}}class iH extends iU{}class iJ extends W{}class iY extends iJ{}class iK extends iJ{async _call(e){return new cS(await super._call(e))}}class iZ extends iJ{}class i0 extends W{}class i1 extends i0{}class i2 extends W{}class i3 extends i2{forward_params=["input_ids","pixel_values","images_seq_mask","images_emb_mask","attention_mask","position_ids","past_key_values"];constructor(...e){super(...e),this._generation_mode="text"}async forward(e){let t,r=this._generation_mode??"text";if("text"!==r&&e.past_key_values){let r=this.sessions.gen_img_embeds,s=(0,i.pick)({image_ids:e.input_ids},r.inputNames);t=await F(r,s)}else{let r=this.sessions.prepare_inputs_embeds,s=(0,i.pick)(e,r.inputNames);t=await F(r,s)}let s={...e,...t},o=await I(this,s),a=this.sessions["text"===r?"lm_head":"gen_head"];if(!a)throw Error(`Unable to find "${a}" generation head`);let n=await F(a,(0,i.pick)(o,a.inputNames));return{...t,...o,...n}}async generate(e){return this._generation_mode="text",super.generate(e)}async generate_images(e){this._generation_mode="image";let t=(e.inputs??e[this.main_input_name]).dims[1],r=(await super.generate(e)).slice(null,[t,null]),s=this.sessions.image_decode,{decoded_image:o}=await F(s,{generated_tokens:r}),a=o.add_(1).mul_(127.5).clamp_(0,255).to("uint8"),n=[];for(let e of a){let t=_.RawImage.fromTensor(e);n.push(t)}return n}}class i4 extends U{constructor({char_logits:e,bpe_logits:t,wp_logits:r}){super(),this.char_logits=e,this.bpe_logits=t,this.wp_logits=r}get logits(){return[this.char_logits,this.bpe_logits,this.wp_logits]}}class i8 extends W{}class i5 extends i8{async _call(e){return new i4(await super._call(e))}}class i6 extends W{}class i9 extends i6{}class i7 extends i6{}class le extends W{}class lt extends le{}class lr extends le{}class ls extends W{forward_params=["input_ids","attention_mask","position_ids","audio_values","past_key_values"]}class lo extends ls{_merge_input_ids_with_audio_features(e){let t=e.audio_features.dims.at(-1),r=e.audio_features.view(-1,t);return D({audio_token_id:this.config.ignore_index??this.config.audio_token_id,...e,audio_features:r})}}class la extends lo{}class ln extends W{main_input_name="input_values";forward_params=["input_values"]}class li extends U{constructor({audio_codes:e}){super(),this.audio_codes=e}}class ll extends U{constructor({audio_values:e}){super(),this.audio_values=e}}class lc extends ln{async encode(e){return new li(await F(this.sessions.encoder_model,e))}async decode(e){return new ll(await F(this.sessions.decoder_model,e))}}class ld extends ln{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"encoder_model"})}}class lu extends ln{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"decoder_model"})}}class lm extends W{main_input_name="input_values";forward_params=["input_values"]}class l_ extends U{constructor({audio_codes:e}){super(),this.audio_codes=e}}class lp extends U{constructor({audio_values:e}){super(),this.audio_values=e}}class lh extends lm{async encode(e){return new l_(await F(this.sessions.encoder_model,e))}async decode(e){return new lp(await F(this.sessions.decoder_model,e))}}class lf extends lm{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"encoder_model"})}}class lg extends lm{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"decoder_model"})}}class lM extends W{main_input_name="input_values";forward_params=["input_values"]}class lw extends lM{async encode(e){return await F(this.sessions.encoder_model,e)}async decode(e){return await F(this.sessions.decoder_model,e)}}class lx extends lM{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"encoder_model"})}}class lb extends lM{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"decoder_model"})}}class lT{static MODEL_CLASS_MAPPINGS=null;static BASE_IF_FAIL=!1;static async from_pretrained(e,{progress_callback:t=null,config:r=null,cache_dir:o=null,local_files_only:a=!1,revision:n="main",model_file_name:i=null,subfolder:l="onnx",device:c=null,dtype:d=null,use_external_data_format:u=null,session_options:m={}}={}){let _={progress_callback:t,config:r,cache_dir:o,local_files_only:a,revision:n,model_file_name:i,subfolder:l,device:c,dtype:d,use_external_data_format:u,session_options:m};if(_.config=await s.AutoConfig.from_pretrained(e,_),!this.MODEL_CLASS_MAPPINGS)throw Error("`MODEL_CLASS_MAPPINGS` not implemented for this type of `AutoClass`: "+this.name);let p=_.config.model_type;for(let t of this.MODEL_CLASS_MAPPINGS){let r=t.get(p);if(!r){for(let e of t.values())if(e[0]===p){r=e;break}if(!r)continue}return await r[1].from_pretrained(e,_)}if(this.BASE_IF_FAIL)return l5.has(p)||console.warn(`Unknown model class "${p}", attempting to construct from base class.`),await W.from_pretrained(e,_);throw Error(`Unsupported model type: ${p}`)}}let lP=new Map([["bert",["BertModel",H]],["neobert",["NeoBertModel",et]],["modernbert",["ModernBertModel",ei]],["nomic_bert",["NomicBertModel",eh]],["roformer",["RoFormerModel",eg]],["electra",["ElectraModel",eS]],["esm",["EsmModel",e8]],["convbert",["ConvBertModel",eP]],["camembert",["CamembertModel",ez]],["deberta",["DebertaModel",eG]],["deberta-v2",["DebertaV2Model",eQ]],["mpnet",["MPNetModel",ta]],["albert",["AlbertModel",tf]],["distilbert",["DistilBertModel",eZ
1]],["roberta",["RobertaModel",tW]],["xlm",["XLMModel",tY]],["xlm-roberta",["XLMRobertaModel",t3]],["clap",["ClapModel",iw]],["clip",["CLIPModel",rv]],["clipseg",["CLIPSegModel",rR]],["chinese_clip",["ChineseCLIPModel",rD]],["siglip",["SiglipModel",rL]],["jina_clip",["JinaCLIPModel",rO]],["mobilebert",["MobileBertModel",te]],["squeezebert",["SqueezeBertModel",tu]],["wav2vec2",["Wav2Vec2Model",nk]],["wav2vec2-bert",["Wav2Vec2BertModel",nU]],["unispeech",["UniSpeechModel",nV]],["unispeech-sat",["UniSpeechSatModel",nG]],["hubert",["HubertModel",nJ]],["wavlm",["WavLMModel",n0]],["audio-spectrogram-transformer",["ASTModel",t7]],["vits",["VitsModel",iP]],["pyannote",["PyAnnoteModel",nL]],["wespeaker-resnet",["WeSpeakerResNetModel",nz]],["detr",["DetrModel",o4]],["rt_detr",["RTDetrModel",ae]],["rt_detr_v2",["RTDetrV2Model",ao]],["rf_detr",["RFDetrModel",al]],["d_fine",["DFineModel",am]],["table-transformer",["TableTransformerModel",ah]],["vit",["ViTModel",ox]],["ijepa",["IJepaModel",oP]],["pvt",["PvtModel",oC]],["vit_msn",["ViTMSNModel",oI]],["vit_mae",["ViTMAEModel",oA]],["groupvit",["GroupViTModel",oD]],["fastvit",["FastViTModel",oO]],["mobilevit",["MobileViTModel",oq]],["mobilevitv2",["MobileViTV2Model",oU]],["owlvit",["OwlViTModel",oH]],["owlv2",["Owlv2Model",oK]],["beit",["BeitModel",o1]],["deit",["DeiTModel",aw]],["hiera",["HieraModel",aT]],["convnext",["ConvNextModel",a4]],["convnextv2",["ConvNextV2Model",a6]],["dinov2",["Dinov2Model",ne]],["dinov2_with_registers",["Dinov2WithRegistersModel",ns]],["dinov3_vit",["DINOv3ViTModel",nn]],["dinov3_convnext",["DINOv3ConvNextModel",nl]],["resnet",["ResNetModel",ak]],["swin",["SwinModel",aC]],["swin2sr",["Swin2SRModel",aL]],["donut-swin",["DonutSwinModel",a2]],["yolos",["YolosModel",nm]],["dpt",["DPTModel",az]],["glpn",["GLPNModel",aZ]],["hifigan",["SpeechT5HifiGan",it]],["efficientnet",["EfficientNetModel",iL]],["decision_transformer",["DecisionTransformerModel",i1]],["patchtst",["PatchTSTForPrediction",i9]],["patchtsmixer",["PatchTSMixerForPrediction",lt]],["mobilenet_v1",["MobileNetV1Model",iN]],["mobilenet_v2",["MobileNetV2Model",iq]],["mobilenet_v3",["MobileNetV3Model",iQ]],["mobilenet_v4",["MobileNetV4Model",iY]],["maskformer",["MaskFormerModel",aJ]],["mgp-str",["MgpstrForSceneTextRecognition",i5]],["style_text_to_speech_2",["StyleTextToSpeech2Model",n5]]]),ly=new Map([["t5",["T5Model",tb]],["longt5",["LongT5Model",ty]],["mt5",["MT5Model",tF]],["bart",["BartModel",tE]],["mbart",["MBartModel",tj]],["marian",["MarianModel",nw]],["whisper",["WhisperModel",rr]],["m2m_100",["M2M100Model",nT]],["blenderbot",["BlenderbotModel",tN]],["blenderbot-small",["BlenderbotSmallModel",tR]]]),lk=new Map([["mimi",["MimiModel",lc]],["dac",["DacModel",lh]],["snac",["SnacModel",lw]]]),lv=new Map([["bloom",["BloomModel",ou]],["jais",["JAISModel",rX]],["gpt2",["GPT2Model",rW]],["gptj",["GPTJModel",r3]],["gpt_bigcode",["GPTBigCodeModel",r5]],["gpt_neo",["GPTNeoModel",rY]],["gpt_neox",["GPTNeoXModel",r0]],["codegen",["CodeGenModel",r7]],["llama",["LlamaModel",sr]],["nanochat",["NanoChatModel",si]],["arcee",["ArceeModel",sd]],["lfm2",["Lfm2Model",s_]],["smollm3",["SmolLM3Model",sf]],["exaone",["ExaoneModel",sk]],["olmo",["OlmoModel",sA]],["olmo2",["Olmo2Model",sj]],["mobilellm",["MobileLLMModel",sC]],["granite",["GraniteModel",sV]],["granitemoehybrid",["GraniteMoeHybridModel",sB]],["cohere",["CohereModel",sq]],["gemma",["GemmaModel",sU]],["gemma2",["Gemma2Model",sH]],["vaultgemma",["VaultGemmaModel",sK]],["gemma3_text",["Gemma3Model",s1]],["helium",["HeliumModel",sw]],["glm",["GlmModel",sT]],["openelm",["OpenELMModel",s4]],["qwen2",["Qwen2Model",s6]],["qwen3",["Qwen3Model",oe]],["phi",["PhiModel",oa]],["phi3",["Phi3Model",ol]],["mpt",["MptModel",op]],["opt",["OPTModel",og]],["mistral",["MistralModel",ia]],["ernie4_5",["Ernie4_5_Model",ic]],["starcoder2",["Starcoder2Model",im]],["falcon",["FalconModel",ih]],["stablelm",["StableLmModel",iS]],["modernbert-decoder",["ModernBertDecoderModel",em]]]),lF=new Map([["speecht5",["SpeechT5ForSpeechToText",n7]],["whisper",["WhisperForConditionalGeneration",rs]],["lite-whisper",["LiteWhisperForConditionalGeneration",ro]],["moonshine",["MoonshineForConditionalGeneration",ri]]]),lC=new Map([["speecht5",["SpeechT5ForTextToSpeech",ie]]]),lS=new Map([["vits",["VitsModel",iP]],["musicgen",["MusicgenForConditionalGeneration",iV]]]),lE=new Map([["bert",["BertForSequenceClassification",Y]],["neobert",["NeoBertForSequenceClassification",es]],["modernbert",["ModernBertForSequenceClassification",ec]],["roformer",["RoFormerForSequenceClassification",ew]],["electra",["ElectraF
1orSequenceClassification",eA]],["esm",["EsmForSequenceClassification",e6]],["convbert",["ConvBertForSequenceClassification",ek]],["camembert",["CamembertForSequenceClassification",eV]],["deberta",["DebertaForSequenceClassification",eq]],["deberta-v2",["DebertaV2ForSequenceClassification",eH]],["mpnet",["MPNetForSequenceClassification",ti]],["albert",["AlbertForSequenceClassification",tg]],["distilbert",["DistilBertForSequenceClassification",e0]],["roberta",["RobertaForSequenceClassification",tQ]],["xlm",["XLMForSequenceClassification",tZ]],["xlm-roberta",["XLMRobertaForSequenceClassification",t8]],["bart",["BartForSequenceClassification",tL]],["mbart",["MBartForSequenceClassification",tD]],["mobilebert",["MobileBertForSequenceClassification",tr]],["squeezebert",["SqueezeBertForSequenceClassification",t_]]]),lA=new Map([["bert",["BertForTokenClassification",K]],["neobert",["NeoBertForTokenClassification",eo]],["modernbert",["ModernBertForTokenClassification",ed]],["roformer",["RoFormerForTokenClassification",ex]],["electra",["ElectraForTokenClassification",eL]],["esm",["EsmForTokenClassification",e9]],["convbert",["ConvBertForTokenClassification",ev]],["camembert",["CamembertForTokenClassification",eO]],["deberta",["DebertaForTokenClassification",e$]],["deberta-v2",["DebertaV2ForTokenClassification",eJ]],["mpnet",["MPNetForTokenClassification",tl]],["distilbert",["DistilBertForTokenClassification",e1]],["roberta",["RobertaForTokenClassification",tX]],["xlm",["XLMForTokenClassification",t0]],["xlm-roberta",["XLMRobertaForTokenClassification",t5]]]),lL=new Map([["t5",["T5ForConditionalGeneration",tT]],["longt5",["LongT5ForConditionalGeneration",tk]],["mt5",["MT5ForConditionalGeneration",tC]],["bart",["BartForConditionalGeneration",tA]],["mbart",["MBartForConditionalGeneration",tz]],["marian",["MarianMTModel",nx]],["m2m_100",["M2M100ForConditionalGeneration",nP]],["blenderbot",["BlenderbotForConditionalGeneration",tB]],["blenderbot-small",["BlenderbotSmallForConditionalGeneration",tq]]]),lI=new Map([["bloom",["BloomForCausalLM",om]],["gpt2",["GPT2LMHeadModel",rU]],["jais",["JAISLMHeadModel",rH]],["gptj",["GPTJForCausalLM",r4]],["gpt_bigcode",["GPTBigCodeForCausalLM",r6]],["gpt_neo",["GPTNeoForCausalLM",rK]],["gpt_neox",["GPTNeoXForCausalLM",r1]],["codegen",["CodeGenForCausalLM",se]],["llama",["LlamaForCausalLM",ss]],["nanochat",["NanoChatForCausalLM",sl]],["llama4_text",["Llama4ForCausalLM",sa]],["arcee",["ArceeForCausalLM",su]],["lfm2",["Lfm2ForCausalLM",sp]],["smollm3",["SmolLM3ForCausalLM",sg]],["exaone",["ExaoneForCausalLM",sv]],["olmo",["OlmoForCausalLM",sL]],["olmo2",["Olmo2ForCausalLM",sz]],["mobilellm",["MobileLLMForCausalLM",sS]],["granite",["GraniteForCausalLM",sO]],["granitemoehybrid",["GraniteMoeHybridForCausalLM",sG]],["cohere",["CohereForCausalLM",s$]],["gemma",["GemmaForCausalLM",sQ]],["gemma2",["Gemma2ForCausalLM",sJ]],["vaultgemma",["VaultGemmaForCausalLM",sZ]],["gemma3_text",["Gemma3ForCausalLM",s2]],["helium",["HeliumForCausalLM",sx]],["glm",["GlmForCausalLM",sP]],["openelm",["OpenELMForCausalLM",s8]],["qwen2",["Qwen2ForCausalLM",s9]],["qwen3",["Qwen3ForCausalLM",ot]],["phi",["PhiForCausalLM",on]],["phi3",["Phi3ForCausalLM",oc]],["mpt",["MptForCausalLM",oh]],["opt",["OPTForCausalLM",oM]],["mbart",["MBartForCausalLM",tV]],["mistral",["MistralForCausalLM",ii]],["ernie4_5",["Ernie4_5_ForCausalLM",id]],["starcoder2",["Starcoder2ForCausalLM",i_]],["falcon",["FalconForCausalLM",ig]],["trocr",["TrOCRForCausalLM",is]],["stablelm",["StableLmForCausalLM",iE]],["modernbert-decoder",["ModernBertDecoderForCausalLM",e_]],["phi3_v",["Phi3VForCausalLM",ry]]]),lj=new Map([["multi_modality",["MultiModalityCausalLM",i3]]]),lz=new Map([["bert",["BertForMaskedLM",J]],["neobert",["NeoBertForMaskedLM",er]],["modernbert",["ModernBertForMaskedLM",el]],["roformer",["RoFormerForMaskedLM",eM]],["electra",["ElectraForMaskedLM",eE]],["esm",["EsmForMaskedLM",e5]],["convbert",["ConvBertForMaskedLM",ey]],["camembert",["CamembertForMaskedLM",eD]],["deberta",["DebertaForMaskedLM",eR]],["deberta-v2",["DebertaV2ForMaskedLM",eX]],["mpnet",["MPNetForMaskedLM",tn]],["albert",["AlbertForMaskedLM",t
1w]],["distilbert",["DistilBertForMaskedLM",e3]],["roberta",["RobertaForMaskedLM",tU]],["xlm",["XLMWithLMHeadModel",tK]],["xlm-roberta",["XLMRobertaForMaskedLM",t4]],["mobilebert",["MobileBertForMaskedLM",tt]],["squeezebert",["SqueezeBertForMaskedLM",tm]]]),lD=new Map([["bert",["BertForQuestionAnswering",Z]],["neobert",["NeoBertForQuestionAnswering",ea]],["roformer",["RoFormerForQuestionAnswering",eb]],["electra",["ElectraForQuestionAnswering",eI]],["convbert",["ConvBertForQuestionAnswering",eF]],["camembert",["CamembertForQuestionAnswering",eN]],["deberta",["DebertaForQuestionAnswering",eW]],["deberta-v2",["DebertaV2ForQuestionAnswering",eY]],["mpnet",["MPNetForQuestionAnswering",tc]],["albert",["AlbertForQuestionAnswering",tM]],["distilbert",["DistilBertForQuestionAnswering",e2]],["roberta",["RobertaForQuestionAnswering",tH]],["xlm",["XLMForQuestionAnswering",t1]],["xlm-roberta",["XLMRobertaForQuestionAnswering",t6]],["mobilebert",["MobileBertForQuestionAnswering",ts]],["squeezebert",["SqueezeBertForQuestionAnswering",tp]]]),lV=new Map([["vision-encoder-decoder",["VisionEncoderDecoderModel",rl]],["idefics3",["Idefics3ForConditionalGeneration",rb]],["smolvlm",["SmolVLMForConditionalGeneration",rT]]]),lO=new Map([["llava",["LlavaForConditionalGeneration",rd]],["llava_onevision",["LlavaOnevisionForConditionalGeneration",ru]],["moondream1",["Moondream1ForConditionalGeneration",rm]],["florence2",["Florence2ForConditionalGeneration",rp]],["qwen2-vl",["Qwen2VLForConditionalGeneration",os]],["idefics3",["Idefics3ForConditionalGeneration",rb]],["smolvlm",["SmolVLMForConditionalGeneration",rT]],["paligemma",["PaliGemmaForConditionalGeneration",rf]],["llava_qwen2",["LlavaQwen2ForCausalLM",rg]],["gemma3n",["Gemma3nForConditionalGeneration",rw]]]),lN=new Map([["ultravox",["UltravoxModel",lo]],["voxtral",["VoxtralForConditionalGeneration",la]]]),lB=new Map([["vision-encoder-decoder",["VisionEncoderDecoderModel",rl]]]),lG=new Map([["vit",["ViTForImageClassification",ob]],["ijepa",["IJepaForImageClassification",oy]],["pvt",["PvtForImageClassification",oS]],["vit_msn",["ViTMSNForImageClassification",oj]],["fastvit",["FastViTForImageClassification",oN]],["mobilevit",["MobileViTForImageClassification",o$]],["mobilevitv2",["MobileViTV2ForImageClassification",oQ]],["beit",["BeitForImageClassification",o2]],["deit",["DeiTForImageClassification",ax]],["hiera",["HieraForImageClassification",aP]],["convnext",["ConvNextForImageClassification",a8]],["convnextv2",["ConvNextV2ForImageClassification",a9]],["dinov2",["Dinov2ForImageClassification",nt]],["dinov2_with_registers",["Dinov2WithRegistersForImageClassification",no]],["resnet",["ResNetForImageClassification",av]],["swin",["SwinForImageClassification",aS]],["segformer",["SegformerForImageClassification",iv]],["efficientnet",["EfficientNetForImageClassification",iI]],["mobilenet_v1",["MobileNetV1ForImageClassification",iB]],["mobilenet_v2",["MobileNetV2ForImageClassification",i$]],["mobilenet_v3",["MobileNetV3ForImageClassification",iX]],["mobilenet_v4",["MobileNetV4ForImageClassification",iK]]]),lR=new Map([["detr",["DetrForObjectDetection",o8]],["rt_detr",["RTDetrForObjectDetection",at]],["rt_detr_v2",["RTDetrV2ForObjectDetection",aa]],["rf_detr",["RFDetrForObjectDetection",ac]],["d_fine",["DFineForObjectDetection",a_]],["table-transformer",["TableTransformerForObjectDetection",af]],["yolos",["YolosForObjectDetection",n_]]]),lq=new Map([["owlvit",["OwlViTForObjectDetection",oJ]],["owlv2",["Owlv2ForObjectDetection",oZ]],["grounding-dino",["GroundingDinoForObjectDetection",nd]]]),l$=new Map([["detr",["DetrForSegmentation",o5]],["clipseg",["CLIPSegForImageSegmentation",rq]]]),lW=new Map([["segformer",["SegformerForSemanticSegmentation",iF]],["sapiens",["SapiensForSemanticSegmentation",aB]],["swin",["SwinForSemanticSegmentation",aE]],["mobilenet_v1",["MobileNetV1ForSemanticSegmentation",iG]],["mobilenet_v2",["MobileNetV2ForSemanticSegmentation",iW]],["mobilenet_v3",["MobileNetV3ForSemanticSegmentation",iH]],["mobilenet_v4",["MobileNetV4ForSemanticSegmentation",iZ]]]),lU=new Map([["detr",["DetrForSegmentation",o5]],["maskformer",["MaskFormerForInstanceSegmentation",aY]]]),lQ=new Map([["sam",["SamModel",nf]]]),lX=new Map([["wav2vec2",["Wav2Vec2ForCTC",nv]],["wav2vec2-bert",["Wav2Vec2BertForCTC",nQ]],["unispeech",["UniSpeechForCTC",nO]],["unispeech-sat",["UniSpeechSatForCTC",nR]],["wavlm",["WavLMForCTC",n1]],["hubert",["HubertForCTC",nY]],["parakeet_ctc",["ParakeetForCTC",nE]]]),lH=new Map([["wav2vec2",["Wav2Vec2ForSequenceClassification",nF]],["wav2vec2-bert",["Wav2Vec2BertForSequenceClassification",nX]],["unispeech",["UniSpeechForSequenceClassification",nN]],["unispeech-sat",["UniSpeechSatForSequenceClassification",nq]],["wavlm",["WavLMForSequenceClassification",n2]],["hubert",["HubertForSequenceClassification",nK]],["audio-spectrogram-transformer",["ASTForAudioClassification",re]]]),lJ=new Map([["wavlm",["WavLMForXVector",n3]]]),lY=new Map([["unispeech-sat",["UniSpeechSatForAudioFrameClassification",n$]],["wavlm",["WavLMForAudioFrameClassification",n4]],["wav2vec2",["Wav2Vec2ForAudioFrameClassification",nC]],["pyannote",["PyAnnoteForAudioFrameClassification",nI]]]),lK=new Map([["vitmatte",["VitMatteForImageMatting",oG]]]),lZ=new Map([["patchtst",["PatchTSTForPrediction",i7]],["patchtsmixer",["PatchTSMixerForPrediction",lr]]]),l0=new Map([["swin2sr",["Swin2SRForImageSuperResolution",aI]]]),l1=new Map([["dpt",["DPTForDepthEstimation",aD]],["depth_anything",["DepthAnythingForDepthEstimation",aO]],["glpn",["GLPNForDepthEstimation",a0]],["sapiens",["SapiensForDepthEstimation",aG]],["depth_pro",["DepthProForDepthEstimation",a$]],["metric3d",["Metric3DForDepthEstimation",aU]],["metric3dv2",["Metric3Dv2ForDepthEstimation",aX]]]),l2=new Map([["sapiens",["SapiensForNormalEstimation",aR]]]),l3=new Map([["vitpose",["VitPoseForPoseEstimation",ov]]]),l4=new Map([["clip",["CLIPVisionModelWithProjection",rE]],["siglip",["SiglipVisionModel",rj]],["jina_clip",["JinaCLIPVisionModel",rB]]]),l8=[[lP,x.EncoderOnly],[ly,x.EncoderDecoder],[lv,x.DecoderOnly],[lk,x.AutoEncoder],[lE,x.EncoderOnly],[lA,x.EncoderOnly],[lL,x.Seq2Seq],[lF,x.Seq2Seq],[lI,x.DecoderOnly],[lj,x.MultiModality],[lz,x.EncoderOnly],[lD,x.EncoderOnly],[lV,x.Vision2Seq],[lO,x.ImageTextToText],[lN,x.AudioTextToText],[lG,x.EncoderOnly],[l$,x.EncoderOnly],[lU,x.EncoderOnly],[lW,x.EncoderOnly],[lK,x.EncoderOnly],[lZ,x.EncoderOnly],[l0,x.EncoderOnly],[l1,x.EncoderOnly],[l2,x.EncoderOnly],[l3,x.EncoderOnly],[lR,x.EncoderOnly],[lq,x.EncoderOnly],[lQ,x.MaskGeneration],[lX,x.EncoderOnly],[lH,x.EncoderOnly],[lC,x.Seq2Seq],[lS,x.EncoderOnly],[lJ,x.EncoderOnly],[lY,x.EncoderOnly],[l4,x.EncoderOnly]];for(let[e,t]of l8)for(let[r,s]of e.values())b.set(r,t),P.set(s,r),T.set(r,s);for(let[e,t,r]of[["MusicgenForConditionalGeneration",iV,x.Musicgen],["Phi3VForCausalLM",ry,x.Phi3V],["CLIPTextModelWithProjection",rC,x.EncoderOnly],["SiglipTextModel",rI,x.EncoderOnly],["JinaCLIPTextModel",rN,x.EncoderOnly],["ClapTextModelWithProjection",ix,x.EncoderOnly],["ClapAudioModelWithProjection",ib,x.EncoderOnly],["DacEncoderModel",lf,x.EncoderOnly],["DacDecoderModel",lg,x.EncoderOnly],["MimiEncoderModel",ld,x.EncoderOnly],["MimiDecoderModel",lu,x.EncoderOnly],["SnacEncoderModel",lx,x.EncoderOnly],["SnacDecoderModel",lb,x.EncoderOnly],["Gemma3nForConditionalGeneration",rw,x.ImageAudioTextToText]])b.set(e,r),P.set(t,e),T.set(e,t);let l5=new Map([["modnet",l$],["birefnet",l$],["isnet",l$],["ben",l$]]);for(let[e,t]of l5.entries())t.set(e,["PreTrainedModel",W]),b.set(e,x.EncoderOnly),P.set(W,e),T.set(e,W);class l6 extends lT{static MODEL_CLASS_MAPPINGS=l8.map(e=>e[0]);static BASE_IF_FAIL=!0}class l9 extends lT{static MODEL_CLASS_MAPPINGS=[lE]}class l7 extends lT{static MODEL_CLASS_MAPPINGS=[lA]}class ce extends lT{static MODEL_CLASS_MAPPINGS=[lL]}class ct extends lT{static MODEL_CLASS_MAPPINGS=[lF]}class cr extends lT{static MODEL_CLASS_MAPPINGS=[lC]}class cs extends lT{static MODEL_CLASS_MAPPINGS=[lS]}class co extends lT{static MODEL_CLASS_MAPPINGS=[lI]}class ca extends lT{static MODEL_CLASS_MAPPINGS=[lz]}class cn extends lT{static MODEL_CLASS_MAPPINGS=[lD]}class ci extends lT{static MODEL_CLASS_MAPPINGS=[lV]}class cl extends lT{static MODEL_CLASS_MAPPINGS=[lG]}class cc extends lT{static MODEL_CLASS_MAPPINGS=[l$]}class cd extends lT{static MODEL_CLASS_MAPPINGS=[lW]}class cu extends lT{static MODEL_CLASS_MAPPINGS=[lU]}class cm extends lT{static MODEL_CLASS_MAPPINGS=[lR]}class c_ extends lT{static MODEL_CLASS_MAPPINGS=[lq]}class cp extends lT{static MODEL_CLASS_MAPPINGS=[lQ]}class ch extends lT{static MODEL_CLASS_MAPPINGS=[lX]}class cf extends lT{static MODEL_CLASS_MAPPINGS=[lH]}class cg extends lT{static MODEL_CLASS_MAPPINGS=[lJ]}class cM extends lT{static MODEL_CLASS_MAPPINGS=[lY]}class cw extends lT{static MODEL_CLASS_MAPPINGS=[lB]}class cx extends lT{static MODEL_CLASS_MAPPINGS=[lK]}class cb extends lT{static MODEL_CLASS_MAPPINGS=[l0]}class cT extends lT{static MODEL_CLASS_MAPPINGS=[l1]}class cP extends lT{static MODEL_CLASS_MAPPINGS=[l2]}class cy extends lT{static MODEL_CLASS_MAPPINGS=[l3]}class ck extends lT{static MODEL_CLASS_MAPPINGS=[l4]}class cv extends lT{static MODEL_CLASS_MAPPINGS=[lO]}class cF extends lT{static MODEL_CLASS_MAPPINGS=[lN]}class cC extends U{constructor({logits:e,past_key_values:t,encoder_outputs:r,decoder_attentions:s=null,cross_attentions:o=null}){super(),this.logits=e,this.past_key_values=t,this.encoder_outputs=r,this.decoder_attentions=s,this.cross_attentions=o}}class cS extends U{constructor({logits:e,...t}){super(),this.logits=e;let r=Object.values(t);r.length>0&&(this.attentions=r)}}class cE extends U{constructor({logits:e,embeddings:t}){super(),this.logits=e,this.embeddings=t}}class cA extends U{constructor({logits:e}){super(),this.logits=e}}class cL extends U{constructor({logits:e}){super(),this.logits=e}}
1class cI extends U{constructor({start_logits:e,end_logits:t}){super(),this.start_logits=e,this.end_logits=t}}class cj extends U{constructor({logits:e}){super(),this.logits=e}}class cz extends U{constructor({logits:e,past_key_values:t}){super(),this.logits=e,this.past_key_values=t}}class cD extends U{constructor({alphas:e}){super(),this.alphas=e}}class cV extends U{constructor({waveform:e,spectrogram:t}){super(),this.waveform=e,this.spectrogram=t}}},
1"./src/models/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.js":(e,t,r)=>{r.r(t),r.d(t,{ASTFeatureExtractor:()=>a});var s=r("./src/base/feature_extraction_utils.js");r("./src/utils/tensor.js");var o=r("./src/utils/audio.js");class a extends s.FeatureExtractor{constructor(e){super(e);let t=this.config.sampling_rate,r=(0,o.mel_filter_bank)(257,this.config.num_mel_bins,20,Math.floor(t/2),t,null,"kaldi",!0);this.mel_filters=r,this.window=(0,o.window_function)(400,"hann",{periodic:!1}),this.mean=this.config.mean,this.std=this.config.std}async _extract_fbank_features(e,t){return(0,o.spectrogram)(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){(0,s.validate_audio_inputs)(e,"ASTFeatureExtractor");let t=await this._extract_fbank_features(e,this.config.max_length);if(this.config.do_normalize){let e=2*this.std,r=t.data;for(let t=0;t<r.length;++t)r[t]=(r[t]-this.mean)/e}return{input_values:t.unsqueeze_(0)}}}},
1"./src/models/auto/feature_extraction_auto.js":(e,t,r)=>{r.r(t),r.d(t,{AutoFeatureExtractor:()=>n});var s=r("./src/utils/constants.js"),o=r("./src/utils/hub.js");r("./src/base/feature_extraction_utils.js");var a=r("./src/models/feature_extractors.js");class n{static async from_pretrained(e,t={}){let r=await (0,o.getModelJSON)(e,s.FEATURE_EXTRACTOR_NAME,!0,t),n=r.feature_extractor_type,i=a[n];if(!i)throw Error(`Unknown feature_extractor_type: '${n}'. Please report this at ${s.GITHUB_ISSUE_URL}.`);return new i(r)}}},
1"./src/models/auto/image_processing_auto.js":(e,t,r)=>{r.r(t),r.d(t,{AutoImageProcessor:()=>i});var s=r("./src/utils/constants.js"),o=r("./src/utils/hub.js"),a=r("./src/base/image_processors_utils.js"),n=r("./src/models/image_processors.js");class i{static async from_pretrained(e,t={}){let r=await (0,o.getModelJSON)(e,s.IMAGE_PROCESSOR_NAME,!0,t),i=r.image_processor_type??r.feature_extractor_type,l=n[i?.replace(/Fast$/,"")];return l||(void 0!==i&&console.warn(`Image processor type '${i}' not found, assuming base ImageProcessor. Please report this at ${s.GITHUB_ISSUE_URL}.`),l=a.ImageProcessor),new l(r)}}},
1"./src/models/auto/processing_auto.js":(e,t,r)=>{r.r(t),r.d(t,{AutoProcessor:()=>c});var s=r("./src/utils/constants.js"),o=r("./src/utils/hub.js"),a=r("./src/base/processing_utils.js"),n=r("./src/models/processors.js"),i=r("./src/models/image_processors.js"),l=r("./src/models/feature_extractors.js");class c{static async from_pretrained(e,t={}){let r=await (0,o.getModelJSON)(e,s.IMAGE_PROCESSOR_NAME,!0,t),{image_processor_type:c,feature_extractor_type:d,processor_class:u}=r;if(u&&n[u])return n[u].from_pretrained(e,t);if(!c&&!d)throw Error("No `image_processor_type` or `feature_extractor_type` found in the config.");let m={};if(c){let e=i[c.replace(/Fast$/,"")];if(!e)throw Error(`Unknown image_processor_type: '${c}'.`);m.image_processor=new e(r)}if(d){let e=i[d];if(e)m.image_processor=new e(r);else{let e=l[d];if(!e)throw Error(`Unknown feature_extractor_type: '${d}'.`);m.feature_extractor=new e(r)}}return new a.Processor({},m,null)}}},
1"./src/models/beit/image_processing_beit.js":(e,t,r)=>{r.r(t),r.d(t,{BeitFeatureExtractor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}},
1"./src/models/bit/image_processing_bit.js":(e,t,r)=>{r.r(t),r.d(t,{BitImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}},
1"./src/models/chinese_clip/image_processing_chinese_clip.js":(e,t,r)=>{r.r(t),r.d(t,{ChineseCLIPFeatureExtractor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}},
1"./src/models/clap/feature_extraction_clap.js":(e,t,r)=>{r.r(t),r.d(t,{ClapFeatureExtractor:()=>a});var s=r("./src/base/feature_extraction_utils.js");r("./src/utils/tensor.js");var o=r("./src/utils/audio.js");class a extends s.FeatureExtractor{constructor(e){super(e),this.mel_filters=(0,o.mel_filter_bank)(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=(0,o.mel_filter_bank)(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=(0,o.window_function)(this.config.fft_window_size,"hann")}async _get_input_mel(e,t,r,s){let o,a=e.length-t;if(a>0)if("rand_trunc"===r){let r=Math.floor(Math.random()*(a+1));e=e.subarray(r,r+t),o=await this._extract_fbank_features(e,this.mel_filters_slaney,this.config.nb_max_samples)}else throw Error(`Truncation strategy "${r}" not implemented`);else{if(a<0){let r=new Float64Array(t);if(r.set(e),"repeat"===s)for(let s=e.length;s<t;s+=e.length)r.set(e.subarray(0,Math.min(e.length,t-s)),s);else if("repeatpad"===s)for(let t=e.length;t<-a;t+=e.length)r.set(e,t);e=r}if("fusion"===r)throw Error(`Truncation strategy "${r}" not implemented`);o=await this._extract_fbank_features(e,this.mel_filters_slaney,this.config.nb_max_samples)}return o.unsqueeze_(0)}async _extract_fbank_features(e,t,r=null){return(0,o.spectrogram)(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}={}){return(0,s.validate_audio_inputs)(e,"ClapFeatureExtractor"),{input_features:(await this._get_input_mel(e,t??this.config.nb_max_samples,this.config.truncation,this.config.padding)).unsqueeze_(0)}}}},
1"./src/models/clip/image_processing_clip.js":(e,t,r)=>{r.r(t),r.d(t,{CLIPFeatureExtractor:()=>a,CLIPImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class a extends o{}},
1"./src/models/convnext/image_processing_convnext.js":(e,t,r)=>{r.r(t),r.d(t,{ConvNextFeatureExtractor:()=>a,ConvNextImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{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),[s,o]=this.get_resize_output_image_size(e,{shortest_edge:r});e=await e.resize(s,o,{resample:this.resample}),e=await e.center_crop(t,t)}else e=await e.resize(t,t,{resample:this.resample});return e}}class a extends o{}},
1"./src/models/dac/feature_extraction_dac.js":(e,t,r)=>{r.r(t),r.d(t,{DacFeatureExtractor:()=>o});var s=r("./src/models/encodec/feature_extraction_encodec.js");class o extends s.EncodecFeatureExtractor{}},
1"./src/models/deit/image_processing_deit.js":(e,t,r)=>{r.r(t),r.d(t,{DeiTFeatureExtractor:()=>a,DeiTImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class a extends o{}},
1"./src/models/detr/image_processing_detr.js":(e,t,r)=>{r.r(t),r.d(t,{DetrFeatureExtractor:()=>n,DetrImageProcessor:()=>a});var s=r("./src/base/image_processors_utils.js"),o=r("./src/utils/tensor.js");class a extends s.ImageProcessor{async _call(e){let t=await super._call(e),r=[t.pixel_values.dims[0],64,64],s=(0,o.full)(r,1n);return{...t,pixel_mask:s}}post_process_object_detection(...e){return(0,s.post_process_object_detection)(...e)}post_process_panoptic_segmentation(...e){return(0,s.post_process_panoptic_segmentation)(...e)}post_process_instance_segmentation(...e){return(0,s.post_process_instance_segmentation)(...e)}}class n extends a{}},
1"./src/models/dinov3_vit/image_processing_dinov3_vit.js":(e,t,r)=>{r.r(t),r.d(t,{DINOv3ViTImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}},
1"./src/models/donut/image_processing_donut.js":(e,t,r)=>{r.r(t),r.d(t,{DonutFeatureExtractor:()=>a,DonutImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{pad_image(e,t,r,s={}){let[o,a,n]=t,i=this.image_mean;Array.isArray(this.image_mean)||(i=Array(n).fill(i));let l=this.image_std;Array.isArray(l)||(l=Array(n).fill(i));let c=i.map((e,t)=>-e/l[t]);return super.pad_image(e,t,r,{center:!0,constant_values:c,...s})}}class a extends o{}},
1"./src/models/dpt/image_processing_dpt.js":(e,t,r)=>{r.r(t),r.d(t,{DPTFeatureExtractor:()=>a,DPTImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class a extends o{}},
1"./src/models/efficientnet/image_processing_efficientnet.js":(e,t,r)=>{r.r(t),r.d(t,{EfficientNetImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{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))}}},
1"./src/models/encodec/feature_extraction_encodec.js":(e,t,r)=>{r.r(t),r.d(t,{EncodecFeatureExtractor:()=>a});var s=r("./src/base/feature_extraction_utils.js"),o=r("./src/utils/tensor.js");class a extends s.FeatureExtractor{async _call(e){(0,s.validate_audio_inputs)(e,"EncodecFeatureExtractor"),e instanceof Float64Array&&(e=new Float32Array(e));let t=this.config.feature_size;if(e.length%t!=0)throw Error(`The length of the audio data must be a multiple of the number of channels (${t}).`);let r=[1,t,e.length/t];return{input_values:new o.Tensor("float32",e,r)}}}},
1"./src/models/feature_extractors.js":(e,t,r)=>{r.r(t),r.d(t,{ASTFeatureExtractor:()=>s.ASTFeatureExtractor,ClapFeatureExtractor:()=>a.ClapFeatureExtractor,DacFeatureExtractor:()=>n.DacFeatureExtractor,EncodecFeatureExtractor:()=>o.EncodecFeatureExtractor,Gemma3nAudioFeatureExtractor:()=>i.Gemma3nAudioFeatureExtractor,ImageFeatureExtractor:()=>g.ImageProcessor,MoonshineFeatureExtractor:()=>l.MoonshineFeatureExtractor,ParakeetFeatureExtractor:()=>c.ParakeetFeatureExtractor,PyAnnoteFeatureExtractor:()=>d.PyAnnoteFeatureExtractor,SeamlessM4TFeatureExtractor:()=>u.SeamlessM4TFeatureExtractor,SnacFeatureExtractor:()=>m.SnacFeatureExtractor,SpeechT5FeatureExtractor:()=>_.SpeechT5FeatureExtractor,Wav2Vec2FeatureExtractor:()=>p.Wav2Vec2FeatureExtractor,WeSpeakerFeatureExtractor:()=>h.WeSpeakerFeatureExtractor,WhisperFeatureExtractor:()=>f.WhisperFeatureExtractor});var s=r("./src/models/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.js"),o=r("./src/models/encodec/feature_extraction_encodec.js"),a=r("./src/models/clap/feature_extraction_clap.js"),n=r("./src/models/dac/feature_extraction_dac.js"),i=r("./src/models/gemma3n/feature_extraction_gemma3n.js"),l=r("./src/models/moonshine/feature_extraction_moonshine.js"),c=r("./src/models/parakeet/feature_extraction_parakeet.js"),d=r("./src/models/pyannote/feature_extraction_pyannote.js"),u=r("./src/models/seamless_m4t/feature_extraction_seamless_m4t.js"),m=r("./src/models/snac/feature_extraction_snac.js"),_=r("./src/models/speecht5/feature_extraction_speecht5.js"),p=r("./src/models/wav2vec2/feature_extraction_wav2vec2.js"),h=r("./src/models/wespeaker/feature_extraction_wespeaker.js"),f=r("./src/models/whisper/feature_extraction_whisper.js"),g=r("./src/base/image_processors_utils.js")},
1"./src/models/florence2/processing_florence2.js":(e,t,r)=>{r.r(t),r.d(t,{Florence2Processor:()=>n});var s=r("./src/base/processing_utils.js"),o=r("./src/models/auto/image_processing_auto.js"),a=r("./src/tokenizers.js");class n extends s.Processor{static tokenizer_class=a.AutoTokenizer;static image_processor_class=o.AutoImageProcessor;constructor(e,t,r){super(e,t,r);let{tasks_answer_post_processing_type:s,task_prompts_without_inputs:o,task_prompts_with_input:a}=this.image_processor.config;this.tasks_answer_post_processing_type=new Map(Object.entries(s??{})),this.task_prompts_without_inputs=new Map(Object.entries(o??{})),this.task_prompts_with_input=new Map(Object.entries(a??{})),this.regexes={quad_boxes:/(.+?)<loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)>/gm,bboxes:/([^<]+)?<loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)>/gm},this.size_per_bin=1e3}construct_prompts(e){"string"==typeof e&&(e=[e]);let t=[];for(let r of e)if(this.task_prompts_without_inputs.has(r))t.push(this.task_prompts_without_inputs.get(r));else{for(let[e,s]of this.task_prompts_with_input)if(r.includes(e)){t.push(s.replaceAll("{input}",r).replaceAll(e,""));break}t.length!==e.length&&t.push(r)}return t}post_process_generation(e,t,r){let s,o=this.tasks_answer_post_processing_type.get(t)??"pure_text";switch(e=e.replaceAll("<s>","").replaceAll("</s>",""),o){case"pure_text":s=e;break;case"description_with_bboxes":case"bboxes":case"phrase_grounding":case"ocr":let a="ocr"===o?"quad_boxes":"bboxes",n=e.matchAll(this.regexes[a]),i=[],l=[];for(let[e,t,...s]of n)i.push(t?t.trim():i.at(-1)??""),l.push(s.map((e,t)=>(Number(e)+.5)/this.size_per_bin*r[t%2]));s={labels:i,[a]:l};break;default:throw Error(`Task "${t}" (of type "${o}") not yet implemented.`)}return{[t]:s}}async _call(e,t=null,r={}){if(!e&&!t)throw Error("Either text or images must be provided");let s=await this.image_processor(e,r),o=t?this.tokenizer(this.construct_prompts(t),r):{};return{...s,...o}}}},
1"./src/models/gemma3n/feature_extraction_gemma3n.js":(e,t,r)=>{r.r(t),r.d(t,{Gemma3nAudioFeatureExtractor:()=>n});var s=r("./src/base/feature_extraction_utils.js"),o=r("./src/utils/tensor.js"),a=r("./src/utils/audio.js");class n extends s.FeatureExtractor{constructor(e){super(e);let{fft_length:t,feature_size:r,min_frequency:s,max_frequency:o,sampling_rate:n,frame_length:i}=this.config,l=(0,a.mel_filter_bank)(Math.floor(1+t/2),r,s,o,n,null,"htk",!1);this.mel_filters=l,this.window=(0,a.window_function)(i,"hann")}async _extract_fbank_features(e,t){return(0,a.spectrogram)(e,this.window,this.config.frame_length,this.config.hop_length,{fft_length:this.config.fft_length,center:!1,onesided:!0,preemphasis:this.config.preemphasis,preemphasis_htk_flavor:this.config.preemphasis_htk_flavor,mel_filters:this.mel_filters,log_mel:"log",mel_floor:this.config.mel_floor,remove_dc_offset:!1,transpose:!0})}async _call(e,{max_length:t=48e4,truncation:r=!0,padding:a=!0,pad_to_multiple_of:n=128}={}){if((0,s.validate_audio_inputs)(e,"Gemma3nAudioFeatureExtractor"),r&&e.length>t&&(e=e.slice(0,t)),a&&e.length%n!=0){let t=n-e.length%n,r=new Float64Array(e.length+t);r.set(e),0!==this.config.padding_value&&r.fill(this.config.padding_value,e.length),e=r}let i=await this._extract_fbank_features(e,this.config.max_length),l=(0,o.full)([1,i.dims[0]],!0);return{input_features:i.unsqueeze_(0),input_features_mask:l}}}},
1"./src/models/gemma3n/processing_gemma3n.js":(e,t,r)=>{r.r(t),r.d(t,{Gemma3nProcessor:()=>i});var s=r("./src/base/processing_utils.js"),o=r("./src/models/auto/image_processing_auto.js"),a=r("./src/models/auto/feature_extraction_auto.js"),n=r("./src/tokenizers.js");r("./src/utils/image.js"),r("./src/utils/audio.js");class i extends s.Processor{static image_processor_class=o.AutoImageProcessor;static feature_extractor_class=a.AutoFeatureExtractor;static tokenizer_class=n.AutoTokenizer;static uses_processor_config=!0;static uses_chat_template_file=!0;constructor(e,t,r){super(e,t,r),this.audio_seq_length=this.config.audio_seq_length,this.image_seq_length=this.config.image_seq_length;let{audio_token_id:s,boa_token:o,audio_token:a,eoa_token:n,image_token_id:i,boi_token:l,image_token:c,eoi_token:d}=this.tokenizer.config;this.audio_token_id=s,this.boa_token=o,this.audio_token=a;let u=a.repeat(this.audio_seq_length);this.full_audio_sequence=`
2
3${o}${u}${n}
4
5`,this.image_token_id=i,this.boi_token=l,this.image_token=c;let m=c.repeat(this.image_seq_length);this.full_image_sequence=`
6
7${l}${m}${d}
8
9`}async _call(e,t=null,r=null,s={}){let o,a;return"string"==typeof e&&(e=[e]),r&&(o=await this.feature_extractor(r,s),e=e.map(e=>e.replaceAll(this.audio_token,this.full_audio_sequence))),t&&(a=await this.image_processor(t,s),e=e.map(e=>e.replaceAll(this.image_token,this.full_image_sequence))),{...this.tokenizer(e,s),...a,...o}}}},
9"./src/models/glpn/image_processing_glpn.js":(e,t,r)=>{r.r(t),r.d(t,{GLPNFeatureExtractor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}},
9"./src/models/grounding_dino/image_processing_grounding_dino.js":(e,t,r)=>{r.r(t),r.d(t,{GroundingDinoImageProcessor:()=>a});var s=r("./src/base/image_processors_utils.js"),o=r("./src/utils/tensor.js");class a extends s.ImageProcessor{async _call(e){let t=await super._call(e),r=t.pixel_values.dims,s=(0,o.ones)([r[0],r[2],r[3]]);return{...t,pixel_mask:s}}}},
9"./src/models/grounding_dino/processing_grounding_dino.js":(e,t,r)=>{r.r(t),r.d(t,{GroundingDinoProcessor:()=>i});var s=r("./src/base/processing_utils.js"),o=r("./src/models/auto/image_processing_auto.js"),a=r("./src/tokenizers.js"),n=r("./src/base/image_processors_utils.js");class i extends s.Processor{static tokenizer_class=a.AutoTokenizer;static image_processor_class=o.AutoImageProcessor;async _call(e,t,r={}){let s=e?await this.image_processor(e,r):{};return{...t?this.tokenizer(t,r):{},...s}}post_process_grounded_object_detection(e,t,{box_threshold:r=.25,text_threshold:s=.25,target_sizes:o=null}={}){let{logits:a,pred_boxes:i}=e,l=a.dims[0];if(null!==o&&o.length!==l)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");let c=a.dims.at(1),d=a.sigmoid(),u=d.max(-1).tolist(),m=i.tolist().map(e=>e.map(e=>(0,n.center_to_corners_format)(e))),_=[];for(let e=0;e<l;++e){let a=null!==o?o[e]:null;null!==a&&(m[e]=m[e].map(e=>e.map((e,t)=>e*a[(t+1)%2])));let n=u[e],i=[],l=[],p=[];for(let o=0;o<c;++o){let a=n[o];if(a<=r)continue;let c=m[e][o],u=d[e][o];i.push(a),p.push(c);let _=function(e,t){let r=e.dims.at(-1)-1,s=e.tolist();s.fill(!1,0,1),s.fill(!1,r);let o=t.tolist();return s.map((e,t)=>e?t:null).filter(e=>null!==e).map(e=>o[e])}(u.gt(s),t[e]);l.push(_)}_.push({scores:i,boxes:p,labels:this.batch_decode(l)})}return _}}},
9"./src/models/idefics3/image_processing_idefics3.js":(e,t,r)=>{r.r(t),r.d(t,{Idefics3ImageProcessor:()=>a});var s=r("./src/base/image_processors_utils.js"),o=r("./src/utils/tensor.js");class a extends s.ImageProcessor{constructor(e){super(e),this.do_image_splitting=e.do_image_splitting??!0,this.max_image_size=e.max_image_size}get_resize_for_vision_encoder(e,t){let[r,s]=e.dims.slice(-2),o=s/r;return s>=r?r=Math.ceil((r=Math.floor((s=Math.ceil(s/t)*t)/o))/t)*t:s=Math.ceil((s=Math.floor((r=Math.ceil(r/t)*t)*o))/t)*t,{height:r,width:s}}async _call(e,{do_image_splitting:t=null,return_row_col_info:r=!1}={}){let s,a,n;if(Array.isArray(e)){if(0===e.length||!e[0])throw Error("No images provided.");s=Array.isArray(e[0])?e:[e]}else s=[[e]];let i=[],l=[],c=[],d=[],u=[];for(let e of s){let r,s=await Promise.all(e.map(e=>this.preprocess(e)));d.push(...s.map(e=>e.original_size)),u.push(...s.map(e=>e.reshaped_input_size)),s.forEach(e=>e.pixel_values.unsqueeze_(0));let{longest_edge:a}=this.max_image_size;if(t??this.do_image_splitting){let e=Array(s.length),t=Array(s.length);r=await Promise.all(s.map(async(r,s)=>{let n=this.get_resize_for_vision_encoder(r.pixel_values,a),i=await (0,o.interpolate_4d)(r.pixel_values,{size:[n.height,n.width]}),{frames:l,num_splits_h:c,num_splits_w:d}=await this.split_image(i,this.max_image_size);return e[s]=c,t[s]=d,(0,o.cat)(l,0)})),l.push(e),c.push(t)}else{let e=[a,a];r=await Promise.all(s.map(t=>(0,o.interpolate_4d)(t.pixel_values,{size:e}))),l.push(Array(s.length).fill(0)),c.push(Array(s.length).fill(0))}i.push((0,o.cat)(r,0))}let m=i.length,[_,p,h,f]=i[0].dims;if(1===m)a=i[0].unsqueeze_(0),n=(0,o.full)([m,_,h,f],!0);else{let e=Math.max(...i.map(e=>e.dims.at(0))),t=(n=(0,o.full)([m,e,h,f],!0)).data,r=e*h*f;for(let s=0;s<m;++s){let a=i[s].dims[0];if(a<e){i[s]=(0,o.cat)([i[s],(0,o.full)([e-a,p,h,f],0)],0);let n=s*r+a*h*f,l=(s+1)*r;t.fill(!1,n,l)}}a=(0,o.stack)(i,0)}return{pixel_values:a,pixel_attention_mask:n,original_sizes:d,reshaped_input_sizes:u,...r?{rows:l,cols:c}:{}}}async split_image(e,{longest_edge:t}){let r=[],[s,a]=e.dims.slice(-2),n=0,i=0;if(s>t||a>t){n=Math.ceil(s/t),i=Math.ceil(a/t);let l=Math.ceil(s/n),c=Math.ceil(a/i);for(let t=0;t<n;++t)for(let d=0;d<i;++d){let u,m,_,p;t===n-1?(m=s-l,p=s):(m=t*l,p=(t+1)*l),d===i-1?(u=a-c,_=a):(u=d*c,_=(d+1)*c);let h=[m,u],f=[p,_],g=await (0,o.slice)(e,h,f,[2,3]);r.push(g)}(s!==t||a!==t)&&(e=await (0,o.interpolate_4d)(e,{size:[t,t]}))}return r.push(e),{frames:r,num_splits_h:n,num_splits_w:i}}}},
9"./src/models/idefics3/processing_idefics3.js":(e,t,r)=>{r.r(t),r.d(t,{Idefics3Processor:()=>i});var s=r("./src/base/processing_utils.js"),o=r("./src/models/auto/image_processing_auto.js"),a=r("./src/tokenizers.js");r("./src/utils/image.js");var n=r("./src/utils/core.js");class i extends s.Processor{static image_processor_class=o.AutoImageProcessor;static tokenizer_class=a.AutoTokenizer;static uses_processor_config=!0;fake_image_token="<fake_token_around_image>";image_token="<image>";global_img_token="<global-img>";async _call(e,t=null,r={}){let s;r.return_row_col_info??=!0,t&&(s=await this.image_processor(t,r)),Array.isArray(e)||(e=[e]);let o=s.rows??[Array(e.length).fill(0)],a=s.cols??[Array(e.length).fill(0)],i=this.config.image_seq_len,l=[],c=[];for(let t=0;t<e.length;++t){let r=e[t],s=o[t],d=a[t];l.push((0,n.count)(r,this.image_token));let u=s.map((e,t)=>(function(e,t,r,s,o,a){if(0===e&&0===t)return`${s}${a}`+o.repeat(r)+`${s}`;let n="";for(let a=0;a<e;++a){for(let e=0;e<t;++e)n+=s+`<row_${a+1}_col_${e+1}>`+o.repeat(r);n+="\n"}return n+(`
10${s}${a}`+o.repeat(r)+`${s}`)})(e,d[t],i,this.fake_image_token,this.image_token,this.global_img_token)),m=r.split(this.image_token);if(0===m.length)throw Error("The image token should be present in the text.");let _=m[0];for(let e=0;e<u.length;++e)_+=u[e]+m[e+1];c.push(_)}return{...this.tokenizer(c),...s}}}},
10"./src/models/image_processors.js":(e,t,r)=>{r.r(t),r.d(t,{BeitFeatureExtractor:()=>s.BeitFeatureExtractor,BitImageProcessor:()=>o.BitImageProcessor,CLIPFeatureExtractor:()=>n.CLIPFeatureExtractor,CLIPImageProcessor:()=>n.CLIPImageProcessor,ChineseCLIPFeatureExtractor:()=>a.ChineseCLIPFeatureExtractor,ConvNextFeatureExtractor:()=>i.ConvNextFeatureExtractor,ConvNextImageProcessor:()=>i.ConvNextImageProcessor,DINOv3ViTImageProcessor:()=>d.DINOv3ViTImageProcessor,DPTFeatureExtractor:()=>m.DPTFeatureExtractor,DPTImageProcessor:()=>m.DPTImageProcessor,DeiTFeatureExtractor:()=>l.DeiTFeatureExtractor,DeiTImageProcessor:()=>l.DeiTImageProcessor,DetrFeatureExtractor:()=>c.DetrFeatureExtractor,DetrImageProcessor:()=>c.DetrImageProcessor,DonutFeatureExtractor:()=>u.DonutFeatureExtractor,DonutImageProcessor:()=>u.DonutImageProcessor,EfficientNetImageProcessor:()=>_.EfficientNetImageProcessor,GLPNFeatureExtractor:()=>p.GLPNFeatureExtractor,GroundingDinoImageProcessor:()=>h.GroundingDinoImageProcessor,Idefics3ImageProcessor:()=>f.Idefics3ImageProcessor,JinaCLIPImageProcessor:()=>M.JinaCLIPImageProcessor,LlavaOnevisionImageProcessor:()=>w.LlavaOnevisionImageProcessor,Mask2FormerImageProcessor:()=>x.Mask2FormerImageProcessor,MaskFormerFeatureExtractor:()=>b.MaskFormerFeatureExtractor,MaskFormerImageProcessor:()=>b.MaskFormerImageProcessor,MobileNetV1FeatureExtractor:()=>T.MobileNetV1FeatureExtractor,MobileNetV1ImageProcessor:()=>T.MobileNetV1ImageProcessor,MobileNetV2FeatureExtractor:()=>P.MobileNetV2FeatureExtractor,MobileNetV2ImageProcessor:()=>P.MobileNetV2ImageProcessor,MobileNetV3FeatureExtractor:()=>y.MobileNetV3FeatureExtractor,MobileNetV3ImageProcessor:()=>y.MobileNetV3ImageProcessor,MobileNetV4FeatureExtractor:()=>k.MobileNetV4FeatureExtractor,MobileNetV4ImageProcessor:()=>k.MobileNetV4ImageProcessor,MobileViTFeatureExtractor:()=>v.MobileViTFeatureExtractor,MobileViTImageProcessor:()=>v.MobileViTImageProcessor,NougatImageProcessor:()=>F.NougatImageProcessor,OwlViTFeatureExtractor:()=>S.OwlViTFeatureExtractor,OwlViTImageProcessor:()=>S.OwlViTImageProcessor,Owlv2ImageProcessor:()=>C.Owlv2ImageProcessor,Phi3VImageProcessor:()=>E.Phi3VImageProcessor,PvtImageProcessor:()=>A.PvtImageProcessor,Qwen2VLImageProcessor:()=>L.Qwen2VLImageProcessor,RTDetrImageProcessor:()=>I.RTDetrImageProcessor,SamImageProcessor:()=>j.SamImageProcessor,SegformerFeatureExtractor:()=>z.SegformerFeatureExtractor,SegformerImageProcessor:()=>z.SegformerImageProcessor,SiglipImageProcessor:()=>D.SiglipImageProcessor,SmolVLMImageProcessor:()=>V.SmolVLMImageProcessor,Swin2SRImageProcessor:()=>O.Swin2SRImageProcessor,VLMImageProcessor:()=>g.VLMImageProcessor,ViTFeatureExtractor:()=>N.ViTFeatureExtractor,ViTImageProcessor:()=>N.ViTImageProcessor,VitMatteImageProcessor:()=>B.VitMatteImageProcessor,VitPoseImageProcessor:()=>G.VitPoseImageProcessor,YolosFeatureExtractor:()=>R.YolosFeatureExtractor,YolosImageProcessor:()=>R.YolosImageProcessor});var s=r("./src/models/beit/image_processing_beit.js"),o=r("./src/models/bit/image_processing_bit.js"),a=r("./src/models/chinese_clip/image_processing_chinese_clip.js"),n=r("./src/models/clip/image_processing_clip.js"),i=r("./src/models/convnext/image_processing_convnext.js"),l=r("./src/models/deit/image_processing_deit.js"),c=r("./src/models/detr/image_processing_detr.js"),d=r("./src/models/dinov3_vit/image_processing_dinov3_vit.js"),u=r("./src/models/donut/image_processing_donut.js"),m=r("./src/models/dpt/image_processing_dpt.js"),_=r("./src/models/efficientnet/image_processing_efficientnet.js"),p=r("./src/models/glpn/image_processing_glpn.js"),h=r("./src/models/grounding_dino/image_processing_grounding_dino.js"),f=r("./src/models/idefics3/image_processing_idefics3.js"),g=r("./src/models/janus/image_processing_janus.js"),M=r("./src/models/jina_clip/image_processing_jina_clip.js"),w=r("./src/models/llava_onevision/image_processing_llava_onevision.js"),x=r("./src/models/mask2former/image_processing_mask2former.js"),b=r("./src/models/maskformer/image_processing_maskformer.js"),T=r("./src/models/mobilenet_v1/image_processing_mobilenet_v1.js"),P=r("./src/models/mobilenet_v2/image_processing_mobilenet_v2.js"),y=r("./src/models/mobilenet_v3/image_processing_mobilenet_v3.js"),k=r("./src/models/mobilenet_v4/image_processing_mobilenet_v4.js"),v=r("./src/models/mobilevit/image_processing_mobilevit.js"),F=r("./src/models/nougat/image_processing_nougat.js"),C=r("./src/models/owlv2/image_processing_owlv2.js"),S=r("./src/models/owlvit/image_processing_owlvit.js"),E=r("./src/models/phi3_v/image_processing_phi3_v.js"),A=r("./src/models/pvt/image_processing_pvt.js"),L=r("./src/models/qwen2_vl/image_processing_qwen2_vl.js"),I=r("./src/models/rt_detr/image_processing_rt_detr.js"),j=r("./src/models/sam/image_processing_sam.js"),z=r("./src/models/segformer/image_processing_segformer.js"),D=r("./src/models/siglip/image_processing_siglip.js"),V=r("./src/models/smolvlm/image_processing_smolvlm.js"),O=r("./src/models/swin2sr/image_processing_swin2sr.js"),N=r("./src/models/vit/image_processing_vit.js"),B=r("./src/models/vitmatte/image_processing_vitmatte.js"),G=r("./src/models/vitpose/image_processing_vitpose.js"),R=r("./src/models/yolos/image_processing_yolos.js")},
10"./src/models/janus/image_processing_janus.js":(e,t,r)=>{r.r(t),r.d(t,{VLMImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{constructor(e){super({do_pad:!0,pad_size:{width:e.image_size,height:e.image_size},...e}),this.constant_values=this.config.background_color.map(e=>e*this.rescale_factor)}pad_image(e,t,r,s){return super.pad_image(e,t,r,{constant_values:this.constant_values,center:!0,...s})}}},
10"./src/models/janus/processing_janus.js":(e,t,r)=>{r.r(t),r.d(t,{VLChatProcessor:()=>c});var s=r("./src/base/processing_utils.js"),o=r("./src/models/auto/image_processing_auto.js"),a=r("./src/tokenizers.js"),n=r("./src/utils/core.js"),i=r("./src/utils/tensor.js"),l=r("./src/utils/image.js");class c extends s.Processor{static image_processor_class=o.AutoImageProcessor;static tokenizer_class=a.AutoTokenizer;static uses_processor_config=!0;constructor(e,t,r){super(e,t,r),this.image_tag=this.config.image_tag,this.image_start_tag=this.config.image_start_tag,this.image_end_tag=this.config.image_end_tag,this.num_image_tokens=this.config.num_image_tokens}async _call(e,{images:t=null,chat_template:r="default"}={}){t?Array.isArray(t)||(t=[t]):t=await Promise.all(e.filter(e=>e.images).flatMap(e=>e.images).map(e=>l.RawImage.read(e)));let s=this.tokenizer,o=s.apply_chat_template(e,{tokenize:!1,add_generation_prompt:!0,chat_template:r}),a=e=>s.encode(e,{add_special_tokens:!1}),c=o.split(this.image_tag),d=c.length-1;if(t.length!==d)throw Error(`Number of images provided (${t.length}) does not match number of "${this.image_tag}" image tags (${d})`);let[u,m,_]=s.model.convert_tokens_to_ids([this.image_tag,this.image_start_tag,this.image_end_tag]),p=a(c[0]),h=Array(p.length).fill(!1);for(let e=1;e<c.length;++e){let t=Array(this.num_image_tokens).fill(u),r=a(c[e]);p=(0,n.mergeArrays)(p,[m],t,[_],r);let s=Array(this.num_image_tokens).fill(!0);h=(0,n.mergeArrays)(h,[!1],s,[!1],Array(r.length).fill(!1))}let f=[1,p.length],g={input_ids:new i.Tensor("int64",p,f),attention_mask:new i.Tensor("int64",Array(p.length).fill(1),f),images_seq_mask:new i.Tensor("bool",h,f),images_emb_mask:new i.Tensor("bool",Array(d*this.num_image_tokens).fill(!0),[1,d,this.num_image_tokens])};if(t&&t.length>0){let e=await this.image_processor(t);return e.pixel_values.unsqueeze_(0),{...g,...e}}return g}}},
10"./src/models/jina_clip/image_processing_jina_clip.js":(e,t,r)=>{r.r(t),r.d(t,{JinaCLIPImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{constructor(e){let{resize_mode:t,fill_color:r,interpolation:s,size:o,...a}=e;super({...a,size:"squash"===t?{width:o,height:o}:"shortest"===t?{shortest_edge:o}:{longest_edge:o},resample:"bicubic"===s?3:2,do_center_crop:!0,crop_size:o,do_normalize:!0})}}},
10"./src/models/jina_clip/processing_jina_clip.js":(e,t,r)=>{r.r(t),r.d(t,{JinaCLIPProcessor:()=>n});var s=r("./src/base/processing_utils.js"),o=r("./src/models/auto/image_processing_auto.js"),a=r("./src/tokenizers.js");class n extends s.Processor{static tokenizer_class=a.AutoTokenizer;static image_processor_class=o.AutoImageProcessor;async _call(e=null,t=null,r={}){if(!e&&!t)throw Error("Either text or images must be provided");let s=e?this.tokenizer(e,r):{},o=t?await this.image_processor(t,r):{};return{...s,...o}}}},
10"./src/models/llava/processing_llava.js":(e,t,r)=>{r.r(t),r.d(t,{LlavaProcessor:()=>n});var s=r("./src/base/processing_utils.js"),o=r("./src/models/auto/image_processing_auto.js"),a=r("./src/tokenizers.js");class n extends s.Processor{static tokenizer_class=a.AutoTokenizer;static image_processor_class=o.AutoImageProcessor;static uses_processor_config=!0;async _call(e,t=null,r={}){let s=await this.image_processor(e,r);if(t){let[e,r]=s.pixel_values.dims.slice(-2),{image_token:o,patch_size:a,num_additional_image_tokens:n}=this.config,i=Math.floor(e/a)*Math.floor(r/a)+n;Array.isArray(t=structuredClone(t))||(t=[t]);for(let e=0;e<t.length;++e)t[e]=t[e].replace(o,o.repeat(i))}let o=t?this.tokenizer(t,r):{};return{...s,...o}}}},
10"./src/models/llava_onevision/image_processing_llava_onevision.js":(e,t,r)=>{r.r(t),r.d(t,{LlavaOnevisionImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}},
10"./src/models/mask2former/image_processing_mask2former.js":(e,t,r)=>{r.r(t),r.d(t,{Mask2FormerImageProcessor:()=>o});var s=r("./src/models/maskformer/image_processing_maskformer.js");class o extends s.MaskFormerImageProcessor{}},
10"./src/models/maskformer/image_processing_maskformer.js":(e,t,r)=>{r.r(t),r.d(t,{MaskFormerFeatureExtractor:()=>a,MaskFormerImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{post_process_panoptic_segmentation(...e){return(0,s.post_process_panoptic_segmentation)(...e)}post_process_instance_segmentation(...e){return(0,s.post_process_instance_segmentation)(...e)}}class a extends o{}},
10"./src/models/mgp_str/processing_mgp_str.js":(e,t,r)=>{r.r(t),r.d(t,{MgpstrProcessor:()=>l});var s=r("./src/base/processing_utils.js"),o=r("./src/models/auto/image_processing_auto.js"),a=r("./src/tokenizers.js"),n=r("./src/utils/maths.js");let i={char:["char_decode",1],bpe:["bpe_decode",2],wp:["wp_decode",102]};class l extends s.Processor{static tokenizer_class=a.AutoTokenizer;static image_processor_class=o.AutoImageProcessor;get char_tokenizer(){return this.components.char_tokenizer}get bpe_tokenizer(){return this.components.bpe_tokenizer}get wp_tokenizer(){return this.components.wp_tokenizer}_decode_helper(e,t){if(!i.hasOwnProperty(t))throw Error(`Format ${t} is not supported.`);let[r,s]=i[t],o=this[r].bind(this),[a,l]=e.dims,c=[],d=[],u=e.tolist();for(let e=0;e<a;++e){let t=u[e],r=[],o=[];for(let e=1;e<l;++e){let[a,i]=(0,n.max)((0,n.softmax)(t[e]));if(o.push(a),i==s)break;r.push(i)}let a=o.length>0?o.reduce((e,t)=>e*t,1):0;d.push(r),c.push(a)}return[o(d),c]}char_decode(e){return this.char_tokenizer.batch_decode(e).map(e=>e.replaceAll(" ",""))}bpe_decode(e){return this.bpe_tokenizer.batch_decode(e)}wp_decode(e){return this.wp_tokenizer.batch_decode(e).map(e=>e.replaceAll(" ",""))}batch_decode([e,t,r]){let[s,o]=this._decode_helper(e,"char"),[a,i]=this._decode_helper(t,"bpe"),[l,c]=this._decode_helper(r,"wp"),d=[],u=[];for(let e=0;e<s.length;++e){let[t,r]=(0,n.max)([o[e],i[e],c[e]]);d.push([s[e],a[e],l[e]][r]),u.push(t)}return{generated_text:d,scores:u,char_preds:s,bpe_preds:a,wp_preds:l}}static async from_pretrained(...e){let t=await super.from_pretrained(...e),r=await a.AutoTokenizer.from_pretrained("Xenova/gpt2"),s=await a.AutoTokenizer.from_pretrained("Xenova/bert-base-uncased");return t.components={image_processor:t.image_processor,char_tokenizer:t.tokenizer,bpe_tokenizer:r,wp_tokenizer:s},t}async _call(e,t=null){let r=await this.image_processor(e);return t&&(r.labels=this.tokenizer(t).input_ids),r}}},
10"./src/models/mobilenet_v1/image_processing_mobilenet_v1.js":(e,t,r)=>{r.r(t),r.d(t,{MobileNetV1FeatureExtractor:()=>a,MobileNetV1ImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class a extends o{}},
10"./src/models/mobilenet_v2/image_processing_mobilenet_v2.js":(e,t,r)=>{r.r(t),r.d(t,{MobileNetV2FeatureExtractor:()=>a,MobileNetV2ImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class a extends o{}},
10"./src/models/mobilenet_v3/image_processing_mobilenet_v3.js":(e,t,r)=>{r.r(t),r.d(t,{MobileNetV3FeatureExtractor:()=>a,MobileNetV3ImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class a extends o{}},
10"./src/models/mobilenet_v4/image_processing_mobilenet_v4.js":(e,t,r)=>{r.r(t),r.d(t,{MobileNetV4FeatureExtractor:()=>a,MobileNetV4ImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class a extends o{}},
10"./src/models/mobilevit/image_processing_mobilevit.js":(e,t,r)=>{r.r(t),r.d(t,{MobileViTFeatureExtractor:()=>a,MobileViTImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class a extends o{}},
10"./src/models/moonshine/feature_extraction_moonshine.js":(e,t,r)=>{r.r(t),r.d(t,{MoonshineFeatureExtractor:()=>a});var s=r("./src/base/feature_extraction_utils.js"),o=r("./src/utils/tensor.js");class a extends s.FeatureExtractor{async _call(e){(0,s.validate_audio_inputs)(e,"MoonshineFeatureExtractor"),e instanceof Float64Array&&(e=new Float32Array(e));let t=[1,e.length];return{input_values:new o.Tensor("float32",e,t)}}}},
10"./src/models/moonshine/processing_moonshine.js":(e,t,r)=>{r.r(t),r.d(t,{MoonshineProcessor:()=>n});var s=r("./src/models/auto/feature_extraction_auto.js"),o=r("./src/tokenizers.js"),a=r("./src/base/processing_utils.js");class n extends a.Processor{static tokenizer_class=o.AutoTokenizer;static feature_extractor_class=s.AutoFeatureExtractor;async _call(e){return await this.feature_extractor(e)}}},
10"./src/models/nougat/image_processing_nougat.js":(e,t,r)=>{r.r(t),r.d(t,{NougatImageProcessor:()=>o});var s=r("./src/models/donut/image_processing_donut.js");class o extends s.DonutImageProcessor{}},
10"./src/models/owlv2/image_processing_owlv2.js":(e,t,r)=>{r.r(t),r.d(t,{Owlv2ImageProcessor:()=>o});var s=r("./src/models/owlvit/image_processing_owlvit.js");class o extends s.OwlViTImageProcessor{}},
10"./src/models/owlvit/image_processing_owlvit.js":(e,t,r)=>{r.r(t),r.d(t,{OwlViTFeatureExtractor:()=>a,OwlViTImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{post_process_object_detection(...e){return(0,s.post_process_object_detection)(...e)}}class a extends o{}},
10"./src/models/owlvit/processing_owlvit.js":(e,t,r)=>{r.r(t),r.d(t,{OwlViTProcessor:()=>n});var s=r("./src/base/processing_utils.js"),o=r("./src/models/auto/image_processing_auto.js"),a=r("./src/tokenizers.js");class n extends s.Processor{static tokenizer_class=a.AutoTokenizer;static image_processor_class=o.AutoImageProcessor}},
10"./src/models/paligemma/processing_paligemma.js":(e,t,r)=>{r.r(t),r.d(t,{PaliGemmaProcessor:()=>i});var s=r("./src/base/processing_utils.js"),o=r("./src/models/auto/image_processing_auto.js"),a=r("./src/tokenizers.js");let n="<image>";class i extends s.Processor{static tokenizer_class=a.AutoTokenizer;static image_processor_class=o.AutoImageProcessor;static uses_processor_config=!1;async _call(e,t=null,r={}){let s;t||(console.warn("You are using PaliGemma without a text prefix. It will perform as a picture-captioning model."),t=""),Array.isArray(e)||(e=[e]),Array.isArray(t)||(t=[t]);let o=this.tokenizer.bos_token,a=this.image_processor.config.image_seq_length;t.some(e=>e.includes(n))?s=t.map(e=>{let t=e.replaceAll(n,n.repeat(a)),r=t.lastIndexOf(n),s=-1===r?0:r+n.length;return t.slice(0,s)+o+t.slice(s)+"\n"}):(console.warn("You are passing both `text` and `images` to `PaliGemmaProcessor`. The processor expects special image tokens in the text, as many tokens as there are images per each text. It is recommended to add `<image>` tokens in the very beginning of your text. For this call, we will infer how many images each text has and add special tokens."),s=t.map(t=>{var r;return r=e.length,`${n.repeat(a*r)}${o}${t}
11`}));let i=this.tokenizer(s,r);return{...await this.image_processor(e,r),...i}}}},
11"./src/models/parakeet/feature_extraction_parakeet.js":(e,t,r)=>{r.r(t),r.d(t,{ParakeetFeatureExtractor:()=>n});var s=r("./src/base/feature_extraction_utils.js"),o=r("./src/utils/tensor.js"),a=r("./src/utils/audio.js");class n extends s.FeatureExtractor{constructor(e){super(e),this.config.mel_filters??=(0,a.mel_filter_bank)(Math.floor(1+this.config.n_fft/2),this.config.feature_size,0,this.config.sampling_rate/2,this.config.sampling_rate,"slaney","slaney");let t=(0,a.window_function)(this.config.win_length,"hann",{periodic:!1});this.window=new Float64Array(this.config.n_fft);let r=Math.floor((this.config.n_fft-this.config.win_length)/2);this.window.set(t,r)}async _extract_fbank_features(e){let t=this.config.preemphasis;e=new Float64Array(e);for(let r=e.length-1;r>=1;--r)e[r]-=t*e[r-1];return await (0,a.spectrogram)(e,this.window,this.window.length,this.config.hop_length,{fft_length:this.config.n_fft,power:2,mel_filters:this.config.mel_filters,log_mel:"log",mel_floor:-1/0,pad_mode:"constant",center:!0,transpose:!0,mel_offset:5960464477539063e-23})}async _call(e){(0,s.validate_audio_inputs)(e,"ParakeetFeatureExtractor");let t=await this._extract_fbank_features(e),r=Math.floor((e.length+2*Math.floor(this.config.n_fft/2)-this.config.n_fft)/this.config.hop_length),a=t.data;a.fill(0,r*t.dims[1]);let[n,i]=t.dims,l=new Float64Array(i),c=new Float64Array(i);for(let e=0;e<r;++e){let t=e*i;for(let e=0;e<i;++e){let r=a[t+e];l[e]+=r,c[e]+=r*r}}let d=r>1?r-1:1;for(let e=0;e<i;++e){let t=l[e]/r,s=1/(Math.sqrt((c[e]-r*t*t)/d)+1e-5);for(let o=0;o<r;++o){let r=o*i+e;a[r]=(a[r]-t)*s}}let u=new BigInt64Array(n);return u.fill(1n,0,r),{input_features:t.unsqueeze_(0),attention_mask:new o.Tensor("int64",u,[1,n])}}}},
11"./src/models/phi3_v/image_processing_phi3_v.js":(e,t,r)=>{r.r(t),r.d(t,{Phi3VImageProcessor:()=>c});var s=r("./src/base/image_processors_utils.js"),o=r("./src/utils/tensor.js");let a=[2,3],{ceil:n,floor:i,sqrt:l}=Math;class c extends s.ImageProcessor{constructor(e){super({...e,do_normalize:!0,do_pad:!0,pad_size:"custom",do_convert_rgb:!0,do_resize:!0}),this._num_crops=e.num_crops}calc_num_image_tokens_from_image_size(e,t){let{num_img_tokens:r}=this.config;return i((i(t/336)*i(e/336)+1)*r+1+(i(t/336)+1)*l(r))}get_resize_output_image_size(e,t){let r=this._num_crops,[s,o]=e.size,a=s/o,n=1;for(;n*Math.ceil(n/a)<=r;)n+=1;let i=Math.floor(336*(n-=1)),l=Math.floor(i/a);return[i,l]}pad_image(e,t,r,s={}){let[o,a]=t,i=336*n(o/336),l=336*n(a/336),c=[1,1,1].map((e,t)=>(e-this.image_mean[t])/this.image_std[t]);return super.pad_image(e,t,{width:l,height:i},{center:!0,constant_values:c,...s})}async _call(e,{num_crops:t=null}={}){if(this._num_crops=t??=this.config.num_crops,t<4||l(t)%1!=0)throw Error("num_crops must be a square number >= 4");Array.isArray(e)||(e=[e]);let r=e.length,s=await Promise.all(e.map(e=>this.preprocess(e))),c=s.map(e=>e.original_size),d=s.map(e=>e.reshaped_input_size),u=[];for(let{pixel_values:e}of s){e.unsqueeze_(0);let[r,s]=e.dims.slice(-2),n=await (0,o.interpolate_4d)(e,{size:[336,336],mode:"bicubic"});if(t>0){let c=[],d=l(t),m=i(s/d),_=i(r/d);for(let t=0;t<d;++t)for(let n=0;n<d;++n){let i,l,u,p;t===d-1?(l=r-_,p=r):(l=t*_,p=(t+1)*_),n===d-1?(i=s-m,u=s):(i=n*m,u=(n+1)*m);let h=[l,i],f=[p,u],g=await (0,o.slice)(e,h,f,a);c.push(g)}let p=await (0,o.interpolate_4d)((0,o.cat)(c,0),{size:[336,336],mode:"bicubic"});u.push((0,o.cat)([n,p],0))}else u.push(n)}let m=(0,o.stack)(u,0),_=d.map(e=>e.map(e=>336*n(e/336)));return{pixel_values:m,original_sizes:c,reshaped_input_sizes:d,image_sizes:new o.Tensor("int64",_.flat(),[r,2]),num_img_tokens:_.map(([e,t])=>this.calc_num_image_tokens_from_image_size(t,e))}}}},
11"./src/models/phi3_v/processing_phi3_v.js":(e,t,r)=>{r.r(t),r.d(t,{Phi3VProcessor:()=>l});var s=r("./src/base/processing_utils.js"),o=r("./src/models/auto/image_processing_auto.js"),a=r("./src/tokenizers.js");r("./src/utils/image.js");let n="<|image|>",i=/<\|image_\d+\|>/g;class l extends s.Processor{static image_processor_class=o.AutoImageProcessor;static tokenizer_class=a.AutoTokenizer;async _call(e,t=null,{padding:r=!0,truncation:s=!0,num_crops:o=null}={}){let a,l;if(Array.isArray(e)||(e=[e]),t){let{num_img_tokens:c}=l=await this.image_processor(t,{num_crops:o}),d=e.map((e,t)=>e.split(i).join(n.repeat(c[t])));a=this.tokenizer(d,{padding:r,truncation:s});let u=this.tokenizer.model.convert_tokens_to_ids([n])[0];a.input_ids.map_(e=>e==u?-e:e)}else a=this.tokenizer(e);return{...a,...l}}}},
11"./src/models/processors.js":(e,t,r)=>{r.r(t),r.d(t,{Florence2Processor:()=>s.Florence2Processor,Gemma3nProcessor:()=>o.Gemma3nProcessor,GroundingDinoProcessor:()=>a.GroundingDinoProcessor,Idefics3Processor:()=>n.Idefics3Processor,JinaCLIPProcessor:()=>l.JinaCLIPProcessor,LlavaProcessor:()=>c.LlavaProcessor,MgpstrProcessor:()=>d.MgpstrProcessor,MoonshineProcessor:()=>u.MoonshineProcessor,OwlViTProcessor:()=>m.OwlViTProcessor,PaliGemmaProcessor:()=>p.PaliGemmaProcessor,Phi3VProcessor:()=>_.Phi3VProcessor,PyAnnoteProcessor:()=>h.PyAnnoteProcessor,Qwen2VLProcessor:()=>f.Qwen2VLProcessor,SamProcessor:()=>g.SamProcessor,SmolVLMProcessor:()=>M.SmolVLMProcessor,SpeechT5Processor:()=>w.SpeechT5Processor,UltravoxProcessor:()=>x.UltravoxProcessor,VLChatProcessor:()=>i.VLChatProcessor,VoxtralProcessor:()=>b.VoxtralProcessor,Wav2Vec2Processor:()=>T.Wav2Vec2Processor,Wav2Vec2ProcessorWithLM:()=>P.Wav2Vec2ProcessorWithLM,WhisperProcessor:()=>y.WhisperProcessor});var s=r("./src/models/florence2/processing_florence2.js"),o=r("./src/models/gemma3n/processing_gemma3n.js"),a=r("./src/models/grounding_dino/processing_grounding_dino.js"),n=r("./src/models/idefics3/processing_idefics3.js"),i=r("./src/models/janus/processing_janus.js"),l=r("./src/models/jina_clip/processing_jina_clip.js"),c=r("./src/models/llava/processing_llava.js"),d=r("./src/models/mgp_str/processing_mgp_str.js"),u=r("./src/models/moonshine/processing_moonshine.js"),m=r("./src/models/owlvit/processing_owlvit.js"),_=r("./src/models/phi3_v/processing_phi3_v.js"),p=r("./src/models/paligemma/processing_paligemma.js"),h=r("./src/models/pyannote/processing_pyannote.js"),f=r("./src/models/qwen2_vl/processing_qwen2_vl.js"),g=r("./src/models/sam/processing_sam.js"),M=r("./src/models/smolvlm/processing_smolvlm.js"),w=r("./src/models/speecht5/processing_speecht5.js"),x=r("./src/models/ultravox/processing_ultravox.js"),b=r("./src/models/voxtral/processing_voxtral.js"),T=r("./src/models/wav2vec2/processing_wav2vec2.js"),P=r("./src/models/wav2vec2_with_lm/processing_wav2vec2_with_lm.js"),y=r("./src/models/whisper/processing_whisper.js")},
11"./src/models/pvt/image_processing_pvt.js":(e,t,r)=>{r.r(t),r.d(t,{PvtImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}},
11"./src/models/pyannote/feature_extraction_pyannote.js":(e,t,r)=>{r.r(t),r.d(t,{PyAnnoteFeatureExtractor:()=>n});var s=r("./src/base/feature_extraction_utils.js"),o=r("./src/utils/tensor.js"),a=r("./src/utils/maths.js");class n extends s.FeatureExtractor{async _call(e){(0,s.validate_audio_inputs)(e,"PyAnnoteFeatureExtractor"),e instanceof Float64Array&&(e=new Float32Array(e));let t=[1,1,e.length];return{input_values:new o.Tensor("float32",e,t)}}samples_to_frames(e){return(e-this.config.offset)/this.config.step}post_process_speaker_diarization(e,t){let r=t/this.samples_to_frames(t)/this.config.sampling_rate,s=[];for(let t of e.tolist()){let e=[],o=-1;for(let r=0;r<t.length;++r){let s=(0,a.softmax)(t[r]),[n,i]=(0,a.max)(s),[l,c]=[r,r+1];i!==o?(o=i,e.push({id:i,start:l,end:c,score:n})):(e.at(-1).end=c,e.at(-1).score+=n)}s.push(e.map(({id:e,start:t,end:s,score:o})=>({id:e,start:t*r,end:s*r,confidence:o/(s-t)})))}return s}}},
11"./src/models/pyannote/processing_pyannote.js":(e,t,r)=>{r.r(t),r.d(t,{PyAnnoteProcessor:()=>a});var s=r("./src/base/processing_utils.js"),o=r("./src/models/pyannote/feature_extraction_pyannote.js");class a extends s.Processor{static feature_extractor_class=o.PyAnnoteFeatureExtractor;async _call(e){return await this.feature_extractor(e)}post_process_speaker_diarization(...e){return this.feature_extractor.post_process_speaker_diarization(...e)}get sampling_rate(){return this.feature_extractor.config.sampling_rate}}},
11"./src/models/qwen2_vl/image_processing_qwen2_vl.js":(e,t,r)=>{r.r(t),r.d(t,{Qwen2VLImageProcessor:()=>a});var s=r("./src/base/image_processors_utils.js"),o=r("./src/utils/tensor.js");class a extends s.ImageProcessor{async _call(e,...t){let{pixel_values:r,original_sizes:s,reshaped_input_sizes:a}=await super._call(e,...t),n=r,{temporal_patch_size:i,merge_size:l,patch_size:c}=this.config;1===n.dims[0]&&(n=(0,o.cat)(Array.from({length:i},()=>n),0));let d=n.dims[0]/i,u=n.dims[1],m=Math.floor(n.dims[2]/c),_=Math.floor(n.dims[3]/c);return{pixel_values:n.view(d,i,u,Math.floor(m/l),l,c,Math.floor(_/l),l,c).permute(0,3,6,4,7,2,1,5,8).view(d*m*_,u*i*c*c),image_grid_thw:new o.Tensor("int64",[d,m,_],[1,3]),original_sizes:s,reshaped_input_sizes:a}}}},
11"./src/models/qwen2_vl/processing_qwen2_vl.js":(e,t,r)=>{r.r(t),r.d(t,{Qwen2VLProcessor:()=>n});var s=r("./src/base/processing_utils.js"),o=r("./src/models/auto/image_processing_auto.js"),a=r("./src/tokenizers.js");r("./src/utils/image.js");class n extends s.Processor{static image_processor_class=o.AutoImageProcessor;static tokenizer_class=a.AutoTokenizer;async _call(e,t=null){let r,s;if(Array.isArray(e)||(e=[e]),t&&(s=(r=await this.image_processor(t)).image_grid_thw),s){let t=this.image_processor.config.merge_size**2,r=0,o=s.tolist();e=e.map(e=>{for(;e.includes("<|image_pad|>");){let s=Number(o[r++].reduce((e,t)=>e*t,1n));e=e.replace("<|image_pad|>","<|placeholder|>".repeat(Math.floor(s/t)))}return e.replaceAll("<|placeholder|>","<|image_pad|>")})}return{...this.tokenizer(e),...r}}}},
11"./src/models/rt_detr/image_processing_rt_detr.js":(e,t,r)=>{r.r(t),r.d(t,{RTDetrImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{post_process_object_detection(...e){return(0,s.post_process_object_detection)(...e)}}},
11"./src/models/sam/image_processing_sam.js":(e,t,r)=>{r.r(t),r.d(t,{SamImageProcessor:()=>n});var s=r("./src/base/image_processors_utils.js"),o=r("./src/utils/core.js"),a=r("./src/utils/tensor.js");class n extends s.ImageProcessor{reshape_input_points(e,t,r,s=!1){e=structuredClone(e);let n=(0,o.calculateDimensions)(e);if(3===n.length)s||(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 s=0;s<e.length;++s){let o=t[s],a=r[s],n=[a[0]/o[0],a[1]/o[1]];for(let t=0;t<e[s].length;++t)for(let r=0;r<e[s][t].length;++r)for(let o=0;o<e[s][t][r].length;++o)e[s][t][r][o]*=n[o%2]}return new a.Tensor("float32",Float32Array.from(e.flat(1/0)),n)}add_input_labels(e,t){let r=(0,o.calculateDimensions)(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 a.Tensor("int64",e.flat(1/0).map(BigInt),r)}async _call(e,{input_points:t=null,input_labels:r=null,input_boxes:s=null}={}){let o=await super._call(e);if(t&&(o.input_points=this.reshape_input_points(t,o.original_sizes,o.reshaped_input_sizes)),r){if(!o.input_points)throw Error("`input_points` must be provided if `input_labels` are provided.");o.input_labels=this.add_input_labels(r,o.input_points)}return s&&(o.input_boxes=this.reshape_input_points(s,o.original_sizes,o.reshaped_input_sizes,!0)),o}async post_process_masks(e,t,r,{mask_threshold:s=0,binarize:o=!0,pad_size:n=null}={}){let i=[],l=[(n=n??this.pad_size).height,n.width];for(let n=0;n<t.length;++n){let c=t[n],d=r[n],u=await (0,a.interpolate_4d)(e[n],{mode:"bilinear",size:l});if(u=u.slice(null,null,[0,d[0]],[0,d[1]]),u=await (0,a.interpolate_4d)(u,{mode:"bilinear",size:c}),o){let e=u.data,t=new Uint8Array(e.length);for(let r=0;r<e.length;++r)e[r]>s&&(t[r]=1);u=new a.Tensor("bool",t,u.dims)}i.push(u)}return i}generate_crop_boxes(e,t,{crop_n_layers:r=0,overlap_ratio:s=512/1500,points_per_crop:o=32,crop_n_points_downscale_factor:a=1}={}){}}},
11"./src/models/sam/processing_sam.js":(e,t,r)=>{r.r(t),r.d(t,{SamProcessor:()=>a});var s=r("./src/base/processing_utils.js"),o=r("./src/models/auto/image_processing_auto.js");class a extends s.Processor{static image_processor_class=o.AutoImageProcessor;async _call(...e){return await this.image_processor(...e)}post_process_masks(...e){return this.image_processor.post_process_masks(...e)}reshape_input_points(...e){return this.image_processor.reshape_input_points(...e)}}},
11"./src/models/seamless_m4t/feature_extraction_seamless_m4t.js":(e,t,r)=>{r.r(t),r.d(t,{SeamlessM4TFeatureExtractor:()=>n});var s=r("./src/base/feature_extraction_utils.js"),o=r("./src/utils/tensor.js"),a=r("./src/utils/audio.js");class n extends s.FeatureExtractor{constructor(e){super(e);let t=this.config.sampling_rate,r=(0,a.mel_filter_bank)(257,this.config.num_mel_bins,20,Math.floor(t/2),t,null,"kaldi",!0);this.mel_filters=r,this.window=(0,a.window_function)(400,"povey",{periodic:!1})}async _extract_fbank_features(e,t){return e=e.map(e=>32768*e),(0,a.spectrogram)(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:a=!0,return_attention_mask:n=!0}={}){let i;(0,s.validate_audio_inputs)(e,"SeamlessM4TFeatureExtractor");let l=await this._extract_fbank_features(e,this.config.max_length);if(a){let[e,t]=l.dims,r=l.data;for(let s=0;s<t;++s){let o=0;for(let a=0;a<e;++a)o+=r[a*t+s];let a=o/e,n=0;for(let o=0;o<e;++o)n+=(r[o*t+s]-a)**2;let i=Math.sqrt((n/=e-1)+1e-7);for(let o=0;o<e;++o){let e=o*t+s;r[e]=(r[e]-a)/i}}}if(t){let[e,t]=l.dims,s=l.data,a=e%r;if(a>0){let r=new Float32Array(t*(e+a));r.set(s),r.fill(this.config.padding_value,s.length);let c=e+a;l=new o.Tensor(l.type,r,[c,t]),n&&(i=new o.Tensor("int64",new BigInt64Array(c),[1,c])).data.fill(1n,0,e)}}let[c,d]=l.dims,u=this.config.stride;if(0!=c%u)throw Error(`The number of frames (${c}) must be a multiple of the stride (${u}).`);let m=l.view(1,Math.floor(c/u),d*u),_={input_features:m};if(n){let e=m.dims[1],t=new BigInt64Array(e);if(i){let e=i.data;for(let r=1,s=0;r<c;r+=u,++s)t[s]=e[r]}else t.fill(1n);_.attention_mask=new o.Tensor("int64",t,[1,e])}return _}}},
11"./src/models/segformer/image_processing_segformer.js":(e,t,r)=>{r.r(t),r.d(t,{SegformerFeatureExtractor:()=>a,SegformerImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{post_process_semantic_segmentation(...e){return(0,s.post_process_semantic_segmentation)(...e)}}class a extends o{}},
11"./src/models/siglip/image_processing_siglip.js":(e,t,r)=>{r.r(t),r.d(t,{SiglipImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}},
11"./src/models/smolvlm/image_processing_smolvlm.js":(e,t,r)=>{r.r(t),r.d(t,{SmolVLMImageProcessor:()=>s.Idefics3ImageProcessor});var s=r("./src/models/idefics3/image_processing_idefics3.js")},
11"./src/models/smolvlm/processing_smolvlm.js":(e,t,r)=>{r.r(t),r.d(t,{SmolVLMProcessor:()=>s.Idefics3Processor});var s=r("./src/models/idefics3/processing_idefics3.js")},
11"./src/models/snac/feature_extraction_snac.js":(e,t,r)=>{r.r(t),r.d(t,{SnacFeatureExtractor:()=>o});var s=r("./src/models/dac/feature_extraction_dac.js");class o extends s.DacFeatureExtractor{}},
11"./src/models/speecht5/feature_extraction_speecht5.js":(e,t,r)=>{r.r(t),r.d(t,{SpeechT5FeatureExtractor:()=>o});var s=r("./src/base/feature_extraction_utils.js");class o extends s.FeatureExtractor{}},
11"./src/models/speecht5/processing_speecht5.js":(e,t,r)=>{r.r(t),r.d(t,{SpeechT5Processor:()=>n});var s=r("./src/base/processing_utils.js"),o=r("./src/tokenizers.js"),a=r("./src/models/auto/feature_extraction_auto.js");class n extends s.Processor{static tokenizer_class=o.AutoTokenizer;static feature_extractor_class=a.AutoFeatureExtractor;async _call(e){return await this.feature_extractor(e)}}},
11"./src/models/swin2sr/image_processing_swin2sr.js":(e,t,r)=>{r.r(t),r.d(t,{Swin2SRImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{pad_image(e,t,r,s={}){let[o,a,n]=t;return super.pad_image(e,t,{width:a+(r-a%r)%r,height:o+(r-o%r)%r},{mode:"symmetric",center:!1,constant_values:-1,...s})}}},
11"./src/models/ultravox/processing_ultravox.js":(e,t,r)=>{r.r(t),r.d(t,{UltravoxProcessor:()=>n});var s=r("./src/models/auto/feature_extraction_auto.js"),o=r("./src/tokenizers.js"),a=r("./src/base/processing_utils.js");class n extends a.Processor{static tokenizer_class=o.AutoTokenizer;static feature_extractor_class=s.AutoFeatureExtractor;static uses_processor_config=!0;async _call(e,t=null,r={}){if(Array.isArray(e))throw Error("Batched inputs are not supported yet.");let s={};if(t){let o=t.length,{input_features:a}=await this.feature_extractor(t,{...r,max_length:o}),n=1+Math.ceil(Math.round(o/this.config.encoder_ds_factor+1e-4)/this.config.stack_factor);s.audio_token_len=[n],s.audio_values=a;let i=this.config.audio_placeholder;if(!e.includes(i))throw Error(`The input text does not contain the image token ${i}.`);e=e.replaceAll(i,i.repeat(n))}return{...this.tokenizer(e,{add_special_tokens:!1,...r}),...s}}}},
11"./src/models/vit/image_processing_vit.js":(e,t,r)=>{r.r(t),r.d(t,{ViTFeatureExtractor:()=>a,ViTImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class a extends o{}},
11"./src/models/vitmatte/image_processing_vitmatte.js":(e,t,r)=>{r.r(t),r.d(t,{VitMatteImageProcessor:()=>a});var s=r("./src/base/image_processors_utils.js"),o=r("./src/utils/tensor.js");class a extends s.ImageProcessor{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))),s=await Promise.all(t.map(e=>this.preprocess(e,{do_normalize:!1,do_convert_rgb:!1,do_convert_grayscale:!0})));return{pixel_values:(0,o.stack)(r.map((e,t)=>(0,o.cat)([e.pixel_values,s[t].pixel_values],0)),0),original_sizes:r.map(e=>e.original_size),reshaped_input_sizes:r.map(e=>e.reshaped_input_size)}}}},
11"./src/models/vitpose/image_processing_vitpose.js":(e,t,r)=>{r.r(t),r.d(t,{VitPoseImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{post_process_pose_estimation(e,t,{threshold:r=null}={}){let s=e.tolist(),[o,a,n,i]=e.dims,l=[];for(let e=0;e<o;++e){let o=s[e],a=t[e],c=[];for(let e=0;e<a.length;++e){let t=a[e],s=[],l=[],d=[],u=t.at(-2)/i,m=t.at(-1)/n;for(let e=0;e<o.length;++e){let[t,a]=[0,0],n=0,i=-1/0,c=o[e];for(let e=0;e<c.length;++e){let r=c[e];for(let s=0;s<r.length;++s){let o=r[s];n+=o,i=Math.max(i,o),t+=(s+.5)*o,a+=e*o}}if(null!=r&&i<r)continue;let _=[u*t/n,m*a/n];s.push(_),d.push(e),l.push(i)}c.push({bbox:t,scores:l,labels:d,keypoints:s})}l.push(c)}return l}}},
11"./src/models/voxtral/processing_voxtral.js":(e,t,r)=>{r.r(t),r.d(t,{VoxtralProcessor:()=>l});var s=r("./src/models/auto/feature_extraction_auto.js"),o=r("./src/tokenizers.js"),a=r("./src/base/processing_utils.js"),n=r("./src/utils/tensor.js");let i="[AUDIO]";class l extends a.Processor{static tokenizer_class=o.AutoTokenizer;static feature_extractor_class=s.AutoFeatureExtractor;static uses_processor_config=!1;async _call(e,t=null,r={}){if(Array.isArray(e))throw Error("Batched inputs are not supported yet.");let s={};if(t){if(!e.includes(i))throw Error(`The input text does not contain the audio token ${i}.`);Array.isArray(t)||(t=[t]);let o=e.split(i),a=o.length-1;if(a!==t.length)throw Error(`The number of audio inputs (${t.length}) does not match the number of audio tokens in the text (${a}).`);let l=this.feature_extractor.config.n_samples,c=t.map(e=>(function(e,t){let r=[];for(let s=0;s<e.length;s+=t)r.push(e.subarray(s,Math.min(s+t,e.length)));return r})(e,l)),d=c.map(e=>e.length),u=c.flat(),m=(await Promise.all(u.map(e=>this.feature_extractor(e,r)))).map(e=>e.input_features);s.audio_values=m.length>1?(0,n.cat)(m,0):m[0];let _=o[0];for(let e=0;e<d.length;++e){_+="[BEGIN_AUDIO]";for(let t=0;t<d[e];++t)_+=i.repeat(375);_+=o[e+1]}e=_}return{...this.tokenizer(e,{add_special_tokens:!1,...r}),...s}}}},
11"./src/models/wav2vec2/feature_extraction_wav2vec2.js":(e,t,r)=>{r.r(t),r.d(t,{Wav2Vec2FeatureExtractor:()=>a});var s=r("./src/base/feature_extraction_utils.js"),o=r("./src/utils/tensor.js");class a extends s.FeatureExtractor{_zero_mean_unit_var_norm(e){let t=e.reduce((e,t)=>e+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){(0,s.validate_audio_inputs)(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 o.Tensor("float32",t,r),attention_mask:new o.Tensor("int64",new BigInt64Array(t.length).fill(1n),r)}}}},
11"./src/models/wav2vec2/processing_wav2vec2.js":(e,t,r)=>{r.r(t),r.d(t,{Wav2Vec2Processor:()=>n});var s=r("./src/tokenizers.js"),o=r("./src/models/auto/feature_extraction_auto.js"),a=r("./src/base/processing_utils.js");class n extends a.Processor{static tokenizer_class=s.AutoTokenizer;static feature_extractor_class=o.AutoFeatureExtractor;async _call(e){return await this.feature_extractor(e)}}},
11"./src/models/wav2vec2_with_lm/processing_wav2vec2_with_lm.js":(e,t,r)=>{r.r(t),r.d(t,{Wav2Vec2ProcessorWithLM:()=>n});var s=r("./src/tokenizers.js"),o=r("./src/models/auto/feature_extraction_auto.js"),a=r("./src/base/processing_utils.js");class n extends a.Processor{static tokenizer_class=s.AutoTokenizer;static feature_extractor_class=o.AutoFeatureExtractor;async _call(e){return await this.feature_extractor(e)}}},
11"./src/models/wespeaker/feature_extraction_wespeaker.js":(e,t,r)=>{r.r(t),r.d(t,{WeSpeakerFeatureExtractor:()=>a});var s=r("./src/base/feature_extraction_utils.js");r("./src/utils/tensor.js");var o=r("./src/utils/audio.js");class a extends s.FeatureExtractor{constructor(e){super(e);let t=this.config.sampling_rate,r=(0,o.mel_filter_bank)(257,this.config.num_mel_bins,20,Math.floor(t/2),t,null,"kaldi",!0);this.mel_filters=r,this.window=(0,o.window_function)(400,"hamming",{periodic:!1}),this.min_num_frames=this.config.min_num_frames}async _extract_fbank_features(e){return e=e.map(e=>32768*e),(0,o.spectrogram)(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,transpose:!0,min_num_frames:this.min_num_frames})}async _call(e){(0,s.validate_audio_inputs)(e,"WeSpeakerFeatureExtractor");let t=(await this._extract_fbank_features(e)).unsqueeze_(0);if(null===this.config.fbank_centering_span){let e=t.mean(1).data,r=t.data,[s,o,a]=t.dims;for(let t=0;t<s;++t){let s=t*o*a,n=t*a;for(let t=0;t<o;++t){let o=s+t*a;for(let t=0;t<a;++t)r[o+t]-=e[n+t]}}}return{input_features:t}}}},
11"./src/models/whisper/common_whisper.js":(e,t,r)=>{r.r(t),r.d(t,{WHISPER_LANGUAGE_MAPPING:()=>o,WHISPER_TO_LANGUAGE_CODE_MAPPING:()=>a,whisper_language_to_code:()=>n});let s=[["en","english"],["zh","chinese"],["de","german"],["es","spanish"],["ru","russian"],["ko","korean"],["fr","french"],["ja","japanese"],["pt","portuguese"],["tr","turkish"],["pl","polish"],["ca","catalan"],["nl","dutch"],["ar","arabic"],["sv","swedish"],["it","italian"],["id","indonesian"],["hi","hindi"],["fi","finnish"],["vi","vietnamese"],["he","hebrew"],["uk","ukrainian"],["el","greek"],["ms","malay"],["cs","czech"],["ro","romanian"],["da","danish"],["hu","hungarian"],["ta","tamil"],["no","norwegian"],["th","thai"],["ur","urdu"],["hr","croatian"],["bg","bulgarian"],["lt","lithuanian"],["la","latin"],["mi","maori"],["ml","malayalam"],["cy","welsh"],["sk","slovak"],["te","telugu"],["fa","persian"],["lv","latvian"],["bn","bengali"],["sr","serbian"],["az","azerbaijani"],["sl","slovenian"],["kn","kannada"],["et","estonian"],["mk","macedonian"],["br","breton"],["eu","basque"],["is","icelandic"],["hy","armenian"],["ne","nepali"],["mn","mongolian"],["bs","bosnian"],["kk","kazakh"],["sq","albanian"],["sw","swahili"],["gl","galician"],["mr","marathi"],["pa","punjabi"],["si","sinhala"],["km","khmer"],["sn","shona"],["yo","yoruba"],["so","somali"],["af","afrikaans"],["oc","occitan"],["ka","georgian"],["be","belarusian"],["tg","tajik"],["sd","sindhi"],["gu","gujarati"],["am","amharic"],["yi","yiddish"],["lo","lao"],["uz","uzbek"],["fo","faroese"],["ht","haitian creole"],["ps","pashto"],["tk","turkmen"],["nn","nynorsk"],["mt","maltese"],["sa","sanskrit"],["lb","luxembourgish"],["my","myanmar"],["bo","tibetan"],["tl","tagalog"],["mg","malagasy"],["as","assamese"],["tt","tatar"],["haw","hawaiian"],["ln","lingala"],["ha","hausa"],["ba","bashkir"],["jw","javanese"],["su","sundanese"]],o=new Map(s),a=new Map([...s.map(([e,t])=>[t,e]),["burmese","my"],["valencian","ca"],["flemish","nl"],["haitian","ht"],["letzeburgesch","lb"],["pushto","ps"],["panjabi","pa"],["moldavian","ro"],["moldovan","ro"],["sinhalese","si"],["castilian","es"]]);function n(e){e=e.toLowerCase();let t=a.get(e);if(void 0===t){let r=e.match(/^<\|([a-z]{2})\|>$/);if(r&&(e=r[1]),o.has(e))t=e;else{let t=2===e.length?o.keys():o.values();throw Error(`Language "${e}" is not supported. Must be one of: ${JSON.stringify(Array.from(t))}`)}}return t}},
11"./src/models/whisper/feature_extraction_whisper.js":(e,t,r)=>{r.r(t),r.d(t,{WhisperFeatureExtractor:()=>n});var s=r("./src/base/feature_extraction_utils.js");r("./src/utils/tensor.js");var o=r("./src/utils/audio.js"),a=r("./src/utils/maths.js");class n extends s.FeatureExtractor{constructor(e){super(e),this.config.mel_filters??=(0,o.mel_filter_bank)(Math.floor(1+this.config.n_fft/2),this.config.feature_size,0,8e3,this.config.sampling_rate,"slaney","slaney"),this.window=(0,o.window_function)(this.config.n_fft,"hann")}async _extract_fbank_features(e){let t=await (0,o.spectrogram)(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:Math.min(Math.floor(e.length/this.config.hop_length),this.config.nb_max_frames)}),r=t.data,s=(0,a.max)(r)[0];for(let e=0;e<r.length;++e)r[e]=(Math.max(r[e],s-8)+4)/4;return t}async _call(e,{max_length:t=null}={}){let r;(0,s.validate_audio_inputs)(e,"WhisperFeatureExtractor");let o=t??this.config.n_samples;return e.length>o?(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`."),r=e.slice(0,o)):(r=new Float32Array(o)).set(e),{input_features:(await this._extract_fbank_features(r)).unsqueeze_(0)}}}},
11"./src/models/whisper/generation_whisper.js":(e,t,r)=>{r.r(t),r.d(t,{WhisperGenerationConfig:()=>o});var s=r("./src/generation/configuration_utils.js");class o extends s.GenerationConfig{return_timestamps=null;return_token_timestamps=null;num_frames=null;alignment_heads=null;task=null;language=null;no_timestamps_token_id=null;prompt_ids=null;is_multilingual=null;lang_to_id=null;task_to_id=null;max_initial_timestamp_index=1}},
11"./src/models/whisper/processing_whisper.js":(e,t,r)=>{r.r(t),r.d(t,{WhisperProcessor:()=>n});var s=r("./src/models/auto/feature_extraction_auto.js"),o=r("./src/tokenizers.js"),a=r("./src/base/processing_utils.js");class n extends a.Processor{static tokenizer_class=o.AutoTokenizer;static feature_extractor_class=s.AutoFeatureExtractor;async _call(e){return await this.feature_extractor(e)}}},
11"./src/models/yolos/image_processing_yolos.js":(e,t,r)=>{r.r(t),r.d(t,{YolosFeatureExtractor:()=>a,YolosImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{post_process_object_detection(...e){return(0,s.post_process_object_detection)(...e)}}class a extends o{}},
11"./src/ops/registry.js":(e,t,r)=>{r.r(t),r.d(t,{TensorOpRegistry:()=>n});var s=r("./src/backends/onnx.js"),o=r("./src/utils/tensor.js");let a=async(e,t,r)=>{let a=await (0,s.createInferenceSession)(new Uint8Array(e),t);return async e=>{let t=(0,s.isONNXProxy)(),n=Object.fromEntries(Object.entries(e).map(([e,r])=>[e,(t?r.clone():r).ort_tensor])),i=await (0,s.runInferenceSession)(a,n);return Array.isArray(r)?r.map(e=>new o.Tensor(i[e])):new o.Tensor(i[r])}};class n{static session_options={};static get nearest_interpolate_4d(){return this._nearest_interpolate_4d||(this._nearest_interpolate_4d=a([8,10,18,0,58,129,1,10,41,10,1,120,10,0,10,0,10,1,115,18,1,121,34,6,82,101,115,105,122,101,42,18,10,4,109,111,100,101,34,7,110,101,97,114,101,115,116,160,1,3,18,1,114,90,31,10,1,120,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,90,15,10,1,115,18,10,10,8,8,7,18,4,10,2,8,4,98,31,10,1,121,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,66,2,16,21],this.session_options,"y")),this._nearest_interpolate_4d}static get bilinear_interpolate_4d(){return this._bilinear_interpolate_4d||(this._bilinear_interpolate_4d=a([8,9,18,0,58,128,1,10,40,10,1,120,10,0,10,0,10,1,115,18,1,121,34,6,82,101,115,105,122,101,42,17,10,4,109,111,100,101,34,6,108,105,110,101,97,114,160,1,3,18,1,114,90,31,10,1,120,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,90,15,10,1,115,18,10,10,8,8,7,18,4,10,2,8,4,98,31,10,1,121,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,66,2,16,20],this.session_options,"y")),this._bilinear_interpolate_4d}static get bicubic_interpolate_4d(){return this._bicubic_interpolate_4d||(this._bicubic_interpolate_4d=a([8,9,18,0,58,127,10,39,10,1,120,10,0,10,0,10,1,115,18,1,121,34,6,82,101,115,105,122,101,42,16,10,4,109,111,100,101,34,5,99,117,98,105,99,160,1,3,18,1,114,90,31,10,1,120,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,90,15,10,1,115,18,10,10,8,8,7,18,4,10,2,8,4,98,31,10,1,121,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,66,2,16,20],this.session_options,"y")),this._bicubic_interpolate_4d}static get matmul(){return this._matmul||(this._matmul=a([8,9,18,0,58,55,10,17,10,1,97,10,1,98,18,1,99,34,6,77,97,116,77,117,108,18,1,114,90,9,10,1,97,18,4,10,2,8,1,90,9,10,1,98,18,4,10,2,8,1,98,9,10,1,99,18,4,10,2,8,1,66,2,16,20],this.session_options,"c")),this._matmul}static get stft(){return this._stft||(this._stft=a([8,7,18,0,58,148,1,10,38,10,1,115,10,1,106,10,1,119,10,1,108,18,1,111,34,4,83,84,70,84,42,15,10,8,111,110,101,115,105,100,101,100,24,1,160,1,2,18,1,115,90,26,10,1,115,18,21,10,19,8,1,18,15,10,3,18,1,98,10,3,18,1,115,10,3,18,1,99,90,11,10,1,106,18,6,10,4,8,7,18,0,90,16,10,1,119,18,11,10,9,8,1,18,5,10,3,18,1,119,90,11,10,1,108,18,6,10,4,8,7,18,0,98,31,10,1,111,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,102,10,3,18,1,100,10,3,18,1,99,66,2,16,17],this.session_options,"o")),this._stft}static get rfft(){return this._rfft||(this._rfft=a([8,9,18,0,58,97,10,33,10,1,120,10,0,10,1,97,18,1,121,34,3,68,70,84,42,15,10,8,111,110,101,115,105,100,101,100,24,1,160,1,2,18,1,100,90,21,10,1,120,18,16,10,14,8,1,18,10,10,3,18,1,115,10,3,18,1,99,90,11,10,1,97,18,6,10,4,8,7,18,0,98,21,10,1,121,18,16,10,14,8,1,18,10,10,3,18,1,115,10,3,18,1,99,66,2,16,20],this.session_options,"y")),this._rfft}static get top_k(){return this._top_k||(this._top_k=a([8,10,18,0,58,73,10,18,10,1,120,10,1,107,18,1,118,18,1,105,34,4,84,111,112,75,18,1,116,90,9,10,1,120,18,4,10,2,8,1,90,15,10,1,107,18,10,10,8,8,7,18,4,10,2,8,1,98,9,10,1,118,18,4,10,2,8,1,98,9,10,1,105,18,4,10,2,8,7,66,2,16,21],this.session_options,["v","i"])),this._top_k}static get slice(){return this._slice||(this._slice=a([8,7,18,0,58,96,10,25,10,1,120,10,1,115,10,1,101,10,1,97,10,1,116,18,1,121,34,5,83,108,105,99,101,18,1,114,90,9,10,1,120,18,4,10,2,8,1,90,9,10,1,115,18,4,10,2,8,7,90,9,10,1,101,18,4,10,2,8,7,90,9,10,1,97,18,4,10,2,8,7,90,9,10,1,116,18,4,10,2,8,7,98,9,10,1,121,18,4,10,2,8,1,66,2,16,13],this.session_options,"y")),this._slice}}},
11"./src/pipelines.js":(e,t,r)=>{r.r(t),r.d(t,{AudioClassificationPipeline:()=>C,AutomaticSpeechRecognitionPipeline:()=>E,BackgroundRemovalPipeline:()=>j,DepthEstimationPipeline:()=>G,DocumentQuestionAnsweringPipeline:()=>O,FeatureExtractionPipeline:()=>v,FillMaskPipeline:()=>w,ImageClassificationPipeline:()=>L,ImageFeatureExtractionPipeline:()=>F,ImageSegmentationPipeline:()=>I,ImageToImagePipeline:()=>B,ImageToTextPipeline:()=>A,ObjectDetectionPipeline:()=>D,Pipeline:()=>h,QuestionAnsweringPipeline:()=>M,SummarizationPipeline:()=>b,Text2TextGenerationPipeline:()=>x,TextClassificationPipeline:()=>f,TextGenerationPipeline:()=>y,TextToAudioPipeline:()=>N,TokenClassificationPipeline:()=>g,TranslationPipeline:()=>T,ZeroShotAudioClassificationPipeline:()=>S,ZeroShotClassificationPipeline:()=>k,ZeroShotImageClassificationPipeline:()=>z,ZeroShotObjectDetectionPipeline:()=>V,pipeline:()=>$});var s=r("./src/tokenizers.js"),o=r("./src/models.js"),a=r("./src/models/auto/processing_auto.js");r("./src/base/processing_utils.js");var n=r("./src/utils/generic.js"),i=r("./src/utils/core.js"),l=r("./src/utils/maths.js"),c=r("./src/utils/audio.js"),d=r("./src/utils/tensor.js"),u=r("./src/utils/image.js");async function m(e){return Array.isArray(e)||(e=[e]),await Promise.all(e.map(e=>u.RawImage.read(e)))}async function _(e,t){return Array.isArray(e)||(e=[e]),await Promise.all(e.map(e=>"string"==typeof e||e instanceof URL?(0,c.read_audio)(e,t):e instanceof Float64Array?new Float32Array(e):e))}function p(e,t){t&&(e=e.map(e=>0|e));let[r,s,o,a]=e;return{xmin:r,ymin:s,xmax:o,ymax:a}}class h extends n.Callable{constructor({task:e,model:t,tokenizer:r=null,processor:s=null}){super(),this.task=e,this.model=t,this.tokenizer=r,this.processor=s}async dispose(){await this.model.dispose()}}class f extends h{constructor(e){super(e)}async _call(e,{top_k:t=1}={}){let r=this.tokenizer(e,{padding:!0,truncation:!0}),s=await this.model(r),o="multi_label_classification"===this.model.config.problem_type?e=>e.sigmoid():e=>new d.Tensor("float32",(0,l.softmax)(e.data),e.dims),a=this.model.config.id2label,n=[];for(let e of s.logits){let r=o(e),s=await (0,d.topk)(r,t),i=s[0].tolist(),l=s[1].tolist().map((e,t)=>({label:a?a[e]:`LABEL_${e}`,score:i[t]}));1===t?n.push(...l):n.push(l)}return Array.isArray(e)||1===t?n:n[0]}}class g extends h{constructor(e){super(e)}async _call(e,{ignore_labels:t=["O"]}={}){let r=Array.isArray(e),s=this.tokenizer(r?e:[e],{padding:!0,truncation:!0}),o=(await this.model(s)).logits,a=this.model.config.id2label,n=[];for(let e=0;e<o.dims[0];++e){let r=s.input_ids[e],i=o[e],c=[];for(let e=0;
11e<i.dims[0];++e){let s=i[e],o=(0,l.max)(s.data)[1],n=a?a[o]:`LABEL_${o}`;if(t.includes(n))continue;let d=this.tokenizer.decode([r[e].item()],{skip_special_tokens:!0});if(""===d)continue;let u=(0,l.softmax)(s.data);c.push({entity:n,score:u[o],index:e,word:d})}n.push(c)}return r?n:n[0]}}class M extends h{constructor(e){super(e)}async _call(e,t,{top_k:r=1}={}){let s=this.tokenizer(e,{text_pair:t,padding:!0,truncation:!0}),{start_logits:o,end_logits:a}=await this.model(s),n=s.input_ids.tolist(),c=s.attention_mask.tolist(),d=this.tokenizer.all_special_ids,u=[];for(let e=0;e<o.dims[0];++e){let t=n[e],s=t.findIndex(e=>e==this.tokenizer.sep_token_id);c[e].map((e,r)=>1==e&&(0===r||r>s&&-1===d.findIndex(e=>e==t[r])));let m=o[e].tolist(),_=a[e].tolist();for(let r=1;r<m.length;++r)(0==c[e]||r<=s||-1!==d.findIndex(e=>e==t[r]))&&(m[r]=-1/0,_[r]=-1/0);let p=(0,l.softmax)(m).map((e,t)=>[e,t]),h=(0,l.softmax)(_).map((e,t)=>[e,t]);p[0][0]=0,h[0][0]=0;let f=(0,i.product)(p,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(f.length,r);++e){let[r,s,o]=f[e],a=t.slice(r,s+1),n=this.tokenizer.decode(a,{skip_special_tokens:!0});u.push({answer:n,score:o})}}return 1===r?u[0]:u}}class w extends h{constructor(e){super(e)}async _call(e,{top_k:t=5}={}){let r=this.tokenizer(e,{padding:!0,truncation:!0}),{logits:s}=await this.model(r),o=[],a=r.input_ids.tolist();for(let e=0;e<a.length;++e){let r=a[e],n=r.findIndex(e=>e==this.tokenizer.mask_token_id);if(-1===n)throw Error(`Mask token (${this.tokenizer.mask_token}) not found in text.`);let i=s[e][n],c=await (0,d.topk)(new d.Tensor("float32",(0,l.softmax)(i.data),i.dims),t),u=c[0].tolist(),m=c[1].tolist();o.push(m.map((e,t)=>{let s=r.slice();return s[n]=e,{score:u[t],token:Number(e),token_str:this.tokenizer.decode([e]),sequence:this.tokenizer.decode(s,{skip_special_tokens:!0})}}))}return Array.isArray(e)?o:o[0]}}class x extends h{_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 s=this.model.config.task_specific_params;s&&s[this.task]&&s[this.task].prefix&&(e=e.map(e=>s[this.task].prefix+e));let o=this.tokenizer,a={padding:!0,truncation:!0};r=this instanceof T&&"_build_translation_inputs"in o?o._build_translation_inputs(e,a,t):o(e,a);let n=await this.model.generate({...r,...t});return o.batch_decode(n,{skip_special_tokens:!0}).map(e=>({[this._key]:e}))}}class b extends x{_key="summary_text";constructor(e){super(e)}}class T extends x{_key="translation_text";constructor(e){super(e)}}function P(e){return Array.isArray(e)&&e.every(e=>"role"in e&&"content"in e)}class y extends h{constructor(e){super(e)}async _call(e,t={}){let r,s,o=!1,a=!1,n=t.add_special_tokens??(this.tokenizer.add_bos_token||this.tokenizer.add_eos_token)??!1;if("string"==typeof e)r=e=[e];else if(Array.isArray(e)&&e.every(e=>"string"==typeof e))o=!0,r=e;else{if(P(e))e=[e];else if(Array.isArray(e)&&e.every(P))o=!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})),n=!1}let i=!a&&(t.return_full_text??!0);this.tokenizer.padding_side="left";let l=this.tokenizer(r,{add_special_tokens:n,padding:!0,truncation:!0}),c=await this.model.generate({...l,...t}),d=this.tokenizer.batch_decode(c,{skip_special_tokens:!0});!i&&l.input_ids.dims.at(-1)>0&&(s=this.tokenizer.batch_decode(l.input_ids,{skip_special_tokens:!0}).map(e=>e.length));let u=Array.from({length:e.length},e=>[]);for(let t=0;t<d.length;++t){let r=Math.floor(t/c.dims[0]*e.length);s&&(d[t]=d[t].slice(s[r])),u[r].push({generated_text:a?[...e[r],{role:"assistant",content:d[t]}]:d[t]})}return o||1!==u.length?u:u[0]}}class k extends h{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:s=!1}={}){let o=Array.isArray(e);o||(e=[e]),Array.isArray(t)||(t=[t]);let a=t.map(e=>r.replace("{}",e)),n=s||1===t.length,i=[];for(let r of e){let e=[];for(let t of a){let s=this.tokenizer(r,{text_pair:t,padding:!0,truncation:!0}
11),o=await this.model(s);n?e.push([o.logits.data[this.contradiction_id],o.logits.data[this.entailment_id]]):e.push(o.logits.data[this.entailment_id])}let s=(n?e.map(e=>(0,l.softmax)(e)[1]):(0,l.softmax)(e)).map((e,t)=>[e,t]).sort((e,t)=>t[0]-e[0]);i.push({sequence:r,labels:s.map(e=>t[e[1]]),scores:s.map(e=>e[0])})}return o?i:i[0]}}class v extends h{constructor(e){super(e)}async _call(e,{pooling:t="none",normalize:r=!1,quantize:s=!1,precision:o="binary"}={}){let a=this.tokenizer(e,{padding:!0,truncation:!0}),n=await this.model(a),i=n.last_hidden_state??n.logits??n.token_embeddings;switch(t){case"none":break;case"mean":i=(0,d.mean_pooling)(i,a.attention_mask);break;case"first_token":case"cls":i=i.slice(null,0);break;case"last_token":case"eos":i=i.slice(null,-1);break;default:throw Error(`Pooling method '${t}' not supported.`)}return r&&(i=i.normalize(2,-1)),s&&(i=(0,d.quantize_embeddings)(i,o)),i}}class F extends h{constructor(e){super(e)}async _call(e,{pool:t=null}={}){let r,s=await m(e),{pixel_values:o}=await this.processor(s),a=await this.model({pixel_values:o});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 C extends h{constructor(e){super(e)}async _call(e,{top_k:t=5}={}){let r=this.processor.feature_extractor.config.sampling_rate,s=await _(e,r),o=this.model.config.id2label,a=[];for(let e of s){let r=await this.processor(e),s=(await this.model(r)).logits[0],n=await (0,d.topk)(new d.Tensor("float32",(0,l.softmax)(s.data),s.dims),t),i=n[0].tolist(),c=n[1].tolist().map((e,t)=>({label:o?o[e]:`LABEL_${e}`,score:i[t]}));a.push(c)}return Array.isArray(e)?a:a[0]}}class S extends h{constructor(e){super(e)}async _call(e,t,{hypothesis_template:r="This is a sound of {}."}={}){let s=!Array.isArray(e);s&&(e=[e]);let o=t.map(e=>r.replace("{}",e)),a=this.tokenizer(o,{padding:!0,truncation:!0}),n=this.processor.feature_extractor.config.sampling_rate,i=await _(e,n),c=[];for(let e of i){let r=await this.processor(e),s=await this.model({...a,...r}),o=(0,l.softmax)(s.logits_per_audio.data);c.push([...o].map((e,r)=>({score:e,label:t[r]})))}return s?c[0]:c}}class E extends h{constructor(e){super(e)}async _call(e,t={}){switch(this.model.config.model_type){case"whisper":case"lite-whisper":return this._call_whisper(e,t);case"wav2vec2":case"wav2vec2-bert":case"unispeech":case"unispeech-sat":case"hubert":case"parakeet_ctc":return this._call_wav2vec2(e,t);case"moonshine":return this._call_moonshine(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 s=this.processor.feature_extractor.config.sampling_rate,o=await _(e,s),a=[];for(let e of o){let t=await this.processor(e),r=(await this.model(t)).logits[0],s=[];for(let e of r)s.push((0,l.max)(e.data)[1]);let o=this.tokenizer.decode(s,{skip_special_tokens:!0}).trim();a.push({text:o})}return r?a[0]:a}async _call_whisper(e,t){let r=t.return_timestamps??!1,s=t.chunk_length_s??0,o=t.force_full_sequences??!1,a=t.stride_length_s??null,n={...t};"word"===r&&(n.return_token_timestamps=!0,n.return_timestamps=!1);let i=!Array.isArray(e);i&&(e=[e]);let c=this.processor.feature_extractor.config.chunk_length/this.model.config.max_source_positions,d=this.processor.feature_extractor.config.hop_length,u=this.processor.feature_extractor.config.sampling_rate,m=await _(e,u),p=[];for(let e of m){let t=[];if(s>0){if(null===a)a=s/6;else if(s<=a)throw Error("`chunk_length_s` must be larger than `stride_length_s`.");let r=u*s,o=u*a,n=r-2*o,i=0;for(;;){let s=i+r,a=e.subarray(i,s),l=await this.processor(a),c=0===i,d=s>=e.length;if(t.push({stride:[a.length,c?0:o,d?0:o],input_features:l.input_features,is_last:d}),d)break;i+=n}}else t=[{stride:[e.length,0,0],input_features:(await this.processor(e)).input_features,is_last:!0}];for(let e of t){n.num_frames=Math.floor(e.stride[0]/d);let t=await this.model.generate({inputs:e.input_features,...n});"word"===r?(e.tokens=t.sequences.tolist()[0],e.token_timestamps=t.token_timestamps.tolist()[0].map(e=>(0,l.round)(e,2))):e.tokens=t[0].tolist(),e.stride=e.stride.map(e=>e/u)}let[i,m]=this.tokenizer._decode_asr(t,{time_precision:c,return_timestamps:r,force_full_sequences:o});p.push({text:i,...m})}return i?p[0]:p}async _call_moonshine(e,t){let r=!Array.isArray(e);r&&(e=[e]);let s=this.processor.feature_extractor.config.sampling_rate,o=await _(e,s),a=[];for(let e of o){let r=await this.processor(e),o=6*Math.floor(e.length/s),n=await this.model.generate({max_new_tokens:o,...t,...r}),i=this.processor.batch_decode(n,{skip_special_tokens:!0})[0];a.push({text:i})}return r?a[0]:a}}class A extends h{constructor(e){super(e)}async _call(e,t={}){let r=Array.isArray(e),s=await m(e),{pixel_values:o}=await this.processor(s),a=[];for(let e of o){e.dims=[1,...e.dims];let r=await this.model.generate({inputs:e,...t}),s=this.tokenizer.batch_decode(r,{skip_special_tokens:!0}).map(e=>({generated_text:e.trim()}));a.push(s)}return r?a:a[0]}}class L extends h{constructor(e){super(e)}async _call(e,{top_k:t=5}={}){let r=await m(e),{pixel_values:s}=await this.processor(r),o=await this.model({pixel_values:s}),a=this.model.config.id2label,n=[];for(let e of o.logits){let r=await (0,d.topk)(new d.Tensor("float32",(0,l.softmax)(e.data),e.dims),t),s=r[0].tolist(),o=r[1].tolist().map((e,t)=>({label:a?a[e]:`LABEL_${e}`,score:s[t]}));n.push(o)}return Array.isArray(e)?n:n[0]}}class I extends h{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:s=.8,label_ids_to_fuse:o=null,target_sizes:a=null,subtask:n=null}={}){if(Array.isArray(e)&&1!==e.length)throw Error("Image segmentation pipeline currently only supports a batch size of 1.");let i=await m(e),l=i.map(e=>[e.height,e.width]),c=await this.processor(i),{inputNames:d,outputNames:_}=this.model.sessions.model;if(!d.includes("pixel_values")){if(1!==d.length)throw Error(`Expected a single input name, but got ${d.length}
11 inputs: ${d}.`);let e=d[0];if(e in c)throw Error(`Input name ${e} already exists in the inputs.`);c[e]=c.pixel_values}let p=await this.model(c),h=null;if(null!==n)h=this.subtasks_mapping[n];else if(this.processor.image_processor){for(let[e,t]of Object.entries(this.subtasks_mapping))if(t in this.processor.image_processor){h=this.processor.image_processor[t].bind(this.processor.image_processor),n=e;break}}let f=this.model.config.id2label,g=[];if(n)if("panoptic"===n||"instance"===n){let e=h(p,t,r,s,o,a??l)[0],n=e.segmentation;for(let t of e.segments_info){let e=new Uint8ClampedArray(n.data.length);for(let r=0;r<n.data.length;++r)n.data[r]===t.id&&(e[r]=255);let r=new u.RawImage(e,n.dims[1],n.dims[0],1);g.push({score:t.score,label:f[t.label_id],mask:r})}}else if("semantic"===n){let{segmentation:e,labels:t}=h(p,a??l)[0];for(let r of t){let t=new Uint8ClampedArray(e.data.length);for(let s=0;s<e.data.length;++s)e.data[s]===r&&(t[s]=255);let s=new u.RawImage(t,e.dims[1],e.dims[0],1);g.push({score:null,label:f[r],mask:s})}}else throw Error(`Subtask ${n} not supported.`);else{let e=p[_[0]];for(let t=0;t<l.length;++t){let r=l[t],s=e[t];s.data.some(e=>e<-1e-5||e>1.00001)&&s.sigmoid_();let o=await u.RawImage.fromTensor(s.mul_(255).to("uint8")).resize(r[1],r[0]);g.push({label:null,score:null,mask:o})}}return g}}class j extends I{constructor(e){super(e)}async _call(e,t={}){if(Array.isArray(e)&&1!==e.length)throw Error("Background removal pipeline currently only supports a batch size of 1.");let r=await m(e),s=await super._call(e,t);return r.map((e,t)=>{let r=e.clone();return r.putAlpha(s[t].mask),r})}}class z extends h{constructor(e){super(e)}async _call(e,t,{hypothesis_template:r="This is a photo of {}"}={}){let s=Array.isArray(e),o=await m(e),a=t.map(e=>r.replace("{}",e)),n=this.tokenizer(a,{padding:"siglip"!==this.model.config.model_type||"max_length",truncation:!0}),{pixel_values:i}=await this.processor(o),c=await this.model({...n,pixel_values:i}),d="siglip"===this.model.config.model_type?e=>e.sigmoid().data:e=>(0,l.softmax)(e.data),u=[];for(let e of c.logits_per_image){let r=[...d(e)].map((e,r)=>({score:e,label:t[r]}));r.sort((e,t)=>t.score-e.score),u.push(r)}return s?u:u[0]}}class D extends h{constructor(e){super(e)}async _call(e,{threshold:t=.9,percentage:r=!1}={}){let s=Array.isArray(e);if(s&&1!==e.length)throw Error("Object detection pipeline currently only supports a batch size of 1.");let o=await m(e),a=r?null:o.map(e=>[e.height,e.width]),{pixel_values:n,pixel_mask:i}=await this.processor(o),l=await this.model({pixel_values:n,pixel_mask:i}),c=this.processor.image_processor.post_process_object_detection(l,t,a),d=this.model.config.id2label,u=c.map(e=>e.boxes.map((t,s)=>({score:e.scores[s],label:d[e.classes[s]],box:p(t,!r)})));return s?u:u[0]}}class V extends h{constructor(e){super(e)}async _call(e,t,{threshold:r=.1,top_k:s=null,percentage:o=!1}={}){let a=Array.isArray(e),n=await m(e),i=this.tokenizer(t,{padding:!0,truncation:!0}),l=await this.processor(n),c=[];for(let e=0;e<n.length;++e){let a,d=n[e],u=o?null:[[d.height,d.width]],m=l.pixel_values[e].unsqueeze_(0),_=await this.model({...i,pixel_values:m});if("post_process_grounded_object_detection"in this.processor){let e=this.processor.post_process_grounded_object_detection(_,i.input_ids,{box_threshold:r,text_threshold:r,target_sizes:u})[0];a=e.boxes.map((t,r)=>({score:e.scores[r],label:e.labels[r],box:p(t,!o)}))}else{let e=this.processor.image_processor.post_process_object_detection(_,r,u,!0)[0];a=e.boxes.map((r,s)=>({score:e.scores[s],label:t[e.classes[s]],box:p(r,!o)}))}a.sort((e,t)=>t.score-e.score),null!==s&&(a=a.slice(0,s)),c.push(a)}return a?c:c[0]}}class O extends h{constructor(e){super(e)}async _call(e,t,r={}){let s=(await m(e))[0],{pixel_values:o}=await this.processor(s),a=`<s_docvqa><s_question>${t}</s_question><s_answer>`,n=this.tokenizer(a,{add_special_tokens:!1,padding:!0,truncation:!0}).input_ids,i=await this.model.generate({inputs:o,max_length:this.model.config.decoder.max_position_embeddings,decoder_input_ids:n,...r}),l=this.tokenizer.batch_decode(i)[0].match(/<s_answer>(.*?)<\/s_answer>/),c=null;return l&&l.length>=2&&(c=l[1].trim()),[{answer:c}]}}class N extends h{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}
11),{waveform:r}=await this.model(t),s=this.model.config.sampling_rate;return new c.RawAudio(r.data,s)}async _call_text_to_spectrogram(e,{speaker_embeddings:t}){if(this.vocoder||(console.log("No vocoder specified, using default HifiGan vocoder."),this.vocoder=await o.AutoModel.from_pretrained(this.DEFAULT_VOCODER_ID,{dtype:"fp32"})),("string"==typeof t||t instanceof URL)&&(t=new Float32Array(await (await fetch(t)).arrayBuffer())),t instanceof Float32Array)t=new d.Tensor("float32",t,[1,t.length]);else if(!(t instanceof d.Tensor))throw Error("Speaker embeddings must be a `Tensor`, `Float32Array`, `string`, or `URL`.");let{input_ids:r}=this.tokenizer(e,{padding:!0,truncation:!0}),{waveform:s}=await this.model.generate_speech(r,t,{vocoder:this.vocoder}),a=this.processor.feature_extractor.config.sampling_rate;return new c.RawAudio(s.data,a)}}class B extends h{constructor(e){super(e)}async _call(e){let t=await m(e),r=await this.processor(t),s=await this.model(r),o=[];for(let e of s.reconstruction){let t=e.squeeze().clamp_(0,1).mul_(255).round_().to("uint8");o.push(u.RawImage.fromTensor(t))}return o.length>1?o:o[0]}}class G extends h{constructor(e){super(e)}async _call(e){let t=await m(e),r=await this.processor(t),{predicted_depth:s}=await this.model(r),o=[];for(let e=0;e<t.length;++e){let r=s[e],[a,n]=r.dims.slice(-2),[i,l]=t[e].size,c=(await (0,d.interpolate_4d)(r.view(1,1,a,n),{size:[l,i],mode:"bilinear"})).view(l,i),m=c.min().item(),_=c.max().item(),p=c.sub(m).div_(_-m).mul_(255).to("uint8").unsqueeze(0),h=u.RawImage.fromTensor(p);o.push({predicted_depth:c,depth:h})}return o.length>1?o:o[0]}}let R=Object.freeze({"text-classification":{tokenizer:s.AutoTokenizer,pipeline:f,model:o.AutoModelForSequenceClassification,default:{model:"Xenova/distilbert-base-uncased-finetuned-sst-2-english"},type:"text"},"token-classification":{tokenizer:s.AutoTokenizer,pipeline:g,model:o.AutoModelForTokenClassification,default:{model:"Xenova/bert-base-multilingual-cased-ner-hrl"},type:"text"},"question-answering":{tokenizer:s.AutoTokenizer,pipeline:M,model:o.AutoModelForQuestionAnswering,default:{model:"Xenova/distilbert-base-cased-distilled-squad"},type:"text"},"fill-mask":{tokenizer:s.AutoTokenizer,pipeline:w,model:o.AutoModelForMaskedLM,default:{model:"Xenova/bert-base-uncased"},type:"text"},summarization:{tokenizer:s.AutoTokenizer,pipeline:b,model:o.AutoModelForSeq2SeqLM,default:{model:"Xenova/distilbart-cnn-6-6"},type:"text"},translation:{tokenizer:s.AutoTokenizer,pipeline:T,model:o.AutoModelForSeq2SeqLM,default:{model:"Xenova/t5-small"},type:"text"},"text2text-generation":{tokenizer:s.AutoTokenizer,pipeline:x,model:o.AutoModelForSeq2SeqLM,default:{model:"Xenova/flan-t5-small"},type:"text"},"text-generation":{tokenizer:s.AutoTokenizer,pipeline:y,model:o.AutoModelForCausalLM,default:{model:"Xenova/gpt2"},type:"text"},"zero-shot-classification":{tokenizer:s.AutoTokenizer,pipeline:k,model:o.AutoModelForSequenceClassification,default:{model:"Xenova/distilbert-base-uncased-mnli"},type:"text"},"audio-classification":{pipeline:C,model:o.AutoModelForAudioClassification,processor:a.AutoProcessor,default:{model:"Xenova/wav2vec2-base-superb-ks"},type:"audio"},"zero-shot-audio-classification":{tokenizer:s.AutoTokenizer,pipeline:S,model:o.AutoModel,processor:a.AutoProcessor,default:{model:"Xenova/clap-htsat-unfused"},type:"multimodal"},"automatic-speech-recognition":{tokenizer:s.AutoTokenizer,pipeline:E,model:[o.AutoModelForSpeechSeq2Seq,o.AutoModelForCTC],processor:a.AutoProcessor,default:{model:"Xenova/whisper-tiny.en"},type:"multimodal"},"text-to-audio":{tokenizer:s.AutoTokenizer,pipeline:N,model:[o.AutoModelForTextToWaveform,o.AutoModelForTextToSpectrogram],processor:[a.AutoProcessor,null],default:{model:"Xenova/speecht5_tts"},type:"text"},"image-to-text":{tokenizer:s.AutoTokenizer,pipeline:A,model:o.AutoModelForVision2Seq,processor:a.AutoProcessor,default:{model:"Xenova/vit-gpt2-image-captioning"},type:"multimodal"},"image-classification":{pipeline:L,model:o.AutoModelForImageClassification,processor:a.AutoProcessor,default:{model:"Xenova/vit-base-patch16-224"},type:"multimodal"},"image-segmentation":{pipeline:I,model:[o.AutoModelForImageSegmentation,o.AutoModelForSemanticSegmentation,o.AutoModelForUniversalSegmentation],processor:a.AutoProcessor,default:{model:"Xenova/detr-resnet-50-panoptic"},type:"multimodal"},"background-removal":{pipeline:j,model:[o.AutoModelForImageSegmentation,o.AutoModelForSemanticSegmentation,o.AutoModelForUniversalSegmentation],processor:a.AutoProcessor,default:{model:"Xenova/modnet"},type:"image"},"zero-shot-image-classification":{tokenizer:s.AutoTokenizer,pipeline:z,model:o.AutoModel,processor:a.AutoProcessor,default:{model:"Xenova/clip-vit-base-patch32"},type:"multimodal"},"object-detection":{pipeline:D,model:o.AutoModelForObjectDetection,processor:a.AutoProcessor,default:{model:"Xenova/detr-resnet-50"},type:"multimodal"},"zero-shot-object-detection":{tokenizer:s.AutoTokenizer,pipeline:V,model:o.AutoModelForZeroShotObjectDetection,processor:a.AutoProcessor,default:{model:"Xenova/owlvit-base-patch32"},type:"multimodal"},"document-question-answering":{tokenizer:s.AutoTokenizer,pipeline:O,model:o.AutoModelForDocumentQuestionAnswering,processor:a.AutoProcessor,default:{model:"Xenova/d
11onut-base-finetuned-docvqa"},type:"multimodal"},"image-to-image":{pipeline:B,model:o.AutoModelForImageToImage,processor:a.AutoProcessor,default:{model:"Xenova/swin2SR-classical-sr-x2-64"},type:"image"},"depth-estimation":{pipeline:G,model:o.AutoModelForDepthEstimation,processor:a.AutoProcessor,default:{model:"Xenova/dpt-large"},type:"image"},"feature-extraction":{tokenizer:s.AutoTokenizer,pipeline:v,model:o.AutoModel,default:{model:"Xenova/all-MiniLM-L6-v2"},type:"text"},"image-feature-extraction":{processor:a.AutoProcessor,pipeline:F,model:[o.AutoModelForImageFeatureExtraction,o.AutoModel],default:{model:"Xenova/vit-base-patch16-224-in21k"},type:"image"}}),q=Object.freeze({"sentiment-analysis":"text-classification",ner:"token-classification",asr:"automatic-speech-recognition","text-to-speech":"text-to-audio",embeddings:"feature-extraction"});async function $(e,t=null,{progress_callback:r=null,config:s=null,cache_dir:o=null,local_files_only:a=!1,revision:n="main",device:l=null,dtype:c=null,subfolder:d="onnx",use_external_data_format:u=null,model_file_name:m=null,session_options:_={}}={}){let p=R[(e=q[e]??e).split("_",1)[0]];if(!p)throw Error(`Unsupported pipeline: ${e}. Must be one of [${Object.keys(R)}]`);t||(t=p.default.model,console.log(`No model specified. Using default model: "${t}".`));let h=new Map([["tokenizer",p.tokenizer],["model",p.model],["processor",p.processor]]),f=await W(h,t,{progress_callback:r,config:s,cache_dir:o,local_files_only:a,revision:n,device:l,dtype:c,subfolder:d,use_external_data_format:u,model_file_name:m,session_options:_});return f.task=e,(0,i.dispatchCallback)(r,{status:"ready",task:e,model:t}),new p.pipeline(f)}async function W(e,t,r){let s=Object.create(null),o=[];for(let[a,n]of e.entries()){let e;n&&(e=Array.isArray(n)?new Promise(async(e,s)=>{let o;for(let a of n){if(null===a)return void e(null);try{e(await a.from_pretrained(t,r));return}catch(e){if(e.message?.includes("Unsupported model type"))o=e;else{if(!e.message?.includes("Could not locate file"))return void s(e);o=e}}}s(o)}):n.from_pretrained(t,r),s[a]=e,o.push(e))}for(let[e,t]of(await Promise.all(o),Object.entries(s)))s[e]=await t;return s}},
11"./src/tokenizers.js":(e,t,r)=>{r.r(t),r.d(t,{AlbertTokenizer:()=>eT,AutoTokenizer:()=>to,BartTokenizer:()=>eD,BertTokenizer:()=>eb,BlenderbotSmallTokenizer:()=>e6,BlenderbotTokenizer:()=>e5,BloomTokenizer:()=>eB,CLIPTokenizer:()=>e2,CamembertTokenizer:()=>eA,CodeGenTokenizer:()=>e1,CodeLlamaTokenizer:()=>eR,CohereTokenizer:()=>tt,ConvBertTokenizer:()=>eC,DebertaTokenizer:()=>ek,DebertaV2Tokenizer:()=>ev,DistilBertTokenizer:()=>eE,ElectraTokenizer:()=>eI,Ernie4_5_Tokenizer:()=>ts,EsmTokenizer:()=>eQ,FalconTokenizer:()=>eW,GPT2Tokenizer:()=>ez,GPTNeoXTokenizer:()=>eU,GemmaTokenizer:()=>eH,Grok1Tokenizer:()=>eJ,HerbertTokenizer:()=>eF,LlamaTokenizer:()=>eG,M2M100Tokenizer:()=>eZ,MBart50Tokenizer:()=>eO,MBartTokenizer:()=>eV,MPNetTokenizer:()=>e$,MarianTokenizer:()=>e4,MgpstrTokenizer:()=>tr,MobileBertTokenizer:()=>eP,NllbTokenizer:()=>eK,NougatTokenizer:()=>e7,PreTrainedTokenizer:()=>ex,Qwen2Tokenizer:()=>eX,RoFormerTokenizer:()=>eS,RobertaTokenizer:()=>eN,SiglipTokenizer:()=>e3,SpeechT5Tokenizer:()=>e9,SqueezeBertTokenizer:()=>ey,T5Tokenizer:()=>ej,TokenizerModel:()=>P,VitsTokenizer:()=>te,Wav2Vec2CTCTokenizer:()=>e8,WhisperTokenizer:()=>e0,XLMRobertaTokenizer:()=>eq,XLMTokenizer:()=>eL,is_chinese_char:()=>g});var s=r("./src/utils/generic.js"),o=r("./src/utils/core.js"),a=r("./src/utils/hub.js"),n=r("./src/utils/maths.js"),i=r("./src/utils/tensor.js"),l=r("./src/utils/data-structures.js"),c=r("./node_modules/@huggingface/jinja/dist/index.js"),d=r("./src/models/whisper/common_whisper.js");async function u(e,t){let r=await Promise.all([(0,a.getModelJSON)(e,"tokenizer.json",!0,t),(0,a.getModelJSON)(e,"tokenizer_config.json",!0,t)]);return null!==t.legacy&&(r[1].legacy=t.legacy),r}function m(e,t=!0){if(void 0!==e.Regex){let t=e.Regex.replace(/\\([#&~])/g,"$1");for(let[e,r]of b)t=t.replaceAll(e,r);return RegExp(t,"gu")}if(void 0===e.String)return console.warn("Unknown pattern type:",e),null;{let r=(0,o.escapeRegExp)(e.String);return RegExp(t?r:`(${r})`,"gu")}}function _(e){return new Map(Object.entries(e))}function p(e){let t=e.dims;switch(t.length){case 1:return e.tolist();case 2:if(1!==t[0])throw Error("Unable to decode tensor with `batch size !== 1`. Use `tokenizer.batch_decode(...)` for batched inputs.");return e.tolist()[0];default:throw Error(`Expected tensor to have 1-2 dimensions, got ${t.length}.`)}}function h(e){return e.replace(/ \./g,".").replace(/ \?/g,"?").replace(/ \!/g,"!").replace(/ ,/g,",").replace(/ \' /g,"'").replace(/ n\'t/g,"n't").replace(/ \'m/g,"'m").replace(/ \'s/g,"'s").replace(/ \'ve/g,"'ve").replace(/ \'re/g,"'re")}function f(e){return e.replace(/\p{M}/gu,"")}function g(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=63744&&e<=64255||e>=194560&&e<=195103}let M="\\p{P}\\u0021-\\u002F\\u003A-\\u0040\\u005B-\\u0060\\u007B-\\u007E",w=RegExp(`^[${M}]+$`,"gu"),x=".,!?…。,、।۔،",b=new Map([["(?i:'s|'t|'re|'ve|'m|'ll|'d)","(?:'([sS]|[tT]|[rR][eE]|[vV][eE]|[mM]|[lL][lL]|[dD]))"],["(?i:[sdmt]|ll|ve|re)","(?:[sS]|[dD]|[mM]|[tT]|[lL][lL]|[vV][eE]|[rR][eE])"],["[^\\r\\n\\p{L}\\p{N}]?+","[^\\r\\n\\p{L}\\p{N}]?"],["[^\\s\\p{L}\\p{N}]++","[^\\s\\p{L}\\p{N}]+"],[` ?[^(\\s|[${x}])]+`,` ?[^\\s${x}]+`]]);class T{constructor(e){this.content=e.content,this.id=e.id,this.single_word=e.single_word??!1,this.lstrip=e.lstrip??!1,this.rstrip=e.rstrip??!1,this.special=e.special??!1,this.normalized=e.normalized??null}}class P extends s.Callable{constructor(e){super(),this.config=e,this.vocab=[],this.tokens_to_ids=new Map,this.unk_token_id=void 0,this.unk_token=void 0,this.end_of_word_suffix=void 0,this.fuse_unk=this.config.fuse_unk??!1}static fromConfig(e,...t){switch(e.type){case"WordPiece":return new y(e);case"Unigram":return new k(e,...t);case"BPE":return new C(e);default:if(e.vocab)if(Array.isArray(e.vocab))return new k(e,...t);else if(!(Object.hasOwn(e,"continuing_subword_prefix")&&Object.hasOwn(e,"unk_token")))return new S(e,...t);else if(Object.hasOwn(e,"merges"))return new C(e);else return new y(e);throw Error(`Unknown TokenizerModel type: ${e.type}`)}}_call(e){return e=this.encode(e),this.fuse_unk&&(e=function(e,t,r){let s=[],o=0;for(;o<e.length;){if(s.push(e[o]),(t.get(e[o])??r)!==r){++o;continue}for(;++o<e.length&&(t.get(e[o])??r)===r;)t.get(s.at(-1))!==r&&(s[s.length-1]+=e[o])}return s}(e,this.tokens_to_ids,this.unk_token_id)),e}encode(e){throw Error("encode should be implemented in subclass.")}convert_tokens_to_ids(e){return e.map(e=>this.tokens_to_ids.get(e)??this.unk_token_id)}convert_ids_to_tokens(e){return e.map(e=>this.vocab[e]??this.unk_token)}}class y extends P{constructor(e){for(let[t,r]of(super(e),this.tokens_to_ids=_(e.vocab),this.unk_token_id=this.tokens_to_ids.get(e.unk_token),this.unk_token=e.unk_token,this.max_input_chars_per_word=e.max_input_chars_per_word??100,this.vocab=Array(this.tokens_to_ids.size),this.tokens_to_ids))this.vocab[r]=t}encode(e){let t=[];for(let r of e){let e=[...r];if(e.length>this.max_input_chars_per_word){t.push(this.unk_token);continue}let s=!1,o=0,a=[];for(;o<e.length;){let t=e.length,r=null;for(;o<t;){let s=e.slice(o,t).join("");if(o>0&&(s=this.config.continuing_subword_prefix+s),this.tokens_to_ids.has(s)){r=s;break}--t}if(null===r){s=!0;break}a.push(r),o=t}s?t.push(this.unk_token):t.push(...a)}return t}}class k extends P{constructor(e,t){super(e);let r=e.vocab.length;this.vocab=Array(r),this.scores=Array(r);for(let t=0;t<r;++t)[this.vocab[t],this.scores[t]]=e.vocab[t];this.unk_token_id=e.unk_id,this.unk_token=this.vocab[e.unk_id],this.tokens_to_ids=new Map(this.vocab.map((e,t)=>[e,t])),this.bos_token=" ",this.bos_token_id=this.tokens_to_ids.get(this.bos_token),this.eos_token=t.eos_token,this.eos_token_id=this.tokens_to_ids.get(this.eos_token),this.unk_token=this.vocab[this.unk_token_id],this.minScore=(0,n.min)(this.scores)[0],this.unk_score=this.minScore-10,this.scores[this.unk_token_id]=this.unk_score,this.trie=new l.CharTrie,this.trie.extend(this.vocab),this.fuse_unk=!0}populateNodes(e){let t=e.chars,r=0;for(;r<t.length;){let s=!1,a=[],n=t.slice(r).join("");for(let t of this.trie.commonPrefixSearch(n)){a.push(t);let n=this.tokens_to_ids.get(t),i=this.scores[n],l=(0,o.len)(t);e.insert(r,l,i,n),s||1!==l||(s=!0)}s||e.insert(r,1,this.unk_score,this.unk_token_id),r+=1}}tokenize(e){let t=new l.TokenLattice(e,this.bos_token_id,this.eos_token_id);return this.populateNodes(t),t.tokens()}encode(e){let t=[];for(let r of e){let e=this.tokenize(r);t.push(...e)}return t}}let v=(()=>{let e=[...Array.from({length:94},(e,t)=>t+33),...Array.from({length:12},(e,t)=>t+161),...Array.from({length:82},(e,t)=>t+174)],t=e.slice(),r=0;for(let s=0;s<256;++s)e.includes(s)||(e.push(s),t.push(256+r),r+=1);let s=t.map(e=>String.fromCharCode(e));return Object.fromEntries(e.map((e,t)=>[e,s[t]]))})(),F=(0,o.reverseDictionary)(v);class C extends P{constructor(e){for(let[t,r]of(super(e),this.tokens_to_ids=_(e.vocab),this.unk_token_id=this.tokens_to_ids.get(e.unk_token),this.unk_token=e.unk_token,this.vocab=Array(this.tokens_to_ids.size),this.tokens_to_ids))this.vocab[r]=t;let t=Array.isArray(e.merges[0]);this.merges=t?e.merges:e.merges.map(e=>e.split(" ",2)),this.bpe_ranks=new Map(this.merges.map((e,t)=>[JSON.stringify(e),t])),this.end_of_word_suffix=e.end_of_word_suffix,this.continuing_subword_suffix=e.continuing_subword_suffix??null,this.byte_fallback=this.config.byte_fallback??!1,this.byte_fallback&&(this.text_encoder=new TextEncoder),this.ignore_merges=this.config.ignore_merges??!1,this.max_length_to_cache=256,this.cache_capacity=1e4,this.cache=new l.LRUCache(this.cache_capacity)}clear_cache(){this.cache.clear()}bpe(e){if(0===e.length)return[];let t=this.cache.get(e);if(void 0!==t)return t;let r=Array.from(e);this.end_of_word_suffix&&(r[r.length-1]+=this.end_of_word_suffix);let s=[];if(r.length>1){let e=new l.PriorityQueue((e,t)=>e.score<t.score),t={token:r[0],bias:0,prev:null,next:null},o=t;for(let t=1;t<r.length;++t){let s={bias:t/r.length,token:r[t],prev:o,next:null};o.next=s,this._add_node(e,o),o=s}for(;!e.isEmpty();){let r=e.pop();if(r.deleted||!r.next||r.next.deleted)continue;if(r.deleted=!0,r.next.deleted=!0,r.prev){let e={...r.prev};r.prev.deleted=!0,r.prev=e,e.prev?e.prev.next=e:t=e}let s={token:r.token+r.next.token,bias:r.bias,prev:r.prev,next:r.next.next};s.prev?(s.prev.next=s,this._add_node(e,s.prev)):t=s,s.next&&(s.next.prev=s,this._add_node(e,s))}for(let e=t;null!==e;e=e.next)s.push(e.token)}else s=r;if(this.continuing_subword_suffix)for(let e=0;e<s.length-1;++e)s[e]+=this.continuing_subword_suffix;return e.length<this.max_length_to_cache&&this.cache.put(e,s),s}_add_node(e,t){let r=this.bpe_ranks.get(JSON.stringify([t.token,t.next.token]));void 0!==r&&(t.score=r+t.bias,e.push(t))}encode(e){let t=[];for(let r of e){if(this.ignore_merges&&this.tokens_to_ids.has(r)){t.push(r);continue}for(let e of this.bpe(r))if(this.tokens_to_ids.has(e))t.push(e);else if(this.byte_fallback){let r=Array.from(this.text_encoder.encode(e)).map(e=>`<0x${e.toString(16).toUpperCase().padStart(2,"0")}>`);r.every(e=>this.tokens_to_ids.has(e))?t.push(...r):t.push(this.unk_token)}else t.push(this.unk_token)}return t}}class S extends P{constructor(e,t){for(let[r,s]of(super(e),this.tokens_to_ids=_(t.target_lang?e.vocab[t.target_lang]:e.vocab),this.bos_token=t.bos_token,this.bos_token_id=this.tokens_to_ids.get(this.bos_token),this.eos_token=t.eos_token,this.eos_token_id=this.tokens_to_ids.get(this.eos_token),this.pad_token=t.pad_token,this.pad_token_id=this.tokens_to_ids.get(this.pad_token),this.unk_token=t.unk_token,this.unk_token_id=this.tokens_to_ids.get(this.unk_token),this.vocab=Array(this.tokens_to_ids.size),this.tokens_to_ids))this.vocab[s]=r}encode(e){return e}}class E extends s.Callable{constructor(e){super(),this.config=e}static fromConfig(e){if(null===e)return null;
11switch(e.type){case"BertNormalizer":return new R(e);case"Precompiled":return new ep(e);case"Sequence":return new G(e);case"Replace":return new A(e);case"NFC":return new I(e);case"NFD":return new j(e);case"NFKC":return new z(e);case"NFKD":return new D(e);case"Strip":return new V(e);case"StripAccents":return new O(e);case"Lowercase":return new N(e);case"Prepend":return new B(e);default:throw Error(`Unknown Normalizer type: ${e.type}`)}}normalize(e){throw Error("normalize should be implemented in subclass.")}_call(e){return this.normalize(e)}}class A extends E{normalize(e){let t=m(this.config.pattern);return null===t?e:e.replaceAll(t,this.config.content)}}class L extends E{form=void 0;normalize(e){return e=e.normalize(this.form)}}class I extends L{form="NFC"}class j extends L{form="NFD"}class z extends L{form="NFKC"}class D extends L{form="NFKD"}class V extends E{normalize(e){return this.config.strip_left&&this.config.strip_right?e=e.trim():(this.config.strip_left&&(e=e.trimStart()),this.config.strip_right&&(e=e.trimEnd())),e}}class O extends E{normalize(e){return e=f(e)}}class N extends E{normalize(e){return e=e.toLowerCase()}}class B extends E{normalize(e){return e=this.config.prepend+e}}class G extends E{constructor(e){super(e),this.normalizers=e.normalizers.map(e=>E.fromConfig(e))}normalize(e){return this.normalizers.reduce((e,t)=>t.normalize(e),e)}}class R extends E{_tokenize_chinese_chars(e){let t=[];for(let r=0;r<e.length;++r){let s=e[r];g(s.charCodeAt(0))?(t.push(" "),t.push(s),t.push(" ")):t.push(s)}return t.join("")}stripAccents(e){return e.normalize("NFD").replace(/\p{Mn}/gu,"")}_is_control(e){switch(e){case"	":case"\n":case"\r":return!1;default:return/^\p{Cc}|\p{Cf}|\p{Co}|\p{Cs}$/u.test(e)}}_clean_text(e){let t=[];for(let r of e){let e=r.charCodeAt(0);0===e||65533===e||this._is_control(r)||(/^\s$/.test(r)?t.push(" "):t.push(r))}return t.join("")}normalize(e){return this.config.clean_text&&(e=this._clean_text(e)),this.config.handle_chinese_chars&&(e=this._tokenize_chinese_chars(e)),this.config.lowercase?(e=e.toLowerCase(),!1!==this.config.strip_accents&&(e=this.stripAccents(e))):this.config.strip_accents&&(e=this.stripAccents(e)),e}}class q extends s.Callable{static fromConfig(e){if(null===e)return null;switch(e.type){case"BertPreTokenizer":return new $(e);case"Sequence":return new eh(e);case"Whitespace":return new ef(e);case"WhitespaceSplit":return new eg(e);case"Metaspace":return new em(e);case"ByteLevel":return new W(e);case"Split":return new U(e);case"Punctuation":return new Q(e);case"Digits":return new X(e);case"Replace":return new eM(e);default:throw Error(`Unknown PreTokenizer type: ${e.type}`)}}pre_tokenize_text(e,t){throw Error("pre_tokenize_text should be implemented in subclass.")}pre_tokenize(e,t){return(Array.isArray(e)?e.map(e=>this.pre_tokenize_text(e,t)):this.pre_tokenize_text(e,t)).flat()}_call(e,t){return this.pre_tokenize(e,t)}}class $ extends q{constructor(e){super(),this.pattern=RegExp(`[^\\s${M}]+|[${M}]`,"gu")}pre_tokenize_text(e,t){return e.trim().match(this.pattern)||[]}}class W extends q{constructor(e){super(),this.config=e,this.add_prefix_space=this.config.add_prefix_space,this.trim_offsets=this.config.trim_offsets,this.use_regex=this.config.use_regex??!0,this.pattern=/'s|'t|'re|'ve|'m|'ll|'d| ?\p{L}+| ?\p{N}+| ?[^\s\p{L}\p{N}]+|\s+(?!\S)|\s+/gu,this.byte_encoder=v,this.text_encoder=new TextEncoder}pre_tokenize_text(e,t){return this.add_prefix_space&&!e.startsWith(" ")&&(e=" "+e),(this.use_regex?e.match(this.pattern)||[]:[e]).map(e=>Array.from(this.text_encoder.encode(e),e=>this.byte_encoder[e]).join(""))}}class U extends q{constructor(e){super(),this.config=e,this.pattern=m(this.config.pattern,this.config.invert)}pre_tokenize_text(e,t){return null===this.pattern?[]:this.config.invert?e.match(this.pattern)||[]:this.config.behavior?.toLowerCase()==="removed"?e.split(this.pattern).filter(e=>e):function(e,t){let r=[],s=0;for(let o of e.matchAll(t)){let t=o[0];s<o.index&&r.push(e.slice(s,o.index)),t.length>0&&r.push(t),s=o.index+t.length}return s<e.length&&r.push(e.slice(s)),r}(e,this.pattern)}}class Q extends q{constructor(e){super(),this.config=e,this.pattern=RegExp(`[^${M}]+|[${M}]+`,"gu")}pre_tokenize_text(e,t){return e.match(this.pattern)||[]}}class X extends q{constructor(e){super(),this.config=e;let t=`[^\\d]+|\\d${this.config.individual_digits?"":"+"}`;this.pattern=RegExp(t,"gu")}pre_tokenize_text(e,t){return e.match(this.pattern)||[]}}class H extends s.Callable{constructor(e){super(),this.config=e}static fromConfig(e){if(null===e)return null;switch(e.type){case"TemplateProcessing":return new K(e);case"ByteLevel":return new Z(e);case"RobertaProcessing":return new Y(e);
11case"BertProcessing":return new J(e);case"Sequence":return new ee(e);default:throw Error(`Unknown PostProcessor type: ${e.type}`)}}post_process(e){throw Error("post_process should be implemented in subclass.")}_call(e,...t){return this.post_process(e,...t)}}class J extends H{constructor(e){super(e),this.cls=e.cls[0],this.sep=e.sep[0]}post_process(e,t=null,{add_special_tokens:r=!0}={}){r&&(e=(0,o.mergeArrays)([this.cls],e,[this.sep]));let s=Array(e.length).fill(0);if(null!==t){let a=r&&this instanceof Y?[this.sep]:[],n=r?[this.sep]:[];e=(0,o.mergeArrays)(e,a,t,n),s=(0,o.mergeArrays)(s,Array(t.length+a.length+n.length).fill(1))}return{tokens:e,token_type_ids:s}}}class Y extends J{}class K extends H{constructor(e){super(e),this.single=e.single,this.pair=e.pair}post_process(e,t=null,{add_special_tokens:r=!0}={}){let s=null===t?this.single:this.pair,a=[],n=[];for(let i of s)"SpecialToken"in i?r&&(a.push(i.SpecialToken.id),n.push(i.SpecialToken.type_id)):"Sequence"in i&&("A"===i.Sequence.id?(a=(0,o.mergeArrays)(a,e),n=(0,o.mergeArrays)(n,Array(e.length).fill(i.Sequence.type_id))):"B"===i.Sequence.id&&(a=(0,o.mergeArrays)(a,t),n=(0,o.mergeArrays)(n,Array(t.length).fill(i.Sequence.type_id))));return{tokens:a,token_type_ids:n}}}class Z extends H{post_process(e,t=null){return t&&(e=(0,o.mergeArrays)(e,t)),{tokens:e}}}class ee extends H{constructor(e){super(e),this.processors=e.processors.map(e=>H.fromConfig(e))}post_process(e,t=null,r={}){let s;for(let o of this.processors)if(o instanceof Z)e=o.post_process(e).tokens,t&&(t=o.post_process(t).tokens);else{let a=o.post_process(e,t,r);e=a.tokens,s=a.token_type_ids}return{tokens:e,token_type_ids:s}}}class et extends s.Callable{constructor(e){super(),this.config=e,this.added_tokens=[],this.end_of_word_suffix=null,this.trim_offsets=e.trim_offsets}static fromConfig(e){if(null===e)return null;switch(e.type){case"WordPiece":return new en(e);case"Metaspace":return new e_(e);case"ByteLevel":return new ei(e);case"Replace":return new er(e);case"ByteFallback":return new es(e);case"Fuse":return new eo(e);case"Strip":return new ea(e);case"Sequence":return new ec(e);case"CTC":return new el(e);case"BPEDecoder":return new ed(e);default:throw Error(`Unknown Decoder type: ${e.type}`)}}_call(e){return this.decode(e)}decode(e){return this.decode_chain(e).join("")}decode_chain(e){throw Error("`decode_chain` should be implemented in subclass.")}}class er extends et{decode_chain(e){let t=m(this.config.pattern);return null===t?e:e.map(e=>e.replaceAll(t,this.config.content))}}class es extends et{constructor(e){super(e),this.text_decoder=new TextDecoder}decode_chain(e){let t=[],r=[];for(let s of e){let e=null;if(6===s.length&&s.startsWith("<0x")&&s.endsWith(">")){let t=parseInt(s.slice(3,5),16);isNaN(t)||(e=t)}if(null!==e)r.push(e);else{if(r.length>0){let e=this.text_decoder.decode(Uint8Array.from(r));t.push(e),r=[]}t.push(s)}}if(r.length>0){let e=this.text_decoder.decode(Uint8Array.from(r));t.push(e),r=[]}return t}}class eo extends et{decode_chain(e){return[e.join("")]}}class ea extends et{constructor(e){super(e),this.content=this.config.content,this.start=this.config.start,this.stop=this.config.stop}decode_chain(e){return e.map(e=>{let t=0;for(let r=0;r<this.start;++r)if(e[r]===this.content){t=r+1;continue}else break;let r=e.length;for(let t=0;t<this.stop;++t){let s=e.length-t-1;if(e[s]===this.content){r=s;continue}break}return e.slice(t,r)})}}class en extends et{constructor(e){super(e),this.cleanup=e.cleanup}decode_chain(e){return e.map((e,t)=>(0!==t&&(e=e.startsWith(this.config.prefix)?e.replace(this.config.prefix,""):" "+e),this.cleanup&&(e=h(e)),e))}}class ei extends et{constructor(e){super(e),this.byte_decoder=F,this.text_decoder=new TextDecoder("utf-8",{fatal:!1,ignoreBOM:!0}),this.end_of_word_suffix=null}convert_tokens_to_string(e){let t=new Uint8Array([...e.join("")].map(e=>this.byte_decoder[e]));return this.text_decoder.decode(t)}decode_chain(e){let t=[],r=[];for(let s of e)void 0!==this.added_tokens.find(e=>e.content===s)?(r.length>0&&(t.push(this.convert_tokens_to_string(r)),r=[]),t.push(s)):r.push(s);return r.length>0&&t.push(this.convert_tokens_to_string(r)),t}}class el extends et{constructor(e){super(e),this.pad_token=this.config.pad_token,this.word_delimiter_token=this.config.word_delimiter_token,this.cleanup=this.config.cleanup}convert_tokens_to_string(e){if(0===e.length)return"";let t=[e[0]];for(let r=1;r<e.length;++r)e[r]!==t.at(-1)&&t.push(e[r]);let r=t.filter(e=>e!==this.pad_token).join("");return this.cleanup&&(r=h(r).replaceAll(this.word_delimiter_token," ").trim()),r}decode_chain(e){return[this.convert_tokens_to_string(e)]}}class ec extends et{constructor(e){super(e),this.decoders=e.decoders.map(e=>et.fromConfig(e))}decode_chain(e){return this.decoders.reduce((e,t)=>
11t.decode_chain(e),e)}}class ed extends et{constructor(e){super(e),this.suffix=this.config.suffix}decode_chain(e){return e.map((t,r)=>t.replaceAll(this.suffix,r===e.length-1?"":" "))}}class eu extends et{decode_chain(e){let t="";for(let r=1;r<e.length;r+=2)t+=e[r];return[t]}}class em extends q{constructor(e){super(),this.addPrefixSpace=e.add_prefix_space,this.replacement=e.replacement,this.strRep=e.str_rep||this.replacement,this.prepend_scheme=e.prepend_scheme??"always"}pre_tokenize_text(e,{section_index:t}={}){let r=e.replaceAll(" ",this.strRep);return this.addPrefixSpace&&!r.startsWith(this.replacement)&&("always"===this.prepend_scheme||"first"===this.prepend_scheme&&0===t)&&(r=this.strRep+r),[r]}}class e_ extends et{constructor(e){super(e),this.addPrefixSpace=e.add_prefix_space,this.replacement=e.replacement}decode_chain(e){let t=[];for(let r=0;r<e.length;++r){let s=e[r].replaceAll(this.replacement," ");this.addPrefixSpace&&0==r&&s.startsWith(" ")&&(s=s.substring(1)),t.push(s)}return t}}class ep extends E{constructor(e){super(e),this.charsmap=e.precompiled_charsmap}normalize(e){return e=(e=(e=e.replace(/[\u0001-\u0008\u000B\u000E-\u001F\u007F\u008F\u009F]/gm,"")).replace(/[\u0009\u000A\u000C\u000D\u00A0\u1680\u2000-\u200F\u2028\u2029\u202F\u205F\u2581\u3000\uFEFF\uFFFD]/gm," ")).includes("~")?e.split("~").map(e=>e.normalize("NFKC")).join("~"):e.normalize("NFKC")}}class eh extends q{constructor(e){super(),this.tokenizers=e.pretokenizers.map(e=>q.fromConfig(e))}pre_tokenize_text(e,t){return this.tokenizers.reduce((e,r)=>r.pre_tokenize(e,t),[e])}}class ef extends q{constructor(e){super()}pre_tokenize_text(e,t){return e.match(/\w+|[^\w\s]+/g)||[]}}class eg extends q{constructor(e){super()}pre_tokenize_text(e,t){return e.match(/\S+/g)||[]}}class eM extends q{constructor(e){super(),this.config=e,this.pattern=m(this.config.pattern),this.content=this.config.content}pre_tokenize_text(e,t){return null===this.pattern?[e]:[e.replaceAll(this.pattern,this.config.content)]}}let ew=["bos_token","eos_token","unk_token","sep_token","pad_token","cls_token","mask_token"];class ex extends s.Callable{return_token_type_ids=!1;padding_side="right";constructor(e,t){for(let r of(super(),this.config=t,this.normalizer=E.fromConfig(e.normalizer),this.pre_tokenizer=q.fromConfig(e.pre_tokenizer),this.model=P.fromConfig(e.model,t),this.post_processor=H.fromConfig(e.post_processor),this.decoder=et.fromConfig(e.decoder),this.special_tokens=[],this.all_special_ids=[],this.added_tokens=[],e.added_tokens)){let e=new T(r);this.added_tokens.push(e),this.model.tokens_to_ids.set(e.content,e.id),this.model.vocab[e.id]=e.content,e.special&&(this.special_tokens.push(e.content),this.all_special_ids.push(e.id))}if(this.additional_special_tokens=t.additional_special_tokens??[],this.special_tokens.push(...this.additional_special_tokens),this.special_tokens=[...new Set(this.special_tokens)],this.decoder&&(this.decoder.added_tokens=this.added_tokens,this.decoder.end_of_word_suffix=this.model.end_of_word_suffix),this.added_tokens_splitter=new l.DictionarySplitter(this.added_tokens.map(e=>e.content)),this.added_tokens_map=new Map(this.added_tokens.map(e=>[e.content,e])),this.mask_token=this.getToken("mask_token"),this.mask_token_id=this.model.tokens_to_ids.get(this.mask_token),this.pad_token=this.getToken("pad_token","eos_token"),this.pad_token_id=this.model.tokens_to_ids.get(this.pad_token),this.sep_token=this.getToken("sep_token"),this.sep_token_id=this.model.tokens_to_ids.get(this.sep_token),this.unk_token=this.getToken("unk_token"),this.unk_token_id=this.model.tokens_to_ids.get(this.unk_token),this.bos_token=this.getToken("bos_token"),this.bos_token_id=this.model.tokens_to_ids.get(this.bos_token),this.eos_token=this.getToken("eos_token"),this.eos_token_id=this.model.tokens_to_ids.get(this.eos_token),this.model_max_length=t.model_max_length,this.remove_space=t.remove_space,this.clean_up_tokenization_spaces=t.clean_up_tokenization_spaces??!0,this.do_lowercase_and_remove_accent=t.do_lowercase_and_remove_accent??!1,t.padding_side&&(this.padding_side=t.padding_side),this.add_bos_token=t.add_bos_token,this.add_eos_token=t.add_eos_token,this.legacy=!1,this.chat_template=t.chat_template??null,Array.isArray(this.chat_template)){let e=Object.create(null);for(let{name:t,template:r}of this.chat_template){if("string"!=typeof t||"string"!=typeof r)throw Error('Chat template must be a list of objects with "name" and "template" properties');e[t]=r}this.chat_template=e}this._compiled_template_cache=new Map}getToken(...e){for(let t of e){let e=this.config[t];if(e)if("object"!=typeof e)return e;else if("AddedToken"===e.__type)return e.content;else throw Error(`Unknown token: ${e}`)}return null}static async from_pretrained(e,{progress_callback:t=null,config:r=null,cache_dir:s=null,local_files_only:o=!1,revision:a="main",legacy:n=null}={}){return new this(...await u(e,{progress_callback:t,config:r,cache_dir:s,local_files_only:o,revision:a,legacy:n}))}_call(e,{text_pair:t=null,add_special_tokens:r=!0,padding:s=!1,truncation:a=null,max_length:l=null,return_tensor:c=!0,return_token_type_ids:d=null}={}){let u,m=Array.isArray(e);if(m){if(0===e.length)throw Error("text array must be non-empty");if(null!==t){if(Array.isArray(t)){if(e.length!==t.length)throw Error("text and text_pair must have the same length")}else throw Error("text_pair must also be an array");u=e.map((e,s)=>this._encode_plus(e,{text_pair:t[s],add_special_tokens:r,return_token_type_ids:d}))}else u=e.map(e=>this._encode_plus(e,{add_special_tokens:r,return_token_type_ids:d}))}else{if(null==e)throw Error("text may not be null or undefined");if(Array.isArray(t))throw Error("When specifying `text_pair`, since `text` is a string, `text_pair` must also be a string (i.e., not an array).");u=[this._encode_plus(e,{text_pair:t,add_special_tokens:r,return_token_type_ids:d})]}if(null===l?l=this.model_max_length:null===a&&(!0===s?(console.warn("`max_length` is ignored when `padding: true` and there is no truncation strategy. To pad to max length, use `padding: 'max_length'`."),l=this.model_max_length):!1===s&&(console.warn("Truncation was not explicitly activated but `max_length` is provided a specific value, please use `truncation: true` to explicitly truncate examples to max length."),a=!0)),!0===s&&(l=Math.min((0,n.max)(u.map(e=>e.input_ids.length))[0],l??1/0)),l=Math.min(l,this.model_max_length??1/0),s||a)for(let e=0;e<u.length;++e)if(u[e].input_ids.length===l)continue;else u[e].input_ids.length>l?a&&function(e,t){for(let r of Object.keys(e))e[r].length=t}(u[e],l):s&&function(e,t,r,s){for(let a of Object.keys(e)){let n=t-e[a].length,i=r(a),l=Array(n).fill(i);e[a]="right"===s?(0,o.mergeArrays)(e[a],l):(0,o.mergeArrays)(l,e[a])}}(u[e],l,e=>"input_ids"===e?this.pad_token_id:0,this.padding_side);let _={};if(c){if(!(s&&a)&&u.some(e=>{for(let t of Object.keys(e))if(e[t].length!==u[0][t]?.length)return!0;return!1}))throw Error("Unable to create tensor, you should probably activate truncation and/or padding with 'padding=true' and 'truncation=true' to have batched tensors with the same length.");let e=[u.length,u[0].input_ids.length];for(let t of Object.keys(u[0]))_[t]=new i.Tensor("int64",BigInt64Array.from(u.flatMap(e=>e[t]).map(BigInt)),e)}else{for(let e of Object.keys(u[0]))_[e]=u.map(t=>t[e]);if(!m)for(let e of Object.keys(_))_[e]=_[e][0]}return _}_encode_text(e){if(null===e)return null;let t=this.added_tokens_splitter.split(e);for(let e=0;e<t.length;++e){let r=this.added_tokens_map.get(t[e]);r&&(r.lstrip&&e>0&&(t[e-1]=t[e-1].trimEnd()),r.rstrip&&e<t.length-1&&(t[e+1]=t[e+1].trimStart()))}return t.flatMap((e,t)=>{if(0===e.length)return[];if(this.added_tokens_map.has(e))return[e];if(!0===this.remove_space&&(e=e.trim().split(/\s+/).join(" ")),this.do_lowercase_and_remove_accent&&(e=f(e.toLowerCase())),null!==this.normalizer&&(e=this.normalizer(e)),0===e.length)return[];let r=null!==this.pre_tokenizer?this.pre_tokenizer(e,{section_index:t}):[e];return this.model(r)})}_encode_plus(e,{text_pair:t=null,add_special_tokens:r=!0,return_token_type_ids:s=null}={}){let{tokens:o,token_type_ids:a}=this._tokenize_helper(e,{pair:t,add_special_tokens:r}),n=this.model.convert_tokens_to_ids(o),i={input_ids:n,attention_mask:Array(n.length).fill(1)};return(s??this.return_token_type_ids)&&a&&(i.token_type_ids=a),i}_tokenize_helper(e,{pair:t=null,add_special_tokens:r=!1}={}){let s=this._encode_text(e),a=this._encode_text(t);return this.post_processor?this.post_processor(s,a,{add_special_tokens:r}):{tokens:(0,o.mergeArrays)(s??[],a??[])}}tokenize(e,{pair:t=null,add_special_tokens:r=!1}={}){return this._tokenize_helper(e,{pair:t,add_special_tokens:r}).tokens}encode(e,{text_pair:t=null,add_special_tokens:r=!0,return_token_type_ids:s=null}={}){return this._encode_plus(e,{text_pair:t,add_special_tokens:r,return_token_type_ids:s}).input_ids}batch_decode(e,t={}){return e instanceof i.Tensor&&(e=e.tolist()),e.map(e=>this.decode(e,t))}decode(e,t={}){if(e instanceof i.Tensor&&(e=p(e)),!Array.isArray(e)||0===e.length||!(0,o.isIntegralNumber)(e[0]))throw Error("token_ids must be a non-empty array of integers.");return this.decode_single(e,t)}decode_single(e,{skip_special_tokens:t=!1,clean_up_tokenization_spaces:r=null}){let s=this.model.convert_ids_to_tokens(e);t&&(s=s.filter(e=>!this.special_tokens.includes(e)));let o=this.decoder?this.decoder(s):s.join(" ");return this.decoder&&this.decoder.end_of_word_suffix&&(o=o.replaceAll(this.decoder.end_of_word_suffix," "),t&&(o=o.trim())),(r??this.clean_up_tokenization_spaces)&&
11(o=h(o)),o}get_chat_template({chat_template:e=null,tools:t=null}={}){if(this.chat_template&&"object"==typeof this.chat_template){let r=this.chat_template;if(null!==e&&Object.hasOwn(r,e))e=r[e];else if(null===e)if(null!==t&&"tool_use"in r)e=r.tool_use;else if("default"in r)e=r.default;else throw Error(`This model has multiple chat templates with no default specified! Please either pass a chat template or the name of the template you wish to use to the 'chat_template' argument. Available template names are ${Object.keys(r).sort()}.`)}else if(null===e)if(this.chat_template)e=this.chat_template;else throw Error("Cannot use apply_chat_template() because tokenizer.chat_template is not set and no template argument was passed! For information about writing templates and setting the tokenizer.chat_template attribute, please see the documentation at https://huggingface.co/docs/transformers/main/en/chat_templating");return e}apply_chat_template(e,{tools:t=null,documents:r=null,chat_template:s=null,add_generation_prompt:o=!1,tokenize:a=!0,padding:n=!1,truncation:i=!1,max_length:l=null,return_tensor:d=!0,return_dict:u=!1,tokenizer_kwargs:m={},..._}={}){if("string"!=typeof(s=this.get_chat_template({chat_template:s,tools:t})))throw Error(`chat_template must be a string, but got ${typeof s}`);let p=this._compiled_template_cache.get(s);void 0===p&&(p=new c.Template(s),this._compiled_template_cache.set(s,p));let h=Object.create(null);for(let e of ew){let t=this.getToken(e);t&&(h[e]=t)}let f=p.render({messages:e,add_generation_prompt:o,tools:t,documents:r,...h,..._});if(a){let e=this._call(f,{add_special_tokens:!1,padding:n,truncation:i,max_length:l,return_tensor:d,...m});return u?e:e.input_ids}return f}}class eb extends ex{return_token_type_ids=!0}class eT extends ex{return_token_type_ids=!0}class eP extends ex{return_token_type_ids=!0}class ey extends ex{return_token_type_ids=!0}class ek extends ex{return_token_type_ids=!0}class ev extends ex{return_token_type_ids=!0}class eF extends ex{return_token_type_ids=!0}class eC extends ex{return_token_type_ids=!0}class eS extends ex{return_token_type_ids=!0}class eE extends ex{}class eA extends ex{}class eL extends ex{return_token_type_ids=!0;constructor(e,t){super(e,t),console.warn('WARNING: `XLMTokenizer` is not yet supported by Hugging Face\'s "fast" tokenizers library. Therefore, you may experience slightly inaccurate results.')}}class eI extends ex{return_token_type_ids=!0}class ej extends ex{}class ez extends ex{}class eD extends ex{}class eV extends ex{constructor(e,t){super(e,t),this.languageRegex=/^[a-z]{2}_[A-Z]{2}$/,this.language_codes=this.special_tokens.filter(e=>this.languageRegex.test(e)),this.lang_to_token=e=>e}_build_translation_inputs(e,t,r){return eY(this,e,t,r)}}class eO extends eV{}class eN extends ex{}class eB extends ex{}class eG extends ex{padding_side="left";constructor(e,t){super(e,t),this.legacy=t.legacy??!0,this.legacy||(this.normalizer=null,this.pre_tokenizer=new em({replacement:"▁",add_prefix_space:!0,prepend_scheme:"first"}))}_encode_text(e){if(null===e)return null;if(this.legacy||0===e.length)return super._encode_text(e);let t=super._encode_text("▁"+e.replaceAll("▁"," "));return t.length>1&&"▁"===t[0]&&this.special_tokens.includes(t[1])&&(t=t.slice(1)),t}}class eR extends ex{}class eq extends ex{}class e$ extends ex{}class eW extends ex{}class eU extends ex{}class eQ extends ex{}class eX extends ex{}class eH extends ex{}class eJ extends ex{}function eY(e,t,r,s){if(!("language_codes"in e)||!Array.isArray(e.language_codes))throw Error("Tokenizer must have `language_codes` attribute set and it should be an array of language ids.");if(!("languageRegex"in e)||!(e.languageRegex instanceof RegExp))throw Error("Tokenizer must have `languageRegex` attribute set and it should be a regular expression.");if(!("lang_to_token"in e)||"function"!=typeof e.lang_to_token)throw Error("Tokenizer must have `lang_to_token` attribute set and it should be a function.");let o=s.src_lang,a=s.tgt_lang;if(!e.language_codes.includes(a))throw Error(`Target language code "${a}
11" is not valid. Must be one of: {${e.language_codes.join(", ")}}`);if(void 0!==o){if(!e.language_codes.includes(o))throw Error(`Source language code "${o}" is not valid. Must be one of: {${e.language_codes.join(", ")}}`);for(let t of e.post_processor.config.single)if("SpecialToken"in t&&e.languageRegex.test(t.SpecialToken.id)){t.SpecialToken.id=e.lang_to_token(o);break}}return s.forced_bos_token_id=e.model.convert_tokens_to_ids([e.lang_to_token(a)])[0],e._call(t,r)}class eK extends ex{constructor(e,t){super(e,t),this.languageRegex=/^[a-z]{3}_[A-Z][a-z]{3}$/,this.language_codes=this.special_tokens.filter(e=>this.languageRegex.test(e)),this.lang_to_token=e=>e}_build_translation_inputs(e,t,r){return eY(this,e,t,r)}}class eZ extends ex{constructor(e,t){super(e,t),this.languageRegex=/^__[a-z]{2,3}__$/,this.language_codes=this.special_tokens.filter(e=>this.languageRegex.test(e)).map(e=>e.slice(2,-2)),this.lang_to_token=e=>`__${e}__`}_build_translation_inputs(e,t,r){return eY(this,e,t,r)}}class e0 extends ex{get timestamp_begin(){return this.model.convert_tokens_to_ids(["<|notimestamps|>"])[0]+1}_decode_asr(e,{return_timestamps:t=!1,return_language:r=!1,time_precision:s=null,force_full_sequences:o=!0}={}){if(null===s)throw Error("Must specify time_precision");let a=null,i="word"===t;function l(){return{language:a,timestamp:[null,null],text:""}}let c=[],u=l(),m=0,_=this.timestamp_begin,p=_+1500,h=[],f=[],g=!1,M=null,x=new Set(this.all_special_ids);for(let r of e){let e=r.tokens,o=i?r.token_timestamps:null,b=null,T=_;if("stride"in r){let[t,o,a]=r.stride;if(m-=o,M=t-a,o&&(T=o/s+_),a)for(let t=e.length-1;t>=0;--t){let r=Number(e[t]);if(r>=_){if(null!==b&&(r-_)*s<M)break;b=r}}}let P=[],y=[];for(let r=0;r<e.length;++r){let M=Number(e[r]);if(x.has(M)){let e=this.decode([M]),r=d.WHISPER_LANGUAGE_MAPPING.get(e.slice(2,-2));if(void 0!==r){if(null!==a&&r!==a&&!t){h.push(P);let e=this.findLongestCommonSequence(h)[0],t=this.decode(e);u.text=t,c.push(u),h=[],P=[],u=l()}a=u.language=r}}else if(M>=_&&M<=p){let e=(M-_)*s+m,t=(0,n.round)(e,2);if(null!==b&&M>=b)g=!0;else if(g||h.length>0&&M<T)g=!1;else if(null===u.timestamp[0])u.timestamp[0]=t;else if(t===u.timestamp[0]);else{u.timestamp[1]=t,h.push(P),i&&f.push(y);let[e,r]=this.findLongestCommonSequence(h,f),s=this.decode(e);u.text=s,i&&(u.words=this.collateWordTimestamps(e,r,a)),c.push(u),h=[],P=[],f=[],y=[],u=l()}}else if(P.push(M),i){let e,t=(0,n.round)(o[r]+m,2);if(r+1<o.length){e=(0,n.round)(o[r+1]+m,2);let a=this.decode([M]);w.test(a)&&(e=(0,n.round)(Math.min(t+s,e),2))}else e=null;y.push([t,e])}}if("stride"in r){let[e,t,s]=r.stride;m+=e-s}P.length>0?(h.push(P),i&&f.push(y)):h.every(e=>0===e.length)&&(u=l(),h=[],P=[],f=[],y=[])}if(h.length>0){if(o&&t)throw Error("Whisper did not predict an ending timestamp, which can happen if audio is cut off in the middle of a word. Also make sure WhisperTimeStampLogitsProcessor was used during generation.");let[e,r]=this.findLongestCommonSequence(h,f),s=this.decode(e);u.text=s,i&&(u.words=this.collateWordTimestamps(e,r,a)),c.push(u)}let b=Object.create(null),T=c.map(e=>e.text).join("");if(t||r){for(let e=0;e<c.length;++e){let s=c[e];t||delete s.timestamp,r||delete s.language}if(i){let e=[];for(let t of c)for(let r of t.words)e.push(r);b={chunks:e}}else b={chunks:c}}return[T,b]}findLongestCommonSequence(e,t=null){let r=e[0],s=r.length,o=[],a=Array.isArray(t)&&t.length>0,n=a?[]:null,i=a?t[0]:null;for(let l=1;l<e.length;++l){let c=e[l],d=0,u=[s,s,0,0],m=c.length;for(let e=1;e<s+m;++e){let o,n=Math.max(0,s-e),_=Math.min(s,s+m-e),p=r.slice(n,_),h=Math.max(0,e-s),f=Math.min(m,e),g=c.slice(h,f);if(p.length!==g.length)throw Error("There is a bug within whisper `decode_asr` function, please report it. Dropping to prevent bad inference.");o=a?p.filter((e,r)=>e===g[r]&&i[n+r]<=t[l][h+r]).length:p.filter((e,t)=>e===g[t]).length;let M=e/1e4,w=o/e+M;o>1&&w>d&&(d=w,u=[n,_,h,f])}let[_,p,h,f]=u,g=Math.floor((p+_)/2),M=Math.floor((f+h)/2);o.push(...r.slice(0,g)),s=(r=c.slice(M)).length,a&&(n.push(...i.slice(0,g)),i=t[l].slice(M))}return(o.push(...r),a)?(n.push(...i),[o,n]):[o,[]]}collateWordTimestamps(e,t,r){let[s,o,a]=this.combineTokensIntoWords(e,r),n=[];for(let e=0;e<s.length;++e){let r=a[e];n.push({text:s[e],timestamp:[t[r.at(0)][0],t[r.at(-1)][1]]})}return n}combineTokensIntoWords(e,t,r="\"'“\xa1\xbf([{-",s="\"'.。,,!!??::”)]}、"){let o,a,n;return["chinese","japanese","thai","lao","myanmar"].includes(t=t??"english")?[o,a,n]=this.splitTokensOnUnicode(e):[o,a,n]=this.splitTokensOnSpaces(e),this.mergePunctuations(o,a,n,r,s)}decode(e,t){let r;return t?.decode_with_timestamps?(e instanceof i.Tensor&&(e=p(e)),r=this.decodeWithTimestamps(e,t)):r=super.decode(e,t),r}decodeWithTimestamps(e,t){let r=t?.time_precision??.02,s=Array.from(this.all_special_ids).at(-1)+1,o=[[]];for(let t of e)if((t=Number(t))>=s){let e=((t-s)*r).toFixed(2);o.push(`<|${e}|>`),o.push([])}else o[o.length-1].push(t);return(o=o.map(e=>"string"==typeof e?e:super.decode(e,t))).join("")}splitTokensOnUnicode(e){let t=this.decode(e,{decode_with_timestamps:!0}),r=[],s=[],o=[],a=[],n=[],i=0;for(let l=0;l<e.length;++l){let c=e[l];a.push(c),n.push(l);let d=this.decode(a,{decode_with_timestamps:!0});d.includes("�")&&"�"!==t[i+d.indexOf("�")]||(r.push(d),s.push(a),o.push(n),a=[],n=[],i+=d.length)}return[r,s,o]}splitTokensOnSpaces(e){let[t,r,s]=this.splitTokensOnUnicode(e),o=[],a=[],n=[],i=RegExp(`^[${M}]$`,"gu");for(let e=0;e<t.length;++e){let l=t[e],c=r[e],d=s[e],u=c[0]>=this.model.tokens_to_ids.get("<|endoftext|>"),m=l.startsWith(" "),_=l.trim(),p=i.test(_);
11if(u||m||p||0===o.length)o.push(l),a.push(c),n.push(d);else{let e=o.length-1;o[e]+=l,a[e].push(...c),n[e].push(...d)}}return[o,a,n]}mergePunctuations(e,t,r,s,a){let n=structuredClone(e),i=structuredClone(t),l=structuredClone(r),c=n.length-2,d=n.length-1;for(;c>=0;)n[c].startsWith(" ")&&s.includes(n[c].trim())?(n[d]=n[c]+n[d],i[d]=(0,o.mergeArrays)(i[c],i[d]),l[d]=(0,o.mergeArrays)(l[c],l[d]),n[c]="",i[c]=[],l[c]=[]):d=c,--c;for(c=0,d=1;d<n.length;)!n[c].endsWith(" ")&&a.includes(n[d])?(n[c]+=n[d],i[c]=(0,o.mergeArrays)(i[c],i[d]),l[c]=(0,o.mergeArrays)(l[c],l[d]),n[d]="",i[d]=[],l[d]=[]):c=d,++d;return[n.filter(e=>e),i.filter(e=>e.length>0),l.filter(e=>e.length>0)]}}class e1 extends ex{}class e2 extends ex{}class e3 extends ex{}class e4 extends ex{constructor(e,t){super(e,t),this.languageRegex=/^(>>\w+<<)\s*/g,this.supported_language_codes=this.model.vocab.filter(e=>this.languageRegex.test(e)),console.warn('WARNING: `MarianTokenizer` is not yet supported by Hugging Face\'s "fast" tokenizers library. Therefore, you may experience slightly inaccurate results.')}_encode_text(e){if(null===e)return null;let[t,...r]=e.trim().split(this.languageRegex);if(0===r.length)return super._encode_text(t);if(2===r.length){let[e,t]=r;return this.supported_language_codes.includes(e)||console.warn(`Unsupported language code "${e}" detected, which may lead to unexpected behavior. Should be one of: ${JSON.stringify(this.supported_language_codes)}`),(0,o.mergeArrays)([e],super._encode_text(t))}}}class e8 extends ex{}class e5 extends ex{}class e6 extends ex{}class e9 extends ex{}class e7 extends ex{}class te extends ex{constructor(e,t){super(e,t),this.decoder=new eu({})}}class tt extends ex{}class tr extends ex{}class ts extends ex{}class to{static TOKENIZER_CLASS_MAPPING={T5Tokenizer:ej,DistilBertTokenizer:eE,CamembertTokenizer:eA,DebertaTokenizer:ek,DebertaV2Tokenizer:ev,BertTokenizer:eb,HerbertTokenizer:eF,ConvBertTokenizer:eC,RoFormerTokenizer:eS,XLMTokenizer:eL,ElectraTokenizer:eI,MobileBertTokenizer:eP,SqueezeBertTokenizer:ey,AlbertTokenizer:eT,GPT2Tokenizer:ez,BartTokenizer:eD,MBartTokenizer:eV,MBart50Tokenizer:eO,RobertaTokenizer:eN,WhisperTokenizer:e0,CodeGenTokenizer:e1,CLIPTokenizer:e2,SiglipTokenizer:e3,MarianTokenizer:e4,BloomTokenizer:eB,NllbTokenizer:eK,M2M100Tokenizer:eZ,LlamaTokenizer:eG,CodeLlamaTokenizer:eR,XLMRobertaTokenizer:eq,MPNetTokenizer:e$,FalconTokenizer:eW,GPTNeoXTokenizer:eU,EsmTokenizer:eQ,Wav2Vec2CTCTokenizer:e8,BlenderbotTokenizer:e5,BlenderbotSmallTokenizer:e6,SpeechT5Tokenizer:e9,NougatTokenizer:e7,VitsTokenizer:te,Qwen2Tokenizer:eX,GemmaTokenizer:eH,Grok1Tokenizer:eJ,CohereTokenizer:tt,MgpstrTokenizer:tr,Ernie4_5_Tokenizer:ts,PreTrainedTokenizer:ex};static async from_pretrained(e,{progress_callback:t=null,config:r=null,cache_dir:s=null,local_files_only:o=!1,revision:a="main",legacy:n=null}={}){let[i,l]=await u(e,{progress_callback:t,config:r,cache_dir:s,local_files_only:o,revision:a,legacy:n}),c=l.tokenizer_class?.replace(/Fast$/,"")??"PreTrainedTokenizer",d=this.TOKENIZER_CLASS_MAPPING[c];return d||(console.warn(`Unknown tokenizer class "${c}", attempting to construct from base class.`),d=ex),new d(i,l)}}},
11"./src/utils/audio.js":(e,t,r)=>{r.r(t),r.d(t,{RawAudio:()=>P,hamming:()=>_,hanning:()=>m,mel_filter_bank:()=>M,read_audio:()=>d,spectrogram:()=>x,window_function:()=>b});var s=r("./src/utils/hub.js"),o=r("./src/utils/maths.js"),a=r("./src/utils/core.js"),i=r("./src/env.js"),l=r("./src/utils/tensor.js"),c=r("?7992");async function d(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-audio-processing.");let o=await (await (0,s.getFile)(e)).arrayBuffer(),a=new AudioContext({sampleRate:t});void 0===t&&console.warn(`No sampling rate provided, using default of ${a.sampleRate}Hz.`);let n=await a.decodeAudioData(o);if(2===n.numberOfChannels){let e=Math.sqrt(2),t=n.getChannelData(0),s=n.getChannelData(1);r=new Float32Array(t.length);for(let o=0;o<n.length;++o)r[o]=e*(t[o]+s[o])/2}else r=n.getChannelData(0);return r}function u(e,t){if(e<1)return new Float64Array;if(1===e)return new Float64Array([1]);let r=1-t,s=2*Math.PI/(e-1),o=new Float64Array(e);for(let a=0;a<e;++a)o[a]=t-r*Math.cos(a*s);return o}function m(e){return u(e,.5)}function _(e){return u(e,.54)}let p={htk:e=>2595*Math.log10(1+e/700),kaldi:e=>1127*Math.log(1+e/700),slaney:(e,t=1e3,r=15,s=27/Math.log(6.4))=>e>=t?r+Math.log(e/t)*s:3*e/200};function h(e,t="htk"){let r=p[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 f={htk:e=>700*(10**(e/2595)-1),kaldi:e=>700*(Math.exp(e/1127)-1),slaney:(e,t=1e3,r=15,s=Math.log(6.4)/27)=>e>=r?t*Math.exp(s*(e-r)):200*e/3};function g(e,t,r){let s=(t-e)/(r-1);return Float64Array.from({length:r},(t,r)=>e+s*r)}function M(e,t,r,s,o,a=null,n="htk",i=!1){let l;if(null!==a&&"slaney"!==a)throw Error('norm must be one of null or "slaney"');if(e<2)throw Error(`Require num_frequency_bins: ${e} >= 2`);if(r>s)throw Error(`Require min_frequency: ${r} <= max_frequency: ${s}`);let c=g(h(r,n),h(s,n),t+2),d=function(e,t="htk"){let r=f[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))}(c,n);if(i){let t=o/((e-1)*2);l=h(Float64Array.from({length:e},(e,r)=>r*t),n),d=c}else l=g(0,Math.floor(o/2),e);let u=function(e,t){let r=Float64Array.from({length:t.length-1},(e,r)=>t[r+1]-t[r]),s=Array.from({length:e.length},()=>Array(t.length));for(let r=0;r<e.length;++r){let o=s[r];for(let s=0;s<t.length;++s)o[s]=t[s]-e[r]}let o=t.length-2,a=Array.from({length:o},()=>Array(e.length));for(let t=0;t<e.length;++t){let e=s[t];for(let s=0;s<o;++s){let o=-e[s]/r[s],n=e[s+2]/r[s+1];a[s][t]=Math.max(0,Math.min(o,n))}}return a}(l,d);if(null!==a&&"slaney"===a)for(let r=0;r<t;++r){let t=u[r],s=2/(d[r+2]-d[r]);for(let r=0;r<e;++r)t[r]*=s}return u}function w(e,t,r,s,a){if(r<=0)throw Error("reference must be greater than zero");if(s<=0)throw Error("min_value must be greater than zero");let n=Math.log10(r=Math.max(s,r));for(let r=0;r<e.length;++r)e[r]=t*Math.log10(Math.max(s,e[r])-n);if(null!==a){if(a<=0)throw Error("db_range must be greater than zero");let t=(0,o.max)(e)[0]-a;for(let r=0;r<e.length;++r)e[r]=Math.max(e[r],t)}return e}async function x(e,t,r,s,{fft_length:n=null,power:i=1,center:c=!0,pad_mode:d="reflect",onesided:u=!0,preemphasis:m=null,preemphasis_htk_flavor:_=!0,mel_filters:p=null,mel_floor:h=1e-10,log_mel:f=null,reference:g=1,min_value:M=1e-10,db_range:b=null,remove_dc_offset:T=null,min_num_frames:P=null,max_num_frames:y=null,do_pad:k=!0,transpose:v=!1,mel_offset:F=0}={}){let C=t.length;if(null===n&&(n=r),r>n)throw Error(`frame_length (${r}) may not be larger than fft_length (${n})`);if(C!==r)throw Error(`Length of the window (${C}) must equal frame_length (${r})`);if(s<=0)throw Error("hop_length must be greater than zero");if(null===i&&null!==p)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(!_)throw Error("`preemphasis_htk_flavor=false` is not currently supported.");
11if(c)switch(d){case"reflect":{let t=Math.floor((n-1)/2)+1;e=function(e,t,r){let s=new e.constructor(e.length+t+r),o=e.length-1;for(let r=0;r<e.length;++r)s[t+r]=e[r];for(let r=1;r<=t;++r)s[t-r]=e[(0,a.calculateReflectOffset)(r,o)];for(let n=1;n<=r;++n)s[o+t+n]=e[(0,a.calculateReflectOffset)(o-n,o)];return s}(e,t,t);break}case"constant":{let t=Math.floor(n/2),r=new e.constructor(e.length+2*t);r.set(e,t),e=r;break}default:throw Error(`pad_mode="${d}" not implemented yet.`)}let S=Math.floor(1+Math.floor((e.length-r)/s));null!==P&&S<P&&(S=P);let E=u?Math.floor(n/2)+1:n,A=S,L=S;null!==y&&(y>S?k&&(L=y):L=A=y);let I=new o.FFT(n),j=new Float64Array(n),z=new Float64Array(I.outputBufferSize),D=new Float32Array(E*L);for(let o=0;o<A;++o){let a=o*s,n=Math.min(e.length-a,r);n!==r&&j.fill(0,0,r);for(let t=0;t<n;++t)j[t]=e[a+t];if(T){let e=0;for(let t=0;t<n;++t)e+=j[t];let t=e/n;for(let e=0;e<n;++e)j[e]-=t}if(null!==m){for(let e=n-1;e>=1;--e)j[e]-=m*j[e-1];j[0]*=1-m}for(let e=0;e<t.length;++e)j[e]*=t[e];I.realTransform(z,j);for(let e=0;e<E;++e){let t=e<<1;D[e*L+o]=z[t]**2+z[t+1]**2}}if(null!==i&&2!==i){let e=i/2;for(let t=0;t<D.length;++t)D[t]**=e}let V=p.length,O=await (0,l.matmul)(new l.Tensor("float32",p.flat(),[V,E]),new l.Tensor("float32",D,[E,L]));v&&(O=O.transpose(1,0));let N=O.data;for(let e=0;e<N.length;++e)N[e]=F+Math.max(h,N[e]);if(null!==i&&null!==f){let e=Math.min(N.length,A*V);switch(f){case"log":for(let t=0;t<e;++t)N[t]=Math.log(N[t]);break;case"log10":for(let t=0;t<e;++t)N[t]=Math.log10(N[t]);break;case"dB":if(1===i)!function(e,t=1,r=1e-5,s=null){w(e,20,t,r,s)}(N,g,M,b);else if(2===i)!function(e,t=1,r=1e-10,s=null){w(e,10,t,r,s)}(N,g,M,b);else throw Error(`Cannot use log_mel option '${f}' with power ${i}`);break;default:throw Error(`log_mel must be one of null, 'log', 'log10' or 'dB'. Got '${f}'`)}}return O}function b(e,t,{periodic:r=!0,frame_length:s=null,center:o=!0}={}){let a,n=r?e+1:e;switch(t){case"boxcar":a=new Float64Array(n).fill(1);break;case"hann":case"hann_window":a=m(n);break;case"hamming":a=_(n);break;case"povey":a=m(n).map(e=>Math.pow(e,.85));break;default:throw Error(`Unknown window type ${t}.`)}if(r&&(a=a.subarray(0,e)),null===s)return a;if(e>s)throw Error(`Length of the window (${e}) may not be larger than frame_length (${s})`);return a}function T(e,t,r){for(let s=0;s<r.length;++s)e.setUint8(t+s,r.charCodeAt(s))}class P{constructor(e,t){this.audio=e,this.sampling_rate=t}toWav(){return function(e,t){let r=44,s=new ArrayBuffer(44+4*e.length),o=new DataView(s);T(o,0,"RIFF"),o.setUint32(4,36+4*e.length,!0),T(o,8,"WAVE"),T(o,12,"fmt "),o.setUint32(16,16,!0),o.setUint16(20,3,!0),o.setUint16(22,1,!0),o.setUint32(24,t,!0),o.setUint32(28,4*t,!0),o.setUint16(32,4,!0),o.setUint16(34,32,!0),T(o,36,"data"),o.setUint32(40,4*e.length,!0);for(let t=0;t<e.length;++t,r+=4)o.setFloat32(r,e[t],!0);return s}(this.audio,this.sampling_rate)}toBlob(){return new Blob([this.toWav()],{type:"audio/wav"})}async save(e){let t;if(i.apis.IS_BROWSER_ENV){if(i.apis.IS_WEBWORKER_ENV)throw Error("Unable to save a file from a Web Worker.");t=a.saveBlob}else if(i.apis.IS_FS_AVAILABLE)t=async(e,t)=>{let r=await t.arrayBuffer();c.writeFileSync(e,n.from(r))};else throw Error("Unable to save because filesystem is disabled in this environment.");await t(e,this.toBlob())}}},
11"./src/utils/constants.js":(e,t,r)=>{r.r(t),r.d(t,{CHAT_TEMPLATE_NAME:()=>l,CONFIG_NAME:()=>o,FEATURE_EXTRACTOR_NAME:()=>a,GENERATION_CONFIG_NAME:()=>c,GITHUB_ISSUE_URL:()=>s,IMAGE_PROCESSOR_NAME:()=>n,PROCESSOR_NAME:()=>i});let s="https://github.com/huggingface/transformers.js/issues/new/choose",o="config.json",a="preprocessor_config.json",n=a,i="processor_config.json",l="chat_template.jinja",c="generation_config.json"},
11"./src/utils/core.js":(e,t,r)=>{function s(e,t){e&&e(t)}function o(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[t,e]))}function a(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function n(e){return e?.prototype?.__proto__?.constructor?.name==="TypedArray"}function i(e){return Number.isInteger(e)||"bigint"==typeof e}function l(e){return null==e||-1===e}function c(e){let t=[],r=e;for(;Array.isArray(r);)t.push(r.length),r=r[0];return t}function d(e,t,r){let s=e[t];if(void 0!==s)return delete e[t],s;if(void 0===r)throw Error(`Key ${t} does not exist in object.`);return r}function u(...e){return Array.prototype.concat.apply([],e)}function m(...e){return e.reduce((e,t)=>e.flatMap(e=>t.map(t=>[e,t])))}function _(e,t){return Math.abs((e+t)%(2*t)-t)}function p(e,t){let r=URL.createObjectURL(t),s=document.createElement("a");s.href=r,s.download=e,s.click(),s.remove(),URL.revokeObjectURL(r)}function h(e,t){return Object.assign({},...t.map(t=>{if(void 0!==e[t])return{[t]:e[t]}}))}function f(e){let t=0;for(let r of e)++t;return t}function g(e,t){let r=0;for(let s of e)s===t&&++r;return r}r.r(t),r.d(t,{calculateDimensions:()=>c,calculateReflectOffset:()=>_,count:()=>g,dispatchCallback:()=>s,escapeRegExp:()=>a,isIntegralNumber:()=>i,isNullishDimension:()=>l,isTypedArray:()=>n,len:()=>f,mergeArrays:()=>u,pick:()=>h,pop:()=>d,product:()=>m,reverseDictionary:()=>o,saveBlob:()=>p})},
11"./src/utils/data-structures.js":(e,t,r)=>{r.r(t),r.d(t,{CharTrie:()=>o,DictionarySplitter:()=>l,LRUCache:()=>c,PriorityQueue:()=>s,TokenLattice:()=>n});class s{constructor(e=(e,t)=>e>t,t=1/0){this._heap=[],this._comparator=e,this._maxSize=t}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)if(this.size<this._maxSize)this._heap.push(t),this._siftUp();else{let e=this._smallest();this._comparator(t,this._heap[e])&&(this._heap[e]=t,this._siftUpFrom(e))}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(){this._siftUpFrom(this.size-1)}_siftUpFrom(e){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}}_smallest(){return 2**Math.floor(Math.log2(this.size))-1}}class o{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;if(void 0===t)return;let r="";for(let s of e){if(r+=s,void 0===(t=t.children.get(s)))return;t.isLeaf&&(yield r)}}}class a{constructor(e,t){this.isLeaf=e,this.children=t}static default(){return new a(!1,new Map)}}class n{constructor(e,t,r){this.chars=Array.from(e),this.len=this.chars.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 s=new i(this.bosTokenId,0,0,0,0),o=new i(this.eosTokenId,1,this.len,0,0);this.nodes.push(s.clone()),this.nodes.push(o.clone()),this.beginNodes[this.len].push(o),this.endNodes[0].push(s)}insert(e,t,r,s){let o=new i(s,this.nodes.length,e,t,r);this.beginNodes[e].push(o),this.endNodes[e+t].push(o),this.nodes.push(o)}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,s=null;for(let o of this.endNodes[t]){let t=o.backtraceScore+e.score;(null===s||t>r)&&(s=o.clone(),r=t)}if(null===s)return[];e.prev=s,e.backtraceScore=r}++t}let r=[],s=this.beginNodes[e][0].prev;if(null===s)return[];let o=s.clone();for(;null!==o.prev;)r.push(o.clone()),o=o.clone().prev.clone();return r.reverse(),r}piece(e){return this.chars.slice(e.pos,e.pos+e.length).join("")}tokens(){return this.viterbi().map(e=>this.piece(e))}tokenIds(){return this.viterbi().map(e=>e.tokenId)}}class i{constructor(e,t,r,s,o){this.tokenId=e,this.nodeId=t,this.pos=r,this.length=s,this.score=o,this.prev=null,this.backtraceScore=0}clone(){let e=new i(this.tokenId,this.nodeId,this.pos,this.length,this.score);return e.prev=this.prev,e.backtraceScore=this.backtraceScore,e}}class l{constructor(e){this.trie=this._buildTrie(e)}_buildTrie(e){let t=Object.create(null);for(let r of e){let e=t;for(let t=0;t<r.length;++t)e=e[r[t]]??=Object.create(null);e.end=r}return t}split(e){let t=[],r=e.length,s=0,o=0;for(;o<r;){let a=this.trie,n=null,i=o;for(;i<r&&(a=a[e[i]]);)a.end&&(n=a.end),++i;n?(o>s&&t.push(e.slice(s,o)),t.push(n),o+=n.length,s=o):++o}return s<r&&t.push(e.slice(s)),t}}class c{constructor(e){this.capacity=e,this.cache=new Map}get(e){if(!this.cache.has(e))return;let t=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,t),t}put(e,t){this.cache.has(e)&&this.cache.delete(e),this.cache.set(e,t),this.cache.size>this.capacity&&this.cache.delete(this.cache.keys().next().value)}clear(){this.cache.clear()}}},
11"./src/utils/devices.js":(e,t,r)=>{r.r(t),r.d(t,{DEVICE_TYPES:()=>s});let s=Object.freeze({auto:"auto",gpu:"gpu",cpu:"cpu",wasm:"wasm",webgpu:"webgpu",cuda:"cuda",dml:"dml",webnn:"webnn","webnn-npu":"webnn-npu","webnn-gpu":"webnn-gpu","webnn-cpu":"webnn-cpu"})},
11"./src/utils/dtypes.js":(e,t,r)=>{r.r(t),r.d(t,{DATA_TYPES:()=>n,DEFAULT_DEVICE_DTYPE_MAPPING:()=>i,DEFAULT_DTYPE_SUFFIX_MAPPING:()=>l,isWebGpuFp16Supported:()=>a});var s=r("./src/env.js"),o=r("./src/utils/devices.js");let a=function(){let e;return async function(){if(void 0===e)if(s.apis.IS_WEBGPU_AVAILABLE)try{e=(await navigator.gpu.requestAdapter()).features.has("shader-f16")}catch(t){e=!1}else e=!1;return e}}(),n=Object.freeze({auto:"auto",fp32:"fp32",fp16:"fp16",q8:"q8",int8:"int8",uint8:"uint8",q4:"q4",bnb4:"bnb4",q4f16:"q4f16"}),i=Object.freeze({[o.DEVICE_TYPES.wasm]:n.q8}),l=Object.freeze({[n.fp32]:"",[n.fp16]:"_fp16",[n.int8]:"_int8",[n.uint8]:"_uint8",[n.q8]:"_quantized",[n.q4]:"_q4",[n.q4f16]:"_q4f16",[n.bnb4]:"_bnb4"})},
11"./src/utils/generic.js":(e,t,r)=>{r.r(t),r.d(t,{Callable:()=>s});let s=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")}}},
11"./src/utils/hub.js":(e,t,r)=>{r.r(t),r.d(t,{MAX_EXTERNAL_DATA_CHUNKS:()=>l,getFile:()=>_,getModelFile:()=>g,getModelJSON:()=>w,getModelText:()=>M});var s=r("?7992"),o=r("?5af5"),n=r("./src/env.js"),i=r("./src/utils/core.js");let l=100,c={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"};class d{constructor(e){if(this.filePath=e,this.headers=new Headers,this.exists=s.existsSync(e),this.exists){this.status=200,this.statusText="OK";let t=s.statSync(e);this.headers.set("content-length",t.size.toString()),this.updateContentType();let r=s.createReadStream(e);this.body=new ReadableStream({start(e){r.on("data",t=>e.enqueue(t)),r.on("end",()=>e.close()),r.on("error",t=>e.error(t))},cancel(){r.destroy()}})}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",c[e]??"application/octet-stream")}clone(){let e=new d(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 s.promises.readFile(this.filePath)).buffer}async blob(){return new Blob([await s.promises.readFile(this.filePath)],{type:this.headers.get("content-type")})}async text(){return await s.promises.readFile(this.filePath,"utf8")}async json(){return JSON.parse(await this.text())}}function u(e,t=null,r=null){let s;try{s=new URL(e)}catch(e){return!1}return(!t||!!t.includes(s.protocol))&&(!r||!!r.includes(s.hostname))}let m=/^(\b[\w\-.]+\b\/)?\b[\w\-.]{1,96}\b$/;async function _(e){if(n.env.useFS&&!u(e,["http:","https:","blob:"]))return new d(e instanceof URL?"file:"===e.protocol?e.pathname:e.toString():e);if(void 0===a||a?.release?.name!=="node")return fetch(e);{let t=!!a.env?.TESTING_REMOTELY,r=n.env.version,s=new Headers;if(s.set("User-Agent",`transformers.js/${r}; is_ci/${t};`),u(e,["http:","https:"],["huggingface.co","hf.co"])){let e=a.env?.HF_TOKEN??a.env?.HF_ACCESS_TOKEN;e&&s.set("Authorization",`Bearer ${e}`)}return fetch(e,{headers:s})}}let p={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 h{constructor(e){this.path=e}async match(e){let t=new d(o.join(this.path,e));return t.exists?t:void 0}async put(e,t,r){let a=o.join(this.path,e);try{let e=t.headers.get("Content-Length"),n=parseInt(e??"0"),i=0;await s.promises.mkdir(o.dirname(a),{recursive:!0});let l=s.createWriteStream(a),c=t.body.getReader();for(;;){let{done:e,value:t}=await c.read();if(e)break;await new Promise((e,r)=>{l.write(t,t=>{if(t)return void r(t);e()})}),i+=t.length;let s=n?i/n*100:0;r?.({progress:s,loaded:i,total:n})}l.close()}catch(e){try{await s.promises.unlink(a)}catch{}throw e}}}async function f(e,...t){for(let r of t)try{let t=await e.match(r);if(t)return t}catch(e){continue}}async function g(e,t,r=!0,s={},o=!1){let a,l,c,M;if(!n.env.allowLocalModels){if(s.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(!n.env.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,i.dispatchCallback)(s.progress_callback,{status:"initiate",name:e,file:t}),!a&&n.env.useCustomCache){if(!n.env.customCache)throw Error("`env.useCustomCache=true`, but `env.customCache` is not defined.");if(!n.env.customCache.match||!n.env.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");a=n.env.customCache}if(!a&&n.env.useBrowserCache){if("undefined"==typeof caches)throw Error("Browser cache is not available in this environment.");try{a=await caches.open("transformers-cache")}catch(e){console.warn("An error occurred while opening the browser cache:",e)}}if(!a&&n.env.useFSCache){if(!n.apis.IS_FS_AVAILABLE)throw Error("File System Cache is not available in this environment.");a=new h(s.cache_dir??n.env.cacheDir)}let w=s.revision??"main",T=b(e,t),P=!(!m.test(e)||e.includes("..")||e.includes("--")||e.endsWith(".git")||e.endsWith(".ipynb")),y=P?b(n.env.localModelPath,T):T,k=b(n.env.remoteHost,n.env.remotePathTemplate.replaceAll("{model}",e).replaceAll("{revision}",encodeURIComponent(w)),t),v=a instanceof h?"main"===w?T:b(e,w,t):k,F=!1;a&&(c=await f(a,y,v));let C=void 0!==c;if(void 0===c){if(n.env.allowLocalModels)if(u(T,["http:","https:"])){if(s.local_files_only)throw Error(`\`local_files_only=true\`, but attempted to load a remote file from: ${T}.`);else if(!n.env.allowRemoteModels)throw Error(`\`env.allowRemoteModels=false\`, but attempted to load a remote file from: ${T}.`)}else try{c=await _(y),l=y}catch(e){console.warn(`Unable to load from local path "${y}": "${e}"`)}if(void 0===c||404===c.status){if(s.local_files_only||!n.env.allowRemoteModels)if(!r)return null;else throw Error(`\`local_files_only=true\` or \`env.allowRemoteModels=false\` and file was not found locally at "${y}".`);if(!P)throw Error(`Local file missing at "${y}
11" and download aborted due to invalid model ID "${e}".`);if(200!==(c=await _(k)).status){var S=c.status;if(!r)return null;let e=p[S]??`Error (${S}) occurred while trying to load file`;throw Error(`${e}: "${k}".`)}l=v}F=a&&"undefined"!=typeof Response&&c instanceof Response&&200===c.status}if((0,i.dispatchCallback)(s.progress_callback,{status:"download",name:e,file:t}),!(n.apis.IS_NODE_ENV&&o)){let r;s.progress_callback?C&&"undefined"!=typeof navigator&&/firefox/i.test(navigator.userAgent)?(r=new Uint8Array(await c.arrayBuffer()),(0,i.dispatchCallback)(s.progress_callback,{status:"progress",name:e,file:t,progress:100,loaded:r.length,total:r.length})):r=await x(c,r=>{(0,i.dispatchCallback)(s.progress_callback,{status:"progress",name:e,file:t,...r})}):r=new Uint8Array(await c.arrayBuffer()),M=r}if(F&&l&&await a.match(l)===void 0)if(M)await a.put(l,new Response(M,{headers:c.headers})).catch(e=>{console.warn(`Unable to add response to browser cache: ${e}.`)});else{let r=s.progress_callback?r=>(0,i.dispatchCallback)(s.progress_callback,{status:"progress",name:e,file:t,...r}):void 0;await a.put(l,c,r)}if((0,i.dispatchCallback)(s.progress_callback,{status:"done",name:e,file:t}),M){if(!n.apis.IS_NODE_ENV&&o)throw Error("Cannot return path in a browser environment.");return M}if(c instanceof d)return c.filePath;let E=await a?.match(l);if(E instanceof d)return E.filePath;if(E instanceof Response)return new Uint8Array(await E.arrayBuffer());if("string"==typeof E)return E;throw Error("Unable to get model file path or buffer.")}async function M(e,t,r=!0,s={}){let o=await g(e,t,r,s,!1);return null===o?null:new TextDecoder("utf-8").decode(o)}async function w(e,t,r=!0,s={}){let o=await M(e,t,r,s);return null===o?{}:JSON.parse(o)}async function x(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 s=parseInt(r??"0"),o=new Uint8Array(s),a=0,n=e.body.getReader();async function i(){let{done:e,value:r}=await n.read();if(e)return;let l=a+r.length;if(l>s){let e=new Uint8Array(s=l);e.set(o),o=e}return o.set(r,a),t({progress:(a=l)/s*100,loaded:a,total:s}),i()}return await i(),o}function b(...e){return(e=e.map((t,r)=>(r&&(t=t.replace(RegExp("^/"),"")),r!==e.length-1&&(t=t.replace(RegExp("/$"),"")),t))).join("/")}},
11"./src/utils/image.js":(e,t,r)=>{let s,o,a;r.r(t),r.d(t,{RawImage:()=>p,load_image:()=>h});var n=r("./src/utils/core.js"),i=r("./src/utils/hub.js"),l=r("./src/env.js"),c=r("./src/utils/tensor.js"),d=r("?2b25");let u=l.apis.IS_BROWSER_ENV||l.apis.IS_WEBWORKER_ENV;if(u)s=(e,t)=>{if(!self.OffscreenCanvas)throw Error("OffscreenCanvas not supported by this browser.");return new self.OffscreenCanvas(e,t)},a=self.createImageBitmap,o=self.ImageData;else if(d)a=async e=>{let t=(await e.metadata()).channels,{data:r,info:s}=await e.rotate().raw().toBuffer({resolveWithObject:!0}),o=new p(new Uint8ClampedArray(r),s.width,s.height,s.channels);return void 0!==t&&t!==s.channels&&o.convert(t),o};else throw Error("Unable to load image processing library.");let m={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 p{constructor(e,t,r,s){this.data=e,this.width=t,this.height=r,this.channels=s}get size(){return[this.width,this.height]}static async read(e){if(e instanceof p)return e;if("string"==typeof e||e instanceof URL)return await this.fromURL(e);if(e instanceof Blob)return await this.fromBlob(e);if("undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas)return this.fromCanvas(e);throw Error(`Unsupported input type: ${typeof e}`)}static fromCanvas(e){if(!u)throw Error("fromCanvas() is only supported in browser environments.");return new p(e.getContext("2d").getImageData(0,0,e.width,e.height).data,e.width,e.height,4)}static async fromURL(e){let t=await (0,i.getFile)(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(u){let t=await a(e),r=s(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=d(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 p(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 s=this.data[t],o=this.data[t+1],a=this.data[t+2];e[r++]=Math.round(.2989*s+.587*o+.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)}putAlpha(e){if(e.width!==this.width||e.height!==this.height)throw Error(`Expected mask size to be ${this.width}x${this.height}, but got ${e.width}x${e.height}`);if(1!==e.channels)throw Error(`Expected mask to have 1 channel, but got ${e.channels}`);let t=this.data,r=e.data,s=this.width*this.height;if(3===this.channels){let e=new Uint8ClampedArray(4*s);for(let o=0,a=0,n=0;o<s;++o)e[n++]=t[a++],e[n++]=t[a++],e[n++]=t[a++],e[n++]=r[o];return this._update(e,this.width,this.height,4)}if(4===this.channels){for(let e=0;e<s;++e)t[4*e+3]=r[e];return this}throw Error(`Expected image to have 3 or 4 channels, but got ${this.channels}`)}async resize(e,t,{resample:r=2}={}){if(this.width===e&&this.height===t)return this;let o=m[r]??r,i=(0,n.isNullishDimension)(e),l=(0,n.isNullishDimension)(t);if(i&&l)return this;if(i?e=t/this.height*this.width:l&&(t=e/this.width*this.height),u){let r=this.channels,o=this.toCanvas(),a=s(e,t).getContext("2d");return a.drawImage(o,0,0,e,t),new p(a.getImageData(0,0,e,t).data,e,t,4).convert(r)}{let r=this.toSharp();switch(o){case"box":case"hamming":("box"===o||"hamming"===o)&&(console.warn(`Resampling method ${o} is not yet supported. Using bilinear instead.`),o="bilinear");case"nearest":case"bilinear":case"bicubic":r=r.affine([e/this.width,0,0,t/this.height],{interpolator:o});break;case"lanczos":r=r.resize({width:e,height:t,fit:"fill",kernel:"lanczos3"});break;default:throw Error(`Resampling method ${o} is not supported.`)}return await a(r)}}async pad([e,t,r,o]){if(e=Math.max(e,0),t=Math.max(t,0),r=Math.max(r,0),o=Math.max(o,0),0===e&&0===t&&0===r&&0===o)return this;if(u){let a=this.channels,n=this.toCanvas(),i=this.width+e+t,l=this.height+r+o,c=s(i,l).getContext("2d");
11return c.drawImage(n,0,0,this.width,this.height,e,r,this.width,this.height),new p(c.getImageData(0,0,i,l).data,i,l,4).convert(a)}{let s=this.toSharp().extend({left:e,right:t,top:r,bottom:o});return await a(s)}}async crop([e,t,r,o]){if(e=Math.max(e,0),t=Math.max(t,0),r=Math.min(r,this.width-1),o=Math.min(o,this.height-1),0===e&&0===t&&r===this.width-1&&o===this.height-1)return this;let n=r-e+1,i=o-t+1;if(u){let r=this.channels,o=this.toCanvas(),a=s(n,i).getContext("2d");return a.drawImage(o,e,t,n,i,0,0,n,i),new p(a.getImageData(0,0,n,i).data,n,i,4).convert(r)}{let r=this.toSharp().extract({left:e,top:t,width:n,height:i});return await a(r)}}async center_crop(e,t){if(this.width===e&&this.height===t)return this;let r=(this.width-e)/2,o=(this.height-t)/2;if(u){let a=this.channels,n=this.toCanvas(),i=s(e,t).getContext("2d"),l=0,c=0,d=0,u=0;return r>=0?l=r:d=-r,o>=0?c=o:u=-o,i.drawImage(n,l,c,e,t,d,u,e,t),new p(i.getImageData(0,0,e,t).data,e,t,4).convert(a)}{let s=this.toSharp();if(r>=0&&o>=0)s=s.extract({left:Math.floor(r),top:Math.floor(o),width:e,height:t});else if(r<=0&&o<=0){let a=Math.floor(-o),n=Math.floor(-r);s=s.extend({top:a,left:n,right:e-this.width-n,bottom:t-this.height-a})}else{let a=[0,0],n=0;o<0?(a[0]=Math.floor(-o),a[1]=t-this.height-a[0]):n=Math.floor(o);let i=[0,0],l=0;r<0?(i[0]=Math.floor(-r),i[1]=e-this.width-i[0]):l=Math.floor(r),s=s.extend({top:a[0],bottom:a[1],left:i[0],right:i[1]}).extract({left:l,top:n,width:e,height:t})}return await a(s)}}async toBlob(e="image/png",t=1){if(!u)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 c.Tensor("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(!u)throw Error("toCanvas() is only supported in browser environments.");let e=this.clone().rgba(),t=s(e.width,e.height),r=new o(e.data,e.width,e.height);return t.getContext("2d").putImageData(r,0,0),t}split(){let{data:e,width:t,height:r,channels:s}=this,o=e.constructor,a=e.length/s,n=Array.from({length:s},()=>new o(a));for(let t=0;t<a;++t){let r=s*t;for(let o=0;o<s;++o)n[o][t]=e[r+o]}return n.map(e=>new p(e,t,r,1))}_update(e,t,r,s=null){return this.data=e,this.width=t,this.height=r,null!==s&&(this.channels=s),this}clone(){return new p(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(u){if(l.apis.IS_WEBWORKER_ENV)throw Error("Unable to save an image from a Web Worker.");let t=e.split(".").pop().toLowerCase(),r=_.get(t)??"image/png",s=await this.toBlob(r);(0,n.saveBlob)(e,s)}else if(l.apis.IS_FS_AVAILABLE){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(u)throw Error("toSharp() is only supported in server-side environments.");return d(this.data,{raw:{width:this.width,height:this.height,channels:this.channels}})}}let h=p.read.bind(p)},
11"./src/utils/maths.js":(e,t,r)=>{function s(e,[t,r,o],[a,n],i="bilinear",l=!1){let c=n/o,d=a/r,u=new e.constructor(a*n*t),m=r*o,_=a*n;for(let s=0;s<a;++s)for(let a=0;a<n;++a){let i=s*n+a,l=(a+.5)/c-.5,p=(s+.5)/d-.5,h=Math.floor(l),f=Math.floor(p),g=Math.min(h+1,o-1),M=Math.min(f+1,r-1),w=l-(h=Math.max(h,0)),x=p-(f=Math.max(f,0)),b=(1-w)*(1-x),T=w*(1-x),P=(1-w)*x,y=w*x,k=f*o,v=M*o,F=k+h,C=k+g,S=v+h,E=v+g;for(let r=0;r<t;++r){let t=r*m;u[r*_+i]=b*e[t+F]+T*e[t+C]+P*e[t+S]+y*e[t+E]}}return u}function o(e,t,r){let s=Array(r.length),o=Array(r.length);for(let e=r.length-1,a=1;e>=0;--e)o[e]=a,s[e]=t[r[e]],a*=s[e];let a=r.map((e,t)=>o[r.indexOf(t)]),n=new e.constructor(e.length);for(let r=0;r<e.length;++r){let s=0;for(let e=t.length-1,o=r;e>=0;--e)s+=o%t[e]*a[e],o=Math.floor(o/t[e]);n[s]=e[r]}return[n,s]}function a(e){let t=u(e)[0],r=e.map(e=>Math.exp(e-t)),s=r.reduce((e,t)=>e+t,0);return r.map(e=>e/s)}function n(e){let t=u(e)[0],r=0;for(let s=0;s<e.length;++s)r+=Math.exp(e[s]-t);let s=Math.log(r);return e.map(e=>e-t-s)}function i(e,t){let r=0;for(let s=0;s<e.length;++s)r+=e[s]*t[s];return r}function l(e,t){let r=i(e,t),s=c(e);return r/(s*c(t))}function c(e){return Math.sqrt(e.reduce((e,t)=>e+t*t,0))}function d(e){if(0===e.length)throw Error("Array must not be empty");let t=e[0],r=0;for(let s=1;s<e.length;++s)e[s]<t&&(t=e[s],r=s);return[t,r]}function u(e){if(0===e.length)throw Error("Array must not be empty");let t=e[0],r=0;for(let s=1;s<e.length;++s)e[s]>t&&(t=e[s],r=s);return[t,r]}function m(e){return e>0&&(e&e-1)==0}r.r(t),r.d(t,{FFT:()=>h,bankers_round:()=>M,cos_sim:()=>l,dot:()=>i,dynamic_time_warping:()=>w,interpolate_data:()=>s,log_softmax:()=>n,magnitude:()=>c,max:()=>u,medianFilter:()=>f,min:()=>d,permute_data:()=>o,round:()=>g,softmax:()=>a});class _{constructor(e){if(this.size=0|e,this.size<=1||!m(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 s,o,a=this._csize,n=1<<this._width,i=a/n<<1,l=this._bitrev;if(4===i)for(s=0,o=0;s<a;s+=i,++o){let r=l[o];this._singleTransform2(t,e,s,r,n)}else for(s=0,o=0;s<a;s+=i,++o){let a=l[o];this._singleTransform4(t,e,s,a,n,r)}let c=this.table;for(n>>=2;n>=2;n>>=2){let t=(i=a/n<<1)>>>2;for(s=0;s<a;s+=i){let o=s+t-1;for(let a=s,i=0;a<o;a+=2,i+=n){let s=a,o=s+t,n=o+t,l=n+t,d=e[s],u=e[s+1],m=e[o],_=e[o+1],p=e[n],h=e[n+1],f=e[l],g=e[l+1],M=c[i],w=r*c[i+1],x=m*M-_*w,b=m*w+_*M,T=c[2*i],P=r*c[2*i+1],y=p*T-h*P,k=p*P+h*T,v=c[3*i],F=r*c[3*i+1],C=f*v-g*F,S=f*F+g*v,E=d+y,A=u+k,L=d-y,I=u-k,j=x+C,z=b+S,D=r*(x-C),V=r*(b-S);e[s]=E+j,e[s+1]=A+z,e[o]=L+V,e[o+1]=I-D,e[n]=E-j,e[n+1]=A-z,e[l]=L-V,e[l+1]=I+D}}}}_singleTransform2(e,t,r,s,o){let a=e[s],n=e[s+1],i=e[s+o],l=e[s+o+1];t[r]=a+i,t[r+1]=n+l,t[r+2]=a-i,t[r+3]=n-l}_singleTransform4(e,t,r,s,o,a){let n=2*o,i=3*o,l=e[s],c=e[s+1],d=e[s+o],u=e[s+o+1],m=e[s+n],_=e[s+n+1],p=e[s+i],h=e[s+i+1],f=l+m,g=c+_,M=l-m,w=c-_,x=d+p,b=u+h,T=a*(d-p),P=a*(u-h);t[r]=f+x,t[r+1]=g+b,t[r+2]=M+P,t[r+3]=w-T,t[r+4]=f-x,t[r+5]=g-b,t[r+6]=M-P,t[r+7]=w+T}_realTransform4(e,t,r){let s,o,a=this._csize,n=1<<this._width,i=a/n<<1,l=this._bitrev;if(4===i)for(s=0,o=0;s<a;s+=i,++o){let r=l[o];this._singleRealTransform2(t,e,s,r>>>1,n>>>1)}else for(s=0,o=0;s<a;s+=i,++o){let a=l[o];this._singleRealTransform4(t,e,s,a>>>1,n>>>1,r)}let c=this.table;for(n>>=2;n>=2;n>>=2){let t=(i=a/n<<1)>>>1,o=t>>>1,l=o>>>1;for(s=0;s<a;s+=i)for(let a=0,i=0;a<=l;a+=2,i+=n){let n=s+a,d=n+o,u=d+o,m=u+o,_=e[n],p=e[n+1],h=e[d],f=e[d+1],g=e[u],M=e[u+1],w=e[m],x=e[m+1],b=c[i],T=r*c[i+1],P=h*b-f*T,y=h*T+f*b,k=c[2*i],v=r*c[2*i+1],F=g*k-M*v,C=g*v+M*k,S=c[3*i],E=r*c[3*i+1],A=w*S-x*E,L=w*E+x*S,I=_+F,j=p+C,z=_
11-F,D=p-C,V=P+A,O=y+L,N=r*(P-A),B=r*(y-L);if(e[n]=I+V,e[n+1]=j+O,e[d]=z+B,e[d+1]=D-N,0===a){e[u]=I-V,e[u+1]=j-O;continue}if(a===l)continue;let G=s+o-a,R=s+t-a;e[G]=z-r*B,e[G+1]=-D-r*N,e[R]=I-r*V,e[R+1]=-j+r*O}}let d=a>>>1;for(let t=2;t<d;t+=2)e[a-t]=e[t],e[a-t+1]=-e[t+1]}_singleRealTransform2(e,t,r,s,o){let a=e[s],n=e[s+o];t[r]=a+n,t[r+1]=0,t[r+2]=a-n,t[r+3]=0}_singleRealTransform4(e,t,r,s,o,a){let n=e[s],i=e[s+o],l=e[s+2*o],c=e[s+3*o],d=n+l,u=n-l,m=i+c,_=a*(i-c);t[r]=d+m,t[r+1]=0,t[r+2]=u,t[r+3]=-_,t[r+4]=d-m,t[r+5]=0,t[r+6]=u,t[r+7]=_}}class p{constructor(e){let t=2*(e-1),r=2*(2*e-1),s=2**Math.ceil(Math.log2(r));this.bufferSize=s,this._a=t;let o=new Float64Array(r),a=new Float64Array(s);this._chirpBuffer=new Float64Array(s),this._buffer1=new Float64Array(s),this._buffer2=new Float64Array(s),this._outBuffer1=new Float64Array(s),this._outBuffer2=new Float64Array(s);let n=-2*Math.PI/e,i=Math.cos(n),l=Math.sin(n);for(let t=0;t<r>>1;++t){let r=(t+1-e)**2/2,s=Math.sqrt(i**2+l**2)**r,n=r*Math.atan2(l,i),c=2*t;o[c]=s*Math.cos(n),o[c+1]=s*Math.sin(n),a[c]=o[c],a[c+1]=-o[c+1]}this._slicedChirpBuffer=o.subarray(t,r),this._f=new _(s>>1),this._f.transform(this._chirpBuffer,a)}_transform(e,t,r){let s=this._buffer1,o=this._buffer2,a=this._outBuffer1,n=this._outBuffer2,i=this._chirpBuffer,l=this._slicedChirpBuffer,c=this._a;if(r)for(let e=0;e<l.length;e+=2){let r=e+1,o=t[e>>1];s[e]=o*l[e],s[r]=o*l[r]}else for(let e=0;e<l.length;e+=2){let r=e+1;s[e]=t[e]*l[e]-t[r]*l[r],s[r]=t[e]*l[r]+t[r]*l[e]}this._f.transform(a,s);for(let e=0;e<i.length;e+=2){let t=e+1;o[e]=a[e]*i[e]-a[t]*i[t],o[t]=a[e]*i[t]+a[t]*i[e]}this._f.inverseTransform(n,o);for(let t=0;t<n.length;t+=2){let r=n[t+c],s=n[t+c+1],o=l[t],a=l[t+1];e[t]=r*o-s*a,e[t+1]=r*a+s*o}}transform(e,t){this._transform(e,t,!1)}realTransform(e,t){this._transform(e,t,!0)}}class h{constructor(e){this.fft_length=e,this.isPowerOfTwo=m(e),this.isPowerOfTwo?(this.fft=new _(e),this.outputBufferSize=2*e):(this.fft=new p(e),this.outputBufferSize=this.fft.bufferSize)}realTransform(e,t){this.fft.realTransform(e,t)}transform(e,t){this.fft.transform(e,t)}}function f(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),s=new e.constructor(t),o=Math.floor(t/2);for(let t=0;t<e.length;++t){let a=0;for(let r=-o;r<=o;++r){let o=t+r;o<0?o=Math.abs(o):o>=e.length&&(o=2*(e.length-1)-o),s[a++]=e[o]}s.sort(),r[t]=s[o]}return r}function g(e,t){let r=Math.pow(10,t);return Math.round(e*r)/r}function M(e){let t=Math.round(e);return Math.abs(e)%1==.5?t%2==0?t:t-1:t}function w(e){let t=e.length,r=e[0].length,s=[t+1,r+1],o=Array.from({length:s[0]},()=>Array(s[1]).fill(1/0));o[0][0]=0;let a=Array.from({length:s[0]},()=>Array(s[1]).fill(-1));for(let t=1;t<s[1];++t)for(let r=1;r<s[0];++r){let s,n,i=o[r-1][t-1],l=o[r-1][t],c=o[r][t-1];i<l&&i<c?(s=i,n=0):l<i&&l<c?(s=l,n=1):(s=c,n=2),o[r][t]=e[r-1][t-1]+s,a[r][t]=n}for(let e=0;e<s[1];++e)a[0][e]=2;for(let e=0;e<s[0];++e)a[e][0]=1;let n=t,i=r,l=[],c=[];for(;n>0||i>0;)switch(l.push(n-1),c.push(i-1),a[n][i]){case 0:--n,--i;break;case 1:--n;break;case 2:--i;break;default:throw Error(`Internal error in dynamic time warping. Unexpected trace[${n}, ${i}]. Please file a bug report.`)}return l.reverse(),c.reverse(),[l,c]}},
11"./src/utils/tensor.js":(e,t,r)=>{r.r(t),r.d(t,{DataTypeMap:()=>n,Tensor:()=>i,cat:()=>b,full:()=>F,full_like:()=>C,interpolate:()=>c,interpolate_4d:()=>d,layer_norm:()=>g,matmul:()=>u,mean:()=>k,mean_pooling:()=>f,ones:()=>S,ones_like:()=>E,permute:()=>l,quantize_embeddings:()=>j,rand:()=>I,rfft:()=>m,slice:()=>h,stack:()=>T,std_mean:()=>y,topk:()=>_,zeros:()=>A,zeros_like:()=>L});var s=r("./src/utils/maths.js"),o=r("./src/backends/onnx.js"),a=r("./src/ops/registry.js");let n=Object.freeze({float32:Float32Array,float16:"undefined"!=typeof Float16Array?Float16Array:Uint16Array,float64:Float64Array,string:Array,int8:Int8Array,uint8:Uint8Array,int16:Int16Array,uint16:Uint16Array,int32:Int32Array,uint32:Uint32Array,int64:BigInt64Array,uint64:BigUint64Array,bool:Uint8Array,uint4:Uint8Array,int4:Int8Array});class i{get dims(){return this.ort_tensor.dims}set dims(e){this.ort_tensor.dims=e}get type(){return this.ort_tensor.type}get data(){return this.ort_tensor.data}get size(){return this.ort_tensor.size}get location(){return this.ort_tensor.location}ort_tensor;constructor(...e){return(0,o.isONNXTensor)(e[0])?this.ort_tensor=e[0]:this.ort_tensor=new o.Tensor(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})}dispose(){this.ort_tensor.dispose()}*[Symbol.iterator](){let[e,...t]=this.dims;if(t.length>0){let r=t.reduce((e,t)=>e*t);for(let s=0;s<e;++s)yield this._subarray(s,r,t)}else yield*this.data}_getitem(e){let[t,...r]=this.dims;if(e=x(e,t),!(r.length>0))return new i(this.type,[this.data[e]],r);{let t=r.reduce((e,t)=>e*t);return this._subarray(e,t,r)}}indexOf(e){let t=this.data;for(let r=0;r<t.length;++r)if(t[r]==e)return r;return -1}_subarray(e,t,r){let s=e*t,o=(e+1)*t,a="subarray"in this.data?this.data.subarray(s,o):this.data.slice(s,o);return new i(this.type,a,r)}item(){let e=this.data;if(1!==e.length)throw Error(`a Tensor with ${e.length} elements cannot be converted to Scalar`);return e[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 s=e;for(let e=t.length-1;e>=0;e--)s=s.reduce((r,s)=>{let o=r[r.length-1];return o.length<t[e]?o.push(s):r.push([s]),r},[[]]);return s[0]}(this.data,this.dims)}sigmoid(){return this.clone().sigmoid_()}sigmoid_(){let e=this.data;for(let t=0;t<e.length;++t)e[t]=1/(1+Math.exp(-e[t]));return this}map(e){return this.clone().map_(e)}map_(e){let t=this.data;for(let r=0;r<t.length;++r)t[r]=e(t[r],r,t);return this}mul(e){return this.clone().mul_(e)}mul_(e){let t=this.data;for(let r=0;r<t.length;++r)t[r]*=e;return this}div(e){return this.clone().div_(e)}div_(e){let t=this.data;for(let r=0;r<t.length;++r)t[r]/=e;return this}add(e){return this.clone().add_(e)}add_(e){let t=this.data;for(let r=0;r<t.length;++r)t[r]+=e;return this}sub(e){return this.clone().sub_(e)}sub_(e){let t=this.data;for(let r=0;r<t.length;++r)t[r]-=e;return this}clone(){return new i(this.type,this.data.slice(),this.dims.slice())}slice(...e){let t=[],r=[];for(let s=0;s<this.dims.length;++s){let o=e[s];if(null==o)r.push([0,this.dims[s]]),t.push(this.dims[s]);else if("number"==typeof o)o=x(o,this.dims[s],s),r.push([o,o+1]);else if(Array.isArray(o)&&2===o.length){let[e,a]=o;if((e=null===e?0:x(e,this.dims[s],s,!1))>(a=null===a?this.dims[s]:x(a,this.dims[s],s,!1)))throw Error(`Invalid slice: ${o}`);let n=[Math.max(e,0),Math.min(a,this.dims[s])];
11r.push(n),t.push(n[1]-n[0])}else throw Error(`Invalid slice: ${o}`)}let s=r.map(([e,t])=>t-e),o=s.reduce((e,t)=>e*t),a=this.data,n=new a.constructor(o),l=this.stride(),c=!0;for(let e=1;e<s.length;++e)if(0!==r[e][0]||r[e][1]!==this.dims[e]){c=!1;break}if(c){let e=r[0][0]*l[0],t=r[0][1]*l[0];if(ArrayBuffer.isView(a))n.set(a.subarray(e,t));else if(Array.isArray(a)){let r=a.slice(e,t);for(let e=0;e<r.length;++e)n[e]=r[e]}else throw Error("Unsupported data type for slicing")}else for(let e=0;e<o;++e){let t=0;for(let o=s.length-1,a=e;o>=0;--o){let e=s[o];t+=(a%e+r[o][0])*l[o],a=Math.floor(a/e)}n[e]=a[t]}return new i(this.type,n,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}`);let s=this.data,o=(t,r)=>t+r**e;if(null===t){let t=s.reduce(o,0)**(1/e);return new i(this.type,[t],[])}let[a,n,l]=P(o,this,t,r);if(1!==e)for(let t=0;t<n.length;++t)n[t]=n[t]**(1/e);return new i(a,n,l)}normalize_(e=2,t=1){t=x(t,this.dims.length);let r=this.norm(e,t,!0),s=this.data,o=r.data;for(let e=0;e<s.length;++e){let r=0;for(let s=this.dims.length-1,o=e,a=1;s>=0;--s){let e=this.dims[s];s!==t&&(r+=o%e*a,a*=this.dims[s]),o=Math.floor(o/e)}s[e]/=o[r]}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,s=1;r>=0;--r)t[r]=s,s*=e[r];return t}(this.dims)}squeeze(e=null){return new i(this.type,this.data,M(this.dims,e))}squeeze_(e=null){return this.dims=M(this.dims,e),this}unsqueeze(e=null){return new i(this.type,this.data,w(this.dims,e))}unsqueeze_(e=null){return this.dims=w(this.dims,e),this}flatten_(e=0,t=-1){t=(t+this.dims.length)%this.dims.length;let r=this.dims.slice(0,e),s=this.dims.slice(e,t+1),o=this.dims.slice(t+1);return this.dims=[...r,s.reduce((e,t)=>e*t,1),...o],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}let r=this.data;if(-1!==t){let s=e.reduce((e,r,s)=>s!==t?e*r:e,1);e[t]=r.length/s}return new i(this.type,r,e)}neg_(){let e=this.data;for(let t=0;t<e.length;++t)e[t]=-e[t];return this}neg(){return this.clone().neg_()}gt(e){let t=new Uint8Array(this.data.length),r=this.data;for(let s=0;s<r.length;++s)t[s]=+(r[s]>e);return new i("bool",t,this.dims)}lt(e){let t=new Uint8Array(this.data.length),r=this.data;for(let s=0;s<r.length;++s)t[s]=+(r[s]<e);return new i("bool",t,this.dims)}clamp_(e,t){let r=this.data;for(let s=0;s<r.length;++s)r[s]=Math.min(Math.max(r[s],e),t);return this}clamp(e,t){return this.clone().clamp_(e,t)}round_(){let e=this.data;for(let t=0;t<e.length;++t)e[t]=Math.round(e[t]);return this}round(){return this.clone().round_()}mean(e=null,t=!1){return k(this,e,t)}min(e=null,t=!1){if(null===e){let e=(0,s.min)(this.data)[0];return new i(this.type,[e],[])}let[r,o,a]=P((e,t)=>Math.min(e,t),this,e,t,1/0);return new i(r,o,a)}max(e=null,t=!1){if(null===e){let e=(0,s.max)(this.data)[0];return new i(this.type,[e],[])}let[r,o,a]=P((e,t)=>Math.max(e,t),this,e,t,-1/0);return new i(r,o,a)}argmin(e=null,t=!1){if(null!==e)throw Error("`dim !== null` not yet implemented.");return new i("int64",[BigInt((0,s.min)(this.data)[1])],[])}argmax(e=null,t=!1){if(null!==e)throw Error("`dim !== null` not yet implemented.");return new i("int64",[BigInt((0,s.max)(this.data)[1])],[])}to(e){let t;if(this.type===e)return this;if(!n.hasOwnProperty(e))throw Error(`Unsupported type: ${e}`);let r=["int64","uint64"].includes(this.type),s=["int64","uint64"].includes(e);return r&&!s?t=Number:!r&&s&&(t=BigInt),new i(e,n[e].from(this.data,t),this.dims)}}function l(e,t){let[r,o]=(0,s.permute_data)(e.data,e.dims,t);return new i(e.type,r,o)}function c(e,[t,r],o="bilinear",a=!1){let n=e.dims.at(-3)??1,l=e.dims.at(-2),d=e.dims.at(-1),u=(0,s.interpolate_data)(e.data,[n,l,d],[t,r],o,a);return new i(e.type,u,[n,t,r])}async function d(e,{size:t=null,mode:r="bilinear"}={}){let s,o;if(4!==e.dims.length)throw Error("`interpolate_4d` currently only supports 4D input.");if(!t)throw Error("`interpolate_4d` requires a `size` argument.");if(2===t.length)s=[...e.dims.slice(0,2),...t];else if(3===t.length)s=[e.dims[0],...t];else if(4===t.length)s=t;else throw Error("`size` must be of length 2, 3, or 4.");if("nearest"===r)o=await a.TensorOpRegistry.nearest_interpolate_4d;else if("bilinear"===r)o=await a.TensorOpRegistry.bilinear_interpolate_4d;else if("bicubic"===r)o=await a.TensorOpRegistry.bicubic_interpolate_4d;else throw Error(`Unsupported mode: ${r}`);let n=new i("int64",new BigInt64Array(s.map(BigInt)),[s.length]);return await o({x:e,s:n})}async function u(e,t){let r=await a.TensorOpRegistry.matmul;return await r({a:e,b:t})}async function m(e,t){let r=await a.TensorOpRegistry.rfft;return await r({x:e,a:t})}async function _(e,t){let r=await a.TensorOpRegistry.top_k;return t=null==t?e.dims.at(-1):Math.min(t,e.dims.at(-1)),await r({x:e,k:new i("int64",[BigInt(t)],[1])})}let p=e=>new i("int64",e,[e.length]);async function h(e,t,r,s,o){let n=await a.TensorOpRegistry.slice;return await n({x:e,s:p(t),e:p(r),a:p(s),t:p(o??Array(s.length).fill(1))})}function f(e,t){let r=e.data,s=t.data,o=[e.dims[0],e.dims[2]],a=new r.constructor(o[0]*o[1]),[n,l,c]=e.dims,d=0;for(let e=0;e<n;++e){let t=e*c*l;for(let o=0;o<c;++o){let n=0,i=0,u=e*l,m=t+o;for(let e=0;e<l;++e){let t=Number(s[u+e]);i+=t,n+=r[m+e*c]*t}let _=n/i;a[d++]=_}}return new i(e.type,a,o)}function g(e,t,{eps:r=1e-5}={}){if(2!==e.dims.length)throw Error("`layer_norm` currently only supports 2D input.");let[s,o]=e.dims;if(1!==t.length&&t[0]!==o)throw Error("`normalized_shape` must be a 1D array with shape `[input.dims[1]]`.");let[a,n]=y(e,1,0,!0),l=a.data,c=n.data,d=e.data,u=new d.constructor(d.length);for(let e=0;e<s;++e){let t=e*o;for(let s=0;s<o;++s){let o=t+s;u[o]=(d[o]-c[e])/(l[e]+r)}}return new i(e.type,u,e.dims)}function M(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 w(e,t){return t=x(t,e.length+1),(e=e.slice()).splice(t,0,1),e}function x(e,t,r=null,s=!0){if(e<-t||e>=t)if(!s)return e<-t?0:t;else 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 b(e,t=0){t=x(t,e[0].dims.length);let r=e[0].dims.slice();r[t]=e.reduce((e,r)=>e+r.dims[t],0);let s=r.reduce((e,t)=>
11e*t,1),o=new e[0].data.constructor(s),a=e[0].type;if(0===t){let t=0;for(let r of e){let e=r.data;o.set(e,t),t+=e.length}}else{let s=0;for(let a=0;a<e.length;++a){let{data:n,dims:i}=e[a];for(let e=0;e<n.length;++e){let a=0;for(let o=i.length-1,n=e,l=1;o>=0;--o){let e=i[o],c=n%e;o===t&&(c+=s),a+=c*l,l*=r[o],n=Math.floor(n/e)}o[a]=n[e]}s+=i[t]}}return new i(a,o,r)}function T(e,t=0){return b(e.map(e=>e.unsqueeze(t)),t)}function P(e,t,r=null,s=!1,o=null){let a=t.data,n=t.dims;r=x(r,n.length);let i=n.slice();i[r]=1;let l=new a.constructor(a.length/n[r]);null!==o&&l.fill(o);for(let t=0;t<a.length;++t){let s=0;for(let e=n.length-1,o=t,a=1;e>=0;--e){let t=n[e];e!==r&&(s+=o%t*a,a*=i[e]),o=Math.floor(o/t)}l[s]=e(l[s],a[t],t,s)}return s||i.splice(r,1),[t.type,l,i]}function y(e,t=null,r=1,s=!1){let o=e.data,a=e.dims;if(null===t){let t=o.reduce((e,t)=>e+t,0)/o.length,s=Math.sqrt(o.reduce((e,r)=>e+(r-t)**2,0)/(o.length-r)),a=new i(e.type,[t],[]);return[new i(e.type,[s],[]),a]}let n=k(e,t=x(t,a.length),s),l=n.data,[c,d,u]=P((e,t,r,s)=>e+(t-l[s])**2,e,t,s);for(let e=0;e<d.length;++e)d[e]=Math.sqrt(d[e]/(a[t]-r));return[new i(c,d,u),n]}function k(e,t=null,r=!1){let s=e.dims,o=e.data;if(null===t){let t=o.reduce((e,t)=>e+t,0);return new i(e.type,[t/o.length],[])}let[a,n,l]=P((e,t)=>e+t,e,t=x(t,s.length),r);if(1!==s[t])for(let e=0;e<n.length;++e)n[e]/=s[t];return new i(a,n,l)}function v(e,t,r,s){return new i(r,new s(e.reduce((e,t)=>e*t,1)).fill(t),e)}function F(e,t){let r,s;if("number"==typeof t)r="float32",s=Float32Array;else if("bigint"==typeof t)r="int64",s=BigInt64Array;else if("boolean"==typeof t)r="bool",s=Uint8Array;else throw Error(`Unsupported data type: ${typeof t}`);return v(e,t,r,s)}function C(e,t){return F(e.dims,t)}function S(e){return v(e,1n,"int64",BigInt64Array)}function E(e){return S(e.dims)}function A(e){return v(e,0n,"int64",BigInt64Array)}function L(e){return A(e.dims)}function I(e){let t=e.reduce((e,t)=>e*t,1);return new i("float32",Float32Array.from({length:t},()=>Math.random()),e)}function j(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'");let r="binary"===t,s=r?Int8Array:Uint8Array,o=e.data,a=new s(o.length/8);for(let e=0;e<o.length;++e){let t=+(o[e]>0),s=Math.floor(e/8),n=e%8;a[s]|=t<<7-n,r&&0===n&&(a[s]-=128)}return new i(r?"int8":"uint8",a,[e.dims[0],e.dims[1]/8])}},
11"./src/utils/video.js":(e,t,r)=>{r.r(t),r.d(t,{RawVideo:()=>n,RawVideoFrame:()=>a,load_video:()=>i});var s=r("./src/utils/image.js"),o=r("./src/env.js");class a{constructor(e,t){this.image=e,this.timestamp=t}}class n{constructor(e,t){e.length>0&&e[0]instanceof s.RawImage&&(e=e.map((r,s)=>new a(r,(s+1)/(e.length+1)*t))),this.frames=e,this.duration=t}get width(){return this.frames[0].image.width}get height(){return this.frames[0].image.height}get fps(){return this.frames.length/this.duration}}async function i(e,{num_frames:t=null,fps:r=null}={}){let l,c;if(!o.apis.IS_BROWSER_ENV)throw Error("`load_video` is currently only supported in browser environments.");if(null==t&&null==r)throw Error("Either num_frames or fps must be provided.");let d=[],u=document.createElement("video");if(u.crossOrigin="anonymous",u.muted=!0,"string"==typeof e)u.src=e;else if(e instanceof Blob)u.src=URL.createObjectURL(e);else if(e instanceof HTMLVideoElement)u.src=e.src;else throw Error("Invalid URL or video element provided.");if(await new Promise(e=>u.onloadedmetadata=e),u.seekable.start(0)===u.seekable.end(0)){let e=await fetch(u.src),t=await e.blob();u.src=URL.createObjectURL(t),await new Promise(e=>u.onloadedmetadata=e)}let m=u.duration;null!=t?(l=t,c=1===t?0:m/(t-1)):l=Math.floor(m/(c=1/r));let _=[];for(let e=0;e<l;++e)_.push(1===t?m/2:e*c);let p=document.createElement("canvas");p.width=u.videoWidth,p.height=u.videoHeight;let h=p.getContext("2d",{willReadFrequently:!0});for(let e of _){u.currentTime=e,await new Promise(e=>{u.onseeked=e}),h.drawImage(u,0,0,p.width,p.height);let t=h.getImageData(0,0,p.width,p.height),r=new a(new s.RawImage(t.data,p.width,p.height,4),e);d.push(r)}return u.remove(),new n(d,m)}}
11},l={};function c(e){var t=l[e];if(void 0!==t)return t.exports;var r=l[e]={exports:{}};return i[e](r,r.exports,c),r.exports}(()=>{var e,t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__;c.t=function(r,s){if(1&s&&(r=this(r)),8&s||"object"==typeof r&&r&&(4&s&&r.__esModule||16&s&&"function"==typeof r.then))return r;var o=Object.create(null);c.r(o);var a={};e=e||[null,t({}),t([]),t(t)];for(var n=2&s&&r;"object"==typeof n&&!~e.indexOf(n);n=t(n))Object.getOwnPropertyNames(n).forEach(e=>a[e]=()=>r[e]);return a.default=()=>r,c.d(o,a),o}})(),c.d=(e,t)=>{for(var r in t)c.o(t,r)&&!c.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},c.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var d={};(()=>{c.r(d),c.d(d,{ASTFeatureExtractor:()=>_.ASTFeatureExtractor,ASTForAudioClassification:()=>r.ASTForAudioClassification,ASTModel:()=>r.ASTModel,ASTPreTrainedModel:()=>r.ASTPreTrainedModel,AlbertForMaskedLM:()=>r.AlbertForMaskedLM,AlbertForQuestionAnswering:()=>r.AlbertForQuestionAnswering,AlbertForSequenceClassification:()=>r.AlbertForSequenceClassification,AlbertModel:()=>r.AlbertModel,AlbertPreTrainedModel:()=>r.AlbertPreTrainedModel,AlbertTokenizer:()=>s.AlbertTokenizer,ArceeForCausalLM:()=>r.ArceeForCausalLM,ArceeModel:()=>r.ArceeModel,ArceePreTrainedModel:()=>r.ArceePreTrainedModel,AudioClassificationPipeline:()=>t.AudioClassificationPipeline,AutoConfig:()=>o.AutoConfig,AutoFeatureExtractor:()=>p.AutoFeatureExtractor,AutoImageProcessor:()=>g.AutoImageProcessor,AutoModel:()=>r.AutoModel,AutoModelForAudioClassification:()=>r.AutoModelForAudioClassification,AutoModelForAudioFrameClassification:()=>r.AutoModelForAudioFrameClassification,AutoModelForAudioTextToText:()=>r.AutoModelForAudioTextToText,AutoModelForCTC:()=>r.AutoModelForCTC,AutoModelForCausalLM:()=>r.AutoModelForCausalLM,AutoModelForDepthEstimation:()=>r.AutoModelForDepthEstimation,AutoModelForDocumentQuestionAnswering:()=>r.AutoModelForDocumentQuestionAnswering,AutoModelForImageClassification:()=>r.AutoModelForImageClassification,AutoModelForImageFeatureExtraction:()=>r.AutoModelForImageFeatureExtraction,AutoModelForImageMatting:()=>r.AutoModelForImageMatting,AutoModelForImageSegmentation:()=>r.AutoModelForImageSegmentation,AutoModelForImageTextToText:()=>r.AutoModelForImageTextToText,AutoModelForImageToImage:()=>r.AutoModelForImageToImage,AutoModelForMaskGeneration:()=>r.AutoModelForMaskGeneration,AutoModelForMaskedLM:()=>r.AutoModelForMaskedLM,AutoModelForNormalEstimation:()=>r.AutoModelForNormalEstimation,AutoModelForObjectDetection:()=>r.AutoModelForObjectDetection,AutoModelForPoseEstimation:()=>r.AutoModelForPoseEstimation,AutoModelForQuestionAnswering:()=>r.AutoModelForQuestionAnswering,AutoModelForSemanticSegmentation:()=>r.AutoModelForSemanticSegmentation,AutoModelForSeq2SeqLM:()=>r.AutoModelForSeq2SeqLM,AutoModelForSequenceClassification:()=>r.AutoModelForSequenceClassification,AutoModelForSpeechSeq2Seq:()=>r.AutoModelForSpeechSeq2Seq,AutoModelForTextToSpectrogram:()=>r.AutoModelForTextToSpectrogram,AutoModelForTextToWaveform:()=>r.AutoModelForTextToWaveform,AutoModelForTokenClassification:()=>r.AutoModelForTokenClassification,AutoModelForUniversalSegmentation:()=>r.AutoModelForUniversalSegmentation,AutoModelForVision2Seq:()=>r.AutoModelForVision2Seq,AutoModelForXVector:()=>r.AutoModelForXVector,AutoModelForZeroShotObjectDetection:()=>r.AutoModelForZeroShotObjectDetection,AutoProcessor:()=>x.AutoProcessor,AutoTokenizer:()=>s.AutoTokenizer,AutomaticSpeechRecognitionPipeline:()=>t.AutomaticSpeechRecognitionPipeline,BackgroundRemovalPipeline:()=>t.BackgroundRemovalPipeline,BartForConditionalGeneration:()=>r.BartForConditionalGeneration,BartForSequenceClassification:()=>r.BartForSequenceClassification,BartModel:()=>r.BartModel,BartPretrainedModel:()=>r.BartPretrainedModel,BartTokenizer:()=>s.BartTokenizer,BaseModelOutput:()=>r.BaseModelOutput,BaseStreamer:()=>b.BaseStreamer,BeitFeatureExtractor:()=>f.BeitFeatureExtractor,BeitForImageClassification:()=>
11r.BeitForImageClassification,BeitModel:()=>r.BeitModel,BeitPreTrainedModel:()=>r.BeitPreTrainedModel,BertForMaskedLM:()=>r.BertForMaskedLM,BertForQuestionAnswering:()=>r.BertForQuestionAnswering,BertForSequenceClassification:()=>r.BertForSequenceClassification,BertForTokenClassification:()=>r.BertForTokenClassification,BertModel:()=>r.BertModel,BertPreTrainedModel:()=>r.BertPreTrainedModel,BertTokenizer:()=>s.BertTokenizer,BitImageProcessor:()=>f.BitImageProcessor,BlenderbotForConditionalGeneration:()=>r.BlenderbotForConditionalGeneration,BlenderbotModel:()=>r.BlenderbotModel,BlenderbotPreTrainedModel:()=>r.BlenderbotPreTrainedModel,BlenderbotSmallForConditionalGeneration:()=>r.BlenderbotSmallForConditionalGeneration,BlenderbotSmallModel:()=>r.BlenderbotSmallModel,BlenderbotSmallPreTrainedModel:()=>r.BlenderbotSmallPreTrainedModel,BlenderbotSmallTokenizer:()=>s.BlenderbotSmallTokenizer,BlenderbotTokenizer:()=>s.BlenderbotTokenizer,BloomForCausalLM:()=>r.BloomForCausalLM,BloomModel:()=>r.BloomModel,BloomPreTrainedModel:()=>r.BloomPreTrainedModel,BloomTokenizer:()=>s.BloomTokenizer,CLIPFeatureExtractor:()=>f.CLIPFeatureExtractor,CLIPImageProcessor:()=>f.CLIPImageProcessor,CLIPModel:()=>r.CLIPModel,CLIPPreTrainedModel:()=>r.CLIPPreTrainedModel,CLIPSegForImageSegmentation:()=>r.CLIPSegForImageSegmentation,CLIPSegModel:()=>r.CLIPSegModel,CLIPSegPreTrainedModel:()=>r.CLIPSegPreTrainedModel,CLIPTextModel:()=>r.CLIPTextModel,CLIPTextModelWithProjection:()=>r.CLIPTextModelWithProjection,CLIPTokenizer:()=>s.CLIPTokenizer,CLIPVisionModel:()=>r.CLIPVisionModel,CLIPVisionModelWithProjection:()=>r.CLIPVisionModelWithProjection,CamembertForMaskedLM:()=>r.CamembertForMaskedLM,CamembertForQuestionAnswering:()=>r.CamembertForQuestionAnswering,CamembertForSequenceClassification:()=>r.CamembertForSequenceClassification,CamembertForTokenClassification:()=>r.CamembertForTokenClassification,CamembertModel:()=>r.CamembertModel,CamembertPreTrainedModel:()=>r.CamembertPreTrainedModel,CamembertTokenizer:()=>s.CamembertTokenizer,CausalLMOutput:()=>r.CausalLMOutput,CausalLMOutputWithPast:()=>r.CausalLMOutputWithPast,ChineseCLIPFeatureExtractor:()=>f.ChineseCLIPFeatureExtractor,ChineseCLIPModel:()=>r.ChineseCLIPModel,ChineseCLIPPreTrainedModel:()=>r.ChineseCLIPPreTrainedModel,ClapAudioModelWithProjection:()=>r.ClapAudioModelWithProjection,ClapFeatureExtractor:()=>_.ClapFeatureExtractor,ClapModel:()=>r.ClapModel,ClapPreTrainedModel:()=>r.ClapPreTrainedModel,ClapTextModelWithProjection:()=>r.ClapTextModelWithProjection,ClassifierFreeGuidanceLogitsProcessor:()=>P.ClassifierFreeGuidanceLogitsProcessor,CodeGenForCausalLM:()=>r.CodeGenForCausalLM,CodeGenModel:()=>r.CodeGenModel,CodeGenPreTrainedModel:()=>r.CodeGenPreTrainedModel,CodeGenTokenizer:()=>s.CodeGenTokenizer,CodeLlamaTokenizer:()=>s.CodeLlamaTokenizer,CohereForCausalLM:()=>r.CohereForCausalLM,CohereModel:()=>r.CohereModel,CoherePreTrainedModel:()=>r.CoherePreTrainedModel,CohereTokenizer:()=>s.CohereTokenizer,ConvBertForMaskedLM:()=>r.ConvBertForMaskedLM,ConvBertForQuestionAnswering:()=>r.ConvBertForQuestionAnswering,ConvBertForSequenceClassification:()=>r.ConvBertForSequenceClassification,ConvBertForTokenClassification:()=>r.ConvBertForTokenClassification,ConvBertModel:()=>r.ConvBertModel,ConvBertPreTrainedModel:()=>r.ConvBertPreTrainedModel,ConvBertTokenizer:()=>s.ConvBertTokenizer,ConvNextFeatureExtractor:()=>f.ConvNextFeatureExtractor,ConvNextForImageClassification:()=>r.ConvNextForImageClassification,ConvNextImageProcessor:()=>f.ConvNextImageProcessor,ConvNextModel:()=>r.ConvNextModel,ConvNextPreTrainedModel:()=>r.ConvNextPreTrainedModel,ConvNextV2ForImageClassification:()=>r.ConvNextV2ForImageClassification,ConvNextV2Model:()=>r.ConvNextV2Model,ConvNextV2PreTrainedModel:()=>r.ConvNextV2PreTrainedModel,DFineForObjectDetection:()=>r.DFineForObjectDetection,DFineModel:()=>r.DFineModel,DFinePreTrainedModel:()=>r.DFinePreTrainedModel,DINOv3ConvNextModel:()=>r.DINOv3ConvNextModel,DINOv3ConvNextPreTrainedModel:()=>r.DINOv3ConvNextPreTrainedModel,DINOv3ViTImageProcessor:()=>f.DINOv3ViTImageProcessor,DINOv3ViTModel:()=>r.DINOv3ViTModel,DINOv3ViTPreTrainedModel:()=>r.DINOv3ViTPreTrainedModel,DPTFeatureExtractor:()=>f.DPTFeatureExtractor,DPTForDepthEstimation:()=>r.DPTForDepthEstimation,DPTImageProcessor:()=>f.DPTImageProcessor,DPTModel:()=>r.DPTModel,DPTPreTrainedModel:()=>r.DPTPreTrainedModel,DacDecoderModel:()=>r.DacDecoderModel,DacDecoderOutput:()=>r.DacDecoderOutput,DacEncoderModel:()=>r.DacEncoderModel,DacEncoderOutput:()=>r.DacEncoderOutput,DacFeatureExtractor:()=>_.DacFeatureExtractor,DacModel:()=>r.DacModel,DacPreTrainedModel:()=>r.DacPreTrainedModel,DataTypeMap:()=>l.DataTypeMap,DebertaForMaskedLM:()=>r.DebertaForMaskedLM,DebertaForQuestionAnswering:()=>r.DebertaForQuestionAnswering,DebertaForSequenceClassification:()=>r.DebertaForSequenceClassification,DebertaForTokenClassification:()=>r.DebertaForTokenClassification,DebertaModel:()=>r.DebertaModel,DebertaPreTrainedModel:()=>r.DebertaPreTrainedModel,DebertaTokenizer:()=>s.DebertaTokenizer,DebertaV2ForMaskedLM:()=>r.DebertaV2ForMaskedLM,DebertaV2ForQuestionAnswering:()=>r.DebertaV2ForQuestionAnswering,DebertaV2ForSequenceClassification:()=>r.DebertaV2ForSequenceClassification,DebertaV2ForTokenClassification:()=>r.DebertaV2ForTokenClassification,DebertaV2Model:()=>r.DebertaV2Model,DebertaV2PreTrainedModel:()=>r.DebertaV2PreTrainedModel,DebertaV2Tokenizer:()=>s.DebertaV2Tokenizer,DecisionTransformerModel:()=>r.DecisionTransformerModel,DecisionTransformerPreTrainedModel:()=>r.DecisionTransformerPreTrainedModel,DeiTFeatureExtractor:()=>f.DeiTFeatureExtractor,DeiTForImageClassification:()=>r.DeiTForImageClassification,DeiTImageProcessor:()=>f.DeiTImageProcessor,DeiTModel:()=>r.DeiTModel,DeiTPreTrainedModel:()=>r.DeiTPreTrainedModel,DepthAnythingForDepthEstimation:()=>r.DepthAnythingForDepthEstimation,DepthAnythingPreTrainedModel:()=>r.DepthAnythingPreTrainedModel,DepthEstimationPipeline:()=>t.DepthEstimationPipeline,DepthProForDepthEstimation:()=>r.DepthProForDepthEstimation,DepthProPreTrainedModel:()=>r.DepthProPreTrainedModel,DetrFeatureExtractor:()=>f.DetrFeatureExtractor,DetrForObjectDetection:()=>r.DetrForObjectDetection,DetrForSegmentation:()=>r.DetrForSegmentation,DetrImageProcessor:()=>f.DetrImageProcessor,DetrModel:()=>r.DetrModel,DetrObjectDetectionOutput:()=>r.DetrObjectDetectionOutput,DetrPreTrainedModel:()=>r.DetrPreTrainedModel,DetrSegmentationOutput:()=>r.DetrSegmentationOutput,Dinov2ForImageClassification:()=>r.Dinov2ForImageClassification,Dinov2Model:()=>r.Dinov2Model,Dinov2PreTrainedModel:()=>r.Dinov2PreTrainedModel,Dinov2WithRegistersForImageClassification:()=>r.Dinov2WithRegistersForImageClassification,Dinov2WithRegistersModel:()=>r.Dinov2WithRegistersModel,Dinov2WithRegistersPreTrainedModel:()=>r.Dinov2WithRegistersPreTrainedModel,DistilBertForMaskedLM:()=>r.DistilBertForMaskedLM,DistilBertForQuestionAnswering:()=>r.DistilBertForQuestionAnswering,DistilBertForSequenceClassification:()=>r.DistilBertForSequenceClassification,DistilBertForTokenClassification:()=>r.DistilBertForTokenClassification,DistilBertModel:()=>r.DistilBertModel,DistilBertPreTrainedModel:()=>r.DistilBertPreTrainedModel,DistilBertTokenizer:()=>s.DistilBertTokenizer,DocumentQuestionAnsweringPipeline:()=>t.DocumentQuestionAnsweringPipeline,DonutFeatureExtractor:()=>f.DonutFeatureExtractor,DonutImageProcessor:()=>f.DonutImageProcessor,DonutSwinModel:()=>r.DonutSwinModel,DonutSwinPreTrainedModel:()=>r.DonutSwinPreTrainedModel,EfficientNetForImageClassification:()=>r.EfficientNetForImageClassification,EfficientNetImageProcessor:()=>f.EfficientNetImageProcessor,EfficientNetModel:()=>r.EfficientNetModel,EfficientNetPreTrainedModel:()=>
11r.EfficientNetPreTrainedModel,ElectraForMaskedLM:()=>r.ElectraForMaskedLM,ElectraForQuestionAnswering:()=>r.ElectraForQuestionAnswering,ElectraForSequenceClassification:()=>r.ElectraForSequenceClassification,ElectraForTokenClassification:()=>r.ElectraForTokenClassification,ElectraModel:()=>r.ElectraModel,ElectraPreTrainedModel:()=>r.ElectraPreTrainedModel,ElectraTokenizer:()=>s.ElectraTokenizer,EncodecFeatureExtractor:()=>_.EncodecFeatureExtractor,EosTokenCriteria:()=>T.EosTokenCriteria,Ernie4_5_ForCausalLM:()=>r.Ernie4_5_ForCausalLM,Ernie4_5_Model:()=>r.Ernie4_5_Model,Ernie4_5_PretrainedModel:()=>r.Ernie4_5_PretrainedModel,Ernie4_5_Tokenizer:()=>s.Ernie4_5_Tokenizer,EsmForMaskedLM:()=>r.EsmForMaskedLM,EsmForSequenceClassification:()=>r.EsmForSequenceClassification,EsmForTokenClassification:()=>r.EsmForTokenClassification,EsmModel:()=>r.EsmModel,EsmPreTrainedModel:()=>r.EsmPreTrainedModel,EsmTokenizer:()=>s.EsmTokenizer,ExaoneForCausalLM:()=>r.ExaoneForCausalLM,ExaoneModel:()=>r.ExaoneModel,ExaonePreTrainedModel:()=>r.ExaonePreTrainedModel,FFT:()=>u.FFT,FalconForCausalLM:()=>r.FalconForCausalLM,FalconModel:()=>r.FalconModel,FalconPreTrainedModel:()=>r.FalconPreTrainedModel,FalconTokenizer:()=>s.FalconTokenizer,FastViTForImageClassification:()=>r.FastViTForImageClassification,FastViTModel:()=>r.FastViTModel,FastViTPreTrainedModel:()=>r.FastViTPreTrainedModel,FeatureExtractionPipeline:()=>t.FeatureExtractionPipeline,FeatureExtractor:()=>m.FeatureExtractor,FillMaskPipeline:()=>t.FillMaskPipeline,Florence2ForConditionalGeneration:()=>r.Florence2ForConditionalGeneration,Florence2PreTrainedModel:()=>r.Florence2PreTrainedModel,Florence2Processor:()=>w.Florence2Processor,ForcedBOSTokenLogitsProcessor:()=>P.ForcedBOSTokenLogitsProcessor,ForcedEOSTokenLogitsProcessor:()=>P.ForcedEOSTokenLogitsProcessor,GLPNFeatureExtractor:()=>f.GLPNFeatureExtractor,GLPNForDepthEstimation:()=>r.GLPNForDepthEstimation,GLPNModel:()=>r.GLPNModel,GLPNPreTrainedModel:()=>r.GLPNPreTrainedModel,GPT2LMHeadModel:()=>r.GPT2LMHeadModel,GPT2Model:()=>r.GPT2Model,GPT2PreTrainedModel:()=>r.GPT2PreTrainedModel,GPT2Tokenizer:()=>s.GPT2Tokenizer,GPTBigCodeForCausalLM:()=>r.GPTBigCodeForCausalLM,GPTBigCodeModel:()=>r.GPTBigCodeModel,GPTBigCodePreTrainedModel:()=>r.GPTBigCodePreTrainedModel,GPTJForCausalLM:()=>r.GPTJForCausalLM,GPTJModel:()=>r.GPTJModel,GPTJPreTrainedModel:()=>r.GPTJPreTrainedModel,GPTNeoForCausalLM:()=>r.GPTNeoForCausalLM,GPTNeoModel:()=>r.GPTNeoModel,GPTNeoPreTrainedModel:()=>r.GPTNeoPreTrainedModel,GPTNeoXForCausalLM:()=>r.GPTNeoXForCausalLM,GPTNeoXModel:()=>r.GPTNeoXModel,GPTNeoXPreTrainedModel:()=>r.GPTNeoXPreTrainedModel,GPTNeoXTokenizer:()=>s.GPTNeoXTokenizer,Gemma2ForCausalLM:()=>r.Gemma2ForCausalLM,Gemma2Model:()=>r.Gemma2Model,Gemma2PreTrainedModel:()=>r.Gemma2PreTrainedModel,Gemma3ForCausalLM:()=>r.Gemma3ForCausalLM,Gemma3Model:()=>r.Gemma3Model,Gemma3PreTrainedModel:()=>r.Gemma3PreTrainedModel,Gemma3nAudioFeatureExtractor:()=>_.Gemma3nAudioFeatureExtractor,Gemma3nForConditionalGeneration:()=>r.Gemma3nForConditionalGeneration,Gemma3nPreTrainedModel:()=>r.Gemma3nPreTrainedModel,Gemma3nProcessor:()=>w.Gemma3nProcessor,GemmaForCausalLM:()=>r.GemmaForCausalLM,GemmaModel:()=>r.GemmaModel,GemmaPreTrainedModel:()=>r.GemmaPreTrainedModel,GemmaTokenizer:()=>s.GemmaTokenizer,GlmForCausalLM:()=>r.GlmForCausalLM,GlmModel:()=>r.GlmModel,GlmPreTrainedModel:()=>r.GlmPreTrainedModel,GraniteForCausalLM:()=>r.GraniteForCausalLM,GraniteModel:()=>r.GraniteModel,GraniteMoeHybridForCausalLM:()=>r.GraniteMoeHybridForCausalLM,GraniteMoeHybridModel:()=>r.GraniteMoeHybridModel,GraniteMoeHybridPreTrainedModel:()=>r.GraniteMoeHybridPreTrainedModel,GranitePreTrainedModel:()=>r.GranitePreTrainedModel,Grok1Tokenizer:()=>s.Grok1Tokenizer,GroundingDinoForObjectDetection:()=>r.GroundingDinoForObjectDetection,GroundingDinoImageProcessor:()=>f.GroundingDinoImageProcessor,GroundingDinoPreTrainedModel:()=>r.GroundingDinoPreTrainedModel,GroundingDinoProcessor:()=>w.GroundingDinoProcessor,GroupViTModel:()=>r.GroupViTModel,GroupViTPreTrainedModel:()=>r.GroupViTPreTrainedModel,HeliumForCausalLM:()=>r.HeliumForCausalLM,HeliumModel:()=>r.HeliumModel,HeliumPreTrainedModel:()=>r.HeliumPreTrainedModel,HerbertTokenizer:()=>s.HerbertTokenizer,HieraForImageClassification:()=>r.HieraForImageClassification,HieraModel:()=>r.HieraModel,HieraPreTrainedModel:()=>r.HieraPreTrainedModel,HubertForCTC:()=>r.HubertForCTC,HubertForSequenceClassification:()=>r.HubertForSequenceClassification,HubertModel:()=>r.HubertModel,HubertPreTrainedModel:()=>r.HubertPreTrainedModel,IJepaForImageClassification:()=>r.IJepaForImageClassification,IJepaModel:()=>r.IJepaModel,IJepaPreTrainedModel:()=>r.IJepaPreTrainedModel,Idefics3ForConditionalGeneration:()=>r.Idefics3ForConditionalGeneration,Idefics3ImageProcessor:()=>f.Idefics3ImageProcessor,Idefics3PreTrainedModel:()=>r.Idefics3PreTrainedModel,Idefics3Processor:()=>w.Idefics3Processor,ImageClassificationPipeline:()=>t.ImageClassificationPipeline,ImageFeatureExtractionPipeline:()=>t.ImageFeatureExtractionPipeline,ImageFeatureExtractor:()=>_.ImageFeatureExtractor,ImageMattingOutput:()=>r.ImageMattingOutput,ImageProcessor:()=>h.ImageProcessor,ImageSegmentationPipeline:()=>t.ImageSegmentationPipeline,ImageToImagePipeline:()=>t.ImageToImagePipeline,ImageToTextPipeline:()=>t.ImageToTextPipeline,InterruptableStoppingCriteria:()=>T.InterruptableStoppingCriteria,JAISLMHeadModel:()=>r.JAISLMHeadModel,JAISModel:()=>r.JAISModel,JAISPreTrainedModel:()=>r.JAISPreTrainedModel,JinaCLIPImageProcessor:()=>f.JinaCLIPImageProcessor,JinaCLIPModel:()=>r.JinaCLIPModel,JinaCLIPPreTrainedModel:()=>r.JinaCLIPPreTrainedModel,JinaCLIPProcessor:()=>w.JinaCLIPProcessor,JinaCLIPTextModel:()=>r.JinaCLIPTextModel,JinaCLIPVisionModel:()=>r.JinaCLIPVisionModel,Lfm2ForCausalLM:()=>r.Lfm2ForCausalLM,Lfm2Model:()=>r.Lfm2Model,Lfm2PreTrainedModel:()=>r.Lfm2PreTrainedModel,LiteWhisperForConditionalGeneration:()=>r.LiteWhisperForConditionalGeneration,Llama4ForCausalLM:()=>r.Llama4ForCausalLM,Llama4PreTrainedModel:()=>r.Llama4PreTrainedModel,LlamaForCausalLM:()=>r.LlamaForCausalLM,LlamaModel:()=>r.LlamaModel,LlamaPreTrainedModel:()=>r.LlamaPreTrainedModel,LlamaTokenizer:()=>s.LlamaTokenizer,LlavaForConditionalGeneration:()=>r.LlavaForConditionalGeneration,LlavaOnevisionForConditionalGeneration:()=>r.LlavaOnevisionForConditionalGeneration,LlavaOnevisionImageProcessor:()=>f.LlavaOnevisionImageProcessor,LlavaPreTrainedModel:()=>r.LlavaPreTrainedModel,LlavaProcessor:()=>w.LlavaProcessor,LlavaQwen2ForCausalLM:()=>r.LlavaQwen2ForCausalLM,LogitsProcessor:()=>P.LogitsProcessor,LogitsProcessorList:()=>P.LogitsProcessorList,LogitsWarper:()=>P.LogitsWarper,LongT5ForConditionalGeneration:()=>r.LongT5ForConditionalGeneration,LongT5Model:()=>r.LongT5Model,LongT5PreTrainedModel:()=>r.LongT5PreTrainedModel,M2M100ForConditionalGeneration:()=>r.M2M100ForConditionalGeneration,M2M100Model:()=>r.M2M100Model,M2M100PreTrainedModel:()=>r.M2M100PreTrainedModel,M2M100Tokenizer:()=>s.M2M100Tokenizer,MBart50Tokenizer:()=>s.MBart50Tokenizer,MBartForCausalLM:()=>r.MBartForCausalLM,MBartForConditionalGeneration:()=>r.MBartForConditionalGeneration,MBartForSequenceClassification:()=>r.MBartForSequenceClassification,MBartModel:()=>r.MBartModel,MBartPreTrainedModel:()=>r.MBartPreTrainedModel,MBartTokenizer:()=>s.MBartTokenizer,MPNetForMaskedLM:()=>r.MPNetForMaskedLM,MPNetForQuestionAnswering:()=>r.MPNetForQuestionAnswering,MPNetForSequenceClassification:()=>r.MPNetForSequenceClassification,MPNetForTokenClassification:()=>r.MPNetForTokenClassification,MPNetModel:()=>r.MPNetModel,MPNetPreTrainedModel:()=>r.MPNetPreTrainedModel,MPNetTokenizer:()=>
11s.MPNetTokenizer,MT5ForConditionalGeneration:()=>r.MT5ForConditionalGeneration,MT5Model:()=>r.MT5Model,MT5PreTrainedModel:()=>r.MT5PreTrainedModel,MarianMTModel:()=>r.MarianMTModel,MarianModel:()=>r.MarianModel,MarianPreTrainedModel:()=>r.MarianPreTrainedModel,MarianTokenizer:()=>s.MarianTokenizer,Mask2FormerImageProcessor:()=>f.Mask2FormerImageProcessor,MaskFormerFeatureExtractor:()=>f.MaskFormerFeatureExtractor,MaskFormerForInstanceSegmentation:()=>r.MaskFormerForInstanceSegmentation,MaskFormerImageProcessor:()=>f.MaskFormerImageProcessor,MaskFormerModel:()=>r.MaskFormerModel,MaskFormerPreTrainedModel:()=>r.MaskFormerPreTrainedModel,MaskedLMOutput:()=>r.MaskedLMOutput,MaxLengthCriteria:()=>T.MaxLengthCriteria,Metric3DForDepthEstimation:()=>r.Metric3DForDepthEstimation,Metric3DPreTrainedModel:()=>r.Metric3DPreTrainedModel,Metric3Dv2ForDepthEstimation:()=>r.Metric3Dv2ForDepthEstimation,Metric3Dv2PreTrainedModel:()=>r.Metric3Dv2PreTrainedModel,MgpstrForSceneTextRecognition:()=>r.MgpstrForSceneTextRecognition,MgpstrModelOutput:()=>r.MgpstrModelOutput,MgpstrPreTrainedModel:()=>r.MgpstrPreTrainedModel,MgpstrProcessor:()=>w.MgpstrProcessor,MgpstrTokenizer:()=>s.MgpstrTokenizer,MimiDecoderModel:()=>r.MimiDecoderModel,MimiDecoderOutput:()=>r.MimiDecoderOutput,MimiEncoderModel:()=>r.MimiEncoderModel,MimiEncoderOutput:()=>r.MimiEncoderOutput,MimiModel:()=>r.MimiModel,MimiPreTrainedModel:()=>r.MimiPreTrainedModel,MinLengthLogitsProcessor:()=>P.MinLengthLogitsProcessor,MinNewTokensLengthLogitsProcessor:()=>P.MinNewTokensLengthLogitsProcessor,MistralForCausalLM:()=>r.MistralForCausalLM,MistralModel:()=>r.MistralModel,MistralPreTrainedModel:()=>r.MistralPreTrainedModel,MobileBertForMaskedLM:()=>r.MobileBertForMaskedLM,MobileBertForQuestionAnswering:()=>r.MobileBertForQuestionAnswering,MobileBertForSequenceClassification:()=>r.MobileBertForSequenceClassification,MobileBertModel:()=>r.MobileBertModel,MobileBertPreTrainedModel:()=>r.MobileBertPreTrainedModel,MobileBertTokenizer:()=>s.MobileBertTokenizer,MobileLLMForCausalLM:()=>r.MobileLLMForCausalLM,MobileLLMModel:()=>r.MobileLLMModel,MobileLLMPreTrainedModel:()=>r.MobileLLMPreTrainedModel,MobileNetV1FeatureExtractor:()=>f.MobileNetV1FeatureExtractor,MobileNetV1ForImageClassification:()=>r.MobileNetV1ForImageClassification,MobileNetV1ForSemanticSegmentation:()=>r.MobileNetV1ForSemanticSegmentation,MobileNetV1ImageProcessor:()=>f.MobileNetV1ImageProcessor,MobileNetV1Model:()=>r.MobileNetV1Model,MobileNetV1PreTrainedModel:()=>r.MobileNetV1PreTrainedModel,MobileNetV2FeatureExtractor:()=>f.MobileNetV2FeatureExtractor,MobileNetV2ForImageClassification:()=>r.MobileNetV2ForImageClassification,MobileNetV2ForSemanticSegmentation:()=>r.MobileNetV2ForSemanticSegmentation,MobileNetV2ImageProcessor:()=>f.MobileNetV2ImageProcessor,MobileNetV2Model:()=>r.MobileNetV2Model,MobileNetV2PreTrainedModel:()=>r.MobileNetV2PreTrainedModel,MobileNetV3FeatureExtractor:()=>f.MobileNetV3FeatureExtractor,MobileNetV3ForImageClassification:()=>r.MobileNetV3ForImageClassification,MobileNetV3ForSemanticSegmentation:()=>r.MobileNetV3ForSemanticSegmentation,MobileNetV3ImageProcessor:()=>f.MobileNetV3ImageProcessor,MobileNetV3Model:()=>r.MobileNetV3Model,MobileNetV3PreTrainedModel:()=>r.MobileNetV3PreTrainedModel,MobileNetV4FeatureExtractor:()=>f.MobileNetV4FeatureExtractor,MobileNetV4ForImageClassification:()=>r.MobileNetV4ForImageClassification,MobileNetV4ForSemanticSegmentation:()=>r.MobileNetV4ForSemanticSegmentation,MobileNetV4ImageProcessor:()=>f.MobileNetV4ImageProcessor,MobileNetV4Model:()=>r.MobileNetV4Model,MobileNetV4PreTrainedModel:()=>r.MobileNetV4PreTrainedModel,MobileViTFeatureExtractor:()=>f.MobileViTFeatureExtractor,MobileViTForImageClassification:()=>r.MobileViTForImageClassification,MobileViTImageProcessor:()=>f.MobileViTImageProcessor,MobileViTModel:()=>r.MobileViTModel,MobileViTPreTrainedModel:()=>r.MobileViTPreTrainedModel,MobileViTV2ForImageClassification:()=>r.MobileViTV2ForImageClassification,MobileViTV2Model:()=>r.MobileViTV2Model,MobileViTV2PreTrainedModel:()=>r.MobileViTV2PreTrainedModel,ModelOutput:()=>r.ModelOutput,ModernBertDecoderForCausalLM:()=>r.ModernBertDecoderForCausalLM,ModernBertDecoderModel:()=>r.ModernBertDecoderModel,ModernBertDecoderPreTrainedModel:()=>r.ModernBertDecoderPreTrainedModel,ModernBertForMaskedLM:()=>r.ModernBertForMaskedLM,ModernBertForSequenceClassification:()=>r.ModernBertForSequenceClassification,ModernBertForTokenClassification:()=>r.ModernBertForTokenClassification,ModernBertModel:()=>r.ModernBertModel,ModernBertPreTrainedModel:()=>r.ModernBertPreTrainedModel,Moondream1ForConditionalGeneration:()=>r.Moondream1ForConditionalGeneration,MoonshineFeatureExtractor:()=>_.MoonshineFeatureExtractor,MoonshineForConditionalGeneration:()=>r.MoonshineForConditionalGeneration,MoonshineModel:()=>r.MoonshineModel,MoonshinePreTrainedModel:()=>r.MoonshinePreTrainedModel,MoonshineProcessor:()=>w.MoonshineProcessor,MptForCausalLM:()=>r.MptForCausalLM,MptModel:()=>r.MptModel,MptPreTrainedModel:()=>
11r.MptPreTrainedModel,MultiModalityCausalLM:()=>r.MultiModalityCausalLM,MultiModalityPreTrainedModel:()=>r.MultiModalityPreTrainedModel,MusicgenForCausalLM:()=>r.MusicgenForCausalLM,MusicgenForConditionalGeneration:()=>r.MusicgenForConditionalGeneration,MusicgenModel:()=>r.MusicgenModel,MusicgenPreTrainedModel:()=>r.MusicgenPreTrainedModel,NanoChatForCausalLM:()=>r.NanoChatForCausalLM,NanoChatModel:()=>r.NanoChatModel,NanoChatPreTrainedModel:()=>r.NanoChatPreTrainedModel,NeoBertForMaskedLM:()=>r.NeoBertForMaskedLM,NeoBertForQuestionAnswering:()=>r.NeoBertForQuestionAnswering,NeoBertForSequenceClassification:()=>r.NeoBertForSequenceClassification,NeoBertForTokenClassification:()=>r.NeoBertForTokenClassification,NeoBertModel:()=>r.NeoBertModel,NeoBertPreTrainedModel:()=>r.NeoBertPreTrainedModel,NllbTokenizer:()=>s.NllbTokenizer,NoBadWordsLogitsProcessor:()=>P.NoBadWordsLogitsProcessor,NoRepeatNGramLogitsProcessor:()=>P.NoRepeatNGramLogitsProcessor,NomicBertModel:()=>r.NomicBertModel,NomicBertPreTrainedModel:()=>r.NomicBertPreTrainedModel,NougatImageProcessor:()=>f.NougatImageProcessor,NougatTokenizer:()=>s.NougatTokenizer,OPTForCausalLM:()=>r.OPTForCausalLM,OPTModel:()=>r.OPTModel,OPTPreTrainedModel:()=>r.OPTPreTrainedModel,ObjectDetectionPipeline:()=>t.ObjectDetectionPipeline,Olmo2ForCausalLM:()=>r.Olmo2ForCausalLM,Olmo2Model:()=>r.Olmo2Model,Olmo2PreTrainedModel:()=>r.Olmo2PreTrainedModel,OlmoForCausalLM:()=>r.OlmoForCausalLM,OlmoModel:()=>r.OlmoModel,OlmoPreTrainedModel:()=>r.OlmoPreTrainedModel,OpenELMForCausalLM:()=>r.OpenELMForCausalLM,OpenELMModel:()=>r.OpenELMModel,OpenELMPreTrainedModel:()=>r.OpenELMPreTrainedModel,OwlViTFeatureExtractor:()=>f.OwlViTFeatureExtractor,OwlViTForObjectDetection:()=>r.OwlViTForObjectDetection,OwlViTImageProcessor:()=>f.OwlViTImageProcessor,OwlViTModel:()=>r.OwlViTModel,OwlViTPreTrainedModel:()=>r.OwlViTPreTrainedModel,OwlViTProcessor:()=>w.OwlViTProcessor,Owlv2ForObjectDetection:()=>r.Owlv2ForObjectDetection,Owlv2ImageProcessor:()=>f.Owlv2ImageProcessor,Owlv2Model:()=>r.Owlv2Model,Owlv2PreTrainedModel:()=>r.Owlv2PreTrainedModel,PaliGemmaForConditionalGeneration:()=>r.PaliGemmaForConditionalGeneration,PaliGemmaPreTrainedModel:()=>r.PaliGemmaPreTrainedModel,PaliGemmaProcessor:()=>w.PaliGemmaProcessor,ParakeetFeatureExtractor:()=>_.ParakeetFeatureExtractor,ParakeetForCTC:()=>r.ParakeetForCTC,ParakeetPreTrainedModel:()=>r.ParakeetPreTrainedModel,PatchTSMixerForPrediction:()=>r.PatchTSMixerForPrediction,PatchTSMixerModel:()=>r.PatchTSMixerModel,PatchTSMixerPreTrainedModel:()=>r.PatchTSMixerPreTrainedModel,PatchTSTForPrediction:()=>r.PatchTSTForPrediction,PatchTSTModel:()=>r.PatchTSTModel,PatchTSTPreTrainedModel:()=>r.PatchTSTPreTrainedModel,Phi3ForCausalLM:()=>r.Phi3ForCausalLM,Phi3Model:()=>r.Phi3Model,Phi3PreTrainedModel:()=>r.Phi3PreTrainedModel,Phi3VForCausalLM:()=>r.Phi3VForCausalLM,Phi3VImageProcessor:()=>f.Phi3VImageProcessor,Phi3VPreTrainedModel:()=>r.Phi3VPreTrainedModel,Phi3VProcessor:()=>w.Phi3VProcessor,PhiForCausalLM:()=>r.PhiForCausalLM,PhiModel:()=>r.PhiModel,PhiPreTrainedModel:()=>r.PhiPreTrainedModel,Pipeline:()=>t.Pipeline,PreTrainedModel:()=>r.PreTrainedModel,PreTrainedTokenizer:()=>s.PreTrainedTokenizer,PretrainedConfig:()=>o.PretrainedConfig,PretrainedMixin:()=>r.PretrainedMixin,Processor:()=>M.Processor,PvtForImageClassification:()=>r.PvtForImageClassification,PvtImageProcessor:()=>f.PvtImageProcessor,PvtModel:()=>r.PvtModel,PvtPreTrainedModel:()=>r.PvtPreTrainedModel,PyAnnoteFeatureExtractor:()=>_.PyAnnoteFeatureExtractor,PyAnnoteForAudioFrameClassification:()=>r.PyAnnoteForAudioFrameClassification,PyAnnoteModel:()=>r.PyAnnoteModel,PyAnnotePreTrainedModel:()=>r.PyAnnotePreTrainedModel,PyAnnoteProcessor:()=>w.PyAnnoteProcessor,QuestionAnsweringModelOutput:()=>r.QuestionAnsweringModelOutput,QuestionAnsweringPipeline:()=>t.QuestionAnsweringPipeline,Qwen2ForCausalLM:()=>r.Qwen2ForCausalLM,Qwen2Model:()=>r.Qwen2Model,Qwen2PreTrainedModel:()=>r.Qwen2PreTrainedModel,Qwen2Tokenizer:()=>s.Qwen2Tokenizer,Qwen2VLForConditionalGeneration:()=>r.Qwen2VLForConditionalGeneration,Qwen2VLImageProcessor:()=>f.Qwen2VLImageProcessor,Qwen2VLPreTrainedModel:()=>r.Qwen2VLPreTrainedModel,Qwen2VLProcessor:()=>w.Qwen2VLProcessor,Qwen3ForCausalLM:()=>r.Qwen3ForCausalLM,Qwen3Model:()=>r.Qwen3Model,Qwen3PreTrainedModel:()=>r.Qwen3PreTrainedModel,RFDetrForObjectDetection:()=>r.RFDetrForObjectDetection,RFDetrModel:()=>r.RFDetrModel,RFDetrObjectDetectionOutput:()=>r.RFDetrObjectDetectionOutput,RFDetrPreTrainedModel:()=>r.RFDetrPreTrainedModel,RTDetrForObjectDetection:()=>r.RTDetrForObjectDetection,RTDetrImageProcessor:()=>f.RTDetrImageProcessor,RTDetrModel:()=>r.RTDetrModel,RTDetrObjectDetectionOutput:()=>r.RTDetrObjectDetectionOutput,RTDetrPreTrainedModel:()=>
11r.RTDetrPreTrainedModel,RTDetrV2ForObjectDetection:()=>r.RTDetrV2ForObjectDetection,RTDetrV2Model:()=>r.RTDetrV2Model,RTDetrV2ObjectDetectionOutput:()=>r.RTDetrV2ObjectDetectionOutput,RTDetrV2PreTrainedModel:()=>r.RTDetrV2PreTrainedModel,RawAudio:()=>a.RawAudio,RawImage:()=>n.RawImage,RawVideo:()=>i.RawVideo,RawVideoFrame:()=>i.RawVideoFrame,RepetitionPenaltyLogitsProcessor:()=>P.RepetitionPenaltyLogitsProcessor,ResNetForImageClassification:()=>r.ResNetForImageClassification,ResNetModel:()=>r.ResNetModel,ResNetPreTrainedModel:()=>r.ResNetPreTrainedModel,RoFormerForMaskedLM:()=>r.RoFormerForMaskedLM,RoFormerForQuestionAnswering:()=>r.RoFormerForQuestionAnswering,RoFormerForSequenceClassification:()=>r.RoFormerForSequenceClassification,RoFormerForTokenClassification:()=>r.RoFormerForTokenClassification,RoFormerModel:()=>r.RoFormerModel,RoFormerPreTrainedModel:()=>r.RoFormerPreTrainedModel,RoFormerTokenizer:()=>s.RoFormerTokenizer,RobertaForMaskedLM:()=>r.RobertaForMaskedLM,RobertaForQuestionAnswering:()=>r.RobertaForQuestionAnswering,RobertaForSequenceClassification:()=>
11r.RobertaForSequenceClassification,RobertaForTokenClassification:()=>r.RobertaForTokenClassification,RobertaModel:()=>r.RobertaModel,RobertaPreTrainedModel:()=>r.RobertaPreTrainedModel,RobertaTokenizer:()=>s.RobertaTokenizer,SamImageProcessor:()=>f.SamImageProcessor,SamImageSegmentationOutput:()=>r.SamImageSegmentationOutput,SamModel:()=>r.SamModel,SamPreTrainedModel:()=>r.SamPreTrainedModel,SamProcessor:()=>w.SamProcessor,SapiensForDepthEstimation:()=>r.SapiensForDepthEstimation,SapiensForNormalEstimation:()=>r.SapiensForNormalEstimation,SapiensForSemanticSegmentation:()=>r.SapiensForSemanticSegmentation,SapiensPreTrainedModel:()=>r.SapiensPreTrainedModel,SeamlessM4TFeatureExtractor:()=>_.SeamlessM4TFeatureExtractor,SegformerFeatureExtractor:()=>f.SegformerFeatureExtractor,SegformerForImageClassification:()=>r.SegformerForImageClassification,SegformerForSemanticSegmentation:()=>r.SegformerForSemanticSegmentation,SegformerImageProcessor:()=>f.SegformerImageProcessor,SegformerModel:()=>r.SegformerModel,SegformerPreTrainedModel:()=>r.SegformerPreTrainedModel,Seq2SeqLMOutput:()=>r.Seq2SeqLMOutput,SequenceClassifierOutput:()=>r.SequenceClassifierOutput,SiglipImageProcessor:()=>f.SiglipImageProcessor,SiglipModel:()=>r.SiglipModel,SiglipPreTrainedModel:()=>r.SiglipPreTrainedModel,SiglipTextModel:()=>r.SiglipTextModel,SiglipTokenizer:()=>s.SiglipTokenizer,SiglipVisionModel:()=>r.SiglipVisionModel,SmolLM3ForCausalLM:()=>r.SmolLM3ForCausalLM,SmolLM3Model:()=>r.SmolLM3Model,SmolLM3PreTrainedModel:()=>r.SmolLM3PreTrainedModel,SmolVLMForConditionalGeneration:()=>r.SmolVLMForConditionalGeneration,SmolVLMImageProcessor:()=>f.SmolVLMImageProcessor,SmolVLMProcessor:()=>w.SmolVLMProcessor,SnacDecoderModel:()=>r.SnacDecoderModel,SnacEncoderModel:()=>r.SnacEncoderModel,SnacFeatureExtractor:()=>_.SnacFeatureExtractor,SnacModel:()=>r.SnacModel,SnacPreTrainedModel:()=>r.SnacPreTrainedModel,SpeechT5FeatureExtractor:()=>_.SpeechT5FeatureExtractor,SpeechT5ForSpeechToText:()=>r.SpeechT5ForSpeechToText,SpeechT5ForTextToSpeech:()=>r.SpeechT5ForTextToSpeech,SpeechT5HifiGan:()=>r.SpeechT5HifiGan,SpeechT5Model:()=>r.SpeechT5Model,SpeechT5PreTrainedModel:()=>r.SpeechT5PreTrainedModel,SpeechT5Processor:()=>w.SpeechT5Processor,SpeechT5Tokenizer:()=>s.SpeechT5Tokenizer,SqueezeBertForMaskedLM:()=>r.SqueezeBertForMaskedLM,SqueezeBertForQuestionAnswering:()=>r.SqueezeBertForQuestionAnswering,SqueezeBertForSequenceClassification:()=>r.SqueezeBertForSequenceClassification,SqueezeBertModel:()=>r.SqueezeBertModel,SqueezeBertPreTrainedModel:()=>r.SqueezeBertPreTrainedModel,SqueezeBertTokenizer:()=>s.SqueezeBertTokenizer,StableLmForCausalLM:()=>r.StableLmForCausalLM,StableLmModel:()=>r.StableLmModel,StableLmPreTrainedModel:()=>r.StableLmPreTrainedModel,Starcoder2ForCausalLM:()=>r.Starcoder2ForCausalLM,Starcoder2Model:()=>r.Starcoder2Model,Starcoder2PreTrainedModel:()=>r.Starcoder2PreTrainedModel,StoppingCriteria:()=>T.StoppingCriteria,StoppingCriteriaList:()=>T.StoppingCriteriaList,StyleTextToSpeech2Model:()=>r.StyleTextToSpeech2Model,StyleTextToSpeech2PreTrainedModel:()=>r.StyleTextToSpeech2PreTrainedModel,SummarizationPipeline:()=>t.SummarizationPipeline,SuppressTokensAtBeginLogitsProcessor:()=>P.SuppressTokensAtBeginLogitsProcessor,Swin2SRForImageSuperResolution:()=>r.Swin2SRForImageSuperResolution,Swin2SRImageProcessor:()=>f.Swin2SRImageProcessor,Swin2SRModel:()=>r.Swin2SRModel,Swin2SRPreTrainedModel:()=>r.Swin2SRPreTrainedModel,SwinForImageClassification:()=>r.SwinForImageClassification,SwinForSemanticSegmentation:()=>r.SwinForSemanticSegmentation,SwinModel:()=>r.SwinModel,SwinPreTrainedModel:()=>r.SwinPreTrainedModel,T5ForConditionalGeneration:()=>r.T5ForConditionalGeneration,T5Model:()=>r.T5Model,T5PreTrainedModel:()=>r.T5PreTrainedModel,T5Tokenizer:()=>s.T5Tokenizer,TableTransformerForObjectDetection:()=>r.TableTransformerForObjectDetection,TableTransformerModel:()=>r.TableTransformerModel,TableTransformerObjectDetectionOutput:()=>r.TableTransformerObjectDetectionOutput,TableTransformerPreTrainedModel:()=>r.TableTransformerPreTrainedModel,TemperatureLogitsWarper:()=>P.TemperatureLogitsWarper,Tensor:()=>l.Tensor,Text2TextGenerationPipeline:()=>t.Text2TextGenerationPipeline,TextClassificationPipeline:()=>t.TextClassificationPipeline,TextGenerationPipeline:()=>t.TextGenerationPipeline,TextStreamer:()=>b.TextStreamer,TextToAudioPipeline:()=>t.TextToAudioPipeline,TokenClassificationPipeline:()=>t.TokenClassificationPipeline,TokenClassifierOutput:()=>r.TokenClassifierOutput,TokenizerModel:()=>s.TokenizerModel,TopKLogitsWarper:()=>P.TopKLogitsWarper,TopPLogitsWarper:()=>P.TopPLogitsWarper,TrOCRForCausalLM:()=>r.TrOCRForCausalLM,TrOCRPreTrainedModel:()=>r.TrOCRPreTrainedModel,TranslationPipeline:()=>t.TranslationPipeline,UltravoxModel:()=>r.UltravoxModel,UltravoxPreTrainedModel:()=>r.UltravoxPreTrainedModel,UltravoxProcessor:()=>w.UltravoxProcessor,UniSpeechForCTC:()=>r.UniSpeechForCTC,UniSpeechForSequenceClassification:()=>r.UniSpeechForSequenceClassification,UniSpeechModel:()=>r.UniSpeechModel,UniSpeechPreTrainedModel:()=>r.UniSpeechPreTrainedModel,UniSpeechSatForAudioFrameClassification:()=>r.UniSpeechSatForAudioFrameClassification,UniSpeechSatForCTC:()=>r.UniSpeechSatForCTC,UniSpeechSatForSequenceClassification:()=>r.UniSpeechSatForSequenceClassification,UniSpeechSatModel:()=>r.UniSpeechSatModel,UniSpeechSatPreTrainedModel:()=>r.UniSpeechSatPreTrainedModel,VLChatProcessor:()=>w.VLChatProcessor,VLMImageProcessor:()=>
11f.VLMImageProcessor,VaultGemmaForCausalLM:()=>r.VaultGemmaForCausalLM,VaultGemmaModel:()=>r.VaultGemmaModel,VaultGemmaPreTrainedModel:()=>r.VaultGemmaPreTrainedModel,ViTFeatureExtractor:()=>f.ViTFeatureExtractor,ViTForImageClassification:()=>r.ViTForImageClassification,ViTImageProcessor:()=>f.ViTImageProcessor,ViTMAEModel:()=>r.ViTMAEModel,ViTMAEPreTrainedModel:()=>r.ViTMAEPreTrainedModel,ViTMSNForImageClassification:()=>r.ViTMSNForImageClassification,ViTMSNModel:()=>r.ViTMSNModel,ViTMSNPreTrainedModel:()=>r.ViTMSNPreTrainedModel,ViTModel:()=>r.ViTModel,ViTPreTrainedModel:()=>r.ViTPreTrainedModel,VisionEncoderDecoderModel:()=>r.VisionEncoderDecoderModel,VitMatteForImageMatting:()=>r.VitMatteForImageMatting,VitMatteImageProcessor:()=>f.VitMatteImageProcessor,VitMattePreTrainedModel:()=>r.VitMattePreTrainedModel,VitPoseForPoseEstimation:()=>r.VitPoseForPoseEstimation,VitPoseImageProcessor:()=>f.VitPoseImageProcessor,VitPosePreTrainedModel:()=>r.VitPosePreTrainedModel,VitsModel:()=>r.VitsModel,VitsModelOutput:()=>r.VitsModelOutput,VitsPreTrainedModel:()=>r.VitsPreTrainedModel,VitsTokenizer:()=>s.VitsTokenizer,VoxtralForConditionalGeneration:()=>r.VoxtralForConditionalGeneration,VoxtralProcessor:()=>w.VoxtralProcessor,Wav2Vec2BertForCTC:()=>r.Wav2Vec2BertForCTC,Wav2Vec2BertForSequenceClassification:()=>r.Wav2Vec2BertForSequenceClassification,Wav2Vec2BertModel:()=>r.Wav2Vec2BertModel,Wav2Vec2BertPreTrainedModel:()=>r.Wav2Vec2BertPreTrainedModel,Wav2Vec2CTCTokenizer:()=>s.Wav2Vec2CTCTokenizer,Wav2Vec2FeatureExtractor:()=>_.Wav2Vec2FeatureExtractor,Wav2Vec2ForAudioFrameClassification:()=>r.Wav2Vec2ForAudioFrameClassification,Wav2Vec2ForCTC:()=>r.Wav2Vec2ForCTC,Wav2Vec2ForSequenceClassification:()=>r.Wav2Vec2ForSequenceClassification,Wav2Vec2Model:()=>r.Wav2Vec2Model,Wav2Vec2PreTrainedModel:()=>r.Wav2Vec2PreTrainedModel,Wav2Vec2Processor:()=>w.Wav2Vec2Processor,Wav2Vec2ProcessorWithLM:()=>w.Wav2Vec2ProcessorWithLM,WavLMForAudioFrameClassification:()=>r.WavLMForAudioFrameClassification,WavLMForCTC:()=>r.WavLMForCTC,WavLMForSequenceClassification:()=>r.WavLMForSequenceClassification,WavLMForXVector:()=>r.WavLMForXVector,WavLMModel:()=>r.WavLMModel,WavLMPreTrainedModel:()=>r.WavLMPreTrainedModel,WeSpeakerFeatureExtractor:()=>_.WeSpeakerFeatureExtractor,WeSpeakerResNetModel:()=>r.WeSpeakerResNetModel,WeSpeakerResNetPreTrainedModel:()=>r.WeSpeakerResNetPreTrainedModel,WhisperFeatureExtractor:()=>_.WhisperFeatureExtractor,WhisperForConditionalGeneration:()=>r.WhisperForConditionalGeneration,WhisperModel:()=>r.WhisperModel,WhisperPreTrainedModel:()=>r.WhisperPreTrainedModel,WhisperProcessor:()=>w.WhisperProcessor,WhisperTextStreamer:()=>b.WhisperTextStreamer,WhisperTimeStampLogitsProcessor:()=>P.WhisperTimeStampLogitsProcessor,WhisperTokenizer:()=>s.WhisperTokenizer,XLMForQuestionAnswering:()=>r.XLMForQuestionAnswering,XLMForSequenceClassification:()=>r.XLMForSequenceClassification,XLMForTokenClassification:()=>r.XLMForTokenClassification,XLMModel:()=>r.XLMModel,XLMPreTrainedModel:()=>r.XLMPreTrainedModel,XLMRobertaForMaskedLM:()=>r.XLMRobertaForMaskedLM,XLMRobertaForQuestionAnswering:()=>r.XLMRobertaForQuestionAnswering,XLMRobertaForSequenceClassification:()=>r.XLMRobertaForSequenceClassification,XLMRobertaForTokenClassification:()=>r.XLMRobertaForTokenClassification,XLMRobertaModel:()=>r.XLMRobertaModel,XLMRobertaPreTrainedModel:()=>r.XLMRobertaPreTrainedModel,XLMRobertaTokenizer:()=>s.XLMRobertaTokenizer,XLMTokenizer:()=>s.XLMTokenizer,XLMWithLMHeadModel:()=>r.XLMWithLMHeadModel,XVectorOutput:()=>r.XVectorOutput,YolosFeatureExtractor:()=>f.YolosFeatureExtractor,YolosForObjectDetection:()=>r.YolosForObjectDetection,YolosImageProcessor:()=>f.YolosImageProcessor,YolosModel:()=>r.YolosModel,YolosObjectDetectionOutput:()=>r.YolosObjectDetectionOutput,YolosPreTrainedModel:()=>r.YolosPreTrainedModel,ZeroShotAudioClassificationPipeline:()=>t.ZeroShotAudioClassificationPipeline,ZeroShotClassificationPipeline:()=>t.ZeroShotClassificationPipeline,ZeroShotImageClassificationPipeline:()=>t.ZeroShotImageClassificationPipeline,ZeroShotObjectDetectionPipeline:()=>t.ZeroShotObjectDetectionPipeline,bankers_round:()=>u.bankers_round,cat:()=>l.cat,cos_sim:()=>u.cos_sim,dot:()=>u.dot,dynamic_time_warping:()=>u.dynamic_time_warping,env:()=>e.env,full:()=>l.full,full_like:()=>l.full_like,getCacheShapes:()=>o.getCacheShapes,hamming:()=>a.hamming,hanning:()=>a.hanning,interpolate:()=>l.interpolate,interpolate_4d:()=>l.interpolate_4d,interpolate_data:()=>u.interpolate_data,is_chinese_char:()=>s.is_chinese_char,layer_norm:()=>l.layer_norm,load_image:()=>n.load_image,load_video:()=>i.load_video,log_softmax:()=>u.log_softmax,magnitude:()=>u.magnitude,matmul:()=>l.matmul,max:()=>u.max,mean:()=>l.mean,mean_pooling:()=>l.mean_pooling,medianFilter:()=>u.medianFilter,mel_filter_bank:()=>a.mel_filter_bank,min:()=>u.min,ones:()=>l.ones,ones_like:()=>l.ones_like,permute:()=>l.permute,permute_data:()=>u.permute_data,pipeline:()=>t.pipeline,quantize_embeddings:()=>l.quantize_embeddings,rand:()=>l.rand,read_audio:()=>a.read_audio,rfft:()=>l.rfft,round:()=>u.round,slice:()=>l.slice,softmax:()=>u.softmax,spectrogram:()=>a.spectrogram,stack:()=>l.stack,std_mean:()=>l.std_mean,topk:()=>l.topk,window_function:()=>a.window_function,zeros:()=>l.zeros,zeros_like:()=>l.zeros_like});var e=c("./src/env.js"),t=c("./src/pipelines.js"),r=c("./src/models.js"),s=c("./src/tokenizers.js"),o=c("./src/configs.js"),a=c("./src/utils/audio.js"),n=c("./src/utils/image.js"),i=c("./src/utils/video.js"),l=c("./src/utils/tensor.js"),u=c("./src/utils/maths.js"),m=c("./src/base/feature_extraction_utils.js"),_=c("./src/models/feature_extractors.js"),p=c("./src/models/auto/feature_extraction_auto.js"),h=c("./src/base/image_processors_utils.js"),f=c("./src/models/image_processors.js"),g=c("./src/models/auto/image_processing_auto.js"),M=c("./src/base/processing_utils.js"),w=c("./src/models/processors.js"),x=c("./src/models/auto/processing_auto.js"),b=c("./src/generation/streamers.js"),T=c("./src/generation/stopping_criteria.js"),P=c("./src/generation/logits_process.js")})(),d.ASTFeatureExtractor,d.ASTForAudioClassification,d.ASTModel,d.ASTPreTrainedModel,d.AlbertForMaskedLM,d.AlbertForQuestionAnswering,d.AlbertForSequenceClassification,d.AlbertModel,d.AlbertPreTrainedModel,d.AlbertTokenizer,d.ArceeForCausalLM,d.ArceeModel,d.ArceePreTrainedModel,d.AudioClassificationPipeline,d.AutoConfig,d.AutoFeatureExtractor,d.AutoImageProcessor,d.AutoModel,d.AutoModelForAudioClassification,d.AutoModelForAudioFrameClassification,d.AutoModelForAudioTextToText,d.AutoModelForCTC,d.AutoModelForCausalLM,d.AutoModelForDepthEstimation,d.AutoModelForDocumentQuestionAnswering,d.AutoModelForImageClassification,d.AutoModelForImageFeatureExtraction,d.AutoModelForImageMatting,d.AutoModelForImageSegmentation,d.AutoModelForImageTextToText,d.AutoModelForImageToImage,d.AutoModelForMaskGeneration,d.AutoModelForMaskedLM,d.AutoModelForNormalEstimation,d.AutoModelForObjectDetection,d.AutoModelForPoseEstimation,d.AutoModelForQuestionAnswering,d.AutoModelForSemanticSegmentation,d.AutoModelForSeq2SeqLM,d.AutoModelForSequenceClassification,d.AutoModelForSpeechSeq2Seq,d.AutoModelForTextToSpectrogram,d.AutoModelForTextToWaveform,d.AutoModelForTokenClassification,d.AutoModelForUniversalSegmentation,d.AutoModelForVision2Seq,d.AutoModelForXVector,d.AutoModelForZeroShotObjectDetection,d.AutoProcessor,d.AutoTokenizer,d.AutomaticSpeechRecognitionPipeline,d.Backgroun
11dRemovalPipeline,d.BartForConditionalGeneration,d.BartForSequenceClassification,d.BartModel,d.BartPretrainedModel,d.BartTokenizer,d.BaseModelOutput,d.BaseStreamer,d.BeitFeatureExtractor,d.BeitForImageClassification,d.BeitModel,d.BeitPreTrainedModel,d.BertForMaskedLM,d.BertForQuestionAnswering,d.BertForSequenceClassification,d.BertForTokenClassification,d.BertModel,d.BertPreTrainedModel,d.BertTokenizer,d.BitImageProcessor,d.BlenderbotForConditionalGeneration,d.BlenderbotModel,d.BlenderbotPreTrainedModel,d.BlenderbotSmallForConditionalGeneration,d.BlenderbotSmallModel,d.BlenderbotSmallPreTrainedModel,d.BlenderbotSmallTokenizer,d.BlenderbotTokenizer,d.BloomForCausalLM,d.BloomModel,d.BloomPreTrainedModel,d.BloomTokenizer,d.CLIPFeatureExtractor,d.CLIPImageProcessor,d.CLIPModel,d.CLIPPreTrainedModel,d.CLIPSegForImageSegmentation,d.CLIPSegModel,d.CLIPSegPreTrainedModel,d.CLIPTextModel,d.CLIPTextModelWithProjection,d.CLIPTokenizer,d.CLIPVisionModel,d.CLIPVisionModelWithProjection,d.CamembertForMaskedLM,d.CamembertForQuestionAnswering,d.CamembertForSequenceClassification,d.CamembertForTokenClassification,d.CamembertModel,d.CamembertPreTrainedModel,d.CamembertTokenizer,d.CausalLMOutput,d.CausalLMOutputWithPast,d.ChineseCLIPFeatureExtractor,d.ChineseCLIPModel,d.ChineseCLIPPreTrainedModel,d.ClapAudioModelWithProjection,d.ClapFeatureExtractor,d.ClapModel,d.ClapPreTrainedModel,d.ClapTextModelWithProjection,d.ClassifierFreeGuidanceLogitsProcessor,d.CodeGenForCausalLM,d.CodeGenModel,d.CodeGenPreTrainedModel,d.CodeGenTokenizer,d.CodeLlamaTokenizer,d.CohereForCausalLM,d.CohereModel,d.CoherePreTrainedModel,d.CohereTokenizer,d.ConvBertForMaskedLM,d.ConvBertForQuestionAnswering,d.ConvBertForSequenceClassification,d.ConvBertForTokenClassification,d.ConvBertModel,d.ConvBertPreTrainedModel,d.ConvBertTokenizer,d.ConvNextFeatureExtractor,d.ConvNextForImageClassification,d.ConvNextImageProcessor,d.ConvNextModel,d.ConvNextPreTrainedModel,d.ConvNextV2ForImageClassification,d.ConvNextV2Model,d.ConvNextV2PreTrainedModel,d.DFineForObjectDetection,d.DFineModel,d.DFinePreTrainedModel,d.DINOv3ConvNextModel,d.DINOv3ConvNextPreTrainedModel,d.DINOv3ViTImageProcessor,d.DINOv3ViTModel,d.DINOv3ViTPreTrainedModel,d.DPTFeatureExtractor,d.DPTForDepthEstimation,d.DPTImageProcessor,d.DPTModel,d.DPTPreTrainedModel,d.DacDecoderModel,d.DacDecoderOutput,d.DacEncoderModel,d.DacEncoderOutput,d.DacFeatureExtractor,d.DacModel,d.DacPreTrainedModel,d.DataTypeMap,d.DebertaForMaskedLM,d.DebertaForQuestionAnswering,d.DebertaForSequenceClassification,d.DebertaForTokenClassification,d.DebertaModel,d.DebertaPreTrainedModel,d.DebertaTokenizer,d.DebertaV2ForMaskedLM,d.DebertaV2ForQuestionAnswering,d.DebertaV2ForSequenceClassification,d.DebertaV2ForTokenClassification,d.DebertaV2Model,d.DebertaV2PreTrainedModel,d.DebertaV2Tokenizer,d.DecisionTransformerModel,d.DecisionTransformerPreTrainedModel,d.DeiTFeatureExtractor,d.DeiTForImageClassification,d.DeiTImageProcessor,d.DeiTModel,d.DeiTPreTrainedModel,d.DepthAnythingForDepthEstimation,d.DepthAnythingPreTrainedModel,d.DepthEstimationPipeline,d.DepthProForDepthEstimation,d.DepthProPreTrainedModel,d.DetrFeatureExtractor,d.DetrForObjectDetection,d.DetrForSegmentation,d.DetrImageProcessor,d.DetrModel,d.DetrObjectDetectionOutput,d.DetrPreTrainedModel,d.DetrSegmentationOutput,d.Dinov2ForImageClassification,d.Dinov2Model,d.Dinov2PreTrainedModel,d.Dinov2WithRegistersForImageClassification,d.Dinov2WithRegistersModel,d.Dinov2WithRegistersPreTrainedModel,d.DistilBertForMaskedLM,d.DistilBertForQuestionAnswering,d.DistilBertForSequenceClassification,d.DistilBertForTokenClassification,d.DistilBertModel,d.DistilBertPreTrainedModel,d.DistilBertTokenizer,d.DocumentQuestionAnsweringPipeline,d.DonutFeatureExtractor,d.DonutImageProcessor,d.DonutSwinModel,d.DonutSwinPreTrainedModel,d.EfficientNetForImageClassification,d.EfficientNetImageProcessor,d.EfficientNetModel,d.EfficientNetPreTrainedModel,d.ElectraForMaskedLM,d.ElectraForQuestionAnswering,d.ElectraForSequenceClassification,d.ElectraForTokenClassification,d.ElectraModel,d.ElectraPreTrainedModel,d.ElectraTokenizer,d.EncodecFeatureExtractor,d.EosTokenCriteria,d.Ernie4_5_ForCausalLM,d.Ernie4_5_Model,d.Ernie4_5_PretrainedModel,d.Ernie4_5_Tokenizer,d.EsmForMaskedLM,d.EsmForSequenceClassification,d.EsmForTokenClassification,d.EsmModel,d.EsmPreTrainedModel,d.EsmTokenizer,d.ExaoneForCausalLM,d.ExaoneModel,d.ExaonePreTrainedModel,d.FFT,d.FalconForCausalLM,d.FalconModel,d.FalconPreTrainedModel,d.FalconTokenizer,d.FastViTForImageClassification,d.FastViTModel,d.FastViTPreTrainedModel,d.FeatureExtractionPipeline,d.FeatureExtractor,d.FillMaskPipeline,d.Florence2ForConditionalGeneration,d.Florence2PreTrainedModel,d.Florence2Processor,d.ForcedBOSTokenLogitsProcessor,d.ForcedEOSTokenLogitsProcessor,d.GLPNFeatureExtractor,d.GLPNForDepthEstimation,d.GLPNModel,d.GLPNPreTrainedModel,d.GPT2LMHeadModel,d.GPT2Model,d.GPT2PreTrainedModel,d.GPT2Tokenizer,d.GPTBigCodeForCausalLM,d.GPTBigCodeModel,d.GPTBigCodePreTrainedModel,d.GPTJForCausalLM,d.GPTJModel,d.GPTJPreTrainedModel,d.GPTNeoForCausalLM,d.GPTNeoModel,d.GPTNeoPreTrainedModel,d.GPTNeoXFor
11CausalLM,d.GPTNeoXModel,d.GPTNeoXPreTrainedModel,d.GPTNeoXTokenizer,d.Gemma2ForCausalLM,d.Gemma2Model,d.Gemma2PreTrainedModel,d.Gemma3ForCausalLM,d.Gemma3Model,d.Gemma3PreTrainedModel,d.Gemma3nAudioFeatureExtractor,d.Gemma3nForConditionalGeneration,d.Gemma3nPreTrainedModel,d.Gemma3nProcessor,d.GemmaForCausalLM,d.GemmaModel,d.GemmaPreTrainedModel,d.GemmaTokenizer,d.GlmForCausalLM,d.GlmModel,d.GlmPreTrainedModel,d.GraniteForCausalLM,d.GraniteModel,d.GraniteMoeHybridForCausalLM,d.GraniteMoeHybridModel,d.GraniteMoeHybridPreTrainedModel,d.GranitePreTrainedModel,d.Grok1Tokenizer,d.GroundingDinoForObjectDetection,d.GroundingDinoImageProcessor,d.GroundingDinoPreTrainedModel,d.GroundingDinoProcessor,d.GroupViTModel,d.GroupViTPreTrainedModel,d.HeliumForCausalLM,d.HeliumModel,d.HeliumPreTrainedModel,d.HerbertTokenizer,d.HieraForImageClassification,d.HieraModel,d.HieraPreTrainedModel,d.HubertForCTC,d.HubertForSequenceClassification,d.HubertModel,d.HubertPreTrainedModel,d.IJepaForImageClassification,d.IJepaModel,d.IJepaPreTrainedModel,d.Idefics3ForConditionalGeneration,d.Idefics3ImageProcessor,d.Idefics3PreTrainedModel,d.Idefics3Processor,d.ImageClassificationPipeline,d.ImageFeatureExtractionPipeline,d.ImageFeatureExtractor,d.ImageMattingOutput,d.ImageProcessor,d.ImageSegmentationPipeline,d.ImageToImagePipeline,d.ImageToTextPipeline,d.InterruptableStoppingCriteria,d.JAISLMHeadModel,d.JAISModel,d.JAISPreTrainedModel,d.JinaCLIPImageProcessor,d.JinaCLIPModel,d.JinaCLIPPreTrainedModel,d.JinaCLIPProcessor,d.JinaCLIPTextModel,d.JinaCLIPVisionModel,d.Lfm2ForCausalLM,d.Lfm2Model,d.Lfm2PreTrainedModel,d.LiteWhisperForConditionalGeneration,d.Llama4ForCausalLM,d.Llama4PreTrainedModel,d.LlamaForCausalLM,d.LlamaModel,d.LlamaPreTrainedModel,d.LlamaTokenizer,d.LlavaForConditionalGeneration,d.LlavaOnevisionForConditionalGeneration,d.LlavaOnevisionImageProcessor,d.LlavaPreTrainedModel,d.LlavaProcessor,d.LlavaQwen2ForCausalLM,d.LogitsProcessor,d.LogitsProcessorList,d.LogitsWarper,d.LongT5ForConditionalGeneration,d.LongT5Model,d.LongT5PreTrainedModel,d.M2M100ForConditionalGeneration,d.M2M100Model,d.M2M100PreTrainedModel,d.M2M100Tokenizer,d.MBart50Tokenizer,d.MBartForCausalLM,d.MBartForConditionalGeneration,d.MBartForSequenceClassification,d.MBartModel,d.MBartPreTrainedModel,d.MBartTokenizer,d.MPNetForMaskedLM,d.MPNetForQuestionAnswering,d.MPNetForSequenceClassification,d.MPNetForTokenClassification,d.MPNetModel,d.MPNetPreTrainedModel,d.MPNetTokenizer,d.MT5ForConditionalGeneration,d.MT5Model,d.MT5PreTrainedModel,d.MarianMTModel,d.MarianModel,d.MarianPreTrainedModel,d.MarianTokenizer,d.Mask2FormerImageProcessor,d.MaskFormerFeatureExtractor,d.MaskFormerForInstanceSegmentation,d.MaskFormerImageProcessor,d.MaskFormerModel,d.MaskFormerPreTrainedModel,d.MaskedLMOutput,d.MaxLengthCriteria,d.Metric3DForDepthEstimation,d.Metric3DPreTrainedModel,d.Metric3Dv2ForDepthEstimation,d.Metric3Dv2PreTrainedModel,d.MgpstrForSceneTextRecognition,d.MgpstrModelOutput,d.MgpstrPreTrainedModel,d.MgpstrProcessor,d.MgpstrTokenizer,d.MimiDecoderModel,d.MimiDecoderOutput,d.MimiEncoderModel,d.MimiEncoderOutput,d.MimiModel,d.MimiPreTrainedModel,d.MinLengthLogitsProcessor,d.MinNewTokensLengthLogitsProcessor,d.MistralForCausalLM,d.MistralModel,d.MistralPreTrainedModel,d.MobileBertForMaskedLM,d.MobileBertForQuestionAnswering,d.MobileBertForSequenceClassification,d.MobileBertModel,d.MobileBertPreTrainedModel,d.MobileBertTokenizer,d.MobileLLMForCausalLM,d.MobileLLMModel,d.MobileLLMPreTrainedModel,d.MobileNetV1FeatureExtractor,d.MobileNetV1ForImageClassification,d.MobileNetV1ForSemanticSegmentation,d.MobileNetV1ImageProcessor,d.MobileNetV1Model,d.MobileNetV1PreTrainedModel,d.MobileNetV2FeatureExtractor,d.MobileNetV2ForImageClassification,d.MobileNetV2ForSemanticSegmentation,d.MobileNetV2ImageProcessor,d.MobileNetV2Model,d.MobileNetV2PreTrainedModel,d.MobileNetV3FeatureExtractor,d.MobileNetV3ForImageClassification,d.MobileNetV3ForSemanticSegmentation,d.MobileNetV3ImageProcessor,d.MobileNetV3Model,d.MobileNetV3PreTrainedModel,d.MobileNetV4FeatureExtractor,d.MobileNetV4ForImageClassification,d.MobileNetV4ForSemanticSegmentation,d.MobileNetV4ImageProcessor,d.MobileNetV4Model,d.MobileNetV4PreTrainedModel,d.MobileViTFeatureExtractor,d.MobileViTForImageClassification,d.MobileViTImageProcessor,d.MobileViTModel,d.MobileViTPreTrainedModel,d.MobileViTV2ForImageClassification,d.MobileViTV2Model,d.MobileViTV2PreTrainedModel,d.ModelOutput,d.ModernBertDecoderForCausalLM,d.ModernBertDecoderModel,d.ModernBertDecoderPreTrainedModel,d.ModernBertForMaskedLM,d.ModernBertForSequenceClassification,d.ModernBertForTokenClassification,d.ModernBertModel,d.ModernBertPreTrainedModel,d.Moondream1ForConditionalGeneration,d.MoonshineFeatureExtractor,d.MoonshineForConditionalGeneration,d.MoonshineModel,d.MoonshinePreTrainedModel,d.MoonshineProcessor,d.MptForCausalLM,d.MptModel,d.MptPreTrainedModel,d.MultiModalityCausalLM,d.MultiModalityPreTrainedModel,d.MusicgenForCausalLM,d.MusicgenForConditionalGeneration,d.Mu
11sicgenModel,d.MusicgenPreTrainedModel,d.NanoChatForCausalLM,d.NanoChatModel,d.NanoChatPreTrainedModel,d.NeoBertForMaskedLM,d.NeoBertForQuestionAnswering,d.NeoBertForSequenceClassification,d.NeoBertForTokenClassification,d.NeoBertModel,d.NeoBertPreTrainedModel,d.NllbTokenizer,d.NoBadWordsLogitsProcessor,d.NoRepeatNGramLogitsProcessor,d.NomicBertModel,d.NomicBertPreTrainedModel,d.NougatImageProcessor,d.NougatTokenizer,d.OPTForCausalLM,d.OPTModel,d.OPTPreTrainedModel,d.ObjectDetectionPipeline,d.Olmo2ForCausalLM,d.Olmo2Model,d.Olmo2PreTrainedModel,d.OlmoForCausalLM,d.OlmoModel,d.OlmoPreTrainedModel,d.OpenELMForCausalLM,d.OpenELMModel,d.OpenELMPreTrainedModel,d.OwlViTFeatureExtractor,d.OwlViTForObjectDetection,d.OwlViTImageProcessor,d.OwlViTModel,d.OwlViTPreTrainedModel,d.OwlViTProcessor,d.Owlv2ForObjectDetection,d.Owlv2ImageProcessor,d.Owlv2Model,d.Owlv2PreTrainedModel,d.PaliGemmaForConditionalGeneration,d.PaliGemmaPreTrainedModel,d.PaliGemmaProcessor,d.ParakeetFeatureExtractor,d.ParakeetForCTC,d.ParakeetPreTrainedModel,d.PatchTSMixerForPrediction,d.PatchTSMixerModel,d.PatchTSMixerPreTrainedModel,d.PatchTSTForPrediction,d.PatchTSTModel,d.PatchTSTPreTrainedModel,d.Phi3ForCausalLM,d.Phi3Model,d.Phi3PreTrainedModel,d.Phi3VForCausalLM,d.Phi3VImageProcessor,d.Phi3VPreTrainedModel,d.Phi3VProcessor,d.PhiForCausalLM,d.PhiModel,d.PhiPreTrainedModel,d.Pipeline,d.PreTrainedModel,d.PreTrainedTokenizer,d.PretrainedConfig,d.PretrainedMixin,d.Processor,d.PvtForImageClassification,d.PvtImageProcessor,d.PvtModel,d.PvtPreTrainedModel,d.PyAnnoteFeatureExtractor,d.PyAnnoteForAudioFrameClassification,d.PyAnnoteModel,d.PyAnnotePreTrainedModel,d.PyAnnoteProcessor,d.QuestionAnsweringModelOutput,d.QuestionAnsweringPipeline,d.Qwen2ForCausalLM,d.Qwen2Model,d.Qwen2PreTrainedModel,d.Qwe
11n2Tokenizer,d.Qwen2VLForConditionalGeneration,d.Qwen2VLImageProcessor,d.Qwen2VLPreTrainedModel,d.Qwen2VLProcessor,d.Qwen3ForCausalLM,d.Qwen3Model,d.Qwen3PreTrainedModel,d.RFDetrForObjectDetection,d.RFDetrModel,d.RFDetrObjectDetectionOutput,d.RFDetrPreTrainedModel,d.RTDetrForObjectDetection,d.RTDetrImageProcessor,d.RTDetrModel,d.RTDetrObjectDetectionOutput,d.RTDetrPreTrainedModel,d.RTDetrV2ForObjectDetection,d.RTDetrV2Model,d.RTDetrV2ObjectDetectionOutput,d.RTDetrV2PreTrainedModel,d.RawAudio,d.RawImage,d.RawVideo,d.RawVideoFrame,d.RepetitionPenaltyLogitsProcessor,d.ResNetForImageClassification,d.ResNetModel,d.ResNetPreTrainedModel,d.RoFormerForMaskedLM,d.RoFormerForQuestionAnswering,d.RoFormerForSequenceClassification,d.RoFormerForTokenClassification,d.RoFormerModel,d.RoFormerPreTrainedModel,d.RoFormerTokenizer,d.RobertaForMaskedLM,d.RobertaForQuestionAnswering,d.RobertaForSequenceClassification,d.RobertaForTokenClassification,d.RobertaModel,d.RobertaPreTrainedModel,d.RobertaTokenizer,d.SamImageProcessor,d.SamImageSegmentationOutput,d.SamModel,d.SamPreTrainedModel,d.SamProcessor,d.SapiensForDepthEstimation,d.SapiensForNormalEstimation,d.SapiensForSemanticSegmentation,d.SapiensPreTrainedModel,d.SeamlessM4TFeatureExtractor,d.SegformerFeatureExtractor,d.SegformerForImageClassification,d.SegformerForSemanticSegmentation,d.SegformerImageProcessor,d.SegformerModel,d.SegformerPreTrainedModel,d.Seq2SeqLMOutput,d.SequenceClassifierOutput,d.SiglipImageProcessor,d.SiglipModel,d.SiglipPreTrainedModel,d.SiglipTextModel,d.SiglipTokenizer,d.SiglipVisionModel,d.SmolLM3ForCausalLM,d.SmolLM3Model,d.SmolLM3PreTrainedModel,d.SmolVLMForConditionalGeneration,d.SmolVLMImageProcessor,d.SmolVLMProcessor,d.SnacDecoderModel,d.SnacEncoderModel,d.SnacFeatureExtractor,d.SnacModel,d.SnacPreTrainedModel,d.SpeechT5FeatureExtractor,d.SpeechT5ForSpeechToText,d.SpeechT5ForTextToSpeech,d.SpeechT5HifiGan,d.SpeechT5Model,d.SpeechT5PreTrainedModel,d.SpeechT5Processor,d.SpeechT5Tokenizer,d.SqueezeBertForMaskedLM,d.SqueezeBertForQuestionAnswering,d.SqueezeBertForSequenceClassification,d.SqueezeBertModel,d.SqueezeBertPreTrainedModel,d.SqueezeBertTokenizer,d.StableLmForCausalLM,d.StableLmModel,d.StableLmPreTrainedModel,d.Starcoder2ForCausalLM,d.Starcoder2Model,d.Starcoder2PreTrainedModel,d.StoppingCriteria,d.StoppingCriteriaList,d.StyleTextToSpeech2Model,d.StyleTextToSpeech2PreTrainedModel,d.SummarizationPipeline,d.SuppressTokensAtBeginLogitsProcessor,d.Swin2SRForImageSuperResolution,d.Swin2SRImageProcessor,d.Swin2SRModel,d.Swin2SRPreTrainedModel,d.SwinForImageClassification,d.SwinForSemanticSegmentation,d.SwinModel,d.SwinPreTrainedModel,d.T5ForConditionalGeneration,d.T5Model,d.T5PreTrainedModel,d.T5Tokenizer,d.TableTransformerForObjectDetection,d.TableTransformerModel,d.TableTransformerObjectDetectionOutput,d.TableTransformerPreTrainedModel,d.TemperatureLogitsWarper,d.Tensor,d.Text2TextGenerationPipeline,d.TextClassificationPipeline,d.TextGenerationPipeline,d.TextStreamer,d.TextToAudioPipeline,d.TokenClassificationPipeline,d.TokenClassifierOutput,d.TokenizerModel,d.TopKLogitsWarper,d.TopPLogitsWarper,d.TrOCRForCausalLM,d.TrOCRPreTrainedModel,d.TranslationPipeline,d.UltravoxModel,d.UltravoxPreTrainedModel,d.UltravoxProcessor,d.UniSpeechForCTC,d.UniSpeechForSequenceClassification,d.UniSpeechModel,d.UniSpeechPreTrainedModel,d.UniSpeechSatForAudioFrameClassification,d.UniSpeechSatForCTC,d.UniSpeechSatForSequenceClassification,d.UniSpeechSatModel,d.UniSpeechSatPreTrainedModel,d.VLChatProcessor,d.VLMImageProcessor,d.VaultGemmaForCausalLM,d.VaultGemmaModel,d.VaultGemmaPreTrainedModel,d.ViTFeatureExtractor,d.ViTForImageClassification,d.ViTImageProcessor,d.ViTMAEModel,d.ViTMAEPreTrainedModel,d.ViTMSNForImageClassification,d.ViTMSNModel,d.ViTMSNPreTrainedModel,d.ViTModel,d.ViTPreTrainedModel,d.VisionEncoderDecoderModel,d.VitMatteForImageMatting,d.VitMatteImageProcessor,d.VitMattePreTrainedModel,d.VitPoseForPoseEstimation,d.VitPoseImageProcessor,d.VitPosePreTrainedModel,d.VitsModel,d.VitsModelOutput,d.VitsPreTrainedModel,d.VitsTokenizer,d.VoxtralForConditionalGeneration,d.VoxtralProcessor,d.Wav2Vec2BertForCTC,d.Wav2Vec2BertForSequenceClassification,d.Wav2Vec2BertModel,d.Wav2Vec2BertPreTrainedModel,d.Wav2Vec2CTCTokenizer,d.Wav2Vec2FeatureExtractor,d.Wav2Vec2ForAudioFrameClassification,d.Wav2Vec2ForCTC,d.Wav2Vec2ForSequenceClassification,d.Wav2Vec2Model,d.Wav2Vec2PreTrainedModel,d.Wav2Vec2Processor,d.Wav2Vec2ProcessorWithLM,d.WavLMForAudioFrameClassification,d.WavLMForCTC,d.WavLMForSequenceClassification,d.WavLMForXVector,d.WavLMModel,d.WavLMPreTrainedModel,d.WeSpeakerFeatureExtractor,d.WeSpeakerResNetModel,d.WeSpeakerResNetPreTrainedModel,d.WhisperFeatureExtractor,d.WhisperForConditionalGeneration,d.WhisperModel,d.WhisperPreTrainedModel,d.WhisperProcessor,d.WhisperTextStreamer,d.WhisperTimeStampLogitsProcessor,d.WhisperTokenizer,d.XLMForQuestionAnswering,d.XLMForSequenceClassification,d.XLMForTokenClassification,d.XLMModel,d.XLMPreTrainedModel,d.XLMRobertaForMaskedLM,d.XLMRobertaForQuestionAnswering,d.XLMRobertaForSequenceClassification,d.XLMR
11obertaForTokenClassification,d.XLMRobertaModel,d.XLMRobertaPreTrainedModel,d.XLMRobertaTokenizer,d.XLMTokenizer,d.XLMWithLMHeadModel,d.XVectorOutput,d.YolosFeatureExtractor,d.YolosForObjectDetection,d.YolosImageProcessor,d.YolosModel,d.YolosObjectDetectionOutput,d.YolosPreTrainedModel,d.ZeroShotAudioClassificationPipeline,d.ZeroShotClassificationPipeline,d.ZeroShotImageClassificationPipeline,d.ZeroShotObjectDetectionPipeline,d.bankers_round,d.cat,d.cos_sim,d.dot,d.dynamic_time_warping;var u=d.env;d.full,d.full_like,d.getCacheShapes,d.hamming,d.hanning,d.interpolate,d.interpolate_4d,d.interpolate_data,d.is_chinese_char,d.layer_norm,d.load_image,d.load_video,d.log_softmax,d.magnitude,d.matmul,d.max,d.mean,d.mean_pooling,d.medianFilter,d.mel_filter_bank,d.min,d.ones,d.ones_like,d.permute,d.permute_data;var m=d.pipeline;d.quantize_embeddings,d.rand,d.read_audio,d.rfft,d.round,d.slice,d.softmax,d.spectrogram,d.stack,d.std_mean,d.topk,d.window_function,d.zeros,d.zeros_like}}]);
12//# sourceMappingURL=adda3502.ec2b044103e011bd.js.map

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.