',q=window.open();q.document.write(K),q.document.title=M}},c.getDefaultOption=function(_){var T={show:!0,icon:"M4.7,22.9L29.3,45.5L54.7,23.4M4.6,43.6L4.6,58L53.8,58L53.8,43.6M29.2,45.1L29.2,0",title:_.getLocaleModel().get(["toolbox","saveAsImage","title"]),type:"png",connectedBackgroundColor:"#fff",name:"",excludeComponents:["toolbox"],lang:_.getLocaleModel().get(["toolbox","saveAsImage","lang"])};return T},c}(ToolboxFeature);const SaveAsImage$1=SaveAsImage;var INNER_STACK_KEYWORD="__ec_magicType_stack__",radioTypes=[["line","bar"],["stack"]],MagicType=function(x){__extends(c,x);function c(){return x!==null&&x.apply(this,arguments)||this}return c.prototype.getIcons=function(){var _=this.model,T=_.get("icon"),C={};return each$f(_.get("type"),function(M){T[M]&&(C[M]=T[M])}),C},c.getDefaultOption=function(_){var T={show:!0,type:[],icon:{line:"M4.1,28.9h7.1l9.3-22l7.4,38l9.7-19.7l3,12.8h14.9M4.1,58h51.4",bar:"M6.7,22.9h10V48h-10V22.9zM24.9,13h10v35h-10V13zM43.2,2h10v46h-10V2zM3.1,58h53.7",stack:"M8.2,38.4l-8.4,4.1l30.6,15.3L60,42.5l-8.1-4.1l-21.5,11L8.2,38.4z M51.9,30l-8.1,4.2l-13.4,6.9l-13.9-6.9L8.2,30l-8.4,4.2l8.4,4.2l22.2,11l21.5-11l8.1-4.2L51.9,30z M51.9,21.7l-8.1,4.2L35.7,30l-5.3,2.8L24.9,30l-8.4-4.1l-8.3-4.2l-8.4,4.2L8.2,30l8.3,4.2l13.9,6.9l13.4-6.9l8.1-4.2l8.1-4.1L51.9,21.7zM30.4,2.2L-0.2,17.5l8.4,4.1l8.3,4.2l8.4,4.2l5.5,2.7l5.3-2.7l8.1-4.2l8.1-4.2l8.1-4.1L30.4,2.2z"},title:_.getLocaleModel().get(["toolbox","magicType","title"]),option:{},seriesIndex:{}};return T},c.prototype.onclick=function(_,T,C){var M=this.model,E=M.get(["seriesIndex",C]);if(seriesOptGenreator[C]){var P={series:[]},R=function(O){var L=O.subType,F=O.id,V=seriesOptGenreator[C](L,F,O,M);V&&(defaults(V,O.option),P.series.push(V));var W=O.coordinateSystem;if(W&&W.type==="cartesian2d"&&(C==="line"||C==="bar")){var z=W.getAxesByScale("ordinal")[0];if(z){var Z=z.dim,H=Z+"Axis",Y=O.getReferringComponents(H,SINGLE_REFERRING).models[0],U=Y.componentIndex;P[H]=P[H]||[];for(var j=0;j<=U;j++)P[H][U]=P[H][U]||{};P[H][U].boundaryGap=C==="bar"}}};each$f(radioTypes,function(O){indexOf(O,C)>=0&&each$f(O,function(L){M.setIconStatus(L,"normal")})}),M.setIconStatus(C,"emphasis"),_.eachComponent({mainType:"series",query:E==null?null:{seriesIndex:E}},R);var $,G=C;C==="stack"&&($=merge({stack:M.option.title.tiled,tiled:M.option.title.stack},M.option.title),M.get(["iconStatus",C])!=="emphasis"&&(G="tiled")),T.dispatchAction({type:"changeMagicType",currentType:G,newOption:P,newTitle:$,featureName:"magicType"})}},c}(ToolboxFeature),seriesOptGenreator={line:function(x,c,_,T){if(x==="bar")return merge({id:c,type:"line",data:_.get("data"),stack:_.get("stack"),markPoint:_.get("markPoint"),markLine:_.get("markLine")},T.get(["option","line"])||{},!0)},bar:function(x,c,_,T){if(x==="line")return merge({id:c,type:"bar",data:_.get("data"),stack:_.get("stack"),markPoint:_.get("markPoint"),markLine:_.get("markLine")},T.get(["option","bar"])||{},!0)},stack:function(x,c,_,T){var C=_.get("stack")===INNER_STACK_KEYWORD;if(x==="line"||x==="bar")return T.setIconStatus("stack",C?"normal":"emphasis"),merge({id:c,stack:C?"":INNER_STACK_KEYWORD},T.get(["option","stack"])||{},!0)}};registerAction({type:"changeMagicType",event:"magicTypeChanged",update:"prepareAndUpdate"},function(x,c){c.mergeOption(x.newOption)});const MagicType$1=MagicType;var BLOCK_SPLITER=new Array(60).join("-"),ITEM_SPLITER=" ";function groupSeries(x){var c={},_=[],T=[];return x.eachRawSeries(function(C){var M=C.coordinateSystem;if(M&&(M.type==="cartesian2d"||M.type==="polar")){var E=M.getBaseAxis();if(E.type==="category"){var P=E.dim+"_"+E.index;c[P]||(c[P]={categoryAxis:E,valueAxis:M.getOtherAxis(E),series:[]},T.push({axisDim:E.dim,axisIndex:E.index})),c[P].series.push(C)}else _.push(C)}else _.push(C)}),{seriesGroupByCategoryAxis:c,other:_,meta:T}}function assembleSeriesWithCategoryAxis(x){var c=[];return each$f(x,function(_,T){var C=_.categoryAxis,M=_.valueAxis,E=M.dim,P=[" "].concat(map$1(_.series,function(F){return F.name})),R=[C.model.getCategories()];each$f(_.series,function(F){var V=F.getRawData();R.push(F.getRawData().mapArray(V.mapDimension(E),function(W){return W}))});for(var $=[P.join(ITEM_SPLITER)],G=0;G=0)return!0}var itemSplitRegex=new RegExp("["+ITEM_SPLITER+"]+","g");function parseTSVContents(x){for(var c=x.split(/\n+/g),_=trim(c.shift()).split(itemSplitRegex),T=[],C=map$1(_,function(R){return{name:R,data:[]}}),M=0;M=0;M--){var E=_[M];if(E[C])break}if(M<0){var P=x.queryComponents({mainType:"dataZoom",subType:"select",id:C})[0];if(P){var R=P.getPercentRange();_[0][C]={dataZoomId:C,start:R[0],end:R[1]}}}}),_.push(c)}function pop$1(x){var c=getStoreSnapshots(x),_=c[c.length-1];c.length>1&&c.pop();var T={};return each$6(_,function(C,M){for(var E=c.length-1;E>=0;E--)if(C=c[E][M],C){T[M]=C;break}}),T}function clear(x){inner$6(x).snapshots=null}function count$1(x){return getStoreSnapshots(x).length}function getStoreSnapshots(x){var c=inner$6(x);return c.snapshots||(c.snapshots=[{}]),c.snapshots}var RestoreOption=function(x){__extends(c,x);function c(){return x!==null&&x.apply(this,arguments)||this}return c.prototype.onclick=function(_,T){clear(_),T.dispatchAction({type:"restore",from:this.uid})},c.getDefaultOption=function(_){var T={show:!0,icon:"M3.8,33.4 M47,18.9h9.8V8.7 M56.3,20.1 C52.1,9,40.5,0.6,26.8,2.1C12.6,3.7,1.6,16.2,2.1,30.6 M13,41.1H3.1v10.2 M3.7,39.9c4.2,11.1,15.8,19.5,29.5,18 c14.2-1.6,25.2-14.1,24.7-28.5",title:_.getLocaleModel().get(["toolbox","restore","title"])};return T},c}(ToolboxFeature);registerAction({type:"restore",event:"restore",update:"prepareAndUpdate"},function(x,c){c.resetOption("recreate")});const Restore=RestoreOption;var INCLUDE_FINDER_MAIN_TYPES=["grid","xAxis","yAxis","geo","graph","polar","radiusAxis","angleAxis","bmap"],BrushTargetManager=function(){function x(c,_,T){var C=this;this._targetInfoList=[];var M=parseFinder(_,c);each$f(targetInfoBuilders,function(E,P){(!T||!T.include||indexOf(T.include,P)>=0)&&E(M,C._targetInfoList)})}return x.prototype.setOutputRanges=function(c,_){return this.matchOutputRanges(c,_,function(T,C,M){if((T.coordRanges||(T.coordRanges=[])).push(C),!T.coordRange){T.coordRange=C;var E=coordConvert[T.brushType](0,M,C);T.__rangeOffset={offset:diffProcessor[T.brushType](E.values,T.range,[1,1]),xyMinMax:E.xyMinMax}}}),c},x.prototype.matchOutputRanges=function(c,_,T){each$f(c,function(C){var M=this.findTargetInfo(C,_);M&&M!==!0&&each$f(M.coordSyses,function(E){var P=coordConvert[C.brushType](1,E,C.range,!0);T(C,P.values,E,_)})},this)},x.prototype.setInputRanges=function(c,_){each$f(c,function(T){var C=this.findTargetInfo(T,_);if(T.range=T.range||[],C&&C!==!0){T.panelId=C.panelId;var M=coordConvert[T.brushType](0,C.coordSys,T.coordRange),E=T.__rangeOffset;T.range=E?diffProcessor[T.brushType](M.values,E.offset,getScales(M.xyMinMax,E.xyMinMax)):M.values}},this)},x.prototype.makePanelOpts=function(c,_){return map$1(this._targetInfoList,function(T){var C=T.getPanelRect();return{panelId:T.panelId,defaultBrushType:_?_(T):null,clipPath:makeRectPanelClipPath(C),isTargetByCursor:makeRectIsTargetByCursor(C,c,T.coordSysModel),getLinearBrushOtherExtent:makeLinearBrushOtherExtent(C)}})},x.prototype.controlSeries=function(c,_,T){var C=this.findTargetInfo(c,T);return C===!0||C&&indexOf(C.coordSyses,_.coordinateSystem)>=0},x.prototype.findTargetInfo=function(c,_){for(var T=this._targetInfoList,C=parseFinder(_,c),M=0;Mx[1]&&x.reverse(),x}function parseFinder(x,c){return parseFinder$1(x,c,{includeMainTypes:INCLUDE_FINDER_MAIN_TYPES})}var targetInfoBuilders={grid:function(x,c){var _=x.xAxisModels,T=x.yAxisModels,C=x.gridModels,M=createHashMap(),E={},P={};!_&&!T&&!C||(each$f(_,function(R){var $=R.axis.grid.model;M.set($.id,$),E[$.id]=!0}),each$f(T,function(R){var $=R.axis.grid.model;M.set($.id,$),P[$.id]=!0}),each$f(C,function(R){M.set(R.id,R),E[R.id]=!0,P[R.id]=!0}),M.each(function(R){var $=R.coordinateSystem,G=[];each$f($.getCartesians(),function(O,L){(indexOf(_,O.getAxis("x").model)>=0||indexOf(T,O.getAxis("y").model)>=0)&&G.push(O)}),c.push({panelId:"grid--"+R.id,gridModel:R,coordSysModel:R,coordSys:G[0],coordSyses:G,getPanelRect:panelRectBuilders.grid,xAxisDeclared:E[R.id],yAxisDeclared:P[R.id]})}))},geo:function(x,c){each$f(x.geoModels,function(_){var T=_.coordinateSystem;c.push({panelId:"geo--"+_.id,geoModel:_,coordSysModel:_,coordSys:T,coordSyses:[T],getPanelRect:panelRectBuilders.geo})})}},targetInfoMatchers=[function(x,c){var _=x.xAxisModel,T=x.yAxisModel,C=x.gridModel;return!C&&_&&(C=_.axis.grid.model),!C&&T&&(C=T.axis.grid.model),C&&C===c.gridModel},function(x,c){var _=x.geoModel;return _&&_===c.geoModel}],panelRectBuilders={grid:function(){return this.coordSys.master.getRect().clone()},geo:function(){var x=this.coordSys,c=x.getBoundingRect().clone();return c.applyTransform(getTransform$1(x)),c}},coordConvert={lineX:curry$1(axisConvert,0),lineY:curry$1(axisConvert,1),rect:function(x,c,_,T){var C=x?c.pointToData([_[0][0],_[1][0]],T):c.dataToPoint([_[0][0],_[1][0]],T),M=x?c.pointToData([_[0][1],_[1][1]],T):c.dataToPoint([_[0][1],_[1][1]],T),E=[formatMinMax([C[0],M[0]]),formatMinMax([C[1],M[1]])];return{values:E,xyMinMax:E}},polygon:function(x,c,_,T){var C=[[1/0,-1/0],[1/0,-1/0]],M=map$1(_,function(E){var P=x?c.pointToData(E,T):c.dataToPoint(E,T);return C[0][0]=Math.min(C[0][0],P[0]),C[1][0]=Math.min(C[1][0],P[1]),C[0][1]=Math.max(C[0][1],P[0]),C[1][1]=Math.max(C[1][1],P[1]),P});return{values:M,xyMinMax:C}}};function axisConvert(x,c,_,T){var C=_.getAxis(["x","y"][x]),M=formatMinMax(map$1([0,1],function(P){return c?C.coordToData(C.toLocalCoord(T[P]),!0):C.toGlobalCoord(C.dataToCoord(T[P]))})),E=[];return E[x]=M,E[1-x]=[NaN,NaN],{values:M,xyMinMax:E}}var diffProcessor={lineX:curry$1(axisDiffProcessor,0),lineY:curry$1(axisDiffProcessor,1),rect:function(x,c,_){return[[x[0][0]-_[0]*c[0][0],x[0][1]-_[0]*c[0][1]],[x[1][0]-_[1]*c[1][0],x[1][1]-_[1]*c[1][1]]]},polygon:function(x,c,_){return map$1(x,function(T,C){return[T[0]-_[0]*c[C][0],T[1]-_[1]*c[C][1]]})}};function axisDiffProcessor(x,c,_,T){return[c[0]-T[x]*_[0],c[1]-T[x]*_[1]]}function getScales(x,c){var _=getSize(x),T=getSize(c),C=[_[0]/T[0],_[1]/T[1]];return isNaN(C[0])&&(C[0]=1),isNaN(C[1])&&(C[1]=1),C}function getSize(x){return x?[x[0][1]-x[0][0],x[1][1]-x[1][0]]:[NaN,NaN]}const BrushTargetManager$1=BrushTargetManager;var each$5=each$f,DATA_ZOOM_ID_BASE=makeInternalComponentId("toolbox-dataZoom_"),DataZoomFeature=function(x){__extends(c,x);function c(){return x!==null&&x.apply(this,arguments)||this}return c.prototype.render=function(_,T,C,M){this._brushController||(this._brushController=new BrushController$1(C.getZr()),this._brushController.on("brush",bind$1(this._onBrush,this)).mount()),updateZoomBtnStatus(_,T,this,M,C),updateBackBtnStatus(_,T)},c.prototype.onclick=function(_,T,C){handlers[C].call(this)},c.prototype.remove=function(_,T){this._brushController&&this._brushController.unmount()},c.prototype.dispose=function(_,T){this._brushController&&this._brushController.dispose()},c.prototype._onBrush=function(_){var T=_.areas;if(!_.isEnd||!T.length)return;var C={},M=this.ecModel;this._brushController.updateCovers([]);var E=new BrushTargetManager$1(makeAxisFinder(this.model),M,{include:["grid"]});E.matchOutputRanges(T,M,function($,G,O){if(O.type==="cartesian2d"){var L=$.brushType;L==="rect"?(P("x",O,G[0]),P("y",O,G[1])):P({lineX:"x",lineY:"y"}[L],O,G)}}),push(M,C),this._dispatchZoomAction(C);function P($,G,O){var L=G.getAxis($),F=L.model,V=R($,F,M),W=V.findRepresentativeAxisProxy(F).getMinMaxSpan();(W.minValueSpan!=null||W.maxValueSpan!=null)&&(O=sliderMove(0,O.slice(),L.scale.getExtent(),0,W.minValueSpan,W.maxValueSpan)),V&&(C[V.id]={dataZoomId:V.id,startValue:O[0],endValue:O[1]})}function R($,G,O){var L;return O.eachComponent({mainType:"dataZoom",subType:"select"},function(F){var V=F.getAxisModel($,G.componentIndex);V&&(L=F)}),L}},c.prototype._dispatchZoomAction=function(_){var T=[];each$5(_,function(C,M){T.push(clone$4(C))}),T.length&&this.api.dispatchAction({type:"dataZoom",from:this.uid,batch:T})},c.getDefaultOption=function(_){var T={show:!0,filterMode:"filter",icon:{zoom:"M0,13.5h26.9 M13.5,26.9V0 M32.1,13.5H58V58H13.5 V32.1",back:"M22,1.4L9.9,13.5l12.3,12.3 M10.3,13.5H54.9v44.6 H10.3v-26"},title:_.getLocaleModel().get(["toolbox","dataZoom","title"]),brushStyle:{borderWidth:0,color:"rgba(210,219,238,0.2)"}};return T},c}(ToolboxFeature),handlers={zoom:function(){var x=!this._isZoomActive;this.api.dispatchAction({type:"takeGlobalCursor",key:"dataZoomSelect",dataZoomSelectActive:x})},back:function(){this._dispatchZoomAction(pop$1(this.ecModel))}};function makeAxisFinder(x){var c={xAxisIndex:x.get("xAxisIndex",!0),yAxisIndex:x.get("yAxisIndex",!0),xAxisId:x.get("xAxisId",!0),yAxisId:x.get("yAxisId",!0)};return c.xAxisIndex==null&&c.xAxisId==null&&(c.xAxisIndex="all"),c.yAxisIndex==null&&c.yAxisId==null&&(c.yAxisIndex="all"),c}function updateBackBtnStatus(x,c){x.setIconStatus("back",count$1(c)>1?"emphasis":"normal")}function updateZoomBtnStatus(x,c,_,T,C){var M=_._isZoomActive;T&&T.type==="takeGlobalCursor"&&(M=T.key==="dataZoomSelect"?T.dataZoomSelectActive:!1),_._isZoomActive=M,x.setIconStatus("zoom",M?"emphasis":"normal");var E=new BrushTargetManager$1(makeAxisFinder(x),c,{include:["grid"]}),P=E.makePanelOpts(C,function(R){return R.xAxisDeclared&&!R.yAxisDeclared?"lineX":!R.xAxisDeclared&&R.yAxisDeclared?"lineY":"rect"});_._brushController.setPanels(P).enableBrush(M&&P.length?{brushType:"auto",brushStyle:x.getModel("brushStyle").getItemStyle()}:!1)}registerInternalOptionCreator("dataZoom",function(x){var c=x.getComponent("toolbox",0),_=["feature","dataZoom"];if(!c||c.get(_)==null)return;var T=c.getModel(_),C=[],M=makeAxisFinder(T),E=parseFinder$1(x,M);each$5(E.xAxisModels,function(R){return P(R,"xAxis","xAxisIndex")}),each$5(E.yAxisModels,function(R){return P(R,"yAxis","yAxisIndex")});function P(R,$,G){var O=R.componentIndex,L={type:"select",$fromToolbox:!0,filterMode:T.get("filterMode",!0)||"filter",id:DATA_ZOOM_ID_BASE+$+O};L[G]=O,C.push(L)}return C});const DataZoom=DataZoomFeature;function install$j(x){x.registerComponentModel(ToolboxModel$1),x.registerComponentView(ToolboxView$1),registerFeature("saveAsImage",SaveAsImage$1),registerFeature("magicType",MagicType$1),registerFeature("dataView",DataView$2),registerFeature("dataZoom",DataZoom),registerFeature("restore",Restore),use(install$k)}var TooltipModel=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_}return c.type="tooltip",c.dependencies=["axisPointer"],c.defaultOption={z:60,show:!0,showContent:!0,trigger:"item",triggerOn:"mousemove|click",alwaysShowContent:!1,displayMode:"single",renderMode:"auto",confine:null,showDelay:0,hideDelay:100,transitionDuration:.4,enterable:!1,backgroundColor:"#fff",shadowBlur:10,shadowColor:"rgba(0, 0, 0, .2)",shadowOffsetX:1,shadowOffsetY:2,borderRadius:4,borderWidth:1,padding:null,extraCssText:"",axisPointer:{type:"line",axis:"auto",animation:"auto",animationDurationUpdate:200,animationEasingUpdate:"exponentialOut",crossStyle:{color:"#999",width:1,type:"dashed",textStyle:{}}},textStyle:{color:"#666",fontSize:14}},c}(ComponentModel$1);const TooltipModel$1=TooltipModel;function shouldTooltipConfine(x){var c=x.get("confine");return c!=null?!!c:x.get("renderMode")==="richText"}function testStyle(x){if(env$4.domSupported){for(var c=document.documentElement.style,_=0,T=x.length;_-1?(P+="top:50%",R+="translateY(-50%) rotate("+($=M==="left"?-225:-45)+"deg)"):(P+="left:50%",R+="translateX(-50%) rotate("+($=M==="top"?225:45)+"deg)");var G=$*Math.PI/180,O=E+C,L=O*Math.abs(Math.cos(G))+O*Math.abs(Math.sin(G)),F=Math.round(((L-Math.SQRT2*C)/2+Math.SQRT2*C-(L-O)/2)*100)/100;P+=";"+M+":-"+F+"px";var V=c+" solid "+C+"px;",W=["position:absolute;width:"+E+"px;height:"+E+"px;z-index:-1;",P+";"+R+";","border-bottom:"+V,"border-right:"+V,"background-color:"+T+";"];return'
'}function assembleTransition(x,c){var _="cubic-bezier(0.23,1,0.32,1)",T=" "+x/2+"s "+_,C="opacity"+T+",visibility"+T;return c||(T=" "+x+"s "+_,C+=env$4.transformSupported?","+CSS_TRANSFORM_VENDOR+T:",left"+T+",top"+T),CSS_TRANSITION_VENDOR+":"+C}function assembleTransform(x,c,_){var T=x.toFixed(0)+"px",C=c.toFixed(0)+"px";if(!env$4.transformSupported)return _?"top:"+C+";left:"+T+";":[["top",C],["left",T]];var M=env$4.transform3dSupported,E="translate"+(M?"3d":"")+"("+T+","+C+(M?",0":"")+")";return _?"top:0;left:0;"+CSS_TRANSFORM_VENDOR+":"+E+";":[["top",0],["left",0],[TRANSFORM_VENDOR,E]]}function assembleFont(x){var c=[],_=x.get("fontSize"),T=x.getTextColor();T&&c.push("color:"+T),c.push("font:"+x.getFont()),_&&c.push("line-height:"+Math.round(_*3/2)+"px");var C=x.get("textShadowColor"),M=x.get("textShadowBlur")||0,E=x.get("textShadowOffsetX")||0,P=x.get("textShadowOffsetY")||0;return C&&M&&c.push("text-shadow:"+E+"px "+P+"px "+M+"px "+C),each$f(["decoration","align"],function(R){var $=x.get(R);$&&c.push("text-"+R+":"+$)}),c.join(";")}function assembleCssText(x,c,_){var T=[],C=x.get("transitionDuration"),M=x.get("backgroundColor"),E=x.get("shadowBlur"),P=x.get("shadowColor"),R=x.get("shadowOffsetX"),$=x.get("shadowOffsetY"),G=x.getModel("textStyle"),O=getPaddingFromTooltipModel(x,"html"),L=R+"px "+$+"px "+E+"px "+P;return T.push("box-shadow:"+L),c&&C&&T.push(assembleTransition(C,_)),M&&T.push("background-color:"+M),each$f(["width","color","radius"],function(F){var V="border-"+F,W=toCamelCase(V),z=x.get(W);z!=null&&T.push(V+":"+z+(F==="color"?"":"px"))}),T.push(assembleFont(G)),O!=null&&T.push("padding:"+normalizeCssArray(O).join("px ")+"px"),T.join(";")+";"}function makeStyleCoord$1(x,c,_,T,C){var M=c&&c.painter;if(_){var E=M&&M.getViewportRoot();E&&transformLocalCoord(x,E,document.body,T,C)}else{x[0]=T,x[1]=C;var P=M&&M.getViewportRootOffset();P&&(x[0]+=P.offsetLeft,x[1]+=P.offsetTop)}x[2]=x[0]/c.getWidth(),x[3]=x[1]/c.getHeight()}var TooltipHTMLContent=function(){function x(c,_,T){if(this._show=!1,this._styleCoord=[0,0,0,0],this._enterable=!0,this._alwaysShowContent=!1,this._firstShow=!0,this._longHide=!0,env$4.wxa)return null;var C=document.createElement("div");C.domBelongToZr=!0,this.el=C;var M=this._zr=_.getZr(),E=this._appendToBody=T&&T.appendToBody;makeStyleCoord$1(this._styleCoord,M,E,_.getWidth()/2,_.getHeight()/2),E?document.body.appendChild(C):c.appendChild(C),this._container=c;var P=this;C.onmouseenter=function(){P._enterable&&(clearTimeout(P._hideTimeout),P._show=!0),P._inContent=!0},C.onmousemove=function(R){if(R=R||window.event,!P._enterable){var $=M.handler,G=M.painter.getViewportRoot();normalizeEvent(G,R,!0),$.dispatch("mousemove",R)}},C.onmouseleave=function(){P._inContent=!1,P._enterable&&P._show&&P.hideLater(P._hideDelay)}}return x.prototype.update=function(c){var _=this._container,T=getComputedStyle$1(_,"position"),C=_.style;C.position!=="absolute"&&T!=="absolute"&&(C.position="relative");var M=c.get("alwaysShowContent");M&&this._moveIfResized(),this._alwaysShowContent=M,this.el.className=c.get("className")||""},x.prototype.show=function(c,_){clearTimeout(this._hideTimeout),clearTimeout(this._longHideTimeout);var T=this.el,C=T.style,M=this._styleCoord;T.innerHTML?C.cssText=gCssText+assembleCssText(c,!this._firstShow,this._longHide)+assembleTransform(M[0],M[1],!0)+("border-color:"+convertToColorString(_)+";")+(c.get("extraCssText")||"")+(";pointer-events:"+(this._enterable?"auto":"none")):C.display="none",this._show=!0,this._firstShow=!1,this._longHide=!1},x.prototype.setContent=function(c,_,T,C,M){var E=this.el;if(c==null){E.innerHTML="";return}var P="";if(isString(M)&&T.get("trigger")==="item"&&!shouldTooltipConfine(T)&&(P=assembleArrow(T,C,M)),isString(c))E.innerHTML=c+P;else if(c){E.innerHTML="",isArray$1(c)||(c=[c]);for(var R=0;R=0?this._tryShow(M,E):C==="leave"&&this._hide(E))},this))},c.prototype._keepShow=function(){var _=this._tooltipModel,T=this._ecModel,C=this._api,M=_.get("triggerOn");if(this._lastX!=null&&this._lastY!=null&&M!=="none"&&M!=="click"){var E=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout(function(){!C.isDisposed()&&E.manuallyShowTip(_,T,C,{x:E._lastX,y:E._lastY,dataByCoordSys:E._lastDataByCoordSys})})}},c.prototype.manuallyShowTip=function(_,T,C,M){if(!(M.from===this.uid||env$4.node||!C.getDom())){var E=makeDispatchAction(M,C);this._ticket="";var P=M.dataByCoordSys,R=findComponentReference(M,T,C);if(R){var $=R.el.getBoundingRect().clone();$.applyTransform(R.el.transform),this._tryShow({offsetX:$.x+$.width/2,offsetY:$.y+$.height/2,target:R.el,position:M.position,positionDefault:"bottom"},E)}else if(M.tooltip&&M.x!=null&&M.y!=null){var G=proxyRect;G.x=M.x,G.y=M.y,G.update(),getECData(G).tooltipConfig={name:null,option:M.tooltip},this._tryShow({offsetX:M.x,offsetY:M.y,target:G},E)}else if(P)this._tryShow({offsetX:M.x,offsetY:M.y,position:M.position,dataByCoordSys:P,tooltipOption:M.tooltipOption},E);else if(M.seriesIndex!=null){if(this._manuallyAxisShowTip(_,T,C,M))return;var O=findPointFromSeries(M,T),L=O.point[0],F=O.point[1];L!=null&&F!=null&&this._tryShow({offsetX:L,offsetY:F,target:O.el,position:M.position,positionDefault:"bottom"},E)}else M.x!=null&&M.y!=null&&(C.dispatchAction({type:"updateAxisPointer",x:M.x,y:M.y}),this._tryShow({offsetX:M.x,offsetY:M.y,position:M.position,target:C.getZr().findHover(M.x,M.y).target},E))}},c.prototype.manuallyHideTip=function(_,T,C,M){var E=this._tooltipContent;this._tooltipModel&&E.hideLater(this._tooltipModel.get("hideDelay")),this._lastX=this._lastY=this._lastDataByCoordSys=null,M.from!==this.uid&&this._hide(makeDispatchAction(M,C))},c.prototype._manuallyAxisShowTip=function(_,T,C,M){var E=M.seriesIndex,P=M.dataIndex,R=T.getComponent("axisPointer").coordSysAxesInfo;if(!(E==null||P==null||R==null)){var $=T.getSeriesByIndex(E);if($){var G=$.getData(),O=buildTooltipModel([G.getItemModel(P),$,($.coordinateSystem||{}).model],this._tooltipModel);if(O.get("trigger")==="axis")return C.dispatchAction({type:"updateAxisPointer",seriesIndex:E,dataIndex:P,position:M.position}),!0}}},c.prototype._tryShow=function(_,T){var C=_.target,M=this._tooltipModel;if(M){this._lastX=_.offsetX,this._lastY=_.offsetY;var E=_.dataByCoordSys;if(E&&E.length)this._showAxisTooltip(E,_);else if(C){this._lastDataByCoordSys=null;var P,R;findEventDispatcher(C,function($){if(getECData($).dataIndex!=null)return P=$,!0;if(getECData($).tooltipConfig!=null)return R=$,!0},!0),P?this._showSeriesItemTooltip(_,P,T):R?this._showComponentItemTooltip(_,R,T):this._hide(T)}else this._lastDataByCoordSys=null,this._hide(T)}},c.prototype._showOrMove=function(_,T){var C=_.get("showDelay");T=bind$1(T,this),clearTimeout(this._showTimout),C>0?this._showTimout=setTimeout(T,C):T()},c.prototype._showAxisTooltip=function(_,T){var C=this._ecModel,M=this._tooltipModel,E=[T.offsetX,T.offsetY],P=buildTooltipModel([T.tooltipOption],M),R=this._renderMode,$=[],G=createTooltipMarkup("section",{blocks:[],noHeader:!0}),O=[],L=new TooltipMarkupStyleCreator;each$f(_,function(H){each$f(H.dataByAxis,function(Y){var U=C.getComponent(Y.axisDim+"Axis",Y.axisIndex),j=Y.value;if(!(!U||j==null)){var X=getValueLabel(j,U.axis,C,Y.seriesDataIndices,Y.valueLabelOpt),K=createTooltipMarkup("section",{header:X,noHeader:!trim$1(X),sortBlocks:!0,blocks:[]});G.blocks.push(K),each$f(Y.seriesDataIndices,function(q){var J=C.getSeriesByIndex(q.seriesIndex),Q=q.dataIndexInside,ee=J.getDataParams(Q);if(!(ee.dataIndex<0)){ee.axisDim=Y.axisDim,ee.axisIndex=Y.axisIndex,ee.axisType=Y.axisType,ee.axisId=Y.axisId,ee.axisValue=getAxisRawValue(U.axis,{value:j}),ee.axisValueLabel=X,ee.marker=L.makeTooltipMarker("item",convertToColorString(ee.color),R);var re=normalizeTooltipFormatResult(J.formatTooltip(Q,!0,null)),ie=re.frag;if(ie){var ae=buildTooltipModel([J],M).get("valueFormatter");K.blocks.push(ae?extend({valueFormatter:ae},ie):ie)}re.text&&O.push(re.text),$.push(ee)}})}})}),G.blocks.reverse(),O.reverse();var F=T.position,V=P.get("order"),W=buildTooltipMarkup(G,L,R,V,C.get("useUTC"),P.get("textStyle"));W&&O.unshift(W);var z=R==="richText"?` `:"
",Z=O.join(z);this._showOrMove(P,function(){this._updateContentNotChangedOnAxis(_,$)?this._updatePosition(P,F,E[0],E[1],this._tooltipContent,$):this._showTooltipContent(P,Z,$,Math.random()+"",E[0],E[1],F,null,L)})},c.prototype._showSeriesItemTooltip=function(_,T,C){var M=this._ecModel,E=getECData(T),P=E.seriesIndex,R=M.getSeriesByIndex(P),$=E.dataModel||R,G=E.dataIndex,O=E.dataType,L=$.getData(O),F=this._renderMode,V=_.positionDefault,W=buildTooltipModel([L.getItemModel(G),$,R&&(R.coordinateSystem||{}).model],this._tooltipModel,V?{position:V}:null),z=W.get("trigger");if(!(z!=null&&z!=="item")){var Z=$.getDataParams(G,O),H=new TooltipMarkupStyleCreator;Z.marker=H.makeTooltipMarker("item",convertToColorString(Z.color),F);var Y=normalizeTooltipFormatResult($.formatTooltip(G,!1,O)),U=W.get("order"),j=W.get("valueFormatter"),X=Y.frag,K=X?buildTooltipMarkup(j?extend({valueFormatter:j},X):X,H,F,U,M.get("useUTC"),W.get("textStyle")):Y.text,q="item_"+$.name+"_"+G;this._showOrMove(W,function(){this._showTooltipContent(W,K,Z,q,_.offsetX,_.offsetY,_.position,_.target,H)}),C({type:"showTip",dataIndexInside:G,dataIndex:L.getRawIndex(G),seriesIndex:P,from:this.uid})}},c.prototype._showComponentItemTooltip=function(_,T,C){var M=getECData(T),E=M.tooltipConfig,P=E.option||{};if(isString(P)){var R=P;P={content:R,formatter:R}}var $=[P],G=this._ecModel.getComponent(M.componentMainType,M.componentIndex);G&&$.push(G),$.push({formatter:P.content});var O=_.positionDefault,L=buildTooltipModel($,this._tooltipModel,O?{position:O}:null),F=L.get("content"),V=Math.random()+"",W=new TooltipMarkupStyleCreator;this._showOrMove(L,function(){var z=clone$4(L.get("formatterParams")||{});this._showTooltipContent(L,F,z,V,_.offsetX,_.offsetY,_.position,T,W)}),C({type:"showTip",from:this.uid})},c.prototype._showTooltipContent=function(_,T,C,M,E,P,R,$,G){if(this._ticket="",!(!_.get("showContent")||!_.get("show"))){var O=this._tooltipContent;O.setEnterable(_.get("enterable"));var L=_.get("formatter");R=R||_.get("position");var F=T,V=this._getNearestPoint([E,P],C,_.get("trigger"),_.get("borderColor")),W=V.color;if(L)if(isString(L)){var z=_.ecModel.get("useUTC"),Z=isArray$1(C)?C[0]:C,H=Z&&Z.axisType&&Z.axisType.indexOf("time")>=0;F=L,H&&(F=format$1(Z.axisValue,F,z)),F=formatTpl(F,C,!0)}else if(isFunction(L)){var Y=bind$1(function(U,j){U===this._ticket&&(O.setContent(j,G,_,W,R),this._updatePosition(_,R,E,P,O,C,$))},this);this._ticket=M,F=L(C,M,Y)}else F=L;O.setContent(F,G,_,W,R),O.show(_,W),this._updatePosition(_,R,E,P,O,C,$)}},c.prototype._getNearestPoint=function(_,T,C,M){if(C==="axis"||isArray$1(T))return{color:M||(this._renderMode==="html"?"#fff":"none")};if(!isArray$1(T))return{color:M||T.color||T.borderColor}},c.prototype._updatePosition=function(_,T,C,M,E,P,R){var $=this._api.getWidth(),G=this._api.getHeight();T=T||_.get("position");var O=E.getSize(),L=_.get("align"),F=_.get("verticalAlign"),V=R&&R.getBoundingRect().clone();if(R&&V.applyTransform(R.transform),isFunction(T)&&(T=T([C,M],P,E.el,V,{viewSize:[$,G],contentSize:O.slice()})),isArray$1(T))C=parsePercent(T[0],$),M=parsePercent(T[1],G);else if(isObject$3(T)){var W=T;W.width=O[0],W.height=O[1];var z=getLayoutRect(W,{width:$,height:G});C=z.x,M=z.y,L=null,F=null}else if(isString(T)&&R){var Z=calcTooltipPosition(T,V,O,_.get("borderWidth"));C=Z[0],M=Z[1]}else{var Z=refixTooltipPosition(C,M,E,$,G,L?null:20,F?null:20);C=Z[0],M=Z[1]}if(L&&(C-=isCenterAlign(L)?O[0]/2:L==="right"?O[0]:0),F&&(M-=isCenterAlign(F)?O[1]/2:F==="bottom"?O[1]:0),shouldTooltipConfine(_)){var Z=confineTooltipPosition(C,M,E,$,G);C=Z[0],M=Z[1]}E.moveTo(C,M)},c.prototype._updateContentNotChangedOnAxis=function(_,T){var C=this._lastDataByCoordSys,M=this._cbParamsList,E=!!C&&C.length===_.length;return E&&each$f(C,function(P,R){var $=P.dataByAxis||[],G=_[R]||{},O=G.dataByAxis||[];E=E&&$.length===O.length,E&&each$f($,function(L,F){var V=O[F]||{},W=L.seriesDataIndices||[],z=V.seriesDataIndices||[];E=E&&L.value===V.value&&L.axisType===V.axisType&&L.axisId===V.axisId&&W.length===z.length,E&&each$f(W,function(Z,H){var Y=z[H];E=E&&Z.seriesIndex===Y.seriesIndex&&Z.dataIndex===Y.dataIndex}),M&&each$f(L.seriesDataIndices,function(Z){var H=Z.seriesIndex,Y=T[H],U=M[H];Y&&U&&U.data!==Y.data&&(E=!1)})})}),this._lastDataByCoordSys=_,this._cbParamsList=T,!!E},c.prototype._hide=function(_){this._lastDataByCoordSys=null,_({type:"hideTip",from:this.uid})},c.prototype.dispose=function(_,T){env$4.node||!T.getDom()||(clear$1(this,"_updatePosition"),this._tooltipContent.dispose(),unregister("itemTooltip",T))},c.type="tooltip",c}(ComponentView$1);function buildTooltipModel(x,c,_){var T=c.ecModel,C;_?(C=new Model$1(_,T,T),C=new Model$1(c.option,C,T)):C=c;for(var M=x.length-1;M>=0;M--){var E=x[M];E&&(E instanceof Model$1&&(E=E.get("tooltip",!0)),isString(E)&&(E={formatter:E}),E&&(C=new Model$1(E,C,T)))}return C}function makeDispatchAction(x,c){return x.dispatchAction||bind$1(c.dispatchAction,c)}function refixTooltipPosition(x,c,_,T,C,M,E){var P=_.getSize(),R=P[0],$=P[1];return M!=null&&(x+R+M+2>T?x-=R+M:x+=M),E!=null&&(c+$+E>C?c-=$+E:c+=E),[x,c]}function confineTooltipPosition(x,c,_,T,C){var M=_.getSize(),E=M[0],P=M[1];return x=Math.min(x+E,T)-E,c=Math.min(c+P,C)-P,x=Math.max(x,0),c=Math.max(c,0),[x,c]}function calcTooltipPosition(x,c,_,T){var C=_[0],M=_[1],E=Math.ceil(Math.SQRT2*T)+8,P=0,R=0,$=c.width,G=c.height;switch(x){case"inside":P=c.x+$/2-C/2,R=c.y+G/2-M/2;break;case"top":P=c.x+$/2-C/2,R=c.y-M-E;break;case"bottom":P=c.x+$/2-C/2,R=c.y+G+E;break;case"left":P=c.x-C-E,R=c.y+G/2-M/2;break;case"right":P=c.x+$+E,R=c.y+G/2-M/2}return[P,R]}function isCenterAlign(x){return x==="center"||x==="middle"}function findComponentReference(x,c,_){var T=preParseFinder(x).queryOptionMap,C=T.keys()[0];if(!(!C||C==="series")){var M=queryReferringComponents(c,C,T.get(C),{useDefault:!1,enableAll:!1,enableNone:!1}),E=M.models[0];if(E){var P=_.getViewOfComponentModel(E),R;if(P.group.traverse(function($){var G=getECData($).tooltipConfig;if(G&&G.name===x.name)return R=$,!0}),R)return{componentMainType:C,componentIndex:E.componentIndex,el:R}}}}const TooltipView$1=TooltipView;function install$i(x){use(install$q),x.registerComponentModel(TooltipModel$1),x.registerComponentView(TooltipView$1),x.registerAction({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},noop),x.registerAction({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},noop)}var DEFAULT_TOOLBOX_BTNS=["rect","polygon","keep","clear"];function brushPreprocessor(x,c){var _=normalizeToArray(x?x.brush:[]);if(_.length){var T=[];each$f(_,function(R){var $=R.hasOwnProperty("toolbox")?R.toolbox:[];$ instanceof Array&&(T=T.concat($))});var C=x&&x.toolbox;isArray$1(C)&&(C=C[0]),C||(C={feature:{}},x.toolbox=[C]);var M=C.feature||(C.feature={}),E=M.brush||(M.brush={}),P=E.type||(E.type=[]);P.push.apply(P,T),removeDuplicate(P),c&&!P.length&&P.push.apply(P,DEFAULT_TOOLBOX_BTNS)}}function removeDuplicate(x){var c={};each$f(x,function(_){c[_]=1}),x.length=0,each$f(c,function(_,T){x.push(T)})}var each$4=each$f;function hasKeys(x){if(x){for(var c in x)if(x.hasOwnProperty(c))return!0}}function createVisualMappings(x,c,_){var T={};return each$4(c,function(M){var E=T[M]=C();each$4(x[M],function(P,R){if(VisualMapping$1.isValidType(R)){var $={type:R,visual:P};_&&_($,M),E[R]=new VisualMapping$1($),R==="opacity"&&($=clone$4($),$.type="colorAlpha",E.__hidden.__alphaForOpacity=new VisualMapping$1($))}})}),T;function C(){var M=function(){};M.prototype.__hidden=M.prototype;var E=new M;return E}}function replaceVisualOption(x,c,_){var T;each$f(_,function(C){c.hasOwnProperty(C)&&hasKeys(c[C])&&(T=!0)}),T&&each$f(_,function(C){c.hasOwnProperty(C)&&hasKeys(c[C])?x[C]=clone$4(c[C]):delete x[C]})}function applyVisual(x,c,_,T,C,M){var E={};each$f(x,function(O){var L=VisualMapping$1.prepareVisualTypes(c[O]);E[O]=L});var P;function R(O){return getItemVisualFromData(_,P,O)}function $(O,L){setItemVisualFromData(_,P,O,L)}M==null?_.each(G):_.each([M],G);function G(O,L){P=M==null?O:L;var F=_.getRawDataItem(P);if(!(F&&F.visualMap===!1))for(var V=T.call(C,O),W=c[V],z=E[V],Z=0,H=z.length;Zc[0][1]&&(c[0][1]=M[0]),M[1]c[1][1]&&(c[1][1]=M[1])}return c&&getBoundingRectFromMinMax(c)}};function getBoundingRectFromMinMax(x){return new BoundingRect$1(x[0][0],x[1][0],x[0][1]-x[0][0],x[1][1]-x[1][0])}var BrushView=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_}return c.prototype.init=function(_,T){this.ecModel=_,this.api=T,this.model,(this._brushController=new BrushController$1(T.getZr())).on("brush",bind$1(this._onBrush,this)).mount()},c.prototype.render=function(_,T,C,M){this.model=_,this._updateController(_,T,C,M)},c.prototype.updateTransform=function(_,T,C,M){layoutCovers(T),this._updateController(_,T,C,M)},c.prototype.updateVisual=function(_,T,C,M){this.updateTransform(_,T,C,M)},c.prototype.updateView=function(_,T,C,M){this._updateController(_,T,C,M)},c.prototype._updateController=function(_,T,C,M){(!M||M.$from!==_.id)&&this._brushController.setPanels(_.brushTargetManager.makePanelOpts(C)).enableBrush(_.brushOption).updateCovers(_.areas.slice())},c.prototype.dispose=function(){this._brushController.dispose()},c.prototype._onBrush=function(_){var T=this.model.id,C=this.model.brushTargetManager.setOutputRanges(_.areas,this.ecModel);(!_.isEnd||_.removeOnClick)&&this.api.dispatchAction({type:"brush",brushId:T,areas:clone$4(C),$from:T}),_.isEnd&&this.api.dispatchAction({type:"brushEnd",brushId:T,areas:clone$4(C),$from:T})},c.type="brush",c}(ComponentView$1);const BrushView$1=BrushView;var DEFAULT_OUT_OF_BRUSH_COLOR="#ddd",BrushModel=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_.areas=[],_.brushOption={},_}return c.prototype.optionUpdated=function(_,T){var C=this.option;!T&&replaceVisualOption(C,_,["inBrush","outOfBrush"]);var M=C.inBrush=C.inBrush||{};C.outOfBrush=C.outOfBrush||{color:DEFAULT_OUT_OF_BRUSH_COLOR},M.hasOwnProperty("liftZ")||(M.liftZ=5)},c.prototype.setAreas=function(_){_&&(this.areas=map$1(_,function(T){return generateBrushOption(this.option,T)},this))},c.prototype.setBrushOption=function(_){this.brushOption=generateBrushOption(this.option,_),this.brushType=this.brushOption.brushType},c.type="brush",c.dependencies=["geo","grid","xAxis","yAxis","parallel","series"],c.defaultOption={seriesIndex:"all",brushType:"rect",brushMode:"single",transformable:!0,brushStyle:{borderWidth:1,color:"rgba(210,219,238,0.3)",borderColor:"#D2DBEE"},throttleType:"fixRate",throttleDelay:0,removeOnClick:!0,z:1e4},c}(ComponentModel$1);function generateBrushOption(x,c){return merge({brushType:x.brushType,brushMode:x.brushMode,transformable:x.transformable,brushStyle:new Model$1(x.brushStyle).getItemStyle(),removeOnClick:x.removeOnClick,z:x.z},c,!0)}const BrushModel$1=BrushModel;var ICON_TYPES=["rect","polygon","lineX","lineY","keep","clear"],BrushFeature=function(x){__extends(c,x);function c(){return x!==null&&x.apply(this,arguments)||this}return c.prototype.render=function(_,T,C){var M,E,P;T.eachComponent({mainType:"brush"},function(R){M=R.brushType,E=R.brushOption.brushMode||"single",P=P||!!R.areas.length}),this._brushType=M,this._brushMode=E,each$f(_.get("type",!0),function(R){_.setIconStatus(R,(R==="keep"?E==="multiple":R==="clear"?P:R===M)?"emphasis":"normal")})},c.prototype.updateView=function(_,T,C){this.render(_,T,C)},c.prototype.getIcons=function(){var _=this.model,T=_.get("icon",!0),C={};return each$f(_.get("type",!0),function(M){T[M]&&(C[M]=T[M])}),C},c.prototype.onclick=function(_,T,C){var M=this._brushType,E=this._brushMode;C==="clear"?(T.dispatchAction({type:"axisAreaSelect",intervals:[]}),T.dispatchAction({type:"brush",command:"clear",areas:[]})):T.dispatchAction({type:"takeGlobalCursor",key:"brush",brushOption:{brushType:C==="keep"?M:M===C?!1:C,brushMode:C==="keep"?E==="multiple"?"single":"multiple":E}})},c.getDefaultOption=function(_){var T={show:!0,type:ICON_TYPES.slice(),icon:{rect:"M7.3,34.7 M0.4,10V-0.2h9.8 M89.6,10V-0.2h-9.8 M0.4,60v10.2h9.8 M89.6,60v10.2h-9.8 M12.3,22.4V10.5h13.1 M33.6,10.5h7.8 M49.1,10.5h7.8 M77.5,22.4V10.5h-13 M12.3,31.1v8.2 M77.7,31.1v8.2 M12.3,47.6v11.9h13.1 M33.6,59.5h7.6 M49.1,59.5 h7.7 M77.5,47.6v11.9h-13",polygon:"M55.2,34.9c1.7,0,3.1,1.4,3.1,3.1s-1.4,3.1-3.1,3.1 s-3.1-1.4-3.1-3.1S53.5,34.9,55.2,34.9z M50.4,51c1.7,0,3.1,1.4,3.1,3.1c0,1.7-1.4,3.1-3.1,3.1c-1.7,0-3.1-1.4-3.1-3.1 C47.3,52.4,48.7,51,50.4,51z M55.6,37.1l1.5-7.8 M60.1,13.5l1.6-8.7l-7.8,4 M59,19l-1,5.3 M24,16.1l6.4,4.9l6.4-3.3 M48.5,11.6 l-5.9,3.1 M19.1,12.8L9.7,5.1l1.1,7.7 M13.4,29.8l1,7.3l6.6,1.6 M11.6,18.4l1,6.1 M32.8,41.9 M26.6,40.4 M27.3,40.2l6.1,1.6 M49.9,52.1l-5.6-7.6l-4.9-1.2",lineX:"M15.2,30 M19.7,15.6V1.9H29 M34.8,1.9H40.4 M55.3,15.6V1.9H45.9 M19.7,44.4V58.1H29 M34.8,58.1H40.4 M55.3,44.4 V58.1H45.9 M12.5,20.3l-9.4,9.6l9.6,9.8 M3.1,29.9h16.5 M62.5,20.3l9.4,9.6L62.3,39.7 M71.9,29.9H55.4",lineY:"M38.8,7.7 M52.7,12h13.2v9 M65.9,26.6V32 M52.7,46.3h13.2v-9 M24.9,12H11.8v9 M11.8,26.6V32 M24.9,46.3H11.8v-9 M48.2,5.1l-9.3-9l-9.4,9.2 M38.9-3.9V12 M48.2,53.3l-9.3,9l-9.4-9.2 M38.9,62.3V46.4",keep:"M4,10.5V1h10.3 M20.7,1h6.1 M33,1h6.1 M55.4,10.5V1H45.2 M4,17.3v6.6 M55.6,17.3v6.6 M4,30.5V40h10.3 M20.7,40 h6.1 M33,40h6.1 M55.4,30.5V40H45.2 M21,18.9h62.9v48.6H21V18.9z",clear:"M22,14.7l30.9,31 M52.9,14.7L22,45.7 M4.7,16.8V4.2h13.1 M26,4.2h7.8 M41.6,4.2h7.8 M70.3,16.8V4.2H57.2 M4.7,25.9v8.6 M70.3,25.9v8.6 M4.7,43.2v12.6h13.1 M26,55.8h7.8 M41.6,55.8h7.8 M70.3,43.2v12.6H57.2"},title:_.getLocaleModel().get(["toolbox","brush","title"])};return T},c}(ToolboxFeature);const BrushFeature$1=BrushFeature;function install$h(x){x.registerComponentView(BrushView$1),x.registerComponentModel(BrushModel$1),x.registerPreprocessor(brushPreprocessor),x.registerVisual(x.PRIORITY.VISUAL.BRUSH,brushVisual),x.registerAction({type:"brush",event:"brush",update:"updateVisual"},function(c,_){_.eachComponent({mainType:"brush",query:c},function(T){T.setAreas(c.areas)})}),x.registerAction({type:"brushSelect",event:"brushSelected",update:"none"},noop),x.registerAction({type:"brushEnd",event:"brushEnd",update:"none"},noop),registerFeature("brush",BrushFeature$1)}var TitleModel=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_.layoutMode={type:"box",ignoreSize:!0},_}return c.type="title",c.defaultOption={z:6,show:!0,text:"",target:"blank",subtext:"",subtarget:"blank",left:0,top:0,backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderWidth:0,padding:5,itemGap:10,textStyle:{fontSize:18,fontWeight:"bold",color:"#464646"},subtextStyle:{fontSize:12,color:"#6E7079"}},c}(ComponentModel$1),TitleView=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_}return c.prototype.render=function(_,T,C){if(this.group.removeAll(),!!_.get("show")){var M=this.group,E=_.getModel("textStyle"),P=_.getModel("subtextStyle"),R=_.get("textAlign"),$=retrieve2(_.get("textBaseline"),_.get("textVerticalAlign")),G=new ZRText$1({style:createTextStyle(E,{text:_.get("text"),fill:E.getTextColor()},{disableBox:!0}),z2:10}),O=G.getBoundingRect(),L=_.get("subtext"),F=new ZRText$1({style:createTextStyle(P,{text:L,fill:P.getTextColor(),y:O.height+_.get("itemGap"),verticalAlign:"top"},{disableBox:!0}),z2:10}),V=_.get("link"),W=_.get("sublink"),z=_.get("triggerEvent",!0);G.silent=!V&&!z,F.silent=!W&&!z,V&&G.on("click",function(){windowOpen(V,"_"+_.get("target"))}),W&&F.on("click",function(){windowOpen(W,"_"+_.get("subtarget"))}),getECData(G).eventData=getECData(F).eventData=z?{componentType:"title",componentIndex:_.componentIndex}:null,M.add(G),L&&M.add(F);var Z=M.getBoundingRect(),H=_.getBoxLayoutParams();H.width=Z.width,H.height=Z.height;var Y=getLayoutRect(H,{width:C.getWidth(),height:C.getHeight()},_.get("padding"));R||(R=_.get("left")||_.get("right"),R==="middle"&&(R="center"),R==="right"?Y.x+=Y.width:R==="center"&&(Y.x+=Y.width/2)),$||($=_.get("top")||_.get("bottom"),$==="center"&&($="middle"),$==="bottom"?Y.y+=Y.height:$==="middle"&&(Y.y+=Y.height/2),$=$||"top"),M.x=Y.x,M.y=Y.y,M.markRedraw();var U={align:R,verticalAlign:$};G.setStyle(U),F.setStyle(U),Z=M.getBoundingRect();var j=Y.margin,X=_.getItemStyle(["color","opacity"]);X.fill=_.get("backgroundColor");var K=new Rect$3({shape:{x:Z.x-j[3],y:Z.y-j[0],width:Z.width+j[1]+j[3],height:Z.height+j[0]+j[2],r:_.get("borderRadius")},style:X,subPixelOptimize:!0,silent:!0});M.add(K)}},c.type="title",c}(ComponentView$1);function install$g(x){x.registerComponentModel(TitleModel),x.registerComponentView(TitleView)}var TimelineModel=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_.layoutMode="box",_}return c.prototype.init=function(_,T,C){this.mergeDefaultAndTheme(_,C),this._initData()},c.prototype.mergeOption=function(_){x.prototype.mergeOption.apply(this,arguments),this._initData()},c.prototype.setCurrentIndex=function(_){_==null&&(_=this.option.currentIndex);var T=this._data.count();this.option.loop?_=(_%T+T)%T:(_>=T&&(_=T-1),_<0&&(_=0)),this.option.currentIndex=_},c.prototype.getCurrentIndex=function(){return this.option.currentIndex},c.prototype.isIndexMax=function(){return this.getCurrentIndex()>=this._data.count()-1},c.prototype.setPlayState=function(_){this.option.autoPlay=!!_},c.prototype.getPlayState=function(){return!!this.option.autoPlay},c.prototype._initData=function(){var _=this.option,T=_.data||[],C=_.axisType,M=this._names=[],E;C==="category"?(E=[],each$f(T,function($,G){var O=convertOptionIdName(getDataItemValue($),""),L;isObject$3($)?(L=clone$4($),L.value=G):L=G,E.push(L),M.push(O)})):E=T;var P={category:"ordinal",time:"time",value:"number"}[C]||"number",R=this._data=new SeriesData$1([{name:"value",type:P}],this);R.initData(E,M)},c.prototype.getData=function(){return this._data},c.prototype.getCategories=function(){if(this.get("axisType")==="category")return this._names.slice()},c.type="timeline",c.defaultOption={z:4,show:!0,axisType:"time",realtime:!0,left:"20%",top:null,right:"20%",bottom:0,width:null,height:40,padding:5,controlPosition:"left",autoPlay:!1,rewind:!1,loop:!0,playInterval:2e3,currentIndex:0,itemStyle:{},label:{color:"#000"},data:[]},c}(ComponentModel$1);const TimelineModel$1=TimelineModel;var SliderTimelineModel=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_}return c.type="timeline.slider",c.defaultOption=inheritDefaultOption(TimelineModel$1.defaultOption,{backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderWidth:0,orient:"horizontal",inverse:!1,tooltip:{trigger:"item"},symbol:"circle",symbolSize:12,lineStyle:{show:!0,width:2,color:"#DAE1F5"},label:{position:"auto",show:!0,interval:"auto",rotate:0,color:"#A4B1D7"},itemStyle:{color:"#A4B1D7",borderWidth:1},checkpointStyle:{symbol:"circle",symbolSize:15,color:"#316bf3",borderColor:"#fff",borderWidth:2,shadowBlur:2,shadowOffsetX:1,shadowOffsetY:1,shadowColor:"rgba(0, 0, 0, 0.3)",animation:!0,animationDuration:300,animationEasing:"quinticInOut"},controlStyle:{show:!0,showPlayBtn:!0,showPrevBtn:!0,showNextBtn:!0,itemSize:24,itemGap:12,position:"left",playIcon:"path://M31.6,53C17.5,53,6,41.5,6,27.4S17.5,1.8,31.6,1.8C45.7,1.8,57.2,13.3,57.2,27.4S45.7,53,31.6,53z M31.6,3.3 C18.4,3.3,7.5,14.1,7.5,27.4c0,13.3,10.8,24.1,24.1,24.1C44.9,51.5,55.7,40.7,55.7,27.4C55.7,14.1,44.9,3.3,31.6,3.3z M24.9,21.3 c0-2.2,1.6-3.1,3.5-2l10.5,6.1c1.899,1.1,1.899,2.9,0,4l-10.5,6.1c-1.9,1.1-3.5,0.2-3.5-2V21.3z",stopIcon:"path://M30.9,53.2C16.8,53.2,5.3,41.7,5.3,27.6S16.8,2,30.9,2C45,2,56.4,13.5,56.4,27.6S45,53.2,30.9,53.2z M30.9,3.5C17.6,3.5,6.8,14.4,6.8,27.6c0,13.3,10.8,24.1,24.101,24.1C44.2,51.7,55,40.9,55,27.6C54.9,14.4,44.1,3.5,30.9,3.5z M36.9,35.8c0,0.601-0.4,1-0.9,1h-1.3c-0.5,0-0.9-0.399-0.9-1V19.5c0-0.6,0.4-1,0.9-1H36c0.5,0,0.9,0.4,0.9,1V35.8z M27.8,35.8 c0,0.601-0.4,1-0.9,1h-1.3c-0.5,0-0.9-0.399-0.9-1V19.5c0-0.6,0.4-1,0.9-1H27c0.5,0,0.9,0.4,0.9,1L27.8,35.8L27.8,35.8z",nextIcon:"M2,18.5A1.52,1.52,0,0,1,.92,18a1.49,1.49,0,0,1,0-2.12L7.81,9.36,1,3.11A1.5,1.5,0,1,1,3,.89l8,7.34a1.48,1.48,0,0,1,.49,1.09,1.51,1.51,0,0,1-.46,1.1L3,18.08A1.5,1.5,0,0,1,2,18.5Z",prevIcon:"M10,.5A1.52,1.52,0,0,1,11.08,1a1.49,1.49,0,0,1,0,2.12L4.19,9.64,11,15.89a1.5,1.5,0,1,1-2,2.22L1,10.77A1.48,1.48,0,0,1,.5,9.68,1.51,1.51,0,0,1,1,8.58L9,.92A1.5,1.5,0,0,1,10,.5Z",prevBtnSize:18,nextBtnSize:18,color:"#A4B1D7",borderColor:"#A4B1D7",borderWidth:1},emphasis:{label:{show:!0,color:"#6f778d"},itemStyle:{color:"#316BF3"},controlStyle:{color:"#316BF3",borderColor:"#316BF3",borderWidth:2}},progress:{lineStyle:{color:"#316BF3"},itemStyle:{color:"#316BF3"},label:{color:"#6f778d"}},data:[]}),c}(TimelineModel$1);mixin(SliderTimelineModel,DataFormatMixin.prototype);const SliderTimelineModel$1=SliderTimelineModel;var TimelineView=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_}return c.type="timeline",c}(ComponentView$1);const TimelineView$1=TimelineView;var TimelineAxis=function(x){__extends(c,x);function c(_,T,C,M){var E=x.call(this,_,T,C)||this;return E.type=M||"value",E}return c.prototype.getLabelModel=function(){return this.model.getModel("label")},c.prototype.isHorizontal=function(){return this.model.get("orient")==="horizontal"},c}(Axis$1);const TimelineAxis$1=TimelineAxis;var PI=Math.PI,labelDataIndexStore=makeInner(),SliderTimelineView=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_}return c.prototype.init=function(_,T){this.api=T},c.prototype.render=function(_,T,C){if(this.model=_,this.api=C,this.ecModel=T,this.group.removeAll(),_.get("show",!0)){var M=this._layout(_,C),E=this._createGroup("_mainGroup"),P=this._createGroup("_labelGroup"),R=this._axis=this._createAxis(M,_);_.formatTooltip=function($){var G=R.scale.getLabel({value:$});return createTooltipMarkup("nameValue",{noName:!0,value:G})},each$f(["AxisLine","AxisTick","Control","CurrentPointer"],function($){this["_render"+$](M,E,R,_)},this),this._renderAxisLabel(M,P,R,_),this._position(M,_)}this._doPlayStop(),this._updateTicksStatus()},c.prototype.remove=function(){this._clearTimer(),this.group.removeAll()},c.prototype.dispose=function(){this._clearTimer()},c.prototype._layout=function(_,T){var C=_.get(["label","position"]),M=_.get("orient"),E=getViewRect(_,T),P;C==null||C==="auto"?P=M==="horizontal"?E.y+E.height/2=0||P==="+"?"left":"right"},$={horizontal:P>=0||P==="+"?"top":"bottom",vertical:"middle"},G={horizontal:0,vertical:PI/2},O=M==="vertical"?E.height:E.width,L=_.getModel("controlStyle"),F=L.get("show",!0),V=F?L.get("itemSize"):0,W=F?L.get("itemGap"):0,z=V+W,Z=_.get(["label","rotate"])||0;Z=Z*PI/180;var H,Y,U,j=L.get("position",!0),X=F&&L.get("showPlayBtn",!0),K=F&&L.get("showPrevBtn",!0),q=F&&L.get("showNextBtn",!0),J=0,Q=O;j==="left"||j==="bottom"?(X&&(H=[0,0],J+=z),K&&(Y=[J,0],J+=z),q&&(U=[Q-V,0],Q-=z)):(X&&(H=[Q-V,0],Q-=z),K&&(Y=[0,0],J+=z),q&&(U=[Q-V,0],Q-=z));var ee=[J,Q];return _.get("inverse")&&ee.reverse(),{viewRect:E,mainLength:O,orient:M,rotation:G[M],labelRotation:Z,labelPosOpt:P,labelAlign:_.get(["label","align"])||R[M],labelBaseline:_.get(["label","verticalAlign"])||_.get(["label","baseline"])||$[M],playPosition:H,prevBtnPosition:Y,nextBtnPosition:U,axisExtent:ee,controlSize:V,controlGap:W}},c.prototype._position=function(_,T){var C=this._mainGroup,M=this._labelGroup,E=_.viewRect;if(_.orient==="vertical"){var P=create$1(),R=E.x,$=E.y+E.height;translate(P,P,[-R,-$]),rotate(P,P,-PI/2),translate(P,P,[R,$]),E=E.clone(),E.applyTransform(P)}var G=H(E),O=H(C.getBoundingRect()),L=H(M.getBoundingRect()),F=[C.x,C.y],V=[M.x,M.y];V[0]=F[0]=G[0][0];var W=_.labelPosOpt;if(W==null||isString(W)){var z=W==="+"?0:1;Y(F,O,G,1,z),Y(V,L,G,1,1-z)}else{var z=W>=0?0:1;Y(F,O,G,1,z),V[1]=F[1]+W}C.setPosition(F),M.setPosition(V),C.rotation=M.rotation=_.rotation,Z(C),Z(M);function Z(U){U.originX=G[0][0]-U.x,U.originY=G[1][0]-U.y}function H(U){return[[U.x,U.x+U.width],[U.y,U.y+U.height]]}function Y(U,j,X,K,q){U[K]+=X[K][q]-j[K][q]}},c.prototype._createAxis=function(_,T){var C=T.getData(),M=T.get("axisType"),E=createScaleByModel(T,M);E.getTicks=function(){return C.mapArray(["value"],function($){return{value:$}})};var P=C.getDataExtent("value");E.setExtent(P[0],P[1]),E.calcNiceTicks();var R=new TimelineAxis$1("value",E,_.axisExtent,M);return R.model=T,R},c.prototype._createGroup=function(_){var T=this[_]=new Group$4;return this.group.add(T),T},c.prototype._renderAxisLine=function(_,T,C,M){var E=C.getExtent();if(M.get(["lineStyle","show"])){var P=new Line$3({shape:{x1:E[0],y1:0,x2:E[1],y2:0},style:extend({lineCap:"round"},M.getModel("lineStyle").getLineStyle()),silent:!0,z2:1});T.add(P);var R=this._progressLine=new Line$3({shape:{x1:E[0],x2:this._currentPointer?this._currentPointer.x:E[0],y1:0,y2:0},style:defaults({lineCap:"round",lineWidth:P.style.lineWidth},M.getModel(["progress","lineStyle"]).getLineStyle()),silent:!0,z2:1});T.add(R)}},c.prototype._renderAxisTick=function(_,T,C,M){var E=this,P=M.getData(),R=C.scale.getTicks();this._tickSymbols=[],each$f(R,function($){var G=C.dataToCoord($.value),O=P.getItemModel($.value),L=O.getModel("itemStyle"),F=O.getModel(["emphasis","itemStyle"]),V=O.getModel(["progress","itemStyle"]),W={x:G,y:0,onclick:bind$1(E._changeTimeline,E,$.value)},z=giveSymbol(O,L,T,W);z.ensureState("emphasis").style=F.getItemStyle(),z.ensureState("progress").style=V.getItemStyle(),enableHoverEmphasis(z);var Z=getECData(z);O.get("tooltip")?(Z.dataIndex=$.value,Z.dataModel=M):Z.dataIndex=Z.dataModel=null,E._tickSymbols.push(z)})},c.prototype._renderAxisLabel=function(_,T,C,M){var E=this,P=C.getLabelModel();if(P.get("show")){var R=M.getData(),$=C.getViewLabels();this._tickLabels=[],each$f($,function(G){var O=G.tickValue,L=R.getItemModel(O),F=L.getModel("label"),V=L.getModel(["emphasis","label"]),W=L.getModel(["progress","label"]),z=C.dataToCoord(G.tickValue),Z=new ZRText$1({x:z,y:0,rotation:_.labelRotation-_.rotation,onclick:bind$1(E._changeTimeline,E,O),silent:!1,style:createTextStyle(F,{text:G.formattedLabel,align:_.labelAlign,verticalAlign:_.labelBaseline})});Z.ensureState("emphasis").style=createTextStyle(V),Z.ensureState("progress").style=createTextStyle(W),T.add(Z),enableHoverEmphasis(Z),labelDataIndexStore(Z).dataIndex=O,E._tickLabels.push(Z)})}},c.prototype._renderControl=function(_,T,C,M){var E=_.controlSize,P=_.rotation,R=M.getModel("controlStyle").getItemStyle(),$=M.getModel(["emphasis","controlStyle"]).getItemStyle(),G=M.getPlayState(),O=M.get("inverse",!0);L(_.nextBtnPosition,"next",bind$1(this._changeTimeline,this,O?"-":"+")),L(_.prevBtnPosition,"prev",bind$1(this._changeTimeline,this,O?"+":"-")),L(_.playPosition,G?"stop":"play",bind$1(this._handlePlayClick,this,!G),!0);function L(F,V,W,z){if(F){var Z=parsePercent$1(retrieve2(M.get(["controlStyle",V+"BtnSize"]),E),E),H=[0,-Z/2,Z,Z],Y=makeControlIcon(M,V+"Icon",H,{x:F[0],y:F[1],originX:E/2,originY:0,rotation:z?-P:0,rectHover:!0,style:R,onclick:W});Y.ensureState("emphasis").style=$,T.add(Y),enableHoverEmphasis(Y)}}},c.prototype._renderCurrentPointer=function(_,T,C,M){var E=M.getData(),P=M.getCurrentIndex(),R=E.getItemModel(P).getModel("checkpointStyle"),$=this,G={onCreate:function(O){O.draggable=!0,O.drift=bind$1($._handlePointerDrag,$),O.ondragend=bind$1($._handlePointerDragend,$),pointerMoveTo(O,$._progressLine,P,C,M,!0)},onUpdate:function(O){pointerMoveTo(O,$._progressLine,P,C,M)}};this._currentPointer=giveSymbol(R,R,this._mainGroup,{},this._currentPointer,G)},c.prototype._handlePlayClick=function(_){this._clearTimer(),this.api.dispatchAction({type:"timelinePlayChange",playState:_,from:this.uid})},c.prototype._handlePointerDrag=function(_,T,C){this._clearTimer(),this._pointerChangeTimeline([C.offsetX,C.offsetY])},c.prototype._handlePointerDragend=function(_){this._pointerChangeTimeline([_.offsetX,_.offsetY],!0)},c.prototype._pointerChangeTimeline=function(_,T){var C=this._toAxisCoord(_)[0],M=this._axis,E=asc$2(M.getExtent().slice());C>E[1]&&(C=E[1]),C=0&&(E[M]=+E[M].toFixed(L)),[E,O]}var markerTypeCalculator={min:curry$1(markerTypeCalculatorWithExtent,"min"),max:curry$1(markerTypeCalculatorWithExtent,"max"),average:curry$1(markerTypeCalculatorWithExtent,"average"),median:curry$1(markerTypeCalculatorWithExtent,"median")};function dataTransform(x,c){if(c){var _=x.getData(),T=x.coordinateSystem,C=T&&T.dimensions;if(!hasXAndY(c)&&!isArray$1(c.coord)&&isArray$1(C)){var M=getAxisInfo(c,_,T,x);if(c=clone$4(c),c.type&&markerTypeCalculator[c.type]&&M.baseAxis&&M.valueAxis){var E=indexOf(C,M.baseAxis.dim),P=indexOf(C,M.valueAxis.dim),R=markerTypeCalculator[c.type](_,M.baseDataDim,M.valueDataDim,E,P);c.coord=R[0],c.value=R[1]}else c.coord=[c.xAxis!=null?c.xAxis:c.radiusAxis,c.yAxis!=null?c.yAxis:c.angleAxis]}if(c.coord==null||!isArray$1(C))c.coord=[];else for(var $=c.coord,G=0;G<2;G++)markerTypeCalculator[$[G]]&&($[G]=numCalculate(_,_.mapDimension(C[G]),$[G]));return c}}function getAxisInfo(x,c,_,T){var C={};return x.valueIndex!=null||x.valueDim!=null?(C.valueDataDim=x.valueIndex!=null?c.getDimension(x.valueIndex):x.valueDim,C.valueAxis=_.getAxis(dataDimToCoordDim(T,C.valueDataDim)),C.baseAxis=_.getOtherAxis(C.valueAxis),C.baseDataDim=c.mapDimension(C.baseAxis.dim)):(C.baseAxis=T.getBaseAxis(),C.valueAxis=_.getOtherAxis(C.baseAxis),C.baseDataDim=c.mapDimension(C.baseAxis.dim),C.valueDataDim=c.mapDimension(C.valueAxis.dim)),C}function dataDimToCoordDim(x,c){var _=x.getData().getDimensionInfo(c);return _&&_.coordDim}function dataFilter(x,c){return x&&x.containData&&c.coord&&!hasXOrY(c)?x.containData(c.coord):!0}function zoneFilter(x,c,_){return x&&x.containZone&&c.coord&&_.coord&&!hasXOrY(c)&&!hasXOrY(_)?x.containZone(c.coord,_.coord):!0}function createMarkerDimValueGetter(x,c){return x?function(_,T,C,M){var E=M<2?_.coord&&_.coord[M]:_.value;return parseDataValue(E,c[M])}:function(_,T,C,M){return parseDataValue(_.value,c[M])}}function numCalculate(x,c,_){if(_==="average"){var T=0,C=0;return x.each(c,function(M,E){isNaN(M)||(T+=M,C++)}),T/C}else return _==="median"?x.getMedian(c):x.getDataExtent(c)[_==="max"?1:0]}var inner$4=makeInner(),MarkerView=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_}return c.prototype.init=function(){this.markerGroupMap=createHashMap()},c.prototype.render=function(_,T,C){var M=this,E=this.markerGroupMap;E.each(function(P){inner$4(P).keep=!1}),T.eachSeries(function(P){var R=MarkerModel$1.getMarkerModelFromSeries(P,M.type);R&&M.renderSeries(P,R,T,C)}),E.each(function(P){!inner$4(P).keep&&M.group.remove(P.group)})},c.prototype.markKeep=function(_){inner$4(_).keep=!0},c.prototype.toggleBlurSeries=function(_,T){var C=this;each$f(_,function(M){var E=MarkerModel$1.getMarkerModelFromSeries(M,C.type);if(E){var P=E.getData();P.eachItemGraphicEl(function(R){R&&(T?enterBlur(R):leaveBlur(R))})}})},c.type="marker",c}(ComponentView$1);const MarkerView$1=MarkerView;function updateMarkerLayout(x,c,_){var T=c.coordinateSystem;x.each(function(C){var M=x.getItemModel(C),E,P=parsePercent(M.get("x"),_.getWidth()),R=parsePercent(M.get("y"),_.getHeight());if(!isNaN(P)&&!isNaN(R))E=[P,R];else if(c.getMarkerPosition)E=c.getMarkerPosition(x.getValues(x.dimensions,C));else if(T){var $=x.get(T.dimensions[0],C),G=x.get(T.dimensions[1],C);E=T.dataToPoint([$,G])}isNaN(P)||(E[0]=P),isNaN(R)||(E[1]=R),x.setItemLayout(C,E)})}var MarkPointView=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_}return c.prototype.updateTransform=function(_,T,C){T.eachSeries(function(M){var E=MarkerModel$1.getMarkerModelFromSeries(M,"markPoint");E&&(updateMarkerLayout(E.getData(),M,C),this.markerGroupMap.get(M.id).updateLayout())},this)},c.prototype.renderSeries=function(_,T,C,M){var E=_.coordinateSystem,P=_.id,R=_.getData(),$=this.markerGroupMap,G=$.get(P)||$.set(P,new SymbolDraw$1),O=createData(E,_,T);T.setData(O),updateMarkerLayout(T.getData(),_,M),O.each(function(L){var F=O.getItemModel(L),V=F.getShallow("symbol"),W=F.getShallow("symbolSize"),z=F.getShallow("symbolRotate"),Z=F.getShallow("symbolOffset"),H=F.getShallow("symbolKeepAspect");if(isFunction(V)||isFunction(W)||isFunction(z)||isFunction(Z)){var Y=T.getRawValue(L),U=T.getDataParams(L);isFunction(V)&&(V=V(Y,U)),isFunction(W)&&(W=W(Y,U)),isFunction(z)&&(z=z(Y,U)),isFunction(Z)&&(Z=Z(Y,U))}var j=F.getModel("itemStyle").getItemStyle(),X=getVisualFromData(R,"color");j.fill||(j.fill=X),O.setItemVisual(L,{symbol:V,symbolSize:W,symbolRotate:z,symbolOffset:Z,symbolKeepAspect:H,style:j})}),G.updateData(O),this.group.add(G.group),O.eachItemGraphicEl(function(L){L.traverse(function(F){getECData(F).dataModel=T})}),this.markKeep(G),G.group.silent=T.get("silent")||_.get("silent")},c.type="markPoint",c}(MarkerView$1);function createData(x,c,_){var T;x?T=map$1(x&&x.dimensions,function(P){var R=c.getData().getDimensionInfo(c.getData().mapDimension(P))||{};return extend(extend({},R),{name:P,ordinalMeta:null})}):T=[{name:"value",type:"float"}];var C=new SeriesData$1(T,_),M=map$1(_.get("data"),curry$1(dataTransform,c));x&&(M=filter(M,curry$1(dataFilter,x)));var E=createMarkerDimValueGetter(!!x,T);return C.initData(M,null,E),C}const MarkPointView$1=MarkPointView;function install$e(x){x.registerComponentModel(MarkPointModel$1),x.registerComponentView(MarkPointView$1),x.registerPreprocessor(function(c){checkMarkerInSeries(c.series,"markPoint")&&(c.markPoint=c.markPoint||{})})}var MarkLineModel=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_}return c.prototype.createMarkerModelFromSeries=function(_,T,C){return new c(_,T,C)},c.type="markLine",c.defaultOption={z:5,symbol:["circle","arrow"],symbolSize:[8,16],symbolOffset:0,precision:2,tooltip:{trigger:"item"},label:{show:!0,position:"end",distance:5},lineStyle:{type:"dashed"},emphasis:{label:{show:!0},lineStyle:{width:3}},animationEasing:"linear"},c}(MarkerModel$1);const MarkLineModel$1=MarkLineModel;var inner$3=makeInner(),markLineTransform=function(x,c,_,T){var C=x.getData(),M;if(isArray$1(T))M=T;else{var E=T.type;if(E==="min"||E==="max"||E==="average"||E==="median"||T.xAxis!=null||T.yAxis!=null){var P=void 0,R=void 0;if(T.yAxis!=null||T.xAxis!=null)P=c.getAxis(T.yAxis!=null?"y":"x"),R=retrieve(T.yAxis,T.xAxis);else{var $=getAxisInfo(T,C,c,x);P=$.valueAxis;var G=getStackedDimension(C,$.valueDataDim);R=numCalculate(C,G,E)}var O=P.dim==="x"?0:1,L=1-O,F=clone$4(T),V={coord:[]};F.type=null,F.coord=[],F.coord[L]=-1/0,V.coord[L]=1/0;var W=_.get("precision");W>=0&&isNumber(R)&&(R=+R.toFixed(Math.min(W,20))),F.coord[O]=V.coord[O]=R,M=[F,V,{type:E,valueIndex:T.valueIndex,value:R}]}else M=[]}var z=[dataTransform(x,M[0]),dataTransform(x,M[1]),extend({},M[2])];return z[2].type=z[2].type||null,merge(z[2],z[0]),merge(z[2],z[1]),z};function isInfinity$1(x){return!isNaN(x)&&!isFinite(x)}function ifMarkLineHasOnlyDim(x,c,_,T){var C=1-x,M=T.dimensions[x];return isInfinity$1(c[C])&&isInfinity$1(_[C])&&c[x]===_[x]&&T.getAxis(M).containData(c[x])}function markLineFilter(x,c){if(x.type==="cartesian2d"){var _=c[0].coord,T=c[1].coord;if(_&&T&&(ifMarkLineHasOnlyDim(1,_,T,x)||ifMarkLineHasOnlyDim(0,_,T,x)))return!0}return dataFilter(x,c[0])&&dataFilter(x,c[1])}function updateSingleMarkerEndLayout(x,c,_,T,C){var M=T.coordinateSystem,E=x.getItemModel(c),P,R=parsePercent(E.get("x"),C.getWidth()),$=parsePercent(E.get("y"),C.getHeight());if(!isNaN(R)&&!isNaN($))P=[R,$];else{if(T.getMarkerPosition)P=T.getMarkerPosition(x.getValues(x.dimensions,c));else{var G=M.dimensions,O=x.get(G[0],c),L=x.get(G[1],c);P=M.dataToPoint([O,L])}if(isCoordinateSystemType(M,"cartesian2d")){var F=M.getAxis("x"),V=M.getAxis("y"),G=M.dimensions;isInfinity$1(x.get(G[0],c))?P[0]=F.toGlobalCoord(F.getExtent()[_?0:1]):isInfinity$1(x.get(G[1],c))&&(P[1]=V.toGlobalCoord(V.getExtent()[_?0:1]))}isNaN(R)||(P[0]=R),isNaN($)||(P[1]=$)}x.setItemLayout(c,P)}var MarkLineView=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_}return c.prototype.updateTransform=function(_,T,C){T.eachSeries(function(M){var E=MarkerModel$1.getMarkerModelFromSeries(M,"markLine");if(E){var P=E.getData(),R=inner$3(E).from,$=inner$3(E).to;R.each(function(G){updateSingleMarkerEndLayout(R,G,!0,M,C),updateSingleMarkerEndLayout($,G,!1,M,C)}),P.each(function(G){P.setItemLayout(G,[R.getItemLayout(G),$.getItemLayout(G)])}),this.markerGroupMap.get(M.id).updateLayout()}},this)},c.prototype.renderSeries=function(_,T,C,M){var E=_.coordinateSystem,P=_.id,R=_.getData(),$=this.markerGroupMap,G=$.get(P)||$.set(P,new LineDraw$1);this.group.add(G.group);var O=createList$1(E,_,T),L=O.from,F=O.to,V=O.line;inner$3(T).from=L,inner$3(T).to=F,T.setData(V);var W=T.get("symbol"),z=T.get("symbolSize"),Z=T.get("symbolRotate"),H=T.get("symbolOffset");isArray$1(W)||(W=[W,W]),isArray$1(z)||(z=[z,z]),isArray$1(Z)||(Z=[Z,Z]),isArray$1(H)||(H=[H,H]),O.from.each(function(U){Y(L,U,!0),Y(F,U,!1)}),V.each(function(U){var j=V.getItemModel(U).getModel("lineStyle").getLineStyle();V.setItemLayout(U,[L.getItemLayout(U),F.getItemLayout(U)]),j.stroke==null&&(j.stroke=L.getItemVisual(U,"style").fill),V.setItemVisual(U,{fromSymbolKeepAspect:L.getItemVisual(U,"symbolKeepAspect"),fromSymbolOffset:L.getItemVisual(U,"symbolOffset"),fromSymbolRotate:L.getItemVisual(U,"symbolRotate"),fromSymbolSize:L.getItemVisual(U,"symbolSize"),fromSymbol:L.getItemVisual(U,"symbol"),toSymbolKeepAspect:F.getItemVisual(U,"symbolKeepAspect"),toSymbolOffset:F.getItemVisual(U,"symbolOffset"),toSymbolRotate:F.getItemVisual(U,"symbolRotate"),toSymbolSize:F.getItemVisual(U,"symbolSize"),toSymbol:F.getItemVisual(U,"symbol"),style:j})}),G.updateData(V),O.line.eachItemGraphicEl(function(U){getECData(U).dataModel=T,U.traverse(function(j){getECData(j).dataModel=T})});function Y(U,j,X){var K=U.getItemModel(j);updateSingleMarkerEndLayout(U,j,X,_,M);var q=K.getModel("itemStyle").getItemStyle();q.fill==null&&(q.fill=getVisualFromData(R,"color")),U.setItemVisual(j,{symbolKeepAspect:K.get("symbolKeepAspect"),symbolOffset:retrieve2(K.get("symbolOffset",!0),H[X?0:1]),symbolRotate:retrieve2(K.get("symbolRotate",!0),Z[X?0:1]),symbolSize:retrieve2(K.get("symbolSize"),z[X?0:1]),symbol:retrieve2(K.get("symbol",!0),W[X?0:1]),style:q})}this.markKeep(G),G.group.silent=T.get("silent")||_.get("silent")},c.type="markLine",c}(MarkerView$1);function createList$1(x,c,_){var T;x?T=map$1(x&&x.dimensions,function($){var G=c.getData().getDimensionInfo(c.getData().mapDimension($))||{};return extend(extend({},G),{name:$,ordinalMeta:null})}):T=[{name:"value",type:"float"}];var C=new SeriesData$1(T,_),M=new SeriesData$1(T,_),E=new SeriesData$1([],_),P=map$1(_.get("data"),curry$1(markLineTransform,c,x,_));x&&(P=filter(P,curry$1(markLineFilter,x)));var R=createMarkerDimValueGetter(!!x,T);return C.initData(map$1(P,function($){return $[0]}),null,R),M.initData(map$1(P,function($){return $[1]}),null,R),E.initData(map$1(P,function($){return $[2]})),E.hasItemOption=!0,{from:C,to:M,line:E}}const MarkLineView$1=MarkLineView;function install$d(x){x.registerComponentModel(MarkLineModel$1),x.registerComponentView(MarkLineView$1),x.registerPreprocessor(function(c){checkMarkerInSeries(c.series,"markLine")&&(c.markLine=c.markLine||{})})}var MarkAreaModel=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_}return c.prototype.createMarkerModelFromSeries=function(_,T,C){return new c(_,T,C)},c.type="markArea",c.defaultOption={z:1,tooltip:{trigger:"item"},animation:!1,label:{show:!0,position:"top"},itemStyle:{borderWidth:0},emphasis:{label:{show:!0,position:"top"}}},c}(MarkerModel$1);const MarkAreaModel$1=MarkAreaModel;var inner$2=makeInner(),markAreaTransform=function(x,c,_,T){var C=T[0],M=T[1];if(!(!C||!M)){var E=dataTransform(x,C),P=dataTransform(x,M),R=E.coord,$=P.coord;R[0]=retrieve(R[0],-1/0),R[1]=retrieve(R[1],-1/0),$[0]=retrieve($[0],1/0),$[1]=retrieve($[1],1/0);var G=mergeAll([{},E,P]);return G.coord=[E.coord,P.coord],G.x0=E.x,G.y0=E.y,G.x1=P.x,G.y1=P.y,G}};function isInfinity(x){return!isNaN(x)&&!isFinite(x)}function ifMarkAreaHasOnlyDim(x,c,_,T){var C=1-x;return isInfinity(c[C])&&isInfinity(_[C])}function markAreaFilter(x,c){var _=c.coord[0],T=c.coord[1],C={coord:_,x:c.x0,y:c.y0},M={coord:T,x:c.x1,y:c.y1};return isCoordinateSystemType(x,"cartesian2d")?_&&T&&(ifMarkAreaHasOnlyDim(1,_,T)||ifMarkAreaHasOnlyDim(0,_,T))?!0:zoneFilter(x,C,M):dataFilter(x,C)||dataFilter(x,M)}function getSingleMarkerEndPoint(x,c,_,T,C){var M=T.coordinateSystem,E=x.getItemModel(c),P,R=parsePercent(E.get(_[0]),C.getWidth()),$=parsePercent(E.get(_[1]),C.getHeight());if(!isNaN(R)&&!isNaN($))P=[R,$];else{if(T.getMarkerPosition){var G=x.getValues(["x0","y0"],c),O=x.getValues(["x1","y1"],c),L=M.clampData(G),F=M.clampData(O),V=[];_[0]==="x0"?V[0]=L[0]>F[0]?O[0]:G[0]:V[0]=L[0]>F[0]?G[0]:O[0],_[1]==="y0"?V[1]=L[1]>F[1]?O[1]:G[1]:V[1]=L[1]>F[1]?G[1]:O[1],P=T.getMarkerPosition(V,_,!0)}else{var W=x.get(_[0],c),z=x.get(_[1],c),Z=[W,z];M.clampData&&M.clampData(Z,Z),P=M.dataToPoint(Z,!0)}if(isCoordinateSystemType(M,"cartesian2d")){var H=M.getAxis("x"),Y=M.getAxis("y"),W=x.get(_[0],c),z=x.get(_[1],c);isInfinity(W)?P[0]=H.toGlobalCoord(H.getExtent()[_[0]==="x0"?0:1]):isInfinity(z)&&(P[1]=Y.toGlobalCoord(Y.getExtent()[_[1]==="y0"?0:1]))}isNaN(R)||(P[0]=R),isNaN($)||(P[1]=$)}return P}var dimPermutations=[["x0","y0"],["x1","y0"],["x1","y1"],["x0","y1"]],MarkAreaView=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_}return c.prototype.updateTransform=function(_,T,C){T.eachSeries(function(M){var E=MarkerModel$1.getMarkerModelFromSeries(M,"markArea");if(E){var P=E.getData();P.each(function(R){var $=map$1(dimPermutations,function(O){return getSingleMarkerEndPoint(P,R,O,M,C)});P.setItemLayout(R,$);var G=P.getItemGraphicEl(R);G.setShape("points",$)})}},this)},c.prototype.renderSeries=function(_,T,C,M){var E=_.coordinateSystem,P=_.id,R=_.getData(),$=this.markerGroupMap,G=$.get(P)||$.set(P,{group:new Group$4});this.group.add(G.group),this.markKeep(G);var O=createList(E,_,T);T.setData(O),O.each(function(L){var F=map$1(dimPermutations,function(q){return getSingleMarkerEndPoint(O,L,q,_,M)}),V=E.getAxis("x").scale,W=E.getAxis("y").scale,z=V.getExtent(),Z=W.getExtent(),H=[V.parse(O.get("x0",L)),V.parse(O.get("x1",L))],Y=[W.parse(O.get("y0",L)),W.parse(O.get("y1",L))];asc$2(H),asc$2(Y);var U=!(z[0]>H[1]||z[1]Y[1]||Z[1]=0},c.prototype.getOrient=function(){return this.get("orient")==="vertical"?{index:1,name:"vertical"}:{index:0,name:"horizontal"}},c.type="legend.plain",c.dependencies=["series"],c.defaultOption={z:4,show:!0,orient:"horizontal",left:"center",top:0,align:"auto",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderRadius:0,borderWidth:0,padding:5,itemGap:10,itemWidth:25,itemHeight:14,symbolRotate:"inherit",symbolKeepAspect:!0,inactiveColor:"#ccc",inactiveBorderColor:"#ccc",inactiveBorderWidth:"auto",itemStyle:{color:"inherit",opacity:"inherit",borderColor:"inherit",borderWidth:"auto",borderCap:"inherit",borderJoin:"inherit",borderDashOffset:"inherit",borderMiterLimit:"inherit"},lineStyle:{width:"auto",color:"inherit",inactiveColor:"#ccc",inactiveWidth:2,opacity:"inherit",type:"inherit",cap:"inherit",join:"inherit",dashOffset:"inherit",miterLimit:"inherit"},textStyle:{color:"#333"},selectedMode:!0,selector:!1,selectorLabel:{show:!0,borderRadius:10,padding:[3,5,3,5],fontSize:12,fontFamily:"sans-serif",color:"#666",borderWidth:1,borderColor:"#666"},emphasis:{selectorLabel:{show:!0,color:"#eee",backgroundColor:"#666"}},selectorPosition:"auto",selectorItemGap:7,selectorButtonGap:10,tooltip:{show:!1}},c}(ComponentModel$1);const LegendModel$1=LegendModel;var curry=curry$1,each$3=each$f,Group$1=Group$4,LegendView=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_.newlineDisabled=!1,_}return c.prototype.init=function(){this.group.add(this._contentGroup=new Group$1),this.group.add(this._selectorGroup=new Group$1),this._isFirstRender=!0},c.prototype.getContentGroup=function(){return this._contentGroup},c.prototype.getSelectorGroup=function(){return this._selectorGroup},c.prototype.render=function(_,T,C){var M=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),!!_.get("show",!0)){var E=_.get("align"),P=_.get("orient");(!E||E==="auto")&&(E=_.get("left")==="right"&&P==="vertical"?"right":"left");var R=_.get("selector",!0),$=_.get("selectorPosition",!0);R&&(!$||$==="auto")&&($=P==="horizontal"?"end":"start"),this.renderInner(E,_,T,C,R,P,$);var G=_.getBoxLayoutParams(),O={width:C.getWidth(),height:C.getHeight()},L=_.get("padding"),F=getLayoutRect(G,O,L),V=this.layoutInner(_,E,F,M,R,$),W=getLayoutRect(defaults({width:V.width,height:V.height},G),O,L);this.group.x=W.x-V.x,this.group.y=W.y-V.y,this.group.markRedraw(),this.group.add(this._backgroundEl=makeBackground(V,_))}},c.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},c.prototype.renderInner=function(_,T,C,M,E,P,R){var $=this.getContentGroup(),G=createHashMap(),O=T.get("selectedMode"),L=[];C.eachRawSeries(function(F){!F.get("legendHoverLink")&&L.push(F.id)}),each$3(T.getData(),function(F,V){var W=F.get("name");if(!this.newlineDisabled&&(W===""||W===` `)){var z=new Group$1;z.newline=!0,$.add(z);return}var Z=C.getSeriesByName(W)[0];if(!G.get(W))if(Z){var H=Z.getData(),Y=H.getVisual("legendLineStyle")||{},U=H.getVisual("legendIcon"),j=H.getVisual("style"),X=this._createItem(Z,W,V,F,T,_,Y,j,U,O,M);X.on("click",curry(dispatchSelectAction,W,null,M,L)).on("mouseover",curry(dispatchHighlightAction,Z.name,null,M,L)).on("mouseout",curry(dispatchDownplayAction,Z.name,null,M,L)),G.set(W,!0)}else C.eachRawSeries(function(K){if(!G.get(W)&&K.legendVisualProvider){var q=K.legendVisualProvider;if(!q.containName(W))return;var J=q.indexOfName(W),Q=q.getItemVisual(J,"style"),ee=q.getItemVisual(J,"legendIcon"),re=parse$1(Q.fill);re&&re[3]===0&&(re[3]=.2,Q=extend(extend({},Q),{fill:stringify(re,"rgba")}));var ie=this._createItem(K,W,V,F,T,_,{},Q,ee,O,M);ie.on("click",curry(dispatchSelectAction,null,W,M,L)).on("mouseover",curry(dispatchHighlightAction,null,W,M,L)).on("mouseout",curry(dispatchDownplayAction,null,W,M,L)),G.set(W,!0)}},this)},this),E&&this._createSelector(E,T,M,P,R)},c.prototype._createSelector=function(_,T,C,M,E){var P=this.getSelectorGroup();each$3(_,function($){var G=$.type,O=new ZRText$1({style:{x:0,y:0,align:"center",verticalAlign:"middle"},onclick:function(){C.dispatchAction({type:G==="all"?"legendAllSelect":"legendInverseSelect"})}});P.add(O);var L=T.getModel("selectorLabel"),F=T.getModel(["emphasis","selectorLabel"]);setLabelStyle(O,{normal:L,emphasis:F},{defaultText:$.title}),enableHoverEmphasis(O)})},c.prototype._createItem=function(_,T,C,M,E,P,R,$,G,O,L){var F=_.visualDrawType,V=E.get("itemWidth"),W=E.get("itemHeight"),z=E.isSelected(T),Z=M.get("symbolRotate"),H=M.get("symbolKeepAspect"),Y=M.get("icon");G=Y||G||"roundRect";var U=getLegendStyle(G,M,R,$,F,z,L),j=new Group$1,X=M.getModel("textStyle");if(isFunction(_.getLegendIcon)&&(!Y||Y==="inherit"))j.add(_.getLegendIcon({itemWidth:V,itemHeight:W,icon:G,iconRotate:Z,itemStyle:U.itemStyle,lineStyle:U.lineStyle,symbolKeepAspect:H}));else{var K=Y==="inherit"&&_.getData().getVisual("symbol")?Z==="inherit"?_.getData().getVisual("symbolRotate"):Z:0;j.add(getDefaultLegendIcon({itemWidth:V,itemHeight:W,icon:G,iconRotate:K,itemStyle:U.itemStyle,lineStyle:U.lineStyle,symbolKeepAspect:H}))}var q=P==="left"?V+5:-5,J=P,Q=E.get("formatter"),ee=T;isString(Q)&&Q?ee=Q.replace("{name}",T??""):isFunction(Q)&&(ee=Q(T));var re=z?X.getTextColor():M.get("inactiveColor");j.add(new ZRText$1({style:createTextStyle(X,{text:ee,x:q,y:W/2,fill:re,align:J,verticalAlign:"middle"},{inheritColor:re})}));var ie=new Rect$3({shape:j.getBoundingRect(),invisible:!0}),ae=M.getModel("tooltip");return ae.get("show")&&setTooltipConfig({el:ie,componentModel:E,itemName:T,itemTooltipOption:ae.option}),j.add(ie),j.eachChild(function(ne){ne.silent=!0}),ie.silent=!O,this.getContentGroup().add(j),enableHoverEmphasis(j),j.__legendDataIndex=C,j},c.prototype.layoutInner=function(_,T,C,M,E,P){var R=this.getContentGroup(),$=this.getSelectorGroup();box(_.get("orient"),R,_.get("itemGap"),C.width,C.height);var G=R.getBoundingRect(),O=[-G.x,-G.y];if($.markRedraw(),R.markRedraw(),E){box("horizontal",$,_.get("selectorItemGap",!0));var L=$.getBoundingRect(),F=[-L.x,-L.y],V=_.get("selectorButtonGap",!0),W=_.getOrient().index,z=W===0?"width":"height",Z=W===0?"height":"width",H=W===0?"y":"x";P==="end"?F[W]+=G[z]+V:O[W]+=L[z]+V,F[1-W]+=G[Z]/2-L[Z]/2,$.x=F[0],$.y=F[1],R.x=O[0],R.y=O[1];var Y={x:0,y:0};return Y[z]=G[z]+V+L[z],Y[Z]=Math.max(G[Z],L[Z]),Y[H]=Math.min(0,L[H]+F[1-W]),Y}else return R.x=O[0],R.y=O[1],this.group.getBoundingRect()},c.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},c.type="legend.plain",c}(ComponentView$1);function getLegendStyle(x,c,_,T,C,M,E){function P(z,Z){z.lineWidth==="auto"&&(z.lineWidth=Z.lineWidth>0?2:0),each$3(z,function(H,Y){z[Y]==="inherit"&&(z[Y]=Z[Y])})}var R=c.getModel("itemStyle"),$=R.getItemStyle(),G=x.lastIndexOf("empty",0)===0?"fill":"stroke",O=R.getShallow("decal");$.decal=!O||O==="inherit"?T.decal:createOrUpdatePatternFromDecal(O,E),$.fill==="inherit"&&($.fill=T[C]),$.stroke==="inherit"&&($.stroke=T[G]),$.opacity==="inherit"&&($.opacity=(C==="fill"?T:_).opacity),P($,T);var L=c.getModel("lineStyle"),F=L.getLineStyle();if(P(F,_),$.fill==="auto"&&($.fill=T.fill),$.stroke==="auto"&&($.stroke=T.fill),F.stroke==="auto"&&(F.stroke=T.fill),!M){var V=c.get("inactiveBorderWidth"),W=$[G];$.lineWidth=V==="auto"?T.lineWidth>0&&W?2:0:$.lineWidth,$.fill=c.get("inactiveColor"),$.stroke=c.get("inactiveBorderColor"),F.stroke=L.get("inactiveColor"),F.lineWidth=L.get("inactiveWidth")}return{itemStyle:$,lineStyle:F}}function getDefaultLegendIcon(x){var c=x.icon||"roundRect",_=createSymbol$1(c,0,0,x.itemWidth,x.itemHeight,x.itemStyle.fill,x.symbolKeepAspect);return _.setStyle(x.itemStyle),_.rotation=(x.iconRotate||0)*Math.PI/180,_.setOrigin([x.itemWidth/2,x.itemHeight/2]),c.indexOf("empty")>-1&&(_.style.stroke=_.style.fill,_.style.fill="#fff",_.style.lineWidth=2),_}function dispatchSelectAction(x,c,_,T){dispatchDownplayAction(x,c,_,T),_.dispatchAction({type:"legendToggleSelect",name:x??c}),dispatchHighlightAction(x,c,_,T)}function isUseHoverLayer(x){for(var c=x.getZr().storage.getDisplayList(),_,T=0,C=c.length;TC[E],z=[-F.x,-F.y];T||(z[M]=G[$]);var Z=[0,0],H=[-V.x,-V.y],Y=retrieve2(_.get("pageButtonGap",!0),_.get("itemGap",!0));if(W){var U=_.get("pageButtonPosition",!0);U==="end"?H[M]+=C[E]-V[E]:Z[M]+=V[E]+Y}H[1-M]+=F[P]/2-V[P]/2,G.setPosition(z),O.setPosition(Z),L.setPosition(H);var j={x:0,y:0};if(j[E]=W?C[E]:F[E],j[P]=Math.max(F[P],V[P]),j[R]=Math.min(0,V[R]+H[1-M]),O.__rectSize=C[E],W){var X={x:0,y:0};X[E]=Math.max(C[E]-V[E]-Y,0),X[P]=j[P],O.setClipPath(new Rect$3({shape:X})),O.__rectSize=X[E]}else L.eachChild(function(q){q.attr({invisible:!0,silent:!0})});var K=this._getPageInfo(_);return K.pageIndex!=null&&updateProps$1(G,{x:K.contentPosition[0],y:K.contentPosition[1]},W?_:null),this._updatePageInfoView(_,K),j},c.prototype._pageGo=function(_,T,C){var M=this._getPageInfo(T)[_];M!=null&&C.dispatchAction({type:"legendScroll",scrollDataIndex:M,legendId:T.id})},c.prototype._updatePageInfoView=function(_,T){var C=this._controllerGroup;each$f(["pagePrev","pageNext"],function(G){var O=G+"DataIndex",L=T[O]!=null,F=C.childOfName(G);F&&(F.setStyle("fill",L?_.get("pageIconColor",!0):_.get("pageIconInactiveColor",!0)),F.cursor=L?"pointer":"default")});var M=C.childOfName("pageText"),E=_.get("pageFormatter"),P=T.pageIndex,R=P!=null?P+1:0,$=T.pageCount;M&&E&&M.setStyle("text",isString(E)?E.replace("{current}",R==null?"":R+"").replace("{total}",$==null?"":$+""):E({current:R,total:$}))},c.prototype._getPageInfo=function(_){var T=_.get("scrollDataIndex",!0),C=this.getContentGroup(),M=this._containerGroup.__rectSize,E=_.getOrient().index,P=WH[E],R=XY[E],$=this._findTargetItemIndex(T),G=C.children(),O=G[$],L=G.length,F=L?1:0,V={contentPosition:[C.x,C.y],pageCount:F,pageIndex:F-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!O)return V;var W=U(O);V.contentPosition[E]=-W.s;for(var z=$+1,Z=W,H=W,Y=null;z<=L;++z)Y=U(G[z]),(!Y&&H.e>Z.s+M||Y&&!j(Y,Z.s))&&(H.i>Z.i?Z=H:Z=Y,Z&&(V.pageNextDataIndex==null&&(V.pageNextDataIndex=Z.i),++V.pageCount)),H=Y;for(var z=$-1,Z=W,H=W,Y=null;z>=-1;--z)Y=U(G[z]),(!Y||!j(H,Y.s))&&Z.i=K&&X.s<=K+M}},c.prototype._findTargetItemIndex=function(_){if(!this._showController)return 0;var T,C=this.getContentGroup(),M;return C.eachChild(function(E,P){var R=E.__legendDataIndex;M==null&&R!=null&&(M=P),R===_&&(T=P)}),T??M},c.type="legend.scroll",c}(LegendView$1);const ScrollableLegendView$1=ScrollableLegendView;function installScrollableLegendAction(x){x.registerAction("legendScroll","legendscroll",function(c,_){var T=c.scrollDataIndex;T!=null&&_.eachComponent({mainType:"legend",subType:"scroll",query:c},function(C){C.setScrollDataIndex(T)})})}function install$a(x){use(install$b),x.registerComponentModel(ScrollableLegendModel$1),x.registerComponentView(ScrollableLegendView$1),installScrollableLegendAction(x)}function install$9(x){use(install$b),use(install$a)}var InsideZoomModel=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_}return c.type="dataZoom.inside",c.defaultOption=inheritDefaultOption(DataZoomModel$1.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),c}(DataZoomModel$1);const InsideZoomModel$1=InsideZoomModel;var inner$1=makeInner();function setViewInfoToCoordSysRecord(x,c,_){inner$1(x).coordSysRecordMap.each(function(T){var C=T.dataZoomInfoMap.get(c.uid);C&&(C.getRange=_)})}function disposeCoordSysRecordIfNeeded(x,c){for(var _=inner$1(x).coordSysRecordMap,T=_.keys(),C=0;CT[_+c]&&(c=P),C=C&&E.get("preventDefaultMouseMove",!0)}),{controlType:c,opt:{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!0,preventDefaultMouseMove:!!C}}}function installDataZoomRoamProcessor(x){x.registerProcessor(x.PRIORITY.PROCESSOR.FILTER,function(c,_){var T=inner$1(_),C=T.coordSysRecordMap||(T.coordSysRecordMap=createHashMap());C.each(function(M){M.dataZoomInfoMap=null}),c.eachComponent({mainType:"dataZoom",subType:"inside"},function(M){var E=collectReferCoordSysModelInfo(M);each$f(E.infoList,function(P){var R=P.model.uid,$=C.get(R)||C.set(R,createCoordSysRecord(_,P.model)),G=$.dataZoomInfoMap||($.dataZoomInfoMap=createHashMap());G.set(M.uid,{dzReferCoordSysInfo:P,model:M,getRange:null})})}),C.each(function(M){var E=M.controller,P,R=M.dataZoomInfoMap;if(R){var $=R.keys()[0];$!=null&&(P=R.get($))}if(!P){disposeCoordSysRecord(C,M);return}var G=mergeControllerParams(R);E.enable(G.controlType,G.opt),E.setPointerChecker(M.containsPoint),createOrUpdate(M,"dispatchAction",P.model.get("throttle",!0),"fixRate")})})}var InsideZoomView=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type="dataZoom.inside",_}return c.prototype.render=function(_,T,C){if(x.prototype.render.apply(this,arguments),_.noTarget()){this._clear();return}this.range=_.getPercentRange(),setViewInfoToCoordSysRecord(C,_,{pan:bind$1(getRangeHandlers.pan,this),zoom:bind$1(getRangeHandlers.zoom,this),scrollMove:bind$1(getRangeHandlers.scrollMove,this)})},c.prototype.dispose=function(){this._clear(),x.prototype.dispose.apply(this,arguments)},c.prototype._clear=function(){disposeCoordSysRecordIfNeeded(this.api,this.dataZoomModel),this.range=null},c.type="dataZoom.inside",c}(DataZoomView$1),getRangeHandlers={zoom:function(x,c,_,T){var C=this.range,M=C.slice(),E=x.axisModels[0];if(E){var P=getDirectionInfo[c](null,[T.originX,T.originY],E,_,x),R=(P.signal>0?P.pixelStart+P.pixelLength-P.pixel:P.pixel-P.pixelStart)/P.pixelLength*(M[1]-M[0])+M[0],$=Math.max(1/T.scale,0);M[0]=(M[0]-R)*$+R,M[1]=(M[1]-R)*$+R;var G=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();if(sliderMove(0,M,[0,100],0,G.minSpan,G.maxSpan),this.range=M,C[0]!==M[0]||C[1]!==M[1])return M}},pan:makeMover(function(x,c,_,T,C,M){var E=getDirectionInfo[T]([M.oldX,M.oldY],[M.newX,M.newY],c,C,_);return E.signal*(x[1]-x[0])*E.pixel/E.pixelLength}),scrollMove:makeMover(function(x,c,_,T,C,M){var E=getDirectionInfo[T]([0,0],[M.scrollDelta,M.scrollDelta],c,C,_);return E.signal*(x[1]-x[0])*M.scrollDelta})};function makeMover(x){return function(c,_,T,C){var M=this.range,E=M.slice(),P=c.axisModels[0];if(P){var R=x(E,P,c,_,T,C);if(sliderMove(R,E,[0,100],"all"),this.range=E,M[0]!==E[0]||M[1]!==E[1])return E}}}var getDirectionInfo={grid:function(x,c,_,T,C){var M=_.axis,E={},P=C.model.coordinateSystem.getRect();return x=x||[0,0],M.dim==="x"?(E.pixel=c[0]-x[0],E.pixelLength=P.width,E.pixelStart=P.x,E.signal=M.inverse?1:-1):(E.pixel=c[1]-x[1],E.pixelLength=P.height,E.pixelStart=P.y,E.signal=M.inverse?-1:1),E},polar:function(x,c,_,T,C){var M=_.axis,E={},P=C.model.coordinateSystem,R=P.getRadiusAxis().getExtent(),$=P.getAngleAxis().getExtent();return x=x?P.pointToCoord(x):[0,0],c=P.pointToCoord(c),_.mainType==="radiusAxis"?(E.pixel=c[0]-x[0],E.pixelLength=R[1]-R[0],E.pixelStart=R[0],E.signal=M.inverse?1:-1):(E.pixel=c[1]-x[1],E.pixelLength=$[1]-$[0],E.pixelStart=$[0],E.signal=M.inverse?-1:1),E},singleAxis:function(x,c,_,T,C){var M=_.axis,E=C.model.coordinateSystem.getRect(),P={};return x=x||[0,0],M.orient==="horizontal"?(P.pixel=c[0]-x[0],P.pixelLength=E.width,P.pixelStart=E.x,P.signal=M.inverse?1:-1):(P.pixel=c[1]-x[1],P.pixelLength=E.height,P.pixelStart=E.y,P.signal=M.inverse?-1:1),P}};const InsideZoomView$1=InsideZoomView;function install$8(x){installCommon$1(x),x.registerComponentModel(InsideZoomModel$1),x.registerComponentView(InsideZoomView$1),installDataZoomRoamProcessor(x)}var SliderZoomModel=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_}return c.type="dataZoom.slider",c.layoutMode="box",c.defaultOption=inheritDefaultOption(DataZoomModel$1.defaultOption,{show:!0,right:"ph",top:"ph",width:"ph",height:"ph",left:null,bottom:null,borderColor:"#d2dbee",borderRadius:3,backgroundColor:"rgba(47,69,84,0)",dataBackground:{lineStyle:{color:"#d2dbee",width:.5},areaStyle:{color:"#d2dbee",opacity:.2}},selectedDataBackground:{lineStyle:{color:"#8fb0f7",width:.5},areaStyle:{color:"#8fb0f7",opacity:.2}},fillerColor:"rgba(135,175,274,0.2)",handleIcon:"path://M-9.35,34.56V42m0-40V9.5m-2,0h4a2,2,0,0,1,2,2v21a2,2,0,0,1-2,2h-4a2,2,0,0,1-2-2v-21A2,2,0,0,1-11.35,9.5Z",handleSize:"100%",handleStyle:{color:"#fff",borderColor:"#ACB8D1"},moveHandleSize:7,moveHandleIcon:"path://M-320.9-50L-320.9-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-348-41-339-50-320.9-50z M-212.3-50L-212.3-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-239.4-41-230.4-50-212.3-50z M-103.7-50L-103.7-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-130.9-41-121.8-50-103.7-50z",moveHandleStyle:{color:"#D2DBEE",opacity:.7},showDetail:!0,showDataShadow:"auto",realtime:!0,zoomLock:!1,textStyle:{color:"#6E7079"},brushSelect:!0,brushStyle:{color:"rgba(135,175,274,0.15)"},emphasis:{handleStyle:{borderColor:"#8FB0F7"},moveHandleStyle:{color:"#8FB0F7"}}}),c}(DataZoomModel$1);const SliderZoomModel$1=SliderZoomModel;var Rect=Rect$3,DEFAULT_LOCATION_EDGE_GAP=7,DEFAULT_FRAME_BORDER_WIDTH=1,DEFAULT_FILLER_SIZE=30,DEFAULT_MOVE_HANDLE_SIZE=7,HORIZONTAL="horizontal",VERTICAL="vertical",LABEL_GAP=5,SHOW_DATA_SHADOW_SERIES_TYPE=["line","bar","candlestick","scatter"],REALTIME_ANIMATION_CONFIG={easing:"cubicOut",duration:100,delay:0},SliderZoomView=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_._displayables={},_}return c.prototype.init=function(_,T){this.api=T,this._onBrush=bind$1(this._onBrush,this),this._onBrushEnd=bind$1(this._onBrushEnd,this)},c.prototype.render=function(_,T,C,M){if(x.prototype.render.apply(this,arguments),createOrUpdate(this,"_dispatchZoomAction",_.get("throttle"),"fixRate"),this._orient=_.getOrient(),_.get("show")===!1){this.group.removeAll();return}if(_.noTarget()){this._clear(),this.group.removeAll();return}(!M||M.type!=="dataZoom"||M.from!==this.uid)&&this._buildView(),this._updateView()},c.prototype.dispose=function(){this._clear(),x.prototype.dispose.apply(this,arguments)},c.prototype._clear=function(){clear$1(this,"_dispatchZoomAction");var _=this.api.getZr();_.off("mousemove",this._onBrush),_.off("mouseup",this._onBrushEnd)},c.prototype._buildView=function(){var _=this.group;_.removeAll(),this._brushing=!1,this._displayables.brushRect=null,this._resetLocation(),this._resetInterval();var T=this._displayables.sliderGroup=new Group$4;this._renderBackground(),this._renderHandle(),this._renderDataShadow(),_.add(T),this._positionGroup()},c.prototype._resetLocation=function(){var _=this.dataZoomModel,T=this.api,C=_.get("brushSelect"),M=C?DEFAULT_MOVE_HANDLE_SIZE:0,E=this._findCoordRect(),P={width:T.getWidth(),height:T.getHeight()},R=this._orient===HORIZONTAL?{right:P.width-E.x-E.width,top:P.height-DEFAULT_FILLER_SIZE-DEFAULT_LOCATION_EDGE_GAP-M,width:E.width,height:DEFAULT_FILLER_SIZE}:{right:DEFAULT_LOCATION_EDGE_GAP,top:E.y,width:DEFAULT_FILLER_SIZE,height:E.height},$=getLayoutParams(_.option);each$f(["right","top","width","height"],function(O){$[O]==="ph"&&($[O]=R[O])});var G=getLayoutRect($,P);this._location={x:G.x,y:G.y},this._size=[G.width,G.height],this._orient===VERTICAL&&this._size.reverse()},c.prototype._positionGroup=function(){var _=this.group,T=this._location,C=this._orient,M=this.dataZoomModel.getFirstTargetAxisModel(),E=M&&M.get("inverse"),P=this._displayables.sliderGroup,R=(this._dataShadowInfo||{}).otherAxisInverse;P.attr(C===HORIZONTAL&&!E?{scaleY:R?1:-1,scaleX:1}:C===HORIZONTAL&&E?{scaleY:R?1:-1,scaleX:-1}:C===VERTICAL&&!E?{scaleY:R?-1:1,scaleX:1,rotation:Math.PI/2}:{scaleY:R?-1:1,scaleX:-1,rotation:Math.PI/2});var $=_.getBoundingRect([P]);_.x=T.x-$.x,_.y=T.y-$.y,_.markRedraw()},c.prototype._getViewExtent=function(){return[0,this._size[0]]},c.prototype._renderBackground=function(){var _=this.dataZoomModel,T=this._size,C=this._displayables.sliderGroup,M=_.get("brushSelect");C.add(new Rect({silent:!0,shape:{x:0,y:0,width:T[0],height:T[1]},style:{fill:_.get("backgroundColor")},z2:-40}));var E=new Rect({shape:{x:0,y:0,width:T[0],height:T[1]},style:{fill:"transparent"},z2:0,onclick:bind$1(this._onClickPanel,this)}),P=this.api.getZr();M?(E.on("mousedown",this._onBrushStart,this),E.cursor="crosshair",P.on("mousemove",this._onBrush),P.on("mouseup",this._onBrushEnd)):(P.off("mousemove",this._onBrush),P.off("mouseup",this._onBrushEnd)),C.add(E)},c.prototype._renderDataShadow=function(){var _=this._dataShadowInfo=this._prepareDataShadowInfo();if(this._displayables.dataShadowSegs=[],!_)return;var T=this._size,C=this._shadowSize||[],M=_.series,E=M.getRawData(),P=M.getShadowDim&&M.getShadowDim(),R=P&&E.getDimensionInfo(P)?M.getShadowDim():_.otherDim;if(R==null)return;var $=this._shadowPolygonPts,G=this._shadowPolylinePts;if(E!==this._shadowData||R!==this._shadowDim||T[0]!==C[0]||T[1]!==C[1]){var O=E.getDataExtent(R),L=(O[1]-O[0])*.3;O=[O[0]-L,O[1]+L];var F=[0,T[1]],V=[0,T[0]],W=[[T[0],0],[0,0]],z=[],Z=V[1]/(E.count()-1),H=0,Y=Math.round(E.count()/T[0]),U;E.each([R],function(J,Q){if(Y>0&&Q%Y){H+=Z;return}var ee=J==null||isNaN(J)||J==="",re=ee?0:linearMap$2(J,O,F,!0);ee&&!U&&Q?(W.push([W[W.length-1][0],0]),z.push([z[z.length-1][0],0])):!ee&&U&&(W.push([H,0]),z.push([H,0])),W.push([H,re]),z.push([H,re]),H+=Z,U=ee}),$=this._shadowPolygonPts=W,G=this._shadowPolylinePts=z}this._shadowData=E,this._shadowDim=R,this._shadowSize=[T[0],T[1]];var j=this.dataZoomModel;function X(J){var Q=j.getModel(J?"selectedDataBackground":"dataBackground"),ee=new Group$4,re=new Polygon$1({shape:{points:$},segmentIgnoreThreshold:1,style:Q.getModel("areaStyle").getAreaStyle(),silent:!0,z2:-20}),ie=new Polyline$3({shape:{points:G},segmentIgnoreThreshold:1,style:Q.getModel("lineStyle").getLineStyle(),silent:!0,z2:-19});return ee.add(re),ee.add(ie),ee}for(var K=0;K<3;K++){var q=X(K===1);this._displayables.sliderGroup.add(q),this._displayables.dataShadowSegs.push(q)}},c.prototype._prepareDataShadowInfo=function(){var _=this.dataZoomModel,T=_.get("showDataShadow");if(T!==!1){var C,M=this.ecModel;return _.eachTargetAxis(function(E,P){var R=_.getAxisProxy(E,P).getTargetSeriesModels();each$f(R,function($){if(!C&&!(T!==!0&&indexOf(SHOW_DATA_SHADOW_SERIES_TYPE,$.get("type"))<0)){var G=M.getComponent(getAxisMainType(E),P).axis,O=getOtherDim(E),L,F=$.coordinateSystem;O!=null&&F.getOtherAxis&&(L=F.getOtherAxis(G).inverse),O=$.getData().mapDimension(O),C={thisAxis:G,series:$,thisDim:E,otherDim:O,otherAxisInverse:L}}},this)},this),C}},c.prototype._renderHandle=function(){var _=this.group,T=this._displayables,C=T.handles=[null,null],M=T.handleLabels=[null,null],E=this._displayables.sliderGroup,P=this._size,R=this.dataZoomModel,$=this.api,G=R.get("borderRadius")||0,O=R.get("brushSelect"),L=T.filler=new Rect({silent:O,style:{fill:R.get("fillerColor")},textConfig:{position:"inside"}});E.add(L),E.add(new Rect({silent:!0,subPixelOptimize:!0,shape:{x:0,y:0,width:P[0],height:P[1],r:G},style:{stroke:R.get("dataBackgroundColor")||R.get("borderColor"),lineWidth:DEFAULT_FRAME_BORDER_WIDTH,fill:"rgba(0,0,0,0)"}})),each$f([0,1],function(Y){var U=R.get("handleIcon");!symbolBuildProxies[U]&&U.indexOf("path://")<0&&U.indexOf("image://")<0&&(U="path://"+U);var j=createSymbol$1(U,-1,0,2,2,null,!0);j.attr({cursor:getCursor$1(this._orient),draggable:!0,drift:bind$1(this._onDragMove,this,Y),ondragend:bind$1(this._onDragEnd,this),onmouseover:bind$1(this._showDataInfo,this,!0),onmouseout:bind$1(this._showDataInfo,this,!1),z2:5});var X=j.getBoundingRect(),K=R.get("handleSize");this._handleHeight=parsePercent(K,this._size[1]),this._handleWidth=X.width/X.height*this._handleHeight,j.setStyle(R.getModel("handleStyle").getItemStyle()),j.style.strokeNoScale=!0,j.rectHover=!0,j.ensureState("emphasis").style=R.getModel(["emphasis","handleStyle"]).getItemStyle(),enableHoverEmphasis(j);var q=R.get("handleColor");q!=null&&(j.style.fill=q),E.add(C[Y]=j);var J=R.getModel("textStyle");_.add(M[Y]=new ZRText$1({silent:!0,invisible:!0,style:createTextStyle(J,{x:0,y:0,text:"",verticalAlign:"middle",align:"center",fill:J.getTextColor(),font:J.getFont()}),z2:10}))},this);var F=L;if(O){var V=parsePercent(R.get("moveHandleSize"),P[1]),W=T.moveHandle=new Rect$3({style:R.getModel("moveHandleStyle").getItemStyle(),silent:!0,shape:{r:[0,0,2,2],y:P[1]-.5,height:V}}),z=V*.8,Z=T.moveHandleIcon=createSymbol$1(R.get("moveHandleIcon"),-z/2,-z/2,z,z,"#fff",!0);Z.silent=!0,Z.y=P[1]+V/2-.5,W.ensureState("emphasis").style=R.getModel(["emphasis","moveHandleStyle"]).getItemStyle();var H=Math.min(P[1]/2,Math.max(V,10));F=T.moveZone=new Rect$3({invisible:!0,shape:{y:P[1]-H,height:V+H}}),F.on("mouseover",function(){$.enterEmphasis(W)}).on("mouseout",function(){$.leaveEmphasis(W)}),E.add(W),E.add(Z),E.add(F)}F.attr({draggable:!0,cursor:getCursor$1(this._orient),drift:bind$1(this._onDragMove,this,"all"),ondragstart:bind$1(this._showDataInfo,this,!0),ondragend:bind$1(this._onDragEnd,this),onmouseover:bind$1(this._showDataInfo,this,!0),onmouseout:bind$1(this._showDataInfo,this,!1)})},c.prototype._resetInterval=function(){var _=this._range=this.dataZoomModel.getPercentRange(),T=this._getViewExtent();this._handleEnds=[linearMap$2(_[0],[0,100],T,!0),linearMap$2(_[1],[0,100],T,!0)]},c.prototype._updateInterval=function(_,T){var C=this.dataZoomModel,M=this._handleEnds,E=this._getViewExtent(),P=C.findRepresentativeAxisProxy().getMinMaxSpan(),R=[0,100];sliderMove(T,M,E,C.get("zoomLock")?"all":_,P.minSpan!=null?linearMap$2(P.minSpan,R,E,!0):null,P.maxSpan!=null?linearMap$2(P.maxSpan,R,E,!0):null);var $=this._range,G=this._range=asc$2([linearMap$2(M[0],E,R,!0),linearMap$2(M[1],E,R,!0)]);return!$||$[0]!==G[0]||$[1]!==G[1]},c.prototype._updateView=function(_){var T=this._displayables,C=this._handleEnds,M=asc$2(C.slice()),E=this._size;each$f([0,1],function(F){var V=T.handles[F],W=this._handleHeight;V.attr({scaleX:W/2,scaleY:W/2,x:C[F]+(F?-1:1),y:E[1]/2-W/2})},this),T.filler.setShape({x:M[0],y:0,width:M[1]-M[0],height:E[1]});var P={x:M[0],width:M[1]-M[0]};T.moveHandle&&(T.moveHandle.setShape(P),T.moveZone.setShape(P),T.moveZone.getBoundingRect(),T.moveHandleIcon&&T.moveHandleIcon.attr("x",P.x+P.width/2));for(var R=T.dataShadowSegs,$=[0,M[0],M[1],E[0]],G=0;GT[0]||C[1]<0||C[1]>T[1])){var M=this._handleEnds,E=(M[0]+M[1])/2,P=this._updateInterval("all",C[0]-E);this._updateView(),P&&this._dispatchZoomAction(!1)}},c.prototype._onBrushStart=function(_){var T=_.offsetX,C=_.offsetY;this._brushStart=new Point$1(T,C),this._brushing=!0,this._brushStartTime=+new Date},c.prototype._onBrushEnd=function(_){if(this._brushing){var T=this._displayables.brushRect;if(this._brushing=!1,!!T){T.attr("ignore",!0);var C=T.shape,M=+new Date;if(!(M-this._brushStartTime<200&&Math.abs(C.width)<5)){var E=this._getViewExtent(),P=[0,100];this._range=asc$2([linearMap$2(C.x,E,P,!0),linearMap$2(C.x+C.width,E,P,!0)]),this._handleEnds=[C.x,C.x+C.width],this._updateView(),this._dispatchZoomAction(!1)}}}},c.prototype._onBrush=function(_){this._brushing&&(stop(_.event),this._updateBrushRect(_.offsetX,_.offsetY))},c.prototype._updateBrushRect=function(_,T){var C=this._displayables,M=this.dataZoomModel,E=C.brushRect;E||(E=C.brushRect=new Rect({silent:!0,style:M.getModel("brushStyle").getItemStyle()}),C.sliderGroup.add(E)),E.attr("ignore",!1);var P=this._brushStart,R=this._displayables.sliderGroup,$=R.transformCoordToLocal(_,T),G=R.transformCoordToLocal(P.x,P.y),O=this._size;$[0]=Math.max(Math.min(O[0],$[0]),0),E.setShape({x:G[0],y:0,width:$[0]-G[0],height:O[1]})},c.prototype._dispatchZoomAction=function(_){var T=this._range;this.api.dispatchAction({type:"dataZoom",from:this.uid,dataZoomId:this.dataZoomModel.id,animation:_?REALTIME_ANIMATION_CONFIG:null,start:T[0],end:T[1]})},c.prototype._findCoordRect=function(){var _,T=collectReferCoordSysModelInfo(this.dataZoomModel).infoList;if(!_&&T.length){var C=T[0].model.coordinateSystem;_=C.getRect&&C.getRect()}if(!_){var M=this.api.getWidth(),E=this.api.getHeight();_={x:M*.2,y:E*.2,width:M*.6,height:E*.6}}return _},c.type="dataZoom.slider",c}(DataZoomView$1);function getOtherDim(x){var c={x:"y",y:"x",radius:"angle",angle:"radius"};return c[x]}function getCursor$1(x){return x==="vertical"?"ns-resize":"ew-resize"}const SliderZoomView$1=SliderZoomView;function install$7(x){x.registerComponentModel(SliderZoomModel$1),x.registerComponentView(SliderZoomView$1),installCommon$1(x)}function install$6(x){use(install$8),use(install$7)}var visualDefault={get:function(x,c,_){var T=clone$4((defaultOption[x]||{})[c]);return _&&isArray$1(T)?T[T.length-1]:T}},defaultOption={color:{active:["#006edd","#e0ffff"],inactive:["rgba(0,0,0,0)"]},colorHue:{active:[0,360],inactive:[0,0]},colorSaturation:{active:[.3,1],inactive:[0,0]},colorLightness:{active:[.9,.5],inactive:[0,0]},colorAlpha:{active:[.3,1],inactive:[0,0]},opacity:{active:[.3,1],inactive:[0,0]},symbol:{active:["circle","roundRect","diamond"],inactive:["none"]},symbolSize:{active:[10,50],inactive:[0,0]}};const visualDefault$1=visualDefault;var mapVisual=VisualMapping$1.mapVisual,eachVisual=VisualMapping$1.eachVisual,isArray=isArray$1,each$2=each$f,asc=asc$2,linearMap$1=linearMap$2,VisualMapModel=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_.stateList=["inRange","outOfRange"],_.replacableOptionKeys=["inRange","outOfRange","target","controller","color"],_.layoutMode={type:"box",ignoreSize:!0},_.dataBound=[-1/0,1/0],_.targetVisuals={},_.controllerVisuals={},_}return c.prototype.init=function(_,T,C){this.mergeDefaultAndTheme(_,C)},c.prototype.optionUpdated=function(_,T){var C=this.option;!T&&replaceVisualOption(C,_,this.replacableOptionKeys),this.textStyleModel=this.getModel("textStyle"),this.resetItemSize(),this.completeVisualOption()},c.prototype.resetVisual=function(_){var T=this.stateList;_=bind$1(_,this),this.controllerVisuals=createVisualMappings(this.option.controller,T,_),this.targetVisuals=createVisualMappings(this.option.target,T,_)},c.prototype.getItemSymbol=function(){return null},c.prototype.getTargetSeriesIndices=function(){var _=this.option.seriesIndex,T=[];return _==null||_==="all"?this.ecModel.eachSeries(function(C,M){T.push(M)}):T=normalizeToArray(_),T},c.prototype.eachTargetSeries=function(_,T){each$f(this.getTargetSeriesIndices(),function(C){var M=this.ecModel.getSeriesByIndex(C);M&&_.call(T,M)},this)},c.prototype.isTargetSeries=function(_){var T=!1;return this.eachTargetSeries(function(C){C===_&&(T=!0)}),T},c.prototype.formatValueText=function(_,T,C){var M=this.option,E=M.precision,P=this.dataBound,R=M.formatter,$;C=C||["<",">"],isArray$1(_)&&(_=_.slice(),$=!0);var G=T?_:$?[O(_[0]),O(_[1])]:O(_);if(isString(R))return R.replace("{value}",$?G[0]:G).replace("{value2}",$?G[1]:G);if(isFunction(R))return $?R(_[0],_[1]):R(_);if($)return _[0]===P[0]?C[0]+" "+G[1]:_[1]===P[1]?C[1]+" "+G[0]:G[0]+" - "+G[1];return G;function O(L){return L===P[0]?"min":L===P[1]?"max":(+L).toFixed(Math.min(E,20))}},c.prototype.resetExtent=function(){var _=this.option,T=asc([_.min,_.max]);this._dataExtent=T},c.prototype.getDataDimensionIndex=function(_){var T=this.option.dimension;if(T!=null)return _.getDimensionIndex(T);for(var C=_.dimensions,M=C.length-1;M>=0;M--){var E=C[M],P=_.getDimensionInfo(E);if(!P.isCalculationCoord)return P.storeDimIndex}},c.prototype.getExtent=function(){return this._dataExtent.slice()},c.prototype.completeVisualOption=function(){var _=this.ecModel,T=this.option,C={inRange:T.inRange,outOfRange:T.outOfRange},M=T.target||(T.target={}),E=T.controller||(T.controller={});merge(M,C),merge(E,C);var P=this.isCategory();R.call(this,M),R.call(this,E),$.call(this,M,"inRange","outOfRange"),G.call(this,E);function R(O){isArray(T.color)&&!O.inRange&&(O.inRange={color:T.color.slice().reverse()}),O.inRange=O.inRange||{color:_.get("gradientColor")}}function $(O,L,F){var V=O[L],W=O[F];V&&!W&&(W=O[F]={},each$2(V,function(z,Z){if(VisualMapping$1.isValidType(Z)){var H=visualDefault$1.get(Z,"inactive",P);H!=null&&(W[Z]=H,Z==="color"&&!W.hasOwnProperty("opacity")&&!W.hasOwnProperty("colorAlpha")&&(W.opacity=[0,0]))}}))}function G(O){var L=(O.inRange||{}).symbol||(O.outOfRange||{}).symbol,F=(O.inRange||{}).symbolSize||(O.outOfRange||{}).symbolSize,V=this.get("inactiveColor"),W=this.getItemSymbol(),z=W||"roundRect";each$2(this.stateList,function(Z){var H=this.itemSize,Y=O[Z];Y||(Y=O[Z]={color:P?V:[V]}),Y.symbol==null&&(Y.symbol=L&&clone$4(L)||(P?z:[z])),Y.symbolSize==null&&(Y.symbolSize=F&&clone$4(F)||(P?H[0]:[H[0],H[0]])),Y.symbol=mapVisual(Y.symbol,function(X){return X==="none"?z:X});var U=Y.symbolSize;if(U!=null){var j=-1/0;eachVisual(U,function(X){X>j&&(j=X)}),Y.symbolSize=mapVisual(U,function(X){return linearMap$1(X,[0,j],[0,H[0]],!0)})}},this)}},c.prototype.resetItemSize=function(){this.itemSize=[parseFloat(this.get("itemWidth")),parseFloat(this.get("itemHeight"))]},c.prototype.isCategory=function(){return!!this.option.categories},c.prototype.setSelected=function(_){},c.prototype.getSelected=function(){return null},c.prototype.getValueState=function(_){return null},c.prototype.getVisualMeta=function(_){return null},c.type="visualMap",c.dependencies=["series"],c.defaultOption={show:!0,z:4,seriesIndex:"all",min:0,max:200,left:0,right:null,top:null,bottom:0,itemWidth:null,itemHeight:null,inverse:!1,orient:"vertical",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",contentColor:"#5793f3",inactiveColor:"#aaa",borderWidth:0,padding:5,textGap:10,precision:0,textStyle:{color:"#333"}},c}(ComponentModel$1);const VisualMapModel$1=VisualMapModel;var DEFAULT_BAR_BOUND=[20,140],ContinuousModel=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_}return c.prototype.optionUpdated=function(_,T){x.prototype.optionUpdated.apply(this,arguments),this.resetExtent(),this.resetVisual(function(C){C.mappingMethod="linear",C.dataExtent=this.getExtent()}),this._resetRange()},c.prototype.resetItemSize=function(){x.prototype.resetItemSize.apply(this,arguments);var _=this.itemSize;(_[0]==null||isNaN(_[0]))&&(_[0]=DEFAULT_BAR_BOUND[0]),(_[1]==null||isNaN(_[1]))&&(_[1]=DEFAULT_BAR_BOUND[1])},c.prototype._resetRange=function(){var _=this.getExtent(),T=this.option.range;!T||T.auto?(_.auto=1,this.option.range=_):isArray$1(T)&&(T[0]>T[1]&&T.reverse(),T[0]=Math.max(T[0],_[0]),T[1]=Math.min(T[1],_[1]))},c.prototype.completeVisualOption=function(){x.prototype.completeVisualOption.apply(this,arguments),each$f(this.stateList,function(_){var T=this.option.controller[_].symbolSize;T&&T[0]!==T[1]&&(T[0]=T[1]/3)},this)},c.prototype.setSelected=function(_){this.option.range=_.slice(),this._resetRange()},c.prototype.getSelected=function(){var _=this.getExtent(),T=asc$2((this.get("range")||[]).slice());return T[0]>_[1]&&(T[0]=_[1]),T[1]>_[1]&&(T[1]=_[1]),T[0]<_[0]&&(T[0]=_[0]),T[1]<_[0]&&(T[1]=_[0]),T},c.prototype.getValueState=function(_){var T=this.option.range,C=this.getExtent();return(T[0]<=C[0]||T[0]<=_)&&(T[1]>=C[1]||_<=T[1])?"inRange":"outOfRange"},c.prototype.findTargetDataIndices=function(_){var T=[];return this.eachTargetSeries(function(C){var M=[],E=C.getData();E.each(this.getDataDimensionIndex(E),function(P,R){_[0]<=P&&P<=_[1]&&M.push(R)},this),T.push({seriesId:C.id,dataIndex:M})},this),T},c.prototype.getVisualMeta=function(_){var T=getColorStopValues(this,"outOfRange",this.getExtent()),C=getColorStopValues(this,"inRange",this.option.range.slice()),M=[];function E(F,V){M.push({value:F,color:_(F,V)})}for(var P=0,R=0,$=C.length,G=T.length;R_[1])break;M.push({color:this.getControllerVisual(R,"color",T),offset:P/C})}return M.push({color:this.getControllerVisual(_[1],"color",T),offset:1}),M},c.prototype._createBarPoints=function(_,T){var C=this.visualMapModel.itemSize;return[[C[0]-T[0],_[0]],[C[0],_[0]],[C[0],_[1]],[C[0]-T[1],_[1]]]},c.prototype._createBarGroup=function(_){var T=this._orient,C=this.visualMapModel.get("inverse");return new Group$4(T==="horizontal"&&!C?{scaleX:_==="bottom"?1:-1,rotation:Math.PI/2}:T==="horizontal"&&C?{scaleX:_==="bottom"?-1:1,rotation:-Math.PI/2}:T==="vertical"&&!C?{scaleX:_==="left"?1:-1,scaleY:-1}:{scaleX:_==="left"?1:-1})},c.prototype._updateHandle=function(_,T){if(this._useHandle){var C=this._shapes,M=this.visualMapModel,E=C.handleThumbs,P=C.handleLabels,R=M.itemSize,$=M.getExtent();each$1([0,1],function(G){var O=E[G];O.setStyle("fill",T.handlesColor[G]),O.y=_[G];var L=linearMap(_[G],[0,R[1]],$,!0),F=this.getControllerVisual(L,"symbolSize");O.scaleX=O.scaleY=F/R[0],O.x=R[0]-F/2;var V=applyTransform(C.handleLabelPoints[G],getTransform$1(O,this.group));P[G].setStyle({x:V[0],y:V[1],text:M.formatValueText(this._dataInterval[G]),verticalAlign:"middle",align:this._orient==="vertical"?this._applyTransform("left",C.mainGroup):"center"})},this)}},c.prototype._showIndicator=function(_,T,C,M){var E=this.visualMapModel,P=E.getExtent(),R=E.itemSize,$=[0,R[1]],G=this._shapes,O=G.indicator;if(O){O.attr("invisible",!1);var L={convertOpacityToAlpha:!0},F=this.getControllerVisual(_,"color",L),V=this.getControllerVisual(_,"symbolSize"),W=linearMap(_,P,$,!0),z=R[0]-V/2,Z={x:O.x,y:O.y};O.y=W,O.x=z;var H=applyTransform(G.indicatorLabelPoint,getTransform$1(O,this.group)),Y=G.indicatorLabel;Y.attr("invisible",!1);var U=this._applyTransform("left",G.mainGroup),j=this._orient,X=j==="horizontal";Y.setStyle({text:(C||"")+E.formatValueText(T),verticalAlign:X?U:"middle",align:X?"center":U});var K={x:z,y:W,style:{fill:F}},q={style:{x:H[0],y:H[1]}};if(E.ecModel.isAnimationEnabled()&&!this._firstShowIndicator){var J={duration:100,easing:"cubicInOut",additive:!0};O.x=Z.x,O.y=Z.y,O.animateTo(K,J),Y.animateTo(q,J)}else O.attr(K),Y.attr(q);this._firstShowIndicator=!1;var Q=this._shapes.handleLabels;if(Q)for(var ee=0;eeE[1]&&(O[1]=1/0),T&&(O[0]===-1/0?this._showIndicator(G,O[1],"< ",R):O[1]===1/0?this._showIndicator(G,O[0],"> ",R):this._showIndicator(G,G,"≈ ",R));var L=this._hoverLinkDataIndices,F=[];(T||useHoverLinkOnHandle(C))&&(F=this._hoverLinkDataIndices=C.findTargetDataIndices(O));var V=compressBatches(L,F);this._dispatchHighDown("downplay",makeHighDownBatch(V[0],C)),this._dispatchHighDown("highlight",makeHighDownBatch(V[1],C))}},c.prototype._hoverLinkFromSeriesMouseOver=function(_){var T;if(findEventDispatcher(_.target,function(R){var $=getECData(R);if($.dataIndex!=null)return T=$,!0},!0),!!T){var C=this.ecModel.getSeriesByIndex(T.seriesIndex),M=this.visualMapModel;if(M.isTargetSeries(C)){var E=C.getData(T.dataType),P=E.getStore().get(M.getDataDimensionIndex(E),T.dataIndex);isNaN(P)||this._showIndicator(P,P)}}},c.prototype._hideIndicator=function(){var _=this._shapes;_.indicator&&_.indicator.attr("invisible",!0),_.indicatorLabel&&_.indicatorLabel.attr("invisible",!0);var T=this._shapes.handleLabels;if(T)for(var C=0;C=0&&(M.dimension=E,T.push(M))}}),x.getData().setVisual("visualMeta",T)}}];function getColorVisual(x,c,_,T){for(var C=c.targetVisuals[T],M=VisualMapping$1.prepareVisualTypes(C),E={color:getVisualFromData(x.getData(),"color")},P=0,R=M.length;P0:c.splitNumber>0)||c.calculable)?"continuous":"piecewise"}),x.registerAction(visualMapActionInfo,visualMapActionHander),each$f(visualMapEncodingHandlers,function(c){x.registerVisual(x.PRIORITY.VISUAL.COMPONENT,c)}),x.registerPreprocessor(visualMapPreprocessor))}function install$5(x){x.registerComponentModel(ContinuousModel$1),x.registerComponentView(ContinuousView$1),installCommon(x)}var PiecewiseModel=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_._pieceList=[],_}return c.prototype.optionUpdated=function(_,T){x.prototype.optionUpdated.apply(this,arguments),this.resetExtent();var C=this._mode=this._determineMode();this._pieceList=[],resetMethods[this._mode].call(this,this._pieceList),this._resetSelected(_,T);var M=this.option.categories;this.resetVisual(function(E,P){C==="categories"?(E.mappingMethod="category",E.categories=clone$4(M)):(E.dataExtent=this.getExtent(),E.mappingMethod="piecewise",E.pieceList=map$1(this._pieceList,function(R){return R=clone$4(R),P!=="inRange"&&(R.visual=null),R}))})},c.prototype.completeVisualOption=function(){var _=this.option,T={},C=VisualMapping$1.listVisualTypes(),M=this.isCategory();each$f(_.pieces,function(P){each$f(C,function(R){P.hasOwnProperty(R)&&(T[R]=1)})}),each$f(T,function(P,R){var $=!1;each$f(this.stateList,function(G){$=$||E(_,G,R)||E(_.target,G,R)},this),!$&&each$f(this.stateList,function(G){(_[G]||(_[G]={}))[R]=visualDefault$1.get(R,G==="inRange"?"active":"inactive",M)})},this);function E(P,R,$){return P&&P[R]&&P[R].hasOwnProperty($)}x.prototype.completeVisualOption.apply(this,arguments)},c.prototype._resetSelected=function(_,T){var C=this.option,M=this._pieceList,E=(T?C:_).selected||{};if(C.selected=E,each$f(M,function(R,$){var G=this.getSelectedMapKey(R);E.hasOwnProperty(G)||(E[G]=!0)},this),C.selectedMode==="single"){var P=!1;each$f(M,function(R,$){var G=this.getSelectedMapKey(R);E[G]&&(P?E[G]=!1:P=!0)},this)}},c.prototype.getItemSymbol=function(){return this.get("itemSymbol")},c.prototype.getSelectedMapKey=function(_){return this._mode==="categories"?_.value+"":_.index+""},c.prototype.getPieceList=function(){return this._pieceList},c.prototype._determineMode=function(){var _=this.option;return _.pieces&&_.pieces.length>0?"pieces":this.option.categories?"categories":"splitNumber"},c.prototype.setSelected=function(_){this.option.selected=clone$4(_)},c.prototype.getValueState=function(_){var T=VisualMapping$1.findPieceIndex(_,this._pieceList);return T!=null&&this.option.selected[this.getSelectedMapKey(this._pieceList[T])]?"inRange":"outOfRange"},c.prototype.findTargetDataIndices=function(_){var T=[],C=this._pieceList;return this.eachTargetSeries(function(M){var E=[],P=M.getData();P.each(this.getDataDimensionIndex(P),function(R,$){var G=VisualMapping$1.findPieceIndex(R,C);G===_&&E.push($)},this),T.push({seriesId:M.id,dataIndex:E})},this),T},c.prototype.getRepresentValue=function(_){var T;if(this.isCategory())T=_.value;else if(_.value!=null)T=_.value;else{var C=_.interval||[];T=C[0]===-1/0&&C[1]===1/0?0:(C[0]+C[1])/2}return T},c.prototype.getVisualMeta=function(_){if(this.isCategory())return;var T=[],C=["",""],M=this;function E(G,O){var L=M.getRepresentValue({interval:G});O||(O=M.getValueState(L));var F=_(L,O);G[0]===-1/0?C[0]=F:G[1]===1/0?C[1]=F:T.push({value:G[0],color:F},{value:G[1],color:F})}var P=this._pieceList.slice();if(!P.length)P.push({interval:[-1/0,1/0]});else{var R=P[0].interval[0];R!==-1/0&&P.unshift({interval:[-1/0,R]}),R=P[P.length-1].interval[1],R!==1/0&&P.push({interval:[R,1/0]})}var $=-1/0;return each$f(P,function(G){var O=G.interval;O&&(O[0]>$&&E([$,O[0]],"outOfRange"),E(O.slice()),$=O[1])},this),{stops:T,outerColors:C}},c.type="visualMap.piecewise",c.defaultOption=inheritDefaultOption(VisualMapModel$1.defaultOption,{selected:null,minOpen:!1,maxOpen:!1,align:"auto",itemWidth:20,itemHeight:14,itemSymbol:"roundRect",pieces:null,categories:null,splitNumber:5,selectedMode:"multiple",itemGap:10,hoverLink:!0}),c}(VisualMapModel$1),resetMethods={splitNumber:function(x){var c=this.option,_=Math.min(c.precision,20),T=this.getExtent(),C=c.splitNumber;C=Math.max(parseInt(C,10),1),c.splitNumber=C;for(var M=(T[1]-T[0])/C;+M.toFixed(_)!==M&&_<5;)_++;c.precision=_,M=+M.toFixed(_),c.minOpen&&x.push({interval:[-1/0,T[0]],close:[0,0]});for(var E=0,P=T[0];E","≥"][T[0]]];_.text=_.text||this.formatValueText(_.value!=null?_.value:_.interval,!1,C)},this)}};function normalizeReverse(x,c){var _=x.inverse;(x.orient==="vertical"?!_:_)&&c.reverse()}const PiecewiseModel$1=PiecewiseModel;var PiecewiseVisualMapView=function(x){__extends(c,x);function c(){var _=x!==null&&x.apply(this,arguments)||this;return _.type=c.type,_}return c.prototype.doRender=function(){var _=this.group;_.removeAll();var T=this.visualMapModel,C=T.get("textGap"),M=T.textStyleModel,E=M.getFont(),P=M.getTextColor(),R=this._getItemAlign(),$=T.itemSize,G=this._getViewData(),O=G.endsText,L=retrieve(T.get("showLabel",!0),!O);O&&this._renderEndsText(_,O[0],$,L,R),each$f(G.viewPieceList,function(F){var V=F.piece,W=new Group$4;W.onclick=bind$1(this._onItemClick,this,V),this._enableHoverLink(W,F.indexInModelPieceList);var z=T.getRepresentValue(V);if(this._createItemSymbol(W,z,[0,0,$[0],$[1]]),L){var Z=this.visualMapModel.getValueState(z);W.add(new ZRText$1({style:{x:R==="right"?-C:$[0]+C,y:$[1]/2,text:V.text,verticalAlign:"middle",align:R,font:E,fill:P,opacity:Z==="outOfRange"?.5:1}}))}_.add(W)},this),O&&this._renderEndsText(_,O[1],$,L,R),box(T.get("orient"),_,T.get("itemGap")),this.renderBackground(_),this.positionGroup(_)},c.prototype._enableHoverLink=function(_,T){var C=this;_.on("mouseover",function(){return M("highlight")}).on("mouseout",function(){return M("downplay")});var M=function(E){var P=C.visualMapModel;P.option.hoverLink&&C.api.dispatchAction({type:E,batch:makeHighDownBatch(P.findTargetDataIndices(T),P)})}},c.prototype._getItemAlign=function(){var _=this.visualMapModel,T=_.option;if(T.orient==="vertical")return getItemAlign(_,this.api,_.itemSize);var C=T.align;return(!C||C==="auto")&&(C="left"),C},c.prototype._renderEndsText=function(_,T,C,M,E){if(T){var P=new Group$4,R=this.visualMapModel.textStyleModel;P.add(new ZRText$1({style:createTextStyle(R,{x:M?E==="right"?C[0]:0:C[0]/2,y:C[1]/2,verticalAlign:"middle",align:M?E:"center",text:T})})),_.add(P)}},c.prototype._getViewData=function(){var _=this.visualMapModel,T=map$1(_.getPieceList(),function(P,R){return{piece:P,indexInModelPieceList:R}}),C=_.get("text"),M=_.get("orient"),E=_.get("inverse");return(M==="horizontal"?E:!E)?T.reverse():C&&(C=C.slice().reverse()),{viewPieceList:T,endsText:C}},c.prototype._createItemSymbol=function(_,T,C){_.add(createSymbol$1(this.getControllerVisual(T,"symbol"),C[0],C[1],C[2],C[3],this.getControllerVisual(T,"color")))},c.prototype._onItemClick=function(_){var T=this.visualMapModel,C=T.option,M=C.selectedMode;if(M){var E=clone$4(C.selected),P=T.getSelectedMapKey(_);M==="single"||M===!0?(E[P]=!0,each$f(E,function(R,$){E[$]=$===P})):E[P]=!E[P],this.api.dispatchAction({type:"selectDataRange",from:this.uid,visualMapId:this.visualMapModel.id,selected:E})}},c.type="visualMap.piecewise",c}(VisualMapView$1);const PiecewiseView=PiecewiseVisualMapView;function install$4(x){x.registerComponentModel(PiecewiseModel$1),x.registerComponentView(PiecewiseView),installCommon(x)}function install$3(x){use(install$5),use(install$4)}var DEFAULT_OPTION={label:{enabled:!0},decal:{show:!1}},inner=makeInner(),decalPaletteScope={};function ariaVisual(x,c){var _=x.getModel("aria");if(!_.get("enabled"))return;var T=clone$4(DEFAULT_OPTION);merge(T.label,x.getLocaleModel().get("aria"),!1),merge(_.option,T,!1),C(),M();function C(){var $=_.getModel("decal"),G=$.get("show");if(G){var O=createHashMap();x.eachSeries(function(L){if(!L.isColorBySeries()){var F=O.get(L.type);F||(F={},O.set(L.type,F)),inner(L).scope=F}}),x.eachRawSeries(function(L){if(x.isSeriesFiltered(L))return;if(isFunction(L.enableAriaDecal)){L.enableAriaDecal();return}var F=L.getData();if(L.isColorBySeries()){var H=getDecalFromPalette(L.ecModel,L.name,decalPaletteScope,x.getSeriesCount()),Y=F.getVisual("decal");F.setVisual("decal",U(Y,H))}else{var V=L.getRawData(),W={},z=inner(L).scope;F.each(function(j){var X=F.getRawIndex(j);W[X]=j});var Z=V.count();V.each(function(j){var X=W[j],K=V.getName(j)||j+"",q=getDecalFromPalette(L.ecModel,K,z,Z),J=F.getItemVisual(X,"decal");F.setItemVisual(X,"decal",U(J,q))})}function U(j,X){var K=j?extend(extend({},X),j):X;return K.dirty=!0,K}})}}function M(){var $=x.getLocaleModel().get("aria"),G=_.getModel("label");if(G.option=defaults(G.option,$),!!G.get("enabled")){var O=c.getZr().dom;if(G.get("description")){O.setAttribute("aria-label",G.get("description"));return}var L=x.getSeriesCount(),F=G.get(["data","maxCount"])||10,V=G.get(["series","maxCount"])||10,W=Math.min(L,V),z;if(!(L<1)){var Z=P();if(Z){var H=G.get(["general","withTitle"]);z=E(H,{title:Z})}else z=G.get(["general","withoutTitle"]);var Y=[],U=L>1?G.get(["series","multiple","prefix"]):G.get(["series","single","prefix"]);z+=E(U,{seriesCount:L}),x.eachSeries(function(q,J){if(J1?G.get(["series","multiple",re]):G.get(["series","single",re]),Q=E(Q,{seriesId:q.seriesIndex,seriesName:q.get("name"),seriesType:R(q.subType)});var ie=q.getData();if(ie.count()>F){var ae=G.get(["data","partialData"]);Q+=E(ae,{displayCnt:F})}else Q+=G.get(["data","allData"]);for(var ne=G.get(["data","separator","middle"]),te=G.get(["data","separator","end"]),oe=[],ue=0;ue":"gt",">=":"gte","=":"eq","!=":"ne","<>":"ne"},RegExpEvaluator=function(){function x(c){var _=this._condVal=isString(c)?new RegExp(c):isRegExp(c)?c:null;if(_==null){var T="";throwError(T)}}return x.prototype.evaluate=function(c){var _=typeof c;return isString(_)?this._condVal.test(c):isNumber(_)?this._condVal.test(c+""):!1},x}(),ConstConditionInternal=function(){function x(){}return x.prototype.evaluate=function(){return this.value},x}(),AndConditionInternal=function(){function x(){}return x.prototype.evaluate=function(){for(var c=this.children,_=0;_2&&T.push(C),C=[ie,ae]}function G(ie,ae,ne,te){aroundEqual(ie,ne)&&aroundEqual(ae,te)||C.push(ie,ae,ne,te,ne,te)}function O(ie,ae,ne,te,oe,ue){var de=Math.abs(ae-ie),pe=Math.tan(de/4)*4/3,he=aeq:ee2&&T.push(C),T}function adpativeBezier(x,c,_,T,C,M,E,P,R,$){if(aroundEqual(x,_)&&aroundEqual(c,T)&&aroundEqual(C,E)&&aroundEqual(M,P)){R.push(E,P);return}var G=2/$,O=G*G,L=E-x,F=P-c,V=Math.sqrt(L*L+F*F);L/=V,F/=V;var W=_-x,z=T-c,Z=C-E,H=M-P,Y=W*W+z*z,U=Z*Z+H*H;if(Y=0&&q=0){R.push(E,P);return}var J=[],Q=[];cubicSubdivide(x,_,C,E,.5,J),cubicSubdivide(c,T,M,P,.5,Q),adpativeBezier(J[0],Q[0],J[1],Q[1],J[2],Q[2],J[3],Q[3],R,$),adpativeBezier(J[4],Q[4],J[5],Q[5],J[6],Q[6],J[7],Q[7],R,$)}function pathToPolygons(x,c){var _=pathToBezierCurves(x),T=[];c=c||1;for(var C=0;C<_.length;C++){var M=_[C],E=[],P=M[0],R=M[1];E.push(P,R);for(var $=2;$0)for(var $=0;$Math.abs($),O=getDividingGrids([R,$],G?0:1,c),L=(G?P:$)/O.length,F=0;FC,E=getDividingGrids([T,C],M?0:1,c),P=M?"width":"height",R=M?"height":"width",$=M?"x":"y",G=M?"y":"x",O=x[P]/E.length,L=0;L1?null:new Point$1(W*R+x,W*$+c)}function projPtOnLine(x,c,_){var T=new Point$1;Point$1.sub(T,_,c),T.normalize();var C=new Point$1;Point$1.sub(C,x,c);var M=C.dot(T);return M}function addToPoly(x,c){var _=x[x.length-1];_&&_[0]===c[0]&&_[1]===c[1]||x.push(c)}function splitPolygonByLine(x,c,_){for(var T=x.length,C=[],M=0;ME?($.x=G.x=P+M/2,$.y=R,G.y=R+E):($.y=G.y=R+E/2,$.x=P,G.x=P+M),splitPolygonByLine(c,$,G)}function binaryDivideRecursive(x,c,_,T){if(_===1)T.push(c);else{var C=Math.floor(_/2),M=x(c);binaryDivideRecursive(x,M[0],C,T),binaryDivideRecursive(x,M[1],_-C,T)}return T}function clone(x,c){for(var _=[],T=0;T0)for(var j=T/_,X=-T/2;X<=T/2;X+=j){for(var K=Math.sin(X),q=Math.cos(X),J=0,Y=0;Y0;$/=2){var G=0,O=0;(x&$)>0&&(G=1),(c&$)>0&&(O=1),P+=$*$*(3*G^O),O===0&&(G===1&&(x=$-1-x,c=$-1-c),R=x,x=c,c=R)}return P}function sortPaths(x){var c=1/0,_=1/0,T=-1/0,C=-1/0,M=map$1(x,function(P){var R=P.getBoundingRect(),$=P.getComputedTransform(),G=R.x+R.width/2+($?$[4]:0),O=R.y+R.height/2+($?$[5]:0);return c=Math.min(G,c),_=Math.min(O,_),T=Math.max(G,T),C=Math.max(O,C),[G,O]}),E=map$1(M,function(P,R){return{cp:P,z:hilbert(P[0],P[1],c,_,T,C),path:x[R]}});return E.sort(function(P,R){return P.z-R.z}).map(function(P){return P.path})}function defaultDividePath(x){return split(x.path,x.count)}function createEmptyReturn(){return{fromIndividuals:[],toIndividuals:[],count:0}}function combineMorph(x,c,_){var T=[];function C(j){for(var X=0;X=0;C--)if(!_[C].many.length){var R=_[P].many;if(R.length<=1)if(P)P=0;else return _;var M=R.length,$=Math.ceil(M/2);_[C].many=R.slice($,M),_[P].many=R.slice(0,$),P++}return _}var pathDividers={clone:function(x){for(var c=[],_=1-Math.pow(1-x.path.style.opacity,1/x.count),T=0;T0))return;var P=T.getModel("universalTransition").get("delay"),R=Object.assign({setToFinal:!0},E),$,G;isMultiple(x)&&($=x,G=c),isMultiple(c)&&($=c,G=x);function O(Z,H,Y,U,j){var X=Z.many,K=Z.one;if(X.length===1&&!j){var q=H?X[0]:K,J=H?K:X[0];if(isCombineMorphing(q))O({many:[q],one:J},!0,Y,U,!0);else{var Q=P?defaults({delay:P(Y,U)},R):R;morphPath(q,J,Q),M(q,J,q,J,Q)}}else for(var ee=defaults({dividePath:pathDividers[_],individualDelay:P&&function(oe,ue,de,pe){return P(oe+Y,U)}},R),re=H?combineMorph(X,K,ee):separateMorph(K,X,ee),ie=re.fromIndividuals,ae=re.toIndividuals,ne=ie.length,te=0;tec.length,F=$?prepareMorphBatches(G,$):prepareMorphBatches(L?c:x,[L?x:c]),V=0,W=0;WDATA_COUNT_THRESHOLD))for(var C=T.getIndices(),M=getGroupIdDimension(T),E=0;E0&&U.group.traverse(function(X){X instanceof Path$1&&!X.animators.length&&X.animateFrom({style:{opacity:0}},j)})})}function getSeriesTransitionKey(x){var c=x.getModel("universalTransition").get("seriesKey");return c||x.id}function convertArraySeriesKeyToString(x){return isArray$1(x)?x.sort().join(","):x}function getDivideShapeFromData(x){if(x.hostModel)return x.hostModel.getModel("universalTransition").get("divideShape")}function findTransitionSeriesBatches(x,c){var _=createHashMap(),T=createHashMap(),C=createHashMap();return each$f(x.oldSeries,function(M,E){var P=x.oldDataGroupIds[E],R=x.oldData[E],$=getSeriesTransitionKey(M),G=convertArraySeriesKeyToString($);T.set(G,{dataGroupId:P,data:R}),isArray$1($)&&each$f($,function(O){C.set(O,{key:G,dataGroupId:P,data:R})})}),each$f(c.updatedSeries,function(M){if(M.isUniversalTransitionEnabled()&&M.isAnimationEnabled()){var E=M.get("dataGroupId"),P=M.getData(),R=getSeriesTransitionKey(M),$=convertArraySeriesKeyToString(R),G=T.get($);if(G)_.set($,{oldSeries:[{dataGroupId:G.dataGroupId,divide:getDivideShapeFromData(G.data),data:G.data}],newSeries:[{dataGroupId:E,divide:getDivideShapeFromData(P),data:P}]});else if(isArray$1(R)){var O=[];each$f(R,function(V){var W=T.get(V);W.data&&O.push({dataGroupId:W.dataGroupId,divide:getDivideShapeFromData(W.data),data:W.data})}),O.length&&_.set($,{oldSeries:O,newSeries:[{dataGroupId:E,data:P,divide:getDivideShapeFromData(P)}]})}else{var L=C.get(R);if(L){var F=_.get(L.key);F||(F={oldSeries:[{dataGroupId:L.dataGroupId,data:L.data,divide:getDivideShapeFromData(L.data)}],newSeries:[]},_.set(L.key,F)),F.newSeries.push({dataGroupId:E,data:P,divide:getDivideShapeFromData(P)})}}}}),_}function querySeries(x,c){for(var _=0;_=0&&C.push({dataGroupId:c.oldDataGroupIds[P],data:c.oldData[P],divide:getDivideShapeFromData(c.oldData[P]),dim:E.dimension})}),each$f(normalizeToArray(x.to),function(E){var P=querySeries(_.updatedSeries,E);if(P>=0){var R=_.updatedSeries[P].getData();M.push({dataGroupId:c.oldDataGroupIds[P],data:R,divide:getDivideShapeFromData(R),dim:E.dimension})}}),C.length>0&&M.length>0&&transitionBetween(C,M,T)}function installUniversalTransition(x){x.registerUpdateLifecycle("series:beforeupdate",function(c,_,T){each$f(normalizeToArray(T.seriesTransition),function(C){each$f(normalizeToArray(C.to),function(M){for(var E=T.updatedSeries,P=0;P(C(),C=subscribe(E,F=>_(5,T=F)),E);x.$$.on_destroy.push(()=>C());let{data:E}=c;M();let{height:P=400}=c,{color1:R="rgba(255, 145, 124, 0.1)"}=c,{color2:$="rgba(255, 145, 124, 0.9)"}=c,G;function O(){setTimeout(()=>{if(T&&G){const F=init$1(G),V={xAxis:{min:-1,max:1},yAxis:{min:-1,max:1},series:[{data:T,type:"line"}]};V&&F.setOption(V)}else console.log("Need both chat and data",G,T)},100)}function L(F){binding_callbacks[F?"unshift":"push"](()=>{G=F,_(2,G)})}return x.$$set=F=>{"data"in F&&M(_(0,E=F.data)),"height"in F&&_(1,P=F.height),"color1"in F&&_(3,R=F.color1),"color2"in F&&_(4,$=F.color2)},x.$$.update=()=>{x.$$.dirty&32&&O()},[E,P,G,R,$,T,L]}class Cartesian extends SvelteComponent{constructor(c){super(),init$3(this,c,instance$7,create_fragment$b,safe_not_equal,{data:0,height:1,color1:3,color2:4})}}const TwoDimensions_svelte_svelte_type_style_lang="";function create_if_block$4(x){let c,_,T,C,M,E,P=float$2(x[0])+"",R,$,G,O,L,F,V,W,z,Z,H,Y,U;return c=new Cartesian({props:{height:300,data:x[1]}}),{c(){create_component(c.$$.fragment),_=space(),T=element("div"),C=element("div"),M=element("div"),E=text(`Cosine Distance: `),R=text(P),$=space(),G=element("div"),O=element("div"),O.textContent=`${format(x[2])}`,L=space(),F=element("div"),F.textContent=`${format(x[3])}`,V=space(),W=element("div"),W.textContent=`${format(x[4])}`,z=space(),Z=element("div"),Z.textContent=`${format(x[5])}`,attr(C,"class","distance svelte-18d9ono"),attr(O,"class","btnn taller svelte-18d9ono"),attr(F,"class","btnn taller svelte-18d9ono"),attr(W,"class","btnn taller svelte-18d9ono"),attr(Z,"class","btnn taller svelte-18d9ono"),attr(G,"class","groups svelte-18d9ono"),attr(T,"class","btnns svelte-18d9ono")},m(j,X){mount_component(c,j,X),insert(j,_,X),insert(j,T,X),append(T,C),append(C,M),append(M,E),append(M,R),append(T,$),append(T,G),append(G,O),append(G,L),append(G,F),append(G,V),append(G,W),append(G,z),append(G,Z),H=!0,Y||(U=[listen(O,"click",x[6]),listen(F,"click",x[7]),listen(W,"click",x[8]),listen(Z,"click",x[9])],Y=!0)},p(j,X){(!H||X&1)&&P!==(P=float$2(j[0])+"")&&set_data(R,P)},i(j){H||(transition_in(c.$$.fragment,j),H=!0)},o(j){transition_out(c.$$.fragment,j),H=!1},d(j){destroy_component(c,j),j&&detach(_),j&&detach(T),Y=!1,run_all(U)}}}function create_fragment$a(x){let c,_,T=x[1]&&create_if_block$4(x);return{c(){T&&T.c(),c=empty()},m(C,M){T&&T.m(C,M),insert(C,c,M),_=!0},p(C,[M]){C[1]&&T.p(C,M)},i(C){_||(transition_in(T),_=!0)},o(C){transition_out(T),_=!1},d(C){T&&T.d(C),C&&detach(c)}}}function float$2(x){return parseFloat(x).toPrecision(2)}function format(x){return"["+x.map(c=>c.join(", ")).join("] and [")+"]"}function cosineSimilarity(x,c){for(var _=0,T=0,C=0,M=0;M_(10,T=W));let M=0;const E=[[-.22,.81],[.23,.44]],P=[[.34,-.12],[-.12,.67]],R=[[-1,0],[-.9,.2]],$=[[-1,-1],[1,1]];function G(){_(0,M=cosineSimilarity(T[0],T[2]))}function O(){set_store_value(C,T=[E[0],[0,0],E[1]],T),G()}function L(){set_store_value(C,T=[P[0],[0,0],P[1]],T),G()}function F(){set_store_value(C,T=[R[0],[0,0],R[1]],T),G()}function V(){set_store_value(C,T=[$[0],[0,0],$[1]],T),G()}return onMount(()=>{setTimeout(()=>{O()},100)}),[M,C,E,P,R,$,O,L,F,V]}class TwoDimensions extends SvelteComponent{constructor(c){super(),init$3(this,c,instance$6,create_fragment$a,safe_not_equal,{})}}const Mult_svelte_svelte_type_style_lang="";function create_else_block$3(x){let c,_,T,C;return{c(){c=element("span"),_=text(x[0]),T=text(" x "),C=text(x[1]),attr(c,"class","multiplier item svelte-vdsfa9")},m(M,E){insert(M,c,E),append(c,_),append(c,T),append(c,C)},p(M,E){E&1&&set_data(_,M[0]),E&2&&set_data(C,M[1])},i:noop$1,o:noop$1,d(M){M&&detach(c)}}}function create_if_block$3(x){let c,_,T=float$1(x[2])+"",C,M,E,P;return{c(){c=element("span"),_=element("span"),C=text(T),attr(c,"class","item calc-result svelte-vdsfa9")},m(R,$){insert(R,c,$),append(c,_),append(_,C),P=!0},p(R,$){(!P||$&4)&&T!==(T=float$1(R[2])+"")&&set_data(C,T)},i(R){P||(add_render_callback(()=>{M||(M=create_bidirectional_transition(_,fly,{},!0)),M.run(1)}),add_render_callback(()=>{E||(E=create_bidirectional_transition(c,fly,{},!0)),E.run(1)}),P=!0)},o(R){M||(M=create_bidirectional_transition(_,fly,{},!1)),M.run(0),E||(E=create_bidirectional_transition(c,fly,{},!1)),E.run(0),P=!1},d(R){R&&detach(c),R&&M&&M.end(),R&&E&&E.end()}}}function create_fragment$9(x){let c,_,T,C;const M=[create_if_block$3,create_else_block$3],E=[];function P(R,$){return R[2]?0:1}return _=P(x),T=E[_]=M[_](x),{c(){c=element("span"),T.c(),attr(c,"class","w-full")},m(R,$){insert(R,c,$),E[_].m(c,null),C=!0},p(R,[$]){let G=_;_=P(R),_===G?E[_].p(R,$):(group_outros(),transition_out(E[G],1,1,()=>{E[G]=null}),check_outros(),T=E[_],T?T.p(R,$):(T=E[_]=M[_](R),T.c()),transition_in(T,1),T.m(c,null))},i(R){C||(transition_in(T),C=!0)},o(R){transition_out(T),C=!1},d(R){R&&detach(c),E[_].d()}}}function float$1(x){return parseFloat(x).toPrecision(2)}function instance$5(x,c,_){let{a:T}=c,{b:C}=c,{time:M}=c,E=0;function P(){_(2,E=0),setTimeout(()=>{_(2,E=T*C)},Math.max(10,M/2))}return x.$$set=R=>{"a"in R&&_(0,T=R.a),"b"in R&&_(1,C=R.b),"time"in R&&_(3,M=R.time)},x.$$.update=()=>{x.$$.dirty&11&&P()},[T,C,E,M]}class Mult extends SvelteComponent{constructor(c){super(),init$3(this,c,instance$5,create_fragment$9,safe_not_equal,{a:0,b:1,time:3})}}const CosineCalculator_svelte_svelte_type_style_lang="";function create_else_block_1$2(x){let c;return{c(){c=element("div"),c.textContent='Please generate two embeddings by clicking the "Generate Embedding" buttons.',attr(c,"class","explanation svelte-rs6pxl")},m(_,T){insert(_,c,T)},p:noop$1,i:noop$1,o:noop$1,d(_){_&&detach(c)}}}function create_if_block$2(x){let c,_,T,C,M,E,P,R,$=!x[3]&&create_if_block_3$2(x),G=x[5]<384&&create_if_block_2$2(x);const O=[create_if_block_1$2,create_else_block$2],L=[];function F(V,W){return V[5]<384?0:1}return E=F(x),P=L[E]=O[E](x),{c(){c=element("div"),c.textContent="Cosine Calculator",_=space(),$&&$.c(),T=space(),G&&G.c(),C=space(),M=element("div"),P.c(),attr(c,"class","calc svelte-rs6pxl"),attr(M,"class","display svelte-rs6pxl")},m(V,W){insert(V,c,W),insert(V,_,W),$&&$.m(V,W),insert(V,T,W),G&&G.m(V,W),insert(V,C,W),insert(V,M,W),L[E].m(M,null),R=!0},p(V,W){V[3]?$&&($.d(1),$=null):$?$.p(V,W):($=create_if_block_3$2(V),$.c(),$.m(T.parentNode,T)),V[5]<384?G?(G.p(V,W),W&32&&transition_in(G,1)):(G=create_if_block_2$2(V),G.c(),transition_in(G,1),G.m(C.parentNode,C)):G&&(group_outros(),transition_out(G,1,1,()=>{G=null}),check_outros());let z=E;E=F(V),E===z?L[E].p(V,W):(group_outros(),transition_out(L[z],1,1,()=>{L[z]=null}),check_outros(),P=L[E],P?P.p(V,W):(P=L[E]=O[E](V),P.c()),transition_in(P,1),P.m(M,null))},i(V){R||(transition_in(G),transition_in(P),R=!0)},o(V){transition_out(G),transition_out(P),R=!1},d(V){V&&detach(c),V&&detach(_),$&&$.d(V),V&&detach(T),G&&G.d(V),V&&detach(C),V&&detach(M),L[E].d()}}}function create_if_block_3$2(x){let c,_,T,C,M;return{c(){c=element("div"),_=element("div"),_.textContent="Start",T=text(` Click start, animation takes 35 seconds.`),attr(_,"class","btnn"),attr(c,"class","spread svelte-rs6pxl")},m(E,P){insert(E,c,P),append(c,_),append(c,T),C||(M=listen(_,"click",x[12]),C=!0)},p:noop$1,d(E){E&&detach(c),C=!1,M()}}}function create_if_block_2$2(x){let c,_,T,C,M,E;return _=new Embedding({props:{hidden:x[5],result:x[0]}}),M=new Embedding({props:{hidden:x[5],result:x[1]}}),{c(){c=element("div"),create_component(_.$$.fragment),T=space(),C=element("div"),create_component(M.$$.fragment),attr(c,"class","embedding"),attr(C,"class","embedding")},m(P,R){insert(P,c,R),mount_component(_,c,null),insert(P,T,R),insert(P,C,R),mount_component(M,C,null),E=!0},p(P,R){const $={};R&32&&($.hidden=P[5]),R&1&&($.result=P[0]),_.$set($);const G={};R&32&&(G.hidden=P[5]),R&2&&(G.result=P[1]),M.$set(G)},i(P){E||(transition_in(_.$$.fragment,P),transition_in(M.$$.fragment,P),E=!0)},o(P){transition_out(_.$$.fragment,P),transition_out(M.$$.fragment,P),E=!1},d(P){P&&detach(c),destroy_component(_),P&&detach(T),P&&detach(C),destroy_component(M)}}}function create_else_block$2(x){let c,_,T,C,M,E,P,R,$,G,O,L,F,V,W,z,Z,H,Y,U,j,X,K,q,J,Q=x[6]/(x[7]*x[8])+"",ee,re;return{c(){c=element("div"),_=element("div"),T=element("div"),T.textContent="dotproduct =",C=space(),M=element("div"),E=text(x[6]),P=space(),R=element("div"),$=element("div"),$.textContent="mA =",G=space(),O=element("div"),L=text(x[7]),F=space(),V=element("div"),W=element("div"),W.textContent="mB =",z=space(),Z=element("div"),H=text(x[8]),Y=space(),U=element("div"),U.innerHTML=`
( dotproduct / mA * mB ) is
similarity score
`,j=space(),X=element("div"),K=element("div"),K.textContent="similarity score =",q=space(),J=element("div"),ee=text(Q),attr(M,"class","calc-result"),attr(_,"class","calcs svelte-rs6pxl"),attr(O,"class","calc-result"),attr(R,"class","calcs svelte-rs6pxl"),attr(Z,"class","calc-result"),attr(V,"class","calcs svelte-rs6pxl"),attr(U,"class","calcs svelte-rs6pxl"),attr(J,"class","calc-result"),attr(X,"class","calcs svelte-rs6pxl")},m(ie,ae){insert(ie,c,ae),append(c,_),append(_,T),append(_,C),append(_,M),append(M,E),append(c,P),append(c,R),append(R,$),append(R,G),append(R,O),append(O,L),append(c,F),append(c,V),append(V,W),append(V,z),append(V,Z),append(Z,H),append(c,Y),append(c,U),append(c,j),append(c,X),append(X,K),append(X,q),append(X,J),append(J,ee)},p(ie,ae){ae&64&&set_data(E,ie[6]),ae&128&&set_data(L,ie[7]),ae&256&&set_data(H,ie[8]),ae&448&&Q!==(Q=ie[6]/(ie[7]*ie[8])+"")&&set_data(ee,Q)},i(ie){re||add_render_callback(()=>{re=create_in_transition(c,fly,{}),re.start()})},o:noop$1,d(ie){ie&&detach(c)}}}function create_if_block_1$2(x){let c,_,T,C,M,E,P,R,$,G,O=float(x[10][x[5]])+"",L,F,V,W,z,Z,H,Y,U,j=float(x[9][x[5]])+"",X,K,q,J,Q,ee,re,ie,ae,ne,te,oe,ue,de,pe,he,we,ye,Me,Pe,Re,De,Le,$e,Oe,Ee,Be,He,We,Ke,Je,tt,mt,pt,bt,gt=float(x[6])+"",ct,yt,At,qe,Bt,xt,Mt=float(x[7])+"",Dt,Ot,_t,ft,Gt,Ye,Pt=float(x[8])+"",Wt,St;return oe=new Mult({props:{time:x[4],a:float(x[10][x[5]]),b:float(x[9][x[5]])}}),Re=new Mult({props:{time:x[4],a:float(x[10][x[5]]),b:float(x[10][x[5]])}}),Ke=new Mult({props:{time:x[4],a:float(x[9][x[5]]),b:float(x[9][x[5]])}}),{c(){c=text("Index: "),_=text(x[5]),T=space(),C=element("div"),M=element("div"),E=text("A["),P=text(x[5]),R=text("] ="),$=space(),G=element("div"),L=text(O),F=space(),V=element("div"),W=element("div"),z=text("B["),Z=text(x[5]),H=text("] ="),Y=space(),U=element("div"),X=text(j),K=space(),q=element("div"),J=element("div"),Q=text("A["),ee=text(x[5]),re=text("] * B["),ie=text(x[5]),ae=text("] ="),ne=space(),te=element("div"),create_component(oe.$$.fragment),ue=space(),de=element("div"),pe=element("div"),he=text("A["),we=text(x[5]),ye=text("]^2 ="),Me=space(),Pe=element("div"),create_component(Re.$$.fragment),De=space(),Le=element("div"),$e=element("div"),Oe=text("B["),Ee=text(x[5]),Be=text("]^2 ="),He=space(),We=element("div"),create_component(Ke.$$.fragment),Je=space(),tt=element("div"),mt=element("div"),mt.textContent="dotproduct (sum) =",pt=space(),bt=element("div"),ct=text(gt),yt=space(),At=element("div"),qe=element("div"),qe.textContent="mA (sum) =",Bt=space(),xt=element("div"),Dt=text(Mt),Ot=space(),_t=element("div"),ft=element("div"),ft.textContent="mB (sum) =",Gt=space(),Ye=element("div"),Wt=text(Pt),attr(G,"class","calc-result"),attr(C,"class","calcs svelte-rs6pxl"),attr(U,"class","calc-result"),attr(V,"class","calcs svelte-rs6pxl"),attr(q,"class","calcs svelte-rs6pxl"),attr(de,"class","calcs svelte-rs6pxl"),attr(Le,"class","calcs svelte-rs6pxl"),attr(bt,"class","calc-result"),attr(tt,"class","calcs svelte-rs6pxl"),attr(xt,"class","calc-result"),attr(At,"class","calcs svelte-rs6pxl"),attr(Ye,"class","calc-result"),attr(_t,"class","calcs svelte-rs6pxl")},m(Ge,ze){insert(Ge,c,ze),insert(Ge,_,ze),insert(Ge,T,ze),insert(Ge,C,ze),append(C,M),append(M,E),append(M,P),append(M,R),append(C,$),append(C,G),append(G,L),insert(Ge,F,ze),insert(Ge,V,ze),append(V,W),append(W,z),append(W,Z),append(W,H),append(V,Y),append(V,U),append(U,X),insert(Ge,K,ze),insert(Ge,q,ze),append(q,J),append(J,Q),append(J,ee),append(J,re),append(J,ie),append(J,ae),append(q,ne),append(q,te),mount_component(oe,te,null),insert(Ge,ue,ze),insert(Ge,de,ze),append(de,pe),append(pe,he),append(pe,we),append(pe,ye),append(de,Me),append(de,Pe),mount_component(Re,Pe,null),insert(Ge,De,ze),insert(Ge,Le,ze),append(Le,$e),append($e,Oe),append($e,Ee),append($e,Be),append(Le,He),append(Le,We),mount_component(Ke,We,null),insert(Ge,Je,ze),insert(Ge,tt,ze),append(tt,mt),append(tt,pt),append(tt,bt),append(bt,ct),insert(Ge,yt,ze),insert(Ge,At,ze),append(At,qe),append(At,Bt),append(At,xt),append(xt,Dt),insert(Ge,Ot,ze),insert(Ge,_t,ze),append(_t,ft),append(_t,Gt),append(_t,Ye),append(Ye,Wt),St=!0},p(Ge,ze){(!St||ze&32)&&set_data(_,Ge[5]),(!St||ze&32)&&set_data(P,Ge[5]),(!St||ze&1056)&&O!==(O=float(Ge[10][Ge[5]])+"")&&set_data(L,O),(!St||ze&32)&&set_data(Z,Ge[5]),(!St||ze&544)&&j!==(j=float(Ge[9][Ge[5]])+"")&&set_data(X,j),(!St||ze&32)&&set_data(ee,Ge[5]),(!St||ze&32)&&set_data(ie,Ge[5]);const kt={};ze&16&&(kt.time=Ge[4]),ze&1056&&(kt.a=float(Ge[10][Ge[5]])),ze&544&&(kt.b=float(Ge[9][Ge[5]])),oe.$set(kt),(!St||ze&32)&&set_data(we,Ge[5]);const Nt={};ze&16&&(Nt.time=Ge[4]),ze&1056&&(Nt.a=float(Ge[10][Ge[5]])),ze&1056&&(Nt.b=float(Ge[10][Ge[5]])),Re.$set(Nt),(!St||ze&32)&&set_data(Ee,Ge[5]);const $t={};ze&16&&($t.time=Ge[4]),ze&544&&($t.a=float(Ge[9][Ge[5]])),ze&544&&($t.b=float(Ge[9][Ge[5]])),Ke.$set($t),(!St||ze&64)&>!==(gt=float(Ge[6])+"")&&set_data(ct,gt),(!St||ze&128)&&Mt!==(Mt=float(Ge[7])+"")&&set_data(Dt,Mt),(!St||ze&256)&&Pt!==(Pt=float(Ge[8])+"")&&set_data(Wt,Pt)},i(Ge){St||(transition_in(oe.$$.fragment,Ge),transition_in(Re.$$.fragment,Ge),transition_in(Ke.$$.fragment,Ge),St=!0)},o(Ge){transition_out(oe.$$.fragment,Ge),transition_out(Re.$$.fragment,Ge),transition_out(Ke.$$.fragment,Ge),St=!1},d(Ge){Ge&&detach(c),Ge&&detach(_),Ge&&detach(T),Ge&&detach(C),Ge&&detach(F),Ge&&detach(V),Ge&&detach(K),Ge&&detach(q),destroy_component(oe),Ge&&detach(ue),Ge&&detach(de),destroy_component(Re),Ge&&detach(De),Ge&&detach(Le),destroy_component(Ke),Ge&&detach(Je),Ge&&detach(tt),Ge&&detach(yt),Ge&&detach(At),Ge&&detach(Ot),Ge&&detach(_t)}}}function create_fragment$8(x){let c,_,T,C;const M=[create_if_block$2,create_else_block_1$2],E=[];function P(R,$){return R[10].length&&R[9].length?0:1}return _=P(x),T=E[_]=M[_](x),{c(){c=element("div"),T.c(),attr(c,"class","wrapper svelte-rs6pxl")},m(R,$){insert(R,c,$),E[_].m(c,null),C=!0},p(R,[$]){let G=_;_=P(R),_===G?E[_].p(R,$):(group_outros(),transition_out(E[G],1,1,()=>{E[G]=null}),check_outros(),T=E[_],T?T.p(R,$):(T=E[_]=M[_](R),T.c()),transition_in(T,1),T.m(c,null))},i(R){C||(transition_in(T),C=!0)},o(R){transition_out(T),C=!1},d(R){R&&detach(c),E[_].d()}}}function float(x){return parseFloat(x).toPrecision(2)}function instance$4(x,c,_){let T,C=noop$1,M=()=>(C(),C=subscribe(F,Q=>_(9,T=Q)),F),E,P=noop$1,R=()=>(P(),P=subscribe(L,Q=>_(10,E=Q)),L),$,G=noop$1,O=()=>(G(),G=subscribe(V,Q=>_(11,$=Q)),V);x.$$.on_destroy.push(()=>C()),x.$$.on_destroy.push(()=>P()),x.$$.on_destroy.push(()=>G());let{a:L}=c;R();let{b:F}=c;M();let{start:V}=c;O();let W=!1,z,Z;onMount(()=>{if(console.log("a, b",L,F),V&&V.subscribe){console.log("Start",V);let Q=!1;V.subscribe(ee=>{Q?(console.log("Subscribed",ee),ee?(console.log("Running",ee),q()):console.log("Skipping it")):Q=!0})}});let H=2e3,Y=0,U=0,j=0,X=0;function K(){E&&T&&E.length&&T.length?(_(4,H=Math.max(10,H-Y*Y)),Y<383&&(z=E[Y],Z=T[Y],_(6,U+=z*Z),_(7,j+=z*z),_(8,X+=Z*Z),setTimeout(K,H)),_(5,Y+=1)):console.log("Not ready",E,T)}function q(){console.log("Inside run",W),W||(console.log("Not started, starting",W),_(3,W=!0),console.log("Not started, starting",W),K(),console.log("Calculated"))}const J=()=>set_store_value(V,$=!0,$);return x.$$set=Q=>{"a"in Q&&R(_(0,L=Q.a)),"b"in Q&&M(_(1,F=Q.b)),"start"in Q&&O(_(2,V=Q.start))},[L,F,V,W,H,Y,U,j,X,T,E,$,J]}class CosineCalculator extends SvelteComponent{constructor(c){super(),init$3(this,c,instance$4,create_fragment$8,safe_not_equal,{a:0,b:1,start:2})}}const Credits_svelte_svelte_type_style_lang="";function get_each_context$2(x,c,_){const T=x.slice();return T[1]=c[_],T}function create_each_block$2(x){let c,_,T,C,M,E,P,R=x[1].name+"",$,G,O,L=x[1].bio+"",F,V;return{c(){c=element("div"),_=element("div"),T=element("img"),M=space(),E=element("div"),P=element("a"),$=text(R),G=space(),O=element("div"),F=text(L),V=space(),attr(T,"class","headshot svelte-exos6p"),src_url_equal(T.src,C=x[1].headshot)||attr(T,"src",C),attr(_,"class","wrapper svelte-exos6p"),attr(P,"href",x[1].link),attr(E,"class","name svelte-exos6p"),attr(O,"class","bio svelte-exos6p"),attr(c,"class","person svelte-exos6p")},m(W,z){insert(W,c,z),append(c,_),append(_,T),append(c,M),append(c,E),append(E,P),append(P,$),append(c,G),append(c,O),append(O,F),append(c,V)},p:noop$1,d(W){W&&detach(c)}}}function create_fragment$7(x){let c,_,T,C,M=x[0],E=[];for(let P=0;P[_,c]))}function escapeRegExp(x){return x.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const Callable=class{constructor(){let x=function(...c){return x._call(...c)};return Object.setPrototypeOf(x,new.target.prototype)}_call(...x){throw Error("Must implement _call method in subclass")}};function isTypedArray(x){var c,_,T;return((T=(_=(c=x==null?void 0:x.prototype)==null?void 0:c.__proto__)==null?void 0:_.constructor)==null?void 0:T.name)==="TypedArray"}function isIntegralNumber(x){return Number.isInteger(x)||typeof x=="bigint"}function exists(x){return x!=null}function calculateDimensions(x){const c=[];let _=x;for(;Array.isArray(_);)c.push(_.length),_=_[0];return c}function pop(x,c,_=void 0){const T=x[c];if(T!==void 0)return delete x[c],T;if(_===void 0)throw Error(`Key ${c} does not exist in object.`);return _}function mergeArrays(...x){return Array.prototype.concat.apply([],x)}function product(...x){return x.reduce((c,_)=>c.flatMap(T=>_.map(C=>[T,C])))}function calculateReflectOffset(x,c){return Math.abs((x+c)%(2*c)-c)}var ortWeb_minExports={},ortWeb_min$1={get exports(){return ortWeb_minExports},set exports(x){ortWeb_minExports=x}};const backends={},backendsSortedByPriority=[],registerBackend=(x,c,_)=>{if(c&&typeof c.init=="function"&&typeof c.createSessionHandler=="function"){const T=backends[x];if(T===void 0)backends[x]={backend:c,priority:_};else{if(T.priority>_)return;if(T.priority===_&&T.backend!==c)throw new Error(`cannot register backend "${x}" using priority ${_}`)}if(_>=0){const C=backendsSortedByPriority.indexOf(x);C!==-1&&backendsSortedByPriority.splice(C,1);for(let M=0;M{const c=x.length===0?backendsSortedByPriority:x,_=[];for(const T of c){const C=backends[T];if(C){if(C.initialized)return C.backend;if(C.aborted)continue;const M=!!C.initPromise;try{return M||(C.initPromise=C.backend.init()),await C.initPromise,C.initialized=!0,C.backend}catch(E){M||_.push({name:T,err:E}),C.aborted=!0}finally{delete C.initPromise}}}throw new Error(`no available backend found. ERR: ${_.map(T=>`[${T.name}] ${T.err}`).join(", ")}`)};class EnvImpl{constructor(){this.wasm={},this.webgl={},this.logLevelInternal="warning"}set logLevel(c){if(c!==void 0){if(typeof c!="string"||["verbose","info","warning","error","fatal"].indexOf(c)===-1)throw new Error(`Unsupported logging level: ${c}`);this.logLevelInternal=c}}get logLevel(){return this.logLevelInternal}}const env$2=new EnvImpl,isBigInt64ArrayAvailable=typeof BigInt64Array<"u"&&typeof BigInt64Array.from=="function",isBigUint64ArrayAvailable=typeof BigUint64Array<"u"&&typeof BigUint64Array.from=="function",NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP=new Map([["float32",Float32Array],["uint8",Uint8Array],["int8",Int8Array],["uint16",Uint16Array],["int16",Int16Array],["int32",Int32Array],["bool",Uint8Array],["float64",Float64Array],["uint32",Uint32Array]]),NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP=new Map([[Float32Array,"float32"],[Uint8Array,"uint8"],[Int8Array,"int8"],[Uint16Array,"uint16"],[Int16Array,"int16"],[Int32Array,"int32"],[Float64Array,"float64"],[Uint32Array,"uint32"]]);isBigInt64ArrayAvailable&&(NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP.set("int64",BigInt64Array),NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP.set(BigInt64Array,"int64"));isBigUint64ArrayAvailable&&(NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP.set("uint64",BigUint64Array),NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP.set(BigUint64Array,"uint64"));const calculateSize=x=>{let c=1;for(let _=0;_{const O=document.createElement("canvas"),L=O.getContext("2d");if(!c||!L)return G();const F=new Image;F.crossOrigin="Anonymous",F.src=c,F.onload=()=>{O.width=F.width,O.height=F.height,L.drawImage(F,0,0,O.width,O.height);const V=L.getImageData(0,0,O.width,O.height);if(_!==void 0){if(_.height!==void 0&&_.height!==O.height)throw new Error("Image input config height doesn't match ImageBitmap height");if(R.height=O.height,_.width!==void 0&&_.width!==O.width)throw new Error("Image input config width doesn't match ImageBitmap width");R.width=O.width}else R.height=O.height,R.width=O.width;$(tr.bufferToTensor(V.data,R))}});throw new Error("Input data provided is not supported - aborted tensor creation")}if(P!==void 0)return tr.bufferToTensor(P,R);throw new Error("Input data provided is not supported - aborted tensor creation")}toImageData(c){var _,T;const C=document.createElement("canvas").getContext("2d");let M;if(C!=null){const E=this.dims[3],P=this.dims[2],R=this.dims[1],$=c!==void 0&&c.format!==void 0?c.format:"RGB",G=c!==void 0&&((_=c.norm)===null||_===void 0?void 0:_.mean)!==void 0?c.norm.mean:255,O=c!==void 0&&((T=c.norm)===null||T===void 0?void 0:T.bias)!==void 0?c.norm.bias:0,L=P*E;if(c!==void 0){if(c.height!==void 0&&c.height!==P)throw new Error("Image output config height doesn't match tensor height");if(c.width!==void 0&&c.width!==E)throw new Error("Image output config width doesn't match tensor width");if(c.format!==void 0&&R===4&&c.format!=="RGBA"||R===3&&c.format!=="RGB"&&c.format!=="BGR")throw new Error("Tensor format doesn't match input tensor dims")}const F=4;let V=0,W=1,z=2,Z=3,H=0,Y=L,U=L*2,j=-1;$==="RGBA"?(H=0,Y=L,U=L*2,j=L*3):$==="RGB"?(H=0,Y=L,U=L*2):$==="RBG"&&(H=0,U=L,Y=L*2),M=C.createImageData(E,P);for(let X=0;X"u")throw new Error(`input '${$}' is missing in 'feeds'.`);if(E)for(const $ of this.outputNames)C[$]=null;const P=await this.handler.run(c,C,M),R={};for(const $ in P)Object.hasOwnProperty.call(P,$)&&(R[$]=new Tensor$1(P[$].type,P[$].data,P[$].dims));return R}static async create(c,_,T,C){let M,E={};if(typeof c=="string"){if(M=c,typeof _=="object"&&_!==null)E=_;else if(typeof _<"u")throw new TypeError("'options' must be an object.")}else if(c instanceof Uint8Array){if(M=c,typeof _=="object"&&_!==null)E=_;else if(typeof _<"u")throw new TypeError("'options' must be an object.")}else if(c instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&c instanceof SharedArrayBuffer){const O=c;let L=0,F=c.byteLength;if(typeof _=="object"&&_!==null)E=_;else if(typeof _=="number"){if(L=_,!Number.isSafeInteger(L))throw new RangeError("'byteOffset' must be an integer.");if(L<0||L>=O.byteLength)throw new RangeError(`'byteOffset' is out of range [0, ${O.byteLength}).`);if(F=c.byteLength-L,typeof T=="number"){if(F=T,!Number.isSafeInteger(F))throw new RangeError("'byteLength' must be an integer.");if(F<=0||L+F>O.byteLength)throw new RangeError(`'byteLength' is out of range (0, ${O.byteLength-L}].`);if(typeof C=="object"&&C!==null)E=C;else if(typeof C<"u")throw new TypeError("'options' must be an object.")}else if(typeof T<"u")throw new TypeError("'byteLength' must be a number.")}else if(typeof _<"u")throw new TypeError("'options' must be an object.");M=new Uint8Array(O,L,F)}else throw new TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");const R=(E.executionProviders||[]).map(O=>typeof O=="string"?O:O.name),G=await(await resolveBackend(R)).createSessionHandler(M,E);return new Nr(G)}startProfiling(){this.handler.startProfiling()}endProfiling(){this.handler.endProfiling()}get inputNames(){return this.handler.inputNames}get outputNames(){return this.handler.outputNames}};const InferenceSession$1=InferenceSession$2,lib=Object.freeze(Object.defineProperty({__proto__:null,InferenceSession:InferenceSession$1,Tensor:Tensor$1,env:env$2,registerBackend},Symbol.toStringTag,{value:"Module"})),require$$0=getAugmentedNamespace(lib);/*! * ONNX Runtime Web v1.14.0 * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */(function(module,exports){(function(x,c){module.exports=c(require$$0)})(self,__WEBPACK_EXTERNAL_MODULE__1670__=>(()=>{var __webpack_modules__={3474:(x,c,_)=>{var T,C=(T=(T=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(M){function E(){return de.buffer!=he&&He(de.buffer),we}function P(){return de.buffer!=he&&He(de.buffer),ye}function R(){return de.buffer!=he&&He(de.buffer),Me}function $(){return de.buffer!=he&&He(de.buffer),Pe}function G(){return de.buffer!=he&&He(de.buffer),Re}var O,L,F;M=M||{},O||(O=M!==void 0?M:{}),O.ready=new Promise(function(se,le){L=se,F=le});var V,W,z,Z,H,Y,U=Object.assign({},O),j="./this.program",X=(se,le)=>{throw le},K=typeof window=="object",q=typeof importScripts=="function",J=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",Q=O.ENVIRONMENT_IS_PTHREAD||!1,ee="";function re(se){return O.locateFile?O.locateFile(se,ee):ee+se}if(J){let se;ee=q?_(908).dirname(ee)+"/":"//",Y=()=>{H||(Z=_(1384),H=_(908))},V=function(le,fe){return Y(),le=H.normalize(le),Z.readFileSync(le,fe?void 0:"utf8")},z=le=>((le=V(le,!0)).buffer||(le=new Uint8Array(le)),le),W=(le,fe,ve)=>{Y(),le=H.normalize(le),Z.readFile(le,function(Se,Te){Se?ve(Se):fe(Te.buffer)})},1{if(bt())throw process.exitCode=le,fe;fe instanceof Dt||oe("exiting due to exception: "+fe),process.exit(le)},O.inspect=function(){return"[Emscripten Module object]"};try{se=_(9925)}catch(le){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),le}_.g.Worker=se.Worker}else(K||q)&&(q?ee=self.location.href:typeof document<"u"&&document.currentScript&&(ee=document.currentScript.src),T&&(ee=T),ee=ee.indexOf("blob:")!==0?ee.substr(0,ee.replace(/[?#].*/,"").lastIndexOf("/")+1):"",J||(V=se=>{var le=new XMLHttpRequest;return le.open("GET",se,!1),le.send(null),le.responseText},q&&(z=se=>{var le=new XMLHttpRequest;return le.open("GET",se,!1),le.responseType="arraybuffer",le.send(null),new Uint8Array(le.response)}),W=(se,le,fe)=>{var ve=new XMLHttpRequest;ve.open("GET",se,!0),ve.responseType="arraybuffer",ve.onload=()=>{ve.status==200||ve.status==0&&ve.response?le(ve.response):fe()},ve.onerror=fe,ve.send(null)}));J&&typeof performance>"u"&&(_.g.performance=_(6953).performance);var ie=console.log.bind(console),ae=console.warn.bind(console);J&&(Y(),ie=se=>Z.writeSync(1,se+` `),ae=se=>Z.writeSync(2,se+` `));var ne,te=O.print||ie,oe=O.printErr||ae;Object.assign(O,U),U=null,O.thisProgram&&(j=O.thisProgram),O.quit&&(X=O.quit),O.wasmBinary&&(ne=O.wasmBinary);var ue=O.noExitRuntime||!1;typeof WebAssembly!="object"&&qe("no native wasm support detected");var de,pe,he,we,ye,Me,Pe,Re,De=!1,Le=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function $e(se,le,fe){var ve=(le>>>=0)+fe;for(fe=le;se[fe]&&!(fe>=ve);)++fe;if(16(Se=(240&Se)==224?(15&Se)<<12|Te<<6|Fe:(7&Se)<<18|Te<<12|Fe<<6|63&se[le++])?ve+=String.fromCharCode(Se):(Se-=65536,ve+=String.fromCharCode(55296|Se>>10,56320|1023&Se))}}else ve+=String.fromCharCode(Se)}return ve}function Oe(se,le){return(se>>>=0)?$e(P(),se,le):""}function Ee(se,le,fe,ve){if(!(0>>=0;ve=fe+ve-1;for(var Te=0;Te=Fe&&(Fe=65536+((1023&Fe)<<10)|1023&se.charCodeAt(++Te)),127>=Fe){if(fe>=ve)break;le[fe++>>>0]=Fe}else{if(2047>=Fe){if(fe+1>=ve)break;le[fe++>>>0]=192|Fe>>6}else{if(65535>=Fe){if(fe+2>=ve)break;le[fe++>>>0]=224|Fe>>12}else{if(fe+3>=ve)break;le[fe++>>>0]=240|Fe>>18,le[fe++>>>0]=128|Fe>>12&63}le[fe++>>>0]=128|Fe>>6&63}le[fe++>>>0]=128|63&Fe}}return le[fe>>>0]=0,fe-Se}function Be(se){for(var le=0,fe=0;fe=ve?le++:2047>=ve?le+=2:55296<=ve&&57343>=ve?(le+=4,++fe):le+=3}return le}function He(se){he=se,O.HEAP8=we=new Int8Array(se),O.HEAP16=new Int16Array(se),O.HEAP32=Me=new Int32Array(se),O.HEAPU8=ye=new Uint8Array(se),O.HEAPU16=new Uint16Array(se),O.HEAPU32=Pe=new Uint32Array(se),O.HEAPF32=new Float32Array(se),O.HEAPF64=Re=new Float64Array(se)}Q&&(he=O.buffer);var We=O.INITIAL_MEMORY||16777216;if(Q)de=O.wasmMemory,he=O.buffer;else if(O.wasmMemory)de=O.wasmMemory;else if(!((de=new WebAssembly.Memory({initial:We/65536,maximum:65536,shared:!0})).buffer instanceof SharedArrayBuffer))throw oe("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),J&&console.log("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)"),Error("bad memory");de&&(he=de.buffer),We=he.byteLength,He(he);var Ke,Je=[],tt=[],mt=[],pt=[];function bt(){return ue||!1}function gt(){var se=O.preRun.shift();Je.unshift(se)}var ct,yt=0,At=null;function qe(se){throw Q?postMessage({cmd:"onAbort",arg:se}):O.onAbort&&O.onAbort(se),oe(se="Aborted("+se+")"),De=!0,se=new WebAssembly.RuntimeError(se+". Build with -sASSERTIONS for more info."),F(se),se}function Bt(){return ct.startsWith("data:application/octet-stream;base64,")}function xt(){var se=ct;try{if(se==ct&&ne)return new Uint8Array(ne);if(z)return z(se);throw"both async and sync fetching of the wasm failed"}catch(le){qe(le)}}ct="ort-wasm-threaded.wasm",Bt()||(ct=re(ct));var Mt={};function Dt(se){this.name="ExitStatus",this.message="Program terminated with exit("+se+")",this.status=se}function Ot(se){(se=Ye.Vb[se])||qe(),Ye.mc(se)}function _t(se){var le=Ye.Cc();if(!le)return 6;Ye.ac.push(le),Ye.Vb[se.Ub]=le,le.Ub=se.Ub;var fe={cmd:"run",start_routine:se.Ic,arg:se.zc,pthread_ptr:se.Ub};return le.$b=()=>{fe.time=performance.now(),le.postMessage(fe,se.Nc)},le.loaded&&(le.$b(),delete le.$b),0}function ft(se){if(Q)return Ze(1,1,se);bt()||(Ye.oc(),O.onExit&&O.onExit(se),De=!0),X(se,new Dt(se))}function Gt(se,le){if(!le&&Q)throw St(se),"unwind";bt()||Q||(br(),Pt(mt),_r(0),ur[1].length&&cr(1,10),ur[2].length&&cr(2,10),Ye.oc()),ft(se)}var Ye={Yb:[],ac:[],qc:[],Vb:{},fc:function(){Q&&Ye.Ec()},Pc:function(){},Ec:function(){Ye.receiveObjectTransfer=Ye.Gc,Ye.threadInitTLS=Ye.pc,Ye.setExitStatus=Ye.nc,ue=!1},nc:function(){},oc:function(){for(var se of Object.values(Ye.Vb))Ye.mc(se);for(se of Ye.Yb)se.terminate();Ye.Yb=[]},mc:function(se){var le=se.Ub;delete Ye.Vb[le],Ye.Yb.push(se),Ye.ac.splice(Ye.ac.indexOf(se),1),se.Ub=0,hr(le)},Gc:function(){},pc:function(){Ye.qc.forEach(se=>se())},Fc:function(se,le){se.onmessage=fe=>{var ve=(fe=fe.data).cmd;if(se.Ub&&(Ye.Bc=se.Ub),fe.targetThread&&fe.targetThread!=or()){var Se=Ye.Vb[fe.Qc];Se?Se.postMessage(fe,fe.transferList):oe('Internal error! Worker sent a message "'+ve+'" to target pthread '+fe.targetThread+", but that thread no longer exists!")}else ve==="processProxyingQueue"?me(fe.queue):ve==="spawnThread"?_t(fe):ve==="cleanupThread"?Ot(fe.thread):ve==="killThread"?(fe=fe.thread,ve=Ye.Vb[fe],delete Ye.Vb[fe],ve.terminate(),hr(fe),Ye.ac.splice(Ye.ac.indexOf(ve),1),ve.Ub=0):ve==="cancelThread"?Ye.Vb[fe.thread].postMessage({cmd:"cancel"}):ve==="loaded"?(se.loaded=!0,le&&le(se),se.$b&&(se.$b(),delete se.$b)):ve==="print"?te("Thread "+fe.threadId+": "+fe.text):ve==="printErr"?oe("Thread "+fe.threadId+": "+fe.text):ve==="alert"?alert("Thread "+fe.threadId+": "+fe.text):fe.target==="setimmediate"?se.postMessage(fe):ve==="onAbort"?O.onAbort&&O.onAbort(fe.arg):ve&&oe("worker sent an unknown command "+ve);Ye.Bc=void 0},se.onerror=fe=>{throw oe("worker sent an error! "+fe.filename+":"+fe.lineno+": "+fe.message),fe},J&&(se.on("message",function(fe){se.onmessage({data:fe})}),se.on("error",function(fe){se.onerror(fe)}),se.on("detachedExit",function(){})),se.postMessage({cmd:"load",urlOrBlob:O.mainScriptUrlOrBlob||T,wasmMemory:de,wasmModule:pe})},yc:function(){var se=re("ort-wasm-threaded.worker.js");Ye.Yb.push(new Worker(se))},Cc:function(){return Ye.Yb.length==0&&(Ye.yc(),Ye.Fc(Ye.Yb[0])),Ye.Yb.pop()}};function Pt(se){for(;0>2>>>0];se=R()[se+48>>2>>>0],Ir(le,le-se),at(le)};var Ge=[];function ze(se){var le=Ge[se];return le||(se>=Ge.length&&(Ge.length=se+1),Ge[se]=le=Ke.get(se)),le}O.invokeEntryPoint=function(se,le){se=ze(se)(le),bt()?Ye.nc(se):Tr(se)};var kt,Nt,$t=[],et=0,Xe=0;function Qe(se){this.Zb=se,this.Sb=se-24,this.xc=function(le){$()[this.Sb+4>>2>>>0]=le},this.bc=function(){return $()[this.Sb+4>>2>>>0]},this.wc=function(le){$()[this.Sb+8>>2>>>0]=le},this.Dc=function(){return $()[this.Sb+8>>2>>>0]},this.rc=function(){R()[this.Sb>>2>>>0]=0},this.hc=function(le){le=le?1:0,E()[this.Sb+12>>0>>>0]=le},this.uc=function(){return E()[this.Sb+12>>0>>>0]!=0},this.ic=function(le){le=le?1:0,E()[this.Sb+13>>0>>>0]=le},this.kc=function(){return E()[this.Sb+13>>0>>>0]!=0},this.fc=function(le,fe){this.cc(0),this.xc(le),this.wc(fe),this.rc(),this.hc(!1),this.ic(!1)},this.sc=function(){Atomics.add(R(),this.Sb>>2,1)},this.Hc=function(){return Atomics.sub(R(),this.Sb>>2,1)===1},this.cc=function(le){$()[this.Sb+16>>2>>>0]=le},this.tc=function(){return $()[this.Sb+16>>2>>>0]},this.vc=function(){if(Ar(this.bc()))return $()[this.Zb>>2>>>0];var le=this.tc();return le!==0?le:this.Zb}}function Jt(se){return yr(new Qe(se).Sb)}function Rt(se,le,fe,ve){return Q?Ze(3,1,se,le,fe,ve):qt(se,le,fe,ve)}function qt(se,le,fe,ve){if(typeof SharedArrayBuffer>"u")return oe("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var Se=[];return Q&&Se.length===0?Rt(se,le,fe,ve):(se={Ic:fe,Ub:se,zc:ve,Nc:Se},Q?(se.Oc="spawnThread",postMessage(se,Se),0):_t(se))}function Qt(se,le,fe){return Q?Ze(4,1,se,le,fe):0}function Ft(se,le){if(Q)return Ze(5,1,se,le)}function er(se,le){if(Q)return Ze(6,1,se,le)}function Tt(se,le,fe){if(Q)return Ze(7,1,se,le,fe)}function be(se,le,fe){return Q?Ze(8,1,se,le,fe):0}function Ve(se,le){if(Q)return Ze(9,1,se,le)}function Yt(se,le,fe){if(Q)return Ze(10,1,se,le,fe)}function Ut(se,le,fe,ve){if(Q)return Ze(11,1,se,le,fe,ve)}function jt(se,le,fe,ve){if(Q)return Ze(12,1,se,le,fe,ve)}function nr(se,le,fe,ve){if(Q)return Ze(13,1,se,le,fe,ve)}function ar(se){if(Q)return Ze(14,1,se)}function ce(se,le){if(Q)return Ze(15,1,se,le)}function ge(se,le,fe){if(Q)return Ze(16,1,se,le,fe)}function me(se){Atomics.store(R(),se>>2,1),or()&&xr(se),Atomics.compareExchange(R(),se>>2,1,0)}function _e(se){return $()[se>>>2]+4294967296*R()[se+4>>>2]}function xe(se,le,fe,ve,Se,Te){return Q?Ze(17,1,se,le,fe,ve,Se,Te):-52}function Ce(se,le,fe,ve,Se,Te){if(Q)return Ze(18,1,se,le,fe,ve,Se,Te)}function Ne(se){var le=Be(se)+1,fe=dr(le);return fe&&Ee(se,E(),fe,le),fe}function Ue(se,le,fe){function ve(ut){return(ut=ut.toTimeString().match(/\(([A-Za-z ]+)\)$/))?ut[1]:"GMT"}if(Q)return Ze(19,1,se,le,fe);var Se=new Date().getFullYear(),Te=new Date(Se,0,1),Fe=new Date(Se,6,1);Se=Te.getTimezoneOffset();var je=Fe.getTimezoneOffset(),st=Math.max(Se,je);R()[se>>2>>>0]=60*st,R()[le>>2>>>0]=Number(Se!=je),se=ve(Te),le=ve(Fe),se=Ne(se),le=Ne(le),je>2>>>0]=se,$()[fe+4>>2>>>0]=le):($()[fe>>2>>>0]=le,$()[fe+4>>2>>>0]=se)}function Ze(se,le){var fe=arguments.length-2,ve=arguments;return Wt(()=>{for(var Se=fr(8*fe),Te=Se>>3,Fe=0;Fe>>0]=je}return wr(se,fe,Se,le)})}O.executeNotifiedProxyingQueue=me,Nt=J?()=>{var se=process.hrtime();return 1e3*se[0]+se[1]/1e6}:Q?()=>performance.now()-O.__performance_now_clock_drift:()=>performance.now();var nt,vt=[],Lt={};function Et(){if(!nt){var se,le={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:j||"./this.program"};for(se in Lt)Lt[se]===void 0?delete le[se]:le[se]=Lt[se];var fe=[];for(se in le)fe.push(se+"="+le[se]);nt=fe}return nt}function Ie(se,le){if(Q)return Ze(20,1,se,le);var fe=0;return Et().forEach(function(ve,Se){var Te=le+fe;for(Se=$()[se+4*Se>>2>>>0]=Te,Te=0;Te>0>>>0]=ve.charCodeAt(Te);E()[Se>>0>>>0]=0,fe+=ve.length+1}),0}function dt(se,le){if(Q)return Ze(21,1,se,le);var fe=Et();$()[se>>2>>>0]=fe.length;var ve=0;return fe.forEach(function(Se){ve+=Se.length+1}),$()[le>>2>>>0]=ve,0}function wt(se){return Q?Ze(22,1,se):52}function zt(se,le,fe,ve){return Q?Ze(23,1,se,le,fe,ve):52}function Xt(se,le,fe,ve,Se){return Q?Ze(24,1,se,le,fe,ve,Se):70}var ur=[null,[],[]];function cr(se,le){var fe=ur[se];le===0||le===10?((se===1?te:oe)($e(fe,0)),fe.length=0):fe.push(le)}function pr(se,le,fe,ve){if(Q)return Ze(25,1,se,le,fe,ve);for(var Se=0,Te=0;Te>2>>>0],je=$()[le+4>>2>>>0];le+=8;for(var st=0;st>>0]);Se+=je}return $()[ve>>2>>>0]=Se,0}var Vt=0;function ir(se){return se%4==0&&(se%100!=0||se%400==0)}var gr=[31,29,31,30,31,30,31,31,30,31,30,31],vr=[31,28,31,30,31,30,31,31,30,31,30,31];function mr(se,le,fe,ve){function Se(Ae,ht,It){for(Ae=typeof Ae=="number"?Ae.toString():Ae||"";Ae.lengthrr?-1:0Kt-Ae.getDate())){Ae.setDate(Ae.getDate()+ht);break}ht-=Kt-Ae.getDate()+1,Ae.setDate(1),11>It?Ae.setMonth(It+1):(Ae.setMonth(0),Ae.setFullYear(Ae.getFullYear()+1))}return It=new Date(Ae.getFullYear()+1,0,4),ht=je(new Date(Ae.getFullYear(),0,4)),It=je(It),0>=Fe(ht,Ae)?0>=Fe(It,Ae)?Ae.getFullYear()+1:Ae.getFullYear():Ae.getFullYear()-1}var ut=R()[ve+40>>2>>>0];for(var Ct in ve={Lc:R()[ve>>2>>>0],Kc:R()[ve+4>>2>>>0],dc:R()[ve+8>>2>>>0],jc:R()[ve+12>>2>>>0],ec:R()[ve+16>>2>>>0],Xb:R()[ve+20>>2>>>0],Tb:R()[ve+24>>2>>>0],Wb:R()[ve+28>>2>>>0],Rc:R()[ve+32>>2>>>0],Jc:R()[ve+36>>2>>>0],Mc:ut?Oe(ut):""},fe=Oe(fe),ut={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})fe=fe.replace(new RegExp(Ct,"g"),ut[Ct]);var Ht="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),Zt="January February March April May June July August September October November December".split(" ");for(Ct in ut={"%a":function(Ae){return Ht[Ae.Tb].substring(0,3)},"%A":function(Ae){return Ht[Ae.Tb]},"%b":function(Ae){return Zt[Ae.ec].substring(0,3)},"%B":function(Ae){return Zt[Ae.ec]},"%C":function(Ae){return Te((Ae.Xb+1900)/100|0,2)},"%d":function(Ae){return Te(Ae.jc,2)},"%e":function(Ae){return Se(Ae.jc,2," ")},"%g":function(Ae){return st(Ae).toString().substring(2)},"%G":function(Ae){return st(Ae)},"%H":function(Ae){return Te(Ae.dc,2)},"%I":function(Ae){return(Ae=Ae.dc)==0?Ae=12:12Ae.dc?"AM":"PM"},"%S":function(Ae){return Te(Ae.Lc,2)},"%t":function(){return" "},"%u":function(Ae){return Ae.Tb||7},"%U":function(Ae){return Te(Math.floor((Ae.Wb+7-Ae.Tb)/7),2)},"%V":function(Ae){var ht=Math.floor((Ae.Wb+7-(Ae.Tb+6)%7)/7);if(2>=(Ae.Tb+371-Ae.Wb-2)%7&&ht++,ht)ht==53&&((It=(Ae.Tb+371-Ae.Wb)%7)==4||It==3&&ir(Ae.Xb)||(ht=1));else{ht=52;var It=(Ae.Tb+7-Ae.Wb-1)%7;(It==4||It==5&&ir(Ae.Xb%400-1))&&ht++}return Te(ht,2)},"%w":function(Ae){return Ae.Tb},"%W":function(Ae){return Te(Math.floor((Ae.Wb+7-(Ae.Tb+6)%7)/7),2)},"%y":function(Ae){return(Ae.Xb+1900).toString().substring(2)},"%Y":function(Ae){return Ae.Xb+1900},"%z":function(Ae){var ht=0<=(Ae=Ae.Jc);return Ae=Math.abs(Ae)/60,(ht?"+":"-")+String("0000"+(Ae/60*100+Ae%60)).slice(-4)},"%Z":function(Ae){return Ae.Mc},"%%":function(){return"%"}},fe=fe.replace(/%%/g,"\0\0"),ut)fe.includes(Ct)&&(fe=fe.replace(new RegExp(Ct,"g"),ut[Ct](ve)));return Ct=function(Ae){var ht=Array(Be(Ae)+1);return Ee(Ae,ht,0,ht.length),ht}(fe=fe.replace(/\0\0/g,"%")),Ct.length>le?0:(function(Ae,ht){E().set(Ae,ht>>>0)}(Ct,se),Ct.length-1)}Ye.fc();var Fr=[null,ft,St,Rt,Qt,Ft,er,Tt,be,Ve,Yt,Ut,jt,nr,ar,ce,ge,xe,Ce,Ue,Ie,dt,wt,zt,Xt,pr],Vr={b:function(se){return dr(se+24)+24},n:function(se){return(se=new Qe(se)).uc()||(se.hc(!0),et--),se.ic(!1),$t.push(se),se.sc(),se.vc()},ma:function(se){throw oe("Unexpected exception thrown, this is not properly supported - aborting"),De=!0,se},x:function(){ot(0);var se=$t.pop();if(se.Hc()&&!se.kc()){var le=se.Dc();le&&ze(le)(se.Zb),Jt(se.Zb)}Xe=0},e:function(){var se=Xe;if(!se)return Vt=0;var le=new Qe(se);le.cc(se);var fe=le.bc();if(!fe)return Vt=0,se;for(var ve=Array.prototype.slice.call(arguments),Se=0;Seme(ve));else if(Q)postMessage({targetThread:se,cmd:"processProxyingQueue",queue:ve});else{if(!(se=Ye.Vb[se]))return;se.postMessage({cmd:"processProxyingQueue",queue:ve})}return 1},Ea:function(){return-1},Pa:function(se,le){se=new Date(1e3*_e(se)),R()[le>>2>>>0]=se.getUTCSeconds(),R()[le+4>>2>>>0]=se.getUTCMinutes(),R()[le+8>>2>>>0]=se.getUTCHours(),R()[le+12>>2>>>0]=se.getUTCDate(),R()[le+16>>2>>>0]=se.getUTCMonth(),R()[le+20>>2>>>0]=se.getUTCFullYear()-1900,R()[le+24>>2>>>0]=se.getUTCDay(),se=(se.getTime()-Date.UTC(se.getUTCFullYear(),0,1,0,0,0,0))/864e5|0,R()[le+28>>2>>>0]=se},Qa:function(se,le){se=new Date(1e3*_e(se)),R()[le>>2>>>0]=se.getSeconds(),R()[le+4>>2>>>0]=se.getMinutes(),R()[le+8>>2>>>0]=se.getHours(),R()[le+12>>2>>>0]=se.getDate(),R()[le+16>>2>>>0]=se.getMonth(),R()[le+20>>2>>>0]=se.getFullYear()-1900,R()[le+24>>2>>>0]=se.getDay();var fe=new Date(se.getFullYear(),0,1),ve=(se.getTime()-fe.getTime())/864e5|0;R()[le+28>>2>>>0]=ve,R()[le+36>>2>>>0]=-60*se.getTimezoneOffset(),ve=new Date(se.getFullYear(),6,1).getTimezoneOffset(),se=0|(ve!=(fe=fe.getTimezoneOffset())&&se.getTimezoneOffset()==Math.min(fe,ve)),R()[le+32>>2>>>0]=se},Ra:function(se){var le=new Date(R()[se+20>>2>>>0]+1900,R()[se+16>>2>>>0],R()[se+12>>2>>>0],R()[se+8>>2>>>0],R()[se+4>>2>>>0],R()[se>>2>>>0],0),fe=R()[se+32>>2>>>0],ve=le.getTimezoneOffset(),Se=new Date(le.getFullYear(),0,1),Te=new Date(le.getFullYear(),6,1).getTimezoneOffset(),Fe=Se.getTimezoneOffset(),je=Math.min(Fe,Te);return 0>fe?R()[se+32>>2>>>0]=Number(Te!=Fe&&je==ve):0>2>>>0]=le.getDay(),fe=(le.getTime()-Se.getTime())/864e5|0,R()[se+28>>2>>>0]=fe,R()[se>>2>>>0]=le.getSeconds(),R()[se+4>>2>>>0]=le.getMinutes(),R()[se+8>>2>>>0]=le.getHours(),R()[se+12>>2>>>0]=le.getDate(),R()[se+16>>2>>>0]=le.getMonth(),le.getTime()/1e3|0},Aa:xe,Ba:Ce,Sa:function se(le,fe,ve){se.Ac||(se.Ac=!0,Ue(le,fe,ve))},y:function(){qe("")},U:function(){if(!J&&!q){var se="Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread";kt||(kt={}),kt[se]||(kt[se]=1,J&&(se="warning: "+se),oe(se))}},ra:function(){return 4294901760},B:Nt,Ia:function(se,le,fe){P().copyWithin(se>>>0,le>>>0,le+fe>>>0)},F:function(){return J?_(3993).cpus().length:navigator.hardwareConcurrency},Da:function(se,le,fe){vt.length=le,fe>>=3;for(var ve=0;ve>>0];return(0>se?Mt[-se-1]:Fr[se]).apply(null,vt)},qa:function(se){var le=P().length;if((se>>>=0)<=le||4294901760=fe;fe*=2){var ve=le*(1+.2/fe);ve=Math.min(ve,se+100663296);var Se=Math;ve=Math.max(se,ve),Se=Se.min.call(Se,4294901760,ve+(65536-ve%65536)%65536);e:{try{de.grow(Se-he.byteLength+65535>>>16),He(de.buffer);var Te=1;break e}catch{}Te=void 0}if(Te)return!0}return!1},Na:function(){throw"unwind"},Ga:Ie,Ha:dt,J:Gt,I:wt,S:zt,ga:Xt,R:pr,d:function(){return Vt},na:function se(le,fe){se.lc||(se.lc=function(){if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function"){var Se=new Uint8Array(1);return()=>(crypto.getRandomValues(Se),Se[0])}if(J)try{var Te=_(Object(function(){var Fe=new Error("Cannot find module 'crypto'");throw Fe.code="MODULE_NOT_FOUND",Fe}()));return()=>Te.randomBytes(1)[0]}catch{}return()=>qe("randomDevice")}());for(var ve=0;ve>0>>>0]=se.lc();return 0},ia:function(se,le,fe){var ve=it();try{return ze(se)(le,fe)}catch(Se){if(at(ve),Se!==Se+0)throw Se;ot(1,0)}},ja:function(se,le,fe){var ve=it();try{return ze(se)(le,fe)}catch(Se){if(at(ve),Se!==Se+0)throw Se;ot(1,0)}},K:function(se){var le=it();try{return ze(se)()}catch(fe){if(at(le),fe!==fe+0)throw fe;ot(1,0)}},f:function(se,le){var fe=it();try{return ze(se)(le)}catch(ve){if(at(fe),ve!==ve+0)throw ve;ot(1,0)}},P:function(se,le,fe){var ve=it();try{return ze(se)(le,fe)}catch(Se){if(at(ve),Se!==Se+0)throw Se;ot(1,0)}},Q:function(se,le,fe){var ve=it();try{return ze(se)(le,fe)}catch(Se){if(at(ve),Se!==Se+0)throw Se;ot(1,0)}},k:function(se,le,fe){var ve=it();try{return ze(se)(le,fe)}catch(Se){if(at(ve),Se!==Se+0)throw Se;ot(1,0)}},p:function(se,le,fe,ve){var Se=it();try{return ze(se)(le,fe,ve)}catch(Te){if(at(Se),Te!==Te+0)throw Te;ot(1,0)}},q:function(se,le,fe,ve,Se){var Te=it();try{return ze(se)(le,fe,ve,Se)}catch(Fe){if(at(Te),Fe!==Fe+0)throw Fe;ot(1,0)}},N:function(se,le,fe,ve,Se,Te){var Fe=it();try{return ze(se)(le,fe,ve,Se,Te)}catch(je){if(at(Fe),je!==je+0)throw je;ot(1,0)}},s:function(se,le,fe,ve,Se,Te){var Fe=it();try{return ze(se)(le,fe,ve,Se,Te)}catch(je){if(at(Fe),je!==je+0)throw je;ot(1,0)}},w:function(se,le,fe,ve,Se,Te,Fe){var je=it();try{return ze(se)(le,fe,ve,Se,Te,Fe)}catch(st){if(at(je),st!==st+0)throw st;ot(1,0)}},L:function(se,le,fe,ve,Se,Te,Fe,je){var st=it();try{return ze(se)(le,fe,ve,Se,Te,Fe,je)}catch(ut){if(at(st),ut!==ut+0)throw ut;ot(1,0)}},E:function(se,le,fe,ve,Se,Te,Fe,je,st,ut,Ct,Ht){var Zt=it();try{return ze(se)(le,fe,ve,Se,Te,Fe,je,st,ut,Ct,Ht)}catch(Ae){if(at(Zt),Ae!==Ae+0)throw Ae;ot(1,0)}},aa:function(se,le,fe,ve,Se,Te,Fe,je){var st=it();try{return Rr(se,le,fe,ve,Se,Te,Fe,je)}catch(ut){if(at(st),ut!==ut+0)throw ut;ot(1,0)}},_:function(se,le,fe,ve,Se,Te,Fe){var je=it();try{return Mr(se,le,fe,ve,Se,Te,Fe)}catch(st){if(at(je),st!==st+0)throw st;ot(1,0)}},Z:function(se,le,fe,ve,Se){var Te=it();try{return $r(se,le,fe,ve,Se)}catch(Fe){if(at(Te),Fe!==Fe+0)throw Fe;ot(1,0)}},ca:function(se,le,fe,ve){var Se=it();try{return Dr(se,le,fe,ve)}catch(Te){if(at(Se),Te!==Te+0)throw Te;ot(1,0)}},$:function(se){var le=it();try{return Cr(se)}catch(fe){if(at(le),fe!==fe+0)throw fe;ot(1,0)}},ba:function(se,le){var fe=it();try{return Or(se,le)}catch(ve){if(at(fe),ve!==ve+0)throw ve;ot(1,0)}},Y:function(se,le,fe){var ve=it();try{return Er(se,le,fe)}catch(Se){if(at(ve),Se!==Se+0)throw Se;ot(1,0)}},g:function(se){var le=it();try{ze(se)()}catch(fe){if(at(le),fe!==fe+0)throw fe;ot(1,0)}},r:function(se,le){var fe=it();try{ze(se)(le)}catch(ve){if(at(fe),ve!==ve+0)throw ve;ot(1,0)}},i:function(se,le,fe){var ve=it();try{ze(se)(le,fe)}catch(Se){if(at(ve),Se!==Se+0)throw Se;ot(1,0)}},ha:function(se,le,fe,ve){var Se=it();try{ze(se)(le,fe,ve)}catch(Te){if(at(Se),Te!==Te+0)throw Te;ot(1,0)}},m:function(se,le,fe,ve){var Se=it();try{ze(se)(le,fe,ve)}catch(Te){if(at(Se),Te!==Te+0)throw Te;ot(1,0)}},v:function(se,le,fe,ve,Se){var Te=it();try{ze(se)(le,fe,ve,Se)}catch(Fe){if(at(Te),Fe!==Fe+0)throw Fe;ot(1,0)}},u:function(se,le,fe,ve,Se,Te){var Fe=it();try{ze(se)(le,fe,ve,Se,Te)}catch(je){if(at(Fe),je!==je+0)throw je;ot(1,0)}},O:function(se,le,fe,ve,Se,Te,Fe){var je=it();try{ze(se)(le,fe,ve,Se,Te,Fe)}catch(st){if(at(je),st!==st+0)throw st;ot(1,0)}},A:function(se,le,fe,ve,Se,Te,Fe,je){var st=it();try{ze(se)(le,fe,ve,Se,Te,Fe,je)}catch(ut){if(at(st),ut!==ut+0)throw ut;ot(1,0)}},ka:function(se,le,fe,ve,Se,Te,Fe,je,st){var ut=it();try{ze(se)(le,fe,ve,Se,Te,Fe,je,st)}catch(Ct){if(at(ut),Ct!==Ct+0)throw Ct;ot(1,0)}},C:function(se,le,fe,ve,Se,Te,Fe,je,st,ut,Ct){var Ht=it();try{ze(se)(le,fe,ve,Se,Te,Fe,je,st,ut,Ct)}catch(Zt){if(at(Ht),Zt!==Zt+0)throw Zt;ot(1,0)}},D:function(se,le,fe,ve,Se,Te,Fe,je,st,ut,Ct,Ht,Zt,Ae,ht,It){var Kt=it();try{ze(se)(le,fe,ve,Se,Te,Fe,je,st,ut,Ct,Ht,Zt,Ae,ht,It)}catch(rr){if(at(Kt),rr!==rr+0)throw rr;ot(1,0)}},fa:function(se,le,fe,ve,Se,Te,Fe,je){var st=it();try{Pr(se,le,fe,ve,Se,Te,Fe,je)}catch(ut){if(at(st),ut!==ut+0)throw ut;ot(1,0)}},da:function(se,le,fe,ve,Se,Te,Fe,je,st,ut,Ct,Ht){var Zt=it();try{kr(se,le,fe,ve,Se,Te,Fe,je,st,ut,Ct,Ht)}catch(Ae){if(at(Zt),Ae!==Ae+0)throw Ae;ot(1,0)}},ea:function(se,le,fe,ve,Se,Te){var Fe=it();try{Lr(se,le,fe,ve,Se,Te)}catch(je){if(at(Fe),je!==je+0)throw je;ot(1,0)}},o:function(se){return se},a:de||O.wasmMemory,G:function(se){Vt=se},la:mr,z:function(se,le,fe,ve){return mr(se,le,fe,ve)}};(function(){function se(Se,Te){O.asm=Se.exports,Ye.qc.push(O.asm.sb),Ke=O.asm.ub,tt.unshift(O.asm.Va),pe=Te,Q||(yt--,O.monitorRunDependencies&&O.monitorRunDependencies(yt),yt==0&&At&&(Se=At,At=null,Se()))}function le(Se){se(Se.instance,Se.module)}function fe(Se){return function(){if(!ne&&(K||q)){if(typeof fetch=="function"&&!ct.startsWith("file://"))return fetch(ct,{credentials:"same-origin"}).then(function(Te){if(!Te.ok)throw"failed to load wasm binary file at '"+ct+"'";return Te.arrayBuffer()}).catch(function(){return xt()});if(W)return new Promise(function(Te,Fe){W(ct,function(je){Te(new Uint8Array(je))},Fe)})}return Promise.resolve().then(function(){return xt()})}().then(function(Te){return WebAssembly.instantiate(Te,ve)}).then(function(Te){return Te}).then(Se,function(Te){oe("failed to asynchronously prepare wasm: "+Te),qe(Te)})}var ve={a:Vr};if(Q||(yt++,O.monitorRunDependencies&&O.monitorRunDependencies(yt)),O.instantiateWasm)try{return O.instantiateWasm(ve,se)}catch(Se){return oe("Module.instantiateWasm callback failed with error: "+Se),!1}(ne||typeof WebAssembly.instantiateStreaming!="function"||Bt()||ct.startsWith("file://")||J||typeof fetch!="function"?fe(le):fetch(ct,{credentials:"same-origin"}).then(function(Se){return WebAssembly.instantiateStreaming(Se,ve).then(le,function(Te){return oe("wasm streaming compile failed: "+Te),oe("falling back to ArrayBuffer instantiation"),fe(le)})})).catch(F)})(),O.___wasm_call_ctors=function(){return(O.___wasm_call_ctors=O.asm.Va).apply(null,arguments)},O._OrtInit=function(){return(O._OrtInit=O.asm.Wa).apply(null,arguments)},O._OrtCreateSessionOptions=function(){return(O._OrtCreateSessionOptions=O.asm.Xa).apply(null,arguments)},O._OrtAppendExecutionProvider=function(){return(O._OrtAppendExecutionProvider=O.asm.Ya).apply(null,arguments)},O._OrtAddSessionConfigEntry=function(){return(O._OrtAddSessionConfigEntry=O.asm.Za).apply(null,arguments)},O._OrtReleaseSessionOptions=function(){return(O._OrtReleaseSessionOptions=O.asm._a).apply(null,arguments)},O._OrtCreateSession=function(){return(O._OrtCreateSession=O.asm.$a).apply(null,arguments)},O._OrtReleaseSession=function(){return(O._OrtReleaseSession=O.asm.ab).apply(null,arguments)},O._OrtGetInputCount=function(){return(O._OrtGetInputCount=O.asm.bb).apply(null,arguments)},O._OrtGetOutputCount=function(){return(O._OrtGetOutputCount=O.asm.cb).apply(null,arguments)},O._OrtGetInputName=function(){return(O._OrtGetInputName=O.asm.db).apply(null,arguments)},O._OrtGetOutputName=function(){return(O._OrtGetOutputName=O.asm.eb).apply(null,arguments)},O._OrtFree=function(){return(O._OrtFree=O.asm.fb).apply(null,arguments)},O._OrtCreateTensor=function(){return(O._OrtCreateTensor=O.asm.gb).apply(null,arguments)},O._OrtGetTensorData=function(){return(O._OrtGetTensorData=O.asm.hb).apply(null,arguments)},O._OrtReleaseTensor=function(){return(O._OrtReleaseTensor=O.asm.ib).apply(null,arguments)},O._OrtCreateRunOptions=function(){return(O._OrtCreateRunOptions=O.asm.jb).apply(null,arguments)},O._OrtAddRunConfigEntry=function(){return(O._OrtAddRunConfigEntry=O.asm.kb).apply(null,arguments)},O._OrtReleaseRunOptions=function(){return(O._OrtReleaseRunOptions=O.asm.lb).apply(null,arguments)},O._OrtRun=function(){return(O._OrtRun=O.asm.mb).apply(null,arguments)},O._OrtEndProfiling=function(){return(O._OrtEndProfiling=O.asm.nb).apply(null,arguments)};var or=O._pthread_self=function(){return(or=O._pthread_self=O.asm.ob).apply(null,arguments)},dr=O._malloc=function(){return(dr=O._malloc=O.asm.pb).apply(null,arguments)},yr=O._free=function(){return(yr=O._free=O.asm.qb).apply(null,arguments)},_r=O._fflush=function(){return(_r=O._fflush=O.asm.rb).apply(null,arguments)};O.__emscripten_tls_init=function(){return(O.__emscripten_tls_init=O.asm.sb).apply(null,arguments)};var br=O.___funcs_on_exit=function(){return(br=O.___funcs_on_exit=O.asm.tb).apply(null,arguments)},Sr=O.__emscripten_thread_init=function(){return(Sr=O.__emscripten_thread_init=O.asm.vb).apply(null,arguments)};O.__emscripten_thread_crashed=function(){return(O.__emscripten_thread_crashed=O.asm.wb).apply(null,arguments)};var sr,wr=O._emscripten_run_in_main_runtime_thread_js=function(){return(wr=O._emscripten_run_in_main_runtime_thread_js=O.asm.xb).apply(null,arguments)},xr=O.__emscripten_proxy_execute_task_queue=function(){return(xr=O.__emscripten_proxy_execute_task_queue=O.asm.yb).apply(null,arguments)},hr=O.__emscripten_thread_free_data=function(){return(hr=O.__emscripten_thread_free_data=O.asm.zb).apply(null,arguments)},Tr=O.__emscripten_thread_exit=function(){return(Tr=O.__emscripten_thread_exit=O.asm.Ab).apply(null,arguments)},ot=O._setThrew=function(){return(ot=O._setThrew=O.asm.Bb).apply(null,arguments)},Ir=O._emscripten_stack_set_limits=function(){return(Ir=O._emscripten_stack_set_limits=O.asm.Cb).apply(null,arguments)},it=O.stackSave=function(){return(it=O.stackSave=O.asm.Db).apply(null,arguments)},at=O.stackRestore=function(){return(at=O.stackRestore=O.asm.Eb).apply(null,arguments)},fr=O.stackAlloc=function(){return(fr=O.stackAlloc=O.asm.Fb).apply(null,arguments)},lr=O.___cxa_can_catch=function(){return(lr=O.___cxa_can_catch=O.asm.Gb).apply(null,arguments)},Ar=O.___cxa_is_pointer_type=function(){return(Ar=O.___cxa_is_pointer_type=O.asm.Hb).apply(null,arguments)},Cr=O.dynCall_j=function(){return(Cr=O.dynCall_j=O.asm.Ib).apply(null,arguments)},Mr=O.dynCall_iiiiij=function(){return(Mr=O.dynCall_iiiiij=O.asm.Jb).apply(null,arguments)},Er=O.dynCall_jii=function(){return(Er=O.dynCall_jii=O.asm.Kb).apply(null,arguments)},Pr=O.dynCall_viiiiij=function(){return(Pr=O.dynCall_viiiiij=O.asm.Lb).apply(null,arguments)},Lr=O.dynCall_vjji=function(){return(Lr=O.dynCall_vjji=O.asm.Mb).apply(null,arguments)},kr=O.dynCall_viiijjjii=function(){return(kr=O.dynCall_viiijjjii=O.asm.Nb).apply(null,arguments)},Dr=O.dynCall_iij=function(){return(Dr=O.dynCall_iij=O.asm.Ob).apply(null,arguments)},Or=O.dynCall_ji=function(){return(Or=O.dynCall_ji=O.asm.Pb).apply(null,arguments)},Rr=O.dynCall_iiiiiij=function(){return(Rr=O.dynCall_iiiiiij=O.asm.Qb).apply(null,arguments)},$r=O.dynCall_iiij=function(){return($r=O.dynCall_iiij=O.asm.Rb).apply(null,arguments)};function Br(){function se(){if(!sr&&(sr=!0,O.calledRun=!0,!De)&&(Q||Pt(tt),L(O),O.onRuntimeInitialized&&O.onRuntimeInitialized(),!Q)){if(O.postRun)for(typeof O.postRun=="function"&&(O.postRun=[O.postRun]);O.postRun.length;){var le=O.postRun.shift();pt.unshift(le)}Pt(pt)}}if(!(0{var T,C=(T=(T=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(M){var E,P,R;M=M||{},E||(E=M!==void 0?M:{}),E.ready=new Promise(function(ce,ge){P=ce,R=ge});var $,G,O,L,F,V,W=Object.assign({},E),z="./this.program",Z=(ce,ge)=>{throw ge},H=typeof window=="object",Y=typeof importScripts=="function",U=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",j="";U?(j=Y?_(908).dirname(j)+"/":"//",V=()=>{F||(L=_(1384),F=_(908))},$=function(ce,ge){return V(),ce=F.normalize(ce),L.readFileSync(ce,ge?void 0:"utf8")},O=ce=>((ce=$(ce,!0)).buffer||(ce=new Uint8Array(ce)),ce),G=(ce,ge,me)=>{V(),ce=F.normalize(ce),L.readFile(ce,function(_e,xe){_e?me(_e):ge(xe.buffer)})},1{if(J||0{var ge=new XMLHttpRequest;return ge.open("GET",ce,!1),ge.send(null),ge.responseText},Y&&(O=ce=>{var ge=new XMLHttpRequest;return ge.open("GET",ce,!1),ge.responseType="arraybuffer",ge.send(null),new Uint8Array(ge.response)}),G=(ce,ge,me)=>{var _e=new XMLHttpRequest;_e.open("GET",ce,!0),_e.responseType="arraybuffer",_e.onload=()=>{_e.status==200||_e.status==0&&_e.response?ge(_e.response):me()},_e.onerror=me,_e.send(null)});var X,K=E.print||console.log.bind(console),q=E.printErr||console.warn.bind(console);Object.assign(E,W),W=null,E.thisProgram&&(z=E.thisProgram),E.quit&&(Z=E.quit),E.wasmBinary&&(X=E.wasmBinary);var J=E.noExitRuntime||!1;typeof WebAssembly!="object"&&He("no native wasm support detected");var Q,ee,re,ie,ae,ne,te=!1,oe=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function ue(ce,ge,me){var _e=(ge>>>=0)+me;for(me=ge;ce[me]&&!(me>=_e);)++me;if(16(xe=(240&xe)==224?(15&xe)<<12|Ce<<6|Ne:(7&xe)<<18|Ce<<12|Ne<<6|63&ce[ge++])?_e+=String.fromCharCode(xe):(xe-=65536,_e+=String.fromCharCode(55296|xe>>10,56320|1023&xe))}}else _e+=String.fromCharCode(xe)}return _e}function de(ce,ge){return(ce>>>=0)?ue(ie,ce,ge):""}function pe(ce,ge,me,_e){if(!(0<_e))return 0;var xe=me>>>=0;_e=me+_e-1;for(var Ce=0;Ce=Ne&&(Ne=65536+((1023&Ne)<<10)|1023&ce.charCodeAt(++Ce)),127>=Ne){if(me>=_e)break;ge[me++>>>0]=Ne}else{if(2047>=Ne){if(me+1>=_e)break;ge[me++>>>0]=192|Ne>>6}else{if(65535>=Ne){if(me+2>=_e)break;ge[me++>>>0]=224|Ne>>12}else{if(me+3>=_e)break;ge[me++>>>0]=240|Ne>>18,ge[me++>>>0]=128|Ne>>12&63}ge[me++>>>0]=128|Ne>>6&63}ge[me++>>>0]=128|63&Ne}}return ge[me>>>0]=0,me-xe}function he(ce){for(var ge=0,me=0;me=_e?ge++:2047>=_e?ge+=2:55296<=_e&&57343>=_e?(ge+=4,++me):ge+=3}return ge}function we(){var ce=Q.buffer;ee=ce,E.HEAP8=re=new Int8Array(ce),E.HEAP16=new Int16Array(ce),E.HEAP32=ae=new Int32Array(ce),E.HEAPU8=ie=new Uint8Array(ce),E.HEAPU16=new Uint16Array(ce),E.HEAPU32=ne=new Uint32Array(ce),E.HEAPF32=new Float32Array(ce),E.HEAPF64=new Float64Array(ce)}var ye,Me=[],Pe=[],Re=[],De=[],Le=0;function $e(){var ce=E.preRun.shift();Me.unshift(ce)}var Oe,Ee=0,Be=null;function He(ce){throw E.onAbort&&E.onAbort(ce),q(ce="Aborted("+ce+")"),te=!0,ce=new WebAssembly.RuntimeError(ce+". Build with -sASSERTIONS for more info."),R(ce),ce}function We(){return Oe.startsWith("data:application/octet-stream;base64,")}if(Oe="ort-wasm.wasm",!We()){var Ke=Oe;Oe=E.locateFile?E.locateFile(Ke,j):j+Ke}function Je(){var ce=Oe;try{if(ce==Oe&&X)return new Uint8Array(X);if(O)return O(ce);throw"both async and sync fetching of the wasm failed"}catch(ge){He(ge)}}function tt(ce){this.name="ExitStatus",this.message="Program terminated with exit("+ce+")",this.status=ce}function mt(ce){for(;0>2>>>0]=ge},this.Eb=function(){return ne[this.zb+4>>2>>>0]},this.Sb=function(ge){ne[this.zb+8>>2>>>0]=ge},this.Wb=function(){return ne[this.zb+8>>2>>>0]},this.Tb=function(){ae[this.zb>>2>>>0]=0},this.Ib=function(ge){re[this.zb+12>>0>>>0]=ge?1:0},this.Pb=function(){return re[this.zb+12>>0>>>0]!=0},this.Jb=function(ge){re[this.zb+13>>0>>>0]=ge?1:0},this.Lb=function(){return re[this.zb+13>>0>>>0]!=0},this.Rb=function(ge,me){this.Fb(0),this.Ub(ge),this.Sb(me),this.Tb(),this.Ib(!1),this.Jb(!1)},this.Nb=function(){ae[this.zb>>2>>>0]+=1},this.Xb=function(){var ge=ae[this.zb>>2>>>0];return ae[this.zb>>2>>>0]=ge-1,ge===1},this.Fb=function(ge){ne[this.zb+16>>2>>>0]=ge},this.Ob=function(){return ne[this.zb+16>>2>>>0]},this.Qb=function(){if(qt(this.Eb()))return ne[this.Db>>2>>>0];var ge=this.Ob();return ge!==0?ge:this.Db}}function yt(ce){return kt(new ct(ce).zb)}var At=[];function qe(ce){var ge=At[ce];return ge||(ce>=At.length&&(At.length=ce+1),At[ce]=ge=ye.get(ce)),ge}function Bt(ce){var ge=he(ce)+1,me=ze(ge);return me&&pe(ce,re,me,ge),me}var xt={};function Mt(){if(!Dt){var ce,ge={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:z||"./this.program"};for(ce in xt)xt[ce]===void 0?delete ge[ce]:ge[ce]=xt[ce];var me=[];for(ce in ge)me.push(ce+"="+ge[ce]);Dt=me}return Dt}var Dt,Ot=[null,[],[]];function _t(ce,ge){var me=Ot[ce];ge===0||ge===10?((ce===1?K:q)(ue(me,0)),me.length=0):me.push(ge)}var ft=0;function Gt(ce){return ce%4==0&&(ce%100!=0||ce%400==0)}var Ye=[31,29,31,30,31,30,31,31,30,31,30,31],Pt=[31,28,31,30,31,30,31,31,30,31,30,31];function Wt(ce,ge,me,_e){function xe(Ie,dt,wt){for(Ie=typeof Ie=="number"?Ie.toString():Ie||"";Ie.lengthXt?-1:0zt-Ie.getDate())){Ie.setDate(Ie.getDate()+dt);break}dt-=zt-Ie.getDate()+1,Ie.setDate(1),11>wt?Ie.setMonth(wt+1):(Ie.setMonth(0),Ie.setFullYear(Ie.getFullYear()+1))}return wt=new Date(Ie.getFullYear()+1,0,4),dt=Ue(new Date(Ie.getFullYear(),0,4)),wt=Ue(wt),0>=Ne(dt,Ie)?0>=Ne(wt,Ie)?Ie.getFullYear()+1:Ie.getFullYear():Ie.getFullYear()-1}var nt=ae[_e+40>>2>>>0];for(var vt in _e={$b:ae[_e>>2>>>0],Zb:ae[_e+4>>2>>>0],Gb:ae[_e+8>>2>>>0],Kb:ae[_e+12>>2>>>0],Hb:ae[_e+16>>2>>>0],Cb:ae[_e+20>>2>>>0],Ab:ae[_e+24>>2>>>0],Bb:ae[_e+28>>2>>>0],bc:ae[_e+32>>2>>>0],Yb:ae[_e+36>>2>>>0],ac:nt?de(nt):""},me=de(me),nt={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})me=me.replace(new RegExp(vt,"g"),nt[vt]);var Lt="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),Et="January February March April May June July August September October November December".split(" ");for(vt in nt={"%a":function(Ie){return Lt[Ie.Ab].substring(0,3)},"%A":function(Ie){return Lt[Ie.Ab]},"%b":function(Ie){return Et[Ie.Hb].substring(0,3)},"%B":function(Ie){return Et[Ie.Hb]},"%C":function(Ie){return Ce((Ie.Cb+1900)/100|0,2)},"%d":function(Ie){return Ce(Ie.Kb,2)},"%e":function(Ie){return xe(Ie.Kb,2," ")},"%g":function(Ie){return Ze(Ie).toString().substring(2)},"%G":function(Ie){return Ze(Ie)},"%H":function(Ie){return Ce(Ie.Gb,2)},"%I":function(Ie){return(Ie=Ie.Gb)==0?Ie=12:12Ie.Gb?"AM":"PM"},"%S":function(Ie){return Ce(Ie.$b,2)},"%t":function(){return" "},"%u":function(Ie){return Ie.Ab||7},"%U":function(Ie){return Ce(Math.floor((Ie.Bb+7-Ie.Ab)/7),2)},"%V":function(Ie){var dt=Math.floor((Ie.Bb+7-(Ie.Ab+6)%7)/7);if(2>=(Ie.Ab+371-Ie.Bb-2)%7&&dt++,dt)dt==53&&((wt=(Ie.Ab+371-Ie.Bb)%7)==4||wt==3&&Gt(Ie.Cb)||(dt=1));else{dt=52;var wt=(Ie.Ab+7-Ie.Bb-1)%7;(wt==4||wt==5&&Gt(Ie.Cb%400-1))&&dt++}return Ce(dt,2)},"%w":function(Ie){return Ie.Ab},"%W":function(Ie){return Ce(Math.floor((Ie.Bb+7-(Ie.Ab+6)%7)/7),2)},"%y":function(Ie){return(Ie.Cb+1900).toString().substring(2)},"%Y":function(Ie){return Ie.Cb+1900},"%z":function(Ie){var dt=0<=(Ie=Ie.Yb);return Ie=Math.abs(Ie)/60,(dt?"+":"-")+String("0000"+(Ie/60*100+Ie%60)).slice(-4)},"%Z":function(Ie){return Ie.ac},"%%":function(){return"%"}},me=me.replace(/%%/g,"\0\0"),nt)me.includes(vt)&&(me=me.replace(new RegExp(vt,"g"),nt[vt](_e)));return vt=function(Ie){var dt=Array(he(Ie)+1);return pe(Ie,dt,0,dt.length),dt}(me=me.replace(/\0\0/g,"%")),vt.length>ge?0:(re.set(vt,ce>>>0),vt.length-1)}var St={a:function(ce){return ze(ce+24)+24},m:function(ce){return(ce=new ct(ce)).Pb()||(ce.Ib(!0),bt--),ce.Jb(!1),pt.push(ce),ce.Nb(),ce.Qb()},ia:function(ce){throw q("Unexpected exception thrown, this is not properly supported - aborting"),te=!0,ce},w:function(){et(0);var ce=pt.pop();if(ce.Xb()&&!ce.Lb()){var ge=ce.Wb();ge&&qe(ge)(ce.Db),yt(ce.Db)}gt=0},d:function(){var ce=gt;if(!ce)return ft=0;var ge=new ct(ce);ge.Fb(ce);var me=ge.Eb();if(!me)return ft=0,ce;for(var _e=Array.prototype.slice.call(arguments),xe=0;xe<_e.length;xe++){var Ce=_e[xe];if(Ce===0||Ce===me)break;if(Rt(Ce,me,ge.zb+16))return ft=Ce,ce}return ft=me,ce},k:function(){var ce=gt;if(!ce)return ft=0;var ge=new ct(ce);ge.Fb(ce);var me=ge.Eb();if(!me)return ft=0,ce;for(var _e=Array.prototype.slice.call(arguments),xe=0;xe<_e.length;xe++){var Ce=_e[xe];if(Ce===0||Ce===me)break;if(Rt(Ce,me,ge.zb+16))return ft=Ce,ce}return ft=me,ce},g:function(){var ce=gt;if(!ce)return ft=0;var ge=new ct(ce);ge.Fb(ce);var me=ge.Eb();if(!me)return ft=0,ce;for(var _e=Array.prototype.slice.call(arguments),xe=0;xe<_e.length;xe++){var Ce=_e[xe];if(Ce===0||Ce===me)break;if(Rt(Ce,me,ge.zb+16))return ft=Ce,ce}return ft=me,ce},s:yt,L:function(){var ce=pt.pop();ce||He("no exception to throw");var ge=ce.Db;throw ce.Lb()||(pt.push(ce),ce.Jb(!0),ce.Ib(!1),bt++),gt=ge,ge},b:function(ce,ge,me){throw new ct(ce).Rb(ge,me),gt=ce,bt++,ce},la:function(){return bt},i:function(ce){throw gt||(gt=ce),ce},H:function(){return 0},Ba:function(){},pa:function(){},ra:function(){},ka:function(){return 0},za:function(){},ua:function(){},ya:function(){},R:function(){},qa:function(){},na:function(){},Aa:function(){},oa:function(){},Ha:function(){},Ja:function(){He("To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking")},Ia:function(){He("To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking")},S:function(){return Date.now()},Ca:function(){return!0},Da:function(ce,ge){ce=new Date(1e3*(ne[ce>>>2]+4294967296*ae[ce+4>>>2])),ae[ge>>2>>>0]=ce.getUTCSeconds(),ae[ge+4>>2>>>0]=ce.getUTCMinutes(),ae[ge+8>>2>>>0]=ce.getUTCHours(),ae[ge+12>>2>>>0]=ce.getUTCDate(),ae[ge+16>>2>>>0]=ce.getUTCMonth(),ae[ge+20>>2>>>0]=ce.getUTCFullYear()-1900,ae[ge+24>>2>>>0]=ce.getUTCDay(),ae[ge+28>>2>>>0]=(ce.getTime()-Date.UTC(ce.getUTCFullYear(),0,1,0,0,0,0))/864e5|0},Ea:function(ce,ge){ce=new Date(1e3*(ne[ce>>>2]+4294967296*ae[ce+4>>>2])),ae[ge>>2>>>0]=ce.getSeconds(),ae[ge+4>>2>>>0]=ce.getMinutes(),ae[ge+8>>2>>>0]=ce.getHours(),ae[ge+12>>2>>>0]=ce.getDate(),ae[ge+16>>2>>>0]=ce.getMonth(),ae[ge+20>>2>>>0]=ce.getFullYear()-1900,ae[ge+24>>2>>>0]=ce.getDay();var me=new Date(ce.getFullYear(),0,1);ae[ge+28>>2>>>0]=(ce.getTime()-me.getTime())/864e5|0,ae[ge+36>>2>>>0]=-60*ce.getTimezoneOffset();var _e=new Date(ce.getFullYear(),6,1).getTimezoneOffset();me=me.getTimezoneOffset(),ae[ge+32>>2>>>0]=0|(_e!=me&&ce.getTimezoneOffset()==Math.min(me,_e))},Fa:function(ce){var ge=new Date(ae[ce+20>>2>>>0]+1900,ae[ce+16>>2>>>0],ae[ce+12>>2>>>0],ae[ce+8>>2>>>0],ae[ce+4>>2>>>0],ae[ce>>2>>>0],0),me=ae[ce+32>>2>>>0],_e=ge.getTimezoneOffset(),xe=new Date(ge.getFullYear(),0,1),Ce=new Date(ge.getFullYear(),6,1).getTimezoneOffset(),Ne=xe.getTimezoneOffset(),Ue=Math.min(Ne,Ce);return 0>me?ae[ce+32>>2>>>0]=Number(Ce!=Ne&&Ue==_e):0>2>>>0]=ge.getDay(),ae[ce+28>>2>>>0]=(ge.getTime()-xe.getTime())/864e5|0,ae[ce>>2>>>0]=ge.getSeconds(),ae[ce+4>>2>>>0]=ge.getMinutes(),ae[ce+8>>2>>>0]=ge.getHours(),ae[ce+12>>2>>>0]=ge.getDate(),ae[ce+16>>2>>>0]=ge.getMonth(),ge.getTime()/1e3|0},sa:function(){return-52},ta:function(){},Ga:function ce(ge,me,_e){ce.Vb||(ce.Vb=!0,function(xe,Ce,Ne){function Ue(Et){return(Et=Et.toTimeString().match(/\(([A-Za-z ]+)\)$/))?Et[1]:"GMT"}var Ze=new Date().getFullYear(),nt=new Date(Ze,0,1),vt=new Date(Ze,6,1);Ze=nt.getTimezoneOffset();var Lt=vt.getTimezoneOffset();ae[xe>>2>>>0]=60*Math.max(Ze,Lt),ae[Ce>>2>>>0]=Number(Ze!=Lt),xe=Ue(nt),Ce=Ue(vt),xe=Bt(xe),Ce=Bt(Ce),Lt>2>>>0]=xe,ne[Ne+4>>2>>>0]=Ce):(ne[Ne>>2>>>0]=Ce,ne[Ne+4>>2>>>0]=xe)}(ge,me,_e))},B:function(){He("")},ma:function(){return 4294901760},I:U?()=>{var ce=process.hrtime();return 1e3*ce[0]+ce[1]/1e6}:()=>performance.now(),xa:function(ce,ge,me){ie.copyWithin(ce>>>0,ge>>>0,ge+me>>>0)},G:function(ce){var ge=ie.length;if(4294901760<(ce>>>=0))return!1;for(var me=1;4>=me;me*=2){var _e=ge*(1+.2/me);_e=Math.min(_e,ce+100663296);var xe=Math;_e=Math.max(ce,_e),xe=xe.min.call(xe,4294901760,_e+(65536-_e%65536)%65536);e:{try{Q.grow(xe-ee.byteLength+65535>>>16),we();var Ce=1;break e}catch{}Ce=void 0}if(Ce)return!0}return!1},va:function(ce,ge){var me=0;return Mt().forEach(function(_e,xe){var Ce=ge+me;for(xe=ne[ce+4*xe>>2>>>0]=Ce,Ce=0;Ce<_e.length;++Ce)re[xe++>>0>>>0]=_e.charCodeAt(Ce);re[xe>>0>>>0]=0,me+=_e.length+1}),0},wa:function(ce,ge){var me=Mt();ne[ce>>2>>>0]=me.length;var _e=0;return me.forEach(function(xe){_e+=xe.length+1}),ne[ge>>2>>>0]=_e,0},ba:function(ce){J||0>2>>>0],Ue=ne[ge+4>>2>>>0];ge+=8;for(var Ze=0;Ze>>0]);xe+=Ue}return ne[_e>>2>>>0]=xe,0},c:function(){return ft},ja:function ce(ge,me){ce.Mb||(ce.Mb=function(){if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function"){var xe=new Uint8Array(1);return()=>(crypto.getRandomValues(xe),xe[0])}if(U)try{var Ce=_(Object(function(){var Ne=new Error("Cannot find module 'crypto'");throw Ne.code="MODULE_NOT_FOUND",Ne}()));return()=>Ce.randomBytes(1)[0]}catch{}return()=>He("randomDevice")}());for(var _e=0;_e>0>>>0]=ce.Mb();return 0},ea:function(ce,ge,me){var _e=Xe();try{return qe(ce)(ge,me)}catch(xe){if(Qe(_e),xe!==xe+0)throw xe;et(1,0)}},fa:function(ce,ge,me){var _e=Xe();try{return qe(ce)(ge,me)}catch(xe){if(Qe(_e),xe!==xe+0)throw xe;et(1,0)}},J:function(ce){var ge=Xe();try{return qe(ce)()}catch(me){if(Qe(ge),me!==me+0)throw me;et(1,0)}},e:function(ce,ge){var me=Xe();try{return qe(ce)(ge)}catch(_e){if(Qe(me),_e!==_e+0)throw _e;et(1,0)}},N:function(ce,ge,me){var _e=Xe();try{return qe(ce)(ge,me)}catch(xe){if(Qe(_e),xe!==xe+0)throw xe;et(1,0)}},O:function(ce,ge,me){var _e=Xe();try{return qe(ce)(ge,me)}catch(xe){if(Qe(_e),xe!==xe+0)throw xe;et(1,0)}},j:function(ce,ge,me){var _e=Xe();try{return qe(ce)(ge,me)}catch(xe){if(Qe(_e),xe!==xe+0)throw xe;et(1,0)}},o:function(ce,ge,me,_e){var xe=Xe();try{return qe(ce)(ge,me,_e)}catch(Ce){if(Qe(xe),Ce!==Ce+0)throw Ce;et(1,0)}},p:function(ce,ge,me,_e,xe){var Ce=Xe();try{return qe(ce)(ge,me,_e,xe)}catch(Ne){if(Qe(Ce),Ne!==Ne+0)throw Ne;et(1,0)}},M:function(ce,ge,me,_e,xe,Ce){var Ne=Xe();try{return qe(ce)(ge,me,_e,xe,Ce)}catch(Ue){if(Qe(Ne),Ue!==Ue+0)throw Ue;et(1,0)}},r:function(ce,ge,me,_e,xe,Ce){var Ne=Xe();try{return qe(ce)(ge,me,_e,xe,Ce)}catch(Ue){if(Qe(Ne),Ue!==Ue+0)throw Ue;et(1,0)}},v:function(ce,ge,me,_e,xe,Ce,Ne){var Ue=Xe();try{return qe(ce)(ge,me,_e,xe,Ce,Ne)}catch(Ze){if(Qe(Ue),Ze!==Ze+0)throw Ze;et(1,0)}},K:function(ce,ge,me,_e,xe,Ce,Ne,Ue){var Ze=Xe();try{return qe(ce)(ge,me,_e,xe,Ce,Ne,Ue)}catch(nt){if(Qe(Ze),nt!==nt+0)throw nt;et(1,0)}},D:function(ce,ge,me,_e,xe,Ce,Ne,Ue,Ze,nt,vt,Lt){var Et=Xe();try{return qe(ce)(ge,me,_e,xe,Ce,Ne,Ue,Ze,nt,vt,Lt)}catch(Ie){if(Qe(Et),Ie!==Ie+0)throw Ie;et(1,0)}},X:function(ce,ge,me,_e,xe,Ce,Ne,Ue){var Ze=Xe();try{return jt(ce,ge,me,_e,xe,Ce,Ne,Ue)}catch(nt){if(Qe(Ze),nt!==nt+0)throw nt;et(1,0)}},V:function(ce,ge,me,_e,xe,Ce,Ne){var Ue=Xe();try{return Ft(ce,ge,me,_e,xe,Ce,Ne)}catch(Ze){if(Qe(Ue),Ze!==Ze+0)throw Ze;et(1,0)}},U:function(ce,ge,me,_e,xe){var Ce=Xe();try{return nr(ce,ge,me,_e,xe)}catch(Ne){if(Qe(Ce),Ne!==Ne+0)throw Ne;et(1,0)}},Z:function(ce,ge,me,_e){var xe=Xe();try{return Yt(ce,ge,me,_e)}catch(Ce){if(Qe(xe),Ce!==Ce+0)throw Ce;et(1,0)}},W:function(ce){var ge=Xe();try{return Qt(ce)}catch(me){if(Qe(ge),me!==me+0)throw me;et(1,0)}},Y:function(ce,ge){var me=Xe();try{return Ut(ce,ge)}catch(_e){if(Qe(me),_e!==_e+0)throw _e;et(1,0)}},T:function(ce,ge,me){var _e=Xe();try{return er(ce,ge,me)}catch(xe){if(Qe(_e),xe!==xe+0)throw xe;et(1,0)}},f:function(ce){var ge=Xe();try{qe(ce)()}catch(me){if(Qe(ge),me!==me+0)throw me;et(1,0)}},q:function(ce,ge){var me=Xe();try{qe(ce)(ge)}catch(_e){if(Qe(me),_e!==_e+0)throw _e;et(1,0)}},h:function(ce,ge,me){var _e=Xe();try{qe(ce)(ge,me)}catch(xe){if(Qe(_e),xe!==xe+0)throw xe;et(1,0)}},da:function(ce,ge,me,_e){var xe=Xe();try{qe(ce)(ge,me,_e)}catch(Ce){if(Qe(xe),Ce!==Ce+0)throw Ce;et(1,0)}},l:function(ce,ge,me,_e){var xe=Xe();try{qe(ce)(ge,me,_e)}catch(Ce){if(Qe(xe),Ce!==Ce+0)throw Ce;et(1,0)}},t:function(ce,ge,me,_e,xe){var Ce=Xe();try{qe(ce)(ge,me,_e,xe)}catch(Ne){if(Qe(Ce),Ne!==Ne+0)throw Ne;et(1,0)}},u:function(ce,ge,me,_e,xe,Ce){var Ne=Xe();try{qe(ce)(ge,me,_e,xe,Ce)}catch(Ue){if(Qe(Ne),Ue!==Ue+0)throw Ue;et(1,0)}},x:function(ce,ge,me,_e,xe,Ce,Ne){var Ue=Xe();try{qe(ce)(ge,me,_e,xe,Ce,Ne)}catch(Ze){if(Qe(Ue),Ze!==Ze+0)throw Ze;et(1,0)}},z:function(ce,ge,me,_e,xe,Ce,Ne,Ue){var Ze=Xe();try{qe(ce)(ge,me,_e,xe,Ce,Ne,Ue)}catch(nt){if(Qe(Ze),nt!==nt+0)throw nt;et(1,0)}},ga:function(ce,ge,me,_e,xe,Ce,Ne,Ue,Ze){var nt=Xe();try{qe(ce)(ge,me,_e,xe,Ce,Ne,Ue,Ze)}catch(vt){if(Qe(nt),vt!==vt+0)throw vt;et(1,0)}},A:function(ce,ge,me,_e,xe,Ce,Ne,Ue,Ze,nt,vt){var Lt=Xe();try{qe(ce)(ge,me,_e,xe,Ce,Ne,Ue,Ze,nt,vt)}catch(Et){if(Qe(Lt),Et!==Et+0)throw Et;et(1,0)}},C:function(ce,ge,me,_e,xe,Ce,Ne,Ue,Ze,nt,vt,Lt,Et,Ie,dt,wt){var zt=Xe();try{qe(ce)(ge,me,_e,xe,Ce,Ne,Ue,Ze,nt,vt,Lt,Et,Ie,dt,wt)}catch(Xt){if(Qe(zt),Xt!==Xt+0)throw Xt;et(1,0)}},aa:function(ce,ge,me,_e,xe,Ce,Ne,Ue){var Ze=Xe();try{Tt(ce,ge,me,_e,xe,Ce,Ne,Ue)}catch(nt){if(Qe(Ze),nt!==nt+0)throw nt;et(1,0)}},_:function(ce,ge,me,_e,xe,Ce,Ne,Ue,Ze,nt,vt,Lt){var Et=Xe();try{Ve(ce,ge,me,_e,xe,Ce,Ne,Ue,Ze,nt,vt,Lt)}catch(Ie){if(Qe(Et),Ie!==Ie+0)throw Ie;et(1,0)}},$:function(ce,ge,me,_e,xe,Ce){var Ne=Xe();try{be(ce,ge,me,_e,xe,Ce)}catch(Ue){if(Qe(Ne),Ue!==Ue+0)throw Ue;et(1,0)}},n:function(ce){return ce},F:function(ce){ft=ce},ha:Wt,y:function(ce,ge,me,_e){return Wt(ce,ge,me,_e)}};(function(){function ce(xe){E.asm=xe.exports,Q=E.asm.Ka,we(),ye=E.asm.ib,Pe.unshift(E.asm.La),Ee--,E.monitorRunDependencies&&E.monitorRunDependencies(Ee),Ee==0&&Be&&(xe=Be,Be=null,xe())}function ge(xe){ce(xe.instance)}function me(xe){return function(){if(!X&&(H||Y)){if(typeof fetch=="function"&&!Oe.startsWith("file://"))return fetch(Oe,{credentials:"same-origin"}).then(function(Ce){if(!Ce.ok)throw"failed to load wasm binary file at '"+Oe+"'";return Ce.arrayBuffer()}).catch(function(){return Je()});if(G)return new Promise(function(Ce,Ne){G(Oe,function(Ue){Ce(new Uint8Array(Ue))},Ne)})}return Promise.resolve().then(function(){return Je()})}().then(function(Ce){return WebAssembly.instantiate(Ce,_e)}).then(function(Ce){return Ce}).then(xe,function(Ce){q("failed to asynchronously prepare wasm: "+Ce),He(Ce)})}var _e={a:St};if(Ee++,E.monitorRunDependencies&&E.monitorRunDependencies(Ee),E.instantiateWasm)try{return E.instantiateWasm(_e,ce)}catch(xe){return q("Module.instantiateWasm callback failed with error: "+xe),!1}(X||typeof WebAssembly.instantiateStreaming!="function"||We()||Oe.startsWith("file://")||U||typeof fetch!="function"?me(ge):fetch(Oe,{credentials:"same-origin"}).then(function(xe){return WebAssembly.instantiateStreaming(xe,_e).then(ge,function(Ce){return q("wasm streaming compile failed: "+Ce),q("falling back to ArrayBuffer instantiation"),me(ge)})})).catch(R)})(),E.___wasm_call_ctors=function(){return(E.___wasm_call_ctors=E.asm.La).apply(null,arguments)},E._OrtInit=function(){return(E._OrtInit=E.asm.Ma).apply(null,arguments)},E._OrtCreateSessionOptions=function(){return(E._OrtCreateSessionOptions=E.asm.Na).apply(null,arguments)},E._OrtAppendExecutionProvider=function(){return(E._OrtAppendExecutionProvider=E.asm.Oa).apply(null,arguments)},E._OrtAddSessionConfigEntry=function(){return(E._OrtAddSessionConfigEntry=E.asm.Pa).apply(null,arguments)},E._OrtReleaseSessionOptions=function(){return(E._OrtReleaseSessionOptions=E.asm.Qa).apply(null,arguments)},E._OrtCreateSession=function(){return(E._OrtCreateSession=E.asm.Ra).apply(null,arguments)},E._OrtReleaseSession=function(){return(E._OrtReleaseSession=E.asm.Sa).apply(null,arguments)},E._OrtGetInputCount=function(){return(E._OrtGetInputCount=E.asm.Ta).apply(null,arguments)},E._OrtGetOutputCount=function(){return(E._OrtGetOutputCount=E.asm.Ua).apply(null,arguments)},E._OrtGetInputName=function(){return(E._OrtGetInputName=E.asm.Va).apply(null,arguments)},E._OrtGetOutputName=function(){return(E._OrtGetOutputName=E.asm.Wa).apply(null,arguments)},E._OrtFree=function(){return(E._OrtFree=E.asm.Xa).apply(null,arguments)},E._OrtCreateTensor=function(){return(E._OrtCreateTensor=E.asm.Ya).apply(null,arguments)},E._OrtGetTensorData=function(){return(E._OrtGetTensorData=E.asm.Za).apply(null,arguments)},E._OrtReleaseTensor=function(){return(E._OrtReleaseTensor=E.asm._a).apply(null,arguments)},E._OrtCreateRunOptions=function(){return(E._OrtCreateRunOptions=E.asm.$a).apply(null,arguments)},E._OrtAddRunConfigEntry=function(){return(E._OrtAddRunConfigEntry=E.asm.ab).apply(null,arguments)},E._OrtReleaseRunOptions=function(){return(E._OrtReleaseRunOptions=E.asm.bb).apply(null,arguments)},E._OrtRun=function(){return(E._OrtRun=E.asm.cb).apply(null,arguments)},E._OrtEndProfiling=function(){return(E._OrtEndProfiling=E.asm.db).apply(null,arguments)};var Ge,ze=E._malloc=function(){return(ze=E._malloc=E.asm.eb).apply(null,arguments)},kt=E._free=function(){return(kt=E._free=E.asm.fb).apply(null,arguments)},Nt=E._fflush=function(){return(Nt=E._fflush=E.asm.gb).apply(null,arguments)},$t=E.___funcs_on_exit=function(){return($t=E.___funcs_on_exit=E.asm.hb).apply(null,arguments)},et=E._setThrew=function(){return(et=E._setThrew=E.asm.jb).apply(null,arguments)},Xe=E.stackSave=function(){return(Xe=E.stackSave=E.asm.kb).apply(null,arguments)},Qe=E.stackRestore=function(){return(Qe=E.stackRestore=E.asm.lb).apply(null,arguments)},Jt=E.stackAlloc=function(){return(Jt=E.stackAlloc=E.asm.mb).apply(null,arguments)},Rt=E.___cxa_can_catch=function(){return(Rt=E.___cxa_can_catch=E.asm.nb).apply(null,arguments)},qt=E.___cxa_is_pointer_type=function(){return(qt=E.___cxa_is_pointer_type=E.asm.ob).apply(null,arguments)},Qt=E.dynCall_j=function(){return(Qt=E.dynCall_j=E.asm.pb).apply(null,arguments)},Ft=E.dynCall_iiiiij=function(){return(Ft=E.dynCall_iiiiij=E.asm.qb).apply(null,arguments)},er=E.dynCall_jii=function(){return(er=E.dynCall_jii=E.asm.rb).apply(null,arguments)},Tt=E.dynCall_viiiiij=function(){return(Tt=E.dynCall_viiiiij=E.asm.sb).apply(null,arguments)},be=E.dynCall_vjji=function(){return(be=E.dynCall_vjji=E.asm.tb).apply(null,arguments)},Ve=E.dynCall_viiijjjii=function(){return(Ve=E.dynCall_viiijjjii=E.asm.ub).apply(null,arguments)},Yt=E.dynCall_iij=function(){return(Yt=E.dynCall_iij=E.asm.vb).apply(null,arguments)},Ut=E.dynCall_ji=function(){return(Ut=E.dynCall_ji=E.asm.wb).apply(null,arguments)},jt=E.dynCall_iiiiiij=function(){return(jt=E.dynCall_iiiiiij=E.asm.xb).apply(null,arguments)},nr=E.dynCall_iiij=function(){return(nr=E.dynCall_iiij=E.asm.yb).apply(null,arguments)};function ar(){function ce(){if(!Ge&&(Ge=!0,E.calledRun=!0,!te)){if(mt(Pe),P(E),E.onRuntimeInitialized&&E.onRuntimeInitialized(),E.postRun)for(typeof E.postRun=="function"&&(E.postRun=[E.postRun]);E.postRun.length;){var ge=E.postRun.shift();De.unshift(ge)}mt(De)}}if(!(0{x.exports=function(c,_){for(var T=new Array(arguments.length-1),C=0,M=2,E=!0;M{var _=c;_.length=function(P){var R=P.length;if(!R)return 0;for(var $=0;--R%4>1&&P.charAt(R)==="=";)++$;return Math.ceil(3*P.length)/4-$};for(var T=new Array(64),C=new Array(123),M=0;M<64;)C[T[M]=M<26?M+65:M<52?M+71:M<62?M-4:M-59|43]=M++;_.encode=function(P,R,$){for(var G,O=null,L=[],F=0,V=0;R<$;){var W=P[R++];switch(V){case 0:L[F++]=T[W>>2],G=(3&W)<<4,V=1;break;case 1:L[F++]=T[G|W>>4],G=(15&W)<<2,V=2;break;case 2:L[F++]=T[G|W>>6],L[F++]=T[63&W],V=0}F>8191&&((O||(O=[])).push(String.fromCharCode.apply(String,L)),F=0)}return V&&(L[F++]=T[G],L[F++]=61,V===1&&(L[F++]=61)),O?(F&&O.push(String.fromCharCode.apply(String,L.slice(0,F))),O.join("")):String.fromCharCode.apply(String,L.slice(0,F))};var E="invalid encoding";_.decode=function(P,R,$){for(var G,O=$,L=0,F=0;F1)break;if((V=C[V])===void 0)throw Error(E);switch(L){case 0:G=V,L=1;break;case 1:R[$++]=G<<2|(48&V)>>4,G=V,L=2;break;case 2:R[$++]=(15&G)<<4|(60&V)>>2,G=V,L=3;break;case 3:R[$++]=(3&G)<<6|V,L=0}}if(L===1)throw Error(E);return $-O},_.test=function(P){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(P)}},9211:x=>{function c(){this._listeners={}}x.exports=c,c.prototype.on=function(_,T,C){return(this._listeners[_]||(this._listeners[_]=[])).push({fn:T,ctx:C||this}),this},c.prototype.off=function(_,T){if(_===void 0)this._listeners={};else if(T===void 0)this._listeners[_]=[];else for(var C=this._listeners[_],M=0;M{function c(E){return typeof Float32Array<"u"?function(){var P=new Float32Array([-0]),R=new Uint8Array(P.buffer),$=R[3]===128;function G(V,W,z){P[0]=V,W[z]=R[0],W[z+1]=R[1],W[z+2]=R[2],W[z+3]=R[3]}function O(V,W,z){P[0]=V,W[z]=R[3],W[z+1]=R[2],W[z+2]=R[1],W[z+3]=R[0]}function L(V,W){return R[0]=V[W],R[1]=V[W+1],R[2]=V[W+2],R[3]=V[W+3],P[0]}function F(V,W){return R[3]=V[W],R[2]=V[W+1],R[1]=V[W+2],R[0]=V[W+3],P[0]}E.writeFloatLE=$?G:O,E.writeFloatBE=$?O:G,E.readFloatLE=$?L:F,E.readFloatBE=$?F:L}():function(){function P($,G,O,L){var F=G<0?1:0;if(F&&(G=-G),G===0)$(1/G>0?0:2147483648,O,L);else if(isNaN(G))$(2143289344,O,L);else if(G>34028234663852886e22)$((F<<31|2139095040)>>>0,O,L);else if(G<11754943508222875e-54)$((F<<31|Math.round(G/1401298464324817e-60))>>>0,O,L);else{var V=Math.floor(Math.log(G)/Math.LN2);$((F<<31|V+127<<23|8388607&Math.round(G*Math.pow(2,-V)*8388608))>>>0,O,L)}}function R($,G,O){var L=$(G,O),F=2*(L>>31)+1,V=L>>>23&255,W=8388607&L;return V===255?W?NaN:F*(1/0):V===0?1401298464324817e-60*F*W:F*Math.pow(2,V-150)*(W+8388608)}E.writeFloatLE=P.bind(null,_),E.writeFloatBE=P.bind(null,T),E.readFloatLE=R.bind(null,C),E.readFloatBE=R.bind(null,M)}(),typeof Float64Array<"u"?function(){var P=new Float64Array([-0]),R=new Uint8Array(P.buffer),$=R[7]===128;function G(V,W,z){P[0]=V,W[z]=R[0],W[z+1]=R[1],W[z+2]=R[2],W[z+3]=R[3],W[z+4]=R[4],W[z+5]=R[5],W[z+6]=R[6],W[z+7]=R[7]}function O(V,W,z){P[0]=V,W[z]=R[7],W[z+1]=R[6],W[z+2]=R[5],W[z+3]=R[4],W[z+4]=R[3],W[z+5]=R[2],W[z+6]=R[1],W[z+7]=R[0]}function L(V,W){return R[0]=V[W],R[1]=V[W+1],R[2]=V[W+2],R[3]=V[W+3],R[4]=V[W+4],R[5]=V[W+5],R[6]=V[W+6],R[7]=V[W+7],P[0]}function F(V,W){return R[7]=V[W],R[6]=V[W+1],R[5]=V[W+2],R[4]=V[W+3],R[3]=V[W+4],R[2]=V[W+5],R[1]=V[W+6],R[0]=V[W+7],P[0]}E.writeDoubleLE=$?G:O,E.writeDoubleBE=$?O:G,E.readDoubleLE=$?L:F,E.readDoubleBE=$?F:L}():function(){function P($,G,O,L,F,V){var W=L<0?1:0;if(W&&(L=-L),L===0)$(0,F,V+G),$(1/L>0?0:2147483648,F,V+O);else if(isNaN(L))$(0,F,V+G),$(2146959360,F,V+O);else if(L>17976931348623157e292)$(0,F,V+G),$((W<<31|2146435072)>>>0,F,V+O);else{var z;if(L<22250738585072014e-324)$((z=L/5e-324)>>>0,F,V+G),$((W<<31|z/4294967296)>>>0,F,V+O);else{var Z=Math.floor(Math.log(L)/Math.LN2);Z===1024&&(Z=1023),$(4503599627370496*(z=L*Math.pow(2,-Z))>>>0,F,V+G),$((W<<31|Z+1023<<20|1048576*z&1048575)>>>0,F,V+O)}}}function R($,G,O,L,F){var V=$(L,F+G),W=$(L,F+O),z=2*(W>>31)+1,Z=W>>>20&2047,H=4294967296*(1048575&W)+V;return Z===2047?H?NaN:z*(1/0):Z===0?5e-324*z*H:z*Math.pow(2,Z-1075)*(H+4503599627370496)}E.writeDoubleLE=P.bind(null,_,0,4),E.writeDoubleBE=P.bind(null,T,4,0),E.readDoubleLE=R.bind(null,C,0,4),E.readDoubleBE=R.bind(null,M,4,0)}(),E}function _(E,P,R){P[R]=255&E,P[R+1]=E>>>8&255,P[R+2]=E>>>16&255,P[R+3]=E>>>24}function T(E,P,R){P[R]=E>>>24,P[R+1]=E>>>16&255,P[R+2]=E>>>8&255,P[R+3]=255&E}function C(E,P){return(E[P]|E[P+1]<<8|E[P+2]<<16|E[P+3]<<24)>>>0}function M(E,P){return(E[P]<<24|E[P+1]<<16|E[P+2]<<8|E[P+3])>>>0}x.exports=c(c)},7199:module=>{function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(x){}return null}module.exports=inquire},6662:x=>{x.exports=function(c,_,T){var C=T||8192,M=C>>>1,E=null,P=C;return function(R){if(R<1||R>M)return c(R);P+R>C&&(E=c(C),P=0);var $=_.call(E,P,P+=R);return 7&P&&(P=1+(7|P)),$}}},4997:(x,c)=>{var _=c;_.length=function(T){for(var C=0,M=0,E=0;E191&&E<224?R[$++]=(31&E)<<6|63&T[C++]:E>239&&E<365?(E=((7&E)<<18|(63&T[C++])<<12|(63&T[C++])<<6|63&T[C++])-65536,R[$++]=55296+(E>>10),R[$++]=56320+(1023&E)):R[$++]=(15&E)<<12|(63&T[C++])<<6|63&T[C++],$>8191&&((P||(P=[])).push(String.fromCharCode.apply(String,R)),$=0);return P?($&&P.push(String.fromCharCode.apply(String,R.slice(0,$))),P.join("")):String.fromCharCode.apply(String,R.slice(0,$))},_.write=function(T,C,M){for(var E,P,R=M,$=0;$>6|192,C[M++]=63&E|128):(64512&E)==55296&&(64512&(P=T.charCodeAt($+1)))==56320?(E=65536+((1023&E)<<10)+(1023&P),++$,C[M++]=E>>18|240,C[M++]=E>>12&63|128,C[M++]=E>>6&63|128,C[M++]=63&E|128):(C[M++]=E>>12|224,C[M++]=E>>6&63|128,C[M++]=63&E|128);return M-R}},3442:(x,c)=>{c.__esModule=!0;var _=function(){function T(C){if(!C)throw new TypeError("Invalid argument; `value` has no value.");this.value=T.EMPTY,C&&T.isGuid(C)&&(this.value=C)}return T.isGuid=function(C){var M=C.toString();return C&&(C instanceof T||T.validator.test(M))},T.create=function(){return new T([T.gen(2),T.gen(1),T.gen(1),T.gen(1),T.gen(3)].join("-"))},T.createEmpty=function(){return new T("emptyguid")},T.parse=function(C){return new T(C)},T.raw=function(){return[T.gen(2),T.gen(1),T.gen(1),T.gen(1),T.gen(3)].join("-")},T.gen=function(C){for(var M="",E=0;E{x.exports=_;var c=null;try{c=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function _(J,Q,ee){this.low=0|J,this.high=0|Q,this.unsigned=!!ee}function T(J){return(J&&J.__isLong__)===!0}_.prototype.__isLong__,Object.defineProperty(_.prototype,"__isLong__",{value:!0}),_.isLong=T;var C={},M={};function E(J,Q){var ee,re,ie;return Q?(ie=0<=(J>>>=0)&&J<256)&&(re=M[J])?re:(ee=R(J,(0|J)<0?-1:0,!0),ie&&(M[J]=ee),ee):(ie=-128<=(J|=0)&&J<128)&&(re=C[J])?re:(ee=R(J,J<0?-1:0,!1),ie&&(C[J]=ee),ee)}function P(J,Q){if(isNaN(J))return Q?Z:z;if(Q){if(J<0)return Z;if(J>=F)return X}else{if(J<=-V)return K;if(J+1>=V)return j}return J<0?P(-J,Q).neg():R(J%L|0,J/L|0,Q)}function R(J,Q,ee){return new _(J,Q,ee)}_.fromInt=E,_.fromNumber=P,_.fromBits=R;var $=Math.pow;function G(J,Q,ee){if(J.length===0)throw Error("empty string");if(J==="NaN"||J==="Infinity"||J==="+Infinity"||J==="-Infinity")return z;if(typeof Q=="number"?(ee=Q,Q=!1):Q=!!Q,(ee=ee||10)<2||360)throw Error("interior hyphen");if(re===0)return G(J.substring(1),Q,ee).neg();for(var ie=P($(ee,8)),ae=z,ne=0;ne>>0:this.low},q.toNumber=function(){return this.unsigned?(this.high>>>0)*L+(this.low>>>0):this.high*L+(this.low>>>0)},q.toString=function(J){if((J=J||10)<2||36>>0).toString(J);if((ae=te).isZero())return oe+ne;for(;oe.length<6;)oe="0"+oe;ne=""+oe+ne}},q.getHighBits=function(){return this.high},q.getHighBitsUnsigned=function(){return this.high>>>0},q.getLowBits=function(){return this.low},q.getLowBitsUnsigned=function(){return this.low>>>0},q.getNumBitsAbs=function(){if(this.isNegative())return this.eq(K)?64:this.neg().getNumBitsAbs();for(var J=this.high!=0?this.high:this.low,Q=31;Q>0&&!(J&1<=0},q.isOdd=function(){return(1&this.low)==1},q.isEven=function(){return(1&this.low)==0},q.equals=function(J){return T(J)||(J=O(J)),(this.unsigned===J.unsigned||this.high>>>31!=1||J.high>>>31!=1)&&this.high===J.high&&this.low===J.low},q.eq=q.equals,q.notEquals=function(J){return!this.eq(J)},q.neq=q.notEquals,q.ne=q.notEquals,q.lessThan=function(J){return this.comp(J)<0},q.lt=q.lessThan,q.lessThanOrEqual=function(J){return this.comp(J)<=0},q.lte=q.lessThanOrEqual,q.le=q.lessThanOrEqual,q.greaterThan=function(J){return this.comp(J)>0},q.gt=q.greaterThan,q.greaterThanOrEqual=function(J){return this.comp(J)>=0},q.gte=q.greaterThanOrEqual,q.ge=q.greaterThanOrEqual,q.compare=function(J){if(T(J)||(J=O(J)),this.eq(J))return 0;var Q=this.isNegative(),ee=J.isNegative();return Q&&!ee?-1:!Q&&ee?1:this.unsigned?J.high>>>0>this.high>>>0||J.high===this.high&&J.low>>>0>this.low>>>0?-1:1:this.sub(J).isNegative()?-1:1},q.comp=q.compare,q.negate=function(){return!this.unsigned&&this.eq(K)?K:this.not().add(H)},q.neg=q.negate,q.add=function(J){T(J)||(J=O(J));var Q=this.high>>>16,ee=65535&this.high,re=this.low>>>16,ie=65535&this.low,ae=J.high>>>16,ne=65535&J.high,te=J.low>>>16,oe=0,ue=0,de=0,pe=0;return de+=(pe+=ie+(65535&J.low))>>>16,ue+=(de+=re+te)>>>16,oe+=(ue+=ee+ne)>>>16,oe+=Q+ae,R((de&=65535)<<16|(pe&=65535),(oe&=65535)<<16|(ue&=65535),this.unsigned)},q.subtract=function(J){return T(J)||(J=O(J)),this.add(J.neg())},q.sub=q.subtract,q.multiply=function(J){if(this.isZero())return z;if(T(J)||(J=O(J)),c)return R(c.mul(this.low,this.high,J.low,J.high),c.get_high(),this.unsigned);if(J.isZero())return z;if(this.eq(K))return J.isOdd()?K:z;if(J.eq(K))return this.isOdd()?K:z;if(this.isNegative())return J.isNegative()?this.neg().mul(J.neg()):this.neg().mul(J).neg();if(J.isNegative())return this.mul(J.neg()).neg();if(this.lt(W)&&J.lt(W))return P(this.toNumber()*J.toNumber(),this.unsigned);var Q=this.high>>>16,ee=65535&this.high,re=this.low>>>16,ie=65535&this.low,ae=J.high>>>16,ne=65535&J.high,te=J.low>>>16,oe=65535&J.low,ue=0,de=0,pe=0,he=0;return pe+=(he+=ie*oe)>>>16,de+=(pe+=re*oe)>>>16,pe&=65535,de+=(pe+=ie*te)>>>16,ue+=(de+=ee*oe)>>>16,de&=65535,ue+=(de+=re*te)>>>16,de&=65535,ue+=(de+=ie*ne)>>>16,ue+=Q*oe+ee*te+re*ne+ie*ae,R((pe&=65535)<<16|(he&=65535),(ue&=65535)<<16|(de&=65535),this.unsigned)},q.mul=q.multiply,q.divide=function(J){if(T(J)||(J=O(J)),J.isZero())throw Error("division by zero");var Q,ee,re;if(c)return this.unsigned||this.high!==-2147483648||J.low!==-1||J.high!==-1?R((this.unsigned?c.div_u:c.div_s)(this.low,this.high,J.low,J.high),c.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?Z:z;if(this.unsigned){if(J.unsigned||(J=J.toUnsigned()),J.gt(this))return Z;if(J.gt(this.shru(1)))return Y;re=Z}else{if(this.eq(K))return J.eq(H)||J.eq(U)?K:J.eq(K)?H:(Q=this.shr(1).div(J).shl(1)).eq(z)?J.isNegative()?H:U:(ee=this.sub(J.mul(Q)),re=Q.add(ee.div(J)));if(J.eq(K))return this.unsigned?Z:z;if(this.isNegative())return J.isNegative()?this.neg().div(J.neg()):this.neg().div(J).neg();if(J.isNegative())return this.div(J.neg()).neg();re=z}for(ee=this;ee.gte(J);){Q=Math.max(1,Math.floor(ee.toNumber()/J.toNumber()));for(var ie=Math.ceil(Math.log(Q)/Math.LN2),ae=ie<=48?1:$(2,ie-48),ne=P(Q),te=ne.mul(J);te.isNegative()||te.gt(ee);)te=(ne=P(Q-=ae,this.unsigned)).mul(J);ne.isZero()&&(ne=H),re=re.add(ne),ee=ee.sub(te)}return re},q.div=q.divide,q.modulo=function(J){return T(J)||(J=O(J)),c?R((this.unsigned?c.rem_u:c.rem_s)(this.low,this.high,J.low,J.high),c.get_high(),this.unsigned):this.sub(this.div(J).mul(J))},q.mod=q.modulo,q.rem=q.modulo,q.not=function(){return R(~this.low,~this.high,this.unsigned)},q.and=function(J){return T(J)||(J=O(J)),R(this.low&J.low,this.high&J.high,this.unsigned)},q.or=function(J){return T(J)||(J=O(J)),R(this.low|J.low,this.high|J.high,this.unsigned)},q.xor=function(J){return T(J)||(J=O(J)),R(this.low^J.low,this.high^J.high,this.unsigned)},q.shiftLeft=function(J){return T(J)&&(J=J.toInt()),(J&=63)==0?this:J<32?R(this.low<>>32-J,this.unsigned):R(0,this.low<>>J|this.high<<32-J,this.high>>J,this.unsigned):R(this.high>>J-32,this.high>=0?0:-1,this.unsigned)},q.shr=q.shiftRight,q.shiftRightUnsigned=function(J){if(T(J)&&(J=J.toInt()),(J&=63)==0)return this;var Q=this.high;return J<32?R(this.low>>>J|Q<<32-J,Q>>>J,this.unsigned):R(J===32?Q:Q>>>J-32,0,this.unsigned)},q.shru=q.shiftRightUnsigned,q.shr_u=q.shiftRightUnsigned,q.toSigned=function(){return this.unsigned?R(this.low,this.high,!1):this},q.toUnsigned=function(){return this.unsigned?this:R(this.low,this.high,!0)},q.toBytes=function(J){return J?this.toBytesLE():this.toBytesBE()},q.toBytesLE=function(){var J=this.high,Q=this.low;return[255&Q,Q>>>8&255,Q>>>16&255,Q>>>24,255&J,J>>>8&255,J>>>16&255,J>>>24]},q.toBytesBE=function(){var J=this.high,Q=this.low;return[J>>>24,J>>>16&255,J>>>8&255,255&J,Q>>>24,Q>>>16&255,Q>>>8&255,255&Q]},_.fromBytes=function(J,Q,ee){return ee?_.fromBytesLE(J,Q):_.fromBytesBE(J,Q)},_.fromBytesLE=function(J,Q){return new _(J[0]|J[1]<<8|J[2]<<16|J[3]<<24,J[4]|J[5]<<8|J[6]<<16|J[7]<<24,Q)},_.fromBytesBE=function(J,Q){return new _(J[4]<<24|J[5]<<16|J[6]<<8|J[7],J[0]<<24|J[1]<<16|J[2]<<8|J[3],Q)}},1446:(x,c,_)=>{var T,C,M,E=_(2100),P=E.Reader,R=E.Writer,$=E.util,G=E.roots.default||(E.roots.default={});G.onnx=((M={}).Version=(T={},(C=Object.create(T))[T[0]="_START_VERSION"]=0,C[T[1]="IR_VERSION_2017_10_10"]=1,C[T[2]="IR_VERSION_2017_10_30"]=2,C[T[3]="IR_VERSION_2017_11_3"]=3,C[T[4]="IR_VERSION_2019_1_22"]=4,C[T[5]="IR_VERSION"]=5,C),M.AttributeProto=function(){function O(L){if(this.floats=[],this.ints=[],this.strings=[],this.tensors=[],this.graphs=[],L)for(var F=Object.keys(L),V=0;V>>3){case 1:W.name=L.string();break;case 21:W.refAttrName=L.string();break;case 13:W.docString=L.string();break;case 20:W.type=L.int32();break;case 2:W.f=L.float();break;case 3:W.i=L.int64();break;case 4:W.s=L.bytes();break;case 5:W.t=G.onnx.TensorProto.decode(L,L.uint32());break;case 6:W.g=G.onnx.GraphProto.decode(L,L.uint32());break;case 7:if(W.floats&&W.floats.length||(W.floats=[]),(7&z)==2)for(var Z=L.uint32()+L.pos;L.pos>>0,L.i.high>>>0).toNumber())),L.s!=null&&(typeof L.s=="string"?$.base64.decode(L.s,F.s=$.newBuffer($.base64.length(L.s)),0):L.s.length&&(F.s=L.s)),L.t!=null){if(typeof L.t!="object")throw TypeError(".onnx.AttributeProto.t: object expected");F.t=G.onnx.TensorProto.fromObject(L.t)}if(L.g!=null){if(typeof L.g!="object")throw TypeError(".onnx.AttributeProto.g: object expected");F.g=G.onnx.GraphProto.fromObject(L.g)}if(L.floats){if(!Array.isArray(L.floats))throw TypeError(".onnx.AttributeProto.floats: array expected");F.floats=[];for(var V=0;V>>0,L.ints[V].high>>>0).toNumber())}if(L.strings){if(!Array.isArray(L.strings))throw TypeError(".onnx.AttributeProto.strings: array expected");for(F.strings=[],V=0;V>>0,L.i.high>>>0).toNumber():L.i),L.s!=null&&L.hasOwnProperty("s")&&(V.s=F.bytes===String?$.base64.encode(L.s,0,L.s.length):F.bytes===Array?Array.prototype.slice.call(L.s):L.s),L.t!=null&&L.hasOwnProperty("t")&&(V.t=G.onnx.TensorProto.toObject(L.t,F)),L.g!=null&&L.hasOwnProperty("g")&&(V.g=G.onnx.GraphProto.toObject(L.g,F)),L.floats&&L.floats.length){V.floats=[];for(var z=0;z>>0,L.ints[z].high>>>0).toNumber():L.ints[z];if(L.strings&&L.strings.length)for(V.strings=[],z=0;z>>3){case 1:W.name=L.string();break;case 2:W.type=G.onnx.TypeProto.decode(L,L.uint32());break;case 3:W.docString=L.string();break;default:L.skipType(7&z)}}return W},O.decodeDelimited=function(L){return L instanceof P||(L=new P(L)),this.decode(L,L.uint32())},O.verify=function(L){if(typeof L!="object"||L===null)return"object expected";if(L.name!=null&&L.hasOwnProperty("name")&&!$.isString(L.name))return"name: string expected";if(L.type!=null&&L.hasOwnProperty("type")){var F=G.onnx.TypeProto.verify(L.type);if(F)return"type."+F}return L.docString!=null&&L.hasOwnProperty("docString")&&!$.isString(L.docString)?"docString: string expected":null},O.fromObject=function(L){if(L instanceof G.onnx.ValueInfoProto)return L;var F=new G.onnx.ValueInfoProto;if(L.name!=null&&(F.name=String(L.name)),L.type!=null){if(typeof L.type!="object")throw TypeError(".onnx.ValueInfoProto.type: object expected");F.type=G.onnx.TypeProto.fromObject(L.type)}return L.docString!=null&&(F.docString=String(L.docString)),F},O.toObject=function(L,F){F||(F={});var V={};return F.defaults&&(V.name="",V.type=null,V.docString=""),L.name!=null&&L.hasOwnProperty("name")&&(V.name=L.name),L.type!=null&&L.hasOwnProperty("type")&&(V.type=G.onnx.TypeProto.toObject(L.type,F)),L.docString!=null&&L.hasOwnProperty("docString")&&(V.docString=L.docString),V},O.prototype.toJSON=function(){return this.constructor.toObject(this,E.util.toJSONOptions)},O}(),M.NodeProto=function(){function O(L){if(this.input=[],this.output=[],this.attribute=[],L)for(var F=Object.keys(L),V=0;V>>3){case 1:W.input&&W.input.length||(W.input=[]),W.input.push(L.string());break;case 2:W.output&&W.output.length||(W.output=[]),W.output.push(L.string());break;case 3:W.name=L.string();break;case 4:W.opType=L.string();break;case 7:W.domain=L.string();break;case 5:W.attribute&&W.attribute.length||(W.attribute=[]),W.attribute.push(G.onnx.AttributeProto.decode(L,L.uint32()));break;case 6:W.docString=L.string();break;default:L.skipType(7&z)}}return W},O.decodeDelimited=function(L){return L instanceof P||(L=new P(L)),this.decode(L,L.uint32())},O.verify=function(L){if(typeof L!="object"||L===null)return"object expected";if(L.input!=null&&L.hasOwnProperty("input")){if(!Array.isArray(L.input))return"input: array expected";for(var F=0;F>>3){case 1:W.irVersion=L.int64();break;case 8:W.opsetImport&&W.opsetImport.length||(W.opsetImport=[]),W.opsetImport.push(G.onnx.OperatorSetIdProto.decode(L,L.uint32()));break;case 2:W.producerName=L.string();break;case 3:W.producerVersion=L.string();break;case 4:W.domain=L.string();break;case 5:W.modelVersion=L.int64();break;case 6:W.docString=L.string();break;case 7:W.graph=G.onnx.GraphProto.decode(L,L.uint32());break;case 14:W.metadataProps&&W.metadataProps.length||(W.metadataProps=[]),W.metadataProps.push(G.onnx.StringStringEntryProto.decode(L,L.uint32()));break;default:L.skipType(7&z)}}return W},O.decodeDelimited=function(L){return L instanceof P||(L=new P(L)),this.decode(L,L.uint32())},O.verify=function(L){if(typeof L!="object"||L===null)return"object expected";if(L.irVersion!=null&&L.hasOwnProperty("irVersion")&&!($.isInteger(L.irVersion)||L.irVersion&&$.isInteger(L.irVersion.low)&&$.isInteger(L.irVersion.high)))return"irVersion: integer|Long expected";if(L.opsetImport!=null&&L.hasOwnProperty("opsetImport")){if(!Array.isArray(L.opsetImport))return"opsetImport: array expected";for(var F=0;F>>0,L.irVersion.high>>>0).toNumber())),L.opsetImport){if(!Array.isArray(L.opsetImport))throw TypeError(".onnx.ModelProto.opsetImport: array expected");F.opsetImport=[];for(var V=0;V>>0,L.modelVersion.high>>>0).toNumber())),L.docString!=null&&(F.docString=String(L.docString)),L.graph!=null){if(typeof L.graph!="object")throw TypeError(".onnx.ModelProto.graph: object expected");F.graph=G.onnx.GraphProto.fromObject(L.graph)}if(L.metadataProps){if(!Array.isArray(L.metadataProps))throw TypeError(".onnx.ModelProto.metadataProps: array expected");for(F.metadataProps=[],V=0;V>>0,L.irVersion.high>>>0).toNumber():L.irVersion),L.producerName!=null&&L.hasOwnProperty("producerName")&&(V.producerName=L.producerName),L.producerVersion!=null&&L.hasOwnProperty("producerVersion")&&(V.producerVersion=L.producerVersion),L.domain!=null&&L.hasOwnProperty("domain")&&(V.domain=L.domain),L.modelVersion!=null&&L.hasOwnProperty("modelVersion")&&(typeof L.modelVersion=="number"?V.modelVersion=F.longs===String?String(L.modelVersion):L.modelVersion:V.modelVersion=F.longs===String?$.Long.prototype.toString.call(L.modelVersion):F.longs===Number?new $.LongBits(L.modelVersion.low>>>0,L.modelVersion.high>>>0).toNumber():L.modelVersion),L.docString!=null&&L.hasOwnProperty("docString")&&(V.docString=L.docString),L.graph!=null&&L.hasOwnProperty("graph")&&(V.graph=G.onnx.GraphProto.toObject(L.graph,F)),L.opsetImport&&L.opsetImport.length){V.opsetImport=[];for(var z=0;z>>3){case 1:W.key=L.string();break;case 2:W.value=L.string();break;default:L.skipType(7&z)}}return W},O.decodeDelimited=function(L){return L instanceof P||(L=new P(L)),this.decode(L,L.uint32())},O.verify=function(L){return typeof L!="object"||L===null?"object expected":L.key!=null&&L.hasOwnProperty("key")&&!$.isString(L.key)?"key: string expected":L.value!=null&&L.hasOwnProperty("value")&&!$.isString(L.value)?"value: string expected":null},O.fromObject=function(L){if(L instanceof G.onnx.StringStringEntryProto)return L;var F=new G.onnx.StringStringEntryProto;return L.key!=null&&(F.key=String(L.key)),L.value!=null&&(F.value=String(L.value)),F},O.toObject=function(L,F){F||(F={});var V={};return F.defaults&&(V.key="",V.value=""),L.key!=null&&L.hasOwnProperty("key")&&(V.key=L.key),L.value!=null&&L.hasOwnProperty("value")&&(V.value=L.value),V},O.prototype.toJSON=function(){return this.constructor.toObject(this,E.util.toJSONOptions)},O}(),M.TensorAnnotation=function(){function O(L){if(this.quantParameterTensorNames=[],L)for(var F=Object.keys(L),V=0;V>>3){case 1:W.tensorName=L.string();break;case 2:W.quantParameterTensorNames&&W.quantParameterTensorNames.length||(W.quantParameterTensorNames=[]),W.quantParameterTensorNames.push(G.onnx.StringStringEntryProto.decode(L,L.uint32()));break;default:L.skipType(7&z)}}return W},O.decodeDelimited=function(L){return L instanceof P||(L=new P(L)),this.decode(L,L.uint32())},O.verify=function(L){if(typeof L!="object"||L===null)return"object expected";if(L.tensorName!=null&&L.hasOwnProperty("tensorName")&&!$.isString(L.tensorName))return"tensorName: string expected";if(L.quantParameterTensorNames!=null&&L.hasOwnProperty("quantParameterTensorNames")){if(!Array.isArray(L.quantParameterTensorNames))return"quantParameterTensorNames: array expected";for(var F=0;F>>3){case 1:W.node&&W.node.length||(W.node=[]),W.node.push(G.onnx.NodeProto.decode(L,L.uint32()));break;case 2:W.name=L.string();break;case 5:W.initializer&&W.initializer.length||(W.initializer=[]),W.initializer.push(G.onnx.TensorProto.decode(L,L.uint32()));break;case 10:W.docString=L.string();break;case 11:W.input&&W.input.length||(W.input=[]),W.input.push(G.onnx.ValueInfoProto.decode(L,L.uint32()));break;case 12:W.output&&W.output.length||(W.output=[]),W.output.push(G.onnx.ValueInfoProto.decode(L,L.uint32()));break;case 13:W.valueInfo&&W.valueInfo.length||(W.valueInfo=[]),W.valueInfo.push(G.onnx.ValueInfoProto.decode(L,L.uint32()));break;case 14:W.quantizationAnnotation&&W.quantizationAnnotation.length||(W.quantizationAnnotation=[]),W.quantizationAnnotation.push(G.onnx.TensorAnnotation.decode(L,L.uint32()));break;default:L.skipType(7&z)}}return W},O.decodeDelimited=function(L){return L instanceof P||(L=new P(L)),this.decode(L,L.uint32())},O.verify=function(L){if(typeof L!="object"||L===null)return"object expected";if(L.node!=null&&L.hasOwnProperty("node")){if(!Array.isArray(L.node))return"node: array expected";for(var F=0;F>>3){case 1:if(W.dims&&W.dims.length||(W.dims=[]),(7&z)==2)for(var Z=L.uint32()+L.pos;L.pos>>0,L.dims[V].high>>>0).toNumber())}if(L.dataType!=null&&(F.dataType=0|L.dataType),L.segment!=null){if(typeof L.segment!="object")throw TypeError(".onnx.TensorProto.segment: object expected");F.segment=G.onnx.TensorProto.Segment.fromObject(L.segment)}if(L.floatData){if(!Array.isArray(L.floatData))throw TypeError(".onnx.TensorProto.floatData: array expected");for(F.floatData=[],V=0;V>>0,L.int64Data[V].high>>>0).toNumber())}if(L.name!=null&&(F.name=String(L.name)),L.docString!=null&&(F.docString=String(L.docString)),L.rawData!=null&&(typeof L.rawData=="string"?$.base64.decode(L.rawData,F.rawData=$.newBuffer($.base64.length(L.rawData)),0):L.rawData.length&&(F.rawData=L.rawData)),L.externalData){if(!Array.isArray(L.externalData))throw TypeError(".onnx.TensorProto.externalData: array expected");for(F.externalData=[],V=0;V>>0,L.uint64Data[V].high>>>0).toNumber(!0))}return F},O.toObject=function(L,F){F||(F={});var V={};if((F.arrays||F.defaults)&&(V.dims=[],V.floatData=[],V.int32Data=[],V.stringData=[],V.int64Data=[],V.doubleData=[],V.uint64Data=[],V.externalData=[]),F.defaults&&(V.dataType=0,V.segment=null,V.name="",F.bytes===String?V.rawData="":(V.rawData=[],F.bytes!==Array&&(V.rawData=$.newBuffer(V.rawData))),V.docString="",V.dataLocation=F.enums===String?"DEFAULT":0),L.dims&&L.dims.length){V.dims=[];for(var W=0;W>>0,L.dims[W].high>>>0).toNumber():L.dims[W]}if(L.dataType!=null&&L.hasOwnProperty("dataType")&&(V.dataType=L.dataType),L.segment!=null&&L.hasOwnProperty("segment")&&(V.segment=G.onnx.TensorProto.Segment.toObject(L.segment,F)),L.floatData&&L.floatData.length)for(V.floatData=[],W=0;W>>0,L.int64Data[W].high>>>0).toNumber():L.int64Data[W];if(L.name!=null&&L.hasOwnProperty("name")&&(V.name=L.name),L.rawData!=null&&L.hasOwnProperty("rawData")&&(V.rawData=F.bytes===String?$.base64.encode(L.rawData,0,L.rawData.length):F.bytes===Array?Array.prototype.slice.call(L.rawData):L.rawData),L.doubleData&&L.doubleData.length)for(V.doubleData=[],W=0;W>>0,L.uint64Data[W].high>>>0).toNumber(!0):L.uint64Data[W];if(L.docString!=null&&L.hasOwnProperty("docString")&&(V.docString=L.docString),L.externalData&&L.externalData.length)for(V.externalData=[],W=0;W>>3){case 1:z.begin=F.int64();break;case 2:z.end=F.int64();break;default:F.skipType(7&Z)}}return z},L.decodeDelimited=function(F){return F instanceof P||(F=new P(F)),this.decode(F,F.uint32())},L.verify=function(F){return typeof F!="object"||F===null?"object expected":F.begin!=null&&F.hasOwnProperty("begin")&&!($.isInteger(F.begin)||F.begin&&$.isInteger(F.begin.low)&&$.isInteger(F.begin.high))?"begin: integer|Long expected":F.end!=null&&F.hasOwnProperty("end")&&!($.isInteger(F.end)||F.end&&$.isInteger(F.end.low)&&$.isInteger(F.end.high))?"end: integer|Long expected":null},L.fromObject=function(F){if(F instanceof G.onnx.TensorProto.Segment)return F;var V=new G.onnx.TensorProto.Segment;return F.begin!=null&&($.Long?(V.begin=$.Long.fromValue(F.begin)).unsigned=!1:typeof F.begin=="string"?V.begin=parseInt(F.begin,10):typeof F.begin=="number"?V.begin=F.begin:typeof F.begin=="object"&&(V.begin=new $.LongBits(F.begin.low>>>0,F.begin.high>>>0).toNumber())),F.end!=null&&($.Long?(V.end=$.Long.fromValue(F.end)).unsigned=!1:typeof F.end=="string"?V.end=parseInt(F.end,10):typeof F.end=="number"?V.end=F.end:typeof F.end=="object"&&(V.end=new $.LongBits(F.end.low>>>0,F.end.high>>>0).toNumber())),V},L.toObject=function(F,V){V||(V={});var W={};if(V.defaults){if($.Long){var z=new $.Long(0,0,!1);W.begin=V.longs===String?z.toString():V.longs===Number?z.toNumber():z}else W.begin=V.longs===String?"0":0;$.Long?(z=new $.Long(0,0,!1),W.end=V.longs===String?z.toString():V.longs===Number?z.toNumber():z):W.end=V.longs===String?"0":0}return F.begin!=null&&F.hasOwnProperty("begin")&&(typeof F.begin=="number"?W.begin=V.longs===String?String(F.begin):F.begin:W.begin=V.longs===String?$.Long.prototype.toString.call(F.begin):V.longs===Number?new $.LongBits(F.begin.low>>>0,F.begin.high>>>0).toNumber():F.begin),F.end!=null&&F.hasOwnProperty("end")&&(typeof F.end=="number"?W.end=V.longs===String?String(F.end):F.end:W.end=V.longs===String?$.Long.prototype.toString.call(F.end):V.longs===Number?new $.LongBits(F.end.low>>>0,F.end.high>>>0).toNumber():F.end),W},L.prototype.toJSON=function(){return this.constructor.toObject(this,E.util.toJSONOptions)},L}(),O.DataLocation=function(){var L={},F=Object.create(L);return F[L[0]="DEFAULT"]=0,F[L[1]="EXTERNAL"]=1,F}(),O}(),M.TensorShapeProto=function(){function O(L){if(this.dim=[],L)for(var F=Object.keys(L),V=0;V>>3==1?(W.dim&&W.dim.length||(W.dim=[]),W.dim.push(G.onnx.TensorShapeProto.Dimension.decode(L,L.uint32()))):L.skipType(7&z)}return W},O.decodeDelimited=function(L){return L instanceof P||(L=new P(L)),this.decode(L,L.uint32())},O.verify=function(L){if(typeof L!="object"||L===null)return"object expected";if(L.dim!=null&&L.hasOwnProperty("dim")){if(!Array.isArray(L.dim))return"dim: array expected";for(var F=0;F>>3){case 1:Z.dimValue=V.int64();break;case 2:Z.dimParam=V.string();break;case 3:Z.denotation=V.string();break;default:V.skipType(7&H)}}return Z},L.decodeDelimited=function(V){return V instanceof P||(V=new P(V)),this.decode(V,V.uint32())},L.verify=function(V){if(typeof V!="object"||V===null)return"object expected";var W={};if(V.dimValue!=null&&V.hasOwnProperty("dimValue")&&(W.value=1,!($.isInteger(V.dimValue)||V.dimValue&&$.isInteger(V.dimValue.low)&&$.isInteger(V.dimValue.high))))return"dimValue: integer|Long expected";if(V.dimParam!=null&&V.hasOwnProperty("dimParam")){if(W.value===1)return"value: multiple values";if(W.value=1,!$.isString(V.dimParam))return"dimParam: string expected"}return V.denotation!=null&&V.hasOwnProperty("denotation")&&!$.isString(V.denotation)?"denotation: string expected":null},L.fromObject=function(V){if(V instanceof G.onnx.TensorShapeProto.Dimension)return V;var W=new G.onnx.TensorShapeProto.Dimension;return V.dimValue!=null&&($.Long?(W.dimValue=$.Long.fromValue(V.dimValue)).unsigned=!1:typeof V.dimValue=="string"?W.dimValue=parseInt(V.dimValue,10):typeof V.dimValue=="number"?W.dimValue=V.dimValue:typeof V.dimValue=="object"&&(W.dimValue=new $.LongBits(V.dimValue.low>>>0,V.dimValue.high>>>0).toNumber())),V.dimParam!=null&&(W.dimParam=String(V.dimParam)),V.denotation!=null&&(W.denotation=String(V.denotation)),W},L.toObject=function(V,W){W||(W={});var z={};return W.defaults&&(z.denotation=""),V.dimValue!=null&&V.hasOwnProperty("dimValue")&&(typeof V.dimValue=="number"?z.dimValue=W.longs===String?String(V.dimValue):V.dimValue:z.dimValue=W.longs===String?$.Long.prototype.toString.call(V.dimValue):W.longs===Number?new $.LongBits(V.dimValue.low>>>0,V.dimValue.high>>>0).toNumber():V.dimValue,W.oneofs&&(z.value="dimValue")),V.dimParam!=null&&V.hasOwnProperty("dimParam")&&(z.dimParam=V.dimParam,W.oneofs&&(z.value="dimParam")),V.denotation!=null&&V.hasOwnProperty("denotation")&&(z.denotation=V.denotation),z},L.prototype.toJSON=function(){return this.constructor.toObject(this,E.util.toJSONOptions)},L}(),O}(),M.TypeProto=function(){function O(F){if(F)for(var V=Object.keys(F),W=0;W>>3){case 1:z.tensorType=G.onnx.TypeProto.Tensor.decode(F,F.uint32());break;case 6:z.denotation=F.string();break;default:F.skipType(7&Z)}}return z},O.decodeDelimited=function(F){return F instanceof P||(F=new P(F)),this.decode(F,F.uint32())},O.verify=function(F){if(typeof F!="object"||F===null)return"object expected";if(F.tensorType!=null&&F.hasOwnProperty("tensorType")){var V=G.onnx.TypeProto.Tensor.verify(F.tensorType);if(V)return"tensorType."+V}return F.denotation!=null&&F.hasOwnProperty("denotation")&&!$.isString(F.denotation)?"denotation: string expected":null},O.fromObject=function(F){if(F instanceof G.onnx.TypeProto)return F;var V=new G.onnx.TypeProto;if(F.tensorType!=null){if(typeof F.tensorType!="object")throw TypeError(".onnx.TypeProto.tensorType: object expected");V.tensorType=G.onnx.TypeProto.Tensor.fromObject(F.tensorType)}return F.denotation!=null&&(V.denotation=String(F.denotation)),V},O.toObject=function(F,V){V||(V={});var W={};return V.defaults&&(W.denotation=""),F.tensorType!=null&&F.hasOwnProperty("tensorType")&&(W.tensorType=G.onnx.TypeProto.Tensor.toObject(F.tensorType,V),V.oneofs&&(W.value="tensorType")),F.denotation!=null&&F.hasOwnProperty("denotation")&&(W.denotation=F.denotation),W},O.prototype.toJSON=function(){return this.constructor.toObject(this,E.util.toJSONOptions)},O.Tensor=function(){function F(V){if(V)for(var W=Object.keys(V),z=0;z>>3){case 1:Z.elemType=V.int32();break;case 2:Z.shape=G.onnx.TensorShapeProto.decode(V,V.uint32());break;default:V.skipType(7&H)}}return Z},F.decodeDelimited=function(V){return V instanceof P||(V=new P(V)),this.decode(V,V.uint32())},F.verify=function(V){if(typeof V!="object"||V===null)return"object expected";if(V.elemType!=null&&V.hasOwnProperty("elemType")&&!$.isInteger(V.elemType))return"elemType: integer expected";if(V.shape!=null&&V.hasOwnProperty("shape")){var W=G.onnx.TensorShapeProto.verify(V.shape);if(W)return"shape."+W}return null},F.fromObject=function(V){if(V instanceof G.onnx.TypeProto.Tensor)return V;var W=new G.onnx.TypeProto.Tensor;if(V.elemType!=null&&(W.elemType=0|V.elemType),V.shape!=null){if(typeof V.shape!="object")throw TypeError(".onnx.TypeProto.Tensor.shape: object expected");W.shape=G.onnx.TensorShapeProto.fromObject(V.shape)}return W},F.toObject=function(V,W){W||(W={});var z={};return W.defaults&&(z.elemType=0,z.shape=null),V.elemType!=null&&V.hasOwnProperty("elemType")&&(z.elemType=V.elemType),V.shape!=null&&V.hasOwnProperty("shape")&&(z.shape=G.onnx.TensorShapeProto.toObject(V.shape,W)),z},F.prototype.toJSON=function(){return this.constructor.toObject(this,E.util.toJSONOptions)},F}(),O}(),M.OperatorSetIdProto=function(){function O(L){if(L)for(var F=Object.keys(L),V=0;V>>3){case 1:W.domain=L.string();break;case 2:W.version=L.int64();break;default:L.skipType(7&z)}}return W},O.decodeDelimited=function(L){return L instanceof P||(L=new P(L)),this.decode(L,L.uint32())},O.verify=function(L){return typeof L!="object"||L===null?"object expected":L.domain!=null&&L.hasOwnProperty("domain")&&!$.isString(L.domain)?"domain: string expected":L.version!=null&&L.hasOwnProperty("version")&&!($.isInteger(L.version)||L.version&&$.isInteger(L.version.low)&&$.isInteger(L.version.high))?"version: integer|Long expected":null},O.fromObject=function(L){if(L instanceof G.onnx.OperatorSetIdProto)return L;var F=new G.onnx.OperatorSetIdProto;return L.domain!=null&&(F.domain=String(L.domain)),L.version!=null&&($.Long?(F.version=$.Long.fromValue(L.version)).unsigned=!1:typeof L.version=="string"?F.version=parseInt(L.version,10):typeof L.version=="number"?F.version=L.version:typeof L.version=="object"&&(F.version=new $.LongBits(L.version.low>>>0,L.version.high>>>0).toNumber())),F},O.toObject=function(L,F){F||(F={});var V={};if(F.defaults)if(V.domain="",$.Long){var W=new $.Long(0,0,!1);V.version=F.longs===String?W.toString():F.longs===Number?W.toNumber():W}else V.version=F.longs===String?"0":0;return L.domain!=null&&L.hasOwnProperty("domain")&&(V.domain=L.domain),L.version!=null&&L.hasOwnProperty("version")&&(typeof L.version=="number"?V.version=F.longs===String?String(L.version):L.version:V.version=F.longs===String?$.Long.prototype.toString.call(L.version):F.longs===Number?new $.LongBits(L.version.low>>>0,L.version.high>>>0).toNumber():L.version),V},O.prototype.toJSON=function(){return this.constructor.toObject(this,E.util.toJSONOptions)},O}(),M),x.exports=G},2100:(x,c,_)=>{x.exports=_(9482)},9482:(x,c,_)=>{var T=c;function C(){T.util._configure(),T.Writer._configure(T.BufferWriter),T.Reader._configure(T.BufferReader)}T.build="minimal",T.Writer=_(1173),T.BufferWriter=_(3155),T.Reader=_(1408),T.BufferReader=_(593),T.util=_(9693),T.rpc=_(5994),T.roots=_(5054),T.configure=C,C()},1408:(x,c,_)=>{x.exports=R;var T,C=_(9693),M=C.LongBits,E=C.utf8;function P(W,z){return RangeError("index out of range: "+W.pos+" + "+(z||1)+" > "+W.len)}function R(W){this.buf=W,this.pos=0,this.len=W.length}var $,G=typeof Uint8Array<"u"?function(W){if(W instanceof Uint8Array||Array.isArray(W))return new R(W);throw Error("illegal buffer")}:function(W){if(Array.isArray(W))return new R(W);throw Error("illegal buffer")},O=function(){return C.Buffer?function(W){return(R.create=function(z){return C.Buffer.isBuffer(z)?new T(z):G(z)})(W)}:G};function L(){var W=new M(0,0),z=0;if(!(this.len-this.pos>4)){for(;z<3;++z){if(this.pos>=this.len)throw P(this);if(W.lo=(W.lo|(127&this.buf[this.pos])<<7*z)>>>0,this.buf[this.pos++]<128)return W}return W.lo=(W.lo|(127&this.buf[this.pos++])<<7*z)>>>0,W}for(;z<4;++z)if(W.lo=(W.lo|(127&this.buf[this.pos])<<7*z)>>>0,this.buf[this.pos++]<128)return W;if(W.lo=(W.lo|(127&this.buf[this.pos])<<28)>>>0,W.hi=(W.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return W;if(z=0,this.len-this.pos>4){for(;z<5;++z)if(W.hi=(W.hi|(127&this.buf[this.pos])<<7*z+3)>>>0,this.buf[this.pos++]<128)return W}else for(;z<5;++z){if(this.pos>=this.len)throw P(this);if(W.hi=(W.hi|(127&this.buf[this.pos])<<7*z+3)>>>0,this.buf[this.pos++]<128)return W}throw Error("invalid varint encoding")}function F(W,z){return(W[z-4]|W[z-3]<<8|W[z-2]<<16|W[z-1]<<24)>>>0}function V(){if(this.pos+8>this.len)throw P(this,8);return new M(F(this.buf,this.pos+=4),F(this.buf,this.pos+=4))}R.create=O(),R.prototype._slice=C.Array.prototype.subarray||C.Array.prototype.slice,R.prototype.uint32=($=4294967295,function(){if($=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128||($=($|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)||($=($|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)||($=($|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)||($=($|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128))return $;if((this.pos+=5)>this.len)throw this.pos=this.len,P(this,10);return $}),R.prototype.int32=function(){return 0|this.uint32()},R.prototype.sint32=function(){var W=this.uint32();return W>>>1^-(1&W)|0},R.prototype.bool=function(){return this.uint32()!==0},R.prototype.fixed32=function(){if(this.pos+4>this.len)throw P(this,4);return F(this.buf,this.pos+=4)},R.prototype.sfixed32=function(){if(this.pos+4>this.len)throw P(this,4);return 0|F(this.buf,this.pos+=4)},R.prototype.float=function(){if(this.pos+4>this.len)throw P(this,4);var W=C.float.readFloatLE(this.buf,this.pos);return this.pos+=4,W},R.prototype.double=function(){if(this.pos+8>this.len)throw P(this,4);var W=C.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,W},R.prototype.bytes=function(){var W=this.uint32(),z=this.pos,Z=this.pos+W;if(Z>this.len)throw P(this,W);return this.pos+=W,Array.isArray(this.buf)?this.buf.slice(z,Z):z===Z?new this.buf.constructor(0):this._slice.call(this.buf,z,Z)},R.prototype.string=function(){var W=this.bytes();return E.read(W,0,W.length)},R.prototype.skip=function(W){if(typeof W=="number"){if(this.pos+W>this.len)throw P(this,W);this.pos+=W}else do if(this.pos>=this.len)throw P(this);while(128&this.buf[this.pos++]);return this},R.prototype.skipType=function(W){switch(W){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(W=7&this.uint32())!=4;)this.skipType(W);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+W+" at offset "+this.pos)}return this},R._configure=function(W){T=W,R.create=O(),T._configure();var z=C.Long?"toLong":"toNumber";C.merge(R.prototype,{int64:function(){return L.call(this)[z](!1)},uint64:function(){return L.call(this)[z](!0)},sint64:function(){return L.call(this).zzDecode()[z](!1)},fixed64:function(){return V.call(this)[z](!0)},sfixed64:function(){return V.call(this)[z](!1)}})}},593:(x,c,_)=>{x.exports=M;var T=_(1408);(M.prototype=Object.create(T.prototype)).constructor=M;var C=_(9693);function M(E){T.call(this,E)}M._configure=function(){C.Buffer&&(M.prototype._slice=C.Buffer.prototype.slice)},M.prototype.string=function(){var E=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+E,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+E,this.len))},M._configure()},5054:x=>{x.exports={}},5994:(x,c,_)=>{c.Service=_(7948)},7948:(x,c,_)=>{x.exports=C;var T=_(9693);function C(M,E,P){if(typeof M!="function")throw TypeError("rpcImpl must be a function");T.EventEmitter.call(this),this.rpcImpl=M,this.requestDelimited=Boolean(E),this.responseDelimited=Boolean(P)}(C.prototype=Object.create(T.EventEmitter.prototype)).constructor=C,C.prototype.rpcCall=function M(E,P,R,$,G){if(!$)throw TypeError("request must be specified");var O=this;if(!G)return T.asPromise(M,O,E,P,R,$);if(O.rpcImpl)try{return O.rpcImpl(E,P[O.requestDelimited?"encodeDelimited":"encode"]($).finish(),function(L,F){if(L)return O.emit("error",L,E),G(L);if(F!==null){if(!(F instanceof R))try{F=R[O.responseDelimited?"decodeDelimited":"decode"](F)}catch(V){return O.emit("error",V,E),G(V)}return O.emit("data",F,E),G(null,F)}O.end(!0)})}catch(L){return O.emit("error",L,E),void setTimeout(function(){G(L)},0)}else setTimeout(function(){G(Error("already ended"))},0)},C.prototype.end=function(M){return this.rpcImpl&&(M||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},1945:(x,c,_)=>{x.exports=C;var T=_(9693);function C(R,$){this.lo=R>>>0,this.hi=$>>>0}var M=C.zero=new C(0,0);M.toNumber=function(){return 0},M.zzEncode=M.zzDecode=function(){return this},M.length=function(){return 1};var E=C.zeroHash="\0\0\0\0\0\0\0\0";C.fromNumber=function(R){if(R===0)return M;var $=R<0;$&&(R=-R);var G=R>>>0,O=(R-G)/4294967296>>>0;return $&&(O=~O>>>0,G=~G>>>0,++G>4294967295&&(G=0,++O>4294967295&&(O=0))),new C(G,O)},C.from=function(R){if(typeof R=="number")return C.fromNumber(R);if(T.isString(R)){if(!T.Long)return C.fromNumber(parseInt(R,10));R=T.Long.fromString(R)}return R.low||R.high?new C(R.low>>>0,R.high>>>0):M},C.prototype.toNumber=function(R){if(!R&&this.hi>>>31){var $=1+~this.lo>>>0,G=~this.hi>>>0;return $||(G=G+1>>>0),-($+4294967296*G)}return this.lo+4294967296*this.hi},C.prototype.toLong=function(R){return T.Long?new T.Long(0|this.lo,0|this.hi,Boolean(R)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(R)}};var P=String.prototype.charCodeAt;C.fromHash=function(R){return R===E?M:new C((P.call(R,0)|P.call(R,1)<<8|P.call(R,2)<<16|P.call(R,3)<<24)>>>0,(P.call(R,4)|P.call(R,5)<<8|P.call(R,6)<<16|P.call(R,7)<<24)>>>0)},C.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},C.prototype.zzEncode=function(){var R=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^R)>>>0,this.lo=(this.lo<<1^R)>>>0,this},C.prototype.zzDecode=function(){var R=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^R)>>>0,this.hi=(this.hi>>>1^R)>>>0,this},C.prototype.length=function(){var R=this.lo,$=(this.lo>>>28|this.hi<<4)>>>0,G=this.hi>>>24;return G===0?$===0?R<16384?R<128?1:2:R<2097152?3:4:$<16384?$<128?5:6:$<2097152?7:8:G<128?9:10}},9693:function(x,c,_){var T=c;function C(E,P,R){for(var $=Object.keys(P),G=0;G<$.length;++G)E[$[G]]!==void 0&&R||(E[$[G]]=P[$[G]]);return E}function M(E){function P(R,$){if(!(this instanceof P))return new P(R,$);Object.defineProperty(this,"message",{get:function(){return R}}),Error.captureStackTrace?Error.captureStackTrace(this,P):Object.defineProperty(this,"stack",{value:new Error().stack||""}),$&&C(this,$)}return(P.prototype=Object.create(Error.prototype)).constructor=P,Object.defineProperty(P.prototype,"name",{get:function(){return E}}),P.prototype.toString=function(){return this.name+": "+this.message},P}T.asPromise=_(4537),T.base64=_(7419),T.EventEmitter=_(9211),T.float=_(945),T.inquire=_(7199),T.utf8=_(4997),T.pool=_(6662),T.LongBits=_(1945),T.isNode=Boolean(_.g!==void 0&&_.g&&_.g.process&&_.g.process.versions&&_.g.process.versions.node),T.global=T.isNode&&_.g||typeof window<"u"&&window||typeof self<"u"&&self||this,T.emptyArray=Object.freeze?Object.freeze([]):[],T.emptyObject=Object.freeze?Object.freeze({}):{},T.isInteger=Number.isInteger||function(E){return typeof E=="number"&&isFinite(E)&&Math.floor(E)===E},T.isString=function(E){return typeof E=="string"||E instanceof String},T.isObject=function(E){return E&&typeof E=="object"},T.isset=T.isSet=function(E,P){var R=E[P];return!(R==null||!E.hasOwnProperty(P))&&(typeof R!="object"||(Array.isArray(R)?R.length:Object.keys(R).length)>0)},T.Buffer=function(){try{var E=T.inquire("buffer").Buffer;return E.prototype.utf8Write?E:null}catch{return null}}(),T._Buffer_from=null,T._Buffer_allocUnsafe=null,T.newBuffer=function(E){return typeof E=="number"?T.Buffer?T._Buffer_allocUnsafe(E):new T.Array(E):T.Buffer?T._Buffer_from(E):typeof Uint8Array>"u"?E:new Uint8Array(E)},T.Array=typeof Uint8Array<"u"?Uint8Array:Array,T.Long=T.global.dcodeIO&&T.global.dcodeIO.Long||T.global.Long||T.inquire("long"),T.key2Re=/^true|false|0|1$/,T.key32Re=/^-?(?:0|[1-9][0-9]*)$/,T.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,T.longToHash=function(E){return E?T.LongBits.from(E).toHash():T.LongBits.zeroHash},T.longFromHash=function(E,P){var R=T.LongBits.fromHash(E);return T.Long?T.Long.fromBits(R.lo,R.hi,P):R.toNumber(Boolean(P))},T.merge=C,T.lcFirst=function(E){return E.charAt(0).toLowerCase()+E.substring(1)},T.newError=M,T.ProtocolError=M("ProtocolError"),T.oneOfGetter=function(E){for(var P={},R=0;R-1;--G)if(P[$[G]]===1&&this[$[G]]!==void 0&&this[$[G]]!==null)return $[G]}},T.oneOfSetter=function(E){return function(P){for(var R=0;R{x.exports=O;var T,C=_(9693),M=C.LongBits,E=C.base64,P=C.utf8;function R(H,Y,U){this.fn=H,this.len=Y,this.next=void 0,this.val=U}function $(){}function G(H){this.head=H.head,this.tail=H.tail,this.len=H.len,this.next=H.states}function O(){this.len=0,this.head=new R($,0,0),this.tail=this.head,this.states=null}var L=function(){return C.Buffer?function(){return(O.create=function(){return new T})()}:function(){return new O}};function F(H,Y,U){Y[U]=255&H}function V(H,Y){this.len=H,this.next=void 0,this.val=Y}function W(H,Y,U){for(;H.hi;)Y[U++]=127&H.lo|128,H.lo=(H.lo>>>7|H.hi<<25)>>>0,H.hi>>>=7;for(;H.lo>127;)Y[U++]=127&H.lo|128,H.lo=H.lo>>>7;Y[U++]=H.lo}function z(H,Y,U){Y[U]=255&H,Y[U+1]=H>>>8&255,Y[U+2]=H>>>16&255,Y[U+3]=H>>>24}O.create=L(),O.alloc=function(H){return new C.Array(H)},C.Array!==Array&&(O.alloc=C.pool(O.alloc,C.Array.prototype.subarray)),O.prototype._push=function(H,Y,U){return this.tail=this.tail.next=new R(H,Y,U),this.len+=Y,this},V.prototype=Object.create(R.prototype),V.prototype.fn=function(H,Y,U){for(;H>127;)Y[U++]=127&H|128,H>>>=7;Y[U]=H},O.prototype.uint32=function(H){return this.len+=(this.tail=this.tail.next=new V((H>>>=0)<128?1:H<16384?2:H<2097152?3:H<268435456?4:5,H)).len,this},O.prototype.int32=function(H){return H<0?this._push(W,10,M.fromNumber(H)):this.uint32(H)},O.prototype.sint32=function(H){return this.uint32((H<<1^H>>31)>>>0)},O.prototype.uint64=function(H){var Y=M.from(H);return this._push(W,Y.length(),Y)},O.prototype.int64=O.prototype.uint64,O.prototype.sint64=function(H){var Y=M.from(H).zzEncode();return this._push(W,Y.length(),Y)},O.prototype.bool=function(H){return this._push(F,1,H?1:0)},O.prototype.fixed32=function(H){return this._push(z,4,H>>>0)},O.prototype.sfixed32=O.prototype.fixed32,O.prototype.fixed64=function(H){var Y=M.from(H);return this._push(z,4,Y.lo)._push(z,4,Y.hi)},O.prototype.sfixed64=O.prototype.fixed64,O.prototype.float=function(H){return this._push(C.float.writeFloatLE,4,H)},O.prototype.double=function(H){return this._push(C.float.writeDoubleLE,8,H)};var Z=C.Array.prototype.set?function(H,Y,U){Y.set(H,U)}:function(H,Y,U){for(var j=0;j>>0;if(!Y)return this._push(F,1,0);if(C.isString(H)){var U=O.alloc(Y=E.length(H));E.decode(H,U,0),H=U}return this.uint32(Y)._push(Z,Y,H)},O.prototype.string=function(H){var Y=P.length(H);return Y?this.uint32(Y)._push(P.write,Y,H):this._push(F,1,0)},O.prototype.fork=function(){return this.states=new G(this),this.head=this.tail=new R($,0,0),this.len=0,this},O.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new R($,0,0),this.len=0),this},O.prototype.ldelim=function(){var H=this.head,Y=this.tail,U=this.len;return this.reset().uint32(U),U&&(this.tail.next=H.next,this.tail=Y,this.len+=U),this},O.prototype.finish=function(){for(var H=this.head.next,Y=this.constructor.alloc(this.len),U=0;H;)H.fn(H.val,Y,U),U+=H.len,H=H.next;return Y},O._configure=function(H){T=H,O.create=L(),T._configure()}},3155:(x,c,_)=>{x.exports=M;var T=_(1173);(M.prototype=Object.create(T.prototype)).constructor=M;var C=_(9693);function M(){T.call(this)}function E(P,R,$){P.length<40?C.utf8.write(P,R,$):R.utf8Write?R.utf8Write(P,$):R.write(P,$)}M._configure=function(){M.alloc=C._Buffer_allocUnsafe,M.writeBytesBuffer=C.Buffer&&C.Buffer.prototype instanceof Uint8Array&&C.Buffer.prototype.set.name==="set"?function(P,R,$){R.set(P,$)}:function(P,R,$){if(P.copy)P.copy(R,$,0,P.length);else for(var G=0;G>>0;return this.uint32(R),R&&this._push(M.writeBytesBuffer,R,P),this},M.prototype.string=function(P){var R=C.Buffer.byteLength(P);return this.uint32(R),R&&this._push(E,R,P),this},M._configure()},7714:(x,c,_)=>{c.R=void 0;const T=_(6919),C=_(7448);c.R=new class{async init(){}async createSessionHandler(M,E){const P=new T.Session(E);return await P.loadModel(M),new C.OnnxjsSessionHandler(P)}}},4200:(x,c,_)=>{c.c8=c.rX=void 0;const T=_(1670),C=_(5381),M=_(2157),E=_(2306);c.rX=()=>{if((typeof T.env.wasm.initTimeout!="number"||T.env.wasm.initTimeout<0)&&(T.env.wasm.initTimeout=0),typeof T.env.wasm.simd!="boolean"&&(T.env.wasm.simd=!0),typeof T.env.wasm.proxy!="boolean"&&(T.env.wasm.proxy=!1),typeof T.env.wasm.numThreads!="number"||!Number.isInteger(T.env.wasm.numThreads)||T.env.wasm.numThreads<=0){const P=typeof navigator>"u"?(0,C.cpus)().length:navigator.hardwareConcurrency;T.env.wasm.numThreads=Math.min(4,Math.ceil((P||1)/2))}},c.c8=new class{async init(){(0,c.rX)(),await(0,M.initWasm)()}async createSessionHandler(P,R){const $=new E.OnnxruntimeWebAssemblySessionHandler;return await $.loadModel(P,R),Promise.resolve($)}}},6018:function(x,c,_){var T=this&&this.__createBinding||(Object.create?function(E,P,R,$){$===void 0&&($=R);var G=Object.getOwnPropertyDescriptor(P,R);G&&!("get"in G?!P.__esModule:G.writable||G.configurable)||(G={enumerable:!0,get:function(){return P[R]}}),Object.defineProperty(E,$,G)}:function(E,P,R,$){$===void 0&&($=R),E[$]=P[R]}),C=this&&this.__exportStar||function(E,P){for(var R in E)R==="default"||Object.prototype.hasOwnProperty.call(P,R)||T(P,E,R)};Object.defineProperty(c,"__esModule",{value:!0}),C(_(1670),c);const M=_(1670);{const E=_(7714).R;(0,M.registerBackend)("webgl",E,-10)}{const E=_(4200).c8;(0,M.registerBackend)("cpu",E,10),(0,M.registerBackend)("wasm",E,10),(0,M.registerBackend)("xnnpack",E,9)}},246:(x,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createAttributeWithCacheKey=void 0;class _{constructor(C){Object.assign(this,C)}get cacheKey(){return this._cacheKey||(this._cacheKey=Object.getOwnPropertyNames(this).sort().map(C=>`${this[C]}`).join(";")),this._cacheKey}}c.createAttributeWithCacheKey=T=>new _(T)},7778:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Attribute=void 0;const T=_(1446),C=_(9395),M=_(9162),E=_(2517);var P=C.onnxruntime.experimental.fbs;class R{constructor(G){if(this._attributes=new Map,G!=null){for(const O of G)O instanceof T.onnx.AttributeProto?this._attributes.set(O.name,[R.getValue(O),R.getType(O)]):O instanceof P.Attribute&&this._attributes.set(O.name(),[R.getValue(O),R.getType(O)]);if(this._attributes.sizeM.Tensor.fromProto(F));if(G instanceof P.Attribute)return L.map(F=>M.Tensor.fromOrtTensor(F))}if(O===T.onnx.AttributeProto.AttributeType.STRING&&G instanceof T.onnx.AttributeProto){const F=L;return(0,E.decodeUtf8String)(F)}return O===T.onnx.AttributeProto.AttributeType.STRINGS&&G instanceof T.onnx.AttributeProto?L.map(E.decodeUtf8String):L}static getValueNoCheck(G){return G instanceof T.onnx.AttributeProto?this.getValueNoCheckFromOnnxFormat(G):this.getValueNoCheckFromOrtFormat(G)}static getValueNoCheckFromOnnxFormat(G){switch(G.type){case T.onnx.AttributeProto.AttributeType.FLOAT:return G.f;case T.onnx.AttributeProto.AttributeType.INT:return G.i;case T.onnx.AttributeProto.AttributeType.STRING:return G.s;case T.onnx.AttributeProto.AttributeType.TENSOR:return G.t;case T.onnx.AttributeProto.AttributeType.GRAPH:return G.g;case T.onnx.AttributeProto.AttributeType.FLOATS:return G.floats;case T.onnx.AttributeProto.AttributeType.INTS:return G.ints;case T.onnx.AttributeProto.AttributeType.STRINGS:return G.strings;case T.onnx.AttributeProto.AttributeType.TENSORS:return G.tensors;case T.onnx.AttributeProto.AttributeType.GRAPHS:return G.graphs;default:throw new Error(`unsupported attribute type: ${T.onnx.AttributeProto.AttributeType[G.type]}`)}}static getValueNoCheckFromOrtFormat(G){switch(G.type()){case P.AttributeType.FLOAT:return G.f();case P.AttributeType.INT:return G.i();case P.AttributeType.STRING:return G.s();case P.AttributeType.TENSOR:return G.t();case P.AttributeType.GRAPH:return G.g();case P.AttributeType.FLOATS:return G.floatsArray();case P.AttributeType.INTS:{const O=[];for(let L=0;L{Object.defineProperty(c,"__esModule",{value:!0}),c.resolveBackend=c.backend=void 0;const T=_(5038),C=new Map;async function M(E){const P=c.backend;if(P[E]!==void 0&&function(R){const $=R;return"initialize"in $&&typeof $.initialize=="function"&&"createSessionHandler"in $&&typeof $.createSessionHandler=="function"&&"dispose"in $&&typeof $.dispose=="function"}(P[E])){const R=P[E];let $=R.initialize();if(typeof $=="object"&&"then"in $&&($=await $),$)return C.set(E,R),R}}c.backend={webgl:new T.WebGLBackend},c.resolveBackend=async function E(P){if(!P)return E(["webgl"]);{const R=typeof P=="string"?[P]:P;for(const $ of R){const G=C.get($);if(G)return G;const O=await M($);if(O)return O}}throw new Error("no available backend to use")}},5038:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.WebGLBackend=void 0;const T=_(1670),C=_(6231),M=_(6416),E=_(7305);c.WebGLBackend=class{get contextId(){return T.env.webgl.contextId}set contextId(P){T.env.webgl.contextId=P}get matmulMaxBatchSize(){return T.env.webgl.matmulMaxBatchSize}set matmulMaxBatchSize(P){T.env.webgl.matmulMaxBatchSize=P}get textureCacheMode(){return T.env.webgl.textureCacheMode}set textureCacheMode(P){T.env.webgl.textureCacheMode=P}get pack(){return T.env.webgl.pack}set pack(P){T.env.webgl.pack=P}get async(){return T.env.webgl.async}set async(P){T.env.webgl.async=P}initialize(){try{return this.glContext=(0,E.createWebGLContext)(this.contextId),typeof this.matmulMaxBatchSize!="number"&&(this.matmulMaxBatchSize=16),typeof this.textureCacheMode!="string"&&(this.textureCacheMode="full"),typeof this.pack!="boolean"&&(this.pack=!1),typeof this.async!="boolean"&&(this.async=!1),C.Logger.setWithEnv(T.env),C.Logger.verbose("WebGLBackend",`Created WebGLContext: ${typeof this.glContext} with matmulMaxBatchSize: ${this.matmulMaxBatchSize}; textureCacheMode: ${this.textureCacheMode}; pack: ${this.pack}; async: ${this.async}.`),!0}catch(P){return C.Logger.warning("WebGLBackend",`Unable to initialize WebGLBackend. ${P}`),!1}}createSessionHandler(P){return new M.WebGLSessionHandler(this,P)}dispose(){this.glContext.dispose()}}},5107:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CoordsGlslLib=void 0;const T=_(2517),C=_(8520),M=_(5060),E=_(7859),P=_(9390);class R extends C.GlslLib{constructor(G){super(G)}getFunctions(){return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.offsetToCoords()),this.coordsToOffset()),this.toVec()),this.valueFrom()),this.getCommonUtilFuncs()),this.getInputsSamplingSnippets()),this.getOutputSamplingSnippet())}getCustomTypes(){return{}}offsetToCoords(){return{offsetToCoords:new C.GlslLibRoutine(` vec2 offsetToCoords(int offset, int width, int height) { int t = offset / width; int s = offset - t*width; vec2 coords = (vec2(s,t) + vec2(0.5,0.5)) / vec2(width, height); return coords; } `)}}coordsToOffset(){return{coordsToOffset:new C.GlslLibRoutine(` int coordsToOffset(vec2 coords, int width, int height) { float s = coords.s * float(width); float t = coords.t * float(height); int offset = int(t) * width + int(s); return offset; } `)}}getOutputSamplingSnippet(){const G=this.context.outputTextureLayout;return G.isPacked?this.getPackedOutputSamplingSnippet(G):this.getUnpackedOutputSamplingSnippet(G)}getPackedOutputSamplingSnippet(G){const O=G.unpackedShape,L=[G.width,G.height],F={},V="getOutputCoords";switch(O.length){case 0:F[V]=this.getOutputScalarCoords();break;case 1:F[V]=this.getOutputPacked1DCoords(O,L);break;case 2:F[V]=this.getOutputPacked2DCoords(O,L);break;case 3:F[V]=this.getOutputPacked3DCoords(O,L);break;default:F[V]=this.getOutputPackedNDCoords(O,L)}const W=` void setOutput(vec4 val) { ${(0,M.getGlsl)(this.context.glContext.version).output} = val; } `;return F.floatTextureSetRGBA=new C.GlslLibRoutine(W),F}getUnpackedOutputSamplingSnippet(G){const O=G.unpackedShape,L=[G.width,G.height],F={},V="getOutputCoords";switch(O.length){case 0:F[V]=this.getOutputScalarCoords();break;case 1:F[V]=this.getOutputUnpacked1DCoords(O,L);break;case 2:F[V]=this.getOutputUnpacked2DCoords(O,L);break;case 3:F[V]=this.getOutputUnpacked3DCoords(O,L);break;case 4:F[V]=this.getOutputUnpacked4DCoords(O,L);break;case 5:F[V]=this.getOutputUnpacked5DCoords(O,L);break;case 6:F[V]=this.getOutputUnpacked6DCoords(O,L);break;default:throw new Error(`Unsupported output dimensionality: ${O.length}`)}const W=` void setOutput(float val) { ${(0,M.getGlsl)(this.context.glContext.version).output} = vec4(val, 0, 0, 0); } `;return F.floatTextureSetR=new C.GlslLibRoutine(W),F}getOutputScalarCoords(){return new C.GlslLibRoutine(` int getOutputCoords() { return 0; } `)}getOutputPacked1DCoords(G,O){const L=O;let F="";return L[0]===1?(F=` int getOutputCoords() { return 2 * int(TexCoords.y * ${L[1]}.0); } `,new C.GlslLibRoutine(F)):L[1]===1?(F=` int getOutputCoords() { return 2 * int(TexCoords.x * ${L[0]}.0); } `,new C.GlslLibRoutine(F)):(F=` int getOutputCoords() { ivec2 resTexRC = ivec2(TexCoords.xy * vec2(${L[0]}, ${L[1]})); return 2 * (resTexRC.y * ${L[0]} + resTexRC.x); } `,new C.GlslLibRoutine(F))}getOutputPacked2DCoords(G,O){let L="";if(T.ArrayUtil.arraysEqual(G,O))return L=` ivec2 getOutputCoords() { return 2 * ivec2(TexCoords.xy * vec2(${O[0]}, ${O[1]})); } `,new C.GlslLibRoutine(L);const F=O,V=Math.ceil(G[1]/2);return L=` ivec2 getOutputCoords() { ivec2 resTexRC = ivec2(TexCoords.xy * vec2(${F[0]}, ${F[1]})); int index = resTexRC.y * ${F[0]} + resTexRC.x; // reverse r and c order for packed texture int r = imod(index, ${V}) * 2; int c = 2 * (index / ${V}); return ivec2(r, c); } `,new C.GlslLibRoutine(L)}getOutputPacked3DCoords(G,O){const L=[O[0],O[1]],F=Math.ceil(G[2]/2),V=F*Math.ceil(G[1]/2),W=` ivec3 getOutputCoords() { ivec2 resTexRC = ivec2(TexCoords.xy * vec2(${L[0]}, ${L[1]})); int index = resTexRC.y * ${L[0]} + resTexRC.x; int b = index / ${V}; index -= b * ${V}; // reverse r and c order for packed texture int r = imod(index, ${F}) * 2; int c = 2 * (index / ${F}); return ivec3(b, r, c); } `;return new C.GlslLibRoutine(W)}getOutputPackedNDCoords(G,O){const L=[O[0],O[1]],F=Math.ceil(G[G.length-1]/2),V=F*Math.ceil(G[G.length-2]/2);let W=V,z="",Z="b, r, c";for(let Y=2;Y=0;--Z)V[Z]=V[Z+1]*G[Z+1];const W=["r","c","d"],z=V.map((Z,H)=>`int ${W[H]} = index / ${Z}; ${H===V.length-1?`int ${W[H+1]} = index - ${W[H]} * ${Z}`:`index -= ${W[H]} * ${Z}`};`).join("");return L=` ivec3 getOutputCoords() { ivec2 resTexRC = ivec2(TexCoords.xy * vec2(${O[0]}, ${O[1]})); int index = resTexRC.y * ${O[0]} + resTexRC.x; ${z} return ivec3(r, c, d); } `,new C.GlslLibRoutine(L)}getOutputUnpacked4DCoords(G,O){let L="";const F=G.length;let V=null;F<2&&(V=[]),V=new Array(F-1),V[F-2]=G[F-1];for(let Z=F-3;Z>=0;--Z)V[Z]=V[Z+1]*G[Z+1];const W=["r","c","d","d2"],z=V.map((Z,H)=>`int ${W[H]} = index / ${Z}; ${H===V.length-1?`int ${W[H+1]} = index - ${W[H]} * ${Z}`:`index -= ${W[H]} * ${Z}`};`).join("");return L=` ivec4 getOutputCoords() { ivec2 resTexRC = ivec2(TexCoords.xy * vec2(${O[0]}, ${O[1]})); int index = resTexRC.y * ${O[0]} + resTexRC.x; ${z} return ivec4(r, c, d, d2); } `,new C.GlslLibRoutine(L)}getOutputUnpacked5DCoords(G,O){let L="";const F=G.length;let V=null;F<2&&(V=[]),V=new Array(F-1),V[F-2]=G[F-1];for(let Z=F-3;Z>=0;--Z)V[Z]=V[Z+1]*G[Z+1];const W=["r","c","d","d2","d3"],z=V.map((Z,H)=>`int ${W[H]} = index / ${Z}; ${H===V.length-1?`int ${W[H+1]} = index - ${W[H]} * ${Z}`:`index -= ${W[H]} * ${Z}`};`).join("");return L=` ivec5 getOutputCoords() { ivec2 resTexRC = ivec2(TexCoords.xy * vec2(${O[0]}, ${O[1]})); int index = resTexRC.y * ${O[0]} + resTexRC.x; ${z} return ivec5(r, c, d, d2, d3); } `,new C.GlslLibRoutine(L)}getOutputUnpacked6DCoords(G,O){let L="";const F=G.length;let V=null;F<2&&(V=[]),V=new Array(F-1),V[F-2]=G[F-1];for(let Z=F-3;Z>=0;--Z)V[Z]=V[Z+1]*G[Z+1];const W=["r","c","d","d2","d3","d4"],z=V.map((Z,H)=>`int ${W[H]} = index / ${Z}; ${H===V.length-1?`int ${W[H+1]} = index - ${W[H]} * ${Z}`:`index -= ${W[H]} * ${Z}`};`).join("");return L=` ivec6 getOutputCoords() { ivec2 resTexRC = ivec2(TexCoords.xy * vec2(${O[0]}, ${O[1]})); int index = resTexRC.y * ${O[0]} + resTexRC.x; ${z} return ivec6(r, c, d, d2, d3, d4); } `,new C.GlslLibRoutine(L)}getCommonUtilFuncs(){const G={};let O="uvFromFlat";G[O]=new C.GlslLibRoutine(` vec2 uvFromFlat(int texNumR, int texNumC, int index) { int texC = index / texNumR; int texR = index - texC * texNumR; // TODO: swap texR, texC order in following function so row is corresponding to u and column is corresponding to // v. return (vec2(texR, texC) + halfCR) / vec2(texNumR, texNumC); } `),O="packedUVfrom1D",G[O]=new C.GlslLibRoutine(` vec2 packedUVfrom1D(int texNumR, int texNumC, int index) { int texelIndex = index / 2; int texR = texelIndex / texNumC; int texC = texelIndex - texR * texNumC; return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); } `),O="packedUVfrom2D",G[O]=new C.GlslLibRoutine(` vec2 packedUVfrom2D(int texNumR, int texNumC, int texelsInLogicalRow, int row, int col) { int texelIndex = (row / 2) * texelsInLogicalRow + (col / 2); int texR = texelIndex / texNumC; int texC = texelIndex - texR * texNumC; return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); } `),O="packedUVfrom3D",G[O]=new C.GlslLibRoutine(` vec2 packedUVfrom3D(int texNumR, int texNumC, int texelsInBatch, int texelsInLogicalRow, int b, int row, int col) { int index = b * texelsInBatch + (row / 2) * texelsInLogicalRow + (col / 2); int texR = index / texNumC; int texC = index - texR * texNumC; return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); } `),O="sampleTexture";const L=(0,M.getGlsl)(this.context.glContext.version);return G[O]=new C.GlslLibRoutine(` float sampleTexture(sampler2D textureSampler, vec2 uv) { return ${L.texture2D}(textureSampler, uv).r; }`),G}getInputsSamplingSnippets(){const G={},O=this.context.outputTextureLayout;return this.context.programInfo.inputNames.forEach((L,F)=>{const V=this.context.inputTextureLayouts[F],W=(0,P.generateShaderFuncNameFromInputSamplerName)(L);V.isPacked?G[W]=this.getPackedSamplerFromInput(W,L,V):G[W]=this.getUnpackedSamplerFromInput(W,L,V);const z=(0,P.generateShaderFuncNameFromInputSamplerNameAtOutCoords)(L);V.unpackedShape.length<=O.unpackedShape.length&&(V.isPacked?G[z]=this.getPackedSamplerAtOutputCoords(z,V,O,L):G[z]=this.getUnpackedSamplerAtOutputCoords(z,V,O,L))}),G}getPackedSamplerAtOutputCoords(G,O,L,F){const V=O.unpackedShape,W=L.unpackedShape,z=F,Z=(0,P.generateShaderFuncNameFromInputSamplerName)(z),H=V.length,Y=W.length,U=T.BroadcastUtil.getBroadcastDims(V,W),j=(0,P.getCoordsDataType)(Y),X=Y-H;let K;const q=(0,P.getGlChannels)();K=H===0?"":Y<2&&U.length>=1?"coords = 0;":U.map(ae=>`coords.${q[ae+X]} = 0;`).join(` `);let J="";J=Y<2&&H>0?"coords":V.map((ae,ne)=>`coords.${q[ne+X]}`).join(", ");let Q="return outputValue;";const ee=T.ShapeUtil.size(V)===1,re=T.ShapeUtil.size(W)===1;if(H!==1||ee||re){if(ee&&!re)Q=Y===1?` return vec4(outputValue.x, outputValue.x, 0., 0.); `:` return vec4(outputValue.x); `;else if(U.length){const ae=H-2,ne=H-1;U.indexOf(ae)>-1&&U.indexOf(ne)>-1?Q="return vec4(outputValue.x);":U.indexOf(ae)>-1?Q="return vec4(outputValue.x, outputValue.y, outputValue.x, outputValue.y);":U.indexOf(ne)>-1&&(Q="return vec4(outputValue.xx, outputValue.zz);")}}else Q=` return vec4(outputValue.xy, outputValue.xy); `;const ie=` vec4 ${G}() { ${j} coords = getOutputCoords(); int lastDim = coords.${q[Y-1]}; coords.${q[Y-1]} = coords.${q[Y-2]}; coords.${q[Y-2]} = lastDim; ${K} vec4 outputValue = ${Z}(${J}); ${Q} } `;return new C.GlslLibRoutine(ie,["coordinates.getOutputCoords"])}getUnpackedSamplerAtOutputCoords(G,O,L,F){const V=[L.width,L.height],W=[O.width,O.height],z=O.unpackedShape.length,Z=L.unpackedShape.length,H=O.unpackedShape,Y=L.unpackedShape,U=(0,P.generateShaderFuncNameFromInputSamplerName)(F);if(z===Z&&T.ArrayUtil.arraysEqual(W,V)){const re=` float ${G}() { return sampleTexture(${F}, TexCoords); } `;return new C.GlslLibRoutine(re,["coordinates.sampleTexture"])}const j=(0,P.getCoordsDataType)(Z),X=T.BroadcastUtil.getBroadcastDims(H,Y),K=Z-z;let q;const J=(0,P.getGlChannels)();q=z===0?"":Z<2&&X.length>=1?"coords = 0;":X.map(re=>`coords.${J[re+K]} = 0;`).join(` `);let Q="";Q=Z<2&&z>0?"coords":O.unpackedShape.map((re,ie)=>`coords.${J[ie+K]}`).join(", ");const ee=` float ${G}() { ${j} coords = getOutputCoords(); ${q} return ${U}(${Q}); } `;return new C.GlslLibRoutine(ee,["coordinates.getOutputCoords"])}getPackedSamplerFromInput(G,O,L){switch(L.unpackedShape.length){case 0:return this.getPackedSamplerScalar(G,O);case 1:return this.getPackedSampler1D(G,O,L);case 2:return this.getPackedSampler2D(G,O,L);case 3:return this.getPackedSampler3D(G,O,L);default:return this.getPackedSamplerND(G,O,L)}}getUnpackedSamplerFromInput(G,O,L){const F=L.unpackedShape;switch(F.length){case 0:return this.getUnpackedSamplerScalar(G,O,L);case 1:return this.getUnpackedSampler1D(G,O,L);case 2:return this.getUnpackedSampler2D(G,O,L);case 3:return this.getUnpackedSampler3D(G,O,L);case 4:return this.getUnpackedSampler4D(G,O,L);case 5:return this.getUnpackedSampler5D(G,O,L);case 6:return this.getUnpackedSampler6D(G,O,L);default:throw new Error(`Unsupported dimension ${F.length}-D`)}}getPackedSamplerScalar(G,O){const L=` vec4 ${G}() { return ${(0,M.getGlsl)(this.context.glContext.version).texture2D}(${O}, halfCR); } `;return new C.GlslLibRoutine(L)}getPackedSampler1D(G,O,L){const F=[L.width,L.height],V=[F[1],F[0]],W=(0,M.getGlsl)(this.context.glContext.version),z=`vec4 ${G}(int index) { vec2 uv = packedUVfrom1D( ${V[0]}, ${V[1]}, index); return ${W.texture2D}(${O}, uv); }`;return new C.GlslLibRoutine(z,["coordinates.packedUVfrom1D"])}getPackedSampler2D(G,O,L){const F=L.unpackedShape,V=[L.width,L.height],W=(0,M.getGlsl)(this.context.glContext.version),z=V[0],Z=V[1];if(V!=null&&T.ArrayUtil.arraysEqual(F,V)){const j=`vec4 ${G}(int row, int col) { vec2 uv = (vec2(col, row) + halfCR) / vec2(${Z}.0, ${z}.0); return ${W.texture2D}(${O}, uv); }`;return new C.GlslLibRoutine(j)}const H=V,Y=Math.ceil(F[1]/2),U=`vec4 ${G}(int row, int col) { vec2 uv = packedUVfrom2D(${H[1]}, ${H[0]}, ${Y}, row, col); return ${W.texture2D}(${O}, uv); }`;return new C.GlslLibRoutine(U,["coordinates.packedUVfrom2D"])}getPackedSampler3D(G,O,L){const F=L.unpackedShape,V=[L.width,L.height],W=[V[0],V[1]],z=(0,M.getGlsl)(this.context.glContext.version);if(F[0]===1){const j=F.slice(1),X=[1,2],K=(0,P.squeezeInputShape)(F,j),q=["b","row","col"],J=JSON.parse(JSON.stringify(L));J.unpackedShape=K;const Q=this.getPackedSamplerFromInput(G,O,J),ee=`${Q.routineBody} vec4 ${G}(int b, int row, int col) { return ${G}(${(0,P.getSqueezedParams)(q,X)}); } `;return new C.GlslLibRoutine(ee,Q.dependencies)}const Z=W[0],H=W[1],Y=Math.ceil(F[2]/2),U=`vec4 ${G}(int b, int row, int col) { vec2 uv = packedUVfrom3D( ${H}, ${Z}, ${Y*Math.ceil(F[1]/2)}, ${Y}, b, row, col); return ${z.texture2D}(${O}, uv);}`;return new C.GlslLibRoutine(U,["coordinates.packedUVfrom3D"])}getPackedSamplerND(G,O,L){const F=L.unpackedShape,V=F.length,W=[L.width,L.height],z=(0,M.getGlsl)(this.context.glContext.version),Z=[W[0],W[1]],H=Z[1],Y=Z[0],U=Math.ceil(F[V-1]/2);let j=U*Math.ceil(F[V-2]/2),X="int b, int row, int col",K=`b * ${j} + (row / 2) * ${U} + (col / 2)`;for(let J=2;J{const F=this.context.inputTextureLayouts[L],V=(F.unpackedShape.length>0?F.unpackedShape:F.shape).length;let W=`_${O}`;G[W]=new C.GlslLibRoutine(this.getValueFromSingle(O,V,F.width,F.height,!1),[`shapeUtils.indicesToOffset${W}`,"coordinates.offsetToCoords","fragcolor.getColorAsFloat"]),W+="_T",G[W]=new C.GlslLibRoutine(this.getValueFromSingle(O,V,F.width,F.height,!0),[`shapeUtils.indicesToOffset${W}`,"coordinates.offsetToCoords","fragcolor.getColorAsFloat"])}),G}getValueFromSingle(G,O,L,F,V){let W=`_${G}`;return V&&(W+="_T"),` float ${W}(int m[${O}]) { int offset = indicesToOffset${W}(m); vec2 coords = offsetToCoords(offset, ${L}, ${F}); float value = getColorAsFloat(${(0,M.getGlsl)(this.context.glContext.version).texture2D}(${G}, coords)); return value; } `}getPackedValueFrom(G,O,L,F,V){let W=`_${G}_Pack`;return V&&(W+="_T"),` vec4 ${W}(int m[${O}]) { int offset = indicesToOffset_${G}(m); vec2 coords = offsetToCoords(offset, ${L}, ${F}); return ${(0,M.getGlsl)(this.context.glContext.version).texture2D}(${G}, coords); } `}}c.CoordsGlslLib=R},8520:(x,c)=>{var _;Object.defineProperty(c,"__esModule",{value:!0}),c.TopologicalSortGlslRoutines=c.GlslLibRoutineNode=c.GlslLibRoutine=c.GlslLib=c.GlslContext=c.FunctionType=void 0,(_=c.FunctionType||(c.FunctionType={}))[_.ValueBased=0]="ValueBased",_[_.Positional=1]="Positional",c.GlslContext=class{constructor(T,C,M,E){this.glContext=T,this.programInfo=C,this.inputTextureLayouts=M,this.outputTextureLayout=E}},c.GlslLib=class{constructor(T){this.context=T}},c.GlslLibRoutine=class{constructor(T,C){this.routineBody=T,this.dependencies=C}},c.GlslLibRoutineNode=class{constructor(T,C,M){this.name=T,this.dependencies=M||[],C&&(this.routineBody=C)}addDependency(T){T&&this.dependencies.push(T)}},c.TopologicalSortGlslRoutines=class{static returnOrderedNodes(T){if(!T||T.length===0)return[];if(T.length===1)return T;const C=new Set,M=new Set,E=new Array;return this.createOrderedNodes(T,C,M,E),E}static createOrderedNodes(T,C,M,E){for(let P=0;P0)for(let R=0;R{Object.defineProperty(c,"__esModule",{value:!0}),c.EncodingGlslLib=void 0;const T=_(8520);class C extends T.GlslLib{constructor(E){super(E)}getFunctions(){return Object.assign(Object.assign({},this.encodeFloat32()),this.decodeFloat32())}getCustomTypes(){return{}}encodeFloat32(){return{encode:new T.GlslLibRoutine(`highp vec4 encode(highp float f) { return vec4(f, 0.0, 0.0, 0.0); } `)}}decodeFloat32(){return{decode:new T.GlslLibRoutine(`highp float decode(highp vec4 rgba) { return rgba.r; } `)}}encodeUint8(){const E=C.isLittleEndian()?"rgba.rgba=rgba.abgr;":"";return{encode:new T.GlslLibRoutine(` highp vec4 encode(highp float f) { highp float F = abs(f); highp float Sign = step(0.0,-f); highp float Exponent = floor(log2(F)); highp float Mantissa = (exp2(- Exponent) * F); Exponent = floor(log2(F) + 127.0) + floor(log2(Mantissa)); highp vec4 rgba; rgba[0] = 128.0 * Sign + floor(Exponent*exp2(-1.0)); rgba[1] = 128.0 * mod(Exponent,2.0) + mod(floor(Mantissa*128.0),128.0); rgba[2] = floor(mod(floor(Mantissa*exp2(23.0 -8.0)),exp2(8.0))); rgba[3] = floor(exp2(23.0)*mod(Mantissa,exp2(-15.0))); ${E} rgba = rgba / 255.0; // values need to be normalized to [0,1] return rgba; } `)}}decodeUint8(){const E=C.isLittleEndian()?"rgba.rgba=rgba.abgr;":"";return{decode:new T.GlslLibRoutine(` highp float decode(highp vec4 rgba) { rgba = rgba * 255.0; // values need to be de-normalized from [0,1] to [0,255] ${E} highp float Sign = 1.0 - step(128.0,rgba[0])*2.0; highp float Exponent = 2.0 * mod(rgba[0],128.0) + step(128.0,rgba[1]) - 127.0; highp float Mantissa = mod(rgba[1],128.0)*65536.0 + rgba[2]*256.0 +rgba[3] + float(0x800000); highp float Result = Sign * exp2(Exponent) * (Mantissa * exp2(-23.0 )); return Result; } `)}}static isLittleEndian(){const E=new ArrayBuffer(4),P=new Uint32Array(E),R=new Uint8Array(E);if(P[0]=3735928559,R[0]===239)return!0;if(R[0]===222)return!1;throw new Error("unknown endianness")}}c.EncodingGlslLib=C},9894:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.FragColorGlslLib=void 0;const T=_(8520),C=_(5060);class M extends T.GlslLib{constructor(P){super(P)}getFunctions(){return Object.assign(Object.assign({},this.setFragColor()),this.getColorAsFloat())}getCustomTypes(){return{}}setFragColor(){const P=(0,C.getGlsl)(this.context.glContext.version);return{setFragColor:new T.GlslLibRoutine(` void setFragColor(float value) { ${P.output} = encode(value); } `,["encoding.encode"])}}getColorAsFloat(){return{getColorAsFloat:new T.GlslLibRoutine(` float getColorAsFloat(vec4 color) { return decode(color); } `,["encoding.decode"])}}}c.FragColorGlslLib=M},2848:(x,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.replaceInlines=void 0;const _=/@inline[\s\n\r]+(\w+)[\s\n\r]+([0-9a-zA-Z_]+)\s*\(([^)]*)\)\s*{(([^}]|[\n\r])*)}/gm;c.replaceInlines=function(T){const C={};let M;for(;(M=_.exec(T))!==null;){const E=M[3].split(",").map(P=>{const R=P.trim().split(" ");return R&&R.length===2?{type:R[0],name:R[1]}:null}).filter(P=>P!==null);C[M[2]]={params:E,body:M[4]}}for(const E in C){const P="(\\w+)?\\s+([_0-9a-zA-Z]+)\\s+=\\s+__FUNC__\\((.*)\\)\\s*;".replace("__FUNC__",E),R=new RegExp(P,"gm");for(;(M=R.exec(T))!==null;){const $=M[1],G=M[2],O=M[3].split(","),L=$?`${$} ${G};`:"";let F=C[E].body,V="";C[E].params.forEach((z,Z)=>{z&&(V+=`${z.type} ${z.name} = ${O[Z]}; `)}),F=`${V} ${F}`,F=F.replace("return",`${G} = `);const W=` ${L} { ${F} } `;T=T.replace(M[0],W)}}return T.replace(_,"")}},8879:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.GlslPreprocessor=void 0;const T=_(8520),C=_(2848),M=_(5483),E=_(5060);c.GlslPreprocessor=class{constructor(P,R,$,G){this.libs={},this.glslLibRoutineDependencyGraph={},this.context=new T.GlslContext(P,R,$,G),Object.keys(M.glslRegistry).forEach(L=>{const F=new M.glslRegistry[L](this.context);this.libs[L]=F});const O=this.glslLibRoutineDependencyGraph;for(const L in this.libs){const F=this.libs[L].getFunctions();for(const V in F){const W=L+"."+V;let z;O[W]?(z=O[W],z.routineBody=F[V].routineBody):(z=new T.GlslLibRoutineNode(W,F[V].routineBody),O[W]=z);const Z=F[V].dependencies;if(Z)for(let H=0;H{const G=$.split(".")[1];P.indexOf(G)!==-1&&R.push(this.glslLibRoutineDependencyGraph[$])}),T.TopologicalSortGlslRoutines.returnOrderedNodes(R)}getUniforms(P,R){const $=[];if(P)for(const G of P)$.push(`uniform sampler2D ${G};`);if(R)for(const G of R)$.push(`uniform ${G.type} ${G.name}${G.arrayLength?`[${G.arrayLength}]`:""};`);return $.join(` `)}}},5483:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.glslRegistry=void 0;const T=_(5107),C=_(7341),M=_(9894),E=_(2655),P=_(3891);c.glslRegistry={encoding:C.EncodingGlslLib,fragcolor:M.FragColorGlslLib,vec:P.VecGlslLib,shapeUtils:E.ShapeUtilsGlslLib,coordinates:T.CoordsGlslLib}},2655:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ShapeUtilsGlslLib=void 0;const T=_(8520);class C extends T.GlslLib{constructor(E){super(E)}getFunctions(){return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.bcastIndex()),this.bcastMatmulIndex()),this.offsetToIndices()),this.indicesToOffset()),this.incrementIndices())}getCustomTypes(){return{}}bcastIndex(){const E=this.context.outputTextureLayout.shape.length,P={};return this.context.programInfo.inputNames.forEach((R,$)=>{const G=this.context.inputTextureLayouts[$].unpackedShape;if(G.length<=E){const O=G.length,L=E-O,F=`bcastIndices_${R}`;let V="";for(let z=0;z{const G=this.context.inputTextureLayouts[$].shape;if(!(G.length<2||G.length>E)){const O=G.length,L=E-O,F=`bcastMatmulIndices_${R}`;let V="";for(let z=0;z{const $=this.context.inputTextureLayouts[R].shape,G=this.context.inputTextureLayouts[R].strides,O=$.length;let L=`indicesToOffset_${P}`;E[L]=new T.GlslLibRoutine(C.indexToOffsetSingle(L,O,G)),L=`indicesToOffset_${P}_T`,E[L]=new T.GlslLibRoutine(C.indexToOffsetSingle(L,O,G.slice().reverse()))}),E}static indexToOffsetSingle(E,P,R){let $="";for(let G=P-1;G>=0;--G)$+=` offset += indices[${G}] * ${R[G]}; `;return` int ${E}(int indices[${P}]) { int offset = 0; ${$} return offset; } `}offsetToIndices(){const E={};return this.context.programInfo.inputNames.forEach((P,R)=>{const $=this.context.inputTextureLayouts[R].shape,G=this.context.inputTextureLayouts[R].strides,O=$.length;let L=`offsetToIndices_${P}`;E[L]=new T.GlslLibRoutine(C.offsetToIndicesSingle(L,O,G)),L=`offsetToIndices_${P}_T`,E[L]=new T.GlslLibRoutine(C.offsetToIndicesSingle(L,O,G.slice().reverse()))}),E}static offsetToIndicesSingle(E,P,R){const $=[];for(let G=0;G{const $=this.context.inputTextureLayouts[R].shape,G=$.length,O=`incrementIndices_${P}`;let L="";for(let V=0;V= 0; --i) { if(i > axis) continue; indices[i] += 1; if(indices[i] < shape[i]) { break; } indices[i] = 0; } } `;E[O]=new T.GlslLibRoutine(F)}),E}}c.ShapeUtilsGlslLib=C},5060:(x,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.getDefaultFragShaderMain=c.getFragShaderPreamble=c.getVertexShaderSource=c.getGlsl=void 0;const _={version:"",attribute:"attribute",varyingVertex:"varying",varyingFrag:"varying",texture2D:"texture2D",output:"gl_FragColor",outputDeclaration:""},T={version:"#version 300 es",attribute:"in",varyingVertex:"out",varyingFrag:"in",texture2D:"texture",output:"outputColor",outputDeclaration:"out vec4 outputColor;"};function C(M){return M===1?_:T}c.getGlsl=C,c.getVertexShaderSource=function(M){const E=C(M);return`${E.version} precision highp float; ${E.attribute} vec3 position; ${E.attribute} vec2 textureCoord; ${E.varyingVertex} vec2 TexCoords; void main() { gl_Position = vec4(position, 1.0); TexCoords = textureCoord; }`},c.getFragShaderPreamble=function(M){const E=C(M);return`${E.version} precision highp float; precision highp int; precision highp sampler2D; ${E.varyingFrag} vec2 TexCoords; ${E.outputDeclaration} const vec2 halfCR = vec2(0.5, 0.5); // Custom vector types to handle higher dimenalities. struct ivec5 { int x; int y; int z; int w; int u; }; struct ivec6 { int x; int y; int z; int w; int u; int v; }; int imod(int x, int y) { return x - y * (x / y); } `},c.getDefaultFragShaderMain=function(M,E){return` void main() { int indices[${E}]; toVec(TexCoords, indices); vec4 result = vec4(process(indices)); ${C(M).output} = result; } `}},3891:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.VecGlslLib=void 0;const T=_(8520);class C extends T.GlslLib{constructor(E){super(E)}getCustomTypes(){return{}}getFunctions(){return Object.assign(Object.assign(Object.assign(Object.assign({},this.binaryVecFunctions()),this.copyVec()),this.setVecItem()),this.getVecItem())}binaryVecFunctions(){const E=this.context.outputTextureLayout.shape.length,P={add:"+=",sub:"-=",mul:"*=",div:"/="},R={};for(const $ in P){const G=`${$}Vec`;let O="";for(let F=0;F{Object.defineProperty(c,"__esModule",{value:!0}),c.WebGLInferenceHandler=void 0;const T=_(6231),C=_(9162),M=_(2517),E=_(2403),P=_(7019),R=_(8710),$=_(5611),G=_(4057),O=_(2039);c.WebGLInferenceHandler=class{constructor(L){this.session=L,this.packedTextureDataCache=new Map,this.unpackedTextureDataCache=new Map}calculateTextureWidthAndHeight(L,F){return(0,G.calculateTextureWidthAndHeight)(this.session.layoutStrategy,L,F)}executeProgram(L,F){if(F.length{const X=j.map(q=>`${q.unpackedShape.join(",")};${q.width}x${q.height}`).join("_");let K=U.name;return U.cacheHint&&(K+="["+U.cacheHint+"]"),K+=":"+X,K})(L,V);let z=this.session.programManager.getArtifact(W);const Z=z?z.programInfo:typeof L.get=="function"?L.get():L,H=(0,G.createTextureLayoutFromTextureType)(this.session.layoutStrategy,Z.output.dims,Z.output.textureType),Y=this.createTextureData(H,Z.output.type);return z||(z=this.session.programManager.build(Z,V,Y),this.session.programManager.setArtifact(W,z)),this.runProgram(z,V,Y),Y}run(L,F){return this.executeProgram(L,F).tensor}runProgram(L,F,V){for(let W=0;Wthis.readTexture(Z),async H=>this.readTextureAsync(Z),void 0,z),texture:V});return this.setTextureData(Z.tensor.dataId,Z,L.isPacked),Z}getTextureData(L,F=!1){return this.session.isInitializer(L)?this.session.getTextureData(L,F):F?this.packedTextureDataCache.get(L):this.unpackedTextureDataCache.get(L)}setTextureData(L,F,V=!1){this.session.isInitializer(L)?this.session.setTextureData(L,F,V):(V?this.packedTextureDataCache:this.unpackedTextureDataCache).set(L,F)}isTextureLayoutCached(L,F=!1){return!!this.getTextureData(L.dataId,F)}dispose(){this.session.textureManager.clearActiveTextures(),this.packedTextureDataCache.forEach(L=>this.session.textureManager.releaseTexture(L)),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache.forEach(L=>this.session.textureManager.releaseTexture(L)),this.unpackedTextureDataCache=new Map}readTexture(L){return L.isPacked?this.readTexture(this.unpack(L)):this.session.backend.glContext.isFloat32DownloadSupported?this.session.textureManager.readTexture(L,L.tensor.type,L.channels):this.session.textureManager.readUint8TextureAsFloat((0,R.encodeAsUint8)(this,L))}async readTextureAsync(L){return L.isPacked?this.readTextureAsync(this.unpack(L)):this.session.backend.glContext.isFloat32DownloadSupported?this.session.textureManager.readTextureAsync(L,L.tensor.type,L.channels):this.session.textureManager.readUint8TextureAsFloat((0,R.encodeAsUint8)(this,L))}pack(L){return this.executeProgram((0,E.createPackProgramInfoLoader)(this,L.tensor),[L.tensor])}unpack(L){return this.executeProgram((0,$.createUnpackProgramInfoLoader)(this,L.tensor),[L.tensor])}}},1640:function(x,c,_){var T=this&&this.__createBinding||(Object.create?function(de,pe,he,we){we===void 0&&(we=he);var ye=Object.getOwnPropertyDescriptor(pe,he);ye&&!("get"in ye?!pe.__esModule:ye.writable||ye.configurable)||(ye={enumerable:!0,get:function(){return pe[he]}}),Object.defineProperty(de,we,ye)}:function(de,pe,he,we){we===void 0&&(we=he),de[we]=pe[he]}),C=this&&this.__setModuleDefault||(Object.create?function(de,pe){Object.defineProperty(de,"default",{enumerable:!0,value:pe})}:function(de,pe){de.default=pe}),M=this&&this.__importStar||function(de){if(de&&de.__esModule)return de;var pe={};if(de!=null)for(var he in de)he!=="default"&&Object.prototype.hasOwnProperty.call(de,he)&&T(pe,de,he);return C(pe,de),pe};Object.defineProperty(c,"__esModule",{value:!0}),c.WEBGL_OP_RESOLVE_RULES=void 0;const E=_(2898),P=M(_(7839)),R=_(4196),$=_(2069),G=_(8138),O=_(9663),L=_(5193),F=_(7992),V=_(1253),W=_(4776),z=_(6572),Z=_(3346),H=_(5623),Y=_(2870),U=_(2143),j=_(4939),X=_(718),K=_(2268),q=_(8117),J=_(2278),Q=_(5524),ee=_(5975),re=_(3933),ie=_(6558),ae=_(5723),ne=_(3738),te=M(_(4909)),oe=_(8428),ue=_(9793);c.WEBGL_OP_RESOLVE_RULES=[["Abs","","6+",te.abs],["Acos","","7+",te.acos],["Add","","7+",P.add],["And","","7+",P.and],["Asin","","7+",te.asin],["Atan","","7+",te.atan],["AveragePool","","7+",U.averagePool,U.parseAveragePoolAttributes],["BatchNormalization","","7+",E.batchNormalization,E.parseBatchNormalizationAttributes],["Cast","","6+",R.cast,R.parseCastAttributes],["Ceil","","6+",te.ceil],["Clip","","6-10",te.clip,te.parseClipAttributes],["Clip","","11+",te.clipV11],["Concat","","4+",$.concat,$.parseConcatAttributes],["Conv","","1+",G.conv,G.parseConvAttributes],["ConvTranspose","","1+",O.convTranspose,O.parseConvTransposeAttributes],["Cos","","7+",te.cos],["Div","","7+",P.div],["Dropout","","7+",te.identity],["DepthToSpace","","1+",L.depthToSpace,L.parseDepthToSpaceAttributes],["Equal","","7+",P.equal],["Elu","","6+",te.elu,te.parseEluAttributes],["Exp","","6+",te.exp],["Flatten","","1+",F.flatten,F.parseFlattenAttributes],["Floor","","6+",te.floor],["FusedConv","com.microsoft","1+",G.conv,G.parseConvAttributes],["Gather","","1+",V.gather,V.parseGatherAttributes],["Gemm","","7-10",W.gemm,W.parseGemmAttributesV7],["Gemm","","11+",W.gemm,W.parseGemmAttributesV11],["GlobalAveragePool","","1+",U.globalAveragePool,U.parseGlobalAveragePoolAttributes],["GlobalMaxPool","","1+",U.globalMaxPool],["Greater","","7+",P.greater],["Identity","","1+",te.identity],["ImageScaler","","1+",z.imageScaler,z.parseImageScalerAttributes],["InstanceNormalization","","6+",Z.instanceNormalization,Z.parseInstanceNormalizationAttributes],["LeakyRelu","","6+",te.leakyRelu,te.parseLeakyReluAttributes],["Less","","7+",P.less],["Log","","6+",te.log],["MatMul","","1+",H.matMul,H.parseMatMulAttributes],["MaxPool","","1+",U.maxPool,U.parseMaxPoolAttributes],["Mul","","7+",P.mul],["Neg","","6+",te.neg],["Not","","1+",te.not],["Or","","7+",P.or],["Pad","","2-10",Y.padV2,Y.parsePadAttributesV2],["Pad","","11+",Y.padV11,Y.parsePadAttributesV11],["Pow","","7+",P.pow],["PRelu","","7+",P.pRelu],["ReduceLogSum","","1+",j.reduceLogSum,j.parseReduceAttributes],["ReduceMax","","1+",j.reduceMax,j.parseReduceAttributes],["ReduceMean","","1+",j.reduceMean,j.parseReduceAttributes],["ReduceMin","","1+",j.reduceMin,j.parseReduceAttributes],["ReduceProd","","1+",j.reduceProd,j.parseReduceAttributes],["ReduceSum","","1-12",j.reduceSum,j.parseReduceAttributes],["ReduceSumSquare","","1+",j.reduceLogSumSquare,j.parseReduceAttributes],["Relu","","6+",te.relu],["Reshape","","5+",X.reshape],["Resize","","10",K.resize,K.parseResizeAttributesV10],["Resize","","11+",K.resize,K.parseResizeAttributesV11],["Shape","","1+",q.shape],["Sigmoid","","6+",te.sigmoid],["Sin","","7+",te.sin],["Slice","","10+",J.sliceV10],["Slice","","1-9",J.slice,J.parseSliceAttributes],["Softmax","","1-12",Q.softmax,Q.parseSoftmaxAttributes],["Softmax","","13+",Q.softmaxV13,Q.parseSoftmaxAttributesV13],["Split","","2-12",ee.split,ee.parseSplitAttributes],["Sqrt","","6+",te.sqrt],["Squeeze","","1-12",re.squeeze,re.parseSqueezeAttributes],["Squeeze","","13+",re.squeezeV13],["Sub","","7+",P.sub],["Sum","","6+",ie.sum],["Tan","","7+",te.tan],["Tanh","","6+",te.tanh],["Tile","","6+",ae.tile],["Transpose","","1+",ne.transpose,ne.parseTransposeAttributes],["Upsample","","7-8",ue.upsample,ue.parseUpsampleAttributesV7],["Upsample","","9",ue.upsample,ue.parseUpsampleAttributesV9],["Unsqueeze","","1-12",oe.unsqueeze,oe.parseUnsqueezeAttributes],["Unsqueeze","","13+",oe.unsqueezeV13],["Xor","","7+",P.xor]]},2898:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseBatchNormalizationAttributes=c.batchNormalization=void 0;const T=_(246),C=_(5060),M=_(2039),E={name:"BatchNormalization",inputNames:["A","Scale","B","Mean","Variance"],inputTypes:[M.TextureType.unpacked,M.TextureType.unpacked,M.TextureType.unpacked,M.TextureType.unpacked,M.TextureType.unpacked]};c.batchNormalization=($,G,O)=>(R(G),[$.run(Object.assign(Object.assign({},E),{cacheHint:O.cacheKey,get:()=>P($,G,O)}),G)]),c.parseBatchNormalizationAttributes=$=>{const G=$.attributes.getFloat("epsilon",1e-5),O=$.attributes.getFloat("momentum",.9),L=$.attributes.getInt("spatial",1);return(0,T.createAttributeWithCacheKey)({epsilon:G,momentum:O,spatial:L})};const P=($,G,O)=>{const L=(0,C.getGlsl)($.session.backend.glContext.version),F=G[0].dims.length,[V,W]=$.calculateTextureWidthAndHeight(G[1].dims,M.TextureType.unpacked),z=` float process(int[${F}] indices) { vec2 position = offsetToCoords(indices[1], ${V}, ${W}); float scale = getColorAsFloat(${L.texture2D}(Scale, position)); float mean = getColorAsFloat(${L.texture2D}(Mean, position)); float variance = getColorAsFloat(${L.texture2D}(Variance, position)); float b = getColorAsFloat(${L.texture2D}(B, position)); return scale * ( (_A(indices) - mean) / sqrt(variance + float(${O.epsilon})) ) + b; }`;return Object.assign(Object.assign({},E),{output:{dims:G[0].dims,type:G[0].type,textureType:M.TextureType.unpacked},shaderSource:z})},R=$=>{if(!$||$.length!==5)throw new Error("BatchNormalization requires 5 inputs.");const G=$[0],O=$[1],L=$[2],F=$[3],V=$[4];if(G.dims.length<3||O.dims.length!==1||L.dims.length!==1||F.dims.length!==1||V.dims.length!==1)throw new Error("invalid input shape.");if(O.dims[0]!==G.dims[1]||L.dims[0]!==G.dims[1]||F.dims[0]!==G.dims[1]||V.dims[0]!==G.dims[1])throw new Error("invalid input shape.");if(G.type!=="float32"&&G.type!=="float64"||O.type!=="float32"&&O.type!=="float64"||L.type!=="float32"&&L.type!=="float64"||F.type!=="float32"&&F.type!=="float64"||V.type!=="float32"&&V.type!=="float64")throw new Error("invalid input tensor types.")}},7839:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.xor=c.sub=c.pRelu=c.pow=c.or=c.mul=c.less=c.greater=c.equal=c.div=c.and=c.add=c.glslPRelu=c.glslPow=c.glslXor=c.glslOr=c.glslAnd=c.glslLess=c.glslGreater=c.glslEqual=c.glslSub=c.glslMul=c.glslDiv=c.glslAdd=void 0;const T=_(2517),C=_(8520),M=_(5060),E=_(2039);function P(){const j="add_";return{body:` float ${j}(float a, float b) { return a + b; } vec4 ${j}(vec4 v1, vec4 v2) { return v1 + v2; } `,name:j,type:C.FunctionType.ValueBased}}function R(){const j="div_";return{body:` float ${j}(float a, float b) { return a / b; } vec4 ${j}(vec4 v1, vec4 v2) { return v1 / v2; } `,name:j,type:C.FunctionType.ValueBased}}function $(){const j="mul_";return{body:` float ${j}(float a, float b) { return a * b; } vec4 ${j}(vec4 v1, vec4 v2) { return v1 * v2; } `,name:j,type:C.FunctionType.ValueBased}}function G(){const j="sub_";return{body:` float ${j}(float a, float b) { return a - b; } vec4 ${j}(vec4 v1, vec4 v2) { return v1 - v2; } `,name:j,type:C.FunctionType.ValueBased}}function O(){const j="equal_";return{body:` float ${j}(float a, float b) { return float(a == b); } vec4 ${j}(vec4 v1, vec4 v2) { return vec4(equal(v1, v2)); } `,name:j,type:C.FunctionType.ValueBased}}function L(){const j="greater_";return{body:` float ${j}(float a, float b) { return float(a > b); } vec4 ${j}(vec4 v1, vec4 v2) { return vec4( v1.r > v2.r , v1.g > v2.g, v1.b > v2.b, v1.a > v2.a ); } `,name:j,type:C.FunctionType.ValueBased}}function F(){const j="less_";return{body:` float ${j}(float a, float b) { return float(a < b); } vec4 ${j}(vec4 v1, vec4 v2) { return vec4( v1.r < v2.r , v1.g < v2.g, v1.b < v2.b, v1.a < v2.a ); } `,name:j,type:C.FunctionType.ValueBased}}function V(){const j="and_";return{body:` float ${j}(float a, float b) { return float( bool(a) && bool(b) ); } vec4 ${j}(vec4 v1, vec4 v2) { bvec4 b1 = bvec4(v1); bvec4 b2 = bvec4(v2); return vec4( b1.r && b2.r , b1.g && b2.g, b1.b && b2.b, b1.a && b2.a ); } `,name:j,type:C.FunctionType.ValueBased}}function W(){const j="or_";return{body:` float ${j}(float a, float b) { return float( bool(a) || bool(b) ); } vec4 ${j}(vec4 v1, vec4 v2) { bvec4 b1 = bvec4(v1); bvec4 b2 = bvec4(v2); return vec4( b1.r || b2.r , b1.g || b2.g, b1.b || b2.b, b1.a || b2.a ); } `,name:j,type:C.FunctionType.ValueBased}}function z(){const j="xor_";return{body:` float ${j}(float a, float b) { return float( bool(a) ^^ bool(b) ); } vec4 ${j}(vec4 v1, vec4 v2) { bvec4 b1 = bvec4(v1); bvec4 b2 = bvec4(v2); return vec4( b1.r ^^ b2.r , b1.g ^^ b2.g, b1.b ^^ b2.b, b1.a ^^ b2.a ); } `,name:j,type:C.FunctionType.ValueBased}}function Z(){return function(j){const X=`${j}_`;return{body:` float ${X}(float a, float b) { return ${j}(a, b); } vec4 ${X}(vec4 v1, vec4 v2) { return ${j}(v1, v2); } `,name:X,type:C.FunctionType.ValueBased}}("pow")}function H(){const j="prelu_";return{body:` float ${j}(float a, float b) { return a < 0.0 ? a * b: a; } vec4 ${j}(vec4 v1, vec4 v2) { return vec4( v1.r < 0.0 ? v1.r * v2.r: v1.r, v1.g < 0.0 ? v1.g * v2.g: v1.g, v1.b < 0.0 ? v1.b * v2.b: v1.b, v1.a < 0.0 ? v1.a * v2.a: v1.a ); } `,name:j,type:C.FunctionType.ValueBased}}c.glslAdd=P,c.glslDiv=R,c.glslMul=$,c.glslSub=G,c.glslEqual=O,c.glslGreater=L,c.glslLess=F,c.glslAnd=V,c.glslOr=W,c.glslXor=z,c.glslPow=Z,c.glslPRelu=H;const Y=(j,X,K,q=X[0].type,J)=>{const Q=j.session.pack?E.TextureType.packed:E.TextureType.unpacked;return{name:K.name,inputNames:["A","B"],inputTypes:[Q,Q],cacheHint:J,get:()=>U(j,X,K,q)}},U=(j,X,K,q=X[0].type)=>{const J=j.session.pack?E.TextureType.packed:E.TextureType.unpacked,Q=!T.ShapeUtil.areEqual(X[0].dims,X[1].dims);let ee=X[0].dims;const re=j.session.pack;if(Q){const ne=T.BroadcastUtil.calcShape(X[0].dims,X[1].dims,!1);if(!ne)throw new Error("Can't perform binary op on the given tensors");ee=ne;const te=ee.length,oe=X[0].dims.length!==0?X[0].dims.length:1,ue=X[1].dims.length!==0?X[1].dims.length:1,de=X[0].dims.length!==0?"bcastIndices_A(indices, aindices);":"aindices[0] = 0;",pe=X[1].dims.length!==0?"bcastIndices_B(indices, bindices);":"bindices[0] = 0;",he=(0,M.getGlsl)(j.session.backend.glContext.version),we=re?` ${K.body} void main() { vec4 a = getAAtOutCoords(); vec4 b = getBAtOutCoords(); vec4 result = ${K.name}(a, b); ${he.output} = result; }`:` ${K.body} float process(int indices[${te}]) { int aindices[${oe}]; int bindices[${ue}]; ${de} ${pe} return ${K.name}(_A(aindices), _B(bindices)); }`;return{name:K.name,inputNames:["A","B"],inputTypes:[J,J],output:{dims:ee,type:q,textureType:J},shaderSource:we,hasMain:re}}const ie=(0,M.getGlsl)(j.session.backend.glContext.version),ae=` ${K.body} void main() { vec4 v1 = ${ie.texture2D}(A, TexCoords); vec4 v2 = ${ie.texture2D}(B, TexCoords); vec4 result = ${K.name}(v1, v2); ${ie.output} = result; } `;return{name:K.name,inputNames:["A","B"],inputTypes:[J,J],output:{dims:X[0].dims,type:q,textureType:J},shaderSource:ae,hasMain:!0}};c.add=(j,X)=>[j.run(Y(j,X,P()),X)],c.and=(j,X)=>[j.run(Y(j,X,V(),"bool"),X)],c.div=(j,X)=>[j.run(Y(j,X,R()),X)],c.equal=(j,X)=>[j.run(Y(j,X,O(),"bool"),X)],c.greater=(j,X)=>[j.run(Y(j,X,L(),"bool"),X)],c.less=(j,X)=>[j.run(Y(j,X,F(),"bool"),X)],c.mul=(j,X)=>[j.run(Y(j,X,$()),X)],c.or=(j,X)=>[j.run(Y(j,X,W(),"bool"),X)],c.pow=(j,X)=>[j.run(Y(j,X,Z()),X)],c.pRelu=(j,X)=>[j.run(Y(j,X,H()),X)],c.sub=(j,X)=>[j.run(Y(j,X,G()),X)],c.xor=(j,X)=>[j.run(Y(j,X,z(),"bool"),X)]},4196:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseCastAttributes=c.cast=void 0;const T=_(2517);c.cast=(M,E,P)=>(C(E),[M.cast(E[0],P)]),c.parseCastAttributes=M=>T.ProtoUtil.tensorDataTypeFromProto(M.attributes.getInt("to"));const C=M=>{if(!M||M.length!==1)throw new Error("Cast requires 1 input.");if(M[0].type==="string")throw new Error("Invalid input type.")}},1163:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createPackedConcatProgramInfoLoader=void 0;const T=_(5060),C=_(2039),M=_(9390),E=_(2827);c.createPackedConcatProgramInfoLoader=(R,$,G)=>{const O=(L=$.length,F=G.cacheKey,{name:"Concat (packed)",inputNames:Array.from({length:L},(V,W)=>`X${W}`),inputTypes:Array(L).fill(C.TextureType.packed),cacheHint:F});var L,F;return Object.assign(Object.assign({},O),{get:()=>((V,W,z,Z)=>{const H=z[0].dims.slice();if(Z>=H.length||Z<-1*H.length)throw new Error("axis specified for concat doesn't match input dimensionality");Z<0&&(Z=H.length+Z);const Y=H.slice(0);for(let de=1;dede.dims),J=(0,M.getGlChannels)(U),Q=new Array(q.length-1);Q[0]=q[0][Z];for(let de=1;de= ${Q[de-1]}) { return getChannel( getX${de}(${P(J,ee,pe)}), vec2(${P(re,ee,pe)})); }`}const ne=Q.length,te=Q[Q.length-1];ae+=` return getChannel( getX${ne}(${P(J,ee,te)}), vec2(${P(re,ee,te)}));`;const oe=(0,T.getGlsl)(V.session.backend.glContext.version),ue=` ${K} float getValue(${J.map(de=>"int "+de)}) { ${ae} } void main() { ${X} coords = getOutputCoords(); int lastDim = coords.${J[U-1]}; coords.${J[U-1]} = coords.${J[U-2]}; coords.${J[U-2]} = lastDim; vec4 result = vec4(getValue(${j}), 0., 0., 0.); ${j[U-1]} = ${j[U-1]} + 1; if (${j[U-1]} < ${Y[U-1]}) { result.g = getValue(${j}); } ${j[U-2]} = ${j[U-2]} + 1; if (${j[U-2]} < ${Y[U-2]}) { result.a = getValue(${j}); } ${j[U-1]} = ${j[U-1]} - 1; if (${j[U-2]} < ${Y[U-2]} && ${j[U-1]} < ${Y[U-1]}) { result.b = getValue(${j}); } ${oe.output} = result; } `;return Object.assign(Object.assign({},W),{output:{dims:Y,type:z[0].type,textureType:C.TextureType.packed},shaderSource:ue,hasMain:!0})})(R,O,$,G.axis)})};const P=(R,$,G)=>{const O=R.indexOf($);return R.map((L,F)=>F===O?`${L} - ${G}`:L).join()}},2069:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseConcatAttributes=c.concat=void 0;const T=_(246),C=_(2039),M=_(1163);c.concat=(L,F,V)=>(O(F),L.session.pack&&F[0].dims.length>1?[L.run((0,M.createPackedConcatProgramInfoLoader)(L,F,V),F)]:[L.run(E(L,F,V),F)]);const E=(L,F,V)=>{const W=(z=F.length,Z=V.cacheKey,{name:"Concat",inputNames:Array.from({length:z},(H,Y)=>`X${Y}`),inputTypes:Array(z).fill(C.TextureType.unpacked),cacheHint:Z});var z,Z;return Object.assign(Object.assign({},W),{get:()=>((H,Y,U,j)=>{const X=U[0].dims.slice();if(j>=X.length||j<-1*X.length)throw new Error("axis specified for concat doesn't match input dimensionality");j<0&&(j=X.length+j);const K=X.slice(0);for(let ie=1;ie`int getTextureWhereDataResides(int index) { ${L.map((F,V)=>`if(index<${F}) {return ${V};} `).join("")} }`,R=L=>P(L),$=(L,F)=>{const V=[`float fetchDataFromCorrectTexture(int textureIndex, int indices[${F}]) {`];for(let W=0;W{const F=["int getSizeInConcatAxisValueFromIndex(int index) {"];for(let V=0;V(0,T.createAttributeWithCacheKey)({axis:L.attributes.getInt("axis")});const O=L=>{if(!L||L.length<1)throw new Error("too few inputs");const F=L[0].type,V=L[0].dims.length;if(F==="string")throw new Error("string tensor is not supported yet");for(const W of L){if(W.type!==F)throw new Error("input tensors should be one type");if(W.dims.length!==V)throw new Error("input tensors should have the same shape")}}},4770:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createUnpackedGroupedConvProgramInfoLoader=void 0;const T=_(6231),C=_(5060),M=_(2039),E=_(8138),P=_(2823);c.createUnpackedGroupedConvProgramInfoLoader=(R,$,G)=>{const O=(L=$.length>2,F=G.cacheKey,{name:"GroupedConv",inputNames:L?["X","W","Bias"]:["X","W"],inputTypes:L?[M.TextureType.unpacked,M.TextureType.unpacked,M.TextureType.unpacked]:[M.TextureType.unpacked,M.TextureType.unpacked],cacheHint:F});var L,F;return Object.assign(Object.assign({},O),{get:()=>((V,W,z,Z)=>{const H=W.length>2?"value += getBias(output_channel);":"",Y=W[0].dims.slice(),U=W[1].dims.slice(),j=U[0]/Z.group;T.Logger.verbose("GroupedConv",`autpPad:${Z.autoPad}, dilations:${Z.dilations}, group:${Z.group}, kernelShape:${Z.kernelShape}, pads:${Z.pads}, strides:${Z.strides}`);const X=(0,E.calculateOutputShape)(Y,U,Z.dilations,Z.pads,Z.strides),K=(0,C.getGlsl)(V.session.backend.glContext.version),{activationFunction:q,applyActivation:J}=(0,P.getActivationSnippet)(Z),Q=` const ivec2 strides = ivec2(${Z.strides[0]}, ${Z.strides[1]}); const ivec2 pads = ivec2(${Z.pads[0]}, ${Z.pads[1]}); ${q} void main() { ivec4 coords = getOutputCoords(); int batch = coords.x; int output_channel = coords.y; ivec2 xRCCorner = coords.zw * strides - pads; int group_id = output_channel / ${j}; float value = 0.0; for (int wInChannel = 0; wInChannel < ${U[1]}; wInChannel++) { int input_channel = group_id * ${U[1]} + wInChannel; for (int wHeight = 0; wHeight < ${U[2]}; wHeight++) { int xHeight = xRCCorner.x + wHeight * ${Z.dilations[0]}; if (xHeight < 0 || xHeight >= ${Y[2]}) { continue; } for (int wWidth = 0; wWidth < ${U[3]}; wWidth++) { int xWidth = xRCCorner.y + wWidth * ${Z.dilations[1]}; if (xWidth < 0 || xWidth >= ${Y[3]}) { continue; } float xVal = getX(batch, input_channel, xWidth, xHeight); float wVal = getW(output_channel, wInChannel, wWidth, wHeight); value += xVal*wVal; } } } ${H} ${J} ${K.output} = vec4(value, .0, .0, .0); } `;return Object.assign(Object.assign({},z),{output:{dims:X,type:W[0].type,textureType:M.TextureType.unpacked},shaderSource:Q,hasMain:!0})})(R,$,O,G)})}},1386:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.conv2DPacked=c.conv2DPackedPointwise=void 0;const T=_(8138),C=_(8555),M=_(708);c.conv2DPackedPointwise=(E,P,R)=>{const $=P[0].dims,G=P[1].dims,O=(0,T.calculateOutputShape)($,G,R.dilations,R.pads,R.strides),L=E.reshapePacked(P[0],[$[1],$[2]*$[3]]),F=E.reshapePacked(P[1],[G[0],G[1]]),V=P.length>2?[F,L,P[2]]:[F,L],W=E.run((0,M.createPackedMatmulProgramInfoLoader)(E,V,R),V);return E.reshapePacked(W,O)},c.conv2DPacked=(E,P,R)=>{const $=P[0].dims,G=P[1].dims,O=(0,T.calculateOutputShape)($,G,R.dilations,R.pads,R.strides),L=E.run((0,C.createPackedIm2ColProgramInfoLoader)(E,P[0],P[1],O,R),[P[0]]),F=E.reshapePacked(P[1],[G[0],G[1]*G[2]*G[3]]),V=P.length===3?[F,L,P[2]]:[F,L],W=E.run((0,M.createPackedMatmulProgramInfoLoader)(E,V,R),V);return E.reshapePacked(W,O)}},9663:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseConvTransposeAttributes=c.convTranspose=void 0;const T=_(246),C=_(5060),M=_(2039),E=_(2823),P=(F,V,W,z,Z,H)=>(F-1)*V+W+(z-1)*Z+1-H,R=(F,V,W,z,Z)=>{const H=Math.floor(F/2);V==="SAME_UPPER"?(W[z]=H,W[Z]=F-H):V==="SAME_LOWER"&&(W[z]=F-H,W[Z]=H)};c.convTranspose=(F,V,W)=>(L(V,W),$(F,V,W));const $=(F,V,W)=>{const z=O(W,V);return[G(F,V,z)]},G=(F,V,W)=>F.run(((z,Z,H)=>{const Y=(U=Z.length>2,j=H.cacheKey,{name:"ConvTranspose",inputNames:U?["X","W","B"]:["X","W"],inputTypes:U?[M.TextureType.unpacked,M.TextureType.unpacked,M.TextureType.unpacked]:[M.TextureType.unpacked,M.TextureType.unpacked],cacheHint:j});var U,j;return Object.assign(Object.assign({},Y),{get:()=>((X,K,q,J)=>{const Q=K.length>2?"getB(output_channel)":"0.0",ee=K[0].dims,re=K[1].dims,ie=re[1],ae=re[0]/J.group,ne=[K[0].dims[0],K[1].dims[1]*J.group,...J.outputShape],te=(0,C.getGlsl)(X.session.backend.glContext.version),{activationFunction:oe,applyActivation:ue}=(0,E.getActivationSnippet)(J),de=` const ivec2 strides = ivec2(${J.strides[0]}, ${J.strides[1]}); const ivec2 pads = ivec2(${J.pads[0]}, ${J.pads[1]}); ${oe} void main() { ivec4 coords = getOutputCoords(); int batch = coords.x; int output_channel = coords.y; ivec2 loc = coords.zw + pads; int group_id = output_channel / ${ie}; int wOutChannel = output_channel - group_id * ${ie}; float value = ${Q}; for (int inChannelOffset = 0; inChannelOffset < ${ae}; inChannelOffset++) { int input_channel = group_id * ${ae} + inChannelOffset; for (int wWOff = 0; wWOff < ${re[2]}; wWOff++) { for (int wHOff = 0; wHOff < ${re[3]}; wHOff++) { ivec2 wOff = ivec2(wWOff * ${J.dilations[0]}, wHOff * ${J.dilations[1]}); ivec2 wLoc = loc - wOff; ivec2 wLocIn = wLoc / strides; if ( wLocIn * strides == wLoc && wLocIn.x >= 0 && wLocIn.x < ${ee[2]} && wLocIn.y >= 0 && wLocIn.y < ${ee[3]} ) { float xVal = getX(batch, input_channel, wLocIn.y, wLocIn.x); float wVal = getW(input_channel, wOutChannel, wHOff, wWOff); value += xVal * wVal; } } } } ${ue} ${te.output} = vec4(value, .0, .0, .0); } `;return Object.assign(Object.assign({},q),{output:{dims:ne,type:K[0].type,textureType:M.TextureType.unpacked},shaderSource:de,hasMain:!0})})(z,Z,Y,H)})})(F,V,W),V),O=(F,V)=>{const W=F.kernelShape.slice();if(F.kernelShape.length===0)for(let Y=2;Y{const ee=Y.length-2,re=Q.length===0;for(let ie=0;ie{const V=F.attributes,W=(0,E.parseInternalActivationAttributes)(V),z=V.getString("auto_pad","NOTSET"),Z=V.getInts("dilations",[1,1]),H=V.getInt("group",1),Y=V.getInts("kernel_shape",[]),U=V.getInts("output_padding",[0,0]),j=V.getInts("output_shape",[]),X=V.getInts("pads",[0,0,0,0]),K=V.getInts("strides",[1,1]);return(0,T.createAttributeWithCacheKey)(Object.assign({autoPad:z,dilations:Z,group:H,kernelShape:Y,outputPadding:U,outputShape:j,pads:X,strides:K},W))};const L=(F,V)=>{if(!F||F.length!==2&&F.length!==3)throw new Error("Conv requires 2 or 3 inputs");if(F[0].dims.length!==4||F[1].dims.length!==4)throw new Error("currently only support 2-dimensional conv");if(F[0].dims[1]!==F[1].dims[0])throw new Error("FILTER_IN_CHANNEL should be equal to DATA_CHANNEL");const W=F[1].dims[1]*V.group;if(F.length===3&&(F[2].dims.length!==1||F[2].dims[0]!==W))throw new Error("invalid bias");const z=F[0].dims.length-2;if(V.dilations.length!==z)throw new Error(`dilations should be ${z}D`);if(V.strides.length!==z)throw new Error(`strides should be ${z}D`);if(V.pads.length!==2*z)throw new Error(`pads should be ${2*z}D`);if(V.outputPadding.length!==z)throw new Error(`output_padding should be ${z}D`);if(V.kernelShape.length!==0&&V.kernelShape.length!==F[1].dims.length-2)throw new Error("invalid kernel shape");if(V.outputShape.length!==0&&V.outputShape.length!==F[0].dims.length-2)throw new Error("invalid output shape");if(F[0].type!=="float32"||F[1].type!=="float32")throw new Error("ConvTranspose input(X,W) should be float tensor");if(F.length===3&&F[2].type!=="float32")throw new Error("ConvTranspose input(bias) should be float tensor")}},8138:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseConvAttributes=c.conv=c.calculateOutputShape=void 0;const T=_(246),C=_(2517),M=_(4770),E=_(1386),P=_(9828),R=_(2823),$=_(3248),G=_(5623);c.calculateOutputShape=(z,Z,H,Y,U)=>{const j=z[0],X=z.slice(2),K=X.length,q=Z[0],J=Z.slice(2).map((ee,re)=>ee+(ee-1)*(H[re]-1)),Q=X.map((ee,re)=>ee+Y[re]+Y[re+K]).map((ee,re)=>Math.floor((ee-J[re]+U[re])/U[re]));return[j,q].concat(...Q)},c.conv=(z,Z,H)=>(W(Z,H),O(z,Z,H));const O=(z,Z,H)=>{const Y=V(H,Z),U=z.session.pack,j=Y.kernelShape[0]===1&&Y.kernelShape[1]===1;return Y.group>1?[z.run((0,M.createUnpackedGroupedConvProgramInfoLoader)(z,Z,Y),Z)]:j&&U?[L(z,Z,Y)]:U&&Z[0].dims.length===4&&Z[0].dims[0]===1&&!j?[(0,E.conv2DPacked)(z,Z,Y)]:[F(z,Z,Y)]},L=(z,Z,H)=>{const Y=Z[0].dims,U=Z[1].dims,j=(0,c.calculateOutputShape)(Y,U,H.dilations,H.pads,H.strides),X=z.reshapeUnpacked(Z[0],[Y[1],Y[2]*Y[3]]),K=z.reshapeUnpacked(Z[1],[U[0],U[1]]),q=Z.length>2?[K,X,Z[2]]:[K,X],J=z.run((0,G.createMatmulProgramInfoLoader)(q,H),q);return z.reshapeUnpacked(J,j)},F=(z,Z,H)=>{const Y=Z[0].dims,U=Z[1].dims,j=(0,c.calculateOutputShape)(Y,U,H.dilations,H.pads,H.strides),X=z.run((0,$.createIm2ColProgramInfoLoader)(z,Z[0],Z[1],j,H),[Z[0]]),K=Z.length===3?[X,Z[1],Z[2]]:[X,Z[1]];return z.run((0,P.createDotProductProgramInfoLoader)(z,Z,j,H),K)},V=(z,Z)=>{const H=z.kernelShape.slice();if(z.kernelShape.length===0)for(let j=2;j{const Z=z.attributes,H=(0,R.parseInternalActivationAttributes)(Z),Y=Z.getString("auto_pad","NOTSET"),U=Z.getInts("dilations",[1,1]),j=Z.getInt("group",1),X=Z.getInts("kernel_shape",[]),K=Z.getInts("pads",[0,0,0,0]),q=Z.getInts("strides",[1,1]);return(0,T.createAttributeWithCacheKey)(Object.assign({autoPad:Y,dilations:U,group:j,kernelShape:X,pads:K,strides:q},H))};const W=(z,Z)=>{if(!z||z.length!==2&&z.length!==3)throw new Error("Conv requires 2 or 3 inputs");if(z[0].dims.length!==4||z[1].dims.length!==4)throw new Error("currently only support 2-dimensional conv");if(z[0].dims[1]!==z[1].dims[1]*Z.group)throw new Error("FILTER_IN_CHANNEL should be equal to DATA_CHANNEL");if(z.length===3&&(z[2].dims.length!==1||z[1].dims[0]!==z[2].dims[0]))throw new Error("invalid bias");const H=z[0].dims.length-2;if(Z.dilations.length!==H)throw new Error(`dilations should be ${H}D`);if(Z.strides.length!==H)throw new Error(`strides should be ${H}D`);if(Z.pads.length!==2*H)throw new Error(`pads should be ${2*H}D`);if(Z.kernelShape.length!==0&&Z.kernelShape.length!==z[1].dims.length-2)throw new Error("invalid kernel shape");if(z[0].type!=="float32"||z[1].type!=="float32")throw new Error("Conv input(X,W) should be float tensor");if(z.length===3&&z[2].type!=="float32")throw new Error("Conv input(bias) should be float tensor")}},5193:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseDepthToSpaceAttributes=c.depthToSpace=void 0;const T=_(3738);c.depthToSpace=(M,E,P)=>{C(E);const R=P.blocksize,$=R*R,G=P.mode==="DCR"?[0,3,4,1,5,2]:[0,1,4,2,5,3],O=P.mode==="DCR"?[E[0].dims[0],R,R,E[0].dims[1]/$,E[0].dims[2],E[0].dims[3]]:[E[0].dims[0],E[0].dims[1]/$,R,R,E[0].dims[2],E[0].dims[3]],L=M.reshapeUnpacked(E[0],O),F={perm:G,cacheKey:`${G}`},[V]=(0,T.transpose)(M,[L],F),W=[E[0].dims[0],E[0].dims[1]/$,E[0].dims[2]*R,E[0].dims[3]*R];return[M.reshapeUnpacked(V,W)]},c.parseDepthToSpaceAttributes=M=>{const E=M.attributes.getInt("blocksize");if(E<1)throw new Error(`blocksize must be >= 1, but got : ${E} for DepthToSpace`);const P=M.attributes.getString("mode","DCR");if(P!=="DCR"&&P!=="CRD")throw new Error(`unrecognized mode: ${P} for DepthToSpace`);return{mode:P,blocksize:E}};const C=M=>{if(M.length!==1)throw new Error(`DepthToSpace expect 1 inputs, but got ${M.length}`);if(M[0].type==="string"||M[0].dims.length!==4)throw new TypeError("DepthToSpace input should be a 4-D numeric tensor")}},9828:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createDotProductProgramInfoLoader=void 0;const T=_(2517),C=_(5060),M=_(2039),E=_(2823),P=_(3248);c.createDotProductProgramInfoLoader=(R,$,G,O)=>{const L=((F,V)=>({name:"ConvDotProduct",inputNames:F?["Im2Col","K","B"]:["Im2Col","K"],inputTypes:F?[M.TextureType.unpacked,M.TextureType.packedLastDimension,M.TextureType.unpacked]:[M.TextureType.unpacked,M.TextureType.packedLastDimension],cacheKey:V.activationCacheKey}))($.length>2,O);return Object.assign(Object.assign({},L),{get:()=>((F,V,W,z,Z)=>{const H=W[0].dims,Y=W[1].dims,U=[Y[0],Math.ceil(H[1]*Y[2]*Y[3]/4)],j=(0,P.calculateIm2ColDims)(H,Y,z),[X,K]=F.calculateTextureWidthAndHeight(U,M.TextureType.packedLastDimension),q=T.ShapeUtil.computeStrides(j),[J,Q]=F.calculateTextureWidthAndHeight(j,M.TextureType.packedLastDimension),ee=z.length,re=W.length<3?"0.0":"_B(b)",ie=Math.ceil(H[1]*Y[2]*Y[3]/4),{activationFunction:ae,applyActivation:ne}=(0,E.getActivationSnippet)(Z),te=(0,C.getGlsl)(F.session.backend.glContext.version),oe=` ${ae} float process(int indices[${ee}]) { int b[1]; b[0] = indices[1]; int im2col[4]; im2col[0] = indices[0]; im2col[1] = indices[2]; im2col[2] = indices[3]; int im2colOffset = im2col[0] * ${q[0]} + im2col[1] * ${q[1]} + im2col[2] * ${q[2]}; int kernelOffset = indices[1] * ${U[1]}; float value = ${re}; for (int i = 0; i < ${ie}; ++i) { vec2 im2colCoords = offsetToCoords(im2colOffset, ${J}, ${Q}); vec2 kernelCoords = offsetToCoords(kernelOffset, ${X}, ${K}); value += dot(${te.texture2D}(Im2Col, im2colCoords), ${te.texture2D}(K, kernelCoords)); ++im2colOffset; ++kernelOffset; } ${ne} return value; }`;return Object.assign(Object.assign({},V),{output:{dims:z,type:W[0].type,textureType:M.TextureType.unpacked},shaderSource:oe})})(R,L,$,G,O)})}},7992:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseFlattenAttributes=c.flatten=void 0;const T=_(2517);c.flatten=(M,E,P)=>{C(E,P);const R=T.ShapeUtil.flattenShape(E[0].dims,P);return[M.reshapeUnpacked(E[0],R)]},c.parseFlattenAttributes=M=>M.attributes.getInt("axis",1);const C=(M,E)=>{if(!M||M.length!==1)throw new Error("Flatten requires 1 input.");const P=M[0].dims.length;if(P===0)throw new Error("scalar tensor is not supported.");if(E<-P||E>P)throw new Error("Invalid axis");if(M[0].type==="string")throw new Error("string tensor is not supported.")}},2823:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseInternalActivationAttributes=c.getActivationSnippet=void 0;const T=_(2517),C=_(4909);c.getActivationSnippet=function(M){let E;switch(M.activation){case"Relu":E=(0,C.glslRelu)();break;case"Sigmoid":E=(0,C.glslSigmoid)();break;case"Clip":E=(0,C.glslClip)(M.clipMin,M.clipMax);break;default:return{activationFunction:"",applyActivation:""}}const P=E.name;return{activationFunction:E.body,applyActivation:`value = ${P}_(value);`}},c.parseInternalActivationAttributes=M=>{const E=M.getString("activation","");if(E==="Clip"){const[P,R]=M.getFloats("activation_params",[T.MIN_CLIP,T.MAX_CLIP]);return{activation:E,clipMax:R,clipMin:P,activationCacheKey:`${E}:${P},${R}`}}return{activation:E,activationCacheKey:E}}},1253:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseGatherAttributes=c.gather=void 0;const T=_(246),C=_(782),M=_(2517),E=_(2039);c.gather=(G,O,L)=>($(O,L.axis),[G.run(R(G,O,L),O)]),c.parseGatherAttributes=G=>(0,T.createAttributeWithCacheKey)({axis:G.attributes.getInt("axis",0)});const P={name:"Gather",inputNames:["A","B"],inputTypes:[E.TextureType.unpacked,E.TextureType.unpacked]},R=(G,O,L)=>{const F=Object.assign(Object.assign({},P),{cacheHint:L.cacheKey});return Object.assign(Object.assign({},F),{get:()=>((V,W,z,Z)=>{const H=z[0].dims.slice(),Y=z[1].dims.slice(),U=new Array(H.length+Y.length-1);Z=M.ShapeUtil.normalizeAxis(Z,H.length);const j=[];for(let K=0;K{if(!G||G.length!==2)throw new Error("Gather requires 2 inputs.");const L=G[0].dims.length;if(L<1)throw new Error("Invalid input shape.");if(O<-L||O>L-1)throw new Error("Invalid axis.");if(C.NUMBER_TYPES.indexOf(G[0].type)===-1)throw new Error("Invaid input type.");if(G[1].type!=="int32"&&G[1].type!=="int16")throw new Error("Invaid input type.")}},4776:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseGemmAttributesV11=c.parseGemmAttributesV7=c.gemm=void 0;const T=_(246),C=_(2517),M=_(2039);c.gemm=(G,O,L)=>($(O,L),[G.run(P(O,L),O)]);const E=(G,O)=>{const L=G.attributes.getInt("transA",0)!==0,F=G.attributes.getInt("transB",0)!==0,V=G.attributes.getFloat("alpha",1),W=G.attributes.getFloat("beta",1);return(0,T.createAttributeWithCacheKey)({transA:L,transB:F,alpha:V,beta:W,isOptionalC:O})};c.parseGemmAttributesV7=G=>E(G,!1),c.parseGemmAttributesV11=G=>E(G,!0);const P=(G,O)=>{const L={name:"Gemm",inputNames:G.length===3?["A","B","C"]:["A","B"],inputTypes:G.length===3?[M.TextureType.unpacked,M.TextureType.unpacked,M.TextureType.unpacked]:[M.TextureType.unpacked,M.TextureType.unpacked],key:O.cacheKey};return Object.assign(Object.assign({},L),{get:()=>R(L,G,O)})},R=(G,O,L)=>{const F=O[0].dims.slice(),V=O[1].dims.slice(),[W,z]=C.GemmUtil.getShapeOfGemmResult(F,L.transA,V,L.transB,O.length===3?O[2].dims:void 0),Z=[W,z];if(!Z)throw new Error("Can't use gemm on the given tensors");let H=F[F.length-1],Y="";L.transA&&(H=F[0]),L.transA&&L.transB?Y="value += _A_T(a) * _B_T(b);":L.transA&&!L.transB?Y="value += _A_T(a) * _B(b);":!L.transA&&L.transB?Y="value += _A(a) * _B_T(b);":L.transA||L.transB||(Y="value += _A(a) * _B(b);");const U=Z.length,j=` float process(int indices[${U}]) { int a[${U}]; int b[${U}]; ${O.length===3?`int c[${O[2].dims.length}];`:""} copyVec(indices, a); copyVec(indices, b); ${O.length===3?"bcastIndices_C(indices, c);":""} float value = 0.0; for (int k=0; k<${H}; ++k) { a[${U-1}] = k; b[${U-2}] = k; ${Y} } value = value * alpha; ${O.length===3?"value += beta * _C(c);":""} return value; }`;return Object.assign(Object.assign({},G),{output:{dims:Z,type:O[0].type,textureType:M.TextureType.unpacked},variables:[{name:"alpha",type:"float",data:L.alpha},{name:"beta",type:"float",data:L.beta}],shaderSource:j})},$=(G,O)=>{if(!G)throw new Error("Input is missing");if(O.isOptionalC&&(G.length<2||G.length>3))throw new Error("Invaid input shape.");if(!O.isOptionalC&&G.length!==3)throw new Error("Gemm requires 3 inputs");if(G.length===3&&G[2].dims.length!==1&&G[2].dims.length!==2)throw new Error("Invalid input shape of C");if(G[0].type!=="float32"&&G[0].type!=="float64"||G[1].type!=="float32"&&G[1].type!=="float64"||G.length===3&&G[2].type!=="float32"&&G[2].type!=="float64")throw new Error("Invalid input type.");if(G[0].type!==G[1].type||G.length===3&&G[0].type!==G[2].type)throw new Error("Input types are mismatched")}},8555:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createPackedIm2ColProgramInfoLoader=void 0;const T=_(5060),C=_(2039),M=_(2827);c.createPackedIm2ColProgramInfoLoader=(E,P,R,$,G)=>{const O=(L=G.cacheKey,{name:"Im2Col (packed)",inputNames:["A"],inputTypes:[C.TextureType.packed],cacheHint:L});var L;return Object.assign(Object.assign({},O),{get:()=>((F,V,W,z,Z,H)=>{const Y=W.dims,U=z.dims,j=Z.length,X=[U[1]*U[2]*U[3],Z[2]*Z[3]],K=U[2]*U[3],q=(0,M.unpackFromChannel)(),J=(0,T.getGlsl)(F.session.backend.glContext.version);let Q="";for(let re=0;re<=1;re++)for(let ie=0;ie<=1;ie++)Q+=` blockIndex = rc.x + ${ie}; pos = rc.y + ${re}; if(blockIndex < ${X[1]} && pos < ${X[0]}) { offsetY = int(blockIndex / (${Z[j-1]})) * ${H.strides[0]} - ${H.pads[0]}; d0 = offsetY + ${H.dilations[0]} * (imod(pos, ${K}) / ${U[2]}); if(d0 < ${Y[2]} && d0 >= 0) { offsetX = imod(blockIndex, ${Z[j-1]}) * ${H.strides[1]} - ${H.pads[1]}; d1 = offsetX + ${H.dilations[1]} * imod(imod(pos, ${K}), ${U[2]}); if(d1 < ${Y[3]} && d1 >= 0) { ch = int(float(pos)/ ${K}.); innerDims = vec2(d0, d1); result[${2*re+ie}] = getChannel( getA(0, ch, int(innerDims.x), int(innerDims.y)), innerDims); } } } `;const ee=` ${q} void main() { ivec2 rc = getOutputCoords(); vec4 result = vec4(0.0); int blockIndex, pos, offsetY, d0, offsetX, d1, ch; vec2 innerDims; ${Q} ${J.output} = result; } `;return Object.assign(Object.assign({},V),{output:{dims:X,type:W.type,textureType:C.TextureType.packed},shaderSource:ee,hasMain:!0})})(E,O,P,R,$,G)})}},3248:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.calculateIm2ColDims=c.createIm2ColProgramInfoLoader=void 0;const T=_(2039);c.createIm2ColProgramInfoLoader=(C,M,E,P,R)=>{const $=(G=R.cacheKey,{name:"Im2Col",inputNames:["X"],inputTypes:[T.TextureType.unpacked],cacheHint:G});var G;return Object.assign(Object.assign({},$),{get:()=>((O,L,F,V,W,z)=>{const Z=F.dims,H=V.dims,Y=W.length,U=(0,c.calculateIm2ColDims)(Z,H,W,4),j=` const int XC = ${Z[1]}; const int XH = ${Z[2]}; const int XW = ${Z[3]}; const int KH = ${z.kernelShape[0]}; const int KW = ${z.kernelShape[1]}; const int dilationH = ${z.dilations[0]}; const int dilationW = ${z.dilations[1]}; const int strideH = ${z.strides[0]}; const int strideW = ${z.strides[1]}; const int padH = ${z.pads[0]}; const int padW = ${z.pads[1]}; const int KHKW = KH*KW; const int XCKHKW = XC * KHKW; const int outputChannels = 4; vec4 process(int indices[${Y}]) { int b = indices[0]; // batch size int oh = indices[1] * strideH - padH; //output height int ow = indices[2] * strideW - padW; //output width int p = indices[3] * outputChannels; //patch vec4 value = vec4(0.0); for(int i=0; i < outputChannels; ++i) { if(p < XCKHKW) { int patchC = p / KHKW; int patchH = (p - patchC*KHKW) / KW; int patchW = (p - patchC*KHKW) - patchH * KW; int xh2 = oh + patchH * dilationH; int xw2 = ow + patchW * dilationW; int x[${Z.length}]; x[0] = b; x[1] = patchC; x[2] = xh2; x[3] = xw2; if(xh2 >= 0 && xh2 < XH && xw2 >= 0 && xw2 < XW) { value[i] = _X(x); } } ++p; } return value; } `;return Object.assign(Object.assign({},L),{output:{dims:U,type:F.type,textureType:T.TextureType.packedLastDimension},shaderSource:j})})(0,$,M,E,P,R)})},c.calculateIm2ColDims=(C,M,E,P=4)=>[E[0],E[2],E[3],Math.ceil(C[1]*M[2]*M[3]/P)]},6572:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseImageScalerAttributes=c.imageScaler=void 0;const T=_(246),C=_(2039);c.imageScaler=($,G,O)=>(R(G),[$.run(E($,G,O),G)]),c.parseImageScalerAttributes=$=>{const G=$.attributes.getFloat("scale"),O=$.attributes.getFloats("bias");return(0,T.createAttributeWithCacheKey)({scale:G,bias:O})};const M={name:"ImageScaler",inputNames:["X"],inputTypes:[C.TextureType.unpacked]},E=($,G,O)=>{const L=Object.assign(Object.assign({},M),{cacheHint:O.cacheKey});return Object.assign(Object.assign({},L),{get:()=>((F,V,W,z)=>{const Z=W[0].dims.slice(),H=Z.length,Y=` ${P(z.bias.length)} float process(int indices[${H}]) { return _X(indices) * scale + getBias(bias, indices[1]); }`;return Object.assign(Object.assign({},V),{output:{dims:Z,type:W[0].type,textureType:C.TextureType.unpacked},variables:[{name:"bias",type:"float",arrayLength:z.bias.length,data:z.bias},{name:"scale",type:"float",data:z.scale}],shaderSource:Y})})(0,L,G,O)})},P=$=>{const G=[`float getBias(float bias[${$}], int channel) {`];for(let O=0;O<$;++O)O===0?G.push(` if (channel == ${O}) { return bias[${O}]; }`):O===$-1?G.push(` else { return bias[${O}]; }`):G.push(` else if (channel == ${O}) { return bias[${O}]; }`);return G.push(" }"),G.join(` `)},R=$=>{if(!$||$.length!==1)throw new Error("ImageScaler requires 1 input.");if($[0].dims.length!==4)throw new Error("Invalid input shape.");if($[0].type!=="float32"&&$[0].type!=="float64")throw new Error("Invalid input type.")}},3346:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseInstanceNormalizationAttributes=c.instanceNormalization=void 0;const T=_(5060),C=_(2039);c.instanceNormalization=(G,O,L)=>{$(O);const F=G.run(E(O[0]),O);return[G.run(R(G,O[0],L,F.dims),[O[0],F,O[1],O[2]])]},c.parseInstanceNormalizationAttributes=G=>G.attributes.getFloat("epsilon",1e-5);const M={name:"InstanceNormalization_MeanAndVariance",inputNames:["X"],inputTypes:[C.TextureType.unpacked]},E=G=>Object.assign(Object.assign({},M),{get:()=>((O,L)=>{const F=L.dims.slice(),V=F[1],W=F[2]*F[3],z=[F[0],V],Z=` vec4 process(int[2] indices) { vec4 v = vec4(0.0); int a[4]; a[0] = indices[0]; a[1] = indices[1]; float temp = 0.0; for(int a2=0; a2<${F[2]}; a2++) { a[2] = a2; for(int a3=0; a3<${F[3]}; a3++) { a[3] = a3; float x = _X(a); temp += x; } } float mean = temp / float(${W}); temp = 0.0; for(int a2=0; a2<${F[2]}; a2++) { a[2] = a2; for(int a3=0; a3<${F[3]}; a3++) { a[3] = a3; float x = _X(a); temp += (x - mean) * (x - mean); } } v.r = mean; v.g = temp / float(${W}); return v; }`;return Object.assign(Object.assign({},O),{output:{dims:z,type:L.type,textureType:C.TextureType.packedLastDimension},shaderSource:Z})})(M,G)}),P={name:"InstanceNormalization_ComputeOutput",inputNames:["X","MeanAndVariance","Scale","B"],inputTypes:[C.TextureType.unpacked,C.TextureType.packedLastDimension,C.TextureType.unpacked,C.TextureType.unpacked]},R=(G,O,L,F)=>{const V=Object.assign(Object.assign({},P),{cacheHint:`${L}`});return Object.assign(Object.assign({},V),{get:()=>((W,z,Z,H,Y)=>{const U=(0,T.getGlsl)(W.session.backend.glContext.version),[j,X]=W.calculateTextureWidthAndHeight(Y,C.TextureType.packedLastDimension),[K,q]=[j/4,X],J=` vec4 get_MeanAndVariance(int[2] mv) { int offset = indicesToOffset_MeanAndVariance(mv); vec2 coords = offsetToCoords(offset, ${K}, ${q}); return ${U.texture2D}(MeanAndVariance, coords); } float process(int[4] indices) { int mv[2]; mv[0] = indices[0]; mv[1] = indices[1]; vec4 mean_and_variance = get_MeanAndVariance(mv); float mean = mean_and_variance.r; float variance = mean_and_variance.g; int sb[1]; sb[0] = indices[1]; float scale = _Scale(sb); float b = _B(sb); return scale * (_X(indices) - mean) / sqrt(variance + epsilon) + b; }`;return Object.assign(Object.assign({},z),{output:{dims:Z.dims,type:Z.type,textureType:C.TextureType.unpacked},variables:[{name:"epsilon",type:"float",data:H}],shaderSource:J})})(G,V,O,L,F)})},$=G=>{if(!G||G.length!==3)throw new Error("InstanceNormalization requires 3 inputs.");const O=G[0],L=G[1],F=G[2];if(O.dims.length<3||L.dims.length!==1||F.dims.length!==1)throw new Error("Invalid input shape.");if(L.dims[0]!==O.dims[1]||F.dims[0]!==O.dims[1])throw new Error("Input shapes are mismatched.");if(O.type!=="float32"&&O.type!=="float64"||L.type!=="float32"&&L.type!=="float64"||F.type!=="float32"&&F.type!=="float64")throw new Error("Invalid input type.");if(G[0].dims.length!==4)throw new Error("Only support 4-D input shape.")}},708:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createPackedMatmulProgramInfoLoader=void 0;const T=_(2517),C=_(5060),M=_(2039),E=_(9390),P=_(2823),R=_(5623);c.createPackedMatmulProgramInfoLoader=($,G,O)=>{const L=(F=G.length>2,V=O.activationCacheKey,{name:"MatMul (packed)",inputNames:F?["A","B","Bias"]:["A","B"],inputTypes:F?[M.TextureType.packed,M.TextureType.packed,M.TextureType.packed]:[M.TextureType.packed,M.TextureType.packed],cacheHint:V});var F,V;return Object.assign(Object.assign({},L),{get:()=>((W,z,Z,H)=>{const Y=Z.length>2,U=Y?"value += getBiasForMatmul();":"",j=Z[0].dims,X=Z[1].dims,K=T.BroadcastUtil.calcShape(j,X,!0),q=!T.ShapeUtil.areEqual(Z[0].dims,Z[1].dims);if(!K)throw new Error("Can't use matmul on the given tensors");const J=j[j.length-1],Q=Math.ceil(J/2),ee=j.length,re=X.length,ie=(0,C.getGlsl)(W.session.backend.glContext.version),ae=(0,E.getCoordsDataType)(K.length),ne=K.length,te=(0,E.getGlChannels)(),{activationFunction:oe,applyActivation:ue}=(0,P.getActivationSnippet)(H),de=Y?`${(0,R.getBiasForMatmul)(ae,te,Z[2].dims,K,!0)}`:"",pe=q?`${function(Me,Pe,Re,De){let Le=[],$e=[];const Oe=Re[0].dims,Ee=Re[1].dims,Be=Oe.length,He=Ee.length,We=De.length,Ke=We-Be,Je=We-He;Le=Oe.map((ct,yt)=>`coords.${Pe[yt+Ke]}`),Le[Be-1]="i*2",Le.join(", "),$e=Ee.map((ct,yt)=>`coords.${Pe[yt+Je]}`),$e[He-2]="i*2",$e.join(", ");const tt=T.BroadcastUtil.getBroadcastDims(Oe,De),mt=T.BroadcastUtil.getBroadcastDims(Ee,De),pt=tt.map(ct=>`coords.${Pe[ct+Ke]} = 0;`).join(` `),bt=mt.map(ct=>`coords.${Pe[ct+Je]} = 0;`).join(` `),gt=`int lastDim = coords.${Pe[We-1]}; coords.${Pe[We-1]} = coords.${Pe[We-2]}; coords.${Pe[We-2]} = lastDim;`;return` vec4 getAAtOutCoordsMatmul(int i) { ${Me} coords = getOutputCoords(); ${gt} ${pt} vec4 outputValue = getA(${Le}); return outputValue; } vec4 getBAtOutCoordsMatmul(int i) { ${Me} coords = getOutputCoords(); ${gt} ${bt} vec4 outputValue = getB(${$e}); return outputValue; }`}(ae,te,Z,K)}`:"",he=q?"getAAtOutCoordsMatmul(i)":`getA(${function(Me,Pe){let Re="";for(let De=0;De{Object.defineProperty(c,"__esModule",{value:!0}),c.getBiasForMatmul=c.createMatmulProgramInfoLoader=c.parseMatMulAttributes=c.matMul=void 0;const T=_(2517),C=_(2039),M=_(9390),E=_(2823),P=_(708);function R(O,L){const F=(V=O.length>2,W=L.activationCacheKey,{name:"MatMul",inputNames:V?["A","B","Bias"]:["A","B"],inputTypes:V?[C.TextureType.unpacked,C.TextureType.unpacked,C.TextureType.unpacked]:[C.TextureType.unpacked,C.TextureType.unpacked],cacheHint:W});var V,W;return Object.assign(Object.assign({},F),{get:()=>function(z,Z,H){const Y=Z[0].dims,U=Z[1].dims,j=T.BroadcastUtil.calcShape(Y,U,!0);if(!j)throw new Error("Can't use matmul on the given tensors");const X=(0,M.getCoordsDataType)(j.length),K=(0,M.getGlChannels)(),{activationFunction:q,applyActivation:J}=(0,E.getActivationSnippet)(H),Q=Z.length>2,ee=Q?"value += getBiasForMatmul();":"",re=Q?`${G(X,K,Z[2].dims,j,!1)}`:"",ie=j.length,ae=Y.length,ne=U.length,te=` ${q} ${re} float process(int indices[${ie}]) { int a[${ae}]; int b[${ne}]; bcastMatmulIndices_A(indices, a); bcastMatmulIndices_B(indices, b); float value; for (int k=0; k<${Y[Y.length-1]}; ++k) { a[${ae-1}] = k; b[${ne-2}] = k; value += _A(a) * _B(b); } ${ee} ${J} return value; }`;return Object.assign(Object.assign({},z),{output:{dims:j,type:Z[0].type,textureType:C.TextureType.unpacked},shaderSource:te})}(F,O,L)})}c.matMul=(O,L,F)=>($(L),O.session.pack?[O.run((0,P.createPackedMatmulProgramInfoLoader)(O,L,F),L)]:[O.run(R(L,F),L)]),c.parseMatMulAttributes=O=>(0,E.parseInternalActivationAttributes)(O.attributes),c.createMatmulProgramInfoLoader=R;const $=O=>{if(!O||O.length!==2)throw new Error("MatMul requires 2 inputs.");if(O[0].dims[O[0].dims.length-1]!==O[1].dims[O[1].dims.length-2])throw new Error("shared dimension does not match.");if(O[0].type!=="float32"&&O[0].type!=="float64"||O[1].type!=="float32"&&O[1].type!=="float64")throw new Error("inputs should be float type");if(O[0].type!==O[1].type)throw new Error("inputs types should match")};function G(O,L,F,V,W){let z="";const Z=F.length,H=V.length,Y=H-Z;z=H<2&&Z>0?"coords":F.map((X,K)=>`coords.${L[K+Y]}`).join(", ");const U=T.BroadcastUtil.getBroadcastDims(F,V).map(X=>`coords.${L[X+Y]} = 0;`).join(` `);let j="vec4(outputValue.xx, outputValue.yy)";return T.ShapeUtil.size(F)===1&&(j="vec4(outputValue.x)"),W?` vec4 getBiasForMatmul() { ${O} coords = getOutputCoords(); ${U} vec4 outputValue = getBias(${z}); return ${j}; }`:` float getBiasForMatmul() { ${O} coords = getOutputCoords(); ${U} return getBias(coords.x); }`}c.getBiasForMatmul=G},2403:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createPackProgramInfoLoader=void 0;const T=_(5060),C=_(2039),M=_(9390),E=_(2827),P={name:"pack",inputNames:["A"],inputTypes:[C.TextureType.unpackedReversed]};c.createPackProgramInfoLoader=(R,$)=>Object.assign(Object.assign({},P),{get:()=>((G,O)=>{const L=(0,T.getGlsl)(G.session.backend.glContext.version),F=O.dims,V=F.length,W=O.dims.length,z=(0,M.getCoordsDataType)(W),Z=(0,E.getChannels)("rc",W),H=(Y=W,U=Z,j=F[F.length-2],X=F[F.length-1],Y===0||Y===1?"":` int r = ${U[Y-2]}; int c = ${U[Y-1]}; int rp1 = ${U[Y-2]} + 1; int cp1 = ${U[Y-1]} + 1; bool rEdge = rp1 >= ${X}; bool cEdge = cp1 >= ${j}; `);var Y,U,j,X;let K;K=V===0?[1,1]:V===1?[F[0],1]:[F[W-1],F[W-2]];const q=function(ee,re,ie){if(ee===0)return"false";if(ee===1)return`rc > ${re[0]}`;let ae="";for(let ne=ee-2;ne= ${re[ne-ee+2]}`,ne= ${ee[0]} ? 0. : getA(rc + 1), 0, 0`;let ae="";if(ie>2)for(let ne=0;ne{Object.defineProperty(c,"__esModule",{value:!0}),c.unpackFromChannel=c.getChannels=c.getVecChannels=void 0;const T=_(9390);function C(M,E){return(0,T.getGlChannels)(E).map(P=>`${M}.${P}`)}c.getVecChannels=C,c.getChannels=function(M,E){return E===1?[M]:C(M,E)},c.unpackFromChannel=function(){return` float getChannel(vec4 frag, int dim) { int modCoord = imod(dim, 2); return modCoord == 0 ? frag.r : frag.g; } float getChannel(vec4 frag, vec2 innerDims) { vec2 modCoord = mod(innerDims, 2.); return modCoord.x == 0. ? (modCoord.y == 0. ? frag.r : frag.g) : (modCoord.y == 0. ? frag.b : frag.a); } `}},2870:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parsePadAttributesV11=c.padV11=c.parsePadAttributesV2=c.padV2=void 0;const T=_(246),C=_(2517),M=_(5060),E=_(2039),P={name:"Pad",inputNames:["A"],inputTypes:[E.TextureType.unpacked]};c.padV2=(z,Z,H)=>(G(Z),[z.run(Object.assign(Object.assign({},P),{cacheHint:H.cacheKey,get:()=>$(z,Z[0],H)}),Z)]),c.parsePadAttributesV2=z=>{const Z=z.attributes.getString("mode","constant"),H=z.attributes.getFloat("value",0),Y=z.attributes.getInts("pads");return(0,T.createAttributeWithCacheKey)({mode:Z,value:H,pads:Y})},c.padV11=(z,Z,H)=>{O(Z);const Y=R(z,Z,H);return(0,c.padV2)(z,[Z[0]],Y)},c.parsePadAttributesV11=z=>z.attributes.getString("mode","constant");const R=(z,Z,H)=>{if(!z.session.isInitializer(Z[1].dataId)||Z.length>=3&&!z.session.isInitializer(Z[2].dataId))throw new Error("dynamic pad attributes are not allowed");const Y=Array.from(Z[1].integerData),U=Z.length>=3?Z[2].floatData[0]:0;return(0,T.createAttributeWithCacheKey)({mode:H,pads:Y,value:U})},$=(z,Z,H)=>{const Y=C.ShapeUtil.padShape(Z.dims.slice(),H.pads),U=Y.length,j=` ${L(z,Z,H)} float process(int[${U}] indices) { return padA(indices); }`;return{name:"Pad",inputNames:["A"],inputTypes:[E.TextureType.unpacked],output:{dims:Y,type:Z.type,textureType:E.TextureType.unpacked},shaderSource:j}},G=z=>{if(!z||z.length!==1)throw new Error("Pad requires 1 input");if(z[0].type!=="float32"&&z[0].type!=="float64")throw new Error("Invalid input type.")},O=z=>{if(!z||z.length!==2&&z.length!==3)throw new Error("Pad requires 2 or 3 inputs");if(z[1].type!=="int32")throw new Error("Invalid input type.");if(z.length>=3&&z[2].type==="string")throw new Error("Invalid input type.")},L=(z,Z,H)=>{const Y=(0,M.getGlsl)(z.session.backend.glContext.version),[U,j]=z.calculateTextureWidthAndHeight(Z.dims,E.TextureType.unpacked),X=C.ShapeUtil.computeStrides(Z.dims);switch(H.mode){case"constant":return F(Y,Z.dims,X,U,j,H.pads,H.value);case"reflect":return V(Y,Z.dims,X,U,j,H.pads);case"edge":return W(Y,Z.dims,X,U,j,H.pads);default:throw new Error("Invalid mode")}},F=(z,Z,H,Y,U,j,X)=>{const K=Z.length;let q="";for(let J=K-1;J>=0;--J)q+=` k = m[${J}] - ${j[J]}; if (k < 0) return constant; if (k >= ${Z[J]}) return constant; offset += k * ${H[J]}; `;return` float padA(int m[${K}]) { const float constant = float(${X}); int offset = 0; int k = 0; ${q} vec2 coords = offsetToCoords(offset, ${Y}, ${U}); float value = getColorAsFloat(${z.texture2D}(A, coords)); return value; } `},V=(z,Z,H,Y,U,j)=>{const X=Z.length;let K="";for(let q=X-1;q>=0;--q)K+=` k = m[${q}] - ${j[q]}; if (k < 0) { k = -k; } { const int _2n_1 = ${2*(Z[q]-1)}; k = int( mod( float(k), float(_2n_1) ) ) ; if(k >= ${Z[q]}) { k = _2n_1 - k; } } offset += k * ${H[q]}; `;return` float padA(int m[${X}]) { int offset = 0; int k = 0; ${K} vec2 coords = offsetToCoords(offset, ${Y}, ${U}); float value = getColorAsFloat(${z.texture2D}(A, coords)); return value; } `},W=(z,Z,H,Y,U,j)=>{const X=Z.length;let K="";for(let q=X-1;q>=0;--q)K+=` k = m[${q}] - ${j[q]}; if (k < 0) k = 0; if (k >= ${Z[q]}) k = ${Z[q]-1}; offset += k * ${H[q]}; `;return` float padA(int m[${X}]) { int offset = 0; int k = 0; ${K} vec2 coords = offsetToCoords(offset, ${Y}, ${U}); float value = getColorAsFloat(${z.texture2D}(A, coords)); return value; } `}},2143:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.globalMaxPool=c.parseMaxPoolAttributes=c.maxPool=c.parseGlobalAveragePoolAttributes=c.globalAveragePool=c.parseAveragePoolAttributes=c.averagePool=void 0;const T=_(246),C=_(2517),M=_(2039);c.averagePool=(W,z,Z)=>{O(z);const H={name:"AveragePool",inputNames:["X"],inputTypes:[M.TextureType.unpacked],cacheHint:Z.cacheKey};return[W.run(Object.assign(Object.assign({},H),{get:()=>E(z,H,!1,Z)}),z)]},c.parseAveragePoolAttributes=W=>{const z=W.attributes.getString("auto_pad","NOTSET"),Z=W.attributes.getInt("ceil_mode",0),H=W.attributes.getInt("count_include_pad",0)!==0,Y=W.attributes.getInts("kernel_shape"),U=W.attributes.getInts("strides",[]),j=W.attributes.getInts("pads",[]);if(Z!==0)throw new Error("using ceil() in shape computation is not yet supported for AveragePool");return(0,T.createAttributeWithCacheKey)({autoPad:z,ceilMode:Z,countIncludePad:H,kernelShape:Y,strides:U,pads:j})};const E=(W,z,Z,H)=>{const[Y,U]=R(W,H,Z),j=C.ShapeUtil.size(Y.kernelShape);let X="";Y.countIncludePad?X+=`value /= float(${j});`:X+=`value /= float(${j} - pad);`;const K=` ${L(W[0].dims,Y,"value += _X(x);",X,"0.0")} `;return Object.assign(Object.assign({},z),{output:{dims:U,type:W[0].type,textureType:M.TextureType.unpacked},shaderSource:K})};c.globalAveragePool=(W,z,Z)=>{O(z);const H={name:"GlobalAveragePool",inputNames:["X"],inputTypes:[M.TextureType.unpacked],cacheHint:`${Z.countIncludePad}`};return[W.run(Object.assign(Object.assign({},H),{get:()=>E(z,H,!0,Z)}),z)]},c.parseGlobalAveragePoolAttributes=W=>{const z=W.attributes.getInt("count_include_pad",0)!==0;return(0,T.createAttributeWithCacheKey)({autoPad:"",ceilMode:0,countIncludePad:z,kernelShape:[],strides:[],pads:[]})},c.maxPool=(W,z,Z)=>{O(z);const H={name:"MaxPool",inputNames:["X"],inputTypes:[M.TextureType.unpacked],cacheHint:Z.cacheKey};return[W.run(Object.assign(Object.assign({},H),{get:()=>P(z,H,!1,Z)}),z)]},c.parseMaxPoolAttributes=W=>{const z=W.attributes.getString("auto_pad","NOTSET"),Z=W.attributes.getInt("ceil_mode",0),H=W.attributes.getInts("kernel_shape"),Y=W.attributes.getInts("strides",[]),U=W.attributes.getInts("pads",[]),j=W.attributes.getInt("storage_order",0),X=W.attributes.getInts("dilations",[]);if(j!==0)throw new Error("column major storage order is not yet supported for MaxPool");if(Z!==0)throw new Error("using ceil() in shape computation is not yet supported for MaxPool");return(0,T.createAttributeWithCacheKey)({autoPad:z,ceilMode:Z,countIncludePad:!1,kernelShape:H,strides:Y,pads:U,storageOrder:j,dilations:X})};const P=(W,z,Z,H)=>{const[Y,U]=R(W,H,Z),j=` ${L(W[0].dims,Y,` value = max(_X(x), value); `,"","-1e5")} `;return Object.assign(Object.assign({},z),{output:{dims:U,type:W[0].type,textureType:M.TextureType.unpacked},shaderSource:j})},R=(W,z,Z)=>{const H=W[0].dims.slice(),Y=Object.hasOwnProperty.call(z,"dilations"),U=z.kernelShape.slice(),j=z.strides.slice(),X=Y?z.dilations.slice():[],K=z.pads.slice();C.PoolConvUtil.adjustPoolAttributes(Z,H,U,j,X,K);const q=C.PoolConvUtil.computePoolOutputShape(Z,H,j,X,U,K,z.autoPad),J=Object.assign({},z);return Y?Object.assign(J,{kernelShape:U,strides:j,pads:K,dilations:X,cacheKey:z.cacheKey}):Object.assign(J,{kernelShape:U,strides:j,pads:K,cacheKey:z.cacheKey}),[J,q]},$={autoPad:"",ceilMode:0,countIncludePad:!1,kernelShape:[],strides:[],pads:[],storageOrder:0,dilations:[],cacheKey:""},G={name:"GlobalMaxPool",inputNames:["X"],inputTypes:[M.TextureType.unpacked]};c.globalMaxPool=(W,z)=>(O(z),[W.run(Object.assign(Object.assign({},G),{get:()=>P(z,G,!0,$)}),z)]);const O=W=>{if(!W||W.length!==1)throw new Error("Pool ops requires 1 input.");if(W[0].type!=="float32"&&W[0].type!=="float64")throw new Error("Invalid input type.")},L=(W,z,Z,H,Y)=>{const U=W.length;if(z.kernelShape.length<=2){const j=z.kernelShape[z.kernelShape.length-1],X=z.strides[z.strides.length-1],K=z.pads[z.pads.length/2-1],q=z.pads[z.pads.length-1],J=W[U-1];let Q="",ee="",re="";if(Q=K+q!==0?` for (int i = 0; i < ${j}; i++) { x[${U} - 1] = indices[${U} - 1] * ${X} - ${K} + i; if (x[${U} - 1] < 0 || x[${U} - 1] >= ${J}) { pad++; continue; } ${Z} }`:` for (int i = 0; i < ${j}; i++) { x[${U} - 1] = indices[${U} - 1] * ${X} - ${K} + i; ${Z} }`,z.kernelShape.length===2){const ie=z.kernelShape[z.kernelShape.length-2],ae=z.strides[z.strides.length-2],ne=z.pads[z.pads.length/2-2],te=z.pads[z.pads.length-2],oe=W[U-2];ee=ne+te!==0?` for (int j = 0; j < ${ie}; j++) { x[${U} - 2] = indices[${U} - 2] * ${ae} - ${ne} + j; if (x[${U} - 2] < 0 || x[${U} - 2] >= ${oe}) { pad+= ${j}; continue; } `:` for (int j = 0; j < ${ie}; j++) { x[${U} - 2] = indices[${U} - 2] * ${ae} - ${ne} + j; `,re=` } `}return` float process(int indices[${U}]) { int x[${U}]; copyVec(indices, x); float value = ${Y}; int pad = 0; ${ee} ${Q} ${re} ${H} return value; } `}{const j=C.ShapeUtil.size(z.kernelShape),X=C.ShapeUtil.computeStrides(z.kernelShape),K=X.length,q=z.pads.length,J=V(K),Q=F(W,"inputDims"),ee=F(z.pads,"pads"),re=F(X,"kernelStrides"),ie=F(z.strides,"strides");let ae="";return ae=z.pads.reduce((ne,te)=>ne+te)?` if (x[j] >= inputDims[j] || x[j] < 0) { pad++; isPad = true; break; } } if (!isPad) { ${Z} }`:` } ${Z} `,` ${J} float process(int indices[${U}]) { int x[${U}]; copyVec(indices, x); int offset[${K}]; int pads[${q}]; int inputDims[${U}]; int kernelStrides[${K}]; int strides[${K}]; ${ee} ${Q} ${ie} ${re} float value = ${Y}; int pad = 0; bool isPad = false; for (int i = 0; i < ${j}; i++) { offsetToIndices(i, kernelStrides, offset); isPad = false; for (int j = ${U} - ${K}; j < ${U}; j++) { x[j] = indices[j] * strides[j - ${U} + ${K}] + offset[j - ${U} + ${K}] - pads[j - 2]; ${ae} } ${H} return value; } `}},F=(W,z)=>{let Z="";for(let H=0;H` void offsetToIndices(int offset, int[${W}] strides, out int[${W}] indices) { if (${W} == 0) { return; } for (int i = 0; i < ${W} - 1; ++i) { indices[i] = offset / strides[i]; offset -= indices[i] * strides[i]; } indices[${W} - 1] = offset; }`},4939:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.reduceLogSumSquare=c.reduceLogSum=c.reduceProd=c.reduceMin=c.reduceMax=c.reduceMean=c.reduceSum=c.parseReduceAttributes=void 0;const T=_(246),C=_(782),M=_(2517),E=_(2039),P=(G,O,L,F,V)=>{$(O);const W={name:F,inputNames:["A"],inputTypes:[E.TextureType.unpacked]};return[G.run(Object.assign(Object.assign({},W),{cacheHint:L.cacheKey,get:()=>R(G,O,L,F,V,W)}),O)]};c.parseReduceAttributes=G=>{const O=G.attributes.getInts("axes",[]),L=G.attributes.getInt("keepdims",1)===1;return(0,T.createAttributeWithCacheKey)({axes:O,keepDims:L})};const R=(G,O,L,F,V,W)=>{const z=[],Z=O[0].dims.length||1,H=[],Y=M.ShapeUtil.normalizeAxes(L.axes,O[0].dims.length),U=V(O,Y);let j=U[1];for(let K=0;K=0||Y.length===0?(L.keepDims&&z.push(1),j=` for(int j${K} = 0; j${K} < ${O[0].dims[K]}; j${K}++) { inputIdx[${K}] = j${K}; ${j} }`):(H.push(`inputIdx[${K}] = outputIdx[${z.length}];`),z.push(O[0].dims[K]));const X=` float process(int outputIdx[${z.length||1}]) { float value; // final result int inputIdx[${Z}]; // addressing input data ${H.join(` `)} ${U[0]} // init ops for reduce max/min ${j} ${U[2]} // final computation for reduce mean return value; }`;return Object.assign(Object.assign({},W),{output:{dims:z,type:O[0].type,textureType:E.TextureType.unpacked},shaderSource:X})},$=G=>{if(!G||G.length!==1)throw new Error("Reduce op requires 1 input.");if(C.NUMBER_TYPES.indexOf(G[0].type)===-1)throw new Error("Invalid input type.")};c.reduceSum=(G,O,L)=>P(G,O,L,"ReduceSum",()=>["value = 0.0;","value += _A(inputIdx);",""]),c.reduceMean=(G,O,L)=>P(G,O,L,"ReduceMean",(F,V)=>{let W=1;for(let z=0;z=0||V.length===0)&&(W*=F[0].dims[z]);return["value = 0.0;","value += _A(inputIdx);",`value /= ${W}.;`]}),c.reduceMax=(G,O,L)=>P(G,O,L,"ReduceMax",(F,V)=>{const W=[];for(let z=0;z=0||V.length===0)&&W.push(`inputIdx[${z}] = 0;`);return[`${W.join(` `)} value = _A(inputIdx);`,"value = max(value, _A(inputIdx));",""]}),c.reduceMin=(G,O,L)=>P(G,O,L,"ReduceMin",(F,V)=>{const W=[];for(let z=0;z=0||V.length===0)&&W.push(`inputIdx[${z}] = 0;`);return[`${W.join(` `)} value = _A(inputIdx);`,"value = min(value, _A(inputIdx));",""]}),c.reduceProd=(G,O,L)=>P(G,O,L,"ReduceProd",()=>["value = 1.0;","value *= _A(inputIdx);",""]),c.reduceLogSum=(G,O,L)=>P(G,O,L,"ReduceLogSum",()=>["value = 0.0;","value += _A(inputIdx);","value = log(value);"]),c.reduceLogSumSquare=(G,O,L)=>P(G,O,L,"ReduceLogSumSquare",()=>["float t; value = 0.0;","t = _A(inputIdx); value += t * t;",""])},7019:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.isReshapeCheap=c.processDims3D=c.createPackedReshape3DProgramInfoLoader=void 0;const T=_(2517),C=_(5060),M=_(2039),E=_(2827);c.createPackedReshape3DProgramInfoLoader=(P,R,$)=>{const G=(O=>({name:"Reshape (packed)",inputTypes:[M.TextureType.packed],inputNames:["A"],cacheHint:`${O}`}))($);return Object.assign(Object.assign({},G),{get:()=>((O,L,F,V)=>{const W=L.dims,z=V;let Z="";for(let U=0;U<4;U++){let j="";switch(U){case 0:j="outputCoords = rc;";break;case 1:j="outputCoords = ivec3(rc.x, rc.y+1, rc.z);";break;case 2:j="outputCoords = ivec3(rc.x, rc.y, rc.z+1);";break;case 3:j="outputCoords = ivec3(rc.x, rc.y+1, rc.z+1);";break;default:throw new Error}Z+=` ${j} ${U>0?"if(outputCoords.y < rows && outputCoords.z < cols){":""} int flattenedIndex = getFlattenedIndex(outputCoords); ivec3 inputRC = inputCoordsFromReshapedOutCoords(flattenedIndex); vec2 innerDims = vec2(float(inputRC.y),float(inputRC.z)); result[${U}] = getChannel(getA(inputRC.x, inputRC.y, inputRC.z), innerDims); ${U>0?"}":""} `}const H=(0,C.getGlsl)(O.session.backend.glContext.version),Y=` ${function(U){const j=T.ShapeUtil.computeStrides(U),X=["b","r","c"],K="index";return` ivec3 inputCoordsFromReshapedOutCoords(int index) { ${j.map((q,J)=>`int ${X[J]} = ${K} / ${q}; ${J===j.length-1?`int ${X[J+1]} = ${K} - ${X[J]} * ${q}`:`index -= ${X[J]} * ${q}`};`).join("")} return ivec3(b, r, c); } `}(W)} ${function(U){const j=T.ShapeUtil.computeStrides(U);return` int getFlattenedIndex(ivec3 coords) { // reverse y, z order return coords.x * ${j[0]} + coords.z * ${j[1]} + coords.y; } `}(z)} ${(0,E.unpackFromChannel)()} void main() { ivec3 rc = getOutputCoords(); vec4 result = vec4(0.0); ivec3 outputCoords; int rows = ${z[2]}; int cols = ${z[1]}; ${Z} ${H.output} = result; } `;return Object.assign(Object.assign({},F),{output:{dims:z,type:L.type,textureType:M.TextureType.packed},shaderSource:Y,hasMain:!0})})(P,R,G,$)})},c.processDims3D=function(P){if(P.length===0)return[1,1,1];let R=1;for(let $=0;$1?P[P.length-2]:1,P[P.length-1]]},c.isReshapeCheap=function(P,R){let $=!1;return $=P.length===0||R.length===0||(P.length<2||R.length<2?P[P.length-1]===R[R.length-1]:P[P.length-1]===R[R.length-1]&&P[P.length-2]===R[R.length-2]),$}},718:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.reshape=void 0;const T=_(2517);c.reshape=(C,M)=>{const E=T.ShapeUtil.calculateReshapedDims(M[0].dims,M[1].integerData);return C.session.pack?[C.reshapePacked(M[0],E)]:[C.reshapeUnpacked(M[0],E)]}},2268:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseResizeAttributesV11=c.parseResizeAttributesV10=c.resize=void 0;const T=_(5060),C=_(2039),M=_(9390),E=_(2827),P=_(9793),R={name:"Resize",inputNames:["A"],inputTypes:[C.TextureType.packed]};c.resize=(F,V,W)=>((0,P.validateInputs)(V,W),[F.run(Object.assign(Object.assign({},R),{cacheHint:W.cacheKey,get:()=>$(F,V,W)}),V)]),c.parseResizeAttributesV10=F=>(0,P.parseUpsampleAttributes)(F,10),c.parseResizeAttributesV11=F=>(0,P.parseUpsampleAttributes)(F,11);const $=(F,V,W)=>{const z=(0,T.getGlsl)(F.session.backend.glContext.version),[Z,H]=G(V,W);if(Z.every(ae=>ae===1)&&W.coordinateTransformMode!=="tf_crop_and_resize")return Object.assign(Object.assign({},R),{output:{dims:H,type:V[0].type,textureType:C.TextureType.packed},hasMain:!0,shaderSource:`void main() { vec4 v = ${z.texture2D}(X, TexCoords); ${z.output} = v; }`});const Y=H.length;if(Y<2)throw new Error(`output dimension should be at least 2, but got ${Y}`);const U=H[Y-2],j=H[Y-1],X=V[0].dims;if(Y!==X.length)throw new Error(`output dimension should match input ${X.length}, but got ${Y}`);const K=X[Y-2],q=X[Y-1],J=Z[Y-2],Q=Z[Y-1];let ee="";if(W.mode!=="linear")throw new Error(`resize (packed) does not support mode: '${W.mode}'`);switch(W.coordinateTransformMode){case"asymmetric":ee=` vec4 getSourceFracIndex(ivec4 coords) { return vec4(coords) / scaleWHWH; } `;break;case"half_pixel":ee=` vec4 getSourceFracIndex(ivec4 coords) { return (vec4(coords) + 0.5) / scaleWHWH - 0.5; } `;break;case"pytorch_half_pixel":ee=` vec4 getSourceFracIndex(ivec4 coords) { vec4 fcoords = vec4(coords); return vec4( ${j}.0 > 1.0 ? (fcoords.x + 0.5) / scaleWHWH.x - 0.5 : 0.0, ${U}.0 > 1.0 ? (fcoords.y + 0.5) / scaleWHWH.y - 0.5 : 0.0, ${j}.0 > 1.0 ? (fcoords.z + 0.5) / scaleWHWH.z - 0.5 : 0.0, ${U}.0 > 1.0 ? (fcoords.w + 0.5) / scaleWHWH.w - 0.5 : 0.0 ); } `;break;case"align_corners":ee=` vec4 getSourceFracIndex(ivec4 coords) { vec4 resized = vec4(${j}.0 - 1.0, ${U}.0 - 1.0, ${j}.0 - 1.0, ${U}.0 - 1.0); vec4 original = vec4(${q}.0 - 1.0, ${K}.0 - 1.0, ${q}.0 - 1.0, ${K}.0 - 1.0); vec4 new_scale = original / resized; return vec4(coords) * new_scale; } `;break;default:throw new Error(`resize (packed) does not support coordinateTransformMode: '${W.coordinateTransformMode}'`)}const re=(0,M.getCoordsDataType)(Y),ie=` const vec2 inputWH = vec2(${K}.0, ${q}.0); const vec4 scaleWHWH = vec4(float(${J}), float(${Q}), float(${J}), float(${Q})); ${(0,E.unpackFromChannel)()} ${ee} float getAValue(int x10, int r, int c, int d) { return getChannel(getA(x10, r, c, d), vec2(c, d)); } void main() { ${re} rc = getOutputCoords(); int batch = rc[0]; int depth = rc[1]; // retrieve the 4 coordinates that is used in the 4 packed output values. ivec4 coords = ivec4(rc.wz, rc.w + 1, rc.z + 1); // calculate the source index in fraction vec4 sourceFrac = getSourceFracIndex(coords); // get the lower and upper bound of the 4 values that will be packed into one texel. ivec4 x00 = ivec4(max(sourceFrac.xy, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.xy))); ivec4 x01 = ivec4(max(sourceFrac.xw, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.xw))); ivec4 x10 = ivec4(max(sourceFrac.zy, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.zy))); ivec4 x11 = ivec4(max(sourceFrac.zw, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.zw))); bool hasNextRow = rc.w < ${U-1}; bool hasNextCol = rc.z < ${j-1}; // pack x00, x01, x10, x11's top-left corner into one vec4 structure vec4 topLeft = vec4( getAValue(batch, depth, x00.x, x00.y), hasNextCol ? getAValue(batch, depth, x01.x, x01.y) : 0.0, hasNextRow ? getAValue(batch, depth, x10.x, x10.y) : 0.0, (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.x, x11.y) : 0.0); // pack x00, x01, x10, x11's top-right corner into one vec4 structure vec4 topRight = vec4( getAValue(batch, depth, x00.x, x00.w), hasNextCol ? getAValue(batch, depth, x01.x, x01.w) : 0.0, hasNextRow ? getAValue(batch, depth, x10.x, x10.w) : 0.0, (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.x, x11.w) : 0.0); // pack x00, x01, x10, x11's bottom-left corner into one vec4 structure vec4 bottomLeft = vec4( getAValue(batch, depth, x00.z, x00.y), hasNextCol ? getAValue(batch, depth, x01.z, x01.y) : 0.0, hasNextRow ? getAValue(batch, depth, x10.z, x10.y) : 0.0, (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.z, x11.y) : 0.0); // pack x00, x01, x10, x11's bottom-right corner into one vec4 structure vec4 bottomRight = vec4( getAValue(batch, depth, x00.z, x00.w), hasNextCol ? getAValue(batch, depth, x01.z, x01.w) : 0.0, hasNextRow ? getAValue(batch, depth, x10.z, x10.w) : 0.0, (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.z, x11.w) : 0.0); // calculate the interpolation fraction on u and v direction vec4 frac = vec4(sourceFrac) - floor(sourceFrac); vec4 clampFrac = clamp(frac, vec4(0.0), vec4(1.0)); vec4 top = mix(topLeft, topRight, clampFrac.ywyw); vec4 bottom = mix(bottomLeft, bottomRight, clampFrac.ywyw); vec4 newValue = mix(top, bottom, clampFrac.xxzz); ${z.output} = vec4(newValue); } `;return Object.assign(Object.assign({},R),{output:{dims:H,type:V[0].type,textureType:C.TextureType.packed},hasMain:!0,shaderSource:ie})},G=(F,V)=>{const W=F[0].dims;let z,Z=V.scales;if(Z.length===0){const Y=F[V.scalesInputIdx];if(Y&&Y.size!==0){if(F[V.sizesInputIdx])throw new Error("Only one of scales or sizes must be provided as input.");Z=O(Y,V.mode,V.isResize)}else{const U=F[V.sizesInputIdx];if(!U||U.size===0)throw new Error("Either scales or sizes MUST be provided as input.");z=Array.from(U.integerData),Z=L(z,W,V.mode,V.isResize)}}else if(F[V.sizesInputIdx])throw new Error("Only one of scales or sizes must be provided as input.");const H=z||W.map((Y,U)=>Math.floor(Y*Z[U]));return[Z,H]},O=(F,V,W)=>{const z=Array.from(F.floatData);return(0,P.scalesValidation)(z,V,W),z},L=(F,V,W,z)=>{const Z=V.length,H=new Array(Z);for(let Y=0,U=Z;Y{Object.defineProperty(c,"__esModule",{value:!0}),c.shape=void 0;const T=_(9162);c.shape=(M,E)=>(C(E),[new T.Tensor([E[0].dims.length],"int32",void 0,void 0,new Int32Array(E[0].dims))]);const C=M=>{if(!M||M.length!==1)throw new Error("Shape requires 1 input.")}},2278:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.sliceV10=c.parseSliceAttributes=c.slice=void 0;const T=_(246),C=_(782),M=_(2517),E=_(2039),P={name:"Slice",inputNames:["A"],inputTypes:[E.TextureType.unpacked]};c.slice=(L,F,V)=>($(F),[L.run(Object.assign(Object.assign({},P),{cacheHint:V.cacheKey,get:()=>R(L,F[0],V)}),F)]),c.parseSliceAttributes=L=>{const F=L.attributes.getInts("starts"),V=L.attributes.getInts("ends"),W=L.attributes.getInts("axes",[]);return(0,T.createAttributeWithCacheKey)({starts:F,ends:V,axes:W})};const R=(L,F,V)=>{const W=V.axes.length===0?F.dims.slice(0).map((X,K)=>K):V.axes,z=M.ShapeUtil.normalizeAxes(W,F.dims.length),Z=V.starts.map((X,K)=>X>F.dims[z[K]]-1?F.dims[z[K]]:M.ShapeUtil.normalizeAxis(X,F.dims[z[K]])),H=V.ends.map((X,K)=>X>F.dims[z[K]]-1?F.dims[z[K]]:M.ShapeUtil.normalizeAxis(X,F.dims[z[K]])),Y=F.dims.slice(),U=[];for(let X=0;X0&&U.push(`outputIdx[${z[X]}] += ${Z[X]};`);const j=` float process(int outputIdx[${Y.length}]) { ${U.join(` `)} return _A(outputIdx); }`;return Object.assign(Object.assign({},P),{output:{dims:Y,type:F.type,textureType:E.TextureType.unpacked},shaderSource:j})},$=L=>{if(!L||L.length!==1)throw new Error("Slice requires 1 input.");if(C.NUMBER_TYPES.indexOf(L[0].type)===-1)throw new Error("Invalid input type.")};c.sliceV10=(L,F)=>{O(F);const V=G(L,F);return[L.run(Object.assign(Object.assign({},P),{cacheHint:V.cacheKey,get:()=>R(L,F[0],V)}),[F[0]])]};const G=(L,F)=>{if(!L.session.isInitializer(F[1].dataId)||!L.session.isInitializer(F[2].dataId)||F.length>=4&&!L.session.isInitializer(F[3].dataId)||F.length>=5&&!L.session.isInitializer(F[4].dataId))throw new Error("dynamic slice attributes are not allowed");if(F.length>=5&&F[4].integerData.some(Z=>Z!==1))throw new Error("currently non-1 steps is not supported for Slice");const V=Array.from(F[1].integerData),W=Array.from(F[2].integerData),z=F.length>=4?Array.from(F[3].integerData):[];return{starts:V,ends:W,axes:z,cacheKey:`${z};${V};${W}`}},O=L=>{if(!L||L.length<3||L.length>5)throw new Error("Invalid input number.");if(L[1].type!=="int32"||L[1].dims.length!==1)throw new Error("Invalid input type.");if(L[2].type!=="int32"||L[2].dims.length!==1)throw new Error("Invalid input type.");if(L.length>=4&&(L[3].type!=="int32"||L[3].dims.length!==1))throw new Error("Invalid input type.");if(L.length>=5&&(L[4].type!=="int32"||L[4].dims.length!==1))throw new Error("Invalid input type.")}},5524:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.softmaxV13=c.parseSoftmaxAttributesV13=c.parseSoftmaxAttributes=c.softmax=void 0;const T=_(246),C=_(2517),M=_(5060),E=_(2039),P=_(3738),R={name:"SoftmaxComputeMax",inputNames:["A"],inputTypes:[E.TextureType.unpacked]},$={name:"SoftmaxComputeScale",inputNames:["A","Max"],inputTypes:[E.TextureType.unpacked,E.TextureType.unpacked]},G={name:"SoftMax",inputNames:["A","Max","Norm"],inputTypes:[E.TextureType.unpacked,E.TextureType.unpacked,E.TextureType.unpacked]};c.softmax=(z,Z,H)=>{W(Z);const Y=Z[0].dims.slice(),U=C.ShapeUtil.normalizeAxis(H.axis,Y.length),j=C.ShapeUtil.sizeToDimension(Y,U),X=C.ShapeUtil.sizeFromDimension(Y,U);return O(z,Z,H,j,X)},c.parseSoftmaxAttributes=z=>(0,T.createAttributeWithCacheKey)({axis:z.attributes.getInt("axis",1)}),c.parseSoftmaxAttributesV13=z=>(0,T.createAttributeWithCacheKey)({axis:z.attributes.getInt("axis",-1)}),c.softmaxV13=(z,Z,H)=>{W(Z);const Y=Z[0].dims.slice(),U=C.ShapeUtil.normalizeAxis(H.axis,Y.length),j=Y.length,X=U!==j-1,K=[];let q,J=[],Q=[];X&&(J=Array.from({length:j}).map((ae,ne)=>ne),J[U]=j-1,J[j-1]=U,J.map(ae=>K.push(Y[ae])),q=(0,T.createAttributeWithCacheKey)({perm:J}),Q=(0,P.transpose)(z,Z,q));const ee=X?C.ShapeUtil.sizeToDimension(K,j-1):C.ShapeUtil.sizeToDimension(Y,j-1),re=X?C.ShapeUtil.sizeFromDimension(K,j-1):C.ShapeUtil.sizeFromDimension(Y,j-1),ie=O(z,X?Q:Z,H,ee,re);return X?(0,P.transpose)(z,ie,q):ie};const O=(z,Z,H,Y,U)=>{const j=L(z,Z[0],Y,U,[Y]),X=z.run(Object.assign(Object.assign({},R),{cacheHint:H.cacheKey,get:()=>j}),Z),K=F(z,Z[0],Y,U,j.output.dims,[Y]),q=z.run(Object.assign(Object.assign({},$),{cacheHint:H.cacheKey,get:()=>K}),[Z[0],X]),J=V(z,Z[0],Y,U,j.output.dims,K.output.dims);return[z.run(Object.assign(Object.assign({},G),{cacheHint:H.cacheKey,get:()=>J}),[Z[0],X,q])]},L=(z,Z,H,Y,U)=>{const[j,X]=z.calculateTextureWidthAndHeight(Z.dims,E.TextureType.unpacked),K=U.length;if(H<1||Y<1)throw new Error("Logical row count N and feature count D must be greater than or equal to 1");if(U.length!==1)throw new Error("Dimensionality of the output should be 1");if(U[0]!==H)throw new Error("Shape of the output should be equal to logical row count");const q=(0,M.getGlsl)(z.session.backend.glContext.version),J=` float process(int[${K}] indices) { int logical_row_start_offset = indices[0] * ${Y}; float max = getColorAsFloat(${q.texture2D}(A, offsetToCoords(logical_row_start_offset, ${j}, ${X} ))); for(int i=1; i<${Y}; ++i) { float current = getColorAsFloat(${q.texture2D}(A, offsetToCoords(logical_row_start_offset + i, ${j}, ${X}))); if(current > max) max = current; } return max; }`;return Object.assign(Object.assign({},R),{output:{dims:U,type:Z.type,textureType:E.TextureType.unpacked},shaderSource:J})},F=(z,Z,H,Y,U,j)=>{const[X,K]=z.calculateTextureWidthAndHeight(Z.dims,E.TextureType.unpacked),q=j.length;if(H<1||Y<1)throw new Error("Logical row count N and feature count D must be greater than or equal to 1");if(j.length!==1)throw new Error("Dimensionality of the output should be 1");if(j[0]!==H)throw new Error("Shape of the output should be equal to logical row count");if(U.length!==1)throw new Error("Dimensionality of the intermediate results should be 1");if(U[0]!==H)throw new Error("Shape of the intermediate results should be equal to logical row count");const J=` float process(int[${q}] indices) { int logical_row_start_offset = indices[0] * ${Y}; float norm_factor = 0.0; float max = _Max(indices); for(int i=0; i<${Y}; ++i) { norm_factor += exp(getColorAsFloat(${(0,M.getGlsl)(z.session.backend.glContext.version).texture2D}(A, offsetToCoords(logical_row_start_offset + i, ${X}, ${K}))) - max); } return norm_factor; }`;return Object.assign(Object.assign({},$),{output:{dims:j,type:Z.type,textureType:E.TextureType.unpacked},shaderSource:J})},V=(z,Z,H,Y,U,j)=>{const[X,K]=z.calculateTextureWidthAndHeight(Z.dims,E.TextureType.unpacked),q=Z.dims.length;if(H<1||Y<1)throw new Error("Logical row count N and feature count D must be greater than or equal to 1");if(U.length!==1||j.length!==1)throw new Error("Dimensionality of the intermediate results should be 1");if(U[0]!==H||j[0]!==H)throw new Error("Shape of the intermediate results should be equal to logical row count");const J=` float process(int[${q}] indices) { // get offset of current logical tensor index from the 2-D texture coordinates (TexCoords) int offset = coordsToOffset(TexCoords, ${X}, ${K}); //determine the logical row for this index int logical_row_index[1]; logical_row_index[0] = offset / ${Y}; float norm_factor = _Norm(logical_row_index); // avoid possible division by 0 // if norm_facor is 0, all elements are zero // if so, return 0 if(norm_factor == 0.0) return 0.0; return exp(_A(indices) - _Max(logical_row_index)) / norm_factor; }`;return Object.assign(Object.assign({},G),{output:{dims:Z.dims,type:Z.type,textureType:E.TextureType.unpacked},shaderSource:J})},W=z=>{if(!z||z.length!==1)throw new Error("Softmax requires 1 input.");if(z[0].type!=="float32"&&z[0].type!=="float64")throw new Error("Invalid input type")}},5975:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseSplitAttributes=c.split=void 0;const T=_(246),C=_(2517),M=_(2039),E={name:"Split",inputNames:["A"],inputTypes:[M.TextureType.unpacked]};c.split=(G,O,L)=>{$(O);const F=C.ShapeUtil.normalizeAxis(L.axis,O[0].dims.length),V=P(G,O,F,L),W=[];for(let z=0;zR(G,O[0],L,F,z)}),O));return W},c.parseSplitAttributes=G=>{const O=G.attributes.getInt("axis",0),L=G.attributes.getInts("split",[]),F=G.outputs.length;return(0,T.createAttributeWithCacheKey)({axis:O,split:L,numOutputs:F})};const P=(G,O,L,F)=>{const[,V]=C.SplitUtil.splitShape(O[0].dims,L,F.split,F.numOutputs);return V.length},R=(G,O,L,F,V)=>{const[W,z]=C.SplitUtil.splitShape(O.dims,F,L.split,L.numOutputs),Z=z[V],H=W[V],Y=` float process(int indices[${H.length}]) { indices[${F}] += ${Z}; return _A(indices); } `;return Object.assign(Object.assign({},E),{cacheHint:`${L.cacheKey}:${V}`,output:{dims:H,type:O.type,textureType:M.TextureType.unpacked},shaderSource:Y})},$=G=>{if(!G||G.length!==1)throw new Error("Split requires one input.");if(G[0].type!=="int8"&&G[0].type!=="uint8"&&G[0].type!=="int16"&&G[0].type!=="uint16"&&G[0].type!=="int32"&&G[0].type!=="uint32"&&G[0].type!=="float32"&&G[0].type!=="float64"&&G[0].type!=="bool")throw new Error("Invalid input type.")}},3933:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseSqueezeAttributes=c.squeezeV13=c.squeeze=void 0;const T=_(2517);c.squeeze=(E,P,R)=>{C(P);const $=T.ShapeUtil.squeezeShape(P[0].dims,R);return[E.reshapeUnpacked(P[0],$)]},c.squeezeV13=(E,P)=>(M(P),(0,c.squeeze)(E,[P[0]],Array.from(P[1].integerData))),c.parseSqueezeAttributes=E=>E.attributes.getInts("axes");const C=E=>{if(!E||E.length!==1)throw new Error("Squeeze requires 1 input.");if(E[0].type==="string")throw new Error("invalid input tensor types.")},M=E=>{if(!E||E.length!==2)throw new Error("Squeeze requires 2 inputs.");if(E[1].type!=="int32")throw new Error("Invalid input type.")}},6558:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.sum=void 0;const T=_(5060),C=_(2039);c.sum=(P,R)=>{E(R);const $={name:"Sum",inputNames:R.map((G,O)=>`X${O}`),inputTypes:new Array(R.length).fill(C.TextureType.unpacked)};return[P.run(Object.assign(Object.assign({},$),{get:()=>M(P,R,$)}),R)]};const M=(P,R,$)=>{const G=(0,T.getGlsl)(P.session.backend.glContext.version),O=R[0].dims.slice(),L=` void main() { vec4 result = ${R.map((F,V)=>`${G.texture2D}(X${V},TexCoords)`).join(" + ")}; ${G.output} = result; } `;return Object.assign(Object.assign({},$),{output:{dims:O,type:R[0].type,textureType:C.TextureType.unpacked},hasMain:!0,shaderSource:L})},E=P=>{if(!P||P.length===0)throw new Error("Sum requires inputs.");const R=P[0].dims.length;for(let $=1;${Object.defineProperty(c,"__esModule",{value:!0}),c.tile=void 0;const T=_(782),C=_(2039);c.tile=(P,R)=>{E(R);const $={name:"Tile",inputNames:["A"],inputTypes:[C.TextureType.unpacked]};return[P.run(Object.assign(Object.assign({},$),{get:()=>M(P,R,$)}),R)]};const M=(P,R,$)=>{const G=R[0].dims.slice(),O=new Array(G.length),L=[];for(let W=0;W{if(!P||P.length!==2)throw new Error("Tile requires 2 input.");if(P[1].dims.length!==1)throw new Error("The second input shape must 1 dimension.");if(P[1].dims[0]!==P[0].dims.length)throw new Error("Invalid input shape.");if(T.NUMBER_TYPES.indexOf(P[0].type)===-1)throw new Error("Invalid input type.");if(P[1].type!=="int32"&&P[1].type!=="int16")throw new Error("Invalid repeat type.")}},3738:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseTransposeAttributes=c.transpose=void 0;const T=_(246),C=_(2517),M=_(2039),E={name:"Transpose",inputNames:["A"],inputTypes:[M.TextureType.unpacked]};c.transpose=(L,F,V)=>(O(F),[L.run(Object.assign(Object.assign({},E),{cacheHint:V.cacheKey,get:()=>P(L,F[0],V.perm)}),F)]),c.parseTransposeAttributes=L=>(0,T.createAttributeWithCacheKey)({perm:L.attributes.getInts("perm",[])});const P=(L,F,V)=>{const W=F.dims;V=R(W,V);const z=$(W,V),Z=W.length,H=` ${G("perm",V,Z)} float process(int indices[${Z}]) { int a[${Z}]; perm(a, indices); return _A(a); }`;return Object.assign(Object.assign({},E),{output:{dims:z,type:F.type,textureType:M.TextureType.unpacked},shaderSource:H})},R=(L,F)=>(F&&F.length!==L.length&&(F=[...L.keys()].reverse()),F),$=(L,F)=>(F=R(L,F),C.ShapeUtil.sortBasedOnPerm(L,F)),G=(L,F,V)=>{const W=[];W.push(`void ${L}(out int a[${V}], int src[${V}]) {`);for(let z=0;z{if(!L||L.length!==1)throw new Error("Transpose requires 1 input.");if(L[0].type!=="float32"&&L[0].type!=="float64")throw new Error("input should be float tensor")}},8710:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.encodeAsUint8=void 0;const T=_(5060),C=_(2039);c.encodeAsUint8=(M,E)=>{const P=E.shape,R=(0,T.getGlsl)(M.session.backend.glContext.version),$=` const float FLOAT_MAX = 1.70141184e38; const float FLOAT_MIN = 1.17549435e-38; bool isNaN(float val) { return (val < 1.0 || 0.0 < val || val == 0.0) ? false : true; } highp vec4 encodeAsUint8(highp float v) { if (isNaN(v)) { return vec4(255, 255, 255, 255); } highp float av = abs(v); if(av < FLOAT_MIN) { return vec4(0.0, 0.0, 0.0, 0.0); } else if(v > FLOAT_MAX) { return vec4(0.0, 0.0, 128.0, 127.0) / 255.0; } else if(v < -FLOAT_MAX) { return vec4(0.0, 0.0, 128.0, 255.0) / 255.0; } highp vec4 c = vec4(0,0,0,0); highp float e = floor(log2(av)); highp float m = exp2(fract(log2(av))) - 1.0; c[2] = floor(128.0 * m); m -= c[2] / 128.0; c[1] = floor(32768.0 * m); m -= c[1] / 32768.0; c[0] = floor(8388608.0 * m); highp float ebias = e + 127.0; c[3] = floor(ebias / 2.0); ebias -= c[3] * 2.0; c[2] += floor(ebias) * 128.0; c[3] += 128.0 * step(0.0, -v); return c / 255.0; } void main() { float value = ${R.texture2D}(X,TexCoords).r; ${R.output} = encodeAsUint8(value); }`,G={name:"Uint8Encode",inputTypes:[C.TextureType.unpacked],inputNames:["X"],output:{dims:P,type:E.tensor.type,textureType:C.TextureType.downloadUint8AsFloat},shaderSource:$,hasMain:!0};return M.executeProgram(G,[E.tensor])}},4909:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.tanh=c.tan=c.sqrt=c.sin=c.sigmoid=c.relu=c.not=c.neg=c.log=c.parseLeakyReluAttributes=c.leakyRelu=c.identity=c.floor=c.exp=c.parseEluAttributes=c.elu=c.cos=c.ceil=c.clipV11=c.parseClipAttributes=c.clip=c.atan=c.asin=c.acos=c.abs=c.glslTanh=c.glslTan=c.glslSqrt=c.glslSigmoid=c.glslRelu=c.glslSin=c.glslNot=c.glslNeg=c.glslLog=c.glslLeakyRelu=c.glslIdentity=c.glslClip=c.glslFloor=c.glslExp=c.glslElu=c.glslCos=c.glslCeil=c.glslAtan=c.glslAsin=c.glslAcos=c.glslAbs=void 0;const T=_(246),C=_(2517),M=_(8520),E=_(5060),P=_(2039);function R(){return ie("abs")}function $(){return ie("acos")}function G(){return ie("asin")}function O(){return ie("atan")}function L(){return ie("ceil")}function F(){return ie("cos")}function V(te){const oe="elu";return{body:` const float alpha = float(${te}); float ${oe}_(float a) { return a >= 0.0 ? a: (exp(a) - 1.0) * alpha; } vec4 ${oe}_(vec4 v) { return vec4(${oe}_(v.x), ${oe}_(v.y), ${oe}_(v.z), ${oe}_(v.w)); } `,name:oe,type:M.FunctionType.ValueBased}}function W(){return ie("exp")}function z(){return ie("floor")}function Z(te,oe){const ue="clip";return{body:` const float min = float(${te}); const float max = float(${oe}); float ${ue}_(float a) { return clamp(a, min, max); } vec4 ${ue}_(vec4 v) { return clamp(v, min, max); } `,name:ue,type:M.FunctionType.ValueBased}}function H(){const te="indentity";return{body:` float ${te}_(float a) { return a; } vec4 ${te}_(vec4 v) { return v; } `,name:te,type:M.FunctionType.ValueBased}}function Y(te){const oe="leakyRelu";return{body:` const float alpha = float(${te}); float ${oe}_(float a) { return a < 0.0 ? a * alpha : a; } vec4 ${oe}_(vec4 v) { return vec4(${oe}_(v.x), ${oe}_(v.y), ${oe}_(v.z), ${oe}_(v.w)); } `,name:oe,type:M.FunctionType.ValueBased}}function U(){return ie("log")}function j(){const te="neg";return{body:` float ${te}_(float a) { return -a; } vec4 ${te}_(vec4 v) { return -v; } `,name:te,type:M.FunctionType.ValueBased}}function X(){const te="not";return{body:` float ${te}_(float a) { return float( ! bool(a) ); } bool ${te}_(bool a) { return !a; } vec4 ${te}_(vec4 v) { return vec4(!bool(v.x), !bool(v.y), !bool(v.z), !bool(v.w)); } bvec4 ${te}_(bvec4 v) { return bvec4(!v.x, !v.y, !v.z, !v.w); } `,name:te,type:M.FunctionType.ValueBased}}function K(){return ie("sin")}function q(){const te="relu";return{body:` float ${te}_(float a) { return max( a, 0.0 ); } vec4 ${te}_(vec4 v) { return max( v, 0.0 ); } `,name:te,type:M.FunctionType.ValueBased}}function J(){const te="sigmoid";return{body:` float ${te}_(float a) { return 1.0 / (1.0 + exp(-a)); } vec4 ${te}_(vec4 v) { return 1.0 / (1.0 + exp(-v)); } `,name:te,type:M.FunctionType.ValueBased}}function Q(){return ie("sqrt")}function ee(){return ie("tan")}function re(){const te="tanh";return{body:` float ${te}_(float a) { a = clamp(a, -10., 10.); a = exp(2.*a); return (a - 1.) / (a + 1.); } vec4 ${te}_(vec4 v) { v = clamp(v, -10., 10.); v = exp(2.*v); return (v - 1.) / (v + 1.); } `,name:te,type:M.FunctionType.ValueBased}}function ie(te){return{body:` float ${te}_(float a) { return ${te}(a); } vec4 ${te}_(vec4 v) { return ${te}(v); } `,name:te,type:M.FunctionType.ValueBased}}c.glslAbs=R,c.glslAcos=$,c.glslAsin=G,c.glslAtan=O,c.glslCeil=L,c.glslCos=F,c.glslElu=V,c.glslExp=W,c.glslFloor=z,c.glslClip=Z,c.glslIdentity=H,c.glslLeakyRelu=Y,c.glslLog=U,c.glslNeg=j,c.glslNot=X,c.glslSin=K,c.glslRelu=q,c.glslSigmoid=J,c.glslSqrt=Q,c.glslTan=ee,c.glslTanh=re;const ae=(te,oe,ue,de)=>{const pe=te.session.pack?P.TextureType.packed:P.TextureType.unpacked,he={name:ue.name,inputTypes:[pe],inputNames:["A"],cacheHint:de};return Object.assign(Object.assign({},he),{get:()=>((we,ye,Me,Pe)=>{const Re=we.session.pack?P.TextureType.packed:P.TextureType.unpacked,De=(0,E.getGlsl)(we.session.backend.glContext.version);return Object.assign(Object.assign({},ye),{output:{dims:Me.dims,type:Me.type,textureType:Re},shaderSource:` ${Pe.body} void main() { vec4 v = ${De.texture2D}(A, TexCoords); v = ${Pe.name}_(v); ${De.output} = v; } `,hasMain:!0})})(te,he,oe,ue)})};c.abs=(te,oe)=>[te.run(ae(te,oe[0],R()),oe)],c.acos=(te,oe)=>[te.run(ae(te,oe[0],$()),oe)],c.asin=(te,oe)=>[te.run(ae(te,oe[0],G()),oe)],c.atan=(te,oe)=>[te.run(ae(te,oe[0],O()),oe)],c.clip=(te,oe,ue)=>[te.run(ae(te,oe[0],Z(ue.min,ue.max),ue.cacheKey),oe)],c.parseClipAttributes=te=>(0,T.createAttributeWithCacheKey)({min:te.attributes.getFloat("min",C.MIN_CLIP),max:te.attributes.getFloat("max",C.MAX_CLIP)}),c.clipV11=(te,oe)=>{const ue=ne(te,oe);return(0,c.clip)(te,[oe[0]],ue)};const ne=(te,oe)=>{if(oe.length>=3&&(!te.session.isInitializer(oe[1].dataId)||!te.session.isInitializer(oe[2].dataId)))throw new Error("dynamic clip attributes are not allowed");const ue=oe.length>=3?oe[1].numberData[0]:C.MIN_CLIP,de=oe.length>=3?oe[2].numberData[0]:C.MAX_CLIP;return(0,T.createAttributeWithCacheKey)({min:ue,max:de})};c.ceil=(te,oe)=>[te.run(ae(te,oe[0],L()),oe)],c.cos=(te,oe)=>[te.run(ae(te,oe[0],F()),oe)],c.elu=(te,oe,ue)=>[te.run(ae(te,oe[0],V(ue.alpha),ue.cacheKey),oe)],c.parseEluAttributes=te=>(0,T.createAttributeWithCacheKey)({alpha:te.attributes.getFloat("alpha",1)}),c.exp=(te,oe)=>[te.run(ae(te,oe[0],W()),oe)],c.floor=(te,oe)=>[te.run(ae(te,oe[0],z()),oe)],c.identity=(te,oe)=>[te.run(ae(te,oe[0],H()),oe)],c.leakyRelu=(te,oe,ue)=>[te.run(ae(te,oe[0],Y(ue.alpha),ue.cacheKey),oe)],c.parseLeakyReluAttributes=te=>(0,T.createAttributeWithCacheKey)({alpha:te.attributes.getFloat("alpha",.01)}),c.log=(te,oe)=>[te.run(ae(te,oe[0],U()),oe)],c.neg=(te,oe)=>[te.run(ae(te,oe[0],j()),oe)],c.not=(te,oe)=>[te.run(ae(te,oe[0],X()),oe)],c.relu=(te,oe)=>[te.run(ae(te,oe[0],q()),oe)],c.sigmoid=(te,oe)=>[te.run(ae(te,oe[0],J()),oe)],c.sin=(te,oe)=>[te.run(ae(te,oe[0],K()),oe)],c.sqrt=(te,oe)=>[te.run(ae(te,oe[0],Q()),oe)],c.tan=(te,oe)=>[te.run(ae(te,oe[0],ee()),oe)],c.tanh=(te,oe)=>[te.run(ae(te,oe[0],re()),oe)]},5611:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createUnpackProgramInfoLoader=c.createUnpackProgramInfo=void 0;const T=_(5060),C=_(2039),M=_(9390),E=_(2827),P={name:"unpack",inputNames:["A"],inputTypes:[C.TextureType.packed]};c.createUnpackProgramInfo=(R,$)=>{const G=$.dims.length,O=(0,E.getChannels)("rc",G),L=O.slice(-2),F=(0,M.getCoordsDataType)(G),V=(0,E.unpackFromChannel)(),W=$.dims.length===0?"":function(H,Y){if(H===1)return"rc";let U="";for(let j=0;jObject.assign(Object.assign({},P),{get:()=>(0,c.createUnpackProgramInfo)(R,$)})},8428:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.parseUnsqueezeAttributes=c.unsqueezeV13=c.unsqueeze=void 0;const T=_(2517);c.unsqueeze=(E,P,R)=>{C(P);const $=T.ShapeUtil.unsqueezeShape(P[0].dims,R);return[E.reshapeUnpacked(P[0],$)]},c.unsqueezeV13=(E,P)=>(M(P),(0,c.unsqueeze)(E,[P[0]],Array.from(P[1].integerData))),c.parseUnsqueezeAttributes=E=>E.attributes.getInts("axes");const C=E=>{if(!E||E.length!==1)throw new Error("Unsqueeze requires 1 input.");if(E[0].type==="string")throw new Error("invalid input tensor types.")},M=E=>{if(!E||E.length!==2)throw new Error("Unsqueeze requires 2 inputs.");if(E[1].type!=="int32")throw new Error("Invalid input type.")}},9793:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.scalesValidation=c.validateInputs=c.parseUpsampleAttributes=c.parseUpsampleAttributesV9=c.parseUpsampleAttributesV7=c.upsample=void 0;const T=_(246),C=_(5060),M=_(2039),E={name:"Upsample",inputNames:["X"],inputTypes:[M.TextureType.unpacked]};c.upsample=(R,$,G)=>((0,c.validateInputs)($,G),[R.run(Object.assign(Object.assign({},E),{cacheHint:G.cacheKey,get:()=>P(R,$,G)}),$)]),c.parseUpsampleAttributesV7=R=>(0,c.parseUpsampleAttributes)(R,7),c.parseUpsampleAttributesV9=R=>(0,c.parseUpsampleAttributes)(R,9),c.parseUpsampleAttributes=(R,$)=>{const G=$>=10,O=R.attributes.getString("mode","nearest");if(O!=="nearest"&&O!=="linear"&&($<11||O!=="cubic"))throw new Error(`unrecognized mode: ${O}`);let L=[];$<9&&(L=R.attributes.getFloats("scales"),(0,c.scalesValidation)(L,O,G));const F=R.attributes.getFloat("extrapolation_value",0),V=$>10?R.attributes.getString("coordinate_transformation_mode","half_pixel"):"asymmetric";if(["asymmetric","pytorch_half_pixel","tf_half_pixel_for_nn","align_corners","tf_crop_and_resize","half_pixel"].indexOf(V)===-1)throw new Error(`coordinate_transform_mode '${V}' is not supported`);const W=V==="tf_crop_and_resize",z=W,Z=O==="nearest"&&$>=11?R.attributes.getString("nearest_mode","round_prefer_floor"):"";if(["round_prefer_floor","round_prefer_ceil","floor","ceil",""].indexOf(Z)===-1)throw new Error(`nearest_mode '${Z}' is not supported`);const H=R.attributes.getFloat("cubic_coeff_a",-.75),Y=R.attributes.getInt("exclude_outside",0)!==0;if(Y&&O!=="cubic")throw new Error("exclude_outside can be set to 1 only when mode is CUBIC.");const U=$<11||O==="nearest"&&V==="asymmetric"&&Z==="floor";let j=0,X=0,K=0;return $>10?R.inputs.length>2?(j=1,X=2,K=3):(X=1,K=2):$===9&&(X=1),(0,T.createAttributeWithCacheKey)({opset:$,isResize:G,mode:O,scales:L,extrapolationValue:F,coordinateTransformMode:V,useExtrapolation:z,needRoiInput:W,nearestMode:Z,cubicCoefficientA:H,excludeOutside:Y,useNearest2xOptimization:U,roiInputIdx:j,scalesInputIdx:X,sizesInputIdx:K})};const P=(R,$,G)=>{const O=(0,C.getGlsl)(R.session.backend.glContext.version),[L,F]=R.calculateTextureWidthAndHeight($[0].dims,M.TextureType.unpacked),V=$[0].dims.map((K,q)=>Math.floor(K*G.scales[q])),[W,z]=R.calculateTextureWidthAndHeight(V,M.TextureType.unpacked),Z=V.length,H=new Array(Z),Y=new Array(Z);let U=` int output_pitches[${Z}]; int input_pitches[${Z}]; `;for(let K=Z-1;K>=0;K--)H[K]=K===Z-1?1:H[K+1]*V[K+1],Y[K]=K===Z-1?1:Y[K+1]*$[0].dims[K+1],U+=` output_pitches[${K}] = ${H[K]}; input_pitches[${K}] = ${Y[K]}; `;const j=` float getInputFloat(int index) { vec2 coords = offsetToCoords(index, ${L}, ${F}); float value = getColorAsFloat(${O.texture2D}(X, coords)); return value; } `,X=G.mode==="nearest"?` ${j} float process(int indices[${Z}]) { int input_index = 0; int output_index = coordsToOffset(TexCoords, ${W}, ${z}); ${U} int d, m; for (int dim = 0; dim < ${Z}; ++dim) { d = output_index / output_pitches[dim]; m = output_index - d * output_pitches[dim]; output_index = m; if (scales[dim] != 1 && d > 0) { int d2 = d / scales[dim]; m = d - d2 * scales[dim]; d = d2; } input_index += input_pitches[dim] * d; } return getInputFloat(input_index); }`:Z===4?` ${j} float process(int indices[4]) { int input_index = 0; int output_index = coordsToOffset(TexCoords, ${W}, ${z}); ${U} int m; int index_of_dim0, index_of_dim1, index_of_dim2, index_of_dim3; index_of_dim0 = output_index / output_pitches[0]; m = output_index - index_of_dim0 * output_pitches[0]; index_of_dim1 = m / output_pitches[1]; m = m - index_of_dim1 * output_pitches[1]; index_of_dim2 = m / output_pitches[2]; m = m - index_of_dim2 * output_pitches[2]; index_of_dim3 = m; int index_of_input_dim2, index_of_input_dim3, x_offset, y_offset; index_of_input_dim2 = index_of_dim2 / scales[2]; y_offset = index_of_dim2 - index_of_input_dim2 * scales[2]; index_of_input_dim3 = index_of_dim3 / scales[3]; x_offset = index_of_dim3 - index_of_input_dim3 * scales[3]; input_index = index_of_dim0 * input_pitches[0] + index_of_dim1 * input_pitches[1] + index_of_input_dim2 * input_pitches[2] + index_of_input_dim3; float x00 = getInputFloat(input_index); float x10, x01, x11; bool end_of_dim2 = false; if (index_of_input_dim2 == (${$[0].dims[2]} - 1)) { // It's the end in dimension 2 x01 = x00; end_of_dim2 = true; } else { x01 = getInputFloat(input_index + input_pitches[2]); } if (index_of_input_dim3 == (input_pitches[2] - 1)) { // It's the end in dimension 3 x10 = x00; x11 = x01; } else { x10 = getInputFloat(input_index + 1); x11 = end_of_dim2 ? x10 : getInputFloat(input_index + input_pitches[2] + 1); } float y0 = x00 + float(y_offset) * (x01 - x00) / float(scales[2]); float y1 = x10 + float(y_offset) * (x11 - x10) / float(scales[2]); return y0 + float(x_offset) * (y1 - y0) / float(scales[3]); }`:` ${j} float process(int indices[2]) { int input_index = 0; int output_index = coordsToOffset(TexCoords, ${W}, ${z}); ${U} int m; int index_of_dim0, index_of_dim1; index_of_dim0 = output_index / output_pitches[0]; m = output_index - index_of_dim0 * output_pitches[0]; index_of_dim1 = m; int index_of_input_dim0, index_of_input_dim1, x_offset, y_offset; index_of_input_dim0 = index_of_dim0 / scales[0]; y_offset = index_of_dim0 - index_of_input_dim0 * scales[0]; index_of_input_dim1 = index_of_dim1 / scales[1]; x_offset = index_of_dim1 - index_of_input_dim1 * scales[1]; input_index = index_of_input_dim0 * input_pitches[0] + index_of_input_dim1; float x00 = getInputFloat(input_index); float x10, x01, x11; bool end_of_dim0 = false; if (index_of_input_dim0 == (${$[0].dims[0]} - 1)) { // It's the end in dimension 0 x01 = x00; end_of_dim0 = true; } else { x01 = getInputFloat(input_index + input_pitches[0]); } if (index_of_input_dim1 == (input_pitches[0] - 1)) { // It's the end in dimension 1 x10 = x00; x11 = x01; } else { x10 = getInputFloat(input_index + 1); x11 = end_of_dim0 ? x10 : getInputFloat(input_index + input_pitches[0] + 1); } float y0 = x00 + float(y_offset) * (x01 - x00) / float(scales[0]); float y1 = x10 + float(y_offset) * (x11 - x10) / float(scales[0]); return y0 + float(x_offset) * (y1 - y0) / float(scales[1]); }`;return Object.assign(Object.assign({},E),{output:{dims:V,type:$[0].type,textureType:M.TextureType.unpacked},shaderSource:X,variables:[{name:"scales",type:"int",arrayLength:G.scales.length,data:G.scales.map(K=>Math.ceil(K))}]})};c.validateInputs=(R,$)=>{if(!R||$.opset<9&&R.length!==1||$.opset>=9&&$.opset<11&&R.length!==2||$.opset>=11&&R.length<2)throw new Error("invalid inputs.");if($.scales.length>0&&R[0].dims.length!==$.scales.length)throw new Error("Invalid input shape.");if(R[0].type==="string")throw new Error("Invalid input tensor types.")},c.scalesValidation=(R,$,G)=>{if(G){for(const O of R)if(O<=0)throw new Error("Scale value should be greater than 0.")}else for(const O of R)if(O<1)throw new Error("Scale value should be greater than or equal to 1.");if(!($!=="linear"&&$!=="cubic"||R.length===2||R.length===4&&R[0]===1&&R[1]===1))throw new Error(`'Linear' mode and 'Cubic' mode only support 2-D inputs ('Bilinear', 'Bicubic') or 4-D inputs with the corresponding outermost 2 scale values being 1 in the ${G?"Resize":"Upsample"} opeartor.`)}},1958:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ProgramManager=void 0;const T=_(1670),C=_(6231),M=_(8879),E=_(5060);c.ProgramManager=class{constructor(P,R,$){this.profiler=P,this.glContext=R,this.textureLayoutStrategy=$,this.repo=new Map,this.attributesBound=!1}getArtifact(P){return this.repo.get(P)}setArtifact(P,R){this.repo.set(P,R)}run(P,R,$){var G;this.profiler.event("op",`ProgramManager.run ${(G=P.programInfo.name)!==null&&G!==void 0?G:"unknown kernel"}`,()=>{var O;const L=this.glContext.gl,F=P.program;L.useProgram(F);try{this.bindOutput($),this.attributesBound||this.bindAttributes(P.attribLocations),this.bindUniforms(P.uniformLocations,(O=P.programInfo.variables)!==null&&O!==void 0?O:[],R)}catch(V){throw C.Logger.error("ProgramManager",P.programInfo.shaderSource),V}this.profiler.event("backend","GlContext.draw()",()=>{this.glContext.draw()})},this.glContext)}dispose(){this.vertexShader&&this.glContext.deleteShader(this.vertexShader),this.repo.forEach(P=>this.glContext.deleteProgram(P.program))}build(P,R,$){return this.profiler.event("backend","ProgramManager.build",()=>{const G=new M.GlslPreprocessor(this.glContext,P,R,$),O=G.preprocess(),L=this.compile(O);return{programInfo:P,program:L,uniformLocations:this.getUniformLocations(L,G.context.programInfo.inputNames,G.context.programInfo.variables),attribLocations:this.getAttribLocations(L)}})}compile(P){if(!this.vertexShader){C.Logger.verbose("ProrgramManager","Compiling and caching Vertex shader for the first time");const G=(0,E.getVertexShaderSource)(this.glContext.version);this.vertexShader=this.glContext.compileShader(G,this.glContext.gl.VERTEX_SHADER)}T.env.debug&&C.Logger.verbose("ProrgramManager",`FragShader: ${P} `);const R=this.glContext.compileShader(P,this.glContext.gl.FRAGMENT_SHADER),$=this.glContext.createProgram(this.vertexShader,R);return this.glContext.deleteShader(R),$}bindOutput(P){const R=P.width,$=P.height;C.Logger.verbose("ProrgramManager",`Binding output texture to Framebuffer: w/h=${R}/${$}, shape=${P.shape}, type=${P.tensor.type}`),this.glContext.attachFramebuffer(P.texture,R,$)}bindAttributes(P){const R=P.position,$=P.textureCoord;this.glContext.setVertexAttributes(R,$),this.attributesBound=!0}bindUniforms(P,R,$){var G;const O=this.glContext.gl;let L=0;for(const{name:F,type:V,location:W,arrayLength:z}of P){const Z=(G=R.find(H=>H.name===F))===null||G===void 0?void 0:G.data;if(V!=="sampler2D"&&!Z)throw new Error(`variable '${F}' does not have data defined in program info`);switch(V){case"sampler2D":this.bindTexture($[L],W,L),L++;break;case"float":z?O.uniform1fv(W,Z):O.uniform1f(W,Z);break;case"int":z?O.uniform1iv(W,Z):O.uniform1i(W,Z);break;default:throw new Error(`Uniform not implemented: ${V}`)}}}bindTexture(P,R,$){this.glContext.bindTextureToUniform(P.texture,$,R)}getAttribLocations(P){return{position:this.getAttribLocation(P,"position"),textureCoord:this.getAttribLocation(P,"textureCoord")}}getUniformLocations(P,R,$){const G=[];if(R)for(const O of R)G.push({name:O,type:"sampler2D",location:this.getUniformLocation(P,O)});if($)for(const O of $)G.push(Object.assign(Object.assign({},O),{location:this.getUniformLocation(P,O.name)}));return G}getUniformLocation(P,R){const $=this.glContext.gl.getUniformLocation(P,R);if($===null)throw new Error(`Uniform ${R} not found.`);return $}getAttribLocation(P,R){return this.glContext.gl.getAttribLocation(P,R)}}},6416:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.WebGLSessionHandler=void 0;const T=_(6231),C=_(1047),M=_(8316),E=_(1640),P=_(1958),R=_(7859),$=_(5702);c.WebGLSessionHandler=class{constructor(G,O){this.backend=G,this.context=O,this.layoutStrategy=new R.PreferLogicalStrategy(G.glContext.maxTextureSize),this.programManager=new P.ProgramManager(this.context.profiler,G.glContext,this.layoutStrategy),this.textureManager=new $.TextureManager(G.glContext,this.layoutStrategy,this.context.profiler,{reuseTextures:G.textureCacheMode==="full"}),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache=new Map,this.pack=G.pack,this.pack2unpackMap=new Map,this.unpack2packMap=new Map}createInferenceHandler(){return new M.WebGLInferenceHandler(this)}onGraphInitialized(G){const O=G.getValues().filter(L=>L.from===-1&&L.tensor).map(L=>L.tensor.dataId);this.initializers=new Set(O)}isInitializer(G){return!!this.initializers&&this.initializers.has(G)}addInitializer(G){this.initializers.add(G)}getTextureData(G,O){return O?this.packedTextureDataCache.get(G):this.unpackedTextureDataCache.get(G)}setTextureData(G,O,L=!1){T.Logger.verbose("WebGLSessionHandler","Storing Texture data in cache"),L?this.packedTextureDataCache.set(G,O):this.unpackedTextureDataCache.set(G,O)}dispose(){this.programManager.dispose(),this.textureManager.clearActiveTextures(),this.packedTextureDataCache.forEach(G=>this.textureManager.releaseTexture(G,!0)),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache.forEach(G=>this.textureManager.releaseTexture(G,!0)),this.unpackedTextureDataCache=new Map}resolve(G,O,L){const F=(0,C.resolveOperator)(G,O,E.WEBGL_OP_RESOLVE_RULES);return{impl:F.opImpl,context:F.opInit?F.opInit(G,L):G}}}},7769:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Uint8DataEncoder=c.RGBAFloatDataEncoder=c.RedFloat32DataEncoder=void 0;const T=_(6231);c.RedFloat32DataEncoder=class{constructor(C,M=1){if(M===1)this.internalFormat=C.R32F,this.format=C.RED,this.textureType=C.FLOAT,this.channelSize=M;else{if(M!==4)throw new Error(`Invalid number of channels: ${M}`);this.internalFormat=C.RGBA32F,this.format=C.RGBA,this.textureType=C.FLOAT,this.channelSize=M}}encode(C,M){let E,P;return C.constructor!==Float32Array&&(T.Logger.warning("Encoder","data was not of type Float32; creating new Float32Array"),P=new Float32Array(C)),M*this.channelSize>C.length?(T.Logger.warning("Encoder","Source data too small. Allocating larger array"),P=C,E=this.allocate(M*this.channelSize),P.forEach((R,$)=>E[$]=R)):(P=C,E=P),E}allocate(C){return new Float32Array(4*C)}decode(C,M){return this.channelSize===1?C.filter((E,P)=>P%4==0).subarray(0,M):C.subarray(0,M)}},c.RGBAFloatDataEncoder=class{constructor(C,M=1,E){if(M!==1&&M!==4)throw new Error(`Invalid number of channels: ${M}`);this.internalFormat=C.RGBA,this.format=C.RGBA,this.channelSize=M,this.textureType=E||C.FLOAT}encode(C,M){let E=C;return this.channelSize===1&&(T.Logger.verbose("Encoder","Exploding into a larger array"),E=this.allocate(M),C.forEach((P,R)=>E[4*R]=P)),E}allocate(C){return new Float32Array(4*C)}decode(C,M){return this.channelSize===1?C.filter((E,P)=>P%4==0).subarray(0,M):C.subarray(0,M)}},c.Uint8DataEncoder=class{constructor(C,M=1){if(this.channelSize=4,M===1)this.internalFormat=C.ALPHA,this.format=C.ALPHA,this.textureType=C.UNSIGNED_BYTE,this.channelSize=M;else{if(M!==4)throw new Error(`Invalid number of channels: ${M}`);this.internalFormat=C.RGBA,this.format=C.RGBA,this.textureType=C.UNSIGNED_BYTE,this.channelSize=M}}encode(C,M){return new Uint8Array(C.buffer,C.byteOffset,C.byteLength)}allocate(C){return new Uint8Array(C*this.channelSize)}decode(C,M){if(C instanceof Uint8Array)return C.subarray(0,M);throw new Error(`Invalid array type: ${C.constructor}`)}}},7859:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.getBatchDim=c.sizeToSquarishShape=c.getRowsCols=c.sizeFromShape=c.isInt=c.parseAxisParam=c.squeezeShape=c.PreferLogicalStrategy=c.AlwaysKeepOriginalSizeStrategy=void 0;const T=_(6231),C=_(2517);function M(G,O){const L=[],F=[],V=O!=null&&Array.isArray(O)&&O.length===0,W=O==null||V?null:E(O,G).sort();let z=0;for(let Z=0;ZZ)&&G[Z]===1&&(L.push(G[Z]),F.push(Z)),W[z]<=Z&&z++}G[Z]!==1&&(L.push(G[Z]),F.push(Z))}return{newShape:L,keptDims:F}}function E(G,O){const L=O.length;return G=G==null?O.map((F,V)=>V):[].concat(G),(0,C.assert)(G.every(F=>F>=-L&&F`All values in axis param must be in range [-${L}, ${L}) but got axis ${G}`),(0,C.assert)(G.every(P),()=>`All values in axis param must be integers but got axis ${G}`),G.map(F=>F<0?L+F:F)}function P(G){return G%1==0}function R(G){if(G.length===0)return 1;let O=G[0];for(let L=1;L=G.length?1:G.slice(O.breakAxis).reduce((Z,H)=>Z*H),z=O.breakAxis<=0?1:G.slice(0,O.breakAxis).reduce((Z,H)=>Z*H);if(!(W>L||z>L))return[W,z];T.Logger.verbose("TextureLayout",`Given width/height preferences were unattainable: shape:${G}, breakAxis:${O.breakAxis}`)}const F=G.reduce((W,z)=>W*z);let V=Math.floor(Math.sqrt(F));for(;V=L||F%V!=0)throw new Error(`The given dimensions are outside this GPU's boundaries: ${G}`);return[V,F/V]}},c.PreferLogicalStrategy=class{constructor(G){this.maxTextureSize=G}computeTextureWH(G,O){const L=this.computeTexture(G,O);return O&&O.isPacked&&(L[0]/=2,L[1]/=2),O&&O.reverseWH?[L[1],L[0]]:L}computeTexture(G,O){const L=O&&O.isPacked;if(G.length===0)return L?[2,2]:[1,1];let F=this.maxTextureSize;if(O&&O.breakAxis!==void 0){const z=O.breakAxis>=G.length?1:G.slice(O.breakAxis).reduce((H,Y)=>H*Y),Z=O.breakAxis<=0?1:G.slice(0,O.breakAxis).reduce((H,Y)=>H*Y);if(!(z>F||Z>F))return[z,Z];T.Logger.verbose("TextureLayout",`Given width/height preferences were unattainable: shape:${G}, breakAxis:${O.breakAxis}`)}let V=G.slice(0);L&&(F*=2,V=V.map((z,Z)=>Z>=V.length-2?V[Z]%2==0?V[Z]:V[Z]+1:V[Z]),V.length===1&&(V=[2,V[0]])),V.length!==2&&(V=M(V).newShape);const W=R(V);return V.length<=1&&W<=F?[1,W]:V.length===2&&V[0]<=F&&V[1]<=F?V:V.length===3&&V[0]*V[1]<=F&&V[2]<=F?[V[0]*V[1],V[2]]:V.length===3&&V[0]<=F&&V[1]*V[2]<=F?[V[0],V[1]*V[2]]:V.length===4&&V[0]*V[1]*V[2]<=F&&V[3]<=F?[V[0]*V[1]*V[2],V[3]]:V.length===4&&V[0]<=F&&V[1]*V[2]*V[3]<=F?[V[0],V[1]*V[2]*V[3]]:L?$(W/4).map(z=>2*z):$(W)}},c.squeezeShape=M,c.parseAxisParam=E,c.isInt=P,c.sizeFromShape=R,c.getRowsCols=function(G){if(G.length===0)throw Error("Cannot get rows and columns of an empty shape array.");return[G.length>1?G[G.length-2]:1,G[G.length-1]]},c.sizeToSquarishShape=$,c.getBatchDim=function(G,O=2){return R(G.slice(0,G.length-O))}},4057:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createTextureLayoutFromShape=c.calculateTextureWidthAndHeight=c.createTextureLayoutFromTextureType=void 0;const T=_(2517),C=_(2039);c.createTextureLayoutFromTextureType=(M,E,P)=>{const R=P===C.TextureType.unpacked||P===C.TextureType.unpackedReversed?1:4,$=P===C.TextureType.packed,G=P===C.TextureType.unpackedReversed||P===C.TextureType.packed,O=P===C.TextureType.packedLastDimension?E.length-1:void 0,L=P===C.TextureType.packedLastDimension?E.map((F,V)=>V===E.length-1?4*F:F):void 0;return(0,c.createTextureLayoutFromShape)(M,E,R,L,{isPacked:$,reverseWH:G,breakAxis:O})},c.calculateTextureWidthAndHeight=(M,E,P)=>{const R=(0,c.createTextureLayoutFromTextureType)(M,E,P);return[R.width,R.height]},c.createTextureLayoutFromShape=(M,E,P=1,R,$)=>{const G=!(!$||!$.isPacked),[O,L]=M.computeTextureWH(G&&R||E,$),F=E.length;let V=E.slice(0);if(F===0&&(V=[1]),P===1)R=E;else if(G){if(P!==4)throw new Error("a packed texture must be 4-channel");R=E,F>0&&(V[F-1]=Math.ceil(V[F-1]/2)),F>1&&(V[F-2]=Math.ceil(V[F-2]/2))}else if(!R)throw new Error("Unpacked shape is needed when using channels > 1");return{width:O,height:L,channels:P,isPacked:G,shape:V,strides:T.ShapeUtil.computeStrides(V),unpackedShape:R,reversedWH:$&&$.reverseWH}}},5702:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.TextureManager=void 0;const T=_(6231);c.TextureManager=class{constructor(C,M,E,P){this.glContext=C,this.layoutStrategy=M,this.profiler=E,this.config=P,this.pendingRead=new Map,P.reuseTextures&&(this.inUseTextures=new Map,this.idleTextures=new Map,this.textureLookup=new Map)}createTextureFromLayout(C,M,E,P){const R=this.toEncoderType(C),$=this.glContext.getEncoder(R,M.channels||1,P);if(M.isPacked&&P===1)throw new Error("not implemented");const G=M.width,O=M.height;let L,F;if(this.config.reuseTextures){L=`${G}x${O}_${$.format}_${$.internalFormat}_${$.textureType}`,F=this.inUseTextures.get(L),F||(F=[],this.inUseTextures.set(L,F));const W=this.idleTextures.get(L);if(W&&W.length>0){const z=W.pop();return F.push(z),P===1&&this.glContext.updateTexture(z,G,O,$,this.toTextureData(C,E)),z}}T.Logger.verbose("TextureManager",`Creating new texture of size ${M.width}x${M.height}`);const V=this.glContext.allocateTexture(G,O,$,this.toTextureData(C,E));return this.config.reuseTextures&&(F.push(V),this.textureLookup.set(V,L)),V}readTexture(C,M,E){return E||(E=1),this.profiler.event("backend","TextureManager.readTexture",()=>{const P=C.shape.reduce(($,G)=>$*G)*E,R=this.glContext.readTexture(C.texture,C.width,C.height,P,this.toEncoderType(M),E);return this.toTensorData(M,R)})}async readTextureAsync(C,M,E){const P=C.tensor.dataId;if(E||(E=1),this.pendingRead.has(P)){const R=this.pendingRead.get(P);return new Promise($=>R==null?void 0:R.push($))}return this.profiler.event("backend","TextureManager.readTextureAsync",async()=>{this.pendingRead.set(P,[]);const R=C.shape.reduce((L,F)=>L*F)*E;await this.glContext.createAndWaitForFence();const $=this.glContext.readTexture(C.texture,C.width,C.height,R,this.toEncoderType(M),E),G=this.toTensorData(M,$),O=this.pendingRead.get(P);return this.pendingRead.delete(P),O==null||O.forEach(L=>L(G)),G})}readUint8TextureAsFloat(C){return this.profiler.event("backend","TextureManager.readUint8TextureAsFloat",()=>{const M=C.shape.reduce((P,R)=>P*R),E=this.glContext.readTexture(C.texture,C.width,C.height,4*M,"byte",4);return new Float32Array(E.buffer,E.byteOffset,M)})}releaseTexture(C,M){let E;if(this.config.reuseTextures&&(E=this.textureLookup.get(C.texture),E)){M&&this.textureLookup.delete(E);const P=this.inUseTextures.get(E);if(P){const R=P.indexOf(C.texture);if(R!==-1){P.splice(R,1);let $=this.idleTextures.get(E);$||($=[],this.idleTextures.set(E,$)),$.push(C.texture)}}}E&&!M||(T.Logger.verbose("TextureManager",`Deleting texture of size ${C.width}x${C.height}`),this.glContext.deleteTexture(C.texture))}toTensorData(C,M){switch(C){case"int16":return M instanceof Int16Array?M:Int16Array.from(M);case"int32":return M instanceof Int32Array?M:Int32Array.from(M);case"int8":return M instanceof Int8Array?M:Int8Array.from(M);case"uint16":return M instanceof Uint16Array?M:Uint16Array.from(M);case"uint32":return M instanceof Uint32Array?M:Uint32Array.from(M);case"uint8":case"bool":return M instanceof Uint8Array?M:Uint8Array.from(M);case"float32":return M instanceof Float32Array?M:Float32Array.from(M);case"float64":return M instanceof Float64Array?M:Float64Array.from(M);default:throw new Error(`TensorData type ${C} is not supported`)}}toTextureData(C,M){if(M)return M instanceof Float32Array?M:new Float32Array(M)}toEncoderType(C){return"float"}clearActiveTextures(){this.glContext.clearActiveTextures()}}},2039:(x,c)=>{var _;Object.defineProperty(c,"__esModule",{value:!0}),c.TextureType=void 0,(_=c.TextureType||(c.TextureType={}))[_.unpacked=0]="unpacked",_[_.unpackedReversed=1]="unpackedReversed",_[_.packed=2]="packed",_[_.downloadUint8AsFloat=3]="downloadUint8AsFloat",_[_.packedLastDimension=4]="packedLastDimension"},9390:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.getGlChannels=c.getCoordsDataType=c.getSqueezedParams=c.squeezeInputShape=c.generateShaderFuncNameFromInputSamplerNameAtOutCoords=c.generateShaderFuncNameFromInputSamplerName=c.repeatedTry=c.getPackedShape=void 0;const T=_(2517);c.getPackedShape=function(C){const M=C.length;return C.slice(0,M-1).concat(C[M-1]/4)},c.repeatedTry=async function(C,M=P=>0,E){return new Promise((P,R)=>{let $=0;const G=()=>{if(C())return void P();$++;const O=M($);E!=null&&$>=E?R():setTimeout(G,O)};G()})},c.generateShaderFuncNameFromInputSamplerName=function(C){return(0,T.assert)(C!==void 0&&C.length!==0,()=>"empty string found for sampler name"),"get"+C.charAt(0).toUpperCase()+C.slice(1)},c.generateShaderFuncNameFromInputSamplerNameAtOutCoords=function(C){return(0,T.assert)(C!==void 0&&C.length!==0,()=>"empty string found for sampler name"),"get"+C.charAt(0).toUpperCase()+C.slice(1)+"AtOutCoords"},c.squeezeInputShape=function(C,M){let E=JSON.parse(JSON.stringify(C));return E=M,E},c.getSqueezedParams=function(C,M){return M.map(E=>C[E]).join(", ")},c.getCoordsDataType=function(C){if(C<=1)return"int";if(C===2)return"ivec2";if(C===3)return"ivec3";if(C===4)return"ivec4";if(C===5)return"ivec5";if(C===6)return"ivec6";throw Error(`GPU for rank ${C} is not yet supported`)},c.getGlChannels=function(C=6){return["x","y","z","w","u","v"].slice(0,C)}},7305:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createNewWebGLContext=c.createWebGLContext=void 0;const T=_(6231),C=_(1713),M={};function E(P){const R=function(){if(typeof document>"u"){if(typeof OffscreenCanvas>"u")throw new TypeError("failed to create canvas: OffscreenCanvas is not supported");return new OffscreenCanvas(1,1)}const O=document.createElement("canvas");return O.width=1,O.height=1,O}();let $;const G={alpha:!1,depth:!1,antialias:!1,stencil:!1,preserveDrawingBuffer:!1,premultipliedAlpha:!1,failIfMajorPerformanceCaveat:!1};if((!P||P==="webgl2")&&($=R.getContext("webgl2",G),$))try{return new C.WebGLContext($,2)}catch(O){T.Logger.warning("GlContextFactory",`failed to create WebGLContext using contextId 'webgl2'. Error: ${O}`)}if((!P||P==="webgl")&&($=R.getContext("webgl",G)||R.getContext("experimental-webgl",G),$))try{return new C.WebGLContext($,1)}catch(O){T.Logger.warning("GlContextFactory",`failed to create WebGLContext using contextId 'webgl' or 'experimental-webgl'. Error: ${O}`)}throw new Error("WebGL is not supported")}c.createWebGLContext=function P(R){let $;R&&R!=="webgl2"||!("webgl2"in M)?R&&R!=="webgl"||!("webgl"in M)||($=M.webgl):$=M.webgl2,$=$||E(R),R=R||$.version===1?"webgl":"webgl2";const G=$.gl;return M[R]=$,G.isContextLost()?(delete M[R],P(R)):(G.disable(G.DEPTH_TEST),G.disable(G.STENCIL_TEST),G.disable(G.BLEND),G.disable(G.DITHER),G.disable(G.POLYGON_OFFSET_FILL),G.disable(G.SAMPLE_COVERAGE),G.enable(G.SCISSOR_TEST),G.enable(G.CULL_FACE),G.cullFace(G.BACK),$)},c.createNewWebGLContext=E},1713:function(x,c,_){var T=this&&this.__createBinding||(Object.create?function(G,O,L,F){F===void 0&&(F=L);var V=Object.getOwnPropertyDescriptor(O,L);V&&!("get"in V?!O.__esModule:V.writable||V.configurable)||(V={enumerable:!0,get:function(){return O[L]}}),Object.defineProperty(G,F,V)}:function(G,O,L,F){F===void 0&&(F=L),G[F]=O[L]}),C=this&&this.__setModuleDefault||(Object.create?function(G,O){Object.defineProperty(G,"default",{enumerable:!0,value:O})}:function(G,O){G.default=O}),M=this&&this.__importStar||function(G){if(G&&G.__esModule)return G;var O={};if(G!=null)for(var L in G)L!=="default"&&Object.prototype.hasOwnProperty.call(G,L)&&T(O,G,L);return C(O,G),O};Object.defineProperty(c,"__esModule",{value:!0}),c.WebGLContext=c.linearSearchLastTrue=void 0;const E=_(1670),P=M(_(7769)),R=_(9390);function $(G){let O=0;for(;Othis.isTimerResultAvailable(G)),this.getTimerResult(G)}async createAndWaitForFence(){const G=this.createFence(this.gl);return this.pollFence(G)}createFence(G){let O;const L=G,F=L.fenceSync(L.SYNC_GPU_COMMANDS_COMPLETE,0);return G.flush(),O=F===null?()=>!0:()=>{const V=L.clientWaitSync(F,0,0);return V===L.ALREADY_SIGNALED||V===L.CONDITION_SATISFIED},{query:F,isFencePassed:O}}async pollFence(G){return new Promise(O=>{this.addItemToPoll(()=>G.isFencePassed(),()=>O())})}pollItems(){const G=$(this.itemsToPoll.map(O=>O.isDoneFn));for(let O=0;O<=G;++O){const{resolveFn:L}=this.itemsToPoll[O];L()}this.itemsToPoll=this.itemsToPoll.slice(G+1)}async addItemToPoll(G,O){this.itemsToPoll.push({isDoneFn:G,resolveFn:O}),this.itemsToPoll.length>1||await(0,R.repeatedTry)(()=>(this.pollItems(),this.itemsToPoll.length===0))}}},1036:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ExecutionPlan=void 0;const T=_(6231);class C{constructor(E,P){this.op=E,this.node=P}}c.ExecutionPlan=class{constructor(M,E,P){this.graph=M,this.profiler=P,this.initialize(E)}initialize(M){this.profiler.event("session","ExecutionPlan.initialize",()=>{const E=this.graph.getNodes();if(E.length!==M.length)throw new Error("The size of nodes and OPs do not match.");this._ops=M.map((P,R)=>new C(P,E[R])),this.reset(),this._starter=[],this._ops.forEach((P,R)=>{let $=!0;for(const G of P.node.inputs)if(!this._values[G]&&this.graph.getInputIndices().indexOf(G)===-1){$=!1;break}$&&this._starter.push(R)})})}reset(){this._values=this.graph.getValues().map(M=>M.tensor)}async execute(M,E){return this.profiler.event("session","ExecutionPlan.execute",async()=>{this.reset();const P=M.createInferenceHandler(),R=this.graph.getInputIndices();if(E.length!==R.length)throw new Error(`number of input tensors don't match the number of inputs to the model: actual: ${E.length} expected: ${R.length}`);E.forEach((V,W)=>{const z=R[W];this._values[z]=V});const $=this._starter.slice(0),G=this.graph.getValues(),O=this.graph.getNodes();let L=0;for(;L<$.length;){const V=$[L++],W=this._ops[V],z=W.node.inputs.map(U=>this._values[U]);if(z.indexOf(void 0)!==-1)throw new Error(`unresolved input detected: op: ${W.node}`);const Z=z;T.Logger.verbose("ExecPlan",`Runing op:${W.node.name} (${Z.map((U,j)=>`'${W.node.inputs[j]}': ${U.type}[${U.dims.join(",")}]`).join(", ")})`);const H=await this.profiler.event("node",W.node.name,async()=>W.op.impl(P,Z,W.op.context));if(H.length!==W.node.outputs.length)throw new Error("the size of output does not match model definition.");H.forEach((U,j)=>{const X=W.node.outputs[j];if(this._values[X])throw new Error(`output [${X}] already has value: op:${W.node.name}`);this._values[X]=U});const Y=new Set;H.forEach((U,j)=>{const X=W.node.outputs[j];for(const K of G[X].to){const q=O[K];let J=!0;for(const Q of q.inputs)if(!this._values[Q]){J=!1;break}J&&Y.add(K)}}),$.push(...Y)}const F=[];for(let V=0;V{Object.defineProperty(c,"__esModule",{value:!0}),c.Graph=void 0;const T=_(1446),C=_(7778),M=_(9395),E=_(9162),P=_(2517);var R=M.onnxruntime.experimental.fbs;c.Graph={from:(L,F)=>new O(L,F)};class ${constructor(F){this._from=void 0,this._to=[],this.tensor=void 0,this.type=void 0,F&&(this.type=P.ProtoUtil.tensorValueTypeFromProto(F.type.tensorType))}get from(){return this._from}get to(){return this._to}}class G{constructor(F,V){F instanceof T.onnx.NodeProto?(this.name=F.name,this.opType=F.opType,this.attributes=new C.Attribute(F.attribute)):F instanceof R.Node&&(this.name=V??F.name(),this.opType=F.opType(),this.attributes=new C.Attribute(P.ProtoUtil.tensorAttributesFromORTFormat(F))),this.inputs=[],this.outputs=[],this.executeNode=!0}}class O{constructor(F,V){if(!F)throw new TypeError("graph is empty");this.buildGraph(F),this.transformGraph(V),this.checkIsAcyclic()}getInputIndices(){return this._allInputIndices}getInputNames(){return this._allInputNames}getOutputIndices(){return this._allOutputIndices}getOutputNames(){return this._allOutputNames}getValues(){return this._allData}getNodes(){return this._nodes}buildGraph(F){if(F instanceof T.onnx.GraphProto)this.buildGraphFromOnnxFormat(F);else{if(!(F instanceof R.Graph))throw new TypeError("Graph type is not supported.");this.buildGraphFromOrtFormat(F)}}buildGraphFromOnnxFormat(F){const V=new Map;this._allData=[],this._allInputIndices=[],this._allInputNames=[],this._allOutputIndices=[],this._allOutputNames=[],this._nodes=[];const W=new Map;if(!F.input)throw new Error("missing information in graph: input");const z=[];for(const Z of F.input){if(V.has(Z.name))throw new Error(`duplicated input name: ${Z.name}`);const H=this._allData.push(new $(Z))-1;V.set(Z.name,H),z.push(Z.name)}if(!F.initializer)throw new Error("missing information in graph: initializer");for(const Z of F.initializer){let H=V.get(Z.name);if(H===void 0){const Y=new $;Y.type={shape:{dims:P.ProtoUtil.tensorDimsFromProto(Z.dims)},tensorType:P.ProtoUtil.tensorDataTypeFromProto(Z.dataType)},H=this._allData.push(Y)-1,V.set(Z.name,H)}this._allData[H]._from=-1,this._allData[H].tensor=E.Tensor.fromProto(Z)}for(let Z=0;Z{this._allData[z]._to.forEach(Z=>{F.add(Z)})});const V=Array.from(F),W=new Array(this._nodes.length).fill("white");for(;V.length>0;){const z=V.pop();W[z]==="gray"?W[z]="black":(V.push(z),W[z]="gray",this._nodes[z].outputs.forEach(Z=>{const H=this._allData[Z];if(H.tensor!==void 0)throw new Error("node outputs should not be initialized");if(H._from!==z)throw new Error("from property of the Value object doesn't match index of Node being processed");H._to.forEach(Y=>{if(W[Y]==="gray")throw new Error("model graph is cyclic");W[Y]==="white"&&V.push(Y)})}))}}transformGraph(F){this.removeAllIdentityNodes(),this.removeAllDropoutNodes(),this.fuseConvActivationNodes(),F&&F.transformGraph(this),this.finalizeGraph()}finalizeGraph(){let F=0;for(let V=0;V0&&(this._nodes[V].inputs.forEach(W=>{const z=this._allData[W]._to.indexOf(V+F);z!==-1&&(this._allData[W]._to[z]=V)}),this._nodes[V].outputs.forEach(W=>{this._allData[W]._from&&this._allData[W]._from===V+F&&(this._allData[W]._from=V)})):(F++,this._nodes[V].outputs.forEach(W=>{this._allData[W]._from=-2}),this._nodes.splice(V,1),V--);F=0;for(let V=0;V0){let W=-1;this._allData[V].from!==void 0&&this._allData[V].from!==-1?(W=this._nodes[this._allData[V].from].outputs.indexOf(V+F),W!==-1&&(this._nodes[this._allData[V].from].outputs[W]=V)):(W=this._allInputIndices.indexOf(V+F),W!==-1&&(this._allInputIndices[W]=V)),this._allData[V].to.forEach(z=>{W=this._nodes[z].inputs.indexOf(V+F),W!==-1&&(this._nodes[z].inputs[W]=V)}),this._allData[V].to.length===0&&(W=this._allOutputIndices.indexOf(V+F),W!==-1&&(this._allOutputIndices[W]=V))}}else F++,this._allData.splice(V,1),V--}deleteNode(F){const V=this._nodes[F];if(V.outputs.length>1){for(let U=1;U0)throw new Error("Node deletion with more than one output connected to other nodes is not supported. ")}V.executeNode=!1;const W=V.inputs[0],z=V.outputs[0],Z=this._allData[z].to,H=this._allData[W].to.indexOf(F);if(H===-1)throw new Error("The Value object doesn't have the current Node in it's 'to' property ");this._allData[W].to.splice(H,1),this._allData[z]._to=[];const Y=this._allOutputIndices.indexOf(z);if(Y!==-1&&(this._allOutputIndices[Y]=W),Z&&Z.length>0)for(const U of Z){const j=this._nodes[U].inputs.indexOf(z);if(j===-1)throw new Error("The Node object doesn't have the output Value in it's 'inputs' property ");this._nodes[U].inputs[j]=W,this._allData[W].to.push(U)}}removeAllDropoutNodes(){let F=0;for(const V of this._nodes){if(V.opType==="Dropout"){if(V.inputs.length!==1)throw new Error("Dropout nodes should only contain one input. ");if(V.outputs.length!==1&&V.outputs.length!==2)throw new Error("Dropout nodes should contain either 1 or 2 output(s)");if(V.outputs.length===2&&this._allData[V.outputs[1]]._to.length!==0)throw new Error("Dropout nodes's second output should not be referenced by other nodes");this.deleteNode(F)}F++}}removeAllIdentityNodes(){let F=0;for(const V of this._nodes)V.opType==="Identity"&&this.deleteNode(F),F++}isActivation(F){switch(F.opType){case"Relu":case"Sigmoid":case"Clip":return!0;default:return!1}}fuseConvActivationNodes(){for(const F of this._nodes)if(F.opType==="Conv"){const V=this._allData[F.outputs[0]]._to;if(V.length===1&&this.isActivation(this._nodes[V[0]])){const W=this._nodes[V[0]];if(W.opType==="Clip")if(W.inputs.length===1)try{F.attributes.set("activation_params","floats",[W.attributes.getFloat("min"),W.attributes.getFloat("max")])}catch{F.attributes.set("activation_params","floats",[P.MIN_CLIP,P.MAX_CLIP])}else{if(!(W.inputs.length>=3&&this._allData[W.inputs[1]].tensor!==void 0&&this._allData[W.inputs[2]].tensor!==void 0))continue;F.attributes.set("activation_params","floats",[this._allData[W.inputs[1]].tensor.floatData[0],this._allData[W.inputs[2]].tensor.floatData[0]])}F.attributes.set("activation","string",W.opType),this.deleteNode(V[0])}}}}},6231:(x,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.now=c.Profiler=c.Logger=void 0;const _={verbose:1e3,info:2e3,warning:4e3,error:5e3,fatal:6e3},T={none:new class{log(G,O,L){}},console:new class{log(G,O,L){console.log(`${this.color(G)} ${L?"\x1B[35m"+L+"\x1B[0m ":""}${O}`)}color(G){switch(G){case"verbose":return"\x1B[34;40mv\x1B[0m";case"info":return"\x1B[32mi\x1B[0m";case"warning":return"\x1B[30;43mw\x1B[0m";case"error":return"\x1B[31;40me\x1B[0m";case"fatal":return"\x1B[101mf\x1B[0m";default:throw new Error(`unsupported severity: ${G}`)}}}},C={provider:"console",minimalSeverity:"warning",logDateTime:!0,logSourceLocation:!1};let M={"":C};function E(G,O,L,F){if(O===void 0)return V=G,{verbose:E.verbose.bind(null,V),info:E.info.bind(null,V),warning:E.warning.bind(null,V),error:E.error.bind(null,V),fatal:E.fatal.bind(null,V)};if(L===void 0)P(G,O);else if(typeof L=="number"&&F===void 0)P(G,O);else if(typeof L=="string"&&F===void 0)P(G,L,0,O);else{if(typeof L!="string"||typeof F!="number")throw new TypeError("input is valid");P(G,L,0,O)}var V}function P(G,O,L,F){const V=M[F||""]||M[""];_[G]<_[V.minimalSeverity]||(V.logDateTime&&(O=`${new Date().toISOString()}|${O}`),V.logSourceLocation,T[V.provider].log(G,O,F))}(function(G){function O(F){M={},L("",F||{})}function L(F,V){if(F==="*")O(V);else{const W=M[F]||C;M[F]={provider:V.provider||W.provider,minimalSeverity:V.minimalSeverity||W.minimalSeverity,logDateTime:V.logDateTime===void 0?W.logDateTime:V.logDateTime,logSourceLocation:V.logSourceLocation===void 0?W.logSourceLocation:V.logSourceLocation}}}G.verbose=function(F,V){G("verbose",F,V)},G.info=function(F,V){G("info",F,V)},G.warning=function(F,V){G("warning",F,V)},G.error=function(F,V){G("error",F,V)},G.fatal=function(F,V){G("fatal",F,V)},G.reset=O,G.set=L,G.setWithEnv=function(F){const V={};F.logLevel&&(V.minimalSeverity=F.logLevel),L("",V)}})(E||(E={})),c.Logger=E;class R{constructor(O,L,F,V,W,z){this.category=O,this.name=L,this.startTime=F,this.endCallback=V,this.timer=W,this.ctx=z}end(){return this.endCallback(this)}async checkTimer(){if(this.ctx===void 0||this.timer===void 0)throw new Error("No webgl timer found");return this.ctx.endTimer(),this.ctx.waitForQueryAndGetTime(this.timer)}}class ${constructor(O,L,F,V){this.category=O,this.name=L,this.startTime=F,this.endTime=V}}c.Profiler=class{static create(G){return G===void 0?new this:new this(G.maxNumberEvents,G.flushBatchSize,G.flushIntervalInMilliseconds)}constructor(G,O,L){this._started=!1,this._flushPointer=0,this._started=!1,this._maxNumberEvents=G===void 0?1e4:G,this._flushBatchSize=O===void 0?10:O,this._flushIntervalInMilliseconds=L===void 0?5e3:L}start(){this._started=!0,this._timingEvents=[],this._flushTime=(0,c.now)(),this._flushPointer=0}stop(){for(this._started=!1;this._flushPointer{z.then(async Y=>{V&&await V.end(),Z(Y)},async Y=>{V&&await V.end(),H(Y)})});if(!W&&V){const Z=V.end();if(Z&&typeof Z.then=="function")return new Promise((H,Y)=>{Z.then(()=>{H(z)},U=>{Y(U)})})}return z}begin(G,O,L){if(!this._started)throw new Error("profiler is not started yet");if(L===void 0){const F=(0,c.now)();return this.flush(F),new R(G,O,F,V=>this.endSync(V))}{const F=L.beginTimer();return new R(G,O,0,async V=>this.end(V),F,L)}}async end(G){const O=await G.checkTimer();this._timingEvents.length=this._flushBatchSize||G-this._flushTime>=this._flushIntervalInMilliseconds){for(const O=this._flushPointer;this._flushPointerperformance.now():Date.now},2644:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Model=void 0;const T=_(5686),C=_(1446),M=_(7070),E=_(9395),P=_(2517);var R=E.onnxruntime.experimental.fbs;c.Model=class{constructor(){}load($,G,O){if(!O)try{return void this.loadFromOnnxFormat($,G)}catch(L){if(O!==void 0)throw L}this.loadFromOrtFormat($,G)}loadFromOnnxFormat($,G){const O=C.onnx.ModelProto.decode($);if(P.LongUtil.longToNumber(O.irVersion)<3)throw new Error("only support ONNX model with IR_VERSION>=3");this._opsets=O.opsetImport.map(L=>({domain:L.domain,version:P.LongUtil.longToNumber(L.version)})),this._graph=M.Graph.from(O.graph,G)}loadFromOrtFormat($,G){const O=new T.flatbuffers.ByteBuffer($),L=R.InferenceSession.getRootAsInferenceSession(O).model();if(P.LongUtil.longToNumber(L.irVersion())<3)throw new Error("only support ONNX model with IR_VERSION>=3");this._opsets=[];for(let F=0;F{Object.defineProperty(c,"__esModule",{value:!0}),c.FLOAT_TYPES=c.INT_TYPES=c.NUMBER_TYPES=void 0,c.NUMBER_TYPES=["float32","float64","int32","int16","int8","uint16","uint32","uint8"],c.INT_TYPES=["int32","int16","int8","uint16","uint32","uint8"],c.FLOAT_TYPES=["float32","float64"]},1047:(x,c)=>{function _(T,C){if(C.endsWith("+")){const M=Number.parseInt(C.substring(0,C.length-1),10);return!isNaN(M)&&M<=T}if(C.split("-").length===2){const M=C.split("-"),E=Number.parseInt(M[0],10),P=Number.parseInt(M[1],10);return!isNaN(E)&&!isNaN(P)&&E<=T&&T<=P}return Number.parseInt(C,10)===T}Object.defineProperty(c,"__esModule",{value:!0}),c.resolveOperator=void 0,c.resolveOperator=function(T,C,M){for(const E of M){const P=E[0],R=E[1],$=E[2],G=E[3],O=E[4];if(T.opType===P){for(const L of C)if((L.domain===R||L.domain==="ai.onnx"&&R==="")&&_(L.version,$))return{opImpl:G,opInit:O}}}throw new TypeError(`cannot resolve operator '${T.opType}' with opsets: ${C.map(E=>`${E.domain||"ai.onnx"} v${E.version}`).join(", ")}`)}},9395:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.onnxruntime=void 0;const T=_(5686);var C,M;C=c.onnxruntime||(c.onnxruntime={}),function(E){(function(P){P[P.UNDEFINED=0]="UNDEFINED",P[P.FLOAT=1]="FLOAT",P[P.INT=2]="INT",P[P.STRING=3]="STRING",P[P.TENSOR=4]="TENSOR",P[P.GRAPH=5]="GRAPH",P[P.FLOATS=6]="FLOATS",P[P.INTS=7]="INTS",P[P.STRINGS=8]="STRINGS",P[P.TENSORS=9]="TENSORS",P[P.GRAPHS=10]="GRAPHS",P[P.SPARSE_TENSOR=11]="SPARSE_TENSOR",P[P.SPARSE_TENSORS=12]="SPARSE_TENSORS"})(E.AttributeType||(E.AttributeType={}))}((M=C.experimental||(C.experimental={})).fbs||(M.fbs={})),function(E){(function(P){(function(R){(function($){$[$.UNKNOWN=0]="UNKNOWN",$[$.VALUE=1]="VALUE",$[$.PARAM=2]="PARAM"})(R.DimensionValueType||(R.DimensionValueType={}))})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){(function($){$[$.UNDEFINED=0]="UNDEFINED",$[$.FLOAT=1]="FLOAT",$[$.UINT8=2]="UINT8",$[$.INT8=3]="INT8",$[$.UINT16=4]="UINT16",$[$.INT16=5]="INT16",$[$.INT32=6]="INT32",$[$.INT64=7]="INT64",$[$.STRING=8]="STRING",$[$.BOOL=9]="BOOL",$[$.FLOAT16=10]="FLOAT16",$[$.DOUBLE=11]="DOUBLE",$[$.UINT32=12]="UINT32",$[$.UINT64=13]="UINT64",$[$.COMPLEX64=14]="COMPLEX64",$[$.COMPLEX128=15]="COMPLEX128",$[$.BFLOAT16=16]="BFLOAT16"})(R.TensorDataType||(R.TensorDataType={}))})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){(function($){$[$.Primitive=0]="Primitive",$[$.Fused=1]="Fused"})(R.NodeType||(R.NodeType={}))})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){(function($){$[$.NONE=0]="NONE",$[$.tensor_type=1]="tensor_type",$[$.sequence_type=2]="sequence_type",$[$.map_type=3]="map_type"})(R.TypeInfoValue||(R.TypeInfoValue={}))})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsShape(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsShape(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}dim(O,L){let F=this.bb.__offset(this.bb_pos,4);return F?(L||new E.experimental.fbs.Dimension).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+F)+4*O),this.bb):null}dimLength(){let O=this.bb.__offset(this.bb_pos,4);return O?this.bb.__vector_len(this.bb_pos+O):0}static startShape(O){O.startObject(1)}static addDim(O,L){O.addFieldOffset(0,L,0)}static createDimVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addOffset(L[F]);return O.endVector()}static startDimVector(O,L){O.startVector(4,L,4)}static endShape(O){return O.endObject()}static createShape(O,L){return $.startShape(O),$.addDim(O,L),$.endShape(O)}}R.Shape=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsDimension(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsDimension(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}value(O){let L=this.bb.__offset(this.bb_pos,4);return L?(O||new E.experimental.fbs.DimensionValue).__init(this.bb.__indirect(this.bb_pos+L),this.bb):null}denotation(O){let L=this.bb.__offset(this.bb_pos,6);return L?this.bb.__string(this.bb_pos+L,O):null}static startDimension(O){O.startObject(2)}static addValue(O,L){O.addFieldOffset(0,L,0)}static addDenotation(O,L){O.addFieldOffset(1,L,0)}static endDimension(O){return O.endObject()}static createDimension(O,L,F){return $.startDimension(O),$.addValue(O,L),$.addDenotation(O,F),$.endDimension(O)}}R.Dimension=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsDimensionValue(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsDimensionValue(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}dimType(){let O=this.bb.__offset(this.bb_pos,4);return O?this.bb.readInt8(this.bb_pos+O):E.experimental.fbs.DimensionValueType.UNKNOWN}dimValue(){let O=this.bb.__offset(this.bb_pos,6);return O?this.bb.readInt64(this.bb_pos+O):this.bb.createLong(0,0)}dimParam(O){let L=this.bb.__offset(this.bb_pos,8);return L?this.bb.__string(this.bb_pos+L,O):null}static startDimensionValue(O){O.startObject(3)}static addDimType(O,L){O.addFieldInt8(0,L,E.experimental.fbs.DimensionValueType.UNKNOWN)}static addDimValue(O,L){O.addFieldInt64(1,L,O.createLong(0,0))}static addDimParam(O,L){O.addFieldOffset(2,L,0)}static endDimensionValue(O){return O.endObject()}static createDimensionValue(O,L,F,V){return $.startDimensionValue(O),$.addDimType(O,L),$.addDimValue(O,F),$.addDimParam(O,V),$.endDimensionValue(O)}}R.DimensionValue=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsTensorTypeAndShape(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsTensorTypeAndShape(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}elemType(){let O=this.bb.__offset(this.bb_pos,4);return O?this.bb.readInt32(this.bb_pos+O):E.experimental.fbs.TensorDataType.UNDEFINED}shape(O){let L=this.bb.__offset(this.bb_pos,6);return L?(O||new E.experimental.fbs.Shape).__init(this.bb.__indirect(this.bb_pos+L),this.bb):null}static startTensorTypeAndShape(O){O.startObject(2)}static addElemType(O,L){O.addFieldInt32(0,L,E.experimental.fbs.TensorDataType.UNDEFINED)}static addShape(O,L){O.addFieldOffset(1,L,0)}static endTensorTypeAndShape(O){return O.endObject()}static createTensorTypeAndShape(O,L,F){return $.startTensorTypeAndShape(O),$.addElemType(O,L),$.addShape(O,F),$.endTensorTypeAndShape(O)}}R.TensorTypeAndShape=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsMapType(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsMapType(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}keyType(){let O=this.bb.__offset(this.bb_pos,4);return O?this.bb.readInt32(this.bb_pos+O):E.experimental.fbs.TensorDataType.UNDEFINED}valueType(O){let L=this.bb.__offset(this.bb_pos,6);return L?(O||new E.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+L),this.bb):null}static startMapType(O){O.startObject(2)}static addKeyType(O,L){O.addFieldInt32(0,L,E.experimental.fbs.TensorDataType.UNDEFINED)}static addValueType(O,L){O.addFieldOffset(1,L,0)}static endMapType(O){return O.endObject()}static createMapType(O,L,F){return $.startMapType(O),$.addKeyType(O,L),$.addValueType(O,F),$.endMapType(O)}}R.MapType=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsSequenceType(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsSequenceType(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}elemType(O){let L=this.bb.__offset(this.bb_pos,4);return L?(O||new E.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+L),this.bb):null}static startSequenceType(O){O.startObject(1)}static addElemType(O,L){O.addFieldOffset(0,L,0)}static endSequenceType(O){return O.endObject()}static createSequenceType(O,L){return $.startSequenceType(O),$.addElemType(O,L),$.endSequenceType(O)}}R.SequenceType=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(P.fbs||(P.fbs={})).EdgeEnd=class{constructor(){this.bb=null,this.bb_pos=0}__init(R,$){return this.bb_pos=R,this.bb=$,this}nodeIndex(){return this.bb.readUint32(this.bb_pos)}srcArgIndex(){return this.bb.readInt32(this.bb_pos+4)}dstArgIndex(){return this.bb.readInt32(this.bb_pos+8)}static createEdgeEnd(R,$,G,O){return R.prep(4,12),R.writeInt32(O),R.writeInt32(G),R.writeInt32($),R.offset()}}})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsNodeEdge(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsNodeEdge(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}nodeIndex(){let O=this.bb.__offset(this.bb_pos,4);return O?this.bb.readUint32(this.bb_pos+O):0}inputEdges(O,L){let F=this.bb.__offset(this.bb_pos,6);return F?(L||new E.experimental.fbs.EdgeEnd).__init(this.bb.__vector(this.bb_pos+F)+12*O,this.bb):null}inputEdgesLength(){let O=this.bb.__offset(this.bb_pos,6);return O?this.bb.__vector_len(this.bb_pos+O):0}outputEdges(O,L){let F=this.bb.__offset(this.bb_pos,8);return F?(L||new E.experimental.fbs.EdgeEnd).__init(this.bb.__vector(this.bb_pos+F)+12*O,this.bb):null}outputEdgesLength(){let O=this.bb.__offset(this.bb_pos,8);return O?this.bb.__vector_len(this.bb_pos+O):0}static startNodeEdge(O){O.startObject(3)}static addNodeIndex(O,L){O.addFieldInt32(0,L,0)}static addInputEdges(O,L){O.addFieldOffset(1,L,0)}static startInputEdgesVector(O,L){O.startVector(12,L,4)}static addOutputEdges(O,L){O.addFieldOffset(2,L,0)}static startOutputEdgesVector(O,L){O.startVector(12,L,4)}static endNodeEdge(O){return O.endObject()}static createNodeEdge(O,L,F,V){return $.startNodeEdge(O),$.addNodeIndex(O,L),$.addInputEdges(O,F),$.addOutputEdges(O,V),$.endNodeEdge(O)}}R.NodeEdge=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsNode(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsNode(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}name(O){let L=this.bb.__offset(this.bb_pos,4);return L?this.bb.__string(this.bb_pos+L,O):null}docString(O){let L=this.bb.__offset(this.bb_pos,6);return L?this.bb.__string(this.bb_pos+L,O):null}domain(O){let L=this.bb.__offset(this.bb_pos,8);return L?this.bb.__string(this.bb_pos+L,O):null}sinceVersion(){let O=this.bb.__offset(this.bb_pos,10);return O?this.bb.readInt32(this.bb_pos+O):0}index(){let O=this.bb.__offset(this.bb_pos,12);return O?this.bb.readUint32(this.bb_pos+O):0}opType(O){let L=this.bb.__offset(this.bb_pos,14);return L?this.bb.__string(this.bb_pos+L,O):null}type(){let O=this.bb.__offset(this.bb_pos,16);return O?this.bb.readInt32(this.bb_pos+O):E.experimental.fbs.NodeType.Primitive}executionProviderType(O){let L=this.bb.__offset(this.bb_pos,18);return L?this.bb.__string(this.bb_pos+L,O):null}inputs(O,L){let F=this.bb.__offset(this.bb_pos,20);return F?this.bb.__string(this.bb.__vector(this.bb_pos+F)+4*O,L):null}inputsLength(){let O=this.bb.__offset(this.bb_pos,20);return O?this.bb.__vector_len(this.bb_pos+O):0}outputs(O,L){let F=this.bb.__offset(this.bb_pos,22);return F?this.bb.__string(this.bb.__vector(this.bb_pos+F)+4*O,L):null}outputsLength(){let O=this.bb.__offset(this.bb_pos,22);return O?this.bb.__vector_len(this.bb_pos+O):0}attributes(O,L){let F=this.bb.__offset(this.bb_pos,24);return F?(L||new E.experimental.fbs.Attribute).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+F)+4*O),this.bb):null}attributesLength(){let O=this.bb.__offset(this.bb_pos,24);return O?this.bb.__vector_len(this.bb_pos+O):0}inputArgCounts(O){let L=this.bb.__offset(this.bb_pos,26);return L?this.bb.readInt32(this.bb.__vector(this.bb_pos+L)+4*O):0}inputArgCountsLength(){let O=this.bb.__offset(this.bb_pos,26);return O?this.bb.__vector_len(this.bb_pos+O):0}inputArgCountsArray(){let O=this.bb.__offset(this.bb_pos,26);return O?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+O),this.bb.__vector_len(this.bb_pos+O)):null}implicitInputs(O,L){let F=this.bb.__offset(this.bb_pos,28);return F?this.bb.__string(this.bb.__vector(this.bb_pos+F)+4*O,L):null}implicitInputsLength(){let O=this.bb.__offset(this.bb_pos,28);return O?this.bb.__vector_len(this.bb_pos+O):0}static startNode(O){O.startObject(13)}static addName(O,L){O.addFieldOffset(0,L,0)}static addDocString(O,L){O.addFieldOffset(1,L,0)}static addDomain(O,L){O.addFieldOffset(2,L,0)}static addSinceVersion(O,L){O.addFieldInt32(3,L,0)}static addIndex(O,L){O.addFieldInt32(4,L,0)}static addOpType(O,L){O.addFieldOffset(5,L,0)}static addType(O,L){O.addFieldInt32(6,L,E.experimental.fbs.NodeType.Primitive)}static addExecutionProviderType(O,L){O.addFieldOffset(7,L,0)}static addInputs(O,L){O.addFieldOffset(8,L,0)}static createInputsVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addOffset(L[F]);return O.endVector()}static startInputsVector(O,L){O.startVector(4,L,4)}static addOutputs(O,L){O.addFieldOffset(9,L,0)}static createOutputsVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addOffset(L[F]);return O.endVector()}static startOutputsVector(O,L){O.startVector(4,L,4)}static addAttributes(O,L){O.addFieldOffset(10,L,0)}static createAttributesVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addOffset(L[F]);return O.endVector()}static startAttributesVector(O,L){O.startVector(4,L,4)}static addInputArgCounts(O,L){O.addFieldOffset(11,L,0)}static createInputArgCountsVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addInt32(L[F]);return O.endVector()}static startInputArgCountsVector(O,L){O.startVector(4,L,4)}static addImplicitInputs(O,L){O.addFieldOffset(12,L,0)}static createImplicitInputsVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addOffset(L[F]);return O.endVector()}static startImplicitInputsVector(O,L){O.startVector(4,L,4)}static endNode(O){return O.endObject()}static createNode(O,L,F,V,W,z,Z,H,Y,U,j,X,K,q){return $.startNode(O),$.addName(O,L),$.addDocString(O,F),$.addDomain(O,V),$.addSinceVersion(O,W),$.addIndex(O,z),$.addOpType(O,Z),$.addType(O,H),$.addExecutionProviderType(O,Y),$.addInputs(O,U),$.addOutputs(O,j),$.addAttributes(O,X),$.addInputArgCounts(O,K),$.addImplicitInputs(O,q),$.endNode(O)}}R.Node=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsValueInfo(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsValueInfo(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}name(O){let L=this.bb.__offset(this.bb_pos,4);return L?this.bb.__string(this.bb_pos+L,O):null}docString(O){let L=this.bb.__offset(this.bb_pos,6);return L?this.bb.__string(this.bb_pos+L,O):null}type(O){let L=this.bb.__offset(this.bb_pos,8);return L?(O||new E.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+L),this.bb):null}static startValueInfo(O){O.startObject(3)}static addName(O,L){O.addFieldOffset(0,L,0)}static addDocString(O,L){O.addFieldOffset(1,L,0)}static addType(O,L){O.addFieldOffset(2,L,0)}static endValueInfo(O){return O.endObject()}static createValueInfo(O,L,F,V){return $.startValueInfo(O),$.addName(O,L),$.addDocString(O,F),$.addType(O,V),$.endValueInfo(O)}}R.ValueInfo=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsTypeInfo(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsTypeInfo(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}denotation(O){let L=this.bb.__offset(this.bb_pos,4);return L?this.bb.__string(this.bb_pos+L,O):null}valueType(){let O=this.bb.__offset(this.bb_pos,6);return O?this.bb.readUint8(this.bb_pos+O):E.experimental.fbs.TypeInfoValue.NONE}value(O){let L=this.bb.__offset(this.bb_pos,8);return L?this.bb.__union(O,this.bb_pos+L):null}static startTypeInfo(O){O.startObject(3)}static addDenotation(O,L){O.addFieldOffset(0,L,0)}static addValueType(O,L){O.addFieldInt8(1,L,E.experimental.fbs.TypeInfoValue.NONE)}static addValue(O,L){O.addFieldOffset(2,L,0)}static endTypeInfo(O){return O.endObject()}static createTypeInfo(O,L,F,V){return $.startTypeInfo(O),$.addDenotation(O,L),$.addValueType(O,F),$.addValue(O,V),$.endTypeInfo(O)}}R.TypeInfo=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsOperatorSetId(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsOperatorSetId(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}domain(O){let L=this.bb.__offset(this.bb_pos,4);return L?this.bb.__string(this.bb_pos+L,O):null}version(){let O=this.bb.__offset(this.bb_pos,6);return O?this.bb.readInt64(this.bb_pos+O):this.bb.createLong(0,0)}static startOperatorSetId(O){O.startObject(2)}static addDomain(O,L){O.addFieldOffset(0,L,0)}static addVersion(O,L){O.addFieldInt64(1,L,O.createLong(0,0))}static endOperatorSetId(O){return O.endObject()}static createOperatorSetId(O,L,F){return $.startOperatorSetId(O),$.addDomain(O,L),$.addVersion(O,F),$.endOperatorSetId(O)}}R.OperatorSetId=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsTensor(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsTensor(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}name(O){let L=this.bb.__offset(this.bb_pos,4);return L?this.bb.__string(this.bb_pos+L,O):null}docString(O){let L=this.bb.__offset(this.bb_pos,6);return L?this.bb.__string(this.bb_pos+L,O):null}dims(O){let L=this.bb.__offset(this.bb_pos,8);return L?this.bb.readInt64(this.bb.__vector(this.bb_pos+L)+8*O):this.bb.createLong(0,0)}dimsLength(){let O=this.bb.__offset(this.bb_pos,8);return O?this.bb.__vector_len(this.bb_pos+O):0}dataType(){let O=this.bb.__offset(this.bb_pos,10);return O?this.bb.readInt32(this.bb_pos+O):E.experimental.fbs.TensorDataType.UNDEFINED}rawData(O){let L=this.bb.__offset(this.bb_pos,12);return L?this.bb.readUint8(this.bb.__vector(this.bb_pos+L)+O):0}rawDataLength(){let O=this.bb.__offset(this.bb_pos,12);return O?this.bb.__vector_len(this.bb_pos+O):0}rawDataArray(){let O=this.bb.__offset(this.bb_pos,12);return O?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+O),this.bb.__vector_len(this.bb_pos+O)):null}stringData(O,L){let F=this.bb.__offset(this.bb_pos,14);return F?this.bb.__string(this.bb.__vector(this.bb_pos+F)+4*O,L):null}stringDataLength(){let O=this.bb.__offset(this.bb_pos,14);return O?this.bb.__vector_len(this.bb_pos+O):0}static startTensor(O){O.startObject(6)}static addName(O,L){O.addFieldOffset(0,L,0)}static addDocString(O,L){O.addFieldOffset(1,L,0)}static addDims(O,L){O.addFieldOffset(2,L,0)}static createDimsVector(O,L){O.startVector(8,L.length,8);for(let F=L.length-1;F>=0;F--)O.addInt64(L[F]);return O.endVector()}static startDimsVector(O,L){O.startVector(8,L,8)}static addDataType(O,L){O.addFieldInt32(3,L,E.experimental.fbs.TensorDataType.UNDEFINED)}static addRawData(O,L){O.addFieldOffset(4,L,0)}static createRawDataVector(O,L){O.startVector(1,L.length,1);for(let F=L.length-1;F>=0;F--)O.addInt8(L[F]);return O.endVector()}static startRawDataVector(O,L){O.startVector(1,L,1)}static addStringData(O,L){O.addFieldOffset(5,L,0)}static createStringDataVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addOffset(L[F]);return O.endVector()}static startStringDataVector(O,L){O.startVector(4,L,4)}static endTensor(O){return O.endObject()}static createTensor(O,L,F,V,W,z,Z){return $.startTensor(O),$.addName(O,L),$.addDocString(O,F),$.addDims(O,V),$.addDataType(O,W),$.addRawData(O,z),$.addStringData(O,Z),$.endTensor(O)}}R.Tensor=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsSparseTensor(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsSparseTensor(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}values(O){let L=this.bb.__offset(this.bb_pos,4);return L?(O||new E.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+L),this.bb):null}indices(O){let L=this.bb.__offset(this.bb_pos,6);return L?(O||new E.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+L),this.bb):null}dims(O){let L=this.bb.__offset(this.bb_pos,8);return L?this.bb.readInt64(this.bb.__vector(this.bb_pos+L)+8*O):this.bb.createLong(0,0)}dimsLength(){let O=this.bb.__offset(this.bb_pos,8);return O?this.bb.__vector_len(this.bb_pos+O):0}static startSparseTensor(O){O.startObject(3)}static addValues(O,L){O.addFieldOffset(0,L,0)}static addIndices(O,L){O.addFieldOffset(1,L,0)}static addDims(O,L){O.addFieldOffset(2,L,0)}static createDimsVector(O,L){O.startVector(8,L.length,8);for(let F=L.length-1;F>=0;F--)O.addInt64(L[F]);return O.endVector()}static startDimsVector(O,L){O.startVector(8,L,8)}static endSparseTensor(O){return O.endObject()}static createSparseTensor(O,L,F,V){return $.startSparseTensor(O),$.addValues(O,L),$.addIndices(O,F),$.addDims(O,V),$.endSparseTensor(O)}}R.SparseTensor=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsAttribute(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsAttribute(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}name(O){let L=this.bb.__offset(this.bb_pos,4);return L?this.bb.__string(this.bb_pos+L,O):null}docString(O){let L=this.bb.__offset(this.bb_pos,6);return L?this.bb.__string(this.bb_pos+L,O):null}type(){let O=this.bb.__offset(this.bb_pos,8);return O?this.bb.readInt32(this.bb_pos+O):E.experimental.fbs.AttributeType.UNDEFINED}f(){let O=this.bb.__offset(this.bb_pos,10);return O?this.bb.readFloat32(this.bb_pos+O):0}i(){let O=this.bb.__offset(this.bb_pos,12);return O?this.bb.readInt64(this.bb_pos+O):this.bb.createLong(0,0)}s(O){let L=this.bb.__offset(this.bb_pos,14);return L?this.bb.__string(this.bb_pos+L,O):null}t(O){let L=this.bb.__offset(this.bb_pos,16);return L?(O||new E.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+L),this.bb):null}g(O){let L=this.bb.__offset(this.bb_pos,18);return L?(O||new E.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb_pos+L),this.bb):null}floats(O){let L=this.bb.__offset(this.bb_pos,20);return L?this.bb.readFloat32(this.bb.__vector(this.bb_pos+L)+4*O):0}floatsLength(){let O=this.bb.__offset(this.bb_pos,20);return O?this.bb.__vector_len(this.bb_pos+O):0}floatsArray(){let O=this.bb.__offset(this.bb_pos,20);return O?new Float32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+O),this.bb.__vector_len(this.bb_pos+O)):null}ints(O){let L=this.bb.__offset(this.bb_pos,22);return L?this.bb.readInt64(this.bb.__vector(this.bb_pos+L)+8*O):this.bb.createLong(0,0)}intsLength(){let O=this.bb.__offset(this.bb_pos,22);return O?this.bb.__vector_len(this.bb_pos+O):0}strings(O,L){let F=this.bb.__offset(this.bb_pos,24);return F?this.bb.__string(this.bb.__vector(this.bb_pos+F)+4*O,L):null}stringsLength(){let O=this.bb.__offset(this.bb_pos,24);return O?this.bb.__vector_len(this.bb_pos+O):0}tensors(O,L){let F=this.bb.__offset(this.bb_pos,26);return F?(L||new E.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+F)+4*O),this.bb):null}tensorsLength(){let O=this.bb.__offset(this.bb_pos,26);return O?this.bb.__vector_len(this.bb_pos+O):0}graphs(O,L){let F=this.bb.__offset(this.bb_pos,28);return F?(L||new E.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+F)+4*O),this.bb):null}graphsLength(){let O=this.bb.__offset(this.bb_pos,28);return O?this.bb.__vector_len(this.bb_pos+O):0}static startAttribute(O){O.startObject(13)}static addName(O,L){O.addFieldOffset(0,L,0)}static addDocString(O,L){O.addFieldOffset(1,L,0)}static addType(O,L){O.addFieldInt32(2,L,E.experimental.fbs.AttributeType.UNDEFINED)}static addF(O,L){O.addFieldFloat32(3,L,0)}static addI(O,L){O.addFieldInt64(4,L,O.createLong(0,0))}static addS(O,L){O.addFieldOffset(5,L,0)}static addT(O,L){O.addFieldOffset(6,L,0)}static addG(O,L){O.addFieldOffset(7,L,0)}static addFloats(O,L){O.addFieldOffset(8,L,0)}static createFloatsVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addFloat32(L[F]);return O.endVector()}static startFloatsVector(O,L){O.startVector(4,L,4)}static addInts(O,L){O.addFieldOffset(9,L,0)}static createIntsVector(O,L){O.startVector(8,L.length,8);for(let F=L.length-1;F>=0;F--)O.addInt64(L[F]);return O.endVector()}static startIntsVector(O,L){O.startVector(8,L,8)}static addStrings(O,L){O.addFieldOffset(10,L,0)}static createStringsVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addOffset(L[F]);return O.endVector()}static startStringsVector(O,L){O.startVector(4,L,4)}static addTensors(O,L){O.addFieldOffset(11,L,0)}static createTensorsVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addOffset(L[F]);return O.endVector()}static startTensorsVector(O,L){O.startVector(4,L,4)}static addGraphs(O,L){O.addFieldOffset(12,L,0)}static createGraphsVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addOffset(L[F]);return O.endVector()}static startGraphsVector(O,L){O.startVector(4,L,4)}static endAttribute(O){return O.endObject()}static createAttribute(O,L,F,V,W,z,Z,H,Y,U,j,X,K,q){return $.startAttribute(O),$.addName(O,L),$.addDocString(O,F),$.addType(O,V),$.addF(O,W),$.addI(O,z),$.addS(O,Z),$.addT(O,H),$.addG(O,Y),$.addFloats(O,U),$.addInts(O,j),$.addStrings(O,X),$.addTensors(O,K),$.addGraphs(O,q),$.endAttribute(O)}}R.Attribute=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsGraph(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsGraph(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}initializers(O,L){let F=this.bb.__offset(this.bb_pos,4);return F?(L||new E.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+F)+4*O),this.bb):null}initializersLength(){let O=this.bb.__offset(this.bb_pos,4);return O?this.bb.__vector_len(this.bb_pos+O):0}nodeArgs(O,L){let F=this.bb.__offset(this.bb_pos,6);return F?(L||new E.experimental.fbs.ValueInfo).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+F)+4*O),this.bb):null}nodeArgsLength(){let O=this.bb.__offset(this.bb_pos,6);return O?this.bb.__vector_len(this.bb_pos+O):0}nodes(O,L){let F=this.bb.__offset(this.bb_pos,8);return F?(L||new E.experimental.fbs.Node).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+F)+4*O),this.bb):null}nodesLength(){let O=this.bb.__offset(this.bb_pos,8);return O?this.bb.__vector_len(this.bb_pos+O):0}maxNodeIndex(){let O=this.bb.__offset(this.bb_pos,10);return O?this.bb.readUint32(this.bb_pos+O):0}nodeEdges(O,L){let F=this.bb.__offset(this.bb_pos,12);return F?(L||new E.experimental.fbs.NodeEdge).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+F)+4*O),this.bb):null}nodeEdgesLength(){let O=this.bb.__offset(this.bb_pos,12);return O?this.bb.__vector_len(this.bb_pos+O):0}inputs(O,L){let F=this.bb.__offset(this.bb_pos,14);return F?this.bb.__string(this.bb.__vector(this.bb_pos+F)+4*O,L):null}inputsLength(){let O=this.bb.__offset(this.bb_pos,14);return O?this.bb.__vector_len(this.bb_pos+O):0}outputs(O,L){let F=this.bb.__offset(this.bb_pos,16);return F?this.bb.__string(this.bb.__vector(this.bb_pos+F)+4*O,L):null}outputsLength(){let O=this.bb.__offset(this.bb_pos,16);return O?this.bb.__vector_len(this.bb_pos+O):0}sparseInitializers(O,L){let F=this.bb.__offset(this.bb_pos,18);return F?(L||new E.experimental.fbs.SparseTensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+F)+4*O),this.bb):null}sparseInitializersLength(){let O=this.bb.__offset(this.bb_pos,18);return O?this.bb.__vector_len(this.bb_pos+O):0}static startGraph(O){O.startObject(8)}static addInitializers(O,L){O.addFieldOffset(0,L,0)}static createInitializersVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addOffset(L[F]);return O.endVector()}static startInitializersVector(O,L){O.startVector(4,L,4)}static addNodeArgs(O,L){O.addFieldOffset(1,L,0)}static createNodeArgsVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addOffset(L[F]);return O.endVector()}static startNodeArgsVector(O,L){O.startVector(4,L,4)}static addNodes(O,L){O.addFieldOffset(2,L,0)}static createNodesVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addOffset(L[F]);return O.endVector()}static startNodesVector(O,L){O.startVector(4,L,4)}static addMaxNodeIndex(O,L){O.addFieldInt32(3,L,0)}static addNodeEdges(O,L){O.addFieldOffset(4,L,0)}static createNodeEdgesVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addOffset(L[F]);return O.endVector()}static startNodeEdgesVector(O,L){O.startVector(4,L,4)}static addInputs(O,L){O.addFieldOffset(5,L,0)}static createInputsVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addOffset(L[F]);return O.endVector()}static startInputsVector(O,L){O.startVector(4,L,4)}static addOutputs(O,L){O.addFieldOffset(6,L,0)}static createOutputsVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addOffset(L[F]);return O.endVector()}static startOutputsVector(O,L){O.startVector(4,L,4)}static addSparseInitializers(O,L){O.addFieldOffset(7,L,0)}static createSparseInitializersVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addOffset(L[F]);return O.endVector()}static startSparseInitializersVector(O,L){O.startVector(4,L,4)}static endGraph(O){return O.endObject()}static createGraph(O,L,F,V,W,z,Z,H,Y){return $.startGraph(O),$.addInitializers(O,L),$.addNodeArgs(O,F),$.addNodes(O,V),$.addMaxNodeIndex(O,W),$.addNodeEdges(O,z),$.addInputs(O,Z),$.addOutputs(O,H),$.addSparseInitializers(O,Y),$.endGraph(O)}}R.Graph=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsModel(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsModel(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}irVersion(){let O=this.bb.__offset(this.bb_pos,4);return O?this.bb.readInt64(this.bb_pos+O):this.bb.createLong(0,0)}opsetImport(O,L){let F=this.bb.__offset(this.bb_pos,6);return F?(L||new E.experimental.fbs.OperatorSetId).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+F)+4*O),this.bb):null}opsetImportLength(){let O=this.bb.__offset(this.bb_pos,6);return O?this.bb.__vector_len(this.bb_pos+O):0}producerName(O){let L=this.bb.__offset(this.bb_pos,8);return L?this.bb.__string(this.bb_pos+L,O):null}producerVersion(O){let L=this.bb.__offset(this.bb_pos,10);return L?this.bb.__string(this.bb_pos+L,O):null}domain(O){let L=this.bb.__offset(this.bb_pos,12);return L?this.bb.__string(this.bb_pos+L,O):null}modelVersion(){let O=this.bb.__offset(this.bb_pos,14);return O?this.bb.readInt64(this.bb_pos+O):this.bb.createLong(0,0)}docString(O){let L=this.bb.__offset(this.bb_pos,16);return L?this.bb.__string(this.bb_pos+L,O):null}graph(O){let L=this.bb.__offset(this.bb_pos,18);return L?(O||new E.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb_pos+L),this.bb):null}graphDocString(O){let L=this.bb.__offset(this.bb_pos,20);return L?this.bb.__string(this.bb_pos+L,O):null}static startModel(O){O.startObject(9)}static addIrVersion(O,L){O.addFieldInt64(0,L,O.createLong(0,0))}static addOpsetImport(O,L){O.addFieldOffset(1,L,0)}static createOpsetImportVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addOffset(L[F]);return O.endVector()}static startOpsetImportVector(O,L){O.startVector(4,L,4)}static addProducerName(O,L){O.addFieldOffset(2,L,0)}static addProducerVersion(O,L){O.addFieldOffset(3,L,0)}static addDomain(O,L){O.addFieldOffset(4,L,0)}static addModelVersion(O,L){O.addFieldInt64(5,L,O.createLong(0,0))}static addDocString(O,L){O.addFieldOffset(6,L,0)}static addGraph(O,L){O.addFieldOffset(7,L,0)}static addGraphDocString(O,L){O.addFieldOffset(8,L,0)}static endModel(O){return O.endObject()}static createModel(O,L,F,V,W,z,Z,H,Y,U){return $.startModel(O),$.addIrVersion(O,L),$.addOpsetImport(O,F),$.addProducerName(O,V),$.addProducerVersion(O,W),$.addDomain(O,z),$.addModelVersion(O,Z),$.addDocString(O,H),$.addGraph(O,Y),$.addGraphDocString(O,U),$.endModel(O)}}R.Model=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsKernelCreateInfos(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsKernelCreateInfos(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}nodeIndices(O){let L=this.bb.__offset(this.bb_pos,4);return L?this.bb.readUint32(this.bb.__vector(this.bb_pos+L)+4*O):0}nodeIndicesLength(){let O=this.bb.__offset(this.bb_pos,4);return O?this.bb.__vector_len(this.bb_pos+O):0}nodeIndicesArray(){let O=this.bb.__offset(this.bb_pos,4);return O?new Uint32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+O),this.bb.__vector_len(this.bb_pos+O)):null}kernelDefHashes(O){let L=this.bb.__offset(this.bb_pos,6);return L?this.bb.readUint64(this.bb.__vector(this.bb_pos+L)+8*O):this.bb.createLong(0,0)}kernelDefHashesLength(){let O=this.bb.__offset(this.bb_pos,6);return O?this.bb.__vector_len(this.bb_pos+O):0}static startKernelCreateInfos(O){O.startObject(2)}static addNodeIndices(O,L){O.addFieldOffset(0,L,0)}static createNodeIndicesVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addInt32(L[F]);return O.endVector()}static startNodeIndicesVector(O,L){O.startVector(4,L,4)}static addKernelDefHashes(O,L){O.addFieldOffset(1,L,0)}static createKernelDefHashesVector(O,L){O.startVector(8,L.length,8);for(let F=L.length-1;F>=0;F--)O.addInt64(L[F]);return O.endVector()}static startKernelDefHashesVector(O,L){O.startVector(8,L,8)}static endKernelCreateInfos(O){return O.endObject()}static createKernelCreateInfos(O,L,F){return $.startKernelCreateInfos(O),$.addNodeIndices(O,L),$.addKernelDefHashes(O,F),$.endKernelCreateInfos(O)}}R.KernelCreateInfos=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsSubGraphSessionState(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsSubGraphSessionState(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}graphId(O){let L=this.bb.__offset(this.bb_pos,4);return L?this.bb.__string(this.bb_pos+L,O):null}sessionState(O){let L=this.bb.__offset(this.bb_pos,6);return L?(O||new E.experimental.fbs.SessionState).__init(this.bb.__indirect(this.bb_pos+L),this.bb):null}static startSubGraphSessionState(O){O.startObject(2)}static addGraphId(O,L){O.addFieldOffset(0,L,0)}static addSessionState(O,L){O.addFieldOffset(1,L,0)}static endSubGraphSessionState(O){let L=O.endObject();return O.requiredField(L,4),L}static createSubGraphSessionState(O,L,F){return $.startSubGraphSessionState(O),$.addGraphId(O,L),$.addSessionState(O,F),$.endSubGraphSessionState(O)}}R.SubGraphSessionState=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsSessionState(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsSessionState(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}kernels(O){let L=this.bb.__offset(this.bb_pos,4);return L?(O||new E.experimental.fbs.KernelCreateInfos).__init(this.bb.__indirect(this.bb_pos+L),this.bb):null}subGraphSessionStates(O,L){let F=this.bb.__offset(this.bb_pos,6);return F?(L||new E.experimental.fbs.SubGraphSessionState).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+F)+4*O),this.bb):null}subGraphSessionStatesLength(){let O=this.bb.__offset(this.bb_pos,6);return O?this.bb.__vector_len(this.bb_pos+O):0}static startSessionState(O){O.startObject(2)}static addKernels(O,L){O.addFieldOffset(0,L,0)}static addSubGraphSessionStates(O,L){O.addFieldOffset(1,L,0)}static createSubGraphSessionStatesVector(O,L){O.startVector(4,L.length,4);for(let F=L.length-1;F>=0;F--)O.addOffset(L[F]);return O.endVector()}static startSubGraphSessionStatesVector(O,L){O.startVector(4,L,4)}static endSessionState(O){return O.endObject()}static createSessionState(O,L,F){return $.startSessionState(O),$.addKernels(O,L),$.addSubGraphSessionStates(O,F),$.endSessionState(O)}}R.SessionState=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={})),function(E){(function(P){(function(R){class ${constructor(){this.bb=null,this.bb_pos=0}__init(O,L){return this.bb_pos=O,this.bb=L,this}static getRootAsInferenceSession(O,L){return(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static getSizePrefixedRootAsInferenceSession(O,L){return O.setPosition(O.position()+T.flatbuffers.SIZE_PREFIX_LENGTH),(L||new $).__init(O.readInt32(O.position())+O.position(),O)}static bufferHasIdentifier(O){return O.__has_identifier("ORTM")}ortVersion(O){let L=this.bb.__offset(this.bb_pos,4);return L?this.bb.__string(this.bb_pos+L,O):null}model(O){let L=this.bb.__offset(this.bb_pos,6);return L?(O||new E.experimental.fbs.Model).__init(this.bb.__indirect(this.bb_pos+L),this.bb):null}sessionState(O){let L=this.bb.__offset(this.bb_pos,8);return L?(O||new E.experimental.fbs.SessionState).__init(this.bb.__indirect(this.bb_pos+L),this.bb):null}static startInferenceSession(O){O.startObject(3)}static addOrtVersion(O,L){O.addFieldOffset(0,L,0)}static addModel(O,L){O.addFieldOffset(1,L,0)}static addSessionState(O,L){O.addFieldOffset(2,L,0)}static endInferenceSession(O){return O.endObject()}static finishInferenceSessionBuffer(O,L){O.finish(L,"ORTM")}static finishSizePrefixedInferenceSessionBuffer(O,L){O.finish(L,"ORTM",!0)}static createInferenceSession(O,L,F,V){return $.startInferenceSession(O),$.addOrtVersion(O,L),$.addModel(O,F),$.addSessionState(O,V),$.endInferenceSession(O)}}R.InferenceSession=$})(P.fbs||(P.fbs={}))})(E.experimental||(E.experimental={}))}(c.onnxruntime||(c.onnxruntime={}))},7448:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.OnnxjsSessionHandler=void 0;const T=_(1670),C=_(9162);c.OnnxjsSessionHandler=class{constructor(M){this.session=M,this.inputNames=this.session.inputNames,this.outputNames=this.session.outputNames}async dispose(){}async run(M,E,P){const R=new Map;for(const O in M)if(Object.hasOwnProperty.call(M,O)){const L=M[O];R.set(O,new C.Tensor(L.dims,L.type,void 0,void 0,L.data))}const $=await this.session.run(R),G={};return $.forEach((O,L)=>{G[L]=new T.Tensor(O.type,O.data,O.dims)}),G}startProfiling(){this.session.startProfiling()}endProfiling(){this.session.endProfiling()}}},6919:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Session=void 0;const T=_(7067),C=_(1296),M=_(7091),E=_(1036),P=_(6231),R=_(2644);c.Session=class{constructor($={}){this._initialized=!1,this.backendHint=$.backendHint,this.profiler=P.Profiler.create($.profiler),this.context={profiler:this.profiler,graphInputTypes:[],graphInputDims:[]}}get inputNames(){return this._model.graph.getInputNames()}get outputNames(){return this._model.graph.getOutputNames()}startProfiling(){this.profiler.start()}endProfiling(){this.profiler.stop()}async loadModel($,G,O){await this.profiler.event("session","Session.loadModel",async()=>{const L=await(0,M.resolveBackend)(this.backendHint);if(this.sessionHandler=L.createSessionHandler(this.context),this._model=new R.Model,typeof $=="string"){const F=$.endsWith(".ort");if(typeof fetch>"u"){const V=await(0,C.promisify)(T.readFile)($);this.initialize(V,F)}else{const V=await fetch($),W=await V.arrayBuffer();this.initialize(new Uint8Array(W),F)}}else if(ArrayBuffer.isView($))this.initialize($);else{const F=new Uint8Array($,G||0,O||$.byteLength);this.initialize(F)}})}initialize($,G){if(this._initialized)throw new Error("already initialized");this.profiler.event("session","Session.initialize",()=>{const O=this.sessionHandler.transformGraph?this.sessionHandler:void 0;this._model.load($,O,G),this.sessionHandler.onGraphInitialized&&this.sessionHandler.onGraphInitialized(this._model.graph),this.initializeOps(this._model.graph),this._executionPlan=new E.ExecutionPlan(this._model.graph,this._ops,this.profiler)}),this._initialized=!0}async run($){if(!this._initialized)throw new Error("session not initialized yet");return this.profiler.event("session","Session.run",async()=>{const G=this.normalizeAndValidateInputs($),O=await this._executionPlan.execute(this.sessionHandler,G);return this.createOutput(O)})}normalizeAndValidateInputs($){const G=this._model.graph.getInputNames();if(Array.isArray($)){if($.length!==G.length)throw new Error(`incorrect input array length: expected ${G.length} but got ${$.length}`)}else{if($.size!==G.length)throw new Error(`incorrect input map size: expected ${G.length} but got ${$.size}`);const O=new Array($.size);let L=0;for(let F=0;Ftypeof q=="string")))throw new TypeError("cache should be a string array");K&&(this.cache=new Array(X))}else{if(U!==void 0){const q=L(Z);if(!(U instanceof q))throw new TypeError(`cache should be type ${q.name}`)}if(K){const q=new ArrayBuffer(X*function(J){switch(J){case"bool":case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;case"float64":return 8;default:throw new Error(`cannot calculate sizeof() on type ${J}`)}}(Z));this.cache=function(J,Q){return new(L(Q))(J)}(q,Z)}}}static fromProto(z){if(!z)throw new Error("cannot construct Value from an empty tensor");const Z=R.ProtoUtil.tensorDataTypeFromProto(z.dataType),H=R.ProtoUtil.tensorDimsFromProto(z.dims),Y=new G(H,Z);if(Z==="string")z.stringData.forEach((U,j)=>{Y.data[j]=(0,R.decodeUtf8String)(U)});else if(z.rawData&&typeof z.rawData.byteLength=="number"&&z.rawData.byteLength>0){const U=Y.data,j=new DataView(z.rawData.buffer,z.rawData.byteOffset,z.rawData.byteLength),X=O(z.dataType),K=z.rawData.byteLength/X;if(z.rawData.byteLength%X!=0)throw new Error("invalid buffer length");if(U.length!==K)throw new Error("buffer length mismatch");for(let q=0;q0){const U=Y.data,j=new DataView(z.rawDataArray().buffer,z.rawDataArray().byteOffset,z.rawDataLength()),X=O(z.dataType()),K=z.rawDataLength()/X;if(z.rawDataLength()%X!=0)throw new Error("invalid buffer length");if(U.length!==K)throw new Error("buffer length mismatch");for(let q=0;q1&&Q>1)return;K[X-q]=Math.max(J,Q)}return K}static index(Z,H){const Y=new Array(H.length);return $.fillIndex(Z,H,Y),Y}static fillIndex(Z,H,Y){const U=Z.length-H.length;for(let j=0;j=0;ue--)J[ue]=re%X[ue],re=Math.floor(re/X[ue]);ne||($.fillIndex(J,Z.dims,Q),ie=Z.get(Q)),te||($.fillIndex(J,H.dims,ee),ae=H.get(ee)),q.set(J,Y(ie,ae))}}return q}}static isValidBroadcast(Z,H){const Y=Z.length,U=H.length;if(Y>U)return!1;for(let j=1;j<=Y;j++)if(Z[Y-j]!==1&&Z[Y-j]!==H[U-j])return!1;return!0}static getBroadcastDims(Z,H){const Y=Z.length,U=[];for(let j=0;j1&&K===1&&U.unshift(X)}return U}}c.BroadcastUtil=$,c.arrayCopyHelper=function(z,Z,H,Y,U){if(Y<0||Y>=Z.length)throw new Error("sourceIndex out of bounds");if(H<0||H>=z.length)throw new Error("targetIndex out of bounds");if(Y+U>Z.length)throw new Error("source indices to be copied are outside bounds");if(H+U>z.length)throw new Error("target array is too small to hold result");for(let j=0;jM.default.isLong(H)?H.toNumber():H)}static tensorValueTypeFromProto(Z){return{tensorType:G.tensorDataTypeFromProto(Z.elemType),shape:{dims:G.tensorDimsFromProto(Z.shape.dim.map(H=>H.dimValue))}}}static tensorDimsFromORTFormat(Z){const H=[];for(let Y=0;YZ.length)throw new Error(`invalid dimension of ${H} for sizeFromDimension as Tensor has ${Z.length} dimensions.`);return L.getSizeFromDimensionRange(Z,H,Z.length)}static sizeToDimension(Z,H){if(H<0||H>Z.length)throw new Error(`invalid dimension of ${H} for sizeToDimension as Tensor has ${Z.length} dimensions.`);return L.getSizeFromDimensionRange(Z,0,H)}static getSizeFromDimensionRange(Z,H,Y){let U=1;for(let j=H;j=0;--U)Y[U]=Y[U+1]*Z[U+1];return Y}static transpose(Z){return Z.slice().reverse()}static indicesToOffset(Z,H,Y){Y===void 0&&(Y=Z.length);let U=0;for(let j=0;j=H)throw new Error("unsupported axis for this operation.");return Z<0?Z+H:Z}static normalizeAxes(Z,H){return Z.map(Y=>this.normalizeAxis(Y,H))}static incrementIndex(Z,H,Y){if(H.length===0||Z.length===0)throw new Error("Index incrementing unsupported for scalar Tensor");if(Y===void 0)Y=H.length;else if(Y<=0||Y>H.length)throw new Error("Incorrect axis to increment on");for(let U=Y-1;U>=0&&(Z[U]++,!(Z[U]=Z.length)throw new Error("the dimension with value zero exceeds the dimension size of the input tensor");U[q]=Z[q]}else U[q]=H[q];X*=U[q]}}const K=L.size(Z);if(j!==-1){if(K%X!=0)throw new Error(`the input tensor cannot be reshaped to the requested shape. Input shape: [${Z}] Output shape: [${H}]`);U[j]=K/X}else if(X!==K)throw new Error("reshapedDims and originalDims don't have matching sizes");return U}static sortBasedOnPerm(Z,H){return H?H.map(Y=>Z[Y]):Z.slice().reverse()}static padShape(Z,H){const Y=Z.length;return Z.map((U,j)=>U+H[j]+H[j+Y])}static areEqual(Z,H){return Z.length===H.length&&Z.every((Y,U)=>Y===H[U])}static validateDimsAndCalcSize(Z){if(Z.length>6)throw new TypeError("Only rank 0 to 6 is supported for tensor shape.");let H=1;for(const Y of Z){if(!Number.isInteger(Y))throw new TypeError(`Invalid shape: ${Y} is not an integer`);if(Y<0||Y>2147483647)throw new TypeError(`Invalid shape: length ${Y} is not allowed`);H*=Y}return H}static flattenShape(Z,H){H<0&&(H+=Z.length);const Y=Z.reduce((j,X)=>j*X,1),U=Z.slice(H).reduce((j,X)=>j*X,1);return[Y/U,U]}static squeezeShape(Z,H){const Y=new Array;H=L.normalizeAxes(H,Z.length);for(let U=0;U=0;if(j&&Z[U]!==1)throw new Error("squeeze an axis of size different than 1");(H.length===0&&Z[U]>1||H.length>0&&!j)&&Y.push(Z[U])}return Y}static unsqueezeShape(Z,H){const Y=new Array(Z.length+H.length);Y.fill(0);for(let j=0;j=Y.length)throw new Error("'axes' has an out of range axis");if(Y[X]!==0)throw new Error("'axes' has a duplicate axis");Y[X]=1}let U=0;for(let j=0;j=Z.length)throw new Error("sourceIndex out of bounds");if(H<0||H>=z.length)throw new Error("targetIndex out of bounds");if(Y+U>Z.length)throw new Error("source indices to be copied are outside bounds");if(H+U>z.length)throw new Error("target array is too small to hold result");for(let j=0;j=Z.length)throw new Error("sourceIndex out of bounds");if(H<0||H>=z.length)throw new Error("targetIndex out of bounds");if(Y+U>Z.length)throw new Error("source indices to be copied are outside bounds");if(H+U>z.length)throw new Error("target array is too small to hold result");for(let X=0;X=Z.length)throw new Error("sourceIndex out of bounds");if(H<0||H>=z.length)throw new Error("targetIndex out of bounds");if(Y+U>Z.length)throw new Error("source indices to be copied are outside bounds");if(H+U>z.length)throw new Error("target array is too small to hold result");for(let X=0;X=Z.length)throw new Error("sourceIndex out of bounds");if(H<0||H>=z.length)throw new Error("targetIndex out of bounds");if(Y+U>Z.length)throw new Error("source indices to be copied are outside bounds");if(H+U>z.length)throw new Error("target array is too small to hold result");for(let j=0;jH.push(ae));const K=V.calcReduceShape(X,H,!0),q=L.size(K),J=new P.Tensor(K,Z.type),Q=L.computeStrides(K),ee=L.computeStrides(X),re=new Array(X.length);for(let ie=0;ie=H.length)return X(Z[j]);const J=H[U],Q=J>=Y.length?1:L.size(Y.slice(J+1));for(let ee=0;eej!==0)}}c.ReduceUtil=V;class W{static adjustPoolAttributes(Z,H,Y,U,j,X){if(!Z&&Y.length!==H.length-2)throw new Error("length of specified kernel shapes should be 2 less than length of input dimensions");if(Z)for(let K=0;K=Y.length?Y.push(H[K+2]):Y[K]=H[K+2];for(let K=0;K=Y[K]||X[K+Y.length]>=Y[K])throw new Error("pads should be smaller than kernel")}}static adjustPadsBasedOnAutoPad(Z,H,Y,U,j,X){if(X){if(j.length!==2*(Z.length-2))throw new Error("length of pads should be twice the length of data dimensions");if(H.length!==Z.length-2)throw new Error("length of strides should be the length of data dimensions");if(U.length!==Z.length-2)throw new Error("length of kernel shapes should be the length of data dimensions");for(let K=0;K{Object.defineProperty(c,"__esModule",{value:!0}),c.iterateExtraOptions=void 0,c.iterateExtraOptions=(_,T,C,M)=>{if(typeof _=="object"&&_!==null){if(C.has(_))throw new Error("Circular reference in options");C.add(_)}Object.entries(_).forEach(([E,P])=>{const R=T?T+E:E;if(typeof P=="object")(0,c.iterateExtraOptions)(P,R+".",C,M);else if(typeof P=="string"||typeof P=="number")M(R,P.toString());else{if(typeof P!="boolean")throw new Error("Can't handle extra config type: "+typeof P);M(R,P?"1":"0")}})}},2157:function(x,c,_){var T,C=this&&this.__createBinding||(Object.create?function(Q,ee,re,ie){ie===void 0&&(ie=re);var ae=Object.getOwnPropertyDescriptor(ee,re);ae&&!("get"in ae?!ee.__esModule:ae.writable||ae.configurable)||(ae={enumerable:!0,get:function(){return ee[re]}}),Object.defineProperty(Q,ie,ae)}:function(Q,ee,re,ie){ie===void 0&&(ie=re),Q[ie]=ee[re]}),M=this&&this.__setModuleDefault||(Object.create?function(Q,ee){Object.defineProperty(Q,"default",{enumerable:!0,value:ee})}:function(Q,ee){Q.default=ee}),E=this&&this.__importStar||function(Q){if(Q&&Q.__esModule)return Q;var ee={};if(Q!=null)for(var re in Q)re!=="default"&&Object.prototype.hasOwnProperty.call(Q,re)&&C(ee,Q,re);return M(ee,Q),ee};Object.defineProperty(c,"__esModule",{value:!0}),c.endProfiling=c.run=c.releaseSession=c.createSession=c.createSessionFinalize=c.createSessionAllocate=c.initOrt=c.initWasm=void 0;const P=_(1670),R=E(_(349)),$=_(6361),G=()=>!!P.env.wasm.proxy&&typeof document<"u";let O,L,F,V=!1,W=!1,z=!1;const Z=[],H=[],Y=[],U=[],j=[],X=[],K=()=>{if(V||!W||z||!O)throw new Error("worker not ready")},q=Q=>{switch(Q.data.type){case"init-wasm":V=!1,Q.data.err?(z=!0,L[1](Q.data.err)):(W=!0,L[0]());break;case"init-ort":Q.data.err?F[1](Q.data.err):F[0]();break;case"create_allocate":Q.data.err?Z.shift()[1](Q.data.err):Z.shift()[0](Q.data.out);break;case"create_finalize":Q.data.err?H.shift()[1](Q.data.err):H.shift()[0](Q.data.out);break;case"create":Q.data.err?Y.shift()[1](Q.data.err):Y.shift()[0](Q.data.out);break;case"release":Q.data.err?U.shift()[1](Q.data.err):U.shift()[0]();break;case"run":Q.data.err?j.shift()[1](Q.data.err):j.shift()[0](Q.data.out);break;case"end-profiling":Q.data.err?X.shift()[1](Q.data.err):X.shift()[0]()}},J=typeof document<"u"?(T=document==null?void 0:document.currentScript)===null||T===void 0?void 0:T.src:void 0;c.initWasm=async()=>{if(G()){if(W)return;if(V)throw new Error("multiple calls to 'initWasm()' detected.");if(z)throw new Error("previous call to 'initWasm()' failed.");return V=!0,P.env.wasm.wasmPaths===void 0&&J&&J.indexOf("blob:")!==0&&(P.env.wasm.wasmPaths=J.substr(0,+J.lastIndexOf("/")+1)),new Promise((Q,ee)=>{O==null||O.terminate(),O=_(9710).Z(),O.onmessage=q,L=[Q,ee];const re={type:"init-wasm",in:P.env.wasm};O.postMessage(re)})}return(0,$.initializeWebAssembly)(P.env.wasm)},c.initOrt=async(Q,ee)=>{if(G())return K(),new Promise((re,ie)=>{F=[re,ie];const ae={type:"init-ort",in:{numThreads:Q,loggingLevel:ee}};O.postMessage(ae)});R.initOrt(Q,ee)},c.createSessionAllocate=async Q=>G()?(K(),new Promise((ee,re)=>{Z.push([ee,re]);const ie={type:"create_allocate",in:{model:Q}};O.postMessage(ie,[Q.buffer])})):R.createSessionAllocate(Q),c.createSessionFinalize=async(Q,ee)=>G()?(K(),new Promise((re,ie)=>{H.push([re,ie]);const ae={type:"create_finalize",in:{modeldata:Q,options:ee}};O.postMessage(ae)})):R.createSessionFinalize(Q,ee),c.createSession=async(Q,ee)=>G()?(K(),new Promise((re,ie)=>{Y.push([re,ie]);const ae={type:"create",in:{model:Q,options:ee}};O.postMessage(ae,[Q.buffer])})):R.createSession(Q,ee),c.releaseSession=async Q=>{if(G())return K(),new Promise((ee,re)=>{U.push([ee,re]);const ie={type:"release",in:Q};O.postMessage(ie)});R.releaseSession(Q)},c.run=async(Q,ee,re,ie,ae)=>G()?(K(),new Promise((ne,te)=>{j.push([ne,te]);const oe={type:"run",in:{sessionId:Q,inputIndices:ee,inputs:re,outputIndices:ie,options:ae}};O.postMessage(oe,R.extractTransferableBuffers(re))})):R.run(Q,ee,re,ie,ae),c.endProfiling=async Q=>{if(G())return K(),new Promise((ee,re)=>{X.push([ee,re]);const ie={type:"end-profiling",in:Q};O.postMessage(ie)});R.endProfiling(Q)}},586:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.setRunOptions=void 0;const T=_(7967),C=_(4983),M=_(6361);c.setRunOptions=E=>{const P=(0,M.getInstance)();let R=0;const $=[],G=E||{};try{if((E==null?void 0:E.logSeverityLevel)===void 0)G.logSeverityLevel=2;else if(typeof E.logSeverityLevel!="number"||!Number.isInteger(E.logSeverityLevel)||E.logSeverityLevel<0||E.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${E.logSeverityLevel}`);if((E==null?void 0:E.logVerbosityLevel)===void 0)G.logVerbosityLevel=0;else if(typeof E.logVerbosityLevel!="number"||!Number.isInteger(E.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${E.logVerbosityLevel}`);(E==null?void 0:E.terminate)===void 0&&(G.terminate=!1);let O=0;if((E==null?void 0:E.tag)!==void 0&&(O=(0,C.allocWasmString)(E.tag,$)),R=P._OrtCreateRunOptions(G.logSeverityLevel,G.logVerbosityLevel,!!G.terminate,O),R===0)throw new Error("Can't create run options");return(E==null?void 0:E.extra)!==void 0&&(0,T.iterateExtraOptions)(E.extra,"",new WeakSet,(L,F)=>{const V=(0,C.allocWasmString)(L,$),W=(0,C.allocWasmString)(F,$);if(P._OrtAddRunConfigEntry(R,V,W)!==0)throw new Error(`Can't set a run config entry: ${L} - ${F}`)}),[R,$]}catch(O){throw R!==0&&P._OrtReleaseRunOptions(R),$.forEach(P._free),O}}},2306:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.OnnxruntimeWebAssemblySessionHandler=void 0;const T=_(2806),C=_(1670),M=_(2850),E=_(2157);let P;c.OnnxruntimeWebAssemblySessionHandler=class{async createSessionAllocate(R){const $=await fetch(R),G=await $.arrayBuffer();return(0,E.createSessionAllocate)(new Uint8Array(G))}async loadModel(R,$){if(P||(await(0,E.initOrt)(C.env.wasm.numThreads,(G=>{switch(G){case"verbose":return 0;case"info":return 1;case"warning":return 2;case"error":return 3;case"fatal":return 4;default:throw new Error(`unsupported logging level: ${G}`)}})(C.env.logLevel)),P=!0),typeof R=="string")if(typeof fetch>"u"){const G=await(0,M.promisify)(T.readFile)(R);[this.sessionId,this.inputNames,this.outputNames]=await(0,E.createSession)(G,$)}else{const G=await this.createSessionAllocate(R);[this.sessionId,this.inputNames,this.outputNames]=await(0,E.createSessionFinalize)(G,$)}else[this.sessionId,this.inputNames,this.outputNames]=await(0,E.createSession)(R,$)}async dispose(){return(0,E.releaseSession)(this.sessionId)}async run(R,$,G){const O=[],L=[];Object.entries(R).forEach(z=>{const Z=z[0],H=z[1],Y=this.inputNames.indexOf(Z);if(Y===-1)throw new Error(`invalid input '${Z}'`);O.push(H),L.push(Y)});const F=[];Object.entries($).forEach(z=>{const Z=z[0],H=this.outputNames.indexOf(Z);if(H===-1)throw new Error(`invalid output '${Z}'`);F.push(H)});const V=await(0,E.run)(this.sessionId,L,O.map(z=>[z.type,z.dims,z.data]),F,G),W={};for(let z=0;z{Object.defineProperty(c,"__esModule",{value:!0}),c.setSessionOptions=void 0;const T=_(7967),C=_(4983),M=_(6361);c.setSessionOptions=E=>{const P=(0,M.getInstance)();let R=0;const $=[],G=E||{};(O=>{O.extra||(O.extra={}),O.extra.session||(O.extra.session={});const L=O.extra.session;L.use_ort_model_bytes_directly||(L.use_ort_model_bytes_directly="1")})(G);try{(E==null?void 0:E.graphOptimizationLevel)===void 0&&(G.graphOptimizationLevel="all");const O=(V=>{switch(V){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${V}`)}})(G.graphOptimizationLevel);(E==null?void 0:E.enableCpuMemArena)===void 0&&(G.enableCpuMemArena=!0),(E==null?void 0:E.enableMemPattern)===void 0&&(G.enableMemPattern=!0),(E==null?void 0:E.executionMode)===void 0&&(G.executionMode="sequential");const L=(V=>{switch(V){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${V}`)}})(G.executionMode);let F=0;if((E==null?void 0:E.logId)!==void 0&&(F=(0,C.allocWasmString)(E.logId,$)),(E==null?void 0:E.logSeverityLevel)===void 0)G.logSeverityLevel=2;else if(typeof E.logSeverityLevel!="number"||!Number.isInteger(E.logSeverityLevel)||E.logSeverityLevel<0||E.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${E.logSeverityLevel}`);if((E==null?void 0:E.logVerbosityLevel)===void 0)G.logVerbosityLevel=0;else if(typeof E.logVerbosityLevel!="number"||!Number.isInteger(E.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${E.logVerbosityLevel}`);if((E==null?void 0:E.enableProfiling)===void 0&&(G.enableProfiling=!1),R=P._OrtCreateSessionOptions(O,!!G.enableCpuMemArena,!!G.enableMemPattern,L,!!G.enableProfiling,0,F,G.logSeverityLevel,G.logVerbosityLevel),R===0)throw new Error("Can't create session options");return E!=null&&E.executionProviders&&((V,W,z)=>{for(const Z of W){let H=typeof Z=="string"?Z:Z.name;switch(H){case"xnnpack":H="XNNPACK";break;case"wasm":case"cpu":continue;default:throw new Error(`not supported EP: ${H}`)}const Y=(0,C.allocWasmString)(H,z);if((0,M.getInstance)()._OrtAppendExecutionProvider(V,Y)!==0)throw new Error(`Can't append execution provider: ${H}`)}})(R,E.executionProviders,$),(E==null?void 0:E.extra)!==void 0&&(0,T.iterateExtraOptions)(E.extra,"",new WeakSet,(V,W)=>{const z=(0,C.allocWasmString)(V,$),Z=(0,C.allocWasmString)(W,$);if(P._OrtAddSessionConfigEntry(R,z,Z)!==0)throw new Error(`Can't set a session config entry: ${V} - ${W}`)}),[R,$]}catch(O){throw R!==0&&P._OrtReleaseSessionOptions(R),$.forEach(P._free),O}}},4983:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.allocWasmString=void 0;const T=_(6361);c.allocWasmString=(C,M)=>{const E=(0,T.getInstance)(),P=E.lengthBytesUTF8(C)+1,R=E._malloc(P);return E.stringToUTF8(C,R,P),M.push(R),R}},349:(x,c,_)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.extractTransferableBuffers=c.endProfiling=c.run=c.releaseSession=c.createSession=c.createSessionFinalize=c.createSessionAllocate=c.initOrt=void 0;const T=_(586),C=_(4919),M=_(4983),E=_(6361);c.initOrt=(O,L)=>{const F=(0,E.getInstance)()._OrtInit(O,L);if(F!==0)throw new Error(`Can't initialize onnxruntime. error code = ${F}`)};const P=new Map;c.createSessionAllocate=O=>{const L=(0,E.getInstance)(),F=L._malloc(O.byteLength);return L.HEAPU8.set(O,F),[F,O.byteLength]},c.createSessionFinalize=(O,L)=>{const F=(0,E.getInstance)();let V=0,W=0,z=[];try{if([W,z]=(0,C.setSessionOptions)(L),V=F._OrtCreateSession(O[0],O[1],W),V===0)throw new Error("Can't create a session")}finally{F._free(O[0]),F._OrtReleaseSessionOptions(W),z.forEach(F._free)}const Z=F._OrtGetInputCount(V),H=F._OrtGetOutputCount(V),Y=[],U=[],j=[],X=[];for(let K=0;K{const F=(0,c.createSessionAllocate)(O);return(0,c.createSessionFinalize)(F,L)},c.releaseSession=O=>{const L=(0,E.getInstance)(),F=P.get(O);if(!F)throw new Error("invalid session id");const V=F[0],W=F[1],z=F[2];W.forEach(L._OrtFree),z.forEach(L._OrtFree),L._OrtReleaseSession(V),P.delete(O)};const R=O=>{switch(O){case"int8":return 3;case"uint8":return 2;case"bool":return 9;case"int16":return 5;case"uint16":return 4;case"int32":return 6;case"uint32":return 12;case"float32":return 1;case"float64":return 11;case"string":return 8;case"int64":return 7;case"uint64":return 13;default:throw new Error(`unsupported data type: ${O}`)}},$=O=>{switch(O){case 3:return"int8";case 2:return"uint8";case 9:return"bool";case 5:return"int16";case 4:return"uint16";case 6:return"int32";case 12:return"uint32";case 1:return"float32";case 11:return"float64";case 8:return"string";case 7:return"int64";case 13:return"uint64";default:throw new Error(`unsupported data type: ${O}`)}},G=O=>{switch(O){case"float32":return Float32Array;case"uint8":case"bool":return Uint8Array;case"int8":return Int8Array;case"uint16":return Uint16Array;case"int16":return Int16Array;case"int32":return Int32Array;case"float64":return Float64Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"uint64":return BigUint64Array;default:throw new Error(`unsupported type: ${O}`)}};c.run=(O,L,F,V,W)=>{const z=(0,E.getInstance)(),Z=P.get(O);if(!Z)throw new Error("invalid session id");const H=Z[0],Y=Z[1],U=Z[2],j=L.length,X=V.length;let K=0,q=[];const J=[],Q=[];try{[K,q]=(0,T.setRunOptions)(W);for(let te=0;tez.HEAP32[Me++]=Re);const Pe=z._OrtCreateTensor(R(oe),pe,he,ye,ue.length);if(Pe===0)throw new Error("Can't create a tensor");J.push(Pe)}finally{z.stackRestore(we)}}const ee=z.stackSave(),re=z.stackAlloc(4*j),ie=z.stackAlloc(4*j),ae=z.stackAlloc(4*X),ne=z.stackAlloc(4*X);try{let te=re/4,oe=ie/4,ue=ae/4,de=ne/4;for(let we=0;weWe*Ke);if(Re=$($e),Re==="string"){const We=[];let Ke=De/4;for(let Je=0;Je{const L=(0,E.getInstance)(),F=P.get(O);if(!F)throw new Error("invalid session id");const V=F[0],W=L._OrtEndProfiling(V);if(W===0)throw new Error("Can't get an profile file name");L._OrtFree(W)},c.extractTransferableBuffers=O=>{const L=[];for(const F of O){const V=F[2];!Array.isArray(V)&&V.buffer&&L.push(V.buffer)}return L}},6361:function(x,c,_){var T=this&&this.__createBinding||(Object.create?function(W,z,Z,H){H===void 0&&(H=Z);var Y=Object.getOwnPropertyDescriptor(z,Z);Y&&!("get"in Y?!z.__esModule:Y.writable||Y.configurable)||(Y={enumerable:!0,get:function(){return z[Z]}}),Object.defineProperty(W,H,Y)}:function(W,z,Z,H){H===void 0&&(H=Z),W[H]=z[Z]}),C=this&&this.__setModuleDefault||(Object.create?function(W,z){Object.defineProperty(W,"default",{enumerable:!0,value:z})}:function(W,z){W.default=z}),M=this&&this.__importStar||function(W){if(W&&W.__esModule)return W;var z={};if(W!=null)for(var Z in W)Z!=="default"&&Object.prototype.hasOwnProperty.call(W,Z)&&T(z,W,Z);return C(z,W),z},E=this&&this.__importDefault||function(W){return W&&W.__esModule?W:{default:W}};Object.defineProperty(c,"__esModule",{value:!0}),c.dispose=c.getInstance=c.initializeWebAssembly=void 0;const P=M(_(6449)),R=E(_(932)),$=_(3474);let G,O=!1,L=!1,F=!1;const V=(W,z)=>z?W?"ort-wasm-simd-threaded.wasm":"ort-wasm-threaded.wasm":W?"ort-wasm-simd.wasm":"ort-wasm.wasm";c.initializeWebAssembly=async W=>{if(O)return Promise.resolve();if(L)throw new Error("multiple calls to 'initializeWebAssembly()' detected.");if(F)throw new Error("previous call to 'initializeWebAssembly()' failed.");L=!0;const z=W.initTimeout,Z=W.numThreads,H=W.simd,Y=Z>1&&(()=>{try{return typeof SharedArrayBuffer<"u"&&(typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])))}catch{return!1}})(),U=H&&(()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,30,1,28,0,65,0,253,15,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,186,1,26,11]))}catch{return!1}})(),j=typeof W.wasmPaths=="string"?W.wasmPaths:void 0,X=V(!1,Y),K=V(U,Y),q=typeof W.wasmPaths=="object"?W.wasmPaths[K]:void 0;let J=!1;const Q=[];if(z>0&&Q.push(new Promise(ee=>{setTimeout(()=>{J=!0,ee()},z)})),Q.push(new Promise((ee,re)=>{const ie=Y?$:R.default,ae={locateFile:(ne,te)=>Y&&ne.endsWith(".worker.js")&&typeof Blob<"u"?URL.createObjectURL(new Blob([_(4154)],{type:"text/javascript"})):ne===X?q??(j??te)+K:te+ne};if(Y)if(typeof Blob>"u")ae.mainScriptUrlOrBlob=P.join("/","ort-wasm-threaded.js");else{const ne=`var ortWasmThreaded=(function(){var _scriptDir;return ${ie.toString()}})();`;ae.mainScriptUrlOrBlob=new Blob([ne],{type:"text/javascript"})}ie(ae).then(ne=>{L=!1,O=!0,G=ne,ee()},ne=>{L=!1,F=!0,re(ne)})})),await Promise.race(Q),J)throw new Error(`WebAssembly backend initializing failed due to timeout: ${z}ms`)},c.getInstance=()=>{if(O&&G)return G;throw new Error("WebAssembly is not initialized yet.")},c.dispose=()=>{var W;!O||L||F||(L=!0,(W=G.PThread)===null||W===void 0||W.terminateAllThreads(),G=void 0,L=!1,O=!1,F=!0)}},9710:(x,c,_)=>{_.d(c,{Z:()=>M});var T=_(477),C=_.n(T);function M(){return C()('/*!\n* ONNX Runtime Web v1.14.0\n* Copyright (c) Microsoft Corporation. All rights reserved.\n* Licensed under the MIT License.\n*/\n(()=>{var t={474:(t,e,n)=>{var _scriptDir,r=(_scriptDir=(_scriptDir="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(t){function e(){return j.buffer!=D&&N(j.buffer),P}function r(){return j.buffer!=D&&N(j.buffer),U}function a(){return j.buffer!=D&&N(j.buffer),F}function i(){return j.buffer!=D&&N(j.buffer),I}function o(){return j.buffer!=D&&N(j.buffer),W}var u,c,s;t=t||{},u||(u=void 0!==t?t:{}),u.ready=new Promise((function(t,e){c=t,s=e}));var l,f,p,h,d,y,b=Object.assign({},u),m="./this.program",g=(t,e)=>{throw e},v="object"==typeof window,w="function"==typeof importScripts,_="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,O=u.ENVIRONMENT_IS_PTHREAD||!1,A="";function S(t){return u.locateFile?u.locateFile(t,A):A+t}if(_){let e;A=w?n(908).dirname(A)+"/":"//",y=()=>{d||(h=n(384),d=n(908))},l=function(t,e){return y(),t=d.normalize(t),h.readFileSync(t,e?void 0:"utf8")},p=t=>((t=l(t,!0)).buffer||(t=new Uint8Array(t)),t),f=(t,e,n)=>{y(),t=d.normalize(t),h.readFile(t,(function(t,r){t?n(t):e(r.buffer)}))},1{if(Q())throw process.exitCode=t,e;e instanceof ct||x("exiting due to exception: "+e),process.exit(t)},u.inspect=function(){return"[Emscripten Module object]"};try{e=n(925)}catch(t){throw console.error(\'The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?\'),t}n.g.Worker=e.Worker}else(v||w)&&(w?A=self.location.href:"undefined"!=typeof document&&document.currentScript&&(A=document.currentScript.src),_scriptDir&&(A=_scriptDir),A=0!==A.indexOf("blob:")?A.substr(0,A.replace(/[?#].*/,"").lastIndexOf("/")+1):"",_||(l=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},w&&(p=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),f=(t,e,n)=>{var r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=()=>{200==r.status||0==r.status&&r.response?e(r.response):n()},r.onerror=n,r.send(null)}));_&&"undefined"==typeof performance&&(n.g.performance=n(953).performance);var T=console.log.bind(console),E=console.warn.bind(console);_&&(y(),T=t=>h.writeSync(1,t+"\\n"),E=t=>h.writeSync(2,t+"\\n"));var M,C=u.print||T,x=u.printErr||E;Object.assign(u,b),b=null,u.thisProgram&&(m=u.thisProgram),u.quit&&(g=u.quit),u.wasmBinary&&(M=u.wasmBinary);var R=u.noExitRuntime||!1;"object"!=typeof WebAssembly&&at("no native wasm support detected");var j,k,D,P,U,F,I,W,H=!1,L="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function z(t,e,n){var r=(e>>>=0)+n;for(n=e;t[n]&&!(n>=r);)++n;if(16(a=224==(240&a)?(15&a)<<12|i<<6|o:(7&a)<<18|i<<12|o<<6|63&t[e++])?r+=String.fromCharCode(a):(a-=65536,r+=String.fromCharCode(55296|a>>10,56320|1023&a))}}else r+=String.fromCharCode(a)}return r}function Y(t,e){return(t>>>=0)?z(r(),t,e):""}function B(t,e,n,r){if(!(0>>=0;r=n+r-1;for(var i=0;i=o&&(o=65536+((1023&o)<<10)|1023&t.charCodeAt(++i)),127>=o){if(n>=r)break;e[n++>>>0]=o}else{if(2047>=o){if(n+1>=r)break;e[n++>>>0]=192|o>>6}else{if(65535>=o){if(n+2>=r)break;e[n++>>>0]=224|o>>12}else{if(n+3>=r)break;e[n++>>>0]=240|o>>18,e[n++>>>0]=128|o>>12&63}e[n++>>>0]=128|o>>6&63}e[n++>>>0]=128|63&o}}return e[n>>>0]=0,n-a}function G(t){for(var e=0,n=0;n=r?e++:2047>=r?e+=2:55296<=r&&57343>=r?(e+=4,++n):e+=3}return e}function N(t){D=t,u.HEAP8=P=new Int8Array(t),u.HEAP16=new Int16Array(t),u.HEAP32=F=new Int32Array(t),u.HEAPU8=U=new Uint8Array(t),u.HEAPU16=new Uint16Array(t),u.HEAPU32=I=new Uint32Array(t),u.HEAPF32=new Float32Array(t),u.HEAPF64=W=new Float64Array(t)}O&&(D=u.buffer);var V=u.INITIAL_MEMORY||16777216;if(O)j=u.wasmMemory,D=u.buffer;else if(u.wasmMemory)j=u.wasmMemory;else if(!((j=new WebAssembly.Memory({initial:V/65536,maximum:65536,shared:!0})).buffer instanceof SharedArrayBuffer))throw x("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),_&&console.log("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)"),Error("bad memory");j&&(D=j.buffer),V=D.byteLength,N(D);var $,q=[],X=[],J=[],Z=[];function Q(){return R||!1}function K(){var t=u.preRun.shift();q.unshift(t)}var tt,et=0,nt=null,rt=null;function at(t){throw O?postMessage({cmd:"onAbort",arg:t}):u.onAbort&&u.onAbort(t),x(t="Aborted("+t+")"),H=!0,t=new WebAssembly.RuntimeError(t+". Build with -sASSERTIONS for more info."),s(t),t}function it(){return tt.startsWith("data:application/octet-stream;base64,")}function ot(){var t=tt;try{if(t==tt&&M)return new Uint8Array(M);if(p)return p(t);throw"both async and sync fetching of the wasm failed"}catch(t){at(t)}}tt="ort-wasm-threaded.wasm",it()||(tt=S(tt));var ut={};function ct(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}function st(t){(t=ht.Vb[t])||at(),ht.mc(t)}function lt(t){var e=ht.Cc();if(!e)return 6;ht.ac.push(e),ht.Vb[t.Ub]=e,e.Ub=t.Ub;var n={cmd:"run",start_routine:t.Ic,arg:t.zc,pthread_ptr:t.Ub};return e.$b=()=>{n.time=performance.now(),e.postMessage(n,t.Nc)},e.loaded&&(e.$b(),delete e.$b),0}function ft(t){if(O)return $t(1,1,t);Q()||(ht.oc(),u.onExit&&u.onExit(t),H=!0),g(t,new ct(t))}function pt(t,e){if(!e&&O)throw bt(t),"unwind";Q()||O||(me(),dt(J),be(0),re[1].length&&ae(1,10),re[2].length&&ae(2,10),ht.oc()),ft(t)}var ht={Yb:[],ac:[],qc:[],Vb:{},fc:function(){O&&ht.Ec()},Pc:function(){},Ec:function(){ht.receiveObjectTransfer=ht.Gc,ht.threadInitTLS=ht.pc,ht.setExitStatus=ht.nc,R=!1},nc:function(){},oc:function(){for(var t of Object.values(ht.Vb))ht.mc(t);for(t of ht.Yb)t.terminate();ht.Yb=[]},mc:function(t){var e=t.Ub;delete ht.Vb[e],ht.Yb.push(t),ht.ac.splice(ht.ac.indexOf(t),1),t.Ub=0,Oe(e)},Gc:function(){},pc:function(){ht.qc.forEach((t=>t()))},Fc:function(t,e){t.onmessage=n=>{var r=(n=n.data).cmd;if(t.Ub&&(ht.Bc=t.Ub),n.targetThread&&n.targetThread!=he()){var a=ht.Vb[n.Qc];a?a.postMessage(n,n.transferList):x(\'Internal error! Worker sent a message "\'+r+\'" to target pthread \'+n.targetThread+", but that thread no longer exists!")}else"processProxyingQueue"===r?zt(n.queue):"spawnThread"===r?lt(n):"cleanupThread"===r?st(n.thread):"killThread"===r?(n=n.thread,r=ht.Vb[n],delete ht.Vb[n],r.terminate(),Oe(n),ht.ac.splice(ht.ac.indexOf(r),1),r.Ub=0):"cancelThread"===r?ht.Vb[n.thread].postMessage({cmd:"cancel"}):"loaded"===r?(t.loaded=!0,e&&e(t),t.$b&&(t.$b(),delete t.$b)):"print"===r?C("Thread "+n.threadId+": "+n.text):"printErr"===r?x("Thread "+n.threadId+": "+n.text):"alert"===r?alert("Thread "+n.threadId+": "+n.text):"setimmediate"===n.target?t.postMessage(n):"onAbort"===r?u.onAbort&&u.onAbort(n.arg):r&&x("worker sent an unknown command "+r);ht.Bc=void 0},t.onerror=t=>{throw x("worker sent an error! "+t.filename+":"+t.lineno+": "+t.message),t},_&&(t.on("message",(function(e){t.onmessage({data:e})})),t.on("error",(function(e){t.onerror(e)})),t.on("detachedExit",(function(){}))),t.postMessage({cmd:"load",urlOrBlob:u.mainScriptUrlOrBlob||_scriptDir,wasmMemory:j,wasmModule:k})},yc:function(){var t=S("ort-wasm-threaded.worker.js");ht.Yb.push(new Worker(t))},Cc:function(){return 0==ht.Yb.length&&(ht.yc(),ht.Fc(ht.Yb[0])),ht.Yb.pop()}};function dt(t){for(;0>2>>>0];t=a()[t+48>>2>>>0],Te(e,e-t),Me(e)};var mt=[];function gt(t){var e=mt[t];return e||(t>=mt.length&&(mt.length=t+1),mt[t]=e=$.get(t)),e}u.invokeEntryPoint=function(t,e){t=gt(t)(e),Q()?ht.nc(t):Ae(t)};var vt,wt,_t=[],Ot=0,At=0;function St(t){this.Zb=t,this.Sb=t-24,this.xc=function(t){i()[this.Sb+4>>2>>>0]=t},this.bc=function(){return i()[this.Sb+4>>2>>>0]},this.wc=function(t){i()[this.Sb+8>>2>>>0]=t},this.Dc=function(){return i()[this.Sb+8>>2>>>0]},this.rc=function(){a()[this.Sb>>2>>>0]=0},this.hc=function(t){t=t?1:0,e()[this.Sb+12>>0>>>0]=t},this.uc=function(){return 0!=e()[this.Sb+12>>0>>>0]},this.ic=function(t){t=t?1:0,e()[this.Sb+13>>0>>>0]=t},this.kc=function(){return 0!=e()[this.Sb+13>>0>>>0]},this.fc=function(t,e){this.cc(0),this.xc(t),this.wc(e),this.rc(),this.hc(!1),this.ic(!1)},this.sc=function(){Atomics.add(a(),this.Sb>>2,1)},this.Hc=function(){return 1===Atomics.sub(a(),this.Sb>>2,1)},this.cc=function(t){i()[this.Sb+16>>2>>>0]=t},this.tc=function(){return i()[this.Sb+16>>2>>>0]},this.vc=function(){if(Re(this.bc()))return i()[this.Zb>>2>>>0];var t=this.tc();return 0!==t?t:this.Zb}}function Tt(t){return ye(new St(t).Sb)}function Et(t,e,n,r){return O?$t(3,1,t,e,n,r):Mt(t,e,n,r)}function Mt(t,e,n,r){if("undefined"==typeof SharedArrayBuffer)return x("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var a=[];return O&&0===a.length?Et(t,e,n,r):(t={Ic:n,Ub:t,zc:r,Nc:a},O?(t.Oc="spawnThread",postMessage(t,a),0):lt(t))}function Ct(t,e,n){return O?$t(4,1,t,e,n):0}function xt(t,e){if(O)return $t(5,1,t,e)}function Rt(t,e){if(O)return $t(6,1,t,e)}function jt(t,e,n){if(O)return $t(7,1,t,e,n)}function kt(t,e,n){return O?$t(8,1,t,e,n):0}function Dt(t,e){if(O)return $t(9,1,t,e)}function Pt(t,e,n){if(O)return $t(10,1,t,e,n)}function Ut(t,e,n,r){if(O)return $t(11,1,t,e,n,r)}function Ft(t,e,n,r){if(O)return $t(12,1,t,e,n,r)}function It(t,e,n,r){if(O)return $t(13,1,t,e,n,r)}function Wt(t){if(O)return $t(14,1,t)}function Ht(t,e){if(O)return $t(15,1,t,e)}function Lt(t,e,n){if(O)return $t(16,1,t,e,n)}function zt(t){Atomics.store(a(),t>>2,1),he()&&_e(t),Atomics.compareExchange(a(),t>>2,1,0)}function Yt(t){return i()[t>>>2]+4294967296*a()[t+4>>>2]}function Bt(t,e,n,r,a,i){return O?$t(17,1,t,e,n,r,a,i):-52}function Gt(t,e,n,r,a,i){if(O)return $t(18,1,t,e,n,r,a,i)}function Nt(t){var n=G(t)+1,r=de(n);return r&&B(t,e(),r,n),r}function Vt(t,e,n){function r(t){return(t=t.toTimeString().match(/\\(([A-Za-z ]+)\\)$/))?t[1]:"GMT"}if(O)return $t(19,1,t,e,n);var o=(new Date).getFullYear(),u=new Date(o,0,1),c=new Date(o,6,1);o=u.getTimezoneOffset();var s=c.getTimezoneOffset(),l=Math.max(o,s);a()[t>>2>>>0]=60*l,a()[e>>2>>>0]=Number(o!=s),t=r(u),e=r(c),t=Nt(t),e=Nt(e),s>2>>>0]=t,i()[n+4>>2>>>0]=e):(i()[n>>2>>>0]=e,i()[n+4>>2>>>0]=t)}function $t(t,e){var n=arguments.length-2,r=arguments;return yt((()=>{for(var a=Ce(8*n),i=a>>3,u=0;u>>0]=c}return we(t,n,a,e)}))}u.executeNotifiedProxyingQueue=zt,wt=_?()=>{var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:O?()=>performance.now()-u.__performance_now_clock_drift:()=>performance.now();var qt,Xt=[],Jt={};function Zt(){if(!qt){var t,e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:m||"./this.program"};for(t in Jt)void 0===Jt[t]?delete e[t]:e[t]=Jt[t];var n=[];for(t in e)n.push(t+"="+e[t]);qt=n}return qt}function Qt(t,n){if(O)return $t(20,1,t,n);var r=0;return Zt().forEach((function(a,o){var u=n+r;for(o=i()[t+4*o>>2>>>0]=u,u=0;u>0>>>0]=a.charCodeAt(u);e()[o>>0>>>0]=0,r+=a.length+1})),0}function Kt(t,e){if(O)return $t(21,1,t,e);var n=Zt();i()[t>>2>>>0]=n.length;var r=0;return n.forEach((function(t){r+=t.length+1})),i()[e>>2>>>0]=r,0}function te(t){return O?$t(22,1,t):52}function ee(t,e,n,r){return O?$t(23,1,t,e,n,r):52}function ne(t,e,n,r,a){return O?$t(24,1,t,e,n,r,a):70}var re=[null,[],[]];function ae(t,e){var n=re[t];0===e||10===e?((1===t?C:x)(z(n,0)),n.length=0):n.push(e)}function ie(t,e,n,a){if(O)return $t(25,1,t,e,n,a);for(var o=0,u=0;u>2>>>0],s=i()[e+4>>2>>>0];e+=8;for(var l=0;l>>0]);o+=s}return i()[a>>2>>>0]=o,0}var oe=0;function ue(t){return 0==t%4&&(0!=t%100||0==t%400)}var ce=[31,29,31,30,31,30,31,31,30,31,30,31],se=[31,28,31,30,31,30,31,31,30,31,30,31];function le(t,n,r,i){function o(t,e,n){for(t="number"==typeof t?t.toString():t||"";t.lengtht?-1:0r-t.getDate())){t.setDate(t.getDate()+e);break}e-=r-t.getDate()+1,t.setDate(1),11>n?t.setMonth(n+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1))}return n=new Date(t.getFullYear()+1,0,4),e=s(new Date(t.getFullYear(),0,4)),n=s(n),0>=c(e,t)?0>=c(n,t)?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var f=a()[i+40>>2>>>0];for(var p in i={Lc:a()[i>>2>>>0],Kc:a()[i+4>>2>>>0],dc:a()[i+8>>2>>>0],jc:a()[i+12>>2>>>0],ec:a()[i+16>>2>>>0],Xb:a()[i+20>>2>>>0],Tb:a()[i+24>>2>>>0],Wb:a()[i+28>>2>>>0],Rc:a()[i+32>>2>>>0],Jc:a()[i+36>>2>>>0],Mc:f?Y(f):""},r=Y(r),f={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})r=r.replace(new RegExp(p,"g"),f[p]);var h="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),d="January February March April May June July August September October November December".split(" ");for(p in f={"%a":function(t){return h[t.Tb].substring(0,3)},"%A":function(t){return h[t.Tb]},"%b":function(t){return d[t.ec].substring(0,3)},"%B":function(t){return d[t.ec]},"%C":function(t){return u((t.Xb+1900)/100|0,2)},"%d":function(t){return u(t.jc,2)},"%e":function(t){return o(t.jc,2," ")},"%g":function(t){return l(t).toString().substring(2)},"%G":function(t){return l(t)},"%H":function(t){return u(t.dc,2)},"%I":function(t){return 0==(t=t.dc)?t=12:12t.dc?"AM":"PM"},"%S":function(t){return u(t.Lc,2)},"%t":function(){return"\\t"},"%u":function(t){return t.Tb||7},"%U":function(t){return u(Math.floor((t.Wb+7-t.Tb)/7),2)},"%V":function(t){var e=Math.floor((t.Wb+7-(t.Tb+6)%7)/7);if(2>=(t.Tb+371-t.Wb-2)%7&&e++,e)53==e&&(4==(n=(t.Tb+371-t.Wb)%7)||3==n&&ue(t.Xb)||(e=1));else{e=52;var n=(t.Tb+7-t.Wb-1)%7;(4==n||5==n&&ue(t.Xb%400-1))&&e++}return u(e,2)},"%w":function(t){return t.Tb},"%W":function(t){return u(Math.floor((t.Wb+7-(t.Tb+6)%7)/7),2)},"%y":function(t){return(t.Xb+1900).toString().substring(2)},"%Y":function(t){return t.Xb+1900},"%z":function(t){var e=0<=(t=t.Jc);return t=Math.abs(t)/60,(e?"+":"-")+String("0000"+(t/60*100+t%60)).slice(-4)},"%Z":function(t){return t.Mc},"%%":function(){return"%"}},r=r.replace(/%%/g,"\\0\\0"),f)r.includes(p)&&(r=r.replace(new RegExp(p,"g"),f[p](i)));return p=function(t){var e=Array(G(t)+1);return B(t,e,0,e.length),e}(r=r.replace(/\\0\\0/g,"%")),p.length>n?0:(function(t,n){e().set(t,n>>>0)}(p,t),p.length-1)}ht.fc();var fe=[null,ft,bt,Et,Ct,xt,Rt,jt,kt,Dt,Pt,Ut,Ft,It,Wt,Ht,Lt,Bt,Gt,Vt,Qt,Kt,te,ee,ne,ie],pe={b:function(t){return de(t+24)+24},n:function(t){return(t=new St(t)).uc()||(t.hc(!0),Ot--),t.ic(!1),_t.push(t),t.sc(),t.vc()},ma:function(t){throw x("Unexpected exception thrown, this is not properly supported - aborting"),H=!0,t},x:function(){Se(0);var t=_t.pop();if(t.Hc()&&!t.kc()){var e=t.Dc();e&>(e)(t.Zb),Tt(t.Zb)}At=0},e:function(){var t=At;if(!t)return oe=0;var e=new St(t);e.cc(t);var n=e.bc();if(!n)return oe=0,t;for(var r=Array.prototype.slice.call(arguments),a=0;azt(r)));else if(O)postMessage({targetThread:t,cmd:"processProxyingQueue",queue:r});else{if(!(t=ht.Vb[t]))return;t.postMessage({cmd:"processProxyingQueue",queue:r})}return 1},Ea:function(){return-1},Pa:function(t,e){t=new Date(1e3*Yt(t)),a()[e>>2>>>0]=t.getUTCSeconds(),a()[e+4>>2>>>0]=t.getUTCMinutes(),a()[e+8>>2>>>0]=t.getUTCHours(),a()[e+12>>2>>>0]=t.getUTCDate(),a()[e+16>>2>>>0]=t.getUTCMonth(),a()[e+20>>2>>>0]=t.getUTCFullYear()-1900,a()[e+24>>2>>>0]=t.getUTCDay(),t=(t.getTime()-Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0))/864e5|0,a()[e+28>>2>>>0]=t},Qa:function(t,e){t=new Date(1e3*Yt(t)),a()[e>>2>>>0]=t.getSeconds(),a()[e+4>>2>>>0]=t.getMinutes(),a()[e+8>>2>>>0]=t.getHours(),a()[e+12>>2>>>0]=t.getDate(),a()[e+16>>2>>>0]=t.getMonth(),a()[e+20>>2>>>0]=t.getFullYear()-1900,a()[e+24>>2>>>0]=t.getDay();var n=new Date(t.getFullYear(),0,1),r=(t.getTime()-n.getTime())/864e5|0;a()[e+28>>2>>>0]=r,a()[e+36>>2>>>0]=-60*t.getTimezoneOffset(),r=new Date(t.getFullYear(),6,1).getTimezoneOffset(),t=0|(r!=(n=n.getTimezoneOffset())&&t.getTimezoneOffset()==Math.min(n,r)),a()[e+32>>2>>>0]=t},Ra:function(t){var e=new Date(a()[t+20>>2>>>0]+1900,a()[t+16>>2>>>0],a()[t+12>>2>>>0],a()[t+8>>2>>>0],a()[t+4>>2>>>0],a()[t>>2>>>0],0),n=a()[t+32>>2>>>0],r=e.getTimezoneOffset(),i=new Date(e.getFullYear(),0,1),o=new Date(e.getFullYear(),6,1).getTimezoneOffset(),u=i.getTimezoneOffset(),c=Math.min(u,o);return 0>n?a()[t+32>>2>>>0]=Number(o!=u&&c==r):0>2>>>0]=e.getDay(),n=(e.getTime()-i.getTime())/864e5|0,a()[t+28>>2>>>0]=n,a()[t>>2>>>0]=e.getSeconds(),a()[t+4>>2>>>0]=e.getMinutes(),a()[t+8>>2>>>0]=e.getHours(),a()[t+12>>2>>>0]=e.getDate(),a()[t+16>>2>>>0]=e.getMonth(),e.getTime()/1e3|0},Aa:Bt,Ba:Gt,Sa:function t(e,n,r){t.Ac||(t.Ac=!0,Vt(e,n,r))},y:function(){at("")},U:function(){if(!_&&!w){var t="Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread";vt||(vt={}),vt[t]||(vt[t]=1,_&&(t="warning: "+t),x(t))}},ra:function(){return 4294901760},B:wt,Ia:function(t,e,n){r().copyWithin(t>>>0,e>>>0,e+n>>>0)},F:function(){return _?n(993).cpus().length:navigator.hardwareConcurrency},Da:function(t,e,n){Xt.length=e,n>>=3;for(var r=0;r>>0];return(0>t?ut[-t-1]:fe[t]).apply(null,Xt)},qa:function(t){var e=r().length;if((t>>>=0)<=e||4294901760=n;n*=2){var a=e*(1+.2/n);a=Math.min(a,t+100663296);var i=Math;a=Math.max(t,a),i=i.min.call(i,4294901760,a+(65536-a%65536)%65536);t:{try{j.grow(i-D.byteLength+65535>>>16),N(j.buffer);var o=1;break t}catch(t){}o=void 0}if(o)return!0}return!1},Na:function(){throw"unwind"},Ga:Qt,Ha:Kt,J:pt,I:te,S:ee,ga:ne,R:ie,d:function(){return oe},na:function t(r,a){t.lc||(t.lc=function(){if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var t=new Uint8Array(1);return()=>(crypto.getRandomValues(t),t[0])}if(_)try{var e=n(Object(function(){var t=new Error("Cannot find module \'crypto\'");throw t.code="MODULE_NOT_FOUND",t}()));return()=>e.randomBytes(1)[0]}catch(t){}return()=>at("randomDevice")}());for(var i=0;i>0>>>0]=t.lc();return 0},ia:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},ja:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},K:function(t){var e=Ee();try{return gt(t)()}catch(t){if(Me(e),t!==t+0)throw t;Se(1,0)}},f:function(t,e){var n=Ee();try{return gt(t)(e)}catch(t){if(Me(n),t!==t+0)throw t;Se(1,0)}},P:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},Q:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},k:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},p:function(t,e,n,r){var a=Ee();try{return gt(t)(e,n,r)}catch(t){if(Me(a),t!==t+0)throw t;Se(1,0)}},q:function(t,e,n,r,a){var i=Ee();try{return gt(t)(e,n,r,a)}catch(t){if(Me(i),t!==t+0)throw t;Se(1,0)}},N:function(t,e,n,r,a,i){var o=Ee();try{return gt(t)(e,n,r,a,i)}catch(t){if(Me(o),t!==t+0)throw t;Se(1,0)}},s:function(t,e,n,r,a,i){var o=Ee();try{return gt(t)(e,n,r,a,i)}catch(t){if(Me(o),t!==t+0)throw t;Se(1,0)}},w:function(t,e,n,r,a,i,o){var u=Ee();try{return gt(t)(e,n,r,a,i,o)}catch(t){if(Me(u),t!==t+0)throw t;Se(1,0)}},L:function(t,e,n,r,a,i,o,u){var c=Ee();try{return gt(t)(e,n,r,a,i,o,u)}catch(t){if(Me(c),t!==t+0)throw t;Se(1,0)}},E:function(t,e,n,r,a,i,o,u,c,s,l,f){var p=Ee();try{return gt(t)(e,n,r,a,i,o,u,c,s,l,f)}catch(t){if(Me(p),t!==t+0)throw t;Se(1,0)}},aa:function(t,e,n,r,a,i,o,u){var c=Ee();try{return He(t,e,n,r,a,i,o,u)}catch(t){if(Me(c),t!==t+0)throw t;Se(1,0)}},_:function(t,e,n,r,a,i,o){var u=Ee();try{return ke(t,e,n,r,a,i,o)}catch(t){if(Me(u),t!==t+0)throw t;Se(1,0)}},Z:function(t,e,n,r,a){var i=Ee();try{return Le(t,e,n,r,a)}catch(t){if(Me(i),t!==t+0)throw t;Se(1,0)}},ca:function(t,e,n,r){var a=Ee();try{return Ie(t,e,n,r)}catch(t){if(Me(a),t!==t+0)throw t;Se(1,0)}},$:function(t){var e=Ee();try{return je(t)}catch(t){if(Me(e),t!==t+0)throw t;Se(1,0)}},ba:function(t,e){var n=Ee();try{return We(t,e)}catch(t){if(Me(n),t!==t+0)throw t;Se(1,0)}},Y:function(t,e,n){var r=Ee();try{return De(t,e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},g:function(t){var e=Ee();try{gt(t)()}catch(t){if(Me(e),t!==t+0)throw t;Se(1,0)}},r:function(t,e){var n=Ee();try{gt(t)(e)}catch(t){if(Me(n),t!==t+0)throw t;Se(1,0)}},i:function(t,e,n){var r=Ee();try{gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},ha:function(t,e,n,r){var a=Ee();try{gt(t)(e,n,r)}catch(t){if(Me(a),t!==t+0)throw t;Se(1,0)}},m:function(t,e,n,r){var a=Ee();try{gt(t)(e,n,r)}catch(t){if(Me(a),t!==t+0)throw t;Se(1,0)}},v:function(t,e,n,r,a){var i=Ee();try{gt(t)(e,n,r,a)}catch(t){if(Me(i),t!==t+0)throw t;Se(1,0)}},u:function(t,e,n,r,a,i){var o=Ee();try{gt(t)(e,n,r,a,i)}catch(t){if(Me(o),t!==t+0)throw t;Se(1,0)}},O:function(t,e,n,r,a,i,o){var u=Ee();try{gt(t)(e,n,r,a,i,o)}catch(t){if(Me(u),t!==t+0)throw t;Se(1,0)}},A:function(t,e,n,r,a,i,o,u){var c=Ee();try{gt(t)(e,n,r,a,i,o,u)}catch(t){if(Me(c),t!==t+0)throw t;Se(1,0)}},ka:function(t,e,n,r,a,i,o,u,c){var s=Ee();try{gt(t)(e,n,r,a,i,o,u,c)}catch(t){if(Me(s),t!==t+0)throw t;Se(1,0)}},C:function(t,e,n,r,a,i,o,u,c,s,l){var f=Ee();try{gt(t)(e,n,r,a,i,o,u,c,s,l)}catch(t){if(Me(f),t!==t+0)throw t;Se(1,0)}},D:function(t,e,n,r,a,i,o,u,c,s,l,f,p,h,d,y){var b=Ee();try{gt(t)(e,n,r,a,i,o,u,c,s,l,f,p,h,d,y)}catch(t){if(Me(b),t!==t+0)throw t;Se(1,0)}},fa:function(t,e,n,r,a,i,o,u){var c=Ee();try{Pe(t,e,n,r,a,i,o,u)}catch(t){if(Me(c),t!==t+0)throw t;Se(1,0)}},da:function(t,e,n,r,a,i,o,u,c,s,l,f){var p=Ee();try{Fe(t,e,n,r,a,i,o,u,c,s,l,f)}catch(t){if(Me(p),t!==t+0)throw t;Se(1,0)}},ea:function(t,e,n,r,a,i){var o=Ee();try{Ue(t,e,n,r,a,i)}catch(t){if(Me(o),t!==t+0)throw t;Se(1,0)}},o:function(t){return t},a:j||u.wasmMemory,G:function(t){oe=t},la:le,z:function(t,e,n,r){return le(t,e,n,r)}};!function(){function t(t,e){u.asm=t.exports,ht.qc.push(u.asm.sb),$=u.asm.ub,X.unshift(u.asm.Va),k=e,O||(et--,u.monitorRunDependencies&&u.monitorRunDependencies(et),0==et&&(null!==nt&&(clearInterval(nt),nt=null),rt&&(t=rt,rt=null,t())))}function e(e){t(e.instance,e.module)}function n(t){return function(){if(!M&&(v||w)){if("function"==typeof fetch&&!tt.startsWith("file://"))return fetch(tt,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at \'"+tt+"\'";return t.arrayBuffer()})).catch((function(){return ot()}));if(f)return new Promise((function(t,e){f(tt,(function(e){t(new Uint8Array(e))}),e)}))}return Promise.resolve().then((function(){return ot()}))}().then((function(t){return WebAssembly.instantiate(t,r)})).then((function(t){return t})).then(t,(function(t){x("failed to asynchronously prepare wasm: "+t),at(t)}))}var r={a:pe};if(O||(et++,u.monitorRunDependencies&&u.monitorRunDependencies(et)),u.instantiateWasm)try{return u.instantiateWasm(r,t)}catch(t){return x("Module.instantiateWasm callback failed with error: "+t),!1}(M||"function"!=typeof WebAssembly.instantiateStreaming||it()||tt.startsWith("file://")||_||"function"!=typeof fetch?n(e):fetch(tt,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,r).then(e,(function(t){return x("wasm streaming compile failed: "+t),x("falling back to ArrayBuffer instantiation"),n(e)}))}))).catch(s)}(),u.___wasm_call_ctors=function(){return(u.___wasm_call_ctors=u.asm.Va).apply(null,arguments)},u._OrtInit=function(){return(u._OrtInit=u.asm.Wa).apply(null,arguments)},u._OrtCreateSessionOptions=function(){return(u._OrtCreateSessionOptions=u.asm.Xa).apply(null,arguments)},u._OrtAppendExecutionProvider=function(){return(u._OrtAppendExecutionProvider=u.asm.Ya).apply(null,arguments)},u._OrtAddSessionConfigEntry=function(){return(u._OrtAddSessionConfigEntry=u.asm.Za).apply(null,arguments)},u._OrtReleaseSessionOptions=function(){return(u._OrtReleaseSessionOptions=u.asm._a).apply(null,arguments)},u._OrtCreateSession=function(){return(u._OrtCreateSession=u.asm.$a).apply(null,arguments)},u._OrtReleaseSession=function(){return(u._OrtReleaseSession=u.asm.ab).apply(null,arguments)},u._OrtGetInputCount=function(){return(u._OrtGetInputCount=u.asm.bb).apply(null,arguments)},u._OrtGetOutputCount=function(){return(u._OrtGetOutputCount=u.asm.cb).apply(null,arguments)},u._OrtGetInputName=function(){return(u._OrtGetInputName=u.asm.db).apply(null,arguments)},u._OrtGetOutputName=function(){return(u._OrtGetOutputName=u.asm.eb).apply(null,arguments)},u._OrtFree=function(){return(u._OrtFree=u.asm.fb).apply(null,arguments)},u._OrtCreateTensor=function(){return(u._OrtCreateTensor=u.asm.gb).apply(null,arguments)},u._OrtGetTensorData=function(){return(u._OrtGetTensorData=u.asm.hb).apply(null,arguments)},u._OrtReleaseTensor=function(){return(u._OrtReleaseTensor=u.asm.ib).apply(null,arguments)},u._OrtCreateRunOptions=function(){return(u._OrtCreateRunOptions=u.asm.jb).apply(null,arguments)},u._OrtAddRunConfigEntry=function(){return(u._OrtAddRunConfigEntry=u.asm.kb).apply(null,arguments)},u._OrtReleaseRunOptions=function(){return(u._OrtReleaseRunOptions=u.asm.lb).apply(null,arguments)},u._OrtRun=function(){return(u._OrtRun=u.asm.mb).apply(null,arguments)},u._OrtEndProfiling=function(){return(u._OrtEndProfiling=u.asm.nb).apply(null,arguments)};var he=u._pthread_self=function(){return(he=u._pthread_self=u.asm.ob).apply(null,arguments)},de=u._malloc=function(){return(de=u._malloc=u.asm.pb).apply(null,arguments)},ye=u._free=function(){return(ye=u._free=u.asm.qb).apply(null,arguments)},be=u._fflush=function(){return(be=u._fflush=u.asm.rb).apply(null,arguments)};u.__emscripten_tls_init=function(){return(u.__emscripten_tls_init=u.asm.sb).apply(null,arguments)};var me=u.___funcs_on_exit=function(){return(me=u.___funcs_on_exit=u.asm.tb).apply(null,arguments)},ge=u.__emscripten_thread_init=function(){return(ge=u.__emscripten_thread_init=u.asm.vb).apply(null,arguments)};u.__emscripten_thread_crashed=function(){return(u.__emscripten_thread_crashed=u.asm.wb).apply(null,arguments)};var ve,we=u._emscripten_run_in_main_runtime_thread_js=function(){return(we=u._emscripten_run_in_main_runtime_thread_js=u.asm.xb).apply(null,arguments)},_e=u.__emscripten_proxy_execute_task_queue=function(){return(_e=u.__emscripten_proxy_execute_task_queue=u.asm.yb).apply(null,arguments)},Oe=u.__emscripten_thread_free_data=function(){return(Oe=u.__emscripten_thread_free_data=u.asm.zb).apply(null,arguments)},Ae=u.__emscripten_thread_exit=function(){return(Ae=u.__emscripten_thread_exit=u.asm.Ab).apply(null,arguments)},Se=u._setThrew=function(){return(Se=u._setThrew=u.asm.Bb).apply(null,arguments)},Te=u._emscripten_stack_set_limits=function(){return(Te=u._emscripten_stack_set_limits=u.asm.Cb).apply(null,arguments)},Ee=u.stackSave=function(){return(Ee=u.stackSave=u.asm.Db).apply(null,arguments)},Me=u.stackRestore=function(){return(Me=u.stackRestore=u.asm.Eb).apply(null,arguments)},Ce=u.stackAlloc=function(){return(Ce=u.stackAlloc=u.asm.Fb).apply(null,arguments)},xe=u.___cxa_can_catch=function(){return(xe=u.___cxa_can_catch=u.asm.Gb).apply(null,arguments)},Re=u.___cxa_is_pointer_type=function(){return(Re=u.___cxa_is_pointer_type=u.asm.Hb).apply(null,arguments)},je=u.dynCall_j=function(){return(je=u.dynCall_j=u.asm.Ib).apply(null,arguments)},ke=u.dynCall_iiiiij=function(){return(ke=u.dynCall_iiiiij=u.asm.Jb).apply(null,arguments)},De=u.dynCall_jii=function(){return(De=u.dynCall_jii=u.asm.Kb).apply(null,arguments)},Pe=u.dynCall_viiiiij=function(){return(Pe=u.dynCall_viiiiij=u.asm.Lb).apply(null,arguments)},Ue=u.dynCall_vjji=function(){return(Ue=u.dynCall_vjji=u.asm.Mb).apply(null,arguments)},Fe=u.dynCall_viiijjjii=function(){return(Fe=u.dynCall_viiijjjii=u.asm.Nb).apply(null,arguments)},Ie=u.dynCall_iij=function(){return(Ie=u.dynCall_iij=u.asm.Ob).apply(null,arguments)},We=u.dynCall_ji=function(){return(We=u.dynCall_ji=u.asm.Pb).apply(null,arguments)},He=u.dynCall_iiiiiij=function(){return(He=u.dynCall_iiiiiij=u.asm.Qb).apply(null,arguments)},Le=u.dynCall_iiij=function(){return(Le=u.dynCall_iiij=u.asm.Rb).apply(null,arguments)};function ze(){function t(){if(!ve&&(ve=!0,u.calledRun=!0,!H)&&(O||dt(X),c(u),u.onRuntimeInitialized&&u.onRuntimeInitialized(),!O)){if(u.postRun)for("function"==typeof u.postRun&&(u.postRun=[u.postRun]);u.postRun.length;){var t=u.postRun.shift();Z.unshift(t)}dt(Z)}}if(!(0{var _scriptDir,r=(_scriptDir=(_scriptDir="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(t){var e,r,a;t=t||{},e||(e=void 0!==t?t:{}),e.ready=new Promise((function(t,e){r=t,a=e}));var i,o,u,c,s,l,f=Object.assign({},e),p="./this.program",h=(t,e)=>{throw e},d="object"==typeof window,y="function"==typeof importScripts,b="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,m="";b?(m=y?n(908).dirname(m)+"/":"//",l=()=>{s||(c=n(384),s=n(908))},i=function(t,e){return l(),t=s.normalize(t),c.readFileSync(t,e?void 0:"utf8")},u=t=>((t=i(t,!0)).buffer||(t=new Uint8Array(t)),t),o=(t,e,n)=>{l(),t=s.normalize(t),c.readFile(t,(function(t,r){t?n(t):e(r.buffer)}))},1{if(_||0{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},y&&(u=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),o=(t,e,n)=>{var r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=()=>{200==r.status||0==r.status&&r.response?e(r.response):n()},r.onerror=n,r.send(null)});var g,v=e.print||console.log.bind(console),w=e.printErr||console.warn.bind(console);Object.assign(e,f),f=null,e.thisProgram&&(p=e.thisProgram),e.quit&&(h=e.quit),e.wasmBinary&&(g=e.wasmBinary);var _=e.noExitRuntime||!1;"object"!=typeof WebAssembly&&V("no native wasm support detected");var O,A,S,T,E,M,C=!1,x="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function R(t,e,n){var r=(e>>>=0)+n;for(n=e;t[n]&&!(n>=r);)++n;if(16(a=224==(240&a)?(15&a)<<12|i<<6|o:(7&a)<<18|i<<12|o<<6|63&t[e++])?r+=String.fromCharCode(a):(a-=65536,r+=String.fromCharCode(55296|a>>10,56320|1023&a))}}else r+=String.fromCharCode(a)}return r}function j(t,e){return(t>>>=0)?R(T,t,e):""}function k(t,e,n,r){if(!(0>>=0;r=n+r-1;for(var i=0;i=o&&(o=65536+((1023&o)<<10)|1023&t.charCodeAt(++i)),127>=o){if(n>=r)break;e[n++>>>0]=o}else{if(2047>=o){if(n+1>=r)break;e[n++>>>0]=192|o>>6}else{if(65535>=o){if(n+2>=r)break;e[n++>>>0]=224|o>>12}else{if(n+3>=r)break;e[n++>>>0]=240|o>>18,e[n++>>>0]=128|o>>12&63}e[n++>>>0]=128|o>>6&63}e[n++>>>0]=128|63&o}}return e[n>>>0]=0,n-a}function D(t){for(var e=0,n=0;n=r?e++:2047>=r?e+=2:55296<=r&&57343>=r?(e+=4,++n):e+=3}return e}function P(){var t=O.buffer;A=t,e.HEAP8=S=new Int8Array(t),e.HEAP16=new Int16Array(t),e.HEAP32=E=new Int32Array(t),e.HEAPU8=T=new Uint8Array(t),e.HEAPU16=new Uint16Array(t),e.HEAPU32=M=new Uint32Array(t),e.HEAPF32=new Float32Array(t),e.HEAPF64=new Float64Array(t)}var U,F=[],I=[],W=[],H=[],L=0;function z(){var t=e.preRun.shift();F.unshift(t)}var Y,B=0,G=null,N=null;function V(t){throw e.onAbort&&e.onAbort(t),w(t="Aborted("+t+")"),C=!0,t=new WebAssembly.RuntimeError(t+". Build with -sASSERTIONS for more info."),a(t),t}function $(){return Y.startsWith("data:application/octet-stream;base64,")}if(Y="ort-wasm.wasm",!$()){var q=Y;Y=e.locateFile?e.locateFile(q,m):m+q}function X(){var t=Y;try{if(t==Y&&g)return new Uint8Array(g);if(u)return u(t);throw"both async and sync fetching of the wasm failed"}catch(t){V(t)}}function J(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}function Z(t){for(;0>2>>>0]=t},this.Eb=function(){return M[this.zb+4>>2>>>0]},this.Sb=function(t){M[this.zb+8>>2>>>0]=t},this.Wb=function(){return M[this.zb+8>>2>>>0]},this.Tb=function(){E[this.zb>>2>>>0]=0},this.Ib=function(t){S[this.zb+12>>0>>>0]=t?1:0},this.Pb=function(){return 0!=S[this.zb+12>>0>>>0]},this.Jb=function(t){S[this.zb+13>>0>>>0]=t?1:0},this.Lb=function(){return 0!=S[this.zb+13>>0>>>0]},this.Rb=function(t,e){this.Fb(0),this.Ub(t),this.Sb(e),this.Tb(),this.Ib(!1),this.Jb(!1)},this.Nb=function(){E[this.zb>>2>>>0]+=1},this.Xb=function(){var t=E[this.zb>>2>>>0];return E[this.zb>>2>>>0]=t-1,1===t},this.Fb=function(t){M[this.zb+16>>2>>>0]=t},this.Ob=function(){return M[this.zb+16>>2>>>0]},this.Qb=function(){if(Mt(this.Eb()))return M[this.Db>>2>>>0];var t=this.Ob();return 0!==t?t:this.Db}}function nt(t){return vt(new et(t).zb)}var rt=[];function at(t){var e=rt[t];return e||(t>=rt.length&&(rt.length=t+1),rt[t]=e=U.get(t)),e}function it(t){var e=D(t)+1,n=gt(e);return n&&k(t,S,n,e),n}var ot={};function ut(){if(!ct){var t,e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:p||"./this.program"};for(t in ot)void 0===ot[t]?delete e[t]:e[t]=ot[t];var n=[];for(t in e)n.push(t+"="+e[t]);ct=n}return ct}var ct,st=[null,[],[]];function lt(t,e){var n=st[t];0===e||10===e?((1===t?v:w)(R(n,0)),n.length=0):n.push(e)}var ft=0;function pt(t){return 0==t%4&&(0!=t%100||0==t%400)}var ht=[31,29,31,30,31,30,31,31,30,31,30,31],dt=[31,28,31,30,31,30,31,31,30,31,30,31];function yt(t,e,n,r){function a(t,e,n){for(t="number"==typeof t?t.toString():t||"";t.lengtht?-1:0r-t.getDate())){t.setDate(t.getDate()+e);break}e-=r-t.getDate()+1,t.setDate(1),11>n?t.setMonth(n+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1))}return n=new Date(t.getFullYear()+1,0,4),e=u(new Date(t.getFullYear(),0,4)),n=u(n),0>=o(e,t)?0>=o(n,t)?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var s=E[r+40>>2>>>0];for(var l in r={$b:E[r>>2>>>0],Zb:E[r+4>>2>>>0],Gb:E[r+8>>2>>>0],Kb:E[r+12>>2>>>0],Hb:E[r+16>>2>>>0],Cb:E[r+20>>2>>>0],Ab:E[r+24>>2>>>0],Bb:E[r+28>>2>>>0],bc:E[r+32>>2>>>0],Yb:E[r+36>>2>>>0],ac:s?j(s):""},n=j(n),s={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})n=n.replace(new RegExp(l,"g"),s[l]);var f="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),p="January February March April May June July August September October November December".split(" ");for(l in s={"%a":function(t){return f[t.Ab].substring(0,3)},"%A":function(t){return f[t.Ab]},"%b":function(t){return p[t.Hb].substring(0,3)},"%B":function(t){return p[t.Hb]},"%C":function(t){return i((t.Cb+1900)/100|0,2)},"%d":function(t){return i(t.Kb,2)},"%e":function(t){return a(t.Kb,2," ")},"%g":function(t){return c(t).toString().substring(2)},"%G":function(t){return c(t)},"%H":function(t){return i(t.Gb,2)},"%I":function(t){return 0==(t=t.Gb)?t=12:12t.Gb?"AM":"PM"},"%S":function(t){return i(t.$b,2)},"%t":function(){return"\\t"},"%u":function(t){return t.Ab||7},"%U":function(t){return i(Math.floor((t.Bb+7-t.Ab)/7),2)},"%V":function(t){var e=Math.floor((t.Bb+7-(t.Ab+6)%7)/7);if(2>=(t.Ab+371-t.Bb-2)%7&&e++,e)53==e&&(4==(n=(t.Ab+371-t.Bb)%7)||3==n&&pt(t.Cb)||(e=1));else{e=52;var n=(t.Ab+7-t.Bb-1)%7;(4==n||5==n&&pt(t.Cb%400-1))&&e++}return i(e,2)},"%w":function(t){return t.Ab},"%W":function(t){return i(Math.floor((t.Bb+7-(t.Ab+6)%7)/7),2)},"%y":function(t){return(t.Cb+1900).toString().substring(2)},"%Y":function(t){return t.Cb+1900},"%z":function(t){var e=0<=(t=t.Yb);return t=Math.abs(t)/60,(e?"+":"-")+String("0000"+(t/60*100+t%60)).slice(-4)},"%Z":function(t){return t.ac},"%%":function(){return"%"}},n=n.replace(/%%/g,"\\0\\0"),s)n.includes(l)&&(n=n.replace(new RegExp(l,"g"),s[l](r)));return l=function(t){var e=Array(D(t)+1);return k(t,e,0,e.length),e}(n=n.replace(/\\0\\0/g,"%")),l.length>e?0:(S.set(l,t>>>0),l.length-1)}var bt={a:function(t){return gt(t+24)+24},m:function(t){return(t=new et(t)).Pb()||(t.Ib(!0),K--),t.Jb(!1),Q.push(t),t.Nb(),t.Qb()},ia:function(t){throw w("Unexpected exception thrown, this is not properly supported - aborting"),C=!0,t},w:function(){Ot(0);var t=Q.pop();if(t.Xb()&&!t.Lb()){var e=t.Wb();e&&at(e)(t.Db),nt(t.Db)}tt=0},d:function(){var t=tt;if(!t)return ft=0;var e=new et(t);e.Fb(t);var n=e.Eb();if(!n)return ft=0,t;for(var r=Array.prototype.slice.call(arguments),a=0;a>>2]+4294967296*E[t+4>>>2])),E[e>>2>>>0]=t.getUTCSeconds(),E[e+4>>2>>>0]=t.getUTCMinutes(),E[e+8>>2>>>0]=t.getUTCHours(),E[e+12>>2>>>0]=t.getUTCDate(),E[e+16>>2>>>0]=t.getUTCMonth(),E[e+20>>2>>>0]=t.getUTCFullYear()-1900,E[e+24>>2>>>0]=t.getUTCDay(),E[e+28>>2>>>0]=(t.getTime()-Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0))/864e5|0},Ea:function(t,e){t=new Date(1e3*(M[t>>>2]+4294967296*E[t+4>>>2])),E[e>>2>>>0]=t.getSeconds(),E[e+4>>2>>>0]=t.getMinutes(),E[e+8>>2>>>0]=t.getHours(),E[e+12>>2>>>0]=t.getDate(),E[e+16>>2>>>0]=t.getMonth(),E[e+20>>2>>>0]=t.getFullYear()-1900,E[e+24>>2>>>0]=t.getDay();var n=new Date(t.getFullYear(),0,1);E[e+28>>2>>>0]=(t.getTime()-n.getTime())/864e5|0,E[e+36>>2>>>0]=-60*t.getTimezoneOffset();var r=new Date(t.getFullYear(),6,1).getTimezoneOffset();n=n.getTimezoneOffset(),E[e+32>>2>>>0]=0|(r!=n&&t.getTimezoneOffset()==Math.min(n,r))},Fa:function(t){var e=new Date(E[t+20>>2>>>0]+1900,E[t+16>>2>>>0],E[t+12>>2>>>0],E[t+8>>2>>>0],E[t+4>>2>>>0],E[t>>2>>>0],0),n=E[t+32>>2>>>0],r=e.getTimezoneOffset(),a=new Date(e.getFullYear(),0,1),i=new Date(e.getFullYear(),6,1).getTimezoneOffset(),o=a.getTimezoneOffset(),u=Math.min(o,i);return 0>n?E[t+32>>2>>>0]=Number(i!=o&&u==r):0>2>>>0]=e.getDay(),E[t+28>>2>>>0]=(e.getTime()-a.getTime())/864e5|0,E[t>>2>>>0]=e.getSeconds(),E[t+4>>2>>>0]=e.getMinutes(),E[t+8>>2>>>0]=e.getHours(),E[t+12>>2>>>0]=e.getDate(),E[t+16>>2>>>0]=e.getMonth(),e.getTime()/1e3|0},sa:function(){return-52},ta:function(){},Ga:function t(e,n,r){t.Vb||(t.Vb=!0,function(t,e,n){function r(t){return(t=t.toTimeString().match(/\\(([A-Za-z ]+)\\)$/))?t[1]:"GMT"}var a=(new Date).getFullYear(),i=new Date(a,0,1),o=new Date(a,6,1);a=i.getTimezoneOffset();var u=o.getTimezoneOffset();E[t>>2>>>0]=60*Math.max(a,u),E[e>>2>>>0]=Number(a!=u),t=r(i),e=r(o),t=it(t),e=it(e),u>2>>>0]=t,M[n+4>>2>>>0]=e):(M[n>>2>>>0]=e,M[n+4>>2>>>0]=t)}(e,n,r))},B:function(){V("")},ma:function(){return 4294901760},I:b?()=>{var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:()=>performance.now(),xa:function(t,e,n){T.copyWithin(t>>>0,e>>>0,e+n>>>0)},G:function(t){var e=T.length;if(4294901760<(t>>>=0))return!1;for(var n=1;4>=n;n*=2){var r=e*(1+.2/n);r=Math.min(r,t+100663296);var a=Math;r=Math.max(t,r),a=a.min.call(a,4294901760,r+(65536-r%65536)%65536);t:{try{O.grow(a-A.byteLength+65535>>>16),P();var i=1;break t}catch(t){}i=void 0}if(i)return!0}return!1},va:function(t,e){var n=0;return ut().forEach((function(r,a){var i=e+n;for(a=M[t+4*a>>2>>>0]=i,i=0;i>0>>>0]=r.charCodeAt(i);S[a>>0>>>0]=0,n+=r.length+1})),0},wa:function(t,e){var n=ut();M[t>>2>>>0]=n.length;var r=0;return n.forEach((function(t){r+=t.length+1})),M[e>>2>>>0]=r,0},ba:function(t){_||0>2>>>0],u=M[e+4>>2>>>0];e+=8;for(var c=0;c>>0]);a+=u}return M[r>>2>>>0]=a,0},c:function(){return ft},ja:function t(e,r){t.Mb||(t.Mb=function(){if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var t=new Uint8Array(1);return()=>(crypto.getRandomValues(t),t[0])}if(b)try{var e=n(Object(function(){var t=new Error("Cannot find module \'crypto\'");throw t.code="MODULE_NOT_FOUND",t}()));return()=>e.randomBytes(1)[0]}catch(t){}return()=>V("randomDevice")}());for(var a=0;a>0>>>0]=t.Mb();return 0},ea:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},fa:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},J:function(t){var e=At();try{return at(t)()}catch(t){if(St(e),t!==t+0)throw t;Ot(1,0)}},e:function(t,e){var n=At();try{return at(t)(e)}catch(t){if(St(n),t!==t+0)throw t;Ot(1,0)}},N:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},O:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},j:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},o:function(t,e,n,r){var a=At();try{return at(t)(e,n,r)}catch(t){if(St(a),t!==t+0)throw t;Ot(1,0)}},p:function(t,e,n,r,a){var i=At();try{return at(t)(e,n,r,a)}catch(t){if(St(i),t!==t+0)throw t;Ot(1,0)}},M:function(t,e,n,r,a,i){var o=At();try{return at(t)(e,n,r,a,i)}catch(t){if(St(o),t!==t+0)throw t;Ot(1,0)}},r:function(t,e,n,r,a,i){var o=At();try{return at(t)(e,n,r,a,i)}catch(t){if(St(o),t!==t+0)throw t;Ot(1,0)}},v:function(t,e,n,r,a,i,o){var u=At();try{return at(t)(e,n,r,a,i,o)}catch(t){if(St(u),t!==t+0)throw t;Ot(1,0)}},K:function(t,e,n,r,a,i,o,u){var c=At();try{return at(t)(e,n,r,a,i,o,u)}catch(t){if(St(c),t!==t+0)throw t;Ot(1,0)}},D:function(t,e,n,r,a,i,o,u,c,s,l,f){var p=At();try{return at(t)(e,n,r,a,i,o,u,c,s,l,f)}catch(t){if(St(p),t!==t+0)throw t;Ot(1,0)}},X:function(t,e,n,r,a,i,o,u){var c=At();try{return Ft(t,e,n,r,a,i,o,u)}catch(t){if(St(c),t!==t+0)throw t;Ot(1,0)}},V:function(t,e,n,r,a,i,o){var u=At();try{return xt(t,e,n,r,a,i,o)}catch(t){if(St(u),t!==t+0)throw t;Ot(1,0)}},U:function(t,e,n,r,a){var i=At();try{return It(t,e,n,r,a)}catch(t){if(St(i),t!==t+0)throw t;Ot(1,0)}},Z:function(t,e,n,r){var a=At();try{return Pt(t,e,n,r)}catch(t){if(St(a),t!==t+0)throw t;Ot(1,0)}},W:function(t){var e=At();try{return Ct(t)}catch(t){if(St(e),t!==t+0)throw t;Ot(1,0)}},Y:function(t,e){var n=At();try{return Ut(t,e)}catch(t){if(St(n),t!==t+0)throw t;Ot(1,0)}},T:function(t,e,n){var r=At();try{return Rt(t,e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},f:function(t){var e=At();try{at(t)()}catch(t){if(St(e),t!==t+0)throw t;Ot(1,0)}},q:function(t,e){var n=At();try{at(t)(e)}catch(t){if(St(n),t!==t+0)throw t;Ot(1,0)}},h:function(t,e,n){var r=At();try{at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},da:function(t,e,n,r){var a=At();try{at(t)(e,n,r)}catch(t){if(St(a),t!==t+0)throw t;Ot(1,0)}},l:function(t,e,n,r){var a=At();try{at(t)(e,n,r)}catch(t){if(St(a),t!==t+0)throw t;Ot(1,0)}},t:function(t,e,n,r,a){var i=At();try{at(t)(e,n,r,a)}catch(t){if(St(i),t!==t+0)throw t;Ot(1,0)}},u:function(t,e,n,r,a,i){var o=At();try{at(t)(e,n,r,a,i)}catch(t){if(St(o),t!==t+0)throw t;Ot(1,0)}},x:function(t,e,n,r,a,i,o){var u=At();try{at(t)(e,n,r,a,i,o)}catch(t){if(St(u),t!==t+0)throw t;Ot(1,0)}},z:function(t,e,n,r,a,i,o,u){var c=At();try{at(t)(e,n,r,a,i,o,u)}catch(t){if(St(c),t!==t+0)throw t;Ot(1,0)}},ga:function(t,e,n,r,a,i,o,u,c){var s=At();try{at(t)(e,n,r,a,i,o,u,c)}catch(t){if(St(s),t!==t+0)throw t;Ot(1,0)}},A:function(t,e,n,r,a,i,o,u,c,s,l){var f=At();try{at(t)(e,n,r,a,i,o,u,c,s,l)}catch(t){if(St(f),t!==t+0)throw t;Ot(1,0)}},C:function(t,e,n,r,a,i,o,u,c,s,l,f,p,h,d,y){var b=At();try{at(t)(e,n,r,a,i,o,u,c,s,l,f,p,h,d,y)}catch(t){if(St(b),t!==t+0)throw t;Ot(1,0)}},aa:function(t,e,n,r,a,i,o,u){var c=At();try{jt(t,e,n,r,a,i,o,u)}catch(t){if(St(c),t!==t+0)throw t;Ot(1,0)}},_:function(t,e,n,r,a,i,o,u,c,s,l,f){var p=At();try{Dt(t,e,n,r,a,i,o,u,c,s,l,f)}catch(t){if(St(p),t!==t+0)throw t;Ot(1,0)}},$:function(t,e,n,r,a,i){var o=At();try{kt(t,e,n,r,a,i)}catch(t){if(St(o),t!==t+0)throw t;Ot(1,0)}},n:function(t){return t},F:function(t){ft=t},ha:yt,y:function(t,e,n,r){return yt(t,e,n,r)}};!function(){function t(t){e.asm=t.exports,O=e.asm.Ka,P(),U=e.asm.ib,I.unshift(e.asm.La),B--,e.monitorRunDependencies&&e.monitorRunDependencies(B),0==B&&(null!==G&&(clearInterval(G),G=null),N&&(t=N,N=null,t()))}function n(e){t(e.instance)}function r(t){return function(){if(!g&&(d||y)){if("function"==typeof fetch&&!Y.startsWith("file://"))return fetch(Y,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at \'"+Y+"\'";return t.arrayBuffer()})).catch((function(){return X()}));if(o)return new Promise((function(t,e){o(Y,(function(e){t(new Uint8Array(e))}),e)}))}return Promise.resolve().then((function(){return X()}))}().then((function(t){return WebAssembly.instantiate(t,i)})).then((function(t){return t})).then(t,(function(t){w("failed to asynchronously prepare wasm: "+t),V(t)}))}var i={a:bt};if(B++,e.monitorRunDependencies&&e.monitorRunDependencies(B),e.instantiateWasm)try{return e.instantiateWasm(i,t)}catch(t){return w("Module.instantiateWasm callback failed with error: "+t),!1}(g||"function"!=typeof WebAssembly.instantiateStreaming||$()||Y.startsWith("file://")||b||"function"!=typeof fetch?r(n):fetch(Y,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,i).then(n,(function(t){return w("wasm streaming compile failed: "+t),w("falling back to ArrayBuffer instantiation"),r(n)}))}))).catch(a)}(),e.___wasm_call_ctors=function(){return(e.___wasm_call_ctors=e.asm.La).apply(null,arguments)},e._OrtInit=function(){return(e._OrtInit=e.asm.Ma).apply(null,arguments)},e._OrtCreateSessionOptions=function(){return(e._OrtCreateSessionOptions=e.asm.Na).apply(null,arguments)},e._OrtAppendExecutionProvider=function(){return(e._OrtAppendExecutionProvider=e.asm.Oa).apply(null,arguments)},e._OrtAddSessionConfigEntry=function(){return(e._OrtAddSessionConfigEntry=e.asm.Pa).apply(null,arguments)},e._OrtReleaseSessionOptions=function(){return(e._OrtReleaseSessionOptions=e.asm.Qa).apply(null,arguments)},e._OrtCreateSession=function(){return(e._OrtCreateSession=e.asm.Ra).apply(null,arguments)},e._OrtReleaseSession=function(){return(e._OrtReleaseSession=e.asm.Sa).apply(null,arguments)},e._OrtGetInputCount=function(){return(e._OrtGetInputCount=e.asm.Ta).apply(null,arguments)},e._OrtGetOutputCount=function(){return(e._OrtGetOutputCount=e.asm.Ua).apply(null,arguments)},e._OrtGetInputName=function(){return(e._OrtGetInputName=e.asm.Va).apply(null,arguments)},e._OrtGetOutputName=function(){return(e._OrtGetOutputName=e.asm.Wa).apply(null,arguments)},e._OrtFree=function(){return(e._OrtFree=e.asm.Xa).apply(null,arguments)},e._OrtCreateTensor=function(){return(e._OrtCreateTensor=e.asm.Ya).apply(null,arguments)},e._OrtGetTensorData=function(){return(e._OrtGetTensorData=e.asm.Za).apply(null,arguments)},e._OrtReleaseTensor=function(){return(e._OrtReleaseTensor=e.asm._a).apply(null,arguments)},e._OrtCreateRunOptions=function(){return(e._OrtCreateRunOptions=e.asm.$a).apply(null,arguments)},e._OrtAddRunConfigEntry=function(){return(e._OrtAddRunConfigEntry=e.asm.ab).apply(null,arguments)},e._OrtReleaseRunOptions=function(){return(e._OrtReleaseRunOptions=e.asm.bb).apply(null,arguments)},e._OrtRun=function(){return(e._OrtRun=e.asm.cb).apply(null,arguments)},e._OrtEndProfiling=function(){return(e._OrtEndProfiling=e.asm.db).apply(null,arguments)};var mt,gt=e._malloc=function(){return(gt=e._malloc=e.asm.eb).apply(null,arguments)},vt=e._free=function(){return(vt=e._free=e.asm.fb).apply(null,arguments)},wt=e._fflush=function(){return(wt=e._fflush=e.asm.gb).apply(null,arguments)},_t=e.___funcs_on_exit=function(){return(_t=e.___funcs_on_exit=e.asm.hb).apply(null,arguments)},Ot=e._setThrew=function(){return(Ot=e._setThrew=e.asm.jb).apply(null,arguments)},At=e.stackSave=function(){return(At=e.stackSave=e.asm.kb).apply(null,arguments)},St=e.stackRestore=function(){return(St=e.stackRestore=e.asm.lb).apply(null,arguments)},Tt=e.stackAlloc=function(){return(Tt=e.stackAlloc=e.asm.mb).apply(null,arguments)},Et=e.___cxa_can_catch=function(){return(Et=e.___cxa_can_catch=e.asm.nb).apply(null,arguments)},Mt=e.___cxa_is_pointer_type=function(){return(Mt=e.___cxa_is_pointer_type=e.asm.ob).apply(null,arguments)},Ct=e.dynCall_j=function(){return(Ct=e.dynCall_j=e.asm.pb).apply(null,arguments)},xt=e.dynCall_iiiiij=function(){return(xt=e.dynCall_iiiiij=e.asm.qb).apply(null,arguments)},Rt=e.dynCall_jii=function(){return(Rt=e.dynCall_jii=e.asm.rb).apply(null,arguments)},jt=e.dynCall_viiiiij=function(){return(jt=e.dynCall_viiiiij=e.asm.sb).apply(null,arguments)},kt=e.dynCall_vjji=function(){return(kt=e.dynCall_vjji=e.asm.tb).apply(null,arguments)},Dt=e.dynCall_viiijjjii=function(){return(Dt=e.dynCall_viiijjjii=e.asm.ub).apply(null,arguments)},Pt=e.dynCall_iij=function(){return(Pt=e.dynCall_iij=e.asm.vb).apply(null,arguments)},Ut=e.dynCall_ji=function(){return(Ut=e.dynCall_ji=e.asm.wb).apply(null,arguments)},Ft=e.dynCall_iiiiiij=function(){return(Ft=e.dynCall_iiiiiij=e.asm.xb).apply(null,arguments)},It=e.dynCall_iiij=function(){return(It=e.dynCall_iiij=e.asm.yb).apply(null,arguments)};function Wt(){function t(){if(!mt&&(mt=!0,e.calledRun=!0,!C)){if(Z(I),r(e),e.onRuntimeInitialized&&e.onRuntimeInitialized(),e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;){var t=e.postRun.shift();H.unshift(t)}Z(H)}}if(!(0{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.iterateExtraOptions=void 0,e.iterateExtraOptions=(t,n,r,a)=>{if("object"==typeof t&&null!==t){if(r.has(t))throw new Error("Circular reference in options");r.add(t)}Object.entries(t).forEach((([t,i])=>{const o=n?n+t:t;if("object"==typeof i)(0,e.iterateExtraOptions)(i,o+".",r,a);else if("string"==typeof i||"number"==typeof i)a(o,i.toString());else{if("boolean"!=typeof i)throw new Error("Can\'t handle extra config type: "+typeof i);a(o,i?"1":"0")}}))}},586:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setRunOptions=void 0;const r=n(967),a=n(983),i=n(361);e.setRunOptions=t=>{const e=(0,i.getInstance)();let n=0;const o=[],u=t||{};try{if(void 0===(null==t?void 0:t.logSeverityLevel))u.logSeverityLevel=2;else if("number"!=typeof t.logSeverityLevel||!Number.isInteger(t.logSeverityLevel)||t.logSeverityLevel<0||t.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${t.logSeverityLevel}`);if(void 0===(null==t?void 0:t.logVerbosityLevel))u.logVerbosityLevel=0;else if("number"!=typeof t.logVerbosityLevel||!Number.isInteger(t.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${t.logVerbosityLevel}`);void 0===(null==t?void 0:t.terminate)&&(u.terminate=!1);let i=0;if(void 0!==(null==t?void 0:t.tag)&&(i=(0,a.allocWasmString)(t.tag,o)),n=e._OrtCreateRunOptions(u.logSeverityLevel,u.logVerbosityLevel,!!u.terminate,i),0===n)throw new Error("Can\'t create run options");return void 0!==(null==t?void 0:t.extra)&&(0,r.iterateExtraOptions)(t.extra,"",new WeakSet,((t,r)=>{const i=(0,a.allocWasmString)(t,o),u=(0,a.allocWasmString)(r,o);if(0!==e._OrtAddRunConfigEntry(n,i,u))throw new Error(`Can\'t set a run config entry: ${t} - ${r}`)})),[n,o]}catch(t){throw 0!==n&&e._OrtReleaseRunOptions(n),o.forEach(e._free),t}}},919:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setSessionOptions=void 0;const r=n(967),a=n(983),i=n(361);e.setSessionOptions=t=>{const e=(0,i.getInstance)();let n=0;const o=[],u=t||{};(t=>{t.extra||(t.extra={}),t.extra.session||(t.extra.session={});const e=t.extra.session;e.use_ort_model_bytes_directly||(e.use_ort_model_bytes_directly="1")})(u);try{void 0===(null==t?void 0:t.graphOptimizationLevel)&&(u.graphOptimizationLevel="all");const c=(t=>{switch(t){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${t}`)}})(u.graphOptimizationLevel);void 0===(null==t?void 0:t.enableCpuMemArena)&&(u.enableCpuMemArena=!0),void 0===(null==t?void 0:t.enableMemPattern)&&(u.enableMemPattern=!0),void 0===(null==t?void 0:t.executionMode)&&(u.executionMode="sequential");const s=(t=>{switch(t){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${t}`)}})(u.executionMode);let l=0;if(void 0!==(null==t?void 0:t.logId)&&(l=(0,a.allocWasmString)(t.logId,o)),void 0===(null==t?void 0:t.logSeverityLevel))u.logSeverityLevel=2;else if("number"!=typeof t.logSeverityLevel||!Number.isInteger(t.logSeverityLevel)||t.logSeverityLevel<0||t.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${t.logSeverityLevel}`);if(void 0===(null==t?void 0:t.logVerbosityLevel))u.logVerbosityLevel=0;else if("number"!=typeof t.logVerbosityLevel||!Number.isInteger(t.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${t.logVerbosityLevel}`);if(void 0===(null==t?void 0:t.enableProfiling)&&(u.enableProfiling=!1),n=e._OrtCreateSessionOptions(c,!!u.enableCpuMemArena,!!u.enableMemPattern,s,!!u.enableProfiling,0,l,u.logSeverityLevel,u.logVerbosityLevel),0===n)throw new Error("Can\'t create session options");return(null==t?void 0:t.executionProviders)&&((t,e,n)=>{for(const r of e){let e="string"==typeof r?r:r.name;switch(e){case"xnnpack":e="XNNPACK";break;case"wasm":case"cpu":continue;default:throw new Error(`not supported EP: ${e}`)}const o=(0,a.allocWasmString)(e,n);if(0!==(0,i.getInstance)()._OrtAppendExecutionProvider(t,o))throw new Error(`Can\'t append execution provider: ${e}`)}})(n,t.executionProviders,o),void 0!==(null==t?void 0:t.extra)&&(0,r.iterateExtraOptions)(t.extra,"",new WeakSet,((t,r)=>{const i=(0,a.allocWasmString)(t,o),u=(0,a.allocWasmString)(r,o);if(0!==e._OrtAddSessionConfigEntry(n,i,u))throw new Error(`Can\'t set a session config entry: ${t} - ${r}`)})),[n,o]}catch(t){throw 0!==n&&e._OrtReleaseSessionOptions(n),o.forEach(e._free),t}}},983:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.allocWasmString=void 0;const r=n(361);e.allocWasmString=(t,e)=>{const n=(0,r.getInstance)(),a=n.lengthBytesUTF8(t)+1,i=n._malloc(a);return n.stringToUTF8(t,i,a),e.push(i),i}},349:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.extractTransferableBuffers=e.endProfiling=e.run=e.releaseSession=e.createSession=e.createSessionFinalize=e.createSessionAllocate=e.initOrt=void 0;const r=n(586),a=n(919),i=n(983),o=n(361);e.initOrt=(t,e)=>{const n=(0,o.getInstance)()._OrtInit(t,e);if(0!==n)throw new Error(`Can\'t initialize onnxruntime. error code = ${n}`)};const u=new Map;e.createSessionAllocate=t=>{const e=(0,o.getInstance)(),n=e._malloc(t.byteLength);return e.HEAPU8.set(t,n),[n,t.byteLength]},e.createSessionFinalize=(t,e)=>{const n=(0,o.getInstance)();let r=0,i=0,c=[];try{if([i,c]=(0,a.setSessionOptions)(e),r=n._OrtCreateSession(t[0],t[1],i),0===r)throw new Error("Can\'t create a session")}finally{n._free(t[0]),n._OrtReleaseSessionOptions(i),c.forEach(n._free)}const s=n._OrtGetInputCount(r),l=n._OrtGetOutputCount(r),f=[],p=[],h=[],d=[];for(let t=0;t{const r=(0,e.createSessionAllocate)(t);return(0,e.createSessionFinalize)(r,n)},e.releaseSession=t=>{const e=(0,o.getInstance)(),n=u.get(t);if(!n)throw new Error("invalid session id");const r=n[0],a=n[1],i=n[2];a.forEach(e._OrtFree),i.forEach(e._OrtFree),e._OrtReleaseSession(r),u.delete(t)};const c=t=>{switch(t){case"int8":return 3;case"uint8":return 2;case"bool":return 9;case"int16":return 5;case"uint16":return 4;case"int32":return 6;case"uint32":return 12;case"float32":return 1;case"float64":return 11;case"string":return 8;case"int64":return 7;case"uint64":return 13;default:throw new Error(`unsupported data type: ${t}`)}},s=t=>{switch(t){case 3:return"int8";case 2:return"uint8";case 9:return"bool";case 5:return"int16";case 4:return"uint16";case 6:return"int32";case 12:return"uint32";case 1:return"float32";case 11:return"float64";case 8:return"string";case 7:return"int64";case 13:return"uint64";default:throw new Error(`unsupported data type: ${t}`)}},l=t=>{switch(t){case"float32":return Float32Array;case"uint8":case"bool":return Uint8Array;case"int8":return Int8Array;case"uint16":return Uint16Array;case"int16":return Int16Array;case"int32":return Int32Array;case"float64":return Float64Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"uint64":return BigUint64Array;default:throw new Error(`unsupported type: ${t}`)}};e.run=(t,e,n,a,f)=>{const p=(0,o.getInstance)(),h=u.get(t);if(!h)throw new Error("invalid session id");const d=h[0],y=h[1],b=h[2],m=e.length,g=a.length;let v=0,w=[];const _=[],O=[];try{[v,w]=(0,r.setRunOptions)(f);for(let t=0;tp.HEAP32[t++]=e));const n=p._OrtCreateTensor(c(e),o,u,l,r.length);if(0===n)throw new Error("Can\'t create a tensor");_.push(n)}finally{p.stackRestore(s)}}const t=p.stackSave(),o=p.stackAlloc(4*m),u=p.stackAlloc(4*m),h=p.stackAlloc(4*g),A=p.stackAlloc(4*g);try{let n=o/4,r=u/4,i=h/4,c=A/4;for(let t=0;tt*e));if(a=s(o),"string"===a){const t=[];let e=i/4;for(let n=0;n{const e=(0,o.getInstance)(),n=u.get(t);if(!n)throw new Error("invalid session id");const r=n[0],a=e._OrtEndProfiling(r);if(0===a)throw new Error("Can\'t get an profile file name");e._OrtFree(a)},e.extractTransferableBuffers=t=>{const e=[];for(const n of t){const t=n[2];!Array.isArray(t)&&t.buffer&&e.push(t.buffer)}return e}},361:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var a=Object.getOwnPropertyDescriptor(e,n);a&&!("get"in a?!e.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,a)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),a=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return a(e,t),e},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.dispose=e.getInstance=e.initializeWebAssembly=void 0;const u=i(n(449)),c=o(n(932)),s=n(474);let l,f=!1,p=!1,h=!1;const d=(t,e)=>e?t?"ort-wasm-simd-threaded.wasm":"ort-wasm-threaded.wasm":t?"ort-wasm-simd.wasm":"ort-wasm.wasm";e.initializeWebAssembly=async t=>{if(f)return Promise.resolve();if(p)throw new Error("multiple calls to \'initializeWebAssembly()\' detected.");if(h)throw new Error("previous call to \'initializeWebAssembly()\' failed.");p=!0;const e=t.initTimeout,r=t.numThreads,a=t.simd,i=r>1&&(()=>{try{return"undefined"!=typeof SharedArrayBuffer&&("undefined"!=typeof MessageChannel&&(new MessageChannel).port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])))}catch(t){return!1}})(),o=a&&(()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,30,1,28,0,65,0,253,15,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,186,1,26,11]))}catch(t){return!1}})(),y="string"==typeof t.wasmPaths?t.wasmPaths:void 0,b=d(!1,i),m=d(o,i),g="object"==typeof t.wasmPaths?t.wasmPaths[m]:void 0;let v=!1;const w=[];if(e>0&&w.push(new Promise((t=>{setTimeout((()=>{v=!0,t()}),e)}))),w.push(new Promise(((t,e)=>{const r=i?s:c.default,a={locateFile:(t,e)=>i&&t.endsWith(".worker.js")&&"undefined"!=typeof Blob?URL.createObjectURL(new Blob([n(154)],{type:"text/javascript"})):t===b?null!=g?g:(null!=y?y:e)+m:e+t};if(i)if("undefined"==typeof Blob)a.mainScriptUrlOrBlob=u.join("/","ort-wasm-threaded.js");else{const t=`var ortWasmThreaded=(function(){var _scriptDir;return ${r.toString()}})();`;a.mainScriptUrlOrBlob=new Blob([t],{type:"text/javascript"})}r(a).then((e=>{p=!1,f=!0,l=e,t()}),(t=>{p=!1,h=!0,e(t)}))}))),await Promise.race(w),v)throw new Error(`WebAssembly backend initializing failed due to timeout: ${e}ms`)},e.getInstance=()=>{if(f&&l)return l;throw new Error("WebAssembly is not initialized yet.")},e.dispose=()=>{var t;!f||p||h||(p=!0,null===(t=l.PThread)||void 0===t||t.terminateAllThreads(),l=void 0,p=!1,f=!1,h=!0)}},154:t=>{"use strict";t.exports=\'"use strict";var e={},t="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node;if(t){var r=require("worker_threads"),a=r.parentPort;a.on("message",(e=>onmessage({data:e})));var o=require("fs");Object.assign(global,{self:global,require:require,Module:e,location:{href:__filename},Worker:r.Worker,importScripts:function(e){(0,eval)(o.readFileSync(e,"utf8"))},postMessage:function(e){a.postMessage(e)},performance:global.performance||{now:function(){return Date.now()}}})}var s=!1,n=[],i=function(){var e=Array.prototype.slice.call(arguments).join(" ");t?o.writeSync(2,e+"\\\\n"):console.error(e)};self.alert=function(){var t=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:t,threadId:e._pthread_self()})},e.instantiateWasm=(t,r)=>{var a=new WebAssembly.Instance(e.wasmModule,t);return r(a),e.wasmModule=null,a.exports},self.onunhandledrejection=e=>{throw e.reason??e},self.onmessage=t=>{try{if("load"===t.data.cmd){if(e.wasmModule=t.data.wasmModule,e.wasmMemory=t.data.wasmMemory,e.buffer=e.wasmMemory.buffer,e.ENVIRONMENT_IS_PTHREAD=!0,"string"==typeof t.data.urlOrBlob)importScripts(t.data.urlOrBlob);else{var r=URL.createObjectURL(t.data.urlOrBlob);importScripts(r),URL.revokeObjectURL(r)}ortWasmThreaded(e).then((function(t){e=t}))}else if("run"===t.data.cmd){e.__performance_now_clock_drift=performance.now()-t.data.time,e.__emscripten_thread_init(t.data.pthread_ptr,0,0,1),e.establishStackSpace(),e.PThread.receiveObjectTransfer(t.data),e.PThread.threadInitTLS(),s||(n.forEach((t=>{e.executeNotifiedProxyingQueue(t)})),n=[],s=!0);try{e.invokeEntryPoint(t.data.start_routine,t.data.arg)}catch(t){if("unwind"!=t){if(!(t instanceof e.ExitStatus))throw t;e.keepRuntimeAlive()||e.__emscripten_thread_exit(t.status)}}}else"cancel"===t.data.cmd?e._pthread_self()&&e.__emscripten_thread_exit(-1):"setimmediate"===t.data.target||("processProxyingQueue"===t.data.cmd?s?e.executeNotifiedProxyingQueue(t.data.queue):n.push(t.data.queue):(i("worker.js received unknown command "+t.data.cmd),i(t.data)))}catch(t){throw i("worker.js onmessage() captured an uncaught exception: "+t),t&&t.stack&&i(t.stack),e.__emscripten_thread_crashed&&e.__emscripten_thread_crashed(),t}};\\n\'},384:()=>{},993:()=>{},908:()=>{},953:()=>{},925:()=>{},449:()=>{}},e={};function n(r){var a=e[r];if(void 0!==a)return a.exports;var i=e[r]={exports:{}};return t[r].call(i.exports,i,i.exports,n),i.exports}n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),(()=>{"use strict";const t=n(349),e=n(361);self.onmessage=n=>{switch(n.data.type){case"init-wasm":(0,e.initializeWebAssembly)(n.data.in).then((()=>postMessage({type:"init-wasm"})),(t=>postMessage({type:"init-wasm",err:t})));break;case"init-ort":try{const{numThreads:e,loggingLevel:r}=n.data.in;(0,t.initOrt)(e,r),postMessage({type:"init-ort"})}catch(t){postMessage({type:"init-ort",err:t})}break;case"create_allocate":try{const{model:e}=n.data.in,r=(0,t.createSessionAllocate)(e);postMessage({type:"create_allocate",out:r})}catch(t){postMessage({type:"create_allocate",err:t})}break;case"create_finalize":try{const{modeldata:e,options:r}=n.data.in,a=(0,t.createSessionFinalize)(e,r);postMessage({type:"create_finalize",out:a})}catch(t){postMessage({type:"create_finalize",err:t})}break;case"create":try{const{model:e,options:r}=n.data.in,a=(0,t.createSession)(e,r);postMessage({type:"create",out:a})}catch(t){postMessage({type:"create",err:t})}break;case"release":try{const e=n.data.in;(0,t.releaseSession)(e),postMessage({type:"release"})}catch(t){postMessage({type:"release",err:t})}break;case"run":try{const{sessionId:e,inputIndices:r,inputs:a,outputIndices:i,options:o}=n.data.in,u=(0,t.run)(e,r,a,i,o);postMessage({type:"run",out:u},(0,t.extractTransferableBuffers)(u))}catch(t){postMessage({type:"run",err:t})}break;case"end-profiling":try{const e=n.data.in;(0,t.endProfiling)(e),postMessage({type:"end-profiling"})}catch(t){postMessage({type:"end-profiling",err:t})}}}})()})();\n',"Worker",void 0,void 0)}},477:x=>{x.exports=function(c,_,T,C){var M=self||window;try{try{var E;try{E=new M.Blob([c])}catch{(E=new(M.BlobBuilder||M.WebKitBlobBuilder||M.MozBlobBuilder||M.MSBlobBuilder)).append(c),E=E.getBlob()}var P=M.URL||M.webkitURL,R=P.createObjectURL(E),$=new M[_](R,T);return P.revokeObjectURL(R),$}catch{return new M[_]("data:application/javascript,".concat(encodeURIComponent(c)),T)}}catch{if(!C)throw Error("Inline worker is not supported");return new M[_](C,T)}}},4154:x=>{x.exports=`"use strict";var e={},t="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node;if(t){var r=require("worker_threads"),a=r.parentPort;a.on("message",(e=>onmessage({data:e})));var o=require("fs");Object.assign(global,{self:global,require:require,Module:e,location:{href:__filename},Worker:r.Worker,importScripts:function(e){(0,eval)(o.readFileSync(e,"utf8"))},postMessage:function(e){a.postMessage(e)},performance:global.performance||{now:function(){return Date.now()}}})}var s=!1,n=[],i=function(){var e=Array.prototype.slice.call(arguments).join(" ");t?o.writeSync(2,e+"\\n"):console.error(e)};self.alert=function(){var t=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:t,threadId:e._pthread_self()})},e.instantiateWasm=(t,r)=>{var a=new WebAssembly.Instance(e.wasmModule,t);return r(a),e.wasmModule=null,a.exports},self.onunhandledrejection=e=>{throw e.reason??e},self.onmessage=t=>{try{if("load"===t.data.cmd){if(e.wasmModule=t.data.wasmModule,e.wasmMemory=t.data.wasmMemory,e.buffer=e.wasmMemory.buffer,e.ENVIRONMENT_IS_PTHREAD=!0,"string"==typeof t.data.urlOrBlob)importScripts(t.data.urlOrBlob);else{var r=URL.createObjectURL(t.data.urlOrBlob);importScripts(r),URL.revokeObjectURL(r)}ortWasmThreaded(e).then((function(t){e=t}))}else if("run"===t.data.cmd){e.__performance_now_clock_drift=performance.now()-t.data.time,e.__emscripten_thread_init(t.data.pthread_ptr,0,0,1),e.establishStackSpace(),e.PThread.receiveObjectTransfer(t.data),e.PThread.threadInitTLS(),s||(n.forEach((t=>{e.executeNotifiedProxyingQueue(t)})),n=[],s=!0);try{e.invokeEntryPoint(t.data.start_routine,t.data.arg)}catch(t){if("unwind"!=t){if(!(t instanceof e.ExitStatus))throw t;e.keepRuntimeAlive()||e.__emscripten_thread_exit(t.status)}}}else"cancel"===t.data.cmd?e._pthread_self()&&e.__emscripten_thread_exit(-1):"setimmediate"===t.data.target||("processProxyingQueue"===t.data.cmd?s?e.executeNotifiedProxyingQueue(t.data.queue):n.push(t.data.queue):(i("worker.js received unknown command "+t.data.cmd),i(t.data)))}catch(t){throw i("worker.js onmessage() captured an uncaught exception: "+t),t&&t.stack&&i(t.stack),e.__emscripten_thread_crashed&&e.__emscripten_thread_crashed(),t}}; `},1670:x=>{x.exports=__WEBPACK_EXTERNAL_MODULE__1670__},7067:()=>{},1296:()=>{},1384:()=>{},3993:()=>{},908:()=>{},6953:()=>{},9925:()=>{},2806:()=>{},6449:()=>{},2850:()=>{},5381:()=>{},5686:(x,c,_)=>{_.r(c),_.d(c,{flatbuffers:()=>T});var T={};T.Offset,T.Table,T.SIZEOF_SHORT=2,T.SIZEOF_INT=4,T.FILE_IDENTIFIER_LENGTH=4,T.SIZE_PREFIX_LENGTH=4,T.Encoding={UTF8_BYTES:1,UTF16_STRING:2},T.int32=new Int32Array(2),T.float32=new Float32Array(T.int32.buffer),T.float64=new Float64Array(T.int32.buffer),T.isLittleEndian=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1,T.Long=function(C,M){this.low=0|C,this.high=0|M},T.Long.create=function(C,M){return C==0&&M==0?T.Long.ZERO:new T.Long(C,M)},T.Long.prototype.toFloat64=function(){return(this.low>>>0)+4294967296*this.high},T.Long.prototype.equals=function(C){return this.low==C.low&&this.high==C.high},T.Long.ZERO=new T.Long(0,0),T.Builder=function(C){if(C)M=C;else var M=1024;this.bb=T.ByteBuffer.allocate(M),this.space=M,this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1},T.Builder.prototype.clear=function(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1},T.Builder.prototype.forceDefaults=function(C){this.force_defaults=C},T.Builder.prototype.dataBuffer=function(){return this.bb},T.Builder.prototype.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},T.Builder.prototype.prep=function(C,M){C>this.minalign&&(this.minalign=C);for(var E=1+~(this.bb.capacity()-this.space+M)&C-1;this.space=0&&this.vtable[M]==0;M--);for(var E=M+1;M>=0;M--)this.addInt16(this.vtable[M]!=0?C-this.vtable[M]:0);this.addInt16(C-this.object_start);var P=(E+2)*T.SIZEOF_SHORT;this.addInt16(P);var R=0,$=this.space;e:for(M=0;M=0;$--)this.writeInt8(R.charCodeAt($))}this.prep(this.minalign,T.SIZEOF_INT+P),this.addOffset(C),P&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)},T.Builder.prototype.finishSizePrefixed=function(C,M){this.finish(C,M,!0)},T.Builder.prototype.requiredField=function(C,M){var E=this.bb.capacity()-C,P=E-this.bb.readInt32(E);if(this.bb.readInt16(P+M)==0)throw new Error("FlatBuffers: field "+M+" must be set")},T.Builder.prototype.startVector=function(C,M,E){this.notNested(),this.vector_num_elems=M,this.prep(T.SIZEOF_INT,C*M),this.prep(E,C*M)},T.Builder.prototype.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},T.Builder.prototype.createString=function(C){if(C instanceof Uint8Array)var M=C;else{M=[];for(var E=0;E=56320?R:(R<<10)+C.charCodeAt(E++)+-56613888)<128?M.push(P):(P<2048?M.push(P>>6&31|192):(P<65536?M.push(P>>12&15|224):M.push(P>>18&7|240,P>>12&63|128),M.push(P>>6&63|128)),M.push(63&P|128))}}this.addInt8(0),this.startVector(1,M.length,1),this.bb.setPosition(this.space-=M.length),E=0;for(var $=this.space,G=this.bb.bytes();E>24},T.ByteBuffer.prototype.readUint8=function(C){return this.bytes_[C]},T.ByteBuffer.prototype.readInt16=function(C){return this.readUint16(C)<<16>>16},T.ByteBuffer.prototype.readUint16=function(C){return this.bytes_[C]|this.bytes_[C+1]<<8},T.ByteBuffer.prototype.readInt32=function(C){return this.bytes_[C]|this.bytes_[C+1]<<8|this.bytes_[C+2]<<16|this.bytes_[C+3]<<24},T.ByteBuffer.prototype.readUint32=function(C){return this.readInt32(C)>>>0},T.ByteBuffer.prototype.readInt64=function(C){return new T.Long(this.readInt32(C),this.readInt32(C+4))},T.ByteBuffer.prototype.readUint64=function(C){return new T.Long(this.readUint32(C),this.readUint32(C+4))},T.ByteBuffer.prototype.readFloat32=function(C){return T.int32[0]=this.readInt32(C),T.float32[0]},T.ByteBuffer.prototype.readFloat64=function(C){return T.int32[T.isLittleEndian?0:1]=this.readInt32(C),T.int32[T.isLittleEndian?1:0]=this.readInt32(C+4),T.float64[0]},T.ByteBuffer.prototype.writeInt8=function(C,M){this.bytes_[C]=M},T.ByteBuffer.prototype.writeUint8=function(C,M){this.bytes_[C]=M},T.ByteBuffer.prototype.writeInt16=function(C,M){this.bytes_[C]=M,this.bytes_[C+1]=M>>8},T.ByteBuffer.prototype.writeUint16=function(C,M){this.bytes_[C]=M,this.bytes_[C+1]=M>>8},T.ByteBuffer.prototype.writeInt32=function(C,M){this.bytes_[C]=M,this.bytes_[C+1]=M>>8,this.bytes_[C+2]=M>>16,this.bytes_[C+3]=M>>24},T.ByteBuffer.prototype.writeUint32=function(C,M){this.bytes_[C]=M,this.bytes_[C+1]=M>>8,this.bytes_[C+2]=M>>16,this.bytes_[C+3]=M>>24},T.ByteBuffer.prototype.writeInt64=function(C,M){this.writeInt32(C,M.low),this.writeInt32(C+4,M.high)},T.ByteBuffer.prototype.writeUint64=function(C,M){this.writeUint32(C,M.low),this.writeUint32(C+4,M.high)},T.ByteBuffer.prototype.writeFloat32=function(C,M){T.float32[0]=M,this.writeInt32(C,T.int32[0])},T.ByteBuffer.prototype.writeFloat64=function(C,M){T.float64[0]=M,this.writeInt32(C,T.int32[T.isLittleEndian?0:1]),this.writeInt32(C+4,T.int32[T.isLittleEndian?1:0])},T.ByteBuffer.prototype.getBufferIdentifier=function(){if(this.bytes_.length>10),56320+(1023&$)))}return P},T.ByteBuffer.prototype.__indirect=function(C){return C+this.readInt32(C)},T.ByteBuffer.prototype.__vector=function(C){return C+this.readInt32(C)+T.SIZEOF_INT},T.ByteBuffer.prototype.__vector_len=function(C){return this.readInt32(C+this.readInt32(C))},T.ByteBuffer.prototype.__has_identifier=function(C){if(C.length!=T.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+T.FILE_IDENTIFIER_LENGTH);for(var M=0;M{var c=x&&x.__esModule?()=>x.default:()=>x;return __webpack_require__.d(c,{a:c}),c},__webpack_require__.d=(x,c)=>{for(var _ in c)__webpack_require__.o(c,_)&&!__webpack_require__.o(x,_)&&Object.defineProperty(x,_,{enumerable:!0,get:c[_]})},__webpack_require__.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),__webpack_require__.o=(x,c)=>Object.prototype.hasOwnProperty.call(x,c),__webpack_require__.r=x=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(x,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(x,"__esModule",{value:!0})};var __webpack_exports__=__webpack_require__(6018);return __webpack_exports__})())})(ortWeb_min$1);const ortWeb_min=getDefaultExportFromCjs(ortWeb_minExports),ONNX_WEB=_mergeNamespaces({__proto__:null,default:ortWeb_min},[ortWeb_minExports]);let ONNX;const executionProviders=["wasm"];var Gr;typeof process<"u"&&((Gr=process==null?void 0:process.release)==null?void 0:Gr.name)==="node"?(ONNX=sharp??ONNX_NODE,executionProviders.unshift("cpu")):(ONNX=ortWeb_min??ONNX_WEB,typeof navigator<"u"&&/iP(hone|od|ad).+16_4.+AppleWebKit/.test(navigator.userAgent)&&(ONNX.env.wasm.simd=!1));const{env:onnx_env}=ONNX,VERSION="2.17.2",WEB_CACHE_AVAILABLE=typeof self<"u"&&"caches"in self,FS_AVAILABLE=!isEmpty(sharp),PATH_AVAILABLE=!isEmpty(sharp),RUNNING_LOCALLY=FS_AVAILABLE&&PATH_AVAILABLE,__dirname=RUNNING_LOCALLY?sharp.dirname(sharp.dirname(sharp.fileURLToPath(import.meta.url))):"./",DEFAULT_CACHE_DIR=RUNNING_LOCALLY?sharp.join(__dirname,"/.cache/"):null,DEFAULT_LOCAL_MODEL_PATH="/models/",localModelPath=RUNNING_LOCALLY?sharp.join(__dirname,DEFAULT_LOCAL_MODEL_PATH):DEFAULT_LOCAL_MODEL_PATH;onnx_env!=null&&onnx_env.wasm&&(onnx_env.wasm.wasmPaths=RUNNING_LOCALLY?sharp.join(__dirname,"/dist/"):`https://cdn.jsdelivr.net/npm/@xenova/transformers@${VERSION}/dist/`);const env$1={backends:{onnx:onnx_env,tfjs:{}},__dirname,version:VERSION,allowRemoteModels:!0,remoteHost:"https://huggingface.co/",remotePathTemplate:"{model}/resolve/{revision}/",allowLocalModels:!0,localModelPath,useFS:FS_AVAILABLE,useBrowserCache:WEB_CACHE_AVAILABLE,useFSCache:FS_AVAILABLE,cacheDir:DEFAULT_CACHE_DIR,useCustomCache:!1,customCache:null};function isEmpty(x){return Object.keys(x).length===0}class FileResponse{constructor(c){ke(this,"_CONTENT_TYPE_MAP",{txt:"text/plain",html:"text/html",css:"text/css",js:"text/javascript",json:"application/json",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif"});if(this.filePath=c,this.headers=new Headers,this.exists=sharp.existsSync(c),this.exists){this.status=200,this.statusText="OK";let _=sharp.statSync(c);this.headers.set("content-length",_.size.toString()),this.updateContentType();let T=this;this.body=new ReadableStream({start(C){T.arrayBuffer().then(M=>{C.enqueue(new Uint8Array(M)),C.close()})}})}else this.status=404,this.statusText="Not Found",this.body=null}updateContentType(){const c=this.filePath.toString().split(".").pop().toLowerCase();this.headers.set("content-type",this._CONTENT_TYPE_MAP[c]??"application/octet-stream")}clone(){let c=new FileResponse(this.filePath);return c.exists=this.exists,c.status=this.status,c.statusText=this.statusText,c.headers=new Headers(this.headers),c}async arrayBuffer(){return(await sharp.promises.readFile(this.filePath)).buffer}async blob(){const c=await sharp.promises.readFile(this.filePath);return new Blob([c],{type:this.headers.get("content-type")})}async text(){return await sharp.promises.readFile(this.filePath,"utf8")}async json(){return JSON.parse(await this.text())}}function isValidUrl(x,c=null,_=null){let T;try{T=new URL(x)}catch{return!1}return!(c&&!c.includes(T.protocol)||_&&!_.includes(T.hostname))}async function getFile(x){var c,_,T,C;if(env$1.useFS&&!isValidUrl(x,["http:","https:","blob:"]))return new FileResponse(x);if(typeof process<"u"&&((c=process==null?void 0:process.release)==null?void 0:c.name)==="node"){const M=!!((_=process.env)!=null&&_.TESTING_REMOTELY),E=env$1.version,P=new Headers;if(P.set("User-Agent",`transformers.js/${E}; is_ci/${M};`),isValidUrl(x,["http:","https:"],["huggingface.co","hf.co"])){const $=((T=process.env)==null?void 0:T.HF_TOKEN)??((C=process.env)==null?void 0:C.HF_ACCESS_TOKEN);$&&P.set("Authorization",`Bearer ${$}`)}return fetch(x,{headers:P})}else return fetch(x)}const ERROR_MAPPING={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"};function handleError(x,c,_){if(!_)return null;const T=ERROR_MAPPING[x]??`Error (${x}) occurred while trying to load file`;throw Error(`${T}: "${c}".`)}class FileCache{constructor(c){this.path=c}async match(c){let _=sharp.join(this.path,c),T=new FileResponse(_);if(T.exists)return T}async put(c,_){const T=Buffer.from(await _.arrayBuffer());let C=sharp.join(this.path,c);try{await sharp.promises.mkdir(sharp.dirname(C),{recursive:!0}),await sharp.promises.writeFile(C,T)}catch(M){console.warn("An error occurred while writing the file to cache:",M)}}}async function tryCache(x,...c){for(let _ of c)try{let T=await x.match(_);if(T)return T}catch{continue}}async function getModelFile(x,c,_=!0,T={}){if(!env$1.allowLocalModels&&T.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`).");dispatchCallback(T.progress_callback,{status:"initiate",name:x,file:c});let C;if(!C&&env$1.useBrowserCache){if(typeof caches>"u")throw Error("Browser cache is not available in this environment.");try{C=await caches.open("transformers-cache")}catch(Z){console.warn("An error occurred while opening the browser cache:",Z)}}if(!C&&env$1.useFSCache&&(C=new FileCache(T.cache_dir??env$1.cacheDir)),!C&&env$1.useCustomCache)throw Error("`env.useCustomCache=true`, but `env.customCache` is not defined.");const M=T.revision??"main";let E=pathJoin(x,c),P=pathJoin(env$1.localModelPath,E),R=pathJoin(env$1.remoteHost,env$1.remotePathTemplate.replaceAll("{model}",x).replaceAll("{revision}",encodeURIComponent(M)),c),$=M==="main"?E:pathJoin(x,M,c),G,O=C instanceof FileCache?$:R,L=!1,F;C&&(F=await tryCache(C,P,O));const V=F!==void 0;if(F===void 0){if(env$1.allowLocalModels)if(isValidUrl(E,["http:","https:"])){if(T.local_files_only)throw new Error(`\`local_files_only=true\`, but attempted to load a remote file from: ${E}.`)}else try{F=await getFile(P),G=P}catch(H){console.warn(`Unable to load from local path "${P}": "${H}"`)}if(F===void 0||F.status===404){if(T.local_files_only||!env$1.allowRemoteModels){if(_)throw Error(`\`local_files_only=true\` or \`env.allowRemoteModels=false\` and file was not found locally at "${P}".`);return null}if(F=await getFile(R),F.status!==200)return handleError(F.status,R,_);G=O}L=C&&typeof Response<"u"&&F instanceof Response&&F.status===200}dispatchCallback(T.progress_callback,{status:"download",name:x,file:c});const W={status:"progress",name:x,file:c};let z;return T.progress_callback?V&&typeof navigator<"u"&&/firefox/i.test(navigator.userAgent)?(z=new Uint8Array(await F.arrayBuffer()),dispatchCallback(T.progress_callback,{...W,progress:100,loaded:z.length,total:z.length})):z=await readResponse(F,Z=>{dispatchCallback(T.progress_callback,{...W,...Z})}):z=new Uint8Array(await F.arrayBuffer()),L&&G&&await C.match(G)===void 0&&await C.put(G,new Response(z,{headers:F.headers})).catch(Z=>{console.warn(`Unable to add response to browser cache: ${Z}.`)}),dispatchCallback(T.progress_callback,{status:"done",name:x,file:c}),z}async function getModelJSON(x,c,_=!0,T={}){let C=await getModelFile(x,c,_,T);if(C===null)return{};let E=new TextDecoder("utf-8").decode(C);return JSON.parse(E)}async function readResponse(x,c){const _=x.headers.get("Content-Length");_===null&&console.warn("Unable to determine content-length from response headers. Will expand buffer when needed.");let T=parseInt(_??"0"),C=new Uint8Array(T),M=0;const E=x.body.getReader();async function P(){const{done:R,value:$}=await E.read();if(R)return;let G=M+$.length;if(G>T){T=G;let L=new Uint8Array(T);L.set(C),C=L}C.set($,M),M=G;const O=M/T*100;return c({progress:O,loaded:M,total:T}),P()}return await P(),C}function pathJoin(...x){return x=x.map((c,_)=>(_&&(c=c.replace(new RegExp("^/"),"")),_!==x.length-1&&(c=c.replace(new RegExp("/$"),"")),c)),x.join("/")}function interpolate_data(x,[c,_,T],[C,M],E="bilinear",P=!1){const R=M/T,$=C/_,G=new x.constructor(C*M*c),O=_*T,L=C*M;for(let F=0;F=0;--P)C[P]=R,T[P]=c[_[P]],R*=T[P];const M=_.map((P,R)=>C[_.indexOf(R)]),E=new x.constructor(x.length);for(let P=0;P=0;--$)R+=G%c[$]*M[$],G=Math.floor(G/c[$]);E[R]=x[P]}return[E,T]}function softmax(x){const c=max(x)[0],_=x.map(M=>Math.exp(M-c)),T=_.reduce((M,E)=>M+E,0);return _.map(M=>M/T)}function log_softmax(x){return softmax(x).map(T=>Math.log(T))}function getTopItems(x,c=0){return x=Array.from(x).map((_,T)=>[T,_]).sort((_,T)=>T[1]-_[1]),c!==null&&c>0&&(x=x.slice(0,c)),x}function min(x){if(x.length===0)throw Error("Array must not be empty");let c=x[0],_=0;for(let T=1;Tc&&(c=x[T],_=T);return[Number(c),_]}function isPowerOfTwo(x){return x>0&&(x&x-1)===0}class P2FFT{constructor(c){if(this.size=c|0,this.size<=1||!isPowerOfTwo(this.size))throw new Error("FFT size must be a power of two larger than 1");this._csize=c<<1,this.table=new Float64Array(this.size*2);for(let T=0;TT;T<<=1)++_;this._width=_%2===0?_-1:_,this._bitrev=new Int32Array(1<>>C&3)<>>1);for(let C=0;C>>1]=c[C];return T}toComplexArray(c,_){const T=_||this.createComplexArray();for(let C=0;C>>1],T[C+1]=0;return T}transform(c,_){if(c===_)throw new Error("Input and output buffers must be different");this._transform4(c,_,1)}realTransform(c,_){if(c===_)throw new Error("Input and output buffers must be different");this._realTransform4(c,_,1)}inverseTransform(c,_){if(c===_)throw new Error("Input and output buffers must be different");this._transform4(c,_,-1);for(let T=0;T>=2;E>=2;E>>=2){P=C/E<<1;const L=P>>>2;for(R=0;R>>1,E>>>1)}else for(R=0,$=0;R>>1,E>>>1,T)}const O=this.table;for(E>>=2;E>=2;E>>=2){P=C/E<<1;const F=P>>>1,V=F>>>1,W=V>>>1;for(R=0;R>>1;for(let F=2;F>1;++G){const O=(G+1-c)**2/2,L=Math.sqrt(R**2+$**2)**O,F=O*Math.atan2($,R),V=2*G;M[V]=L*Math.cos(F),M[V+1]=L*Math.sin(F),E[V]=M[V],E[V+1]=-M[V+1]}this._slicedChirpBuffer=M.subarray(_,T),this._f=new P2FFT(C>>1),this._f.transform(this._chirpBuffer,E)}_transform(c,_,T){const C=this._buffer1,M=this._buffer2,E=this._outBuffer1,P=this._outBuffer2,R=this._chirpBuffer,$=this._slicedChirpBuffer,G=this._a;if(T)for(let O=0;O<$.length;O+=2){const L=O+1,F=O>>1,V=_[F];C[O]=V*$[O],C[L]=V*$[L]}else for(let O=0;O<$.length;O+=2){const L=O+1;C[O]=_[O]*$[O]-_[L]*$[L],C[L]=_[O]*$[L]+_[L]*$[O]}this._f.transform(E,C);for(let O=0;O=x.length&&(R=2*(x.length-1)-R),T[E++]=x[R]}T.sort(),_[M]=T[C]}return _}function round(x,c){const _=Math.pow(10,c);return Math.round(x*_)/_}function bankers_round(x){const c=Math.round(x);return Math.abs(x)%1===.5?c%2===0?c:c-1:c}const DataTypeMap=Object.freeze({float32:Float32Array,float64:Float64Array,string:Array,int8:Int8Array,uint8:Uint8Array,int16:Int16Array,uint16:Uint16Array,int32:Int32Array,uint32:Uint32Array,int64:BigInt64Array,uint64:BigUint64Array,bool:Uint8Array}),ONNXTensor$1=ONNX.Tensor;class Tensor{constructor(...c){ke(this,"dims");ke(this,"type");ke(this,"data");ke(this,"size");return c[0]instanceof ONNXTensor$1?Object.assign(this,c[0]):Object.assign(this,new ONNXTensor$1(c[0],c[1],c[2])),new Proxy(this,{get:(_,T)=>{if(typeof T=="string"){let C=Number(T);if(Number.isInteger(C))return _._getitem(C)}return _[T]},set:(_,T,C)=>_[T]=C})}*[Symbol.iterator](){const[c,..._]=this.dims;if(_.length>0){const T=_.reduce((C,M)=>C*M);for(let C=0;C0){const C=T.reduce((M,E)=>M*E);return this._subarray(c,C,T)}else return new Tensor(this.type,[this.data[c]],T)}indexOf(c){for(let _=0;_$[1])throw new Error(`Invalid slice: ${$}`);let G=[Math.max($[0],0),Math.min($[1],this.dims[R])];T.push(G),_.push(G[1]-G[0])}else throw new Error(`Invalid slice: ${$}`)}let C=T.map(([R,$])=>$-R),M=C.reduce((R,$)=>R*$),E=new this.data.constructor(M);const P=this.stride();for(let R=0;R=0;--G){const L=C[G];$+=(O%L+T[G][0])*P[G],O=Math.floor(O/L)}E[R]=this.data[$]}return new Tensor(this.type,E,_)}permute(...c){return permute(this,c)}transpose(...c){return this.permute(...c)}sum(c=null,_=!1){return this.norm(1,c,_)}norm(c="fro",_=null,T=!1){if(c==="fro")c=2;else if(typeof c=="string")throw Error(`Unsupported norm: ${c}`);if(_===null){let E=this.data.reduce((P,R)=>P+R**c,0)**(1/c);return new Tensor(this.type,[E],[])}_=safeIndex(_,this.dims.length);const C=this.dims.slice();C[_]=1;const M=new this.data.constructor(this.data.length/this.dims[_]);for(let E=0;E=0;--R){const O=this.dims[R];if(R!==_){const L=$%O;P+=L*G,G*=C[R]}$=Math.floor($/O)}M[P]+=this.data[E]**c}if(c!==1)for(let E=0;E=0;--E){const $=this.dims[E];if(E!==_){const G=P%$;M+=G*R,R*=this.dims[E]}P=Math.floor(P/$)}this.data[C]/=T.data[M]}return this}normalize(c=2,_=1){return this.clone().normalize_(c,_)}stride(){return dimsToStride(this.dims)}squeeze(c=null){return new Tensor(this.type,this.data,calc_squeeze_dims(this.dims,c))}squeeze_(c=null){return this.dims=calc_squeeze_dims(this.dims,c),this}unsqueeze(c=null){return new Tensor(this.type,this.data,calc_unsqueeze_dims(this.dims,c))}unsqueeze_(c=null){return this.dims=calc_unsqueeze_dims(this.dims,c),this}flatten_(c=0,_=-1){_=(_+this.dims.length)%this.dims.length;let T=this.dims.slice(0,c),C=this.dims.slice(c,_+1),M=this.dims.slice(_+1);return this.dims=[...T,C.reduce((E,P)=>E*P,1),...M],this}flatten(c=0,_=-1){return this.clone().flatten_(c,_)}view(...c){let _=-1;for(let T=0;TE!==_?C*M:C,1);c[_]=this.data.length/T}return new Tensor(this.type,this.data,c)}neg_(){for(let c=0;cM*E);if(_!==T)throw Error(`cannot reshape array of size ${_} into shape (${c})`);let C=x;for(let M=c.length-1;M>=0;M--)C=C.reduce((E,P)=>{let R=E[E.length-1];return R.length_!==1):typeof c=="number"?x[c]===1&&x.splice(c,1):Array.isArray(c)&&(x=x.filter((_,T)=>_!==1||!c.includes(T))),x}function calc_unsqueeze_dims(x,c){return c=safeIndex(c,x.length+1),x=x.slice(),x.splice(c,0,1),x}function safeIndex(x,c,_=null){if(x<-c||x>=c)throw new Error(`IndexError: index ${x} is out of bounds for dimension${_===null?"":" "+_} with size ${c}`);return x<0&&(x=(x%c+c)%c),x}function cat(x,c=0){c=safeIndex(c,x[0].dims.length);const _=x[0].dims.slice();_[c]=x.reduce((E,P)=>E+P.dims[c],0);const T=_.reduce((E,P)=>E*P,1),C=new x[0].data.constructor(T),M=x[0].type;if(c===0){let E=0;for(let P of x)C.set(P.data,E),E+=P.data.length}else{let E=0;for(let P=0;P=0;--O){const V=R.dims[O];let W=L%V;O===c&&(W+=E),G+=W*F,F*=_[O],L=Math.floor(L/V)}C[G]=R.data[$]}E+=R.dims[c]}}return new Tensor(M,C,_)}function stack(x,c=0){return cat(x.map(_=>_.unsqueeze(c)),c)}function std_mean(x,c=null,_=1,T=!1){if(c===null){const $=x.data.reduce((F,V)=>F+V,0)/x.data.length,G=Math.sqrt(x.data.reduce((F,V)=>F+(V-$)**2,0)/(x.data.length-_)),O=new Tensor(x.type,[$],[]);return[new Tensor(x.type,[G],[]),O]}c=safeIndex(c,x.dims.length);const C=mean(x,c,T),M=x.dims.slice();M[c]=1;const E=new x.data.constructor(x.data.length/x.dims[c]);for(let R=0;R=0;--G){const F=x.dims[G];if(G!==c){const V=O%F;$+=V*L,L*=M[G]}O=Math.floor(O/F)}E[$]+=(x.data[R]-C.data[$])**2}for(let R=0;RE+P,0);return new Tensor(x.type,[M/x.data.length],[])}c=safeIndex(c,x.dims.length);const T=x.dims.slice();T[c]=1;const C=new x.data.constructor(x.data.length/x.dims[c]);for(let M=0;M=0;--P){const G=x.dims[P];if(P!==c){const O=R%G;E+=O*$,$*=T[P]}R=Math.floor(R/G)}C[E]+=x.data[M]}if(x.dims[c]!==1)for(let M=0;M0||P>0;)switch(R.push(E-1),$.push(P-1),M[E][P].item()){case 0:--E,--P;break;case 1:--E;break;case 2:--P;break;default:throw new Error(`Internal error in dynamic time warping. Unexpected trace[${E}, ${P}]. Please file a bug report.`)}return R.reverse(),$.reverse(),[R,$]}function dimsToStride(x){const c=new Array(x.length);for(let _=x.length-1,T=1;_>=0;--_)c[_]=T,T*=x[_];return c}function ones(x){const c=x.reduce((_,T)=>_*T,1);return new Tensor("int64",new BigInt64Array(c).fill(1n),x)}function ones_like(x){return ones(x.dims)}function quantize_embeddings(x,c){if(x.dims.length!==2)throw new Error("The tensor must have 2 dimensions");if(x.dims.at(-1)%8!==0)throw new Error("The last dimension of the tensor must be a multiple of 8");if(!["binary","ubinary"].includes(c))throw new Error("The precision must be either 'binary' or 'ubinary'");const _=c==="binary",T=_?"int8":"uint8",C=_?Int8Array:Uint8Array,M=x.data,E=new C(M.length/8);for(let P=0;P0?1:0,$=Math.floor(P/8),G=P%8;E[$]|=R<<7-G,_&&G===0&&(E[$]-=128)}return new Tensor(T,E,[x.dims[0],x.dims[1]/8])}class PriorityQueue{constructor(c=(_,T)=>_>T){this._heap=[],this._comparator=c}get size(){return this._heap.length}isEmpty(){return this.size===0}peek(){return this._heap[0]}push(...c){return this.extend(c)}extend(c){for(const _ of c)this._heap.push(_),this._siftUp();return this.size}pop(){const c=this.peek(),_=this.size-1;return _>0&&this._swap(0,_),this._heap.pop(),this._siftDown(),c}replace(c){const _=this.peek();return this._heap[0]=c,this._siftDown(),_}_parent(c){return(c+1>>>1)-1}_left(c){return(c<<1)+1}_right(c){return c+1<<1}_greater(c,_){return this._comparator(this._heap[c],this._heap[_])}_swap(c,_){const T=this._heap[c];this._heap[c]=this._heap[_],this._heap[_]=T}_siftUp(){let c=this.size-1;for(;c>0&&this._greater(c,this._parent(c));)this._swap(c,this._parent(c)),c=this._parent(c)}_siftDown(){let c=0;for(;this._left(c)[]),this.endNodes=Array.from({length:this.len+1},()=>[]);const C=new TokenLatticeNode(this.bosTokenId,0,0,0,0),M=new TokenLatticeNode(this.eosTokenId,1,this.len,0,0);this.nodes.push(C.clone()),this.nodes.push(M.clone()),this.beginNodes[this.len].push(M),this.endNodes[0].push(C)}insert(c,_,T,C){const M=this.nodes.length,E=new TokenLatticeNode(C,M,c,_,T);this.beginNodes[c].push(E),this.endNodes[c+_].push(E),this.nodes.push(E)}viterbi(){const c=this.len;let _=0;for(;_<=c;){if(this.beginNodes[_].length==0)return[];for(let P of this.beginNodes[_]){P.prev=null;let R=0,$=null;for(let G of this.endNodes[_]){const O=G.backtraceScore+P.score;($===null||O>R)&&($=G.clone(),R=O)}if($!==null)P.prev=$,P.backtraceScore=R;else return[]}++_}const T=[],M=this.beginNodes[c][0].prev;if(M===null)return[];let E=M.clone();for(;E.prev!==null;)T.push(E.clone()),E=E.clone().prev.clone();return T.reverse(),T}piece(c){return this.sentence.slice(c.pos,c.pos+c.length)}tokens(){return this.viterbi().map(_=>this.piece(_))}tokenIds(){return this.viterbi().map(_=>_.tokenId)}}class TokenLatticeNode{constructor(c,_,T,C,M){this.tokenId=c,this.nodeId=_,this.pos=T,this.length=C,this.score=M,this.prev=null,this.backtraceScore=0}clone(){const c=new TokenLatticeNode(this.tokenId,this.nodeId,this.pos,this.length,this.score);return c.prev=this.prev,c.backtraceScore=this.backtraceScore,c}}var TOKEN_TYPES=Object.freeze({Text:"Text",NumericLiteral:"NumericLiteral",BooleanLiteral:"BooleanLiteral",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",Set:"Set",If:"If",For:"For",In:"In",Is:"Is",NotIn:"NotIn",Else:"Else",EndIf:"EndIf",ElseIf:"ElseIf",EndFor:"EndFor",And:"And",Or:"Or",Not:"UnaryOperator"}),KEYWORDS=Object.freeze({set:TOKEN_TYPES.Set,for:TOKEN_TYPES.For,in:TOKEN_TYPES.In,is:TOKEN_TYPES.Is,if:TOKEN_TYPES.If,else:TOKEN_TYPES.Else,endif:TOKEN_TYPES.EndIf,elif:TOKEN_TYPES.ElseIf,endfor:TOKEN_TYPES.EndFor,and:TOKEN_TYPES.And,or:TOKEN_TYPES.Or,not:TOKEN_TYPES.Not,"not in":TOKEN_TYPES.NotIn,true:TOKEN_TYPES.BooleanLiteral,false:TOKEN_TYPES.BooleanLiteral}),Token=class{constructor(x,c){this.value=x,this.type=c}};function isWord(x){return/\w/.test(x)}function isInteger(x){return/[0-9]/.test(x)}var ORDERED_MAPPING_TABLE=[["{%",TOKEN_TYPES.OpenStatement],["%}",TOKEN_TYPES.CloseStatement],["{{",TOKEN_TYPES.OpenExpression],["}}",TOKEN_TYPES.CloseExpression],["(",TOKEN_TYPES.OpenParen],[")",TOKEN_TYPES.CloseParen],["{",TOKEN_TYPES.OpenCurlyBracket],["}",TOKEN_TYPES.CloseCurlyBracket],["[",TOKEN_TYPES.OpenSquareBracket],["]",TOKEN_TYPES.CloseSquareBracket],[",",TOKEN_TYPES.Comma],[".",TOKEN_TYPES.Dot],[":",TOKEN_TYPES.Colon],["|",TOKEN_TYPES.Pipe],["<=",TOKEN_TYPES.ComparisonBinaryOperator],[">=",TOKEN_TYPES.ComparisonBinaryOperator],["==",TOKEN_TYPES.ComparisonBinaryOperator],["!=",TOKEN_TYPES.ComparisonBinaryOperator],["<",TOKEN_TYPES.ComparisonBinaryOperator],[">",TOKEN_TYPES.ComparisonBinaryOperator],["+",TOKEN_TYPES.AdditiveBinaryOperator],["-",TOKEN_TYPES.AdditiveBinaryOperator],["*",TOKEN_TYPES.MultiplicativeBinaryOperator],["/",TOKEN_TYPES.MultiplicativeBinaryOperator],["%",TOKEN_TYPES.MultiplicativeBinaryOperator],["=",TOKEN_TYPES.Equals]],ESCAPE_CHARACTERS=new Map([["n",` `],["t"," "],["r","\r"],["b","\b"],["f","\f"],["v","\v"],["'","'"],['"','"'],["\\","\\"]]);function preprocess(x,c={}){return x.endsWith(` `)&&(x=x.slice(0,-1)),x=x.replace(/{#.*?#}/gs,"{##}"),c.lstrip_blocks&&(x=x.replace(/^[ \t]*({[#%])/gm,"$1")),c.trim_blocks&&(x=x.replace(/([#%]})\n/g,"$1")),x.replace(/{##}/g,"").replace(/-%}\s*/g,"%}").replace(/\s*{%-/g,"{%").replace(/-}}\s*/g,"}}").replace(/\s*{{-/g,"{{")}function tokenize(x,c={}){var E,P,R;const _=[],T=preprocess(x,c);let C=0;const M=$=>{let G="";for(;$(T[C]);){if(T[C]==="\\"){if(++C,C>=T.length)throw new SyntaxError("Unexpected end of input");const O=T[C++],L=ESCAPE_CHARACTERS.get(O);if(L===void 0)throw new SyntaxError(`Unexpected escaped character: ${O}`);G+=L;continue}if(G+=T[C++],C>=T.length)throw new SyntaxError("Unexpected end of input")}return G};e:for(;C0){_.push(new Token(O,TOKEN_TYPES.Text));continue}}M(O=>/\s/.test(O));const G=T[C];if(G==="-"||G==="+"){const O=(P=_.at(-1))==null?void 0:P.type;if(O===TOKEN_TYPES.Text||O===void 0)throw new SyntaxError(`Unexpected character: ${G}`);switch(O){case TOKEN_TYPES.Identifier:case TOKEN_TYPES.NumericLiteral:case TOKEN_TYPES.BooleanLiteral:case TOKEN_TYPES.StringLiteral:case TOKEN_TYPES.CloseParen:case TOKEN_TYPES.CloseSquareBracket:break;default:{++C;const L=M(isInteger);_.push(new Token(`${G}${L}`,L.length>0?TOKEN_TYPES.NumericLiteral:TOKEN_TYPES.UnaryOperator));continue}}}for(const[O,L]of ORDERED_MAPPING_TABLE)if(T.slice(C,C+O.length)===O){_.push(new Token(O,L)),C+=O.length;continue e}if(G==="'"||G==='"'){++C;const O=M(L=>L!==G);_.push(new Token(O,TOKEN_TYPES.StringLiteral)),++C;continue}if(isInteger(G)){const O=M(isInteger);_.push(new Token(O,TOKEN_TYPES.NumericLiteral));continue}if(isWord(G)){const O=M(isWord),L=Object.hasOwn(KEYWORDS,O)?KEYWORDS[O]:TOKEN_TYPES.Identifier;L===TOKEN_TYPES.In&&((R=_.at(-1))==null?void 0:R.type)===TOKEN_TYPES.Not?(_.pop(),_.push(new Token("not in",TOKEN_TYPES.NotIn))):_.push(new Token(O,L));continue}throw new SyntaxError(`Unexpected character: ${G}`)}return _}var Statement=class{constructor(){ke(this,"type","Statement")}},Program=class extends Statement{constructor(c){super();ke(this,"type","Program");this.body=c}},If=class extends Statement{constructor(c,_,T){super();ke(this,"type","If");this.test=c,this.body=_,this.alternate=T}},For=class extends Statement{constructor(c,_,T){super();ke(this,"type","For");this.loopvar=c,this.iterable=_,this.body=T}},SetStatement=class extends Statement{constructor(c,_){super();ke(this,"type","Set");this.assignee=c,this.value=_}},Expression=class extends Statement{constructor(){super(...arguments);ke(this,"type","Expression")}},MemberExpression=class extends Expression{constructor(c,_,T){super();ke(this,"type","MemberExpression");this.object=c,this.property=_,this.computed=T}},CallExpression=class extends Expression{constructor(c,_){super();ke(this,"type","CallExpression");this.callee=c,this.args=_}},Identifier=class extends Expression{constructor(c){super();ke(this,"type","Identifier");this.value=c}},Literal=class extends Expression{constructor(c){super();ke(this,"type","Literal");this.value=c}},NumericLiteral=class extends Literal{constructor(){super(...arguments);ke(this,"type","NumericLiteral")}},StringLiteral=class extends Literal{constructor(){super(...arguments);ke(this,"type","StringLiteral")}},BooleanLiteral=class extends Literal{constructor(){super(...arguments);ke(this,"type","BooleanLiteral")}},ArrayLiteral=class extends Literal{constructor(){super(...arguments);ke(this,"type","ArrayLiteral")}},TupleLiteral=class extends Literal{constructor(){super(...arguments);ke(this,"type","TupleLiteral")}},ObjectLiteral=class extends Literal{constructor(){super(...arguments);ke(this,"type","ObjectLiteral")}},BinaryExpression=class extends Expression{constructor(c,_,T){super();ke(this,"type","BinaryExpression");this.operator=c,this.left=_,this.right=T}},FilterExpression=class extends Expression{constructor(c,_){super();ke(this,"type","FilterExpression");this.operand=c,this.filter=_}},TestExpression=class extends Expression{constructor(c,_,T){super();ke(this,"type","TestExpression");this.operand=c,this.negate=_,this.test=T}},UnaryExpression=class extends Expression{constructor(c,_){super();ke(this,"type","UnaryExpression");this.operator=c,this.argument=_}},SliceExpression=class extends Expression{constructor(c=void 0,_=void 0,T=void 0){super();ke(this,"type","SliceExpression");this.start=c,this.stop=_,this.step=T}},KeywordArgumentExpression=class extends Expression{constructor(c,_){super();ke(this,"type","KeywordArgumentExpression");this.key=c,this.value=_}};function parse(x){const c=new Program([]);let _=0;function T(ne,te){const oe=x[_++];if(!oe||oe.type!==ne)throw new Error(`Parser Error: ${te}. ${oe.type} !== ${ne}.`);return oe}function C(){switch(x[_].type){case TOKEN_TYPES.Text:return P();case TOKEN_TYPES.OpenStatement:return R();case TOKEN_TYPES.OpenExpression:return $();default:throw new SyntaxError(`Unexpected token type: ${x[_].type}`)}}function M(...ne){return _+ne.length<=x.length&&ne.some((te,oe)=>te!==x[_+oe].type)}function E(...ne){return _+ne.length<=x.length&&ne.every((te,oe)=>te===x[_+oe].type)}function P(){return new StringLiteral(T(TOKEN_TYPES.Text,"Expected text token").value)}function R(){T(TOKEN_TYPES.OpenStatement,"Expected opening statement token");let ne;switch(x[_].type){case TOKEN_TYPES.Set:++_,ne=G(),T(TOKEN_TYPES.CloseStatement,"Expected closing statement token");break;case TOKEN_TYPES.If:++_,ne=O(),T(TOKEN_TYPES.OpenStatement,"Expected {% token"),T(TOKEN_TYPES.EndIf,"Expected endif token"),T(TOKEN_TYPES.CloseStatement,"Expected %} token");break;case TOKEN_TYPES.For:++_,ne=F(),T(TOKEN_TYPES.OpenStatement,"Expected {% token"),T(TOKEN_TYPES.EndFor,"Expected endfor token"),T(TOKEN_TYPES.CloseStatement,"Expected %} token");break;default:throw new SyntaxError(`Unknown statement type: ${x[_].type}`)}return ne}function $(){T(TOKEN_TYPES.OpenExpression,"Expected opening expression token");const ne=V();return T(TOKEN_TYPES.CloseExpression,"Expected closing expression token"),ne}function G(){const ne=V();if(E(TOKEN_TYPES.Equals)){++_;const te=G();return new SetStatement(ne,te)}return ne}function O(){var ue,de,pe,he,we,ye,Me,Pe;const ne=V();T(TOKEN_TYPES.CloseStatement,"Expected closing statement token");const te=[],oe=[];for(;!(((ue=x[_])==null?void 0:ue.type)===TOKEN_TYPES.OpenStatement&&(((de=x[_+1])==null?void 0:de.type)===TOKEN_TYPES.ElseIf||((pe=x[_+1])==null?void 0:pe.type)===TOKEN_TYPES.Else||((he=x[_+1])==null?void 0:he.type)===TOKEN_TYPES.EndIf));)te.push(C());if(((we=x[_])==null?void 0:we.type)===TOKEN_TYPES.OpenStatement&&((ye=x[_+1])==null?void 0:ye.type)!==TOKEN_TYPES.EndIf)if(++_,E(TOKEN_TYPES.ElseIf))T(TOKEN_TYPES.ElseIf,"Expected elseif token"),oe.push(O());else for(T(TOKEN_TYPES.Else,"Expected else token"),T(TOKEN_TYPES.CloseStatement,"Expected closing statement token");!(((Me=x[_])==null?void 0:Me.type)===TOKEN_TYPES.OpenStatement&&((Pe=x[_+1])==null?void 0:Pe.type)===TOKEN_TYPES.EndIf);)oe.push(C());return new If(ne,te,oe)}function L(ne=!1){const te=ne?ae:V,oe=[te()],ue=E(TOKEN_TYPES.Comma);for(;ue&&(++_,oe.push(te()),!!E(TOKEN_TYPES.Comma)););return ue?new TupleLiteral(oe):oe[0]}function F(){const ne=L(!0);if(!(ne instanceof Identifier||ne instanceof TupleLiteral))throw new SyntaxError(`Expected identifier/tuple for the loop variable, got ${ne.type} instead`);T(TOKEN_TYPES.In,"Expected `in` keyword following loop variable");const te=V();T(TOKEN_TYPES.CloseStatement,"Expected closing statement token");const oe=[];for(;M(TOKEN_TYPES.OpenStatement,TOKEN_TYPES.EndFor);)oe.push(C());return new For(ne,te,oe)}function V(){return W()}function W(){const ne=z();if(E(TOKEN_TYPES.If)){++_;const te=z();T(TOKEN_TYPES.Else,"Expected else token");const oe=z();return new If(te,[ne],[oe])}return ne}function z(){let ne=Z();for(;E(TOKEN_TYPES.Or);){const te=x[_];++_;const oe=Z();ne=new BinaryExpression(te,ne,oe)}return ne}function Z(){let ne=H();for(;E(TOKEN_TYPES.And);){const te=x[_];++_;const oe=H();ne=new BinaryExpression(te,ne,oe)}return ne}function H(){let ne;for(;E(TOKEN_TYPES.Not);){const te=x[_];++_;const oe=H();ne=new UnaryExpression(te,oe)}return ne??Y()}function Y(){let ne=U();for(;E(TOKEN_TYPES.ComparisonBinaryOperator)||E(TOKEN_TYPES.In)||E(TOKEN_TYPES.NotIn);){const te=x[_];++_;const oe=U();ne=new BinaryExpression(te,ne,oe)}return ne}function U(){let ne=ee();for(;E(TOKEN_TYPES.AdditiveBinaryOperator);){const te=x[_];++_;const oe=ee();ne=new BinaryExpression(te,ne,oe)}return ne}function j(){const ne=Q();return E(TOKEN_TYPES.OpenParen)?X(ne):ne}function X(ne){let te=new CallExpression(ne,K());return E(TOKEN_TYPES.OpenParen)&&(te=X(te)),te}function K(){T(TOKEN_TYPES.OpenParen,"Expected opening parenthesis for arguments list");const ne=q();return T(TOKEN_TYPES.CloseParen,"Expected closing parenthesis for arguments list"),ne}function q(){const ne=[];for(;!E(TOKEN_TYPES.CloseParen);){let te=V();if(E(TOKEN_TYPES.Equals)){if(++_,!(te instanceof Identifier))throw new SyntaxError("Expected identifier for keyword argument");const oe=V();te=new KeywordArgumentExpression(te,oe)}ne.push(te),E(TOKEN_TYPES.Comma)&&++_}return ne}function J(){const ne=[];let te=!1;for(;!E(TOKEN_TYPES.CloseSquareBracket);)E(TOKEN_TYPES.Colon)?(ne.push(void 0),++_,te=!0):(ne.push(V()),E(TOKEN_TYPES.Colon)&&(++_,te=!0));if(ne.length===0)throw new SyntaxError("Expected at least one argument for member/slice expression");if(te){if(ne.length>3)throw new SyntaxError("Expected 0-3 arguments for slice expression");return new SliceExpression(...ne)}return ne[0]}function Q(){let ne=ae();for(;E(TOKEN_TYPES.Dot)||E(TOKEN_TYPES.OpenSquareBracket);){const te=x[_];++_;let oe;const ue=te.type!==TOKEN_TYPES.Dot;if(ue)oe=J(),T(TOKEN_TYPES.CloseSquareBracket,"Expected closing square bracket");else if(oe=ae(),oe.type!=="Identifier")throw new SyntaxError("Expected identifier following dot operator");ne=new MemberExpression(ne,oe,ue)}return ne}function ee(){let ne=re();for(;E(TOKEN_TYPES.MultiplicativeBinaryOperator);){const te=x[_];++_;const oe=re();ne=new BinaryExpression(te,ne,oe)}return ne}function re(){let ne=ie();for(;E(TOKEN_TYPES.Is);){++_;const te=E(TOKEN_TYPES.Not);te&&++_;let oe=ae();if(oe instanceof BooleanLiteral&&(oe=new Identifier(oe.value.toString())),!(oe instanceof Identifier))throw new SyntaxError("Expected identifier for the test");ne=new TestExpression(ne,te,oe)}return ne}function ie(){let ne=j();for(;E(TOKEN_TYPES.Pipe);){++_;let te=ae();if(!(te instanceof Identifier))throw new SyntaxError("Expected identifier for the filter");E(TOKEN_TYPES.OpenParen)&&(te=X(te)),ne=new FilterExpression(ne,te)}return ne}function ae(){const ne=x[_];switch(ne.type){case TOKEN_TYPES.NumericLiteral:return++_,new NumericLiteral(Number(ne.value));case TOKEN_TYPES.StringLiteral:return++_,new StringLiteral(ne.value);case TOKEN_TYPES.BooleanLiteral:return++_,new BooleanLiteral(ne.value==="true");case TOKEN_TYPES.Identifier:return++_,new Identifier(ne.value);case TOKEN_TYPES.OpenParen:{++_;const te=L();if(x[_].type!==TOKEN_TYPES.CloseParen)throw new SyntaxError(`Expected closing parenthesis, got ${x[_].type} instead`);return++_,te}case TOKEN_TYPES.OpenSquareBracket:{++_;const te=[];for(;!E(TOKEN_TYPES.CloseSquareBracket);)te.push(V()),E(TOKEN_TYPES.Comma)&&++_;return++_,new ArrayLiteral(te)}case TOKEN_TYPES.OpenCurlyBracket:{++_;const te=new Map;for(;!E(TOKEN_TYPES.CloseCurlyBracket);){const oe=V();T(TOKEN_TYPES.Colon,"Expected colon between key and value in object literal");const ue=V();te.set(oe,ue),E(TOKEN_TYPES.Comma)&&++_}return++_,new ObjectLiteral(te)}default:throw new SyntaxError(`Unexpected token: ${ne.type}`)}}for(;_=0?(c=(c??(c=0))<0?Math.max(x.length+c,0):Math.min(c,x.length),_=(_??(_=x.length))<0?Math.max(x.length+_,0):Math.min(_,x.length)):(c=(c??(c=x.length-1))<0?Math.max(x.length+c,-1):Math.min(c,x.length-1),_=(_??(_=-1))<-1?Math.max(x.length+_,-1):Math.min(_,x.length-1));const M=[];for(let E=c;C*Ec.toUpperCase())}var RuntimeValue=class{constructor(x=void 0){ke(this,"type","RuntimeValue");ke(this,"value");ke(this,"builtins",new Map);this.value=x}__bool__(){return new BooleanValue(!!this.value)}},NumericValue=class extends RuntimeValue{constructor(){super(...arguments);ke(this,"type","NumericValue")}},StringValue=class extends RuntimeValue{constructor(){super(...arguments);ke(this,"type","StringValue");ke(this,"builtins",new Map([["upper",new FunctionValue(()=>new StringValue(this.value.toUpperCase()))],["lower",new FunctionValue(()=>new StringValue(this.value.toLowerCase()))],["strip",new FunctionValue(()=>new StringValue(this.value.trim()))],["title",new FunctionValue(()=>new StringValue(titleCase(this.value)))],["length",new NumericValue(this.value.length)]]))}},BooleanValue=class extends RuntimeValue{constructor(){super(...arguments);ke(this,"type","BooleanValue")}},ObjectValue=class extends RuntimeValue{constructor(){super(...arguments);ke(this,"type","ObjectValue");ke(this,"builtins",new Map([["get",new FunctionValue(([c,_])=>{if(!(c instanceof StringValue))throw new Error(`Object key must be a string: got ${c.type}`);return this.value.get(c.value)??_??new NullValue})],["items",new FunctionValue(()=>new ArrayValue(Array.from(this.value.entries()).map(([c,_])=>new ArrayValue([new StringValue(c),_]))))]]))}__bool__(){return new BooleanValue(this.value.size>0)}},ArrayValue=class extends RuntimeValue{constructor(){super(...arguments);ke(this,"type","ArrayValue");ke(this,"builtins",new Map([["length",new NumericValue(this.value.length)]]))}__bool__(){return new BooleanValue(this.value.length>0)}},TupleValue=class extends ArrayValue{constructor(){super(...arguments);ke(this,"type","TupleValue")}},FunctionValue=class extends RuntimeValue{constructor(){super(...arguments);ke(this,"type","FunctionValue")}},NullValue=class extends RuntimeValue{constructor(){super(...arguments);ke(this,"type","NullValue")}},UndefinedValue=class extends RuntimeValue{constructor(){super(...arguments);ke(this,"type","UndefinedValue")}},Environment=class{constructor(x){ke(this,"variables",new Map([["namespace",new FunctionValue(x=>{if(x.length===0)return new ObjectValue(new Map);if(x.length!==1||!(x[0]instanceof ObjectValue))throw new Error("`namespace` expects either zero arguments or a single object argument");return x[0]})]]));ke(this,"tests",new Map([["boolean",x=>x.type==="BooleanValue"],["callable",x=>x instanceof FunctionValue],["odd",x=>{if(x.type!=="NumericValue")throw new Error(`Cannot apply test "odd" to type: ${x.type}`);return x.value%2!==0}],["even",x=>{if(x.type!=="NumericValue")throw new Error(`Cannot apply test "even" to type: ${x.type}`);return x.value%2===0}],["false",x=>x.type==="BooleanValue"&&!x.value],["true",x=>x.type==="BooleanValue"&&x.value],["number",x=>x.type==="NumericValue"],["integer",x=>x.type==="NumericValue"&&Number.isInteger(x.value)],["iterable",x=>x instanceof ArrayValue||x instanceof StringValue],["lower",x=>{const c=x.value;return x.type==="StringValue"&&c===c.toLowerCase()}],["upper",x=>{const c=x.value;return x.type==="StringValue"&&c===c.toUpperCase()}],["none",x=>x.type==="NullValue"],["defined",x=>x.type!=="UndefinedValue"],["undefined",x=>x.type==="UndefinedValue"],["equalto",(x,c)=>x.value===c.value]]));this.parent=x}set(x,c){return this.declareVariable(x,convertToRuntimeValues(c))}declareVariable(x,c){if(this.variables.has(x))throw new SyntaxError(`Variable already declared: ${x}`);return this.variables.set(x,c),c}setVariable(x,c){return this.variables.set(x,c),c}resolve(x){if(this.variables.has(x))return this;if(this.parent)return this.parent.resolve(x);throw new Error(`Unknown variable: ${x}`)}lookupVariable(x){try{return this.resolve(x).variables.get(x)??new UndefinedValue}catch{return new UndefinedValue}}},Interpreter=class{constructor(x){ke(this,"global");this.global=x??new Environment}run(x){return this.evaluate(x,this.global)}evaluateBinaryExpression(x,c){const _=this.evaluate(x.left,c);switch(x.operator.value){case"and":return _.__bool__().value?this.evaluate(x.right,c):_;case"or":return _.__bool__().value?_:this.evaluate(x.right,c)}const T=this.evaluate(x.right,c);switch(x.operator.value){case"==":return new BooleanValue(_.value==T.value);case"!=":return new BooleanValue(_.value!=T.value)}if(_ instanceof UndefinedValue||T instanceof UndefinedValue)throw new Error("Cannot perform operation on undefined values");if(_ instanceof NullValue||T instanceof NullValue)throw new Error("Cannot perform operation on null values");if(_ instanceof NumericValue&&T instanceof NumericValue)switch(x.operator.value){case"+":return new NumericValue(_.value+T.value);case"-":return new NumericValue(_.value-T.value);case"*":return new NumericValue(_.value*T.value);case"/":return new NumericValue(_.value/T.value);case"%":return new NumericValue(_.value%T.value);case"<":return new BooleanValue(_.value":return new BooleanValue(_.value>T.value);case">=":return new BooleanValue(_.value>=T.value);case"<=":return new BooleanValue(_.value<=T.value)}else if(_ instanceof ArrayValue&&T instanceof ArrayValue)switch(x.operator.value){case"+":return new ArrayValue(_.value.concat(T.value))}else if(T instanceof ArrayValue){const C=T.value.find(M=>M.value===_.value)!==void 0;switch(x.operator.value){case"in":return new BooleanValue(C);case"not in":return new BooleanValue(!C)}}if(_ instanceof StringValue||T instanceof StringValue)switch(x.operator.value){case"+":return new StringValue(_.value.toString()+T.value.toString())}if(_ instanceof StringValue&&T instanceof StringValue)switch(x.operator.value){case"in":return new BooleanValue(T.value.includes(_.value));case"not in":return new BooleanValue(!T.value.includes(_.value))}if(_ instanceof StringValue&&T instanceof ObjectValue)switch(x.operator.value){case"in":return new BooleanValue(T.value.has(_.value));case"not in":return new BooleanValue(!T.value.has(_.value))}throw new SyntaxError(`Unknown operator "${x.operator.value}" between ${_.type} and ${T.type}`)}evaluateFilterExpression(x,c){const _=this.evaluate(x.operand,c);if(x.filter.type==="Identifier"){const T=x.filter;if(_ instanceof ArrayValue)switch(T.value){case"list":return _;case"first":return _.value[0];case"last":return _.value[_.value.length-1];case"length":return new NumericValue(_.value.length);case"reverse":return new ArrayValue(_.value.reverse());case"sort":return new ArrayValue(_.value.sort((C,M)=>{if(C.type!==M.type)throw new Error(`Cannot compare different types: ${C.type} and ${M.type}`);switch(C.type){case"NumericValue":return C.value-M.value;case"StringValue":return C.value.localeCompare(M.value);default:throw new Error(`Cannot compare type: ${C.type}`)}}));default:throw new Error(`Unknown ArrayValue filter: ${T.value}`)}else if(_ instanceof StringValue)switch(T.value){case"length":return new NumericValue(_.value.length);case"upper":return new StringValue(_.value.toUpperCase());case"lower":return new StringValue(_.value.toLowerCase());case"title":return new StringValue(titleCase(_.value));case"capitalize":return new StringValue(_.value.charAt(0).toUpperCase()+_.value.slice(1));case"trim":return new StringValue(_.value.trim());default:throw new Error(`Unknown StringValue filter: ${T.value}`)}else if(_ instanceof NumericValue)switch(T.value){case"abs":return new NumericValue(Math.abs(_.value));default:throw new Error(`Unknown NumericValue filter: ${T.value}`)}else if(_ instanceof ObjectValue)switch(T.value){case"items":return new ArrayValue(Array.from(_.value.entries()).map(([C,M])=>new ArrayValue([new StringValue(C),M])));case"length":return new NumericValue(_.value.size);default:throw new Error(`Unknown ObjectValue filter: ${T.value}`)}throw new Error(`Cannot apply filter "${T.value}" to type: ${_.type}`)}else if(x.filter.type==="CallExpression"){const T=x.filter;if(T.callee.type!=="Identifier")throw new Error(`Unknown filter: ${T.callee.type}`);const C=T.callee.value;if(_ instanceof ArrayValue){switch(C){case"selectattr":{if(_.value.some(G=>!(G instanceof ObjectValue)))throw new Error("`selectattr` can only be applied to array of objects");if(T.args.some(G=>G.type!=="StringLiteral"))throw new Error("arguments of `selectattr` must be strings");const[M,E,P]=T.args.map(G=>this.evaluate(G,c));let R;if(E){const G=c.tests.get(E.value);if(!G)throw new Error(`Unknown test: ${E.value}`);R=G}else R=(...G)=>G[0].__bool__().value;const $=_.value.filter(G=>{const O=G.value.get(M.value);return O?R(O,P):!1});return new ArrayValue($)}}throw new Error(`Unknown ArrayValue filter: ${C}`)}else throw new Error(`Cannot apply filter "${C}" to type: ${_.type}`)}throw new Error(`Unknown filter: ${x.filter.type}`)}evaluateTestExpression(x,c){const _=this.evaluate(x.operand,c),T=c.tests.get(x.test.value);if(!T)throw new Error(`Unknown test: ${x.test.value}`);const C=T(_);return new BooleanValue(x.negate?!C:C)}evaluateUnaryExpression(x,c){const _=this.evaluate(x.argument,c);switch(x.operator.value){case"not":return new BooleanValue(!_.value);default:throw new SyntaxError(`Unknown operator: ${x.operator.value}`)}}evalProgram(x,c){return this.evaluateBlock(x.body,c)}evaluateBlock(x,c){let _="";for(const T of x){const C=this.evaluate(T,c);C.type!=="NullValue"&&C.type!=="UndefinedValue"&&(_+=C.value)}return new StringValue(_)}evaluateIdentifier(x,c){return c.lookupVariable(x.value)}evaluateCallExpression(x,c){const _=[],T=new Map;for(const M of x.args)if(M.type==="KeywordArgumentExpression"){const E=M;T.set(E.key.value,this.evaluate(E.value,c))}else _.push(this.evaluate(M,c));T.size>0&&_.push(new ObjectValue(T));const C=this.evaluate(x.callee,c);if(C.type!=="FunctionValue")throw new Error(`Cannot call something that is not a function: got ${C.type}`);return C.value(_,c)}evaluateSliceExpression(x,c,_){if(!(x instanceof ArrayValue||x instanceof StringValue))throw new Error("Slice object must be an array or string");const T=this.evaluate(c.start,_),C=this.evaluate(c.stop,_),M=this.evaluate(c.step,_);if(!(T instanceof NumericValue||T instanceof UndefinedValue))throw new Error("Slice start must be numeric or undefined");if(!(C instanceof NumericValue||C instanceof UndefinedValue))throw new Error("Slice stop must be numeric or undefined");if(!(M instanceof NumericValue||M instanceof UndefinedValue))throw new Error("Slice step must be numeric or undefined");return x instanceof ArrayValue?new ArrayValue(slice(x.value,T.value,C.value,M.value)):new StringValue(slice(Array.from(x.value),T.value,C.value,M.value).join(""))}evaluateMemberExpression(x,c){const _=this.evaluate(x.object,c);let T;if(x.computed){if(x.property.type==="SliceExpression")return this.evaluateSliceExpression(_,x.property,c);T=this.evaluate(x.property,c)}else T=new StringValue(x.property.value);let C;if(_ instanceof ObjectValue){if(!(T instanceof StringValue))throw new Error(`Cannot access property with non-string: got ${T.type}`);C=_.value.get(T.value)??_.builtins.get(T.value)}else if(_ instanceof ArrayValue||_ instanceof StringValue)if(T instanceof NumericValue)C=_.value.at(T.value),_ instanceof StringValue&&(C=new StringValue(_.value.at(T.value)));else if(T instanceof StringValue)C=_.builtins.get(T.value);else throw new Error(`Cannot access property with non-string/non-number: got ${T.type}`);else{if(!(T instanceof StringValue))throw new Error(`Cannot access property with non-string: got ${T.type}`);C=_.builtins.get(T.value)}return C instanceof RuntimeValue?C:new UndefinedValue}evaluateSet(x,c){const _=this.evaluate(x.value,c);if(x.assignee.type==="Identifier"){const T=x.assignee.value;c.setVariable(T,_)}else if(x.assignee.type==="MemberExpression"){const T=x.assignee,C=this.evaluate(T.object,c);if(!(C instanceof ObjectValue))throw new Error("Cannot assign to member of non-object");if(T.property.type!=="Identifier")throw new Error("Cannot assign to member with non-identifier property");C.value.set(T.property.value,_)}else throw new Error(`Invalid LHS inside assignment expression: ${JSON.stringify(x.assignee)}`);return new NullValue}evaluateIf(x,c){const _=this.evaluate(x.test,c);return this.evaluateBlock(_.__bool__().value?x.body:x.alternate,c)}evaluateFor(x,c){const _=new Environment(c),T=this.evaluate(x.iterable,_);if(!(T instanceof ArrayValue))throw new Error(`Expected iterable type in for loop: got ${T.type}`);let C="";for(let M=0;M0?T.value[M-1]:new UndefinedValue],["nextitem",MG.value.length?"few":"many"} items to unpack`);for(let O=0;O<$.value.length;++O){if($.value[O].type!=="Identifier")throw new Error(`Cannot unpack non-identifier type: ${$.value[O].type}`);_.setVariable($.value[O].value,G.value[O])}}const R=this.evaluateBlock(x.body,_);C+=R.value}return new StringValue(C)}evaluate(x,c){if(x===void 0)return new UndefinedValue;switch(x.type){case"Program":return this.evalProgram(x,c);case"Set":return this.evaluateSet(x,c);case"If":return this.evaluateIf(x,c);case"For":return this.evaluateFor(x,c);case"NumericLiteral":return new NumericValue(Number(x.value));case"StringLiteral":return new StringValue(x.value);case"BooleanLiteral":return new BooleanValue(x.value);case"ArrayLiteral":return new ArrayValue(x.value.map(_=>this.evaluate(_,c)));case"TupleLiteral":return new TupleValue(x.value.map(_=>this.evaluate(_,c)));case"ObjectLiteral":{const _=new Map;for(const[T,C]of x.value){const M=this.evaluate(T,c);if(!(M instanceof StringValue))throw new Error(`Object keys must be strings: got ${M.type}`);_.set(M.value,this.evaluate(C,c))}return new ObjectValue(_)}case"Identifier":return this.evaluateIdentifier(x,c);case"CallExpression":return this.evaluateCallExpression(x,c);case"MemberExpression":return this.evaluateMemberExpression(x,c);case"UnaryExpression":return this.evaluateUnaryExpression(x,c);case"BinaryExpression":return this.evaluateBinaryExpression(x,c);case"FilterExpression":return this.evaluateFilterExpression(x,c);case"TestExpression":return this.evaluateTestExpression(x,c);default:throw new SyntaxError(`Unknown node type: ${x.type}`)}}};function convertToRuntimeValues(x){switch(typeof x){case"number":return new NumericValue(x);case"string":return new StringValue(x);case"boolean":return new BooleanValue(x);case"object":return x===null?new NullValue:Array.isArray(x)?new ArrayValue(x.map(convertToRuntimeValues)):new ObjectValue(new Map(Object.entries(x).map(([c,_])=>[c,convertToRuntimeValues(_)])));case"function":return new FunctionValue((c,_)=>{const T=x(...c.map(C=>C.value))??null;return convertToRuntimeValues(T)});default:throw new Error(`Cannot convert to runtime value: ${x}`)}}var Template=class{constructor(x){ke(this,"parsed");const c=tokenize(x,{lstrip_blocks:!0,trim_blocks:!0});this.parsed=parse(c)}render(x){const c=new Environment;c.set("false",!1),c.set("true",!0),c.set("raise_exception",C=>{throw new Error(C)}),c.set("range",range);for(const[C,M]of Object.entries(x))c.set(C,M);return new Interpreter(c).run(this.parsed).value}};async function loadTokenizer(x,c){const _=await Promise.all([getModelJSON(x,"tokenizer.json",!0,c),getModelJSON(x,"tokenizer_config.json",!0,c)]);return c.legacy!==null&&(_[1].legacy=c.legacy),_}function regexSplit(x,c){const _=[];let T=0;for(const C of x.matchAll(c)){const M=C[0];T0&&_.push(M),T=C.index+M.length}return Tthis.tokens_to_ids.get(_)??this.unk_token_id)}convert_ids_to_tokens(c){return c.map(_=>this.vocab[_]??this.unk_token)}}class WordPieceTokenizer extends TokenizerModel{constructor(c){super(c),this.tokens_to_ids=objectToMap(c.vocab),this.unk_token_id=this.tokens_to_ids.get(c.unk_token),this.unk_token=c.unk_token,this.max_input_chars_per_word=c.max_input_chars_per_word??100,this.vocab=new Array(this.tokens_to_ids.size);for(const[_,T]of this.tokens_to_ids)this.vocab[T]=_}encode(c){const _=[];for(const T of c){const C=[...T];if(C.length>this.max_input_chars_per_word){_.push(this.unk_token);continue}let M=!1,E=0;const P=[];for(;E0&&(G=this.config.continuing_subword_prefix+G),this.tokens_to_ids.has(G)){$=G;break}--R}if($===null){M=!0;break}P.push($),E=R}M?_.push(this.unk_token):_.push(...P)}return _}}class Unigram extends TokenizerModel{constructor(c,_){super(c);const T=c.vocab.length;this.vocab=new Array(T),this.scores=new Array(T);for(let C=0;C[C,M])),this.bosToken=" ",this.bosTokenId=this.tokens_to_ids.get(this.bosToken),this.eosToken=_.eos_token,this.eosTokenId=this.tokens_to_ids.get(this.eosToken),this.unkToken=this.vocab[this.unk_token_id],this.minScore=min(this.scores)[0],this.unkScore=this.minScore-10,this.scores[this.unk_token_id]=this.unkScore,this.trie=new CharTrie,this.trie.extend(this.vocab),this.fuse_unk=!0}populateNodes(c){const _=c.sentence,T=_.length;let C=0;for(;C{const x=[...Array.from({length:"~".charCodeAt(0)-"!".charCodeAt(0)+1},(C,M)=>M+"!".charCodeAt(0)),...Array.from({length:"¬".charCodeAt(0)-"¡".charCodeAt(0)+1},(C,M)=>M+"¡".charCodeAt(0)),...Array.from({length:"ÿ".charCodeAt(0)-"®".charCodeAt(0)+1},(C,M)=>M+"®".charCodeAt(0))],c=x.slice();let _=0;for(let C=0;C<256;++C)x.includes(C)||(x.push(C),c.push(256+_),_+=1);const T=c.map(C=>String.fromCharCode(C));return Object.fromEntries(x.map((C,M)=>[C,T[M]]))})(),UNICODE_TO_BYTES=reverseDictionary(BYTES_TO_UNICODE);class BPE extends TokenizerModel{constructor(c){super(c),this.BPE_SPLIT_TOKEN=" ",this.tokens_to_ids=objectToMap(c.vocab),this.unk_token_id=this.tokens_to_ids.get(c.unk_token),this.unk_token=c.unk_token,this.vocab=new Array(this.tokens_to_ids.size);for(const[_,T]of this.tokens_to_ids)this.vocab[T]=_;this.bpe_ranks=new Map(c.merges.map((_,T)=>[_,T])),this.merges=c.merges.map(_=>_.split(this.BPE_SPLIT_TOKEN)),this.end_of_word_suffix=c.end_of_word_suffix,this.continuing_subword_suffix=c.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.cache=new Map}bpe(c){if(c.length===0)return[];const _=this.cache.get(c);if(_!==void 0)return _;const T=Array.from(c);this.end_of_word_suffix&&(T[T.length-1]+=this.end_of_word_suffix);let C=[];if(T.length>1){const M=new PriorityQueue((R,$)=>R.score<$.score);let E={token:T[0],bias:0,prev:null,next:null},P=E;for(let R=1;R`<0x${E.toString(16).toUpperCase().padStart(2,"0")}>`)):_.push(this.unk_token)}return _}}class LegacyTokenizerModel extends TokenizerModel{constructor(c,_){super(c),this.tokens_to_ids=objectToMap(_.target_lang?c.vocab[_.target_lang]:c.vocab),this.bos_token=_.bos_token,this.bos_token_id=this.tokens_to_ids.get(this.bos_token),this.eos_token=_.eos_token,this.eos_token_id=this.tokens_to_ids.get(this.eos_token),this.pad_token=_.pad_token,this.pad_token_id=this.tokens_to_ids.get(this.pad_token),this.unk_token=_.unk_token,this.unk_token_id=this.tokens_to_ids.get(this.unk_token),this.vocab=new Array(this.tokens_to_ids.size);for(const[T,C]of this.tokens_to_ids)this.vocab[C]=T}encode(c){return c}}class Normalizer extends Callable{constructor(c){super(),this.config=c}static fromConfig(c){if(c===null)return null;switch(c.type){case"BertNormalizer":return new BertNormalizer(c);case"Precompiled":return new Precompiled(c);case"Sequence":return new NormalizerSequence(c);case"Replace":return new Replace(c);case"NFC":return new NFC(c);case"NFKC":return new NFKC(c);case"NFKD":return new NFKD(c);case"Strip":return new StripNormalizer(c);case"StripAccents":return new StripAccents(c);case"Lowercase":return new Lowercase(c);case"Prepend":return new Prepend(c);default:throw new Error(`Unknown Normalizer type: ${c.type}`)}}normalize(c){throw Error("normalize should be implemented in subclass.")}_call(c){return this.normalize(c)}}class Replace extends Normalizer{normalize(c){const _=createPattern(this.config.pattern);return _===null?c:c.replaceAll(_,this.config.content)}}class NFC extends Normalizer{normalize(c){return c=c.normalize("NFC"),c}}class NFKC extends Normalizer{normalize(c){return c=c.normalize("NFKC"),c}}class NFKD extends Normalizer{normalize(c){return c=c.normalize("NFKD"),c}}class StripNormalizer extends Normalizer{normalize(c){return this.config.strip_left&&this.config.strip_right?c=c.trim():(this.config.strip_left&&(c=c.trimStart()),this.config.strip_right&&(c=c.trimEnd())),c}}class StripAccents extends Normalizer{normalize(c){return c=remove_accents(c),c}}class Lowercase extends Normalizer{normalize(c){return c=c.toLowerCase(),c}}class Prepend extends Normalizer{normalize(c){return c=this.config.prepend+c,c}}class NormalizerSequence extends Normalizer{constructor(c){super(c),this.normalizers=c.normalizers.map(_=>Normalizer.fromConfig(_))}normalize(c){return this.normalizers.reduce((_,T)=>T.normalize(_),c)}}class BertNormalizer extends Normalizer{_tokenize_chinese_chars(c){const _=[];for(let T=0;T=19968&&c<=40959||c>=13312&&c<=19903||c>=131072&&c<=173791||c>=173824&&c<=177983||c>=177984&&c<=178207||c>=178208&&c<=183983||c>=63744&&c<=64255||c>=194560&&c<=195103}stripAccents(c){return c.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}_is_control(c){switch(c){case" ":case` `:case"\r":return!1;default:return/^\p{Cc}|\p{Cf}|\p{Co}|\p{Cs}$/u.test(c)}}_clean_text(c){const _=[];for(const T of c){const C=T.charCodeAt(0);C===0||C===65533||this._is_control(T)||(/^\s$/.test(T)?_.push(" "):_.push(T))}return _.join("")}normalize(c){return this.config.clean_text&&(c=this._clean_text(c)),this.config.handle_chinese_chars&&(c=this._tokenize_chinese_chars(c)),this.config.lowercase?(c=c.toLowerCase(),this.config.strip_accents!==!1&&(c=this.stripAccents(c))):this.config.strip_accents&&(c=this.stripAccents(c)),c}}class PreTokenizer extends Callable{static fromConfig(c){if(c===null)return null;switch(c.type){case"BertPreTokenizer":return new BertPreTokenizer(c);case"Sequence":return new PreTokenizerSequence(c);case"Whitespace":return new WhitespacePreTokenizer(c);case"WhitespaceSplit":return new WhitespaceSplit(c);case"Metaspace":return new MetaspacePreTokenizer(c);case"ByteLevel":return new ByteLevelPreTokenizer(c);case"Split":return new SplitPreTokenizer(c);case"Punctuation":return new PunctuationPreTokenizer(c);case"Digits":return new DigitsPreTokenizer(c);case"Replace":return new ReplacePreTokenizer(c);default:throw new Error(`Unknown PreTokenizer type: ${c.type}`)}}pre_tokenize_text(c,_){throw Error("pre_tokenize_text should be implemented in subclass.")}pre_tokenize(c,_){return(Array.isArray(c)?c.map(T=>this.pre_tokenize_text(T,_)):this.pre_tokenize_text(c,_)).flat()}_call(c,_){return this.pre_tokenize(c,_)}}class BertPreTokenizer extends PreTokenizer{constructor(c){super(),this.pattern=new RegExp(`[^\\s${PUNCTUATION_REGEX}]+|[${PUNCTUATION_REGEX}]`,"gu")}pre_tokenize_text(c,_){return c.trim().match(this.pattern)||[]}}class ByteLevelPreTokenizer extends PreTokenizer{constructor(c){super(),this.config=c,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=BYTES_TO_UNICODE,this.text_encoder=new TextEncoder}pre_tokenize_text(c,_){return this.add_prefix_space&&!c.startsWith(" ")&&(c=" "+c),(this.use_regex?c.match(this.pattern)||[]:[c]).map(C=>Array.from(this.text_encoder.encode(C),M=>this.byte_encoder[M]).join(""))}}class SplitPreTokenizer extends PreTokenizer{constructor(c){super(),this.config=c,this.pattern=createPattern(this.config.pattern,this.config.invert)}pre_tokenize_text(c,_){return this.pattern===null?[]:this.config.invert?c.match(this.pattern)||[]:regexSplit(c,this.pattern)}}class PunctuationPreTokenizer extends PreTokenizer{constructor(c){super(),this.config=c,this.pattern=new RegExp(`[^${PUNCTUATION_REGEX}]+|[${PUNCTUATION_REGEX}]+`,"gu")}pre_tokenize_text(c,_){return c.match(this.pattern)||[]}}class DigitsPreTokenizer extends PreTokenizer{constructor(c){super(),this.config=c;const _=`[^\\d]+|\\d${this.config.individual_digits?"":"+"}`;this.pattern=new RegExp(_,"gu")}pre_tokenize_text(c,_){return c.match(this.pattern)||[]}}class PostProcessor extends Callable{constructor(c){super(),this.config=c}static fromConfig(c){if(c===null)return null;switch(c.type){case"TemplateProcessing":return new TemplateProcessing(c);case"ByteLevel":return new ByteLevelPostProcessor(c);case"RobertaProcessing":return new RobertaProcessing(c);case"BertProcessing":return new BertProcessing(c);case"Sequence":return new PostProcessorSequence(c);default:throw new Error(`Unknown PostProcessor type: ${c.type}`)}}post_process(c,..._){throw Error("post_process should be implemented in subclass.")}_call(c,..._){return this.post_process(c,..._)}}class BertProcessing extends PostProcessor{constructor(c){super(c),this.cls=c.cls[0],this.sep=c.sep[0]}post_process(c,_=null,{add_special_tokens:T=!0}={}){T&&(c=mergeArrays([this.cls],c,[this.sep]));let C=new Array(c.length).fill(0);if(_!==null){const M=T&&this instanceof RobertaProcessing?[this.sep]:[],E=T?[this.sep]:[];c=mergeArrays(c,M,_,E),C=mergeArrays(C,new Array(_.length+M.length+E.length).fill(1))}return{tokens:c,token_type_ids:C}}}class RobertaProcessing extends BertProcessing{}class TemplateProcessing extends PostProcessor{constructor(c){super(c),this.single=c.single,this.pair=c.pair}post_process(c,_=null,{add_special_tokens:T=!0}={}){const C=_===null?this.single:this.pair;let M=[],E=[];for(const P of C)"SpecialToken"in P?T&&(M.push(P.SpecialToken.id),E.push(P.SpecialToken.type_id)):"Sequence"in P&&(P.Sequence.id==="A"?(M=mergeArrays(M,c),E=mergeArrays(E,new Array(c.length).fill(P.Sequence.type_id))):P.Sequence.id==="B"&&(M=mergeArrays(M,_),E=mergeArrays(E,new Array(_.length).fill(P.Sequence.type_id))));return{tokens:M,token_type_ids:E}}}class ByteLevelPostProcessor extends PostProcessor{post_process(c,_=null){return _&&(c=mergeArrays(c,_)),{tokens:c}}}class PostProcessorSequence extends PostProcessor{constructor(c){super(c),this.processors=c.processors.map(_=>PostProcessor.fromConfig(_))}post_process(c,_=null,T={}){let C;for(const M of this.processors)if(M instanceof ByteLevelPostProcessor)c=M.post_process(c).tokens,_&&(_=M.post_process(_).tokens);else{const E=M.post_process(c,_,T);c=E.tokens,C=E.token_type_ids}return{tokens:c,token_type_ids:C}}}class Decoder extends Callable{constructor(c){super(),this.config=c,this.added_tokens=[],this.end_of_word_suffix=null,this.trim_offsets=c.trim_offsets}static fromConfig(c){if(c===null)return null;switch(c.type){case"WordPiece":return new WordPieceDecoder(c);case"Metaspace":return new MetaspaceDecoder(c);case"ByteLevel":return new ByteLevelDecoder(c);case"Replace":return new ReplaceDecoder(c);case"ByteFallback":return new ByteFallback(c);case"Fuse":return new FuseDecoder(c);case"Strip":return new StripDecoder(c);case"Sequence":return new DecoderSequence(c);case"CTC":return new CTCDecoder(c);case"BPEDecoder":return new BPEDecoder(c);default:throw new Error(`Unknown Decoder type: ${c.type}`)}}_call(c){return this.decode(c)}decode(c){return this.decode_chain(c).join("")}decode_chain(c){throw Error("`decode_chain` should be implemented in subclass.")}}class ReplaceDecoder extends Decoder{decode_chain(c){const _=createPattern(this.config.pattern);return _===null?c:c.map(T=>T.replaceAll(_,this.config.content))}}class ByteFallback extends Decoder{constructor(c){super(c),this.text_decoder=new TextDecoder}decode_chain(c){const _=[];let T=[];for(const C of c){let M=null;if(C.length===6&&C.startsWith("<0x")&&C.endsWith(">")){const E=parseInt(C.slice(3,5),16);isNaN(E)||(M=E)}if(M!==null)T.push(M);else{if(T.length>0){const E=this.text_decoder.decode(Uint8Array.from(T));_.push(E),T=[]}_.push(C)}}if(T.length>0){const C=this.text_decoder.decode(Uint8Array.from(T));_.push(C),T=[]}return _}}class FuseDecoder extends Decoder{decode_chain(c){return[c.join("")]}}class StripDecoder extends Decoder{constructor(c){super(c),this.content=this.config.content,this.start=this.config.start,this.stop=this.config.stop}decode_chain(c){return c.map(_=>{let T=0;for(let M=0;M(T!==0&&(_.startsWith(this.config.prefix)?_=_.replace(this.config.prefix,""):_=" "+_),this.cleanup&&(_=clean_up_tokenization(_)),_))}}class ByteLevelDecoder extends Decoder{constructor(c){super(c),this.byte_decoder=UNICODE_TO_BYTES,this.text_decoder=new TextDecoder("utf-8",{fatal:!1,ignoreBOM:!0}),this.end_of_word_suffix=null}convert_tokens_to_string(c){const _=c.join(""),T=new Uint8Array([..._].map(M=>this.byte_decoder[M]));return this.text_decoder.decode(T)}decode_chain(c){const _=[];let T=[];for(const C of c)this.added_tokens.find(M=>M.content===C)!==void 0?(T.length>0&&(_.push(this.convert_tokens_to_string(T)),T=[]),_.push(C)):T.push(C);return T.length>0&&_.push(this.convert_tokens_to_string(T)),_}}class CTCDecoder extends Decoder{constructor(c){super(c),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(c){if(c.length===0)return"";const _=[c[0]];for(let M=1;MM!==this.pad_token).join("");return this.cleanup&&(C=clean_up_tokenization(C).replaceAll(this.word_delimiter_token," ").trim()),C}decode_chain(c){return[this.convert_tokens_to_string(c)]}}class DecoderSequence extends Decoder{constructor(c){super(c),this.decoders=c.decoders.map(_=>Decoder.fromConfig(_))}decode_chain(c){return this.decoders.reduce((_,T)=>T.decode_chain(_),c)}}class BPEDecoder extends Decoder{constructor(c){super(c),this.suffix=this.config.suffix}decode_chain(c){return c.map((_,T)=>_.replaceAll(this.suffix,T===c.length-1?"":" "))}}class VitsDecoder extends Decoder{decode_chain(c){let _="";for(let T=1;TT.normalize("NFKC")).join("~"):c=c.normalize("NFKC"),c}}class PreTokenizerSequence extends PreTokenizer{constructor(c){super(),this.tokenizers=c.pretokenizers.map(_=>PreTokenizer.fromConfig(_))}pre_tokenize_text(c,_){return this.tokenizers.reduce((T,C)=>C.pre_tokenize(T,_),[c])}}class WhitespacePreTokenizer extends PreTokenizer{constructor(c){super()}pre_tokenize_text(c,_){return c.match(/\w+|[^\w\s]+/g)||[]}}class WhitespaceSplit extends PreTokenizer{constructor(c){super()}pre_tokenize_text(c,_){return whitespace_split(c)}}class ReplacePreTokenizer extends PreTokenizer{constructor(c){super(),this.config=c,this.pattern=createPattern(this.config.pattern),this.content=this.config.content}pre_tokenize_text(c,_){return this.pattern===null?[c]:[c.replaceAll(this.pattern,this.config.content)]}}const SPECIAL_TOKEN_ATTRIBUTES=["bos_token","eos_token","unk_token","sep_token","pad_token","cls_token","mask_token"];function padHelper(x,c,_,T){for(const C of Object.keys(x)){const M=c-x[C].length,E=_(C),P=new Array(M).fill(E);x[C]=T==="right"?mergeArrays(x[C],P):mergeArrays(P,x[C])}}function truncateHelper(x,c){for(const _ of Object.keys(x))x[_].length=c}class PreTrainedTokenizer extends Callable{constructor(_,T){super();ke(this,"return_token_type_ids",!1);ke(this,"_default_chat_template",`{% for message in messages %}{{'<|im_start|>' + message['role'] + ' ' + message['content'] + '<|im_end|>' + ' '}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant ' }}{% endif %}`);this._tokenizer_config=T,this.normalizer=Normalizer.fromConfig(_.normalizer),this.pre_tokenizer=PreTokenizer.fromConfig(_.pre_tokenizer),this.model=TokenizerModel.fromConfig(_.model,T),this.post_processor=PostProcessor.fromConfig(_.post_processor),this.decoder=Decoder.fromConfig(_.decoder),this.special_tokens=[],this.all_special_ids=[],this.added_tokens=[];for(const C of _.added_tokens){const M=new AddedToken(C);this.added_tokens.push(M),this.model.tokens_to_ids.set(M.content,M.id),this.model.vocab[M.id]=M.content,M.special&&(this.special_tokens.push(M.content),this.all_special_ids.push(M.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_regex=this.added_tokens.length>0?new RegExp(this.added_tokens.map(C=>`${C.lstrip?"\\s*":""}(${escapeRegExp(C.content)})${C.rstrip?"\\s*":""}`).join("|")):null,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.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,this.padding_side="right",this.legacy=!1,this.chat_template=T.chat_template??null,Array.isArray(this.chat_template)){const C=Object.create(null);for(const{name:M,template:E}of this.chat_template){if(typeof M!="string"||typeof E!="string")throw new Error('Chat template must be a list of objects with "name" and "template" properties');C[M]=E}this.chat_template=C}this._compiled_template_cache=new Map}getToken(..._){for(const T of _){const C=this._tokenizer_config[T];if(C)if(typeof C=="object"){if(C.__type==="AddedToken")return C.content;throw Error(`Unknown token: ${C}`)}else return C}return null}static async from_pretrained(_,{progress_callback:T=null,config:C=null,cache_dir:M=null,local_files_only:E=!1,revision:P="main",legacy:R=null}={}){const $=await loadTokenizer(_,{progress_callback:T,config:C,cache_dir:M,local_files_only:E,revision:P,legacy:R});return new this(...$)}_call(_,{text_pair:T=null,add_special_tokens:C=!0,padding:M=!1,truncation:E=null,max_length:P=null,return_tensor:R=!0,return_token_type_ids:$=null}={}){const G=Array.isArray(_);let O;if(G){if(_.length===0)throw Error("text array must be non-empty");if(T!==null){if(Array.isArray(T)){if(_.length!==T.length)throw Error("text and text_pair must have the same length")}else throw Error("text_pair must also be an array");O=_.map((F,V)=>this._encode_plus(F,T[V],{add_special_tokens:C,return_token_type_ids:$}))}else O=_.map(F=>this._encode_plus(F,null,{add_special_tokens:C,return_token_type_ids:$}))}else{if(_==null)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).");O=[this._encode_plus(_,T,{add_special_tokens:C,return_token_type_ids:$})]}if(P===null?M==="max_length"?P=this.model_max_length:P=max(O.map(F=>F.input_ids.length))[0]:E||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."),P=Math.min(P,this.model_max_length),M||E)for(let F=0;FP?E&&truncateHelper(O[F],P):M&&padHelper(O[F],P,V=>V==="input_ids"?this.pad_token_id:0,this.padding_side));const L={};if(R){if(!(M&&E)&&O.some(V=>{var W;for(const z of Object.keys(V))if(V[z].length!==((W=O[0][z])==null?void 0:W.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.");const F=[O.length,O[0].input_ids.length];for(const V of Object.keys(O[0]))L[V]=new Tensor("int64",BigInt64Array.from(O.flatMap(W=>W[V]).map(BigInt)),F)}else{for(const F of Object.keys(O[0]))L[F]=O.map(V=>V[F]);if(!G)for(const F of Object.keys(L))L[F]=L[F][0]}return L}_encode_text(_){return _===null?null:(this.added_tokens_regex?_.split(this.added_tokens_regex).filter(M=>M):[_]).map((M,E)=>{if(this.added_tokens.find(R=>R.content===M)!==void 0)return M;{if(this.remove_space===!0&&(M=M.trim().split(/\s+/).join(" ")),this.do_lowercase_and_remove_accent&&(M=lowercase_and_remove_accent(M)),this.normalizer!==null&&(M=this.normalizer(M)),M.length===0)return[];const R=this.pre_tokenizer!==null?this.pre_tokenizer(M,{section_index:E}):[M];return this.model(R)}}).flat()}_encode_plus(_,T=null,{add_special_tokens:C=!0,return_token_type_ids:M=null}={}){const E=this._encode_text(_),P=this._encode_text(T),R=this.post_processor?this.post_processor(E,P,{add_special_tokens:C}):{tokens:mergeArrays(E??[],P??[])},$=this.model.convert_tokens_to_ids(R.tokens),G={input_ids:$,attention_mask:new Array($.length).fill(1)};return(M??this.return_token_type_ids)&&R.token_type_ids&&(G.token_type_ids=R.token_type_ids),G}encode(_,T=null,{add_special_tokens:C=!0,return_token_type_ids:M=null}={}){const{input_ids:E}=this._encode_plus(_,T,{add_special_tokens:C,return_token_type_ids:M});return E}batch_decode(_,T={}){return _ instanceof Tensor&&(_=_.tolist()),_.map(C=>this.decode(C,T))}decode(_,T={}){if(_ instanceof Tensor&&(_=prepareTensorForDecode(_)),!Array.isArray(_)||_.length===0||!isIntegralNumber(_[0]))throw Error("token_ids must be a non-empty array of integers.");return this.decode_single(_,T)}decode_single(_,{skip_special_tokens:T=!1,clean_up_tokenization_spaces:C=null}){let M=this.model.convert_ids_to_tokens(_);T&&(M=M.filter(P=>!this.special_tokens.includes(P)));let E=this.decoder?this.decoder(M):M.join(" ");return this.decoder&&this.decoder.end_of_word_suffix&&(E=E.replaceAll(this.decoder.end_of_word_suffix," "),T&&(E=E.trim())),(C??this.clean_up_tokenization_spaces)&&(E=clean_up_tokenization(E)),E}get default_chat_template(){return this._warned_about_chat_template||(console.warn("No chat template is defined for this tokenizer - using a default chat template that implements the ChatML format. If the default is not appropriate for your model, please set `tokenizer.chat_template` to an appropriate template. See https://huggingface.co/docs/transformers/main/chat_templating for more information."),this._warned_about_chat_template=!0),this._default_chat_template}apply_chat_template(_,{chat_template:T=null,add_generation_prompt:C=!1,tokenize:M=!0,padding:E=!1,truncation:P=!1,max_length:R=null,return_tensor:$=!0,tokenizer_kwargs:G={},...O}={}){if(this.chat_template&&typeof this.chat_template=="object"||this.chat_template===null&&this.default_chat_template&&typeof this.default_chat_template=="object"){const W=this.chat_template??this.default_chat_template;if(T!==null&&Object.hasOwn(W,T))T=W[T];else if(T===null&&"default"in W)T=W.default;else if(T===null)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(W).sort()}.`)}else T??(T=this.chat_template??this.default_chat_template);if(typeof T!="string")throw Error(`chat_template must be a string, but got ${typeof T}`);let L=this._compiled_template_cache.get(T);L===void 0&&(L=new Template(T),this._compiled_template_cache.set(T,L));const F=Object.create(null);for(const W of SPECIAL_TOKEN_ATTRIBUTES){const z=this.getToken(W);z&&(F[W]=z)}const V=L.render({messages:_,add_generation_prompt:C,...F,...O});return M?this._call(V,{add_special_tokens:!1,padding:E,truncation:P,max_length:R,return_tensor:$,...G}).input_ids:V}}class BertTokenizer extends PreTrainedTokenizer{constructor(){super(...arguments);ke(this,"return_token_type_ids",!0)}}class AlbertTokenizer extends PreTrainedTokenizer{constructor(){super(...arguments);ke(this,"return_token_type_ids",!0)}}class MobileBertTokenizer extends PreTrainedTokenizer{constructor(){super(...arguments);ke(this,"return_token_type_ids",!0)}}class SqueezeBertTokenizer extends PreTrainedTokenizer{constructor(){super(...arguments);ke(this,"return_token_type_ids",!0)}}class DebertaTokenizer extends PreTrainedTokenizer{constructor(){super(...arguments);ke(this,"return_token_type_ids",!0)}}class DebertaV2Tokenizer extends PreTrainedTokenizer{constructor(){super(...arguments);ke(this,"return_token_type_ids",!0)}}class HerbertTokenizer extends PreTrainedTokenizer{constructor(){super(...arguments);ke(this,"return_token_type_ids",!0)}}class ConvBertTokenizer extends PreTrainedTokenizer{constructor(){super(...arguments);ke(this,"return_token_type_ids",!0)}}class RoFormerTokenizer extends PreTrainedTokenizer{constructor(){super(...arguments);ke(this,"return_token_type_ids",!0)}}class DistilBertTokenizer extends PreTrainedTokenizer{}class CamembertTokenizer extends PreTrainedTokenizer{}class XLMTokenizer extends PreTrainedTokenizer{constructor(_,T){super(_,T);ke(this,"return_token_type_ids",!0);console.warn('WARNING: `XLMTokenizer` is not yet supported by Hugging Face\'s "fast" tokenizers library. Therefore, you may experience slightly inaccurate results.')}}class ElectraTokenizer extends PreTrainedTokenizer{constructor(){super(...arguments);ke(this,"return_token_type_ids",!0)}}class T5Tokenizer extends PreTrainedTokenizer{}class GPT2Tokenizer extends PreTrainedTokenizer{constructor(){super(...arguments);ke(this,"_default_chat_template",'{% for message in messages %}" "{{ message.content }}{{ eos_token }}" "{% endfor %}')}}class BartTokenizer extends PreTrainedTokenizer{}class MBartTokenizer extends PreTrainedTokenizer{constructor(c,_){super(c,_),this.languageRegex=/^[a-z]{2}_[A-Z]{2}$/,this.language_codes=this.special_tokens.filter(T=>this.languageRegex.test(T)),this.lang_to_token=T=>T}_build_translation_inputs(c,_,T){return _build_translation_inputs(this,c,_,T)}}class MBart50Tokenizer extends MBartTokenizer{}class RobertaTokenizer extends PreTrainedTokenizer{}class BloomTokenizer extends GPT2Tokenizer{constructor(c,_){var M,E;const T=".,!?…。,、।۔،",C=(E=(M=c.pre_tokenizer)==null?void 0:M.pretokenizers[0])==null?void 0:E.pattern;C&&C.Regex===` ?[^(\\s|[${T}])]+`&&(C.Regex=` ?[^\\s${T}]+`),super(c,_)}}const SPIECE_UNDERLINE="▁";class LlamaTokenizer extends PreTrainedTokenizer{constructor(_,T){super(_,T);ke(this,"_default_chat_template",`{% if messages[0]['role'] == 'system' %}{% set loop_messages = messages[1:] %}{% set system_message = messages[0]['content'] %}{% elif USE_DEFAULT_PROMPT == true and not '<>' in messages[0]['content'] %}{% set loop_messages = messages %}{% set system_message = 'DEFAULT_SYSTEM_MESSAGE' %}{% else %}{% set loop_messages = messages %}{% set system_message = false %}{% endif %}{% for message in loop_messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{% if loop.index0 == 0 and system_message != false %}{% set content = '<> ' + system_message + ' <> ' + message['content'] %}{% else %}{% set content = message['content'] %}{% endif %}{% if message['role'] == 'user' %}{{ bos_token + '[INST] ' + content.strip() + ' [/INST]' }}{% elif message['role'] == 'system' %}{{ '<> ' + content.strip() + ' <> ' }}{% elif message['role'] == 'assistant' %}{{ ' ' + content.strip() + ' ' + eos_token }}{% endif %}{% endfor %}`);ke(this,"DEFAULT_SYSTEM_PROMPT",`You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature. If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.`);this.use_default_system_prompt=T.use_default_system_prompt??!1,this.legacy=T.legacy??!0,this.legacy||(this.normalizer=null,this.pre_tokenizer=new MetaspacePreTokenizer({replacement:SPIECE_UNDERLINE,add_prefix_space:!0,prepend_scheme:"first"}))}_encode_text(_){if(_===null)return null;if(this.legacy||_.length===0)return super._encode_text(_);let T=super._encode_text(SPIECE_UNDERLINE+_.replaceAll(SPIECE_UNDERLINE," "));return T.length>1&&T[0]===SPIECE_UNDERLINE&&this.special_tokens.includes(T[1])&&(T=T.slice(1)),T}get default_chat_template(){return super.default_chat_template.replaceAll("USE_DEFAULT_PROMPT",this.use_default_system_prompt?"true":"false").replaceAll("DEFAULT_SYSTEM_MESSAGE",this.DEFAULT_SYSTEM_PROMPT.replaceAll(` `,"\\n").replaceAll("'","\\'"))}}class CodeLlamaTokenizer extends LlamaTokenizer{}class XLMRobertaTokenizer extends PreTrainedTokenizer{}class MPNetTokenizer extends PreTrainedTokenizer{}class FalconTokenizer extends PreTrainedTokenizer{}class GPTNeoXTokenizer extends PreTrainedTokenizer{}class EsmTokenizer extends PreTrainedTokenizer{}class Qwen2Tokenizer extends PreTrainedTokenizer{}class GemmaTokenizer extends PreTrainedTokenizer{constructor(){super(...arguments);ke(this,"_default_chat_template",`{% if messages[0]['role'] == 'system' %}{{ raise_exception('System role not supported') }}{% endif %}{% for message in messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{% if (message['role'] == 'assistant') %}{% set role = 'model' %}{% else %}{% set role = message['role'] %}{% endif %}{{ '' + role + ' ' + message['content'] | trim + ' ' }}{% endfor %}{% if add_generation_prompt %}{{'model '}}{% endif %}`)}}class Grok1Tokenizer extends PreTrainedTokenizer{}function _build_translation_inputs(x,c,_,T){if(!("language_codes"in x)||!Array.isArray(x.language_codes))throw new Error("Tokenizer must have `language_codes` attribute set and it should be an array of language ids.");if(!("languageRegex"in x)||!(x.languageRegex instanceof RegExp))throw new Error("Tokenizer must have `languageRegex` attribute set and it should be a regular expression.");if(!("lang_to_token"in x)||typeof x.lang_to_token!="function")throw new Error("Tokenizer must have `lang_to_token` attribute set and it should be a function.");const C=T.src_lang,M=T.tgt_lang;if(!x.language_codes.includes(M))throw new Error(`Target language code "${M}" is not valid. Must be one of: {${x.language_codes.join(", ")}}`);if(C!==void 0){if(!x.language_codes.includes(C))throw new Error(`Source language code "${C}" is not valid. Must be one of: {${x.language_codes.join(", ")}}`);for(const E of x.post_processor.config.single)if("SpecialToken"in E&&x.languageRegex.test(E.SpecialToken.id)){E.SpecialToken.id=x.lang_to_token(C);break}}return T.forced_bos_token_id=x.model.convert_tokens_to_ids([x.lang_to_token(M)])[0],x._call(c,_)}class NllbTokenizer extends PreTrainedTokenizer{constructor(c,_){super(c,_),this.languageRegex=/^[a-z]{3}_[A-Z][a-z]{3}$/,this.language_codes=this.special_tokens.filter(T=>this.languageRegex.test(T)),this.lang_to_token=T=>T}_build_translation_inputs(c,_,T){return _build_translation_inputs(this,c,_,T)}}class M2M100Tokenizer extends PreTrainedTokenizer{constructor(c,_){super(c,_),this.languageRegex=/^__[a-z]{2,3}__$/,this.language_codes=this.special_tokens.filter(T=>this.languageRegex.test(T)).map(T=>T.slice(2,-2)),this.lang_to_token=T=>`__${T}__`}_build_translation_inputs(c,_,T){return _build_translation_inputs(this,c,_,T)}}const WHISPER_LANGUAGES=[["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"]],WHISPER_LANGUAGE_MAPPING=new Map(WHISPER_LANGUAGES),WHISPER_TO_LANGUAGE_CODE_MAPPING=new Map([...WHISPER_LANGUAGES.map(([x,c])=>[c,x]),["burmese","my"],["valencian","ca"],["flemish","nl"],["haitian","ht"],["letzeburgesch","lb"],["pushto","ps"],["panjabi","pa"],["moldavian","ro"],["moldovan","ro"],["sinhalese","si"],["castilian","es"]]);class WhisperTokenizer extends PreTrainedTokenizer{constructor(){super(...arguments);ke(this,"_default_chat_template",'{% for message in messages %}" "{{ message.content }}{{ eos_token }}" "{% endfor %}')}_decode_asr(_,{return_timestamps:T=!1,return_language:C=!1,time_precision:M=null,force_full_sequences:E=!0}={}){if(M===null)throw Error("Must specify time_precision");let P=null;const R=T==="word";function $(){return{language:P,timestamp:[null,null],text:""}}const G=[];let O=$(),L=0;const F=this.model.convert_tokens_to_ids(["<|notimestamps|>"])[0]+1;let V=[],W=[],z=!1,Z=null;const H=new Set(this.all_special_ids);for(const j of _){const X=j.tokens,K=R?j.token_timestamps:null;let q=null,J=F;if("stride"in j){const[re,ie,ae]=j.stride;if(L-=ie,Z=re-ae,ie&&(J=ie/M+F),ae)for(let ne=X.length-1;ne>=0;--ne){const te=X[ne];if(te>=F){if(q!==null&&(te-F)*M=F){const ae=(ie-F)*M+L,ne=round(ae,2);if(q!==null&&ie>=q)z=!0;else if(z||V.length>0&&ie0?(V.push(Q),R&&W.push(ee)):V.every(re=>re.length===0)&&(O=$(),V=[],Q=[],W=[],ee=[])}if(V.length>0){if(E&&T)throw new 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.");const[j,X]=this.findLongestCommonSequence(V,W),K=this.decode(j);O.text=K,R&&(O.words=this.collateWordTimestamps(j,X,P)),G.push(O)}let Y=Object.create(null);const U=G.map(j=>j.text).join("");if(T||C){for(let j=0;j0;let R=P?[]:null,$=P?T[0]:null;for(let G=1;G<_.length;++G){const O=_[G];let L=0,F=[M,M,0,0];const V=O.length;for(let j=1;jne===re[te]).length,ae=ie/j+X;ie>1&&ae>L&&(L=ae,F=[K,q,Q,ee])}const[W,z,Z,H]=F,Y=Math.floor((z+W)/2),U=Math.floor((H+Z)/2);E.push(...C.slice(0,Y)),C=O.slice(U),M=C.length,P&&(R.push(...$.slice(0,Y)),$=T[G].slice(U))}return E.push(...C),P?(R.push(...$),[E,R]):[E,[]]}collateWordTimestamps(_,T,C){const[M,E,P]=this.combineTokensIntoWords(_,C),R=[];for(let $=0;$=M){const R=round((P-M)*C,2);E.push(`<|${R}|>`),E.push([])}else E[E.length-1].push(P);return E=E.map(P=>typeof P=="string"?P:super.decode(P,T)),E.join("")}splitTokensOnUnicode(_){const T=this.decode(_,{decode_with_timestamps:!0}),C="�",M=[],E=[],P=[];let R=[],$=[],G=0;for(let O=0;O<_.length;++O){const L=_[O];R.push(L),$.push(O);const F=this.decode(R,{decode_with_timestamps:!0});(!F.includes(C)||T[G+F.indexOf(C)]===C)&&(M.push(F),E.push(R),P.push($),R=[],$=[],G+=F.length)}return[M,E,P]}splitTokensOnSpaces(_){const[T,C,M]=this.splitTokensOnUnicode(_),E=[],P=[],R=[],$=new RegExp(`^[${PUNCTUATION_REGEX}]$`,"gu");for(let G=0;G=this.model.tokens_to_ids.get("<|endoftext|>"),W=O.startsWith(" "),z=O.trim(),Z=$.test(z);if(V||W||Z||E.length===0)E.push(O),P.push(L),R.push(F);else{const H=E.length-1;E[H]+=O,P[H].push(...L),R[H].push(...F)}}return[E,P,R]}mergePunctuations(_,T,C,M,E){const P=structuredClone(_),R=structuredClone(T),$=structuredClone(C);let G=P.length-2,O=P.length-1;for(;G>=0;)P[G].startsWith(" ")&&M.includes(P[G].trim())?(P[O]=P[G]+P[O],R[O]=mergeArrays(R[G],R[O]),$[O]=mergeArrays($[G],$[O]),P[G]="",R[G]=[],$[G]=[]):O=G,--G;for(G=0,O=1;OL),R.filter(L=>L.length>0),$.filter(L=>L.length>0)]}get_decoder_prompt_ids({language:_=null,task:T=null,no_timestamps:C=!0}={}){const M=[];if(_){_=_.toLowerCase();let E=WHISPER_TO_LANGUAGE_CODE_MAPPING.get(_);if(E===void 0)if(WHISPER_LANGUAGE_MAPPING.has(_))E=_;else{const $=_.length===2?WHISPER_LANGUAGE_MAPPING.keys():WHISPER_LANGUAGE_MAPPING.values();throw new Error(`Language "${_}" is not supported. Must be one of: ${JSON.stringify($)}`)}const P=this.model.tokens_to_ids.get(`<|${E}|>`);if(P===void 0)throw new Error(`Unable to find language "${E}" in model vocabulary. Please report this issue at https://github.com/xenova/transformers.js/issues/new/choose.`);M.push(P)}else M.push(null);if(T){if(T=T.toLowerCase(),T!=="transcribe"&&T!=="translate")throw new Error(`Task "${T}" is not supported. Must be one of: ["transcribe", "translate"]`);const E=this.model.tokens_to_ids.get(`<|${T}|>`);if(E===void 0)throw new Error(`Unable to find task "${T}" in model vocabulary. Please report this issue at https://github.com/xenova/transformers.js/issues/new/choose.`);M.push(E)}else M.push(null);if(C){const E=this.model.tokens_to_ids.get("<|notimestamps|>");if(E===void 0)throw new Error('Unable to find "<|notimestamps|>" in model vocabulary. Please report this issue at https://github.com/xenova/transformers.js/issues/new/choose.');M.push(E)}return M.map((E,P)=>[P+1,E]).filter(E=>E[1]!==null)}}class CodeGenTokenizer extends PreTrainedTokenizer{}class CLIPTokenizer extends PreTrainedTokenizer{}class SiglipTokenizer extends PreTrainedTokenizer{}class MarianTokenizer extends PreTrainedTokenizer{constructor(c,_){super(c,_),this.languageRegex=/^(>>\w+<<)\s*/g,this.supported_language_codes=this.model.vocab.filter(T=>this.languageRegex.test(T)),console.warn('WARNING: `MarianTokenizer` is not yet supported by Hugging Face\'s "fast" tokenizers library. Therefore, you may experience slightly inaccurate results.')}_encode_text(c){if(c===null)return null;const[_,...T]=c.trim().split(this.languageRegex);if(T.length===0)return super._encode_text(_);if(T.length===2){const[C,M]=T;return this.supported_language_codes.includes(C)||console.warn(`Unsupported language code "${C}" detected, which may lead to unexpected behavior. Should be one of: ${JSON.stringify(this.supported_language_codes)}`),mergeArrays([C],super._encode_text(M))}}}class Wav2Vec2CTCTokenizer extends PreTrainedTokenizer{}class BlenderbotTokenizer extends PreTrainedTokenizer{constructor(){super(...arguments);ke(this,"_default_chat_template","{% for message in messages %}{% if message['role'] == 'user' %}{{ ' ' }}{% endif %}{{ message['content'] }}{% if not loop.last %}{{ ' ' }}{% endif %}{% endfor %}{{ eos_token }}")}}class BlenderbotSmallTokenizer extends BlenderbotTokenizer{}class SpeechT5Tokenizer extends PreTrainedTokenizer{}class NougatTokenizer extends PreTrainedTokenizer{}class VitsTokenizer extends PreTrainedTokenizer{constructor(c,_){super(c,_),this.decoder=new VitsDecoder({})}}class CohereTokenizer extends PreTrainedTokenizer{}class AutoTokenizer{static async from_pretrained(c,{quantized:_=!0,progress_callback:T=null,config:C=null,cache_dir:M=null,local_files_only:E=!1,revision:P="main",legacy:R=null}={}){var F;const[$,G]=await loadTokenizer(c,{quantized:_,progress_callback:T,config:C,cache_dir:M,local_files_only:E,revision:P,legacy:R}),O=((F=G.tokenizer_class)==null?void 0:F.replace(/Fast$/,""))??"PreTrainedTokenizer";let L=this.TOKENIZER_CLASS_MAPPING[O];return L||(console.warn(`Unknown tokenizer class "${O}", attempting to construct from base class.`),L=PreTrainedTokenizer),new L($,G)}}ke(AutoTokenizer,"TOKENIZER_CLASS_MAPPING",{T5Tokenizer,DistilBertTokenizer,CamembertTokenizer,DebertaTokenizer,DebertaV2Tokenizer,BertTokenizer,HerbertTokenizer,ConvBertTokenizer,RoFormerTokenizer,XLMTokenizer,ElectraTokenizer,MobileBertTokenizer,SqueezeBertTokenizer,AlbertTokenizer,GPT2Tokenizer,BartTokenizer,MBartTokenizer,MBart50Tokenizer,RobertaTokenizer,WhisperTokenizer,CodeGenTokenizer,CLIPTokenizer,SiglipTokenizer,MarianTokenizer,BloomTokenizer,NllbTokenizer,M2M100Tokenizer,LlamaTokenizer,CodeLlamaTokenizer,XLMRobertaTokenizer,MPNetTokenizer,FalconTokenizer,GPTNeoXTokenizer,EsmTokenizer,Wav2Vec2CTCTokenizer,BlenderbotTokenizer,BlenderbotSmallTokenizer,SpeechT5Tokenizer,NougatTokenizer,VitsTokenizer,Qwen2Tokenizer,GemmaTokenizer,Grok1Tokenizer,CohereTokenizer,PreTrainedTokenizer});async function loadConfig(x,c){return await getModelJSON(x,"config.json",!0,c)}class PretrainedConfig{constructor(c){this.model_type=null,this.is_encoder_decoder=!1,Object.assign(this,c)}static async from_pretrained(c,{progress_callback:_=null,config:T=null,cache_dir:C=null,local_files_only:M=!1,revision:E="main"}={}){let P=T??await loadConfig(c,{progress_callback:_,config:T,cache_dir:C,local_files_only:M,revision:E});return new this(P)}}class AutoConfig{static async from_pretrained(...c){return PretrainedConfig.from_pretrained(...c)}}class LogitsProcessorList extends Callable{constructor(){super(),this.processors=[]}push(c){this.processors.push(c)}extend(c){this.processors.push(...c)}_call(c,_){for(let T of _)this.processors.forEach(C=>C(c,T))}[Symbol.iterator](){return this.processors.values()}}class LogitsProcessor extends Callable{_call(c,_){throw Error("`_call` should be implemented in a subclass")}}class ForceTokensLogitsProcessor extends LogitsProcessor{constructor(c){super(),this.force_token_map=Object.fromEntries(c??[])}_call(c,_){let T=this.force_token_map[c.length];return exists(T)&&(_.data.fill(-1/0),_.data[T]=0),_}}class ForcedBOSTokenLogitsProcessor extends LogitsProcessor{constructor(c){super(),this.bos_token_id=c}_call(c,_){return c.length===1&&(_.data.fill(-1/0),_.data[this.bos_token_id]=0),_}}class ForcedEOSTokenLogitsProcessor extends LogitsProcessor{constructor(c,_){super(),this.max_length=c,this.forced_eos_token_id=_}_call(c,_){}}class SuppressTokensAtBeginLogitsProcessor extends LogitsProcessor{constructor(c,_){super(),this.begin_suppress_tokens=c,this.begin_index=_}_call(c,_){if(c.length===this.begin_index)for(let T of this.begin_suppress_tokens)_.data[T]=-1/0;return _}}class WhisperTimeStampLogitsProcessor extends LogitsProcessor{constructor(c){super(),this.eos_token_id=c.eos_token_id,this.no_timestamps_token_id=c.no_timestamps_token_id,this.timestamp_begin=this.no_timestamps_token_id+1,this.begin_index=(c.forced_decoder_ids||[]).length+2,c.forced_decoder_ids.slice(-1)[0][1]===this.no_timestamps_token_id&&(this.begin_index-=1),this.max_initial_timestamp_index=c.max_initial_timestamp_index}_call(c,_){const T=_.data;if(T[this.no_timestamps_token_id]=-1/0,c.length===this.begin_index-1)return T.fill(-1/0),T[this.timestamp_begin]=0,_;const C=c.slice(this.begin_index),M=C.length>=1&&C[C.length-1]>=this.timestamp_begin,E=C.length<2||C[C.length-2]>=this.timestamp_begin;if(M&&(E?T.subarray(this.timestamp_begin).fill(-1/0):T.subarray(0,this.eos_token_id).fill(-1/0)),c.length===this.begin_index&&this.max_initial_timestamp_index!==null){const G=this.timestamp_begin+this.max_initial_timestamp_index;T.subarray(G+1).fill(-1/0)}const P=log_softmax(T),R=Math.log(P.subarray(this.timestamp_begin).map(Math.exp).reduce((G,O)=>G+O)),$=max(P.subarray(0,this.timestamp_begin))[0];return R>$&&T.subarray(0,this.timestamp_begin).fill(-1/0),_}}class NoRepeatNGramLogitsProcessor extends LogitsProcessor{constructor(c){super(),this.no_repeat_ngram_size=c}getNgrams(c){const _=c.length,T=[];for(let M=0;M<_+1-this.no_repeat_ngram_size;++M){const E=[];for(let P=0;P0&&(C=C.map(M=>M/this.generation_config.temperature)),C}randomSelect(c){let _=c.reduce((C,M)=>C+M,0),T=Math.random()*_;for(let C=0;C1)return new BeamSearchSampler(c);if(c.num_return_sequences>1)throw Error(`num_return_sequences has to be 1 when doing greedy search, but is ${c.num_return_sequences}.`);return new GreedySampler(c)}}class GreedySampler extends Sampler{sample(c,_=-1){let T=this.getLogits(c,_);return[[max(T)[1],0]]}}class MultinomialSampler extends Sampler{sample(c,_=-1){let T=c.dims.at(-1);this.generation_config.top_k>0&&(T=Math.min(this.generation_config.top_k,T));const C=this.getLogits(c,_),M=getTopItems(C,T),E=softmax(M.map(P=>P[1]));return Array.from({length:this.generation_config.num_beams},()=>{const P=this.randomSelect(E);return[M[P][0],Math.log(E[P])]})}}class BeamSearchSampler extends Sampler{sample(c,_=-1){let T=c.dims.at(-1);this.generation_config.top_k>0&&(T=Math.min(this.generation_config.top_k,T));const C=this.getLogits(c,_),M=getTopItems(C,T),E=softmax(M.map(P=>P[1]));return Array.from({length:this.generation_config.num_beams},(P,R)=>[M[R][0],Math.log(E[R])])}}const{InferenceSession,Tensor:ONNXTensor,env}=ONNX,MODEL_TYPES={EncoderOnly:0,EncoderDecoder:1,Seq2Seq:2,Vision2Seq:3,DecoderOnly:4,MaskGeneration:5},MODEL_TYPE_MAPPING=new Map,MODEL_NAME_TO_CLASS_MAPPING=new Map,MODEL_CLASS_TO_NAME_MAPPING=new Map;async function constructSession(x,c,_){let T=`onnx/${c}${_.quantized?"_quantized":""}.onnx`,C=await getModelFile(x,T,!0,_);try{return await InferenceSession.create(C,{executionProviders})}catch(M){if(executionProviders.length===1&&executionProviders[0]==="wasm")throw M;return console.warn(M),console.warn("Something went wrong during model construction (most likely a missing operation). Using `wasm` as a fallback. "),await InferenceSession.create(C,{executionProviders:["wasm"]})}}function validateInputs(x,c){const _=Object.create(null),T=[];for(const E of x.inputNames){const P=c[E];if(!(P instanceof Tensor)){T.push(E);continue}_[E]=env.wasm.proxy?P.clone():P}if(T.length>0)throw new Error(`An error occurred during model execution: "Missing the following inputs: ${T.join(", ")}.`);const C=Object.keys(c).length,M=x.inputNames.length;if(C>M){let E=Object.keys(c).filter(P=>!x.inputNames.includes(P));console.warn(`WARNING: Too many inputs were provided (${C} > ${M}). The following inputs will be ignored: "${E.join(", ")}".`)}return _}async function sessionRun(x,c){const _=validateInputs(x,c);try{let T=await x.run(_);return T=replaceTensors(T),T}catch(T){throw console.error(`An error occurred during model execution: "${T}".`),console.error("Inputs given to model:",_),T}}function replaceTensors(x){for(let c in x)x[c]instanceof ONNXTensor?x[c]=new Tensor(x[c]):typeof x[c]=="object"&&replaceTensors(x[c]);return x}function toI64Tensor(x){if(x instanceof Tensor)return x;if(x.length===0)throw Error("items must be non-empty");if(Array.isArray(x[0])){if(x.some(c=>c.length!==x[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 Tensor("int64",BigInt64Array.from(x.flat().map(c=>BigInt(c))),[x.length,x[0].length])}else return new Tensor("int64",BigInt64Array.from(x.map(c=>BigInt(c))),[1,x.length])}function prepareAttentionMask(x,c){let _=x.config.pad_token_id??null,T=x.config.eos_token_id??null;isIntegralNumber(T)&&(T=[T]);let C=c.indexOf(_)!==-1,M=T===null||!T.includes(_);if(C&&M){let E=BigInt64Array.from(c.data.map(P=>P!=_));return new Tensor("int64",E,c.dims)}else return ones_like(c)}function preparePositionIds(x,c,_){if(!x.inputNames.includes("position_ids"))return;const T=new BigInt64Array(c.attention_mask.data.length);for(let C=0;C0&&M.push(new NoRepeatNGramLogitsProcessor(_.no_repeat_ngram_size)),_.bad_words_ids!==null&&M.push(new NoBadWordsLogitsProcessor(_.bad_words_ids,_.eos_token_id)),_.min_length!==null&&_.eos_token_id!==null&&_.min_length>0&&M.push(new MinLengthLogitsProcessor(_.min_length,_.eos_token_id)),_.min_new_tokens!==null&&_.eos_token_id!==null&&_.min_new_tokens>0&&M.push(new MinNewTokensLengthLogitsProcessor(T,_.min_new_tokens,_.eos_token_id)),_.forced_bos_token_id!==null&&M.push(new ForcedBOSTokenLogitsProcessor(_.forced_bos_token_id)),_.forced_eos_token_id!==null&&M.push(new ForcedEOSTokenLogitsProcessor(_.max_length,_.forced_eos_token_id)),_.begin_suppress_tokens!==null){let E=T>1||_.forced_bos_token_id===null?T:T+1;_.forced_decoder_ids!==null&&(E+=_.forced_decoder_ids[_.forced_decoder_ids.length-1][0]),M.push(new SuppressTokensAtBeginLogitsProcessor(_.begin_suppress_tokens,E))}return _.forced_decoder_ids!==null&&M.push(new ForceTokensLogitsProcessor(_.forced_decoder_ids)),C!==null&&M.extend(C),M}_get_generation_config(_){let T=new GenerationConfig(this.config);return"generation_config"in this&&Object.assign(T,this.generation_config),_!==null&&Object.assign(T,_),T}async generate(_,T=null,C=null,{inputs_attention_mask:M=null}={}){if(!this.can_generate){let Z=`The current model class (${MODEL_CLASS_TO_NAME_MAPPING.get(this.constructor)}) is not compatible with \`.generate()\`, as it doesn't have a language model head.`;const H=this.config.model_type,Y=MODEL_WITH_LM_HEAD_MAPPING_NAMES.get(H)??MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING_NAMES.get(H)??MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING_NAMES.get(H)??MODEL_FOR_VISION_2_SEQ_MAPPING_NAMES.get(H);throw Y&&(Z+=` Please use the following class instead: '${Y[0]}'`),Error(Z)}if(!(_ instanceof Tensor)&&!isTypedArray(_)&&!Array.isArray(_))throw Error(`\`inputs\` must be a Tensor, TypedArray, or Array, but is "${_.constructor.name}".`);let E;if(this.config.is_encoder_decoder)E=0;else if(E=_ instanceof Tensor?_.dims.at(-1):_.length,E===0)throw Error("Must supply a non-empty array of input token ids.");T=this._get_generation_config(T),C=C??new LogitsProcessorList,C=this._get_logits_processor(T,E,C);let P=T.eos_token_id;P!==null&&!Array.isArray(P)&&(P=[P]);let R=1;const $=R+(T.max_new_tokens??1/0),G=Number.isInteger(T.max_length)&&(T.max_new_tokens??null)===null;let O=Sampler.getSampler(T),L=this.getStartBeams(_,T,R,M);for(;L.some(z=>!z.done)&&R<$;){let z=[];for(let Z of L){if(Z.done){z.push(Z);continue}if(G&&Z.output_token_ids.length>=T.max_length){Z.done=!0,z.push(Z);continue}let H=await this.runBeam(Z);T.output_attentions&&this.addAttentionsToBeam(Z,H),T.output_scores;let Y=H.logits.slice(null,-1,null);C(Z.output_token_ids,Y);let U=O(Y);for(let[j,X]of U){let K={...Z};this.updateBeam(K,j),K.score+=X,P&&P.includes(j)&&(K.done=!0),z.push(K)}}++R,z=this.groupBeams(z).map(Z=>Z.sort((H,Y)=>Y.score-H.score).slice(0,T.num_beams)),L=z.flat(),T.callback_function&&T.callback_function(L)}const F=this.groupBeams(L),V=z=>F.map(Z=>T.num_return_sequences>1?Z.slice(0,T.num_return_sequences).map(H=>H[z]):[Z[0][z]]).flat(),W=V("output_token_ids");if(T.return_dict_in_generate){const z=V("decoder_attentions"),Z=V("cross_attentions");return{sequences:W,decoder_attentions:z,cross_attentions:Z}}else return W}addAttentionsToBeam(_,T){if(this.config.is_encoder_decoder){if(!T.cross_attentions||T.cross_attentions.length===0)throw Error("`output_attentions` is true, but the model did not produce cross-attentions. This is most likely because the model was not exported with `output_attentions=True`.");_.cross_attentions||(_.cross_attentions=[]),_.cross_attentions.push(T.cross_attentions)}if(!T.decoder_attentions||T.decoder_attentions.length===0)throw Error("`output_attentions` is true, but the model did not produce decoder-attentions. This is most likely because the model was not exported with `output_attentions=True`.");_.decoder_attentions||(_.decoder_attentions=[]),_.decoder_attentions.push(T.decoder_attentions)}groupBeams(_){const T=Object.create(null);for(const C of _)T[C.id]===void 0?T[C.id]=[C]:T[C.id].push(C);return Object.values(T)}getPastKeyValues(_,T){const C=Object.create(null);for(const M in _)if(M.startsWith("present")){let E=M.replace("present","past_key_values");T&&M.includes("encoder")?C[E]=T[E]:C[E]=_[M]}return C}getAttentions(_){const T=Object.create(null);for(const C of["cross_attentions","decoder_attentions"]){const M=[];for(const E in _)if(E.startsWith(C)){const P=E.split(".").pop();M[P]=_[E]}T[C]=M}return T}addPastKeyValues(_,T){if(T)Object.assign(_,T);else if(this.config.is_encoder_decoder&&(this.add_encoder_pkv??!0)){let M=[1,this.num_encoder_heads,0,this.encoder_dim_kv],E=[1,this.num_decoder_heads,0,this.decoder_dim_kv];for(let P=0;P{let O=Array.from({length:this.config.decoder_layers},(Z,H)=>cat(G.map(Y=>Y[H]),2)),L=stack(T.map(([Z,H])=>C?O[Z].slice(null,H,null,[0,C]):O[Z].slice(null,H)));L=L.transpose(1,0,2,3);let[F,V]=std_mean(L,-2,0,!0),W=L.clone();for(let Z=0;ZL[H+1]-L[H]),W=mergeArrays([1],V).map(Z=>!!Z),z=[];for(let Z=0;ZC*M,1);c.input_labels=new Tensor("int64",new BigInt64Array(T).fill(1n),_)}return await sessionRun(this.prompt_encoder_mask_decoder,{input_points:c.input_points,input_labels:c.input_labels,image_embeddings:c.image_embeddings,image_positional_embeddings:c.image_positional_embeddings})}async _call(c){return new SamImageSegmentationOutput(await super._call(c))}}class SamImageSegmentationOutput extends ModelOutput{constructor({iou_scores:c,pred_masks:_}){super(),this.iou_scores=c,this.pred_masks=_}}class MarianPreTrainedModel extends PreTrainedModel{}class MarianModel extends MarianPreTrainedModel{}class MarianMTModel extends MarianPreTrainedModel{constructor(c,_,T,C){super(c,_),this.decoder_merged_session=T,this.generation_config=C,this.num_decoder_layers=this.config.decoder_layers,this.num_decoder_heads=this.config.decoder_attention_heads,this.decoder_dim_kv=this.config.d_model/this.num_decoder_heads,this.num_encoder_layers=this.config.encoder_layers,this.num_encoder_heads=this.config.encoder_attention_heads,this.encoder_dim_kv=this.config.d_model/this.num_encoder_heads}}class M2M100PreTrainedModel extends PreTrainedModel{}class M2M100Model extends M2M100PreTrainedModel{}class M2M100ForConditionalGeneration extends M2M100PreTrainedModel{constructor(c,_,T,C){super(c,_),this.decoder_merged_session=T,this.generation_config=C,this.num_decoder_layers=this.config.decoder_layers,this.num_decoder_heads=this.config.decoder_attention_heads,this.decoder_dim_kv=this.config.d_model/this.num_decoder_heads,this.num_encoder_layers=this.config.encoder_layers,this.num_encoder_heads=this.config.encoder_attention_heads,this.encoder_dim_kv=this.config.d_model/this.num_encoder_heads}}class Wav2Vec2PreTrainedModel extends PreTrainedModel{}class Wav2Vec2Model extends Wav2Vec2PreTrainedModel{}class Wav2Vec2ForCTC extends Wav2Vec2PreTrainedModel{async _call(c){return new CausalLMOutput(await super._call(c))}}class Wav2Vec2ForSequenceClassification extends Wav2Vec2PreTrainedModel{async _call(c){return new SequenceClassifierOutput(await super._call(c))}}class Wav2Vec2ForAudioFrameClassification extends Wav2Vec2PreTrainedModel{async _call(c){return new TokenClassifierOutput(await super._call(c))}}class UniSpeechPreTrainedModel extends PreTrainedModel{}class UniSpeechModel extends UniSpeechPreTrainedModel{}class UniSpeechForCTC extends UniSpeechPreTrainedModel{async _call(c){return new CausalLMOutput(await super._call(c))}}class UniSpeechForSequenceClassification extends UniSpeechPreTrainedModel{async _call(c){return new SequenceClassifierOutput(await super._call(c))}}class UniSpeechSatPreTrainedModel extends PreTrainedModel{}class UniSpeechSatModel extends UniSpeechSatPreTrainedModel{}class UniSpeechSatForCTC extends UniSpeechSatPreTrainedModel{async _call(c){return new CausalLMOutput(await super._call(c))}}class UniSpeechSatForSequenceClassification extends UniSpeechSatPreTrainedModel{async _call(c){return new SequenceClassifierOutput(await super._call(c))}}class UniSpeechSatForAudioFrameClassification extends UniSpeechSatPreTrainedModel{async _call(c){return new TokenClassifierOutput(await super._call(c))}}class Wav2Vec2BertPreTrainedModel extends PreTrainedModel{}class Wav2Vec2BertModel extends Wav2Vec2BertPreTrainedModel{}class Wav2Vec2BertForCTC extends Wav2Vec2BertPreTrainedModel{async _call(c){return new CausalLMOutput(await super._call(c))}}class Wav2Vec2BertForSequenceClassification extends Wav2Vec2BertPreTrainedModel{async _call(c){return new SequenceClassifierOutput(await super._call(c))}}class HubertModel extends Wav2Vec2PreTrainedModel{}class HubertForCTC extends Wav2Vec2PreTrainedModel{async _call(c){return new CausalLMOutput(await super._call(c))}}class HubertForSequenceClassification extends Wav2Vec2PreTrainedModel{async _call(c){return new SequenceClassifierOutput(await super._call(c))}}class WavLMPreTrainedModel extends PreTrainedModel{}class WavLMModel extends WavLMPreTrainedModel{}class WavLMForCTC extends WavLMPreTrainedModel{async _call(c){return new CausalLMOutput(await super._call(c))}}class WavLMForSequenceClassification extends WavLMPreTrainedModel{async _call(c){return new SequenceClassifierOutput(await super._call(c))}}class WavLMForXVector extends WavLMPreTrainedModel{async _call(c){return new XVectorOutput(await super._call(c))}}class WavLMForAudioFrameClassification extends WavLMPreTrainedModel{async _call(c){return new TokenClassifierOutput(await super._call(c))}}class SpeechT5PreTrainedModel extends PreTrainedModel{}class SpeechT5ForSpeechToText extends SpeechT5PreTrainedModel{}class SpeechT5ForTextToSpeech extends SpeechT5PreTrainedModel{constructor(c,_,T,C){super(c,_),this.decoder_merged_session=T,this.generation_config=C,this.num_decoder_layers=this.config.decoder_layers,this.num_decoder_heads=this.config.decoder_attention_heads,this.decoder_dim_kv=this.config.hidden_size/this.num_decoder_heads,this.num_encoder_layers=this.config.encoder_layers,this.num_encoder_heads=this.config.encoder_attention_heads,this.encoder_dim_kv=this.config.hidden_size/this.num_encoder_heads}async generate_speech(c,_,{threshold:T=.5,minlenratio:C=0,maxlenratio:M=20,vocoder:E=null}={}){const P={input_ids:c},{encoder_outputs:R,encoder_attention_mask:$}=await encoderForward(this,P),G=R.dims[1]/this.config.reduction_factor,O=Math.floor(G*M),L=Math.floor(G*C),F=this.config.num_mel_bins;let V=[],W=null,z=null,Z=0;for(;;){++Z;const U=boolTensor(!!z);let j;z?j=z.output_sequence_out:j=new Tensor("float32",new Float32Array(F),[1,1,F]);let X={use_cache_branch:U,output_sequence:j,encoder_attention_mask:$,speaker_embeddings:_,encoder_hidden_states:R};this.addPastKeyValues(X,W),z=await sessionRun(this.decoder_merged_session,X),W=this.getPastKeyValues(z,W);const{prob:K,spectrum:q}=z;if(V.push(q),Z>=L&&(Array.from(K.data).filter(J=>J>=T).length>0||Z>=O))break}const H=cat(V),{waveform:Y}=await sessionRun(E.session,{spectrogram:H});return{spectrogram:H,waveform:Y}}}class SpeechT5HifiGan extends PreTrainedModel{constructor(){super(...arguments);ke(this,"main_input_name","spectrogram")}}class TrOCRPreTrainedModel extends PreTrainedModel{constructor(c,_,T){super(c,_),this.generation_config=T,this.config.pad_token_id=this.config.eos_token_id,this.num_encoder_layers=this.num_decoder_layers=this.config.decoder_layers,this.num_encoder_heads=this.num_decoder_heads=this.config.decoder_attention_heads,this.encoder_dim_kv=this.decoder_dim_kv=this.config.d_model/this.num_decoder_heads}}class TrOCRForCausalLM extends TrOCRPreTrainedModel{}class MistralPreTrainedModel extends PreTrainedModel{constructor(c,_,T){super(c,_),this.generation_config=T,this.config.pad_token_id=this.config.eos_token_id,this.num_heads=this.config.num_key_value_heads,this.num_layers=this.config.num_hidden_layers,this.dim_kv=this.config.hidden_size/this.config.num_attention_heads}}class MistralModel extends MistralPreTrainedModel{}class MistralForCausalLM extends MistralPreTrainedModel{}class Starcoder2PreTrainedModel extends PreTrainedModel{constructor(c,_,T){super(c,_),this.generation_config=T,this.config.pad_token_id=this.config.eos_token_id,this.num_heads=this.config.num_key_value_heads,this.num_layers=this.config.num_hidden_layers,this.dim_kv=this.config.hidden_size/this.config.num_attention_heads}}class Starcoder2Model extends Starcoder2PreTrainedModel{}class Starcoder2ForCausalLM extends Starcoder2PreTrainedModel{}class FalconPreTrainedModel extends PreTrainedModel{constructor(c,_,T){super(c,_),this.generation_config=T,this.config.pad_token_id=this.config.eos_token_id,this.num_heads=this.config.num_attention_heads,this.num_layers=this.config.num_hidden_layers,this.dim_kv=this.config.hidden_size/this.config.num_attention_heads}}class FalconModel extends FalconPreTrainedModel{}class FalconForCausalLM extends FalconPreTrainedModel{}class ClapPreTrainedModel extends PreTrainedModel{}class ClapModel extends ClapPreTrainedModel{}class ClapTextModelWithProjection extends ClapPreTrainedModel{static async from_pretrained(c,_={}){return _.model_file_name??(_.model_file_name="text_model"),super.from_pretrained(c,_)}}class ClapAudioModelWithProjection extends ClapPreTrainedModel{static async from_pretrained(c,_={}){return _.model_file_name??(_.model_file_name="audio_model"),super.from_pretrained(c,_)}}class VitsPreTrainedModel extends PreTrainedModel{}class VitsModel extends VitsPreTrainedModel{async _call(c){return new VitsModelOutput(await super._call(c))}}class SegformerPreTrainedModel extends PreTrainedModel{}class SegformerForImageClassification extends SegformerPreTrainedModel{}class SegformerForSemanticSegmentation extends SegformerPreTrainedModel{}class StableLmPreTrainedModel extends PreTrainedModel{constructor(c,_,T){super(c,_),this.generation_config=T,this.config.pad_token_id=this.config.eos_token_id,this.num_heads=this.config.num_attention_heads,this.num_layers=this.config.num_hidden_layers,this.dim_kv=this.config.hidden_size/this.num_heads}}class StableLmForCausalLM extends StableLmPreTrainedModel{}class EfficientNetPreTrainedModel extends PreTrainedModel{}class EfficientNetModel extends EfficientNetPreTrainedModel{}class EfficientNetForImageClassification extends EfficientNetPreTrainedModel{async _call(c){return new SequenceClassifierOutput(await super._call(c))}}class PretrainedMixin{static async from_pretrained(c,{quantized:_=!0,progress_callback:T=null,config:C=null,cache_dir:M=null,local_files_only:E=!1,revision:P="main",model_file_name:R=null}={}){let $={quantized:_,progress_callback:T,config:C,cache_dir:M,local_files_only:E,revision:P,model_file_name:R};if(C=await AutoConfig.from_pretrained(c,$),$.config||($.config=C),!this.MODEL_CLASS_MAPPINGS)throw new Error("`MODEL_CLASS_MAPPINGS` not implemented for this type of `AutoClass`: "+this.name);for(let G of this.MODEL_CLASS_MAPPINGS){const O=G.get(C.model_type);if(O)return await O[1].from_pretrained(c,$)}if(this.BASE_IF_FAIL)return console.warn(`Unknown model class "${C.model_type}", attempting to construct from base class.`),await PreTrainedModel.from_pretrained(c,$);throw Error(`Unsupported model type: ${C.model_type}`)}}ke(PretrainedMixin,"MODEL_CLASS_MAPPINGS",null),ke(PretrainedMixin,"BASE_IF_FAIL",!1);const MODEL_MAPPING_NAMES_ENCODER_ONLY=new Map([["bert",["BertModel",BertModel]],["nomic_bert",["NomicBertModel",NomicBertModel]],["roformer",["RoFormerModel",RoFormerModel]],["electra",["ElectraModel",ElectraModel]],["esm",["EsmModel",EsmModel]],["convbert",["ConvBertModel",ConvBertModel]],["camembert",["CamembertModel",CamembertModel]],["deberta",["DebertaModel",DebertaModel]],["deberta-v2",["DebertaV2Model",DebertaV2Model]],["mpnet",["MPNetModel",MPNetModel]],["albert",["AlbertModel",AlbertModel]],["distilbert",["DistilBertModel",DistilBertModel]],["roberta",["RobertaModel",RobertaModel]],["xlm",["XLMModel",XLMModel]],["xlm-roberta",["XLMRobertaModel",XLMRobertaModel]],["clap",["ClapModel",ClapModel]],["clip",["CLIPModel",CLIPModel]],["clipseg",["CLIPSegModel",CLIPSegModel]],["chinese_clip",["ChineseCLIPModel",ChineseCLIPModel]],["siglip",["SiglipModel",SiglipModel]],["mobilebert",["MobileBertModel",MobileBertModel]],["squeezebert",["SqueezeBertModel",SqueezeBertModel]],["wav2vec2",["Wav2Vec2Model",Wav2Vec2Model]],["wav2vec2-bert",["Wav2Vec2BertModel",Wav2Vec2BertModel]],["unispeech",["UniSpeechModel",UniSpeechModel]],["unispeech-sat",["UniSpeechSatModel",UniSpeechSatModel]],["hubert",["HubertModel",HubertModel]],["wavlm",["WavLMModel",WavLMModel]],["audio-spectrogram-transformer",["ASTModel",ASTModel]],["vits",["VitsModel",VitsModel]],["detr",["DetrModel",DetrModel]],["table-transformer",["TableTransformerModel",TableTransformerModel]],["vit",["ViTModel",ViTModel]],["fastvit",["FastViTModel",FastViTModel]],["mobilevit",["MobileViTModel",MobileViTModel]],["mobilevitv2",["MobileViTV2Model",MobileViTV2Model]],["owlvit",["OwlViTModel",OwlViTModel]],["owlv2",["Owlv2Model",Owlv2Model]],["beit",["BeitModel",BeitModel]],["deit",["DeiTModel",DeiTModel]],["convnext",["ConvNextModel",ConvNextModel]],["convnextv2",["ConvNextV2Model",ConvNextV2Model]],["dinov2",["Dinov2Model",Dinov2Model]],["resnet",["ResNetModel",ResNetModel]],["swin",["SwinModel",SwinModel]],["swin2sr",["Swin2SRModel",Swin2SRModel]],["donut-swin",["DonutSwinModel",DonutSwinModel]],["yolos",["YolosModel",YolosModel]],["dpt",["DPTModel",DPTModel]],["glpn",["GLPNModel",GLPNModel]],["hifigan",["SpeechT5HifiGan",SpeechT5HifiGan]],["efficientnet",["EfficientNetModel",EfficientNetModel]]]),MODEL_MAPPING_NAMES_ENCODER_DECODER=new Map([["t5",["T5Model",T5Model]],["longt5",["LongT5Model",LongT5Model]],["mt5",["MT5Model",MT5Model]],["bart",["BartModel",BartModel]],["mbart",["MBartModel",MBartModel]],["marian",["MarianModel",MarianModel]],["whisper",["WhisperModel",WhisperModel]],["m2m_100",["M2M100Model",M2M100Model]],["blenderbot",["BlenderbotModel",BlenderbotModel]],["blenderbot-small",["BlenderbotSmallModel",BlenderbotSmallModel]]]),MODEL_MAPPING_NAMES_DECODER_ONLY=new Map([["bloom",["BloomModel",BloomModel]],["gpt2",["GPT2Model",GPT2Model]],["gptj",["GPTJModel",GPTJModel]],["gpt_bigcode",["GPTBigCodeModel",GPTBigCodeModel]],["gpt_neo",["GPTNeoModel",GPTNeoModel]],["gpt_neox",["GPTNeoXModel",GPTNeoXModel]],["codegen",["CodeGenModel",CodeGenModel]],["llama",["LlamaModel",LlamaModel]],["qwen2",["Qwen2Model",Qwen2Model]],["phi",["PhiModel",PhiModel]],["mpt",["MptModel",MptModel]],["opt",["OPTModel",OPTModel]],["mistral",["MistralModel",MistralModel]],["starcoder2",["Starcoder2Model",Starcoder2Model]],["falcon",["FalconModel",FalconModel]]]),MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING_NAMES=new Map([["speecht5",["SpeechT5ForSpeechToText",SpeechT5ForSpeechToText]],["whisper",["WhisperForConditionalGeneration",WhisperForConditionalGeneration]]]),MODEL_FOR_TEXT_TO_SPECTROGRAM_MAPPING_NAMES=new Map([["speecht5",["SpeechT5ForTextToSpeech",SpeechT5ForTextToSpeech]]]),MODEL_FOR_TEXT_TO_WAVEFORM_MAPPING_NAMES=new Map([["vits",["VitsModel",VitsModel]]]),MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING_NAMES=new Map([["bert",["BertForSequenceClassification",BertForSequenceClassification]],["roformer",["RoFormerForSequenceClassification",RoFormerForSequenceClassification]],["electra",["ElectraForSequenceClassification",ElectraForSequenceClassification]],["esm",["EsmForSequenceClassification",EsmForSequenceClassification]],["convbert",["ConvBertForSequenceClassification",ConvBertForSequenceClassification]],["camembert",["CamembertForSequenceClassification",CamembertForSequenceClassification]],["deberta",["DebertaForSequenceClassification",DebertaForSequenceClassification]],["deberta-v2",["DebertaV2ForSequenceClassification",DebertaV2ForSequenceClassification]],["mpnet",["MPNetForSequenceClassification",MPNetForSequenceClassification]],["albert",["AlbertForSequenceClassification",AlbertForSequenceClassification]],["distilbert",["DistilBertForSequenceClassification",DistilBertForSequenceClassification]],["roberta",["RobertaForSequenceClassification",RobertaForSequenceClassification]],["xlm",["XLMForSequenceClassification",XLMForSequenceClassification]],["xlm-roberta",["XLMRobertaForSequenceClassification",XLMRobertaForSequenceClassification]],["bart",["BartForSequenceClassification",BartForSequenceClassification]],["mbart",["MBartForSequenceClassification",MBartForSequenceClassification]],["mobilebert",["MobileBertForSequenceClassification",MobileBertForSequenceClassification]],["squeezebert",["SqueezeBertForSequenceClassification",SqueezeBertForSequenceClassification]]]),MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING_NAMES=new Map([["bert",["BertForTokenClassification",BertForTokenClassification]],["roformer",["RoFormerForTokenClassification",RoFormerForTokenClassification]],["electra",["ElectraForTokenClassification",ElectraForTokenClassification]],["esm",["EsmForTokenClassification",EsmForTokenClassification]],["convbert",["ConvBertForTokenClassification",ConvBertForTokenClassification]],["camembert",["CamembertForTokenClassification",CamembertForTokenClassification]],["deberta",["DebertaForTokenClassification",DebertaForTokenClassification]],["deberta-v2",["DebertaV2ForTokenClassification",DebertaV2ForTokenClassification]],["mpnet",["MPNetForTokenClassification",MPNetForTokenClassification]],["distilbert",["DistilBertForTokenClassification",DistilBertForTokenClassification]],["roberta",["RobertaForTokenClassification",RobertaForTokenClassification]],["xlm",["XLMForTokenClassification",XLMForTokenClassification]],["xlm-roberta",["XLMRobertaForTokenClassification",XLMRobertaForTokenClassification]]]),MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING_NAMES=new Map([["t5",["T5ForConditionalGeneration",T5ForConditionalGeneration]],["longt5",["LongT5ForConditionalGeneration",LongT5ForConditionalGeneration]],["mt5",["MT5ForConditionalGeneration",MT5ForConditionalGeneration]],["bart",["BartForConditionalGeneration",BartForConditionalGeneration]],["mbart",["MBartForConditionalGeneration",MBartForConditionalGeneration]],["marian",["MarianMTModel",MarianMTModel]],["m2m_100",["M2M100ForConditionalGeneration",M2M100ForConditionalGeneration]],["blenderbot",["BlenderbotForConditionalGeneration",BlenderbotForConditionalGeneration]],["blenderbot-small",["BlenderbotSmallForConditionalGeneration",BlenderbotSmallForConditionalGeneration]]]),MODEL_WITH_LM_HEAD_MAPPING_NAMES=new Map([["bloom",["BloomForCausalLM",BloomForCausalLM]],["gpt2",["GPT2LMHeadModel",GPT2LMHeadModel]],["gptj",["GPTJForCausalLM",GPTJForCausalLM]],["gpt_bigcode",["GPTBigCodeForCausalLM",GPTBigCodeForCausalLM]],["gpt_neo",["GPTNeoForCausalLM",GPTNeoForCausalLM]],["gpt_neox",["GPTNeoXForCausalLM",GPTNeoXForCausalLM]],["codegen",["CodeGenForCausalLM",CodeGenForCausalLM]],["llama",["LlamaForCausalLM",LlamaForCausalLM]],["qwen2",["Qwen2ForCausalLM",Qwen2ForCausalLM]],["phi",["PhiForCausalLM",PhiForCausalLM]],["mpt",["MptForCausalLM",MptForCausalLM]],["opt",["OPTForCausalLM",OPTForCausalLM]],["mbart",["MBartForCausalLM",MBartForCausalLM]],["mistral",["MistralForCausalLM",MistralForCausalLM]],["starcoder2",["Starcoder2ForCausalLM",Starcoder2ForCausalLM]],["falcon",["FalconForCausalLM",FalconForCausalLM]],["trocr",["TrOCRForCausalLM",TrOCRForCausalLM]],["stablelm",["StableLmForCausalLM",StableLmForCausalLM]]]),MODEL_FOR_MASKED_LM_MAPPING_NAMES=new Map([["bert",["BertForMaskedLM",BertForMaskedLM]],["roformer",["RoFormerForMaskedLM",RoFormerForMaskedLM]],["electra",["ElectraForMaskedLM",ElectraForMaskedLM]],["esm",["EsmForMaskedLM",EsmForMaskedLM]],["convbert",["ConvBertForMaskedLM",ConvBertForMaskedLM]],["camembert",["CamembertForMaskedLM",CamembertForMaskedLM]],["deberta",["DebertaForMaskedLM",DebertaForMaskedLM]],["deberta-v2",["DebertaV2ForMaskedLM",DebertaV2ForMaskedLM]],["mpnet",["MPNetForMaskedLM",MPNetForMaskedLM]],["albert",["AlbertForMaskedLM",AlbertForMaskedLM]],["distilbert",["DistilBertForMaskedLM",DistilBertForMaskedLM]],["roberta",["RobertaForMaskedLM",RobertaForMaskedLM]],["xlm",["XLMWithLMHeadModel",XLMWithLMHeadModel]],["xlm-roberta",["XLMRobertaForMaskedLM",XLMRobertaForMaskedLM]],["mobilebert",["MobileBertForMaskedLM",MobileBertForMaskedLM]],["squeezebert",["SqueezeBertForMaskedLM",SqueezeBertForMaskedLM]]]),MODEL_FOR_QUESTION_ANSWERING_MAPPING_NAMES=new Map([["bert",["BertForQuestionAnswering",BertForQuestionAnswering]],["roformer",["RoFormerForQuestionAnswering",RoFormerForQuestionAnswering]],["electra",["ElectraForQuestionAnswering",ElectraForQuestionAnswering]],["convbert",["ConvBertForQuestionAnswering",ConvBertForQuestionAnswering]],["camembert",["CamembertForQuestionAnswering",CamembertForQuestionAnswering]],["deberta",["DebertaForQuestionAnswering",DebertaForQuestionAnswering]],["deberta-v2",["DebertaV2ForQuestionAnswering",DebertaV2ForQuestionAnswering]],["mpnet",["MPNetForQuestionAnswering",MPNetForQuestionAnswering]],["albert",["AlbertForQuestionAnswering",AlbertForQuestionAnswering]],["distilbert",["DistilBertForQuestionAnswering",DistilBertForQuestionAnswering]],["roberta",["RobertaForQuestionAnswering",RobertaForQuestionAnswering]],["xlm",["XLMForQuestionAnswering",XLMForQuestionAnswering]],["xlm-roberta",["XLMRobertaForQuestionAnswering",XLMRobertaForQuestionAnswering]],["mobilebert",["MobileBertForQuestionAnswering",MobileBertForQuestionAnswering]],["squeezebert",["SqueezeBertForQuestionAnswering",SqueezeBertForQuestionAnswering]]]),MODEL_FOR_VISION_2_SEQ_MAPPING_NAMES=new Map([["vision-encoder-decoder",["VisionEncoderDecoderModel",VisionEncoderDecoderModel]]]),MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING_NAMES=new Map([["vision-encoder-decoder",["VisionEncoderDecoderModel",VisionEncoderDecoderModel]]]),MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING_NAMES=new Map([["vit",["ViTForImageClassification",ViTForImageClassification]],["fastvit",["FastViTForImageClassification",FastViTForImageClassification]],["mobilevit",["MobileViTForImageClassification",MobileViTForImageClassification]],["mobilevitv2",["MobileViTV2ForImageClassification",MobileViTV2ForImageClassification]],["beit",["BeitForImageClassification",BeitForImageClassification]],["deit",["DeiTForImageClassification",DeiTForImageClassification]],["convnext",["ConvNextForImageClassification",ConvNextForImageClassification]],["convnextv2",["ConvNextV2ForImageClassification",ConvNextV2ForImageClassification]],["dinov2",["Dinov2ForImageClassification",Dinov2ForImageClassification]],["resnet",["ResNetForImageClassification",ResNetForImageClassification]],["swin",["SwinForImageClassification",SwinForImageClassification]],["segformer",["SegformerForImageClassification",SegformerForImageClassification]],["efficientnet",["EfficientNetForImageClassification",EfficientNetForImageClassification]]]),MODEL_FOR_OBJECT_DETECTION_MAPPING_NAMES=new Map([["detr",["DetrForObjectDetection",DetrForObjectDetection]],["table-transformer",["TableTransformerForObjectDetection",TableTransformerForObjectDetection]],["yolos",["YolosForObjectDetection",YolosForObjectDetection]]]),MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING_NAMES=new Map([["owlvit",["OwlViTForObjectDetection",OwlViTForObjectDetection]],["owlv2",["Owlv2ForObjectDetection",Owlv2ForObjectDetection]]]),MODEL_FOR_IMAGE_SEGMENTATION_MAPPING_NAMES=new Map([["detr",["DetrForSegmentation",DetrForSegmentation]],["clipseg",["CLIPSegForImageSegmentation",CLIPSegForImageSegmentation]]]),MODEL_FOR_SEMANTIC_SEGMENTATION_MAPPING_NAMES=new Map([["segformer",["SegformerForSemanticSegmentation",SegformerForSemanticSegmentation]]]),MODEL_FOR_MASK_GENERATION_MAPPING_NAMES=new Map([["sam",["SamModel",SamModel]]]),MODEL_FOR_CTC_MAPPING_NAMES=new Map([["wav2vec2",["Wav2Vec2ForCTC",Wav2Vec2ForCTC]],["wav2vec2-bert",["Wav2Vec2BertForCTC",Wav2Vec2BertForCTC]],["unispeech",["UniSpeechForCTC",UniSpeechForCTC]],["unispeech-sat",["UniSpeechSatForCTC",UniSpeechSatForCTC]],["wavlm",["WavLMForCTC",WavLMForCTC]],["hubert",["HubertForCTC",HubertForCTC]]]),MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING_NAMES=new Map([["wav2vec2",["Wav2Vec2ForSequenceClassification",Wav2Vec2ForSequenceClassification]],["wav2vec2-bert",["Wav2Vec2BertForSequenceClassification",Wav2Vec2BertForSequenceClassification]],["unispeech",["UniSpeechForSequenceClassification",UniSpeechForSequenceClassification]],["unispeech-sat",["UniSpeechSatForSequenceClassification",UniSpeechSatForSequenceClassification]],["wavlm",["WavLMForSequenceClassification",WavLMForSequenceClassification]],["hubert",["HubertForSequenceClassification",HubertForSequenceClassification]],["audio-spectrogram-transformer",["ASTForAudioClassification",ASTForAudioClassification]]]),MODEL_FOR_AUDIO_XVECTOR_MAPPING_NAMES=new Map([["wavlm",["WavLMForXVector",WavLMForXVector]]]),MODEL_FOR_AUDIO_FRAME_CLASSIFICATION_MAPPING_NAMES=new Map([["unispeech-sat",["UniSpeechSatForAudioFrameClassification",UniSpeechSatForAudioFrameClassification]],["wavlm",["WavLMForAudioFrameClassification",WavLMForAudioFrameClassification]],["wav2vec2",["Wav2Vec2ForAudioFrameClassification",Wav2Vec2ForAudioFrameClassification]]]),MODEL_FOR_IMAGE_MATTING_MAPPING_NAMES=new Map([["vitmatte",["VitMatteForImageMatting",VitMatteForImageMatting]]]),MODEL_FOR_IMAGE_TO_IMAGE_MAPPING_NAMES=new Map([["swin2sr",["Swin2SRForImageSuperResolution",Swin2SRForImageSuperResolution]]]),MODEL_FOR_DEPTH_ESTIMATION_MAPPING_NAMES=new Map([["dpt",["DPTForDepthEstimation",DPTForDepthEstimation]],["depth_anything",["DepthAnythingForDepthEstimation",DepthAnythingForDepthEstimation]],["glpn",["GLPNForDepthEstimation",GLPNForDepthEstimation]]]),MODEL_FOR_IMAGE_FEATURE_EXTRACTION_MAPPING_NAMES=new Map([["clip",["CLIPVisionModelWithProjection",CLIPVisionModelWithProjection]],["siglip",["SiglipVisionModel",SiglipVisionModel]]]),MODEL_CLASS_TYPE_MAPPING=[[MODEL_MAPPING_NAMES_ENCODER_ONLY,MODEL_TYPES.EncoderOnly],[MODEL_MAPPING_NAMES_ENCODER_DECODER,MODEL_TYPES.EncoderDecoder],[MODEL_MAPPING_NAMES_DECODER_ONLY,MODEL_TYPES.DecoderOnly],[MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING_NAMES,MODEL_TYPES.EncoderOnly],[MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING_NAMES,MODEL_TYPES.EncoderOnly],[MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING_NAMES,MODEL_TYPES.Seq2Seq],[MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING_NAMES,MODEL_TYPES.Seq2Seq],[MODEL_WITH_LM_HEAD_MAPPING_NAMES,MODEL_TYPES.DecoderOnly],[MODEL_FOR_MASKED_LM_MAPPING_NAMES,MODEL_TYPES.EncoderOnly],[MODEL_FOR_QUESTION_ANSWERING_MAPPING_NAMES,MODEL_TYPES.EncoderOnly],[MODEL_FOR_VISION_2_SEQ_MAPPING_NAMES,MODEL_TYPES.Vision2Seq],[MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING_NAMES,MODEL_TYPES.EncoderOnly],[MODEL_FOR_IMAGE_SEGMENTATION_MAPPING_NAMES,MODEL_TYPES.EncoderOnly],[MODEL_FOR_SEMANTIC_SEGMENTATION_MAPPING_NAMES,MODEL_TYPES.EncoderOnly],[MODEL_FOR_IMAGE_MATTING_MAPPING_NAMES,MODEL_TYPES.EncoderOnly],[MODEL_FOR_IMAGE_TO_IMAGE_MAPPING_NAMES,MODEL_TYPES.EncoderOnly],[MODEL_FOR_DEPTH_ESTIMATION_MAPPING_NAMES,MODEL_TYPES.EncoderOnly],[MODEL_FOR_OBJECT_DETECTION_MAPPING_NAMES,MODEL_TYPES.EncoderOnly],[MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING_NAMES,MODEL_TYPES.EncoderOnly],[MODEL_FOR_MASK_GENERATION_MAPPING_NAMES,MODEL_TYPES.MaskGeneration],[MODEL_FOR_CTC_MAPPING_NAMES,MODEL_TYPES.EncoderOnly],[MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING_NAMES,MODEL_TYPES.EncoderOnly],[MODEL_FOR_TEXT_TO_SPECTROGRAM_MAPPING_NAMES,MODEL_TYPES.Seq2Seq],[MODEL_FOR_TEXT_TO_WAVEFORM_MAPPING_NAMES,MODEL_TYPES.EncoderOnly],[MODEL_FOR_AUDIO_XVECTOR_MAPPING_NAMES,MODEL_TYPES.EncoderOnly],[MODEL_FOR_AUDIO_FRAME_CLASSIFICATION_MAPPING_NAMES,MODEL_TYPES.EncoderOnly],[MODEL_FOR_IMAGE_FEATURE_EXTRACTION_MAPPING_NAMES,MODEL_TYPES.EncoderOnly]];for(const[x,c]of MODEL_CLASS_TYPE_MAPPING)for(const[_,T]of x.values())MODEL_TYPE_MAPPING.set(_,c),MODEL_CLASS_TO_NAME_MAPPING.set(T,_),MODEL_NAME_TO_CLASS_MAPPING.set(_,T);const CUSTOM_MAPPING=[["CLIPTextModelWithProjection",CLIPTextModelWithProjection,MODEL_TYPES.EncoderOnly],["SiglipTextModel",SiglipTextModel,MODEL_TYPES.EncoderOnly],["ClapTextModelWithProjection",ClapTextModelWithProjection,MODEL_TYPES.EncoderOnly],["ClapAudioModelWithProjection",ClapAudioModelWithProjection,MODEL_TYPES.EncoderOnly]];for(const[x,c,_]of CUSTOM_MAPPING)MODEL_TYPE_MAPPING.set(x,_),MODEL_CLASS_TO_NAME_MAPPING.set(c,x),MODEL_NAME_TO_CLASS_MAPPING.set(x,c);class AutoModel extends PretrainedMixin{}ke(AutoModel,"MODEL_CLASS_MAPPINGS",MODEL_CLASS_TYPE_MAPPING.map(c=>c[0])),ke(AutoModel,"BASE_IF_FAIL",!0);class AutoModelForSequenceClassification extends PretrainedMixin{}ke(AutoModelForSequenceClassification,"MODEL_CLASS_MAPPINGS",[MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING_NAMES]);class AutoModelForTokenClassification extends PretrainedMixin{}ke(AutoModelForTokenClassification,"MODEL_CLASS_MAPPINGS",[MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING_NAMES]);class AutoModelForSeq2SeqLM extends PretrainedMixin{}ke(AutoModelForSeq2SeqLM,"MODEL_CLASS_MAPPINGS",[MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING_NAMES]);class AutoModelForSpeechSeq2Seq extends PretrainedMixin{}ke(AutoModelForSpeechSeq2Seq,"MODEL_CLASS_MAPPINGS",[MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING_NAMES]);class AutoModelForTextToSpectrogram extends PretrainedMixin{}ke(AutoModelForTextToSpectrogram,"MODEL_CLASS_MAPPINGS",[MODEL_FOR_TEXT_TO_SPECTROGRAM_MAPPING_NAMES]);class AutoModelForTextToWaveform extends PretrainedMixin{}ke(AutoModelForTextToWaveform,"MODEL_CLASS_MAPPINGS",[MODEL_FOR_TEXT_TO_WAVEFORM_MAPPING_NAMES]);class AutoModelForCausalLM extends PretrainedMixin{}ke(AutoModelForCausalLM,"MODEL_CLASS_MAPPINGS",[MODEL_WITH_LM_HEAD_MAPPING_NAMES]);class AutoModelForMaskedLM extends PretrainedMixin{}ke(AutoModelForMaskedLM,"MODEL_CLASS_MAPPINGS",[MODEL_FOR_MASKED_LM_MAPPING_NAMES]);class AutoModelForQuestionAnswering extends PretrainedMixin{}ke(AutoModelForQuestionAnswering,"MODEL_CLASS_MAPPINGS",[MODEL_FOR_QUESTION_ANSWERING_MAPPING_NAMES]);class AutoModelForVision2Seq extends PretrainedMixin{}ke(AutoModelForVision2Seq,"MODEL_CLASS_MAPPINGS",[MODEL_FOR_VISION_2_SEQ_MAPPING_NAMES]);class AutoModelForImageClassification extends PretrainedMixin{}ke(AutoModelForImageClassification,"MODEL_CLASS_MAPPINGS",[MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING_NAMES]);class AutoModelForImageSegmentation extends PretrainedMixin{}ke(AutoModelForImageSegmentation,"MODEL_CLASS_MAPPINGS",[MODEL_FOR_IMAGE_SEGMENTATION_MAPPING_NAMES]);class AutoModelForSemanticSegmentation extends PretrainedMixin{}ke(AutoModelForSemanticSegmentation,"MODEL_CLASS_MAPPINGS",[MODEL_FOR_SEMANTIC_SEGMENTATION_MAPPING_NAMES]);class AutoModelForObjectDetection extends PretrainedMixin{}ke(AutoModelForObjectDetection,"MODEL_CLASS_MAPPINGS",[MODEL_FOR_OBJECT_DETECTION_MAPPING_NAMES]);class AutoModelForZeroShotObjectDetection extends PretrainedMixin{}ke(AutoModelForZeroShotObjectDetection,"MODEL_CLASS_MAPPINGS",[MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING_NAMES]);class AutoModelForCTC extends PretrainedMixin{}ke(AutoModelForCTC,"MODEL_CLASS_MAPPINGS",[MODEL_FOR_CTC_MAPPING_NAMES]);class AutoModelForAudioClassification extends PretrainedMixin{}ke(AutoModelForAudioClassification,"MODEL_CLASS_MAPPINGS",[MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING_NAMES]);class AutoModelForDocumentQuestionAnswering extends PretrainedMixin{}ke(AutoModelForDocumentQuestionAnswering,"MODEL_CLASS_MAPPINGS",[MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING_NAMES]);class AutoModelForImageToImage extends PretrainedMixin{}ke(AutoModelForImageToImage,"MODEL_CLASS_MAPPINGS",[MODEL_FOR_IMAGE_TO_IMAGE_MAPPING_NAMES]);class AutoModelForDepthEstimation extends PretrainedMixin{}ke(AutoModelForDepthEstimation,"MODEL_CLASS_MAPPINGS",[MODEL_FOR_DEPTH_ESTIMATION_MAPPING_NAMES]);class AutoModelForImageFeatureExtraction extends PretrainedMixin{}ke(AutoModelForImageFeatureExtraction,"MODEL_CLASS_MAPPINGS",[MODEL_FOR_IMAGE_FEATURE_EXTRACTION_MAPPING_NAMES]);class Seq2SeqLMOutput extends ModelOutput{constructor({logits:c,past_key_values:_,encoder_outputs:T,decoder_attentions:C=null,cross_attentions:M=null}){super(),this.logits=c,this.past_key_values=_,this.encoder_outputs=T,this.decoder_attentions=C,this.cross_attentions=M}}class SequenceClassifierOutput extends ModelOutput{constructor({logits:c}){super(),this.logits=c}}class XVectorOutput extends ModelOutput{constructor({logits:c,embeddings:_}){super(),this.logits=c,this.embeddings=_}}class TokenClassifierOutput extends ModelOutput{constructor({logits:c}){super(),this.logits=c}}class MaskedLMOutput extends ModelOutput{constructor({logits:c}){super(),this.logits=c}}class QuestionAnsweringModelOutput extends ModelOutput{constructor({start_logits:c,end_logits:_}){super(),this.start_logits=c,this.end_logits=_}}class CausalLMOutput extends ModelOutput{constructor({logits:c}){super(),this.logits=c}}class ImageMattingOutput extends ModelOutput{constructor({alphas:c}){super(),this.alphas=c}}class VitsModelOutput extends ModelOutput{constructor({waveform:c,spectrogram:_}){super(),this.waveform=c,this.spectrogram=_}}const BROWSER_ENV=typeof self<"u",WEBWORKER_ENV=BROWSER_ENV&&self.constructor.name==="DedicatedWorkerGlobalScope";let createCanvasFunction,ImageDataClass,loadImageFunction;if(BROWSER_ENV)createCanvasFunction=(x,c)=>{if(!self.OffscreenCanvas)throw new Error("OffscreenCanvas not supported by this browser.");return new self.OffscreenCanvas(x,c)},loadImageFunction=self.createImageBitmap,ImageDataClass=self.ImageData;else if(sharp)loadImageFunction=async x=>{const _=(await x.metadata()).channels;let{data:T,info:C}=await x.rotate().raw().toBuffer({resolveWithObject:!0});const M=new RawImage(new Uint8ClampedArray(T),C.width,C.height,C.channels);return _!==void 0&&_!==C.channels&&M.convert(_),M};else throw new Error("Unable to load image processing library.");const RESAMPLING_MAPPING={0:"nearest",1:"lanczos",2:"bilinear",3:"bicubic",4:"box",5:"hamming"},CONTENT_TYPE_MAP=new Map([["png","image/png"],["jpg","image/jpeg"],["jpeg","image/jpeg"],["gif","image/gif"]]);class RawImage{constructor(c,_,T,C){this.data=c,this.width=_,this.height=T,this.channels=C}get size(){return[this.width,this.height]}static async read(c){if(c instanceof RawImage)return c;if(typeof c=="string"||c instanceof URL)return await this.fromURL(c);throw new Error(`Unsupported input type: ${typeof c}`)}static async fromURL(c){let _=await getFile(c);if(_.status!==200)throw new Error(`Unable to read image from "${c}" (${_.status} ${_.statusText})`);let T=await _.blob();return this.fromBlob(T)}static async fromBlob(c){if(BROWSER_ENV){let _=await loadImageFunction(c);const T=createCanvasFunction(_.width,_.height).getContext("2d");return T.drawImage(_,0,0),new this(T.getImageData(0,0,_.width,_.height).data,_.width,_.height,4)}else{let _=sharp(await c.arrayBuffer());return await loadImageFunction(_)}}static fromTensor(c,_="CHW"){if(c.dims.length!==3)throw new Error(`Tensor should have 3 dimensions, but has ${c.dims.length} dimensions.`);if(_==="CHW")c=c.transpose(1,2,0);else if(_!=="HWC")throw new Error(`Unsupported channel format: ${_}`);if(!(c.data instanceof Uint8ClampedArray||c.data instanceof Uint8Array))throw new Error(`Unsupported tensor type: ${c.type}`);switch(c.dims[2]){case 1:case 2:case 3:case 4:return new RawImage(c.data,c.dims[1],c.dims[0],c.dims[2]);default:throw new Error(`Unsupported number of channels: ${c.dims[2]}`)}}grayscale(){if(this.channels===1)return this;let c=new Uint8ClampedArray(this.width*this.height*1);switch(this.channels){case 3:case 4:for(let _=0,T=0;_=0?R=T:G=-T,C>=0?$=C:O=-C,P.drawImage(E,R,$,c,_,G,O,c,_),new RawImage(P.getImageData(0,0,c,_).data,c,_,4).convert(M)}else{let M=this.toSharp();if(T>=0&&C>=0)M=M.extract({left:Math.floor(T),top:Math.floor(C),width:c,height:_});else if(T<=0&&C<=0){let E=Math.floor(-C),P=Math.floor(-T);M=M.extend({top:E,left:P,right:c-this.width-P,bottom:_-this.height-E})}else{let E=[0,0],P=0;C<0?(E[0]=Math.floor(-C),E[1]=_-this.height-E[0]):P=Math.floor(C);let R=[0,0],$=0;T<0?(R[0]=Math.floor(-T),R[1]=c-this.width-R[0]):$=Math.floor(T),M=M.extend({top:E[0],bottom:E[1],left:R[0],right:R[1]}).extract({left:$,top:P,width:c,height:_})}return await loadImageFunction(M)}}async toBlob(c="image/png",_=1){if(!BROWSER_ENV)throw new Error("toBlob() is only supported in browser environments.");return await this.toCanvas().convertToBlob({type:c,quality:_})}toTensor(c="CHW"){let _=new Tensor("uint8",new Uint8Array(this.data),[this.height,this.width,this.channels]);if(c!=="HWC")if(c==="CHW")_=_.permute(2,0,1);else throw new Error(`Unsupported channel format: ${c}`);return _}toCanvas(){if(!BROWSER_ENV)throw new Error("toCanvas() is only supported in browser environments.");let c=this.clone().rgba(),_=createCanvasFunction(c.width,c.height),T=new ImageDataClass(c.data,c.width,c.height);return _.getContext("2d").putImageData(T,0,0),_}_update(c,_,T,C=null){return this.data=c,this.width=_,this.height=T,C!==null&&(this.channels=C),this}clone(){return new RawImage(this.data.slice(),this.width,this.height,this.channels)}convert(c){if(this.channels===c)return this;switch(c){case 1:this.grayscale();break;case 3:this.rgb();break;case 4:this.rgba();break;default:throw new Error(`Conversion failed due to unsupported number of channels: ${this.channels}`)}return this}async save(c){if(BROWSER_ENV){if(WEBWORKER_ENV)throw new Error("Unable to save an image from a Web Worker.");const _=c.split(".").pop().toLowerCase(),T=CONTENT_TYPE_MAP.get(_)??"image/png",C=await this.toBlob(T),M=URL.createObjectURL(C),E=document.createElement("a");E.href=M,E.download=c,E.click(),E.remove()}else{if(env$1.useFS)return await this.toSharp().toFile(c);throw new Error("Unable to save the image because filesystem is disabled in this environment.")}}toSharp(){if(BROWSER_ENV)throw new Error("toSharp() is only supported in server-side environments.");return sharp(this.data,{raw:{width:this.width,height:this.height,channels:this.channels}})}}async function read_audio(x,c){if(typeof AudioContext>"u")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.");const _=await(await getFile(x)).arrayBuffer(),T=new AudioContext({sampleRate:c});typeof c>"u"&&console.warn(`No sampling rate provided, using default of ${T.sampleRate}Hz.`);const C=await T.decodeAudioData(_);let M;if(C.numberOfChannels===2){const E=Math.sqrt(2),P=C.getChannelData(0),R=C.getChannelData(1);M=new Float32Array(P.length);for(let $=0;$2595*Math.log10(1+x/700),kaldi:x=>1127*Math.log(1+x/700),slaney:(x,c=1e3,_=15,T=27/Math.log(6.4))=>x>=c?_+Math.log(x/c)*T:3*x/200};function hertz_to_mel(x,c="htk"){const _=HERTZ_TO_MEL_MAPPING[c];if(!_)throw new Error('mel_scale should be one of "htk", "slaney" or "kaldi".');return typeof x=="number"?_(x):x.map(T=>_(T))}const MEL_TO_HERTZ_MAPPING={htk:x=>700*(10**(x/2595)-1),kaldi:x=>700*(Math.exp(x/1127)-1),slaney:(x,c=1e3,_=15,T=Math.log(6.4)/27)=>x>=_?c*Math.exp(T*(x-_)):200*x/3};function mel_to_hertz(x,c="htk"){const _=MEL_TO_HERTZ_MAPPING[c];if(!_)throw new Error('mel_scale should be one of "htk", "slaney" or "kaldi".');return typeof x=="number"?_(x):x.map(T=>_(T))}function _create_triangular_filter_bank(x,c){const _=Float64Array.from({length:c.length-1},(E,P)=>c[P+1]-c[P]),T=Array.from({length:x.length},()=>new Array(c.length));for(let E=0;Enew Array(x.length));for(let E=0;Ex+T*M)}function mel_filter_bank(x,c,_,T,C,M=null,E="htk",P=!1){if(M!==null&&M!=="slaney")throw new Error('norm must be one of null or "slaney"');const R=hertz_to_mel(_,E),$=hertz_to_mel(T,E),G=linspace(R,$,c+2);let O=mel_to_hertz(G,E),L;if(P){const V=C/(x*2);L=hertz_to_mel(Float64Array.from({length:x},(W,z)=>z*V),E),O=G}else L=linspace(0,Math.floor(C/2),x);const F=_create_triangular_filter_bank(L,O);if(M!==null&&M==="slaney")for(let V=0;VC)throw Error(`frame_length (${_}) may not be larger than fft_length (${C})`);if(U!==_)throw new Error(`Length of the window (${U}) must equal frame_length (${_})`);if(T<=0)throw new Error("hop_length must be greater than zero");if(M===null&&G!==null)throw new 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(E){if(P!=="reflect")throw new Error(`pad_mode="${P}" not implemented yet.`);const te=Math.floor((C-1)/2)+1;x=padReflect(x,te,te)}const j=Math.floor(1+Math.floor((x.length-_)/T)),X=R?Math.floor(C/2)+1:C;let K=j,q=j;Z!==null&&(Z>j?H&&(q=Z):q=K=Z);const J=new FFT(C),Q=new Float64Array(C),ee=new Float64Array(J.outputBufferSize),re=new Array(K);for(let te=0;te=1;--de)Q[de]-=$*Q[de-1];Q[0]*=1-$}for(let de=0;deMath.pow(P,.85));break;default:throw new Error(`Unknown window type ${c}.`)}if(_&&(E=E.subarray(0,x)),T===null)return E;if(x>T)throw new Error(`Length of the window (${x}) may not be larger than frame_length (${T})`);return E}function center_to_corners_format([x,c,_,T]){return[x-_/2,c-T/2,x+_/2,c+T/2]}function post_process_object_detection(x,c=.5,_=null,T=!1){const C=x.logits,M=x.pred_boxes,[E,P,R]=C.dims;if(_!==null&&_.length!==E)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");let $=[];for(let G=0;Gc&&Z.push(Y)}else{let Y=max(z.data)[1];if(Y===R-1)continue;Z.push(Y),H=softmax(z.data)}for(const Y of Z){let U=V[W].data;U=center_to_corners_format(U),O!==null&&(U=U.map((j,X)=>j*O[(X+1)%2])),L.boxes.push(U),L.classes.push(Y),L.scores.push(H[Y])}}$.push(L)}return $}function validate_audio_inputs(x,c){var _;if(!(x instanceof Float32Array||x instanceof Float64Array))throw new Error(`${c} expects input to be a Float32Array or a Float64Array, but got ${((_=x==null?void 0:x.constructor)==null?void 0:_.name)??typeof x} instead. If using the feature extractor directly, remember to use \`read_audio(url, sampling_rate)\` to obtain the raw audio data of the file/url.`)}function constraint_to_multiple_of(x,c,_=0,T=null){const C=x/c;let M=bankers_round(C)*c;return T!==null&&M>T&&(M=Math.floor(C)*c),M<_&&(M=Math.ceil(C)*c),M}function enforce_size_divisibility([x,c],_){return[Math.max(Math.floor(x/_),1)*_,Math.max(Math.floor(c/_),1)*_]}class FeatureExtractor extends Callable{constructor(c){super(),this.config=c}}class ImageFeatureExtractor extends FeatureExtractor{constructor(c){super(c),this.image_mean=this.config.image_mean??this.config.mean,this.image_std=this.config.image_std??this.config.std,this.resample=this.config.resample??2,this.do_rescale=this.config.do_rescale??!0,this.rescale_factor=this.config.rescale_factor??1/255,this.do_normalize=this.config.do_normalize,this.do_resize=this.config.do_resize,this.do_thumbnail=this.config.do_thumbnail,this.size=this.config.size,this.size_divisibility=this.config.size_divisibility??this.config.size_divisor,this.do_center_crop=this.config.do_center_crop,this.crop_size=this.config.crop_size,this.do_convert_rgb=this.config.do_convert_rgb??!0,this.do_crop_margin=this.config.do_crop_margin,this.pad_size=this.config.pad_size,this.do_pad=this.config.do_pad,this.do_pad&&!this.pad_size&&this.size&&this.size.width!==void 0&&this.size.height!==void 0&&(this.pad_size=this.size),this.do_flip_channel_order=this.config.do_flip_channel_order??!1}async thumbnail(c,_,T=2){const C=c.height,M=c.width,E=_.height,P=_.width;let R=Math.min(C,E),$=Math.min(M,P);return R===C&&$===M?c:(C>M?$=Math.floor(M*R/C):M>C&&(R=Math.floor(C*$/M)),await c.resize($,R,{resample:T}))}async crop_margin(c,_=200){const T=c.clone().grayscale(),C=min(T.data)[0],E=max(T.data)[0]-C;if(E===0)return c;const P=_/255;let R=T.width,$=T.height,G=0,O=0;for(let L=0;Lthis.preprocess(M)));return{pixel_values:stack(T.map(M=>M.pixel_values),0),original_sizes:T.map(M=>M.original_size),reshaped_input_sizes:T.map(M=>M.reshaped_input_size)}}}class SegformerFeatureExtractor extends ImageFeatureExtractor{post_process_semantic_segmentation(c,_=null){const T=c.logits,C=T.dims[0];if(_!==null&&_.length!==C)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");const M=[];for(let E=0;EL[H]&&(L[H]=Z[H],O.data[H]=z)}const F=new Array(R.dims[0]),V=O.data;for(let z=0;zz!==void 0);M.push({segmentation:O,labels:W})}return M}}class DPTFeatureExtractor extends ImageFeatureExtractor{}class DPTImageProcessor extends DPTFeatureExtractor{}class BitImageProcessor extends ImageFeatureExtractor{}class GLPNFeatureExtractor extends ImageFeatureExtractor{}class CLIPFeatureExtractor extends ImageFeatureExtractor{}class ChineseCLIPFeatureExtractor extends ImageFeatureExtractor{}class SiglipImageProcessor extends ImageFeatureExtractor{}class ConvNextFeatureExtractor extends ImageFeatureExtractor{constructor(c){super(c),this.crop_pct=this.config.crop_pct??224/256}async resize(c){var T;const _=(T=this.size)==null?void 0:T.shortest_edge;if(_===void 0)throw new Error("Size dictionary must contain 'shortest_edge' key.");if(_<384){const C=Math.floor(_/this.crop_pct),[M,E]=this.get_resize_output_image_size(c,{shortest_edge:C});c=await c.resize(M,E,{resample:this.resample}),c=await c.center_crop(_,_)}else c=await c.resize(_,_,{resample:this.resample});return c}}class ConvNextImageProcessor extends ConvNextFeatureExtractor{}class ViTFeatureExtractor extends ImageFeatureExtractor{}class ViTImageProcessor extends ImageFeatureExtractor{}class EfficientNetImageProcessor extends ImageFeatureExtractor{constructor(c){super(c),this.include_top=this.config.include_top??!0,this.include_top&&(this.image_std=this.image_std.map(_=>_*_))}}class MobileViTFeatureExtractor extends ImageFeatureExtractor{}class MobileViTImageProcessor extends MobileViTFeatureExtractor{}class OwlViTFeatureExtractor extends ImageFeatureExtractor{post_process_object_detection(...c){return post_process_object_detection(...c)}}class Owlv2ImageProcessor extends OwlViTFeatureExtractor{}class DeiTFeatureExtractor extends ImageFeatureExtractor{}class BeitFeatureExtractor extends ImageFeatureExtractor{}class DonutFeatureExtractor extends ImageFeatureExtractor{pad_image(c,_,T,C={}){const[M,E,P]=_;let R=this.image_mean;Array.isArray(this.image_mean)||(R=new Array(P).fill(R));let $=this.image_std;Array.isArray($)||($=new Array(P).fill(R));const G=R.map((O,L)=>-O/$[L]);return super.pad_image(c,_,T,{center:!0,constant_values:G,...C})}}class NougatImageProcessor extends DonutFeatureExtractor{}class DetrFeatureExtractor extends ImageFeatureExtractor{async _call(c){const _=await super._call(c),T=[_.pixel_values.dims[0],64,64],C=new Tensor("int64",new BigInt64Array(T.reduce((M,E)=>M*E)).fill(1n),T);return{..._,pixel_mask:C}}post_process_object_detection(...c){return post_process_object_detection(...c)}remove_low_and_no_objects(c,_,T,C){let M=[],E=[],P=[];for(let R=0;RT&&(M.push(G),E.push(F),P.push(O))}return[M,E,P]}check_segment_validity(c,_,T,C=.5,M=.8){let E=[],P=0,R=0;for(let G=0;G=C&&++R;let $=P>0&&R>0;return $&&($=P/R>M),[$,E]}compute_segments(c,_,T,C,M,E=null,P=null){let[R,$]=P??c[0].dims,G=new Tensor("int32",new Int32Array(R*$),[R,$]),O=[];if(P!==null)for(let W=0;WF[Z]&&(L[Z]=W,F[Z]=c[W].data[Z])}let V=0;for(let W=0;WC!==_.dims[M]))throw Error(`The first ${T.length} dimensions of 'input_points' and 'input_labels' must be the same.`);return new Tensor("int64",c.flat(1/0).map(BigInt),T)}async _call(c,_=null,T=null){const C=await super._call(c);if(_&&(C.input_points=this.reshape_input_points(_,C.original_sizes,C.reshaped_input_sizes)),T){if(!C.input_points)throw Error("`input_points` must be provided if `input_labels` are provided.");C.input_labels=this.add_input_labels(T,C.input_points)}return C}post_process_masks(c,_,T,{mask_threshold:C=0,binarize:M=!0,pad_size:E=null}={}){const P=[];E=E??this.pad_size;const R=[E.height,E.width];for(let $=0;$<_.length;++$){const G=_[$],O=T[$],L=c[$],F=[];for(let V=0;VC&&(Z[H]=1);z=new Tensor("bool",Z,z.dims)}F.push(z)}P.push(stack(F))}return P}}class Swin2SRImageProcessor extends ImageFeatureExtractor{pad_image(c,_,T,C={}){const[M,E,P]=_;return super.pad_image(c,_,{width:E+(T-E%T)%T,height:M+(T-M%T)%T},{mode:"symmetric",center:!1,constant_values:-1,...C})}}class VitMatteImageProcessor extends ImageFeatureExtractor{async _call(c,_){Array.isArray(c)||(c=[c]),Array.isArray(_)||(_=[_]);const T=await Promise.all(c.map(E=>this.preprocess(E))),C=await Promise.all(_.map(E=>this.preprocess(E,{do_normalize:!1,do_convert_rgb:!1,do_convert_grayscale:!0})));return{pixel_values:stack(T.map((E,P)=>cat([E.pixel_values,C[P].pixel_values],0)),0),original_sizes:T.map(E=>E.original_size),reshaped_input_sizes:T.map(E=>E.reshaped_input_size)}}}class WhisperFeatureExtractor extends FeatureExtractor{constructor(c){var _;super(c),(_=this.config).mel_filters??(_.mel_filters=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=window_function(this.config.n_fft,"hann")}_extract_fbank_features(c){const{data:_,dims:T}=spectrogram(c,this.window,this.config.n_fft,this.config.hop_length,{power:2,mel_filters:this.config.mel_filters,log_mel:"log10",max_num_frames:this.config.nb_max_frames}),C=max(_)[0];for(let M=0;M<_.length;++M)_[M]=(Math.max(_[M],C-8)+4)/4;return{data:_,dims:T}}async _call(c){validate_audio_inputs(c,"WhisperFeatureExtractor");let _;c.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`."),_=c.slice(0,this.config.n_samples)):(_=new Float32Array(this.config.n_samples),_.set(c));const{data:T,dims:C}=this._extract_fbank_features(_);return{input_features:new Tensor("float32",T,[1,...C])}}}class Wav2Vec2FeatureExtractor extends FeatureExtractor{_zero_mean_unit_var_norm(c){const T=c.reduce((M,E)=>M+E,0)/c.length,C=c.reduce((M,E)=>M+(E-T)**2,0)/c.length;return c.map(M=>(M-T)/Math.sqrt(C+1e-7))}async _call(c){validate_audio_inputs(c,"Wav2Vec2FeatureExtractor"),c instanceof Float64Array&&(c=new Float32Array(c));let _=c;this.config.do_normalize&&(_=this._zero_mean_unit_var_norm(_));const T=[1,_.length];return{input_values:new Tensor("float32",_,T),attention_mask:new Tensor("int64",new BigInt64Array(_.length).fill(1n),T)}}}class SeamlessM4TFeatureExtractor extends FeatureExtractor{constructor(c){super(c);const _=this.config.sampling_rate,T=mel_filter_bank(256,this.config.num_mel_bins,20,Math.floor(_/2),_,null,"kaldi",!0);for(let C=0;CT*32768),spectrogram(c,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:_,transpose:!0})}async _call(c,{padding:_=!0,pad_to_multiple_of:T=2,do_normalize_per_mel_bins:C=!0,return_attention_mask:M=!0}={}){validate_audio_inputs(c,"SeamlessM4TFeatureExtractor");let E=this._extract_fbank_features(c,this.config.max_length);if(C){const[V,W]=E.dims;for(let z=0;z0){const Z=new Float32Array(W*(V+z));Z.set(E.data),Z.fill(this.config.padding_value,E.data.length);const H=V+z;E={data:Z,dims:[H,W]},M&&(P=new Tensor("int64",new BigInt64Array(H),[1,H]),P.data.fill(1n,0,V))}}const[R,$]=E.dims,G=this.config.stride;if(R%G!==0)throw new Error(`The number of frames (${R}) must be a multiple of the stride (${G}).`);const L=new Tensor("float32",E.data,E.dims).view(1,Math.floor(R/G),$*G),F={input_features:L};if(M){const V=L.dims[1],W=new Tensor("int64",new BigInt64Array(V),[1,V]);if(P)for(let z=1,Z=0;z0)if(T==="rand_trunc"){E=!0;const R=Math.floor(Math.random()*(P+1));c=c.subarray(R,R+_),M=this._extract_fbank_features(c,this.mel_filters_slaney,this.config.nb_max_samples),M.dims=[1,...M.dims]}else throw new Error(`Truncation strategy "${T}" not implemented`);else{if(P<0){let R=new Float64Array(_);if(R.set(c),C==="repeat")for(let $=c.length;$<_;$+=c.length)R.set(c.subarray(0,Math.min(c.length,_-$)),$);else if(C==="repeatpad")for(let $=c.length;$<-P;$+=c.length)R.set(c,$);c=R}if(T==="fusion")throw new Error(`Truncation strategy "${T}" not implemented`);M=this._extract_fbank_features(c,this.mel_filters_slaney,this.config.nb_max_samples),M.dims=[1,...M.dims]}return{...M,longer:E}}_extract_fbank_features(c,_,T=null){return spectrogram(c,this.window,this.config.fft_window_size,this.config.hop_length,{power:2,mel_filters:_,log_mel:"dB",max_num_frames:T,do_pad:!1,transpose:!0})}async _call(c,{max_length:_=null}={}){validate_audio_inputs(c,"ClapFeatureExtractor");const T=this._get_input_mel(c,_??this.config.nb_max_samples,this.config.truncation,this.config.padding);return{input_features:new Tensor("float32",T.data,[1,...T.dims])}}}class SpeechT5FeatureExtractor extends FeatureExtractor{}class Processor extends Callable{constructor(c){super(),this.feature_extractor=c}async _call(c,..._){return await this.feature_extractor(c,..._)}}class SamProcessor extends Processor{async _call(...c){return await this.feature_extractor(...c)}post_process_masks(...c){return this.feature_extractor.post_process_masks(...c)}reshape_input_points(...c){return this.feature_extractor.reshape_input_points(...c)}}class WhisperProcessor extends Processor{async _call(c){return await this.feature_extractor(c)}}class Wav2Vec2ProcessorWithLM extends Processor{async _call(c){return await this.feature_extractor(c)}}class SpeechT5Processor extends Processor{async _call(c){return await this.feature_extractor(c)}}class OwlViTProcessor extends Processor{}class AutoProcessor{static async from_pretrained(c,{progress_callback:_=null,config:T=null,cache_dir:C=null,local_files_only:M=!1,revision:E="main"}={}){let P=T??await getModelJSON(c,"preprocessor_config.json",!0,{progress_callback:_,config:T,cache_dir:C,local_files_only:M,revision:E}),R=P.feature_extractor_type??P.image_processor_type,$=this.FEATURE_EXTRACTOR_CLASS_MAPPING[R];if(!$)if(P.size!==void 0)console.warn(`Feature extractor type "${R}" not found, assuming ImageFeatureExtractor due to size parameter in config.`),$=ImageFeatureExtractor;else throw new Error(`Unknown Feature Extractor type: ${R}`);let G=this.PROCESSOR_CLASS_MAPPING[P.processor_class]??Processor,O=new $(P);return new G(O)}}ke(AutoProcessor,"FEATURE_EXTRACTOR_CLASS_MAPPING",{ImageFeatureExtractor,WhisperFeatureExtractor,ViTFeatureExtractor,MobileViTFeatureExtractor,MobileViTImageProcessor,OwlViTFeatureExtractor,Owlv2ImageProcessor,CLIPFeatureExtractor,ChineseCLIPFeatureExtractor,SiglipImageProcessor,ConvNextFeatureExtractor,ConvNextImageProcessor,SegformerFeatureExtractor,BitImageProcessor,DPTImageProcessor,DPTFeatureExtractor,GLPNFeatureExtractor,BeitFeatureExtractor,DeiTFeatureExtractor,DetrFeatureExtractor,YolosFeatureExtractor,DonutFeatureExtractor,NougatImageProcessor,EfficientNetImageProcessor,ViTImageProcessor,VitMatteImageProcessor,SamImageProcessor,Swin2SRImageProcessor,Wav2Vec2FeatureExtractor,SeamlessM4TFeatureExtractor,SpeechT5FeatureExtractor,ASTFeatureExtractor,ClapFeatureExtractor}),ke(AutoProcessor,"PROCESSOR_CLASS_MAPPING",{WhisperProcessor,Wav2Vec2ProcessorWithLM,SamProcessor,SpeechT5Processor,OwlViTProcessor});async function prepareImages(x){return Array.isArray(x)||(x=[x]),await Promise.all(x.map(c=>RawImage.read(c)))}async function prepareAudios(x,c){return Array.isArray(x)||(x=[x]),await Promise.all(x.map(_=>typeof _=="string"||_ instanceof URL?read_audio(_,c):_ instanceof Float64Array?new Float32Array(_):_))}function get_bounding_box(x,c){c&&(x=x.map(E=>E|0));const[_,T,C,M]=x;return{xmin:_,ymin:T,xmax:C,ymax:M}}class Pipeline extends Callable{constructor({task:c,model:_,tokenizer:T=null,processor:C=null}){super(),this.task=c,this.model=_,this.tokenizer=T,this.processor=C}async dispose(){await this.model.dispose()}}class TextClassificationPipeline extends Pipeline{constructor(c){super(c)}async _call(c,{topk:_=1}={}){const T=this.tokenizer(c,{padding:!0,truncation:!0}),C=await this.model(T),M=this.model.config.problem_type==="multi_label_classification"?R=>R.sigmoid().data:R=>softmax(R.data),E=this.model.config.id2label,P=[];for(const R of C.logits){const $=M(R),O=getTopItems($,_).map(L=>({label:E[L[0]],score:L[1]}));_===1?P.push(...O):P.push(O)}return Array.isArray(c)||_===1?P:P[0]}}class TokenClassificationPipeline extends Pipeline{constructor(c){super(c)}async _call(c,{ignore_labels:_=["O"]}={}){const T=Array.isArray(c),C=this.tokenizer(T?c:[c],{padding:!0,truncation:!0}),E=(await this.model(C)).logits,P=this.model.config.id2label,R=[];for(let $=0;$[F,V]).filter(F=>F[1]>$),O=Array.from(softmax(M.end_logits[P].data)).map((F,V)=>[F,V]).filter(F=>F[1]>$),L=product(G,O).filter(F=>F[0][1]<=F[1][1]).map(F=>[F[0][1],F[1][1],F[0][0]*F[1][0]]).sort((F,V)=>V[2]-F[2]);for(let F=0;F{const F=[...P];return F[R]=L[0],{score:L[1],token:L[0],token_str:this.tokenizer.model.vocab[L[0]],sequence:this.tokenizer.decode(F,{skip_special_tokens:!0})}}))}return Array.isArray(c)?M:M[0]}}class Text2TextGenerationPipeline extends Pipeline{constructor(_){super(_);ke(this,"_key","generated_text")}async _call(_,T={}){Array.isArray(_)||(_=[_]),this.model.config.prefix&&(_=_.map($=>this.model.config.prefix+$));const C=this.model.config.task_specific_params;C&&C[this.task]&&C[this.task].prefix&&(_=_.map($=>C[this.task].prefix+$));const M=this.tokenizer,E={padding:!0,truncation:!0};let P;this instanceof TranslationPipeline&&"_build_translation_inputs"in M?P=M._build_translation_inputs(_,E,T).input_ids:P=M(_,E).input_ids;const R=await this.model.generate(P,T);return M.batch_decode(R,{skip_special_tokens:!0}).map($=>({[this._key]:$}))}}class SummarizationPipeline extends Text2TextGenerationPipeline{constructor(_){super(_);ke(this,"_key","summary_text")}}class TranslationPipeline extends Text2TextGenerationPipeline{constructor(_){super(_);ke(this,"_key","translation_text")}}function isChat(x){return Array.isArray(x)&&x.every(c=>"role"in c&&"content"in c)}class TextGenerationPipeline extends Pipeline{constructor(c){super(c)}async _call(c,_={}){let T=!1,C=!1,M;if(typeof c=="string")M=c=[c];else if(Array.isArray(c)&&c.every(V=>typeof V=="string"))T=!0,M=c;else{if(isChat(c))c=[c];else if(Array.isArray(c)&&c.every(isChat))T=!0;else throw new Error("Input must be a string, an array of strings, a Chat, or an array of Chats");C=!0,M=c.map(V=>this.tokenizer.apply_chat_template(V,{tokenize:!1,add_generation_prompt:!0}))}const E=_.add_special_tokens??!1,P=C?!1:_.return_full_text??!0;this.tokenizer.padding_side="left";const{input_ids:R,attention_mask:$}=this.tokenizer(M,{add_special_tokens:E,padding:!0,truncation:!0}),G=await this.model.generate(R,_,null,{inputs_attention_mask:$});let O=this.tokenizer.batch_decode(G,{skip_special_tokens:!0}),L;!P&&R.dims.at(-1)>0&&(L=this.tokenizer.batch_decode(R,{skip_special_tokens:!0}).map(V=>V.length));const F=Array.from({length:c.length},V=>[]);for(let V=0;V[_.toLowerCase(),T])),this.entailment_id=this.label2id.entailment,this.entailment_id===void 0&&(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,this.contradiction_id===void 0&&(console.warn("Could not find 'contradiction' in label2id mapping. Using 0 as contradiction_id."),this.contradiction_id=0)}async _call(c,_,{hypothesis_template:T="This example is {}.",multi_label:C=!1}={}){const M=Array.isArray(c);M||(c=[c]),Array.isArray(_)||(_=[_]);const E=_.map($=>T.replace("{}",$)),P=C||_.length===1,R=[];for(const $ of c){const G=[];for(const F of E){const V=this.tokenizer($,{text_pair:F,padding:!0,truncation:!0}),W=await this.model(V);P?G.push([W.logits.data[this.contradiction_id],W.logits.data[this.entailment_id]]):G.push(W.logits.data[this.entailment_id])}const L=(P?G.map(F=>softmax(F)[1]):softmax(G)).map((F,V)=>[F,V]).sort((F,V)=>V[0]-F[0]);R.push({sequence:$,labels:L.map(F=>_[F[1]]),scores:L.map(F=>F[0])})}return M?R:R[0]}}class FeatureExtractionPipeline extends Pipeline{constructor(c){super(c)}async _call(c,{pooling:_="none",normalize:T=!1,quantize:C=!1,precision:M="binary"}={}){const E=this.tokenizer(c,{padding:!0,truncation:!0}),P=await this.model(E);let R=P.last_hidden_state??P.logits??P.token_embeddings;if(_!=="none")if(_==="mean")R=mean_pooling(R,E.attention_mask);else if(_==="cls")R=R.slice(null,0);else throw Error(`Pooling method '${_}' not supported.`);return T&&(R=R.normalize(2,-1)),C&&(R=quantize_embeddings(R,M)),R}}class ImageFeatureExtractionPipeline extends Pipeline{constructor(c){super(c)}async _call(c,{pool:_=null}={}){const T=await prepareImages(c),{pixel_values:C}=await this.processor(T),M=await this.model({pixel_values:C});let E;if(_){if(!("pooler_output"in M))throw Error("No pooled output was returned. Make sure the model has a 'pooler' layer when using the 'pool' option.");E=M.pooler_output}else E=M.last_hidden_state??M.logits??M.image_embeds;return E}}class AudioClassificationPipeline extends Pipeline{constructor(c){super(c)}async _call(c,{topk:_=null}={}){const T=!Array.isArray(c),C=this.processor.feature_extractor.config.sampling_rate,M=await prepareAudios(c,C),E=this.model.config.id2label,P=[];for(const R of M){const $=await this.processor(R),O=(await this.model($)).logits[0],F=getTopItems(softmax(O.data),_).map(V=>({label:E[V[0]],score:V[1]}));_===1?P.push(...F):P.push(F)}return!T||_===1?P:P[0]}}class ZeroShotAudioClassificationPipeline extends Pipeline{constructor(c){super(c)}async _call(c,_,{hypothesis_template:T="This is a sound of {}."}={}){const C=!Array.isArray(c);C&&(c=[c]);const M=_.map(G=>T.replace("{}",G)),E=this.tokenizer(M,{padding:!0,truncation:!0}),P=this.processor.feature_extractor.config.sampling_rate,R=await prepareAudios(c,P),$=[];for(const G of R){const O=await this.processor(G),L=await this.model({...E,...O}),F=softmax(L.logits_per_audio.data);$.push([...F].map((V,W)=>({score:V,label:_[W]})))}return C?$[0]:$}}class AutomaticSpeechRecognitionPipeline extends Pipeline{constructor(c){super(c)}async _call(c,_={}){switch(this.model.config.model_type){case"whisper":return this._call_whisper(c,_);case"wav2vec2":case"wav2vec2-bert":case"unispeech":case"unispeech-sat":case"hubert":return this._call_wav2vec2(c,_);default:throw new Error(`AutomaticSpeechRecognitionPipeline does not support model type '${this.model.config.model_type}'.`)}}async _call_wav2vec2(c,_={}){_.language&&console.warn('`language` parameter is not yet supported for `wav2vec2` models, defaulting to "English".'),_.task&&console.warn('`task` parameter is not yet supported for `wav2vec2` models, defaulting to "transcribe".');const T=!Array.isArray(c);T&&(c=[c]);const C=this.processor.feature_extractor.config.sampling_rate,M=await prepareAudios(c,C),E=[];for(const P of M){const R=await this.processor(P),G=(await this.model(R)).logits[0],O=[];for(const F of G)O.push(max(F.data)[1]);const L=this.tokenizer.decode(O);E.push({text:L})}return T?E[0]:E}async _call_whisper(c,_={}){const T=_.return_timestamps??!1,C=_.chunk_length_s??0,M=_.chunk_callback??null,E=_.force_full_sequences??!1;let P=_.stride_length_s??null;T==="word"&&(_.return_token_timestamps=!0);const R=pop(_,"language",null),$=pop(_,"task",null);if(R||$||T){if(_.forced_decoder_ids)throw new Error("Cannot specify `language`/`task`/`return_timestamps` and `forced_decoder_ids` at the same time.");const z=this.tokenizer.get_decoder_prompt_ids({language:R,task:$,no_timestamps:!T});z.length>0&&(_.forced_decoder_ids=z)}const G=!Array.isArray(c);G&&(c=[c]);const O=this.processor.feature_extractor.config.chunk_length/this.model.config.max_source_positions,L=this.processor.feature_extractor.config.hop_length,F=this.processor.feature_extractor.config.sampling_rate,V=await prepareAudios(c,F),W=[];for(const z of V){let Z=[];if(C>0){if(P===null)P=C/6;else if(C<=P)throw Error("`chunk_length_s` must be larger than `stride_length_s`.");const U=F*C,j=F*P,X=U-2*j;let K=0;for(;K=z.length;Z.push({stride:[q.length,Q?0:j,ee?0:j],input_features:J.input_features,is_last:ee}),K+=X}}else Z=[{stride:[z.length,0,0],input_features:(await this.processor(z)).input_features,is_last:!0}];for(const U of Z){_.num_frames=Math.floor(U.stride[0]/L);const j=await this.model.generate(U.input_features,_);T==="word"?(U.tokens=j.sequences[0],U.token_timestamps=j.token_timestamps.tolist()[0].map(X=>round(X,2))):U.tokens=j[0],U.stride=U.stride.map(X=>X/F),M!==null&&M(U)}const[H,Y]=this.tokenizer._decode_asr(Z,{time_precision:O,return_timestamps:T,force_full_sequences:E});W.push({text:H,...Y})}return G?W[0]:W}}class ImageToTextPipeline extends Pipeline{constructor(c){super(c)}async _call(c,_={}){const T=Array.isArray(c),C=await prepareImages(c),{pixel_values:M}=await this.processor(C),E=[];for(const P of M){P.dims=[1,...P.dims];const R=await this.model.generate(P,_),$=this.tokenizer.batch_decode(R,{skip_special_tokens:!0}).map(G=>({generated_text:G.trim()}));E.push($)}return T?E:E[0]}}class ImageClassificationPipeline extends Pipeline{constructor(c){super(c)}async _call(c,{topk:_=1}={}){const T=Array.isArray(c),C=await prepareImages(c),{pixel_values:M}=await this.processor(C),E=await this.model({pixel_values:M}),P=this.model.config.id2label,R=[];for(const $ of E.logits){const O=getTopItems(softmax($.data),_).map(L=>({label:P[L[0]],score:L[1]}));_===1?R.push(...O):R.push(O)}return T||_===1?R:R[0]}}class ImageSegmentationPipeline extends Pipeline{constructor(c){super(c),this.subtasks_mapping={panoptic:"post_process_panoptic_segmentation",instance:"post_process_instance_segmentation",semantic:"post_process_semantic_segmentation"}}async _call(c,{threshold:_=.5,mask_threshold:T=.5,overlap_mask_area_threshold:C=.8,label_ids_to_fuse:M=null,target_sizes:E=null,subtask:P=null}={}){if(Array.isArray(c)&&c.length!==1)throw Error("Image segmentation pipeline currently only supports a batch size of 1.");const $=await prepareImages(c),G=$.map(Z=>[Z.height,Z.width]),{pixel_values:O,pixel_mask:L}=await this.processor($),F=await this.model({pixel_values:O,pixel_mask:L});let V=null;if(P!==null)V=this.subtasks_mapping[P];else for(let[Z,H]of Object.entries(this.subtasks_mapping))if(H in this.processor.feature_extractor){V=this.processor.feature_extractor[H].bind(this.processor.feature_extractor),P=Z;break}const W=this.model.config.id2label,z=[];if(P==="panoptic"||P==="instance"){const Z=V(F,_,T,C,M,E??G)[0],H=Z.segmentation;for(const Y of Z.segments_info){const U=new Uint8ClampedArray(H.data.length);for(let X=0;XT.replace("{}",L)),P=this.tokenizer(E,{padding:this.model.config.model_type==="siglip"?"max_length":!0,truncation:!0}),{pixel_values:R}=await this.processor(M),$=await this.model({...P,pixel_values:R}),G=this.model.config.model_type==="siglip"?L=>L.sigmoid().data:L=>softmax(L.data),O=[];for(const L of $.logits_per_image){const V=[...G(L)].map((W,z)=>({score:W,label:_[z]}));V.sort((W,z)=>z.score-W.score),O.push(V)}return C?O:O[0]}}class ObjectDetectionPipeline extends Pipeline{constructor(c){super(c)}async _call(c,{threshold:_=.9,percentage:T=!1}={}){const C=Array.isArray(c);if(C&&c.length!==1)throw Error("Object detection pipeline currently only supports a batch size of 1.");const M=await prepareImages(c),E=T?null:M.map(F=>[F.height,F.width]),{pixel_values:P,pixel_mask:R}=await this.processor(M),$=await this.model({pixel_values:P,pixel_mask:R}),G=this.processor.feature_extractor.post_process_object_detection($,_,E),O=this.model.config.id2label,L=G.map(F=>F.boxes.map((V,W)=>({score:F.scores[W],label:O[F.classes[W]],box:get_bounding_box(V,!T)})));return C?L:L[0]}}class ZeroShotObjectDetectionPipeline extends Pipeline{constructor(c){super(c)}async _call(c,_,{threshold:T=.1,topk:C=null,percentage:M=!1}={}){const E=Array.isArray(c),P=await prepareImages(c),R=this.tokenizer(_,{padding:!0,truncation:!0}),$=await this.processor(P),G=[];for(let O=0;O({score:z.scores[Y],label:_[z.classes[Y]],box:get_bounding_box(H,!M)})).sort((H,Y)=>Y.score-H.score);C!==null&&(Z=Z.slice(0,C)),G.push(Z)}return E?G:G[0]}}class DocumentQuestionAnsweringPipeline extends Pipeline{constructor(c){super(c)}async _call(c,_,T={}){const C=(await prepareImages(c))[0],{pixel_values:M}=await this.processor(C),E=`${_}`,P=this.tokenizer(E,{add_special_tokens:!1,padding:!0,truncation:!0}).input_ids,R=await this.model.generate(M,{...T,decoder_input_ids:P,max_length:this.model.config.decoder.max_position_embeddings}),G=this.tokenizer.batch_decode(R)[0].match(/(.*?)<\/s_answer>/);let O=null;return G&&G.length>=2&&(O=G[1].trim()),[{answer:O}]}}class TextToAudioPipeline extends Pipeline{constructor(_){super(_);ke(this,"DEFAULT_VOCODER_ID","Xenova/speecht5_hifigan");this.vocoder=_.vocoder??null}async _call(_,{speaker_embeddings:T=null}={}){return this.processor?this._call_text_to_spectrogram(_,{speaker_embeddings:T}):this._call_text_to_waveform(_)}async _call_text_to_waveform(_){const T=this.tokenizer(_,{padding:!0,truncation:!0}),{waveform:C}=await this.model(T),M=this.model.config.sampling_rate;return{audio:C.data,sampling_rate:M}}async _call_text_to_spectrogram(_,{speaker_embeddings:T}){if(this.vocoder||(console.log("No vocoder specified, using default HifiGan vocoder."),this.vocoder=await AutoModel.from_pretrained(this.DEFAULT_VOCODER_ID,{quantized:!1})),(typeof T=="string"||T instanceof URL)&&(T=new Float32Array(await(await fetch(T)).arrayBuffer())),T instanceof Float32Array)T=new Tensor("float32",T,[1,T.length]);else if(!(T instanceof Tensor))throw new Error("Speaker embeddings must be a `Tensor`, `Float32Array`, `string`, or `URL`.");const{input_ids:C}=this.tokenizer(_,{padding:!0,truncation:!0}),{waveform:M}=await this.model.generate_speech(C,T,{vocoder:this.vocoder}),E=this.processor.feature_extractor.config.sampling_rate;return{audio:M.data,sampling_rate:E}}}class ImageToImagePipeline extends Pipeline{constructor(c){super(c)}async _call(c){const _=await prepareImages(c),T=await this.processor(_),C=await this.model(T),M=[];for(const E of C.reconstruction){const P=E.squeeze().clamp_(0,1).mul_(255).round_().to("uint8");M.push(RawImage.fromTensor(P))}return M.length>1?M:M[0]}}class DepthEstimationPipeline extends Pipeline{constructor(c){super(c)}async _call(c){const _=await prepareImages(c),T=await this.processor(_),{predicted_depth:C}=await this.model(T),M=[];for(let E=0;E<_.length;++E){const P=interpolate(C[E],_[E].size.reverse(),"bilinear",!1),R=P.mul_(255/max(P.data)[0]).to("uint8");M.push({predicted_depth:C[E],depth:RawImage.fromTensor(R)})}return M.length>1?M:M[0]}}const SUPPORTED_TASKS=Object.freeze({"text-classification":{tokenizer:AutoTokenizer,pipeline:TextClassificationPipeline,model:AutoModelForSequenceClassification,default:{model:"Xenova/distilbert-base-uncased-finetuned-sst-2-english"},type:"text"},"token-classification":{tokenizer:AutoTokenizer,pipeline:TokenClassificationPipeline,model:AutoModelForTokenClassification,default:{model:"Xenova/bert-base-multilingual-cased-ner-hrl"},type:"text"},"question-answering":{tokenizer:AutoTokenizer,pipeline:QuestionAnsweringPipeline,model:AutoModelForQuestionAnswering,default:{model:"Xenova/distilbert-base-cased-distilled-squad"},type:"text"},"fill-mask":{tokenizer:AutoTokenizer,pipeline:FillMaskPipeline,model:AutoModelForMaskedLM,default:{model:"Xenova/bert-base-uncased"},type:"text"},summarization:{tokenizer:AutoTokenizer,pipeline:SummarizationPipeline,model:AutoModelForSeq2SeqLM,default:{model:"Xenova/distilbart-cnn-6-6"},type:"text"},translation:{tokenizer:AutoTokenizer,pipeline:TranslationPipeline,model:AutoModelForSeq2SeqLM,default:{model:"Xenova/t5-small"},type:"text"},"text2text-generation":{tokenizer:AutoTokenizer,pipeline:Text2TextGenerationPipeline,model:AutoModelForSeq2SeqLM,default:{model:"Xenova/flan-t5-small"},type:"text"},"text-generation":{tokenizer:AutoTokenizer,pipeline:TextGenerationPipeline,model:AutoModelForCausalLM,default:{model:"Xenova/gpt2"},type:"text"},"zero-shot-classification":{tokenizer:AutoTokenizer,pipeline:ZeroShotClassificationPipeline,model:AutoModelForSequenceClassification,default:{model:"Xenova/distilbert-base-uncased-mnli"},type:"text"},"audio-classification":{pipeline:AudioClassificationPipeline,model:AutoModelForAudioClassification,processor:AutoProcessor,default:{model:"Xenova/wav2vec2-base-superb-ks"},type:"audio"},"zero-shot-audio-classification":{tokenizer:AutoTokenizer,pipeline:ZeroShotAudioClassificationPipeline,model:AutoModel,processor:AutoProcessor,default:{model:"Xenova/clap-htsat-unfused"},type:"multimodal"},"automatic-speech-recognition":{tokenizer:AutoTokenizer,pipeline:AutomaticSpeechRecognitionPipeline,model:[AutoModelForSpeechSeq2Seq,AutoModelForCTC],processor:AutoProcessor,default:{model:"Xenova/whisper-tiny.en"},type:"multimodal"},"text-to-audio":{tokenizer:AutoTokenizer,pipeline:TextToAudioPipeline,model:[AutoModelForTextToWaveform,AutoModelForTextToSpectrogram],processor:[AutoProcessor,null],default:{model:"Xenova/speecht5_tts"},type:"text"},"image-to-text":{tokenizer:AutoTokenizer,pipeline:ImageToTextPipeline,model:AutoModelForVision2Seq,processor:AutoProcessor,default:{model:"Xenova/vit-gpt2-image-captioning"},type:"multimodal"},"image-classification":{pipeline:ImageClassificationPipeline,model:AutoModelForImageClassification,processor:AutoProcessor,default:{model:"Xenova/vit-base-patch16-224"},type:"multimodal"},"image-segmentation":{pipeline:ImageSegmentationPipeline,model:[AutoModelForImageSegmentation,AutoModelForSemanticSegmentation],processor:AutoProcessor,default:{model:"Xenova/detr-resnet-50-panoptic"},type:"multimodal"},"zero-shot-image-classification":{tokenizer:AutoTokenizer,pipeline:ZeroShotImageClassificationPipeline,model:AutoModel,processor:AutoProcessor,default:{model:"Xenova/clip-vit-base-patch32"},type:"multimodal"},"object-detection":{pipeline:ObjectDetectionPipeline,model:AutoModelForObjectDetection,processor:AutoProcessor,default:{model:"Xenova/detr-resnet-50"},type:"multimodal"},"zero-shot-object-detection":{tokenizer:AutoTokenizer,pipeline:ZeroShotObjectDetectionPipeline,model:AutoModelForZeroShotObjectDetection,processor:AutoProcessor,default:{model:"Xenova/owlvit-base-patch32"},type:"multimodal"},"document-question-answering":{tokenizer:AutoTokenizer,pipeline:DocumentQuestionAnsweringPipeline,model:AutoModelForDocumentQuestionAnswering,processor:AutoProcessor,default:{model:"Xenova/donut-base-finetuned-docvqa"},type:"multimodal"},"image-to-image":{pipeline:ImageToImagePipeline,model:AutoModelForImageToImage,processor:AutoProcessor,default:{model:"Xenova/swin2SR-classical-sr-x2-64"},type:"image"},"depth-estimation":{pipeline:DepthEstimationPipeline,model:AutoModelForDepthEstimation,processor:AutoProcessor,default:{model:"Xenova/dpt-large"},type:"image"},"feature-extraction":{tokenizer:AutoTokenizer,pipeline:FeatureExtractionPipeline,model:AutoModel,default:{model:"Xenova/all-MiniLM-L6-v2"},type:"text"},"image-feature-extraction":{processor:AutoProcessor,pipeline:ImageFeatureExtractionPipeline,model:[AutoModelForImageFeatureExtraction,AutoModel],default:{model:"Xenova/vit-base-patch16-224-in21k"},type:"image"}}),TASK_ALIASES=Object.freeze({"sentiment-analysis":"text-classification",ner:"token-classification",asr:"automatic-speech-recognition","text-to-speech":"text-to-audio",embeddings:"feature-extraction"});async function pipeline(x,c=null,{quantized:_=!0,progress_callback:T=null,config:C=null,cache_dir:M=null,local_files_only:E=!1,revision:P="main",model_file_name:R=null}={}){x=TASK_ALIASES[x]??x;const $=SUPPORTED_TASKS[x.split("_",1)[0]];if(!$)throw Error(`Unsupported pipeline: ${x}. Must be one of [${Object.keys(SUPPORTED_TASKS)}]`);c||(c=$.default.model,console.log(`No model specified. Using default model: "${c}".`));const G={quantized:_,progress_callback:T,config:C,cache_dir:M,local_files_only:E,revision:P,model_file_name:R},O=new Map([["tokenizer",$.tokenizer],["model",$.model],["processor",$.processor]]),L=await loadItems(O,c,G);L.task=x,dispatchCallback(T,{status:"ready",task:x,model:c});const F=$.pipeline;return new F(L)}async function loadItems(x,c,_){const T=Object.create(null),C=[];for(let[M,E]of x.entries()){if(!E)continue;let P;Array.isArray(E)?P=new Promise(async(R,$)=>{let G;for(let O of E){if(O===null){R(null);return}try{R(await O.from_pretrained(c,_));return}catch(L){G=L}}$(G)}):P=E.from_pretrained(c,_),T[M]=P,C.push(P)}await Promise.all(C);for(let[M,E]of Object.entries(T))T[M]=await E;return T}const _20240429DistanceSeanShawn_md_svelte_type_style_lang="";function get_each_context$1(x,c,_){const T=x.slice();return T[29]=c[_],T[31]=_,T}function create_else_block_3(x){let c,_,T,C,M,E,P,R,$,G,O,L;c=new Numbers({props:{result:x[9]}});let F=x[6],V=[];for(let W=0;W# npm add @xenova/transformer import { pipeline, env } from '@xenova/transformers'; env.allowLocalModels=false; # load remote models const extractor = await pipeline( 'feature-extraction', 'Xenova/all-MiniLM-L6-v2'); const { data } = await extractor( text, { pooling: 'mean', normalize: true });`,ae,ne,te,oe,ue,de,pe,he,we,ye,Me,Pe,Re,De,Le,$e,Oe,Ee,Be=`function cosineSimilarity(A, B) { var dotproduct = 0; var mA = 0; var mB = 0; for(var i = 0; i < A.length; i++) { dotproduct += A[i] * B[i]; mA += A[i] * A[i]; mB += B[i] * B[i]; } mA = Math.sqrt(mA); mB = Math.sqrt(mB); similarity = dotproduct / (mA * mB); return similarity; }`,He,We,Ke,Je,tt=`A = np.array(embedding1) B = np.array(embedding2) cosine_sim = np.dot(A,B)/(norm(A)*norm(B))`,mt,pt,bt,gt,ct,yt,At,qe,Bt,xt,Mt,Dt,Ot,_t,ft,Gt,Ye,Pt,Wt,St,Ge,ze,kt,Nt,$t;const et=[create_if_block_3$1,create_else_block_3],Xe=[];function Qe(be,Ve){return be[6]&&be[6].length?1:0}K=Qe(x),q=Xe[K]=et[K](x),de=new TwoDimensions({});const Jt=[create_if_block_2$1,create_else_block_1$1],Rt=[];function qt(be,Ve){return be[5].length?1:0}xt=qt(x),Mt=Rt[xt]=Jt[xt](x);const Qt=[create_if_block_1$1,create_else_block$1],Ft=[];function er(be,Ve){return be[4].length?1:0}_t=er(x),ft=Ft[_t]=Qt[_t](x);let Tt=x[5]&&x[4]&&create_if_block$1(x);return ze=new Credits({}),{c(){c=element("p"),c.innerHTML='This post is about embeddings, a foundational concept to understand for machine learning and AI. After reading this post, you’ll know all about embeddings, as well as cosine distance calculations. That’s just some bonus learning right there. Don’t worry, your brain can handle it. Once read you’ll know how to reason about them, be able to do the calculations by hand if you wanted to, and realize those two things are not that hard to understand. Embeddings are everywhere these days. You’re encountering them constantly, and they’re very useful in AI, especially with RAG (retrieval augmented generation.) I’m betting this will be a big topic at the AI.engineer worldsfair in June (use discount code LATENTSPACE to save $100.)',_=space(),T=element("p"),T.textContent="If you get nothing else from this post, scroll all the way down and click on the buttons at the bottom of the post, and then click “start.” Doing that will show you a fun animation of the cosine distance function. However! This is a post worth reading all the way through (trust me, people) because embeddings are important, powerful, and easy to grasp.",C=space(),M=element("img"),P=space(),R=element("p"),R.innerHTML="Oh, and everything in this post happens inside your browser! There are no remote connections other than to download the embedding model.",$=space(),G=element("p"),G.innerHTML='A week ago I sent an email that was tangentially related to embeddings. The recipient is someone I highly respect, and someone that I would say is about 2 or 3 degrees away on the Kevin Bacon degree scale from me. I’ve had two conversations with him over video. I would not say we are friends and I would not ask to crash at his place if I visited San Francisco. I think of myself as a Val Kilmer to him (if we are only permitting strict connections through film and not off-broadway).',O=space(),L=element("p"),L.textContent="I made a fatal mistake, however: I misspelled his name in the email invitation. He goes by Shawn, but I wrote Sean. I’m 93% sure this is why he didn’t write back, he is probably so sick of being misnamed into a group with people like Sean Penn, Sean Connery or Sean Young. I’m worried I became a Craig T Nelson to him.",F=space(),V=element("img"),z=space(),Z=element("p"),Z.innerHTML="There is a good reason why I made this mistake and it is because my brain stores that information in a meaty embedding form. A few years ago I recall hearing the term embedding and feeling very stupid. But, now I know what an embedding is.. An embedding is just a vector, which said even more plainly, is just a list of numbers. That list of numbers is generated from a model that takes some textual input and converts it into this list of numbers, and those numbers represent some semantic meaning. That might not sound interesting, but if you have two lists of numbers, then you can do a fun calculation that tells you how close those list of numbers are. And, that means you can tell how semantically close two pieces of text are from each other. And, in my brain, Sean and Shawn are stored as slimy unordered meaty chunked up embeddings, and my bio-GPU (Gloppy Poor-Understandinger) calculates the distance between those globs as a “very close” result.",H=space(),Y=element("p"),Y.textContent="For example, enter a phrase into this text box, and then click the button to generate an embedding for the phrase.",U=space(),j=element("input"),X=space(),q.c(),J=space(),Q=element("p"),Q.textContent="The code to do this in JavaScript is really simple!",ee=space(),re=element("pre"),ae=space(),ne=element("p"),ne.textContent="This embedding is 384 dimensions, standard for embeddings used in many AI applications. What does that mean for semantic encoding? Well, (and someone smarter than me can correct me if I’m wrong,) dimensions categorize the semantics into distinct facets. The more dimensions you have, the more facets. For example, if you had only four dimensions and you were talking about clothing, you could say one facet is the color of the clothing, one is the intricacy, one is the formality, and one is the fabric. Then you could categorize, say, a tuxedo with one set of numbers, a swimsuit with a different set of numbers and a wedding gown with an entirely different set of numbers. Then you’d be able to see which of those clothing items are more similar to the others by looking at the dimensions you’ve assigned.",te=space(),oe=element("p"),oe.textContent="What does it mean this embedding is in 384 dimensions? We humans normally have a hard time thinking past four dimensions (length, width, height and space/time). Let’s constrain ourselves to only two dimensions. We could imagine a model that only encodes into two dimensions, and we can easily plot that with Cartesian planes that we learned in middle school (see below.) By clicking on the buttons to change coordinates, you can see how the cosine distance changes related to how close the vectors are on the graph. Pretty neat.",ue=space(),create_component(de.$$.fragment),pe=space(),he=element("p"),he.textContent="You can see how the closer the vectors are, the higher the similarity score. When the vectors are in diametrically opposite positions, the score is -1. When they are almost in the exact same position, the score is almost 1. That means the embeddings, the semantic meanings, are very closely related.",we=space(),ye=element("p"),ye.innerHTML='It begs the question: how do you calculate that distance value? To do that, use a distance function. There are many of these. Hamming Distance, Tanimoto Coefficient. The most common one however in the AI/ML world is the cosine distance function. Also, even without those functions it’s really easy to calculate in code, even by hand.',Me=space(),Pe=element("p"),Pe.textContent="In math notation, it looks like this:",Re=space(),De=element("p"),De.innerHTML='cosine similarity',Le=space(),$e=element("p"),$e.textContent="Honestly, I hate that. I think it is much easier to read code than that. So, here is the code:",Oe=space(),Ee=element("pre"),He=space(),We=element("p"),We.textContent="By the way, python numpy makes this really simple:",Ke=space(),Je=element("pre"),mt=space(),pt=element("p"),pt.textContent="Python and numpy are simple and powerful, and the JavaScript code is not that complex either. To put it into plain English, that algorithm is such: if you have two vectors with the exact same dimensions then iterate over them. For each item of A and B, multiple them, and save that value into the dotproduct. Square the A-nth item, and save that. Square the B-nth item, and save that. Then, find the square root of the sum of the A-nth items and find the square root of the B-nth items. Then, the similarity score is the dotproduct divided by the product of the results of the squares. I think the code is easier to read than my explanation or the math notation, but perhaps this helped that special someone out there who needed it spelled out.",bt=space(),gt=element("p"),gt.textContent="Now, the result of a cosine distance function is a number where the range is between -1 and 1. The higher it is, the “closer” semantically the phrases are. For example, 0.6 value or above usually indicates semantically similar phrases (in my non-scientific observations).",ct=space(),yt=element("p"),yt.innerHTML='The best way for me to prove I understand a concept like “cosine similarity” is to make something with it, so what follows is an animated version of the algorithm. For this animation, imagine that you took a 384 dimension embedding and converted it into a physical stack of coins, where each coin has the embedding value printed on the front. Then, drop the stack of coins on a table, with the coins closer to the negative value landing to the left, and to the right if they are closer to the positive, all the while maintaining their stack order. This algorithm simulates pulling off the top coin from each stack and running that coin value through the cosine similarity algorithm steps. If you want to see how this is written in JavaScript all of this is written in Svelte (in a svekyll blog You can see the source by clicking on the view source link below to play and tweak it to your heart’s content.',At=space(),qe=element("div"),Bt=element("div"),Mt.c(),Dt=space(),Ot=element("div"),ft.c(),Gt=space(),Tt&&Tt.c(),Ye=space(),Pt=element("p"),Pt.textContent="Remember, 0.6 or above generally indicates semantic similarity (and these phrases are semantically similar as we can see without math.) If you refresh the page and retry with your own phrases that are not semantically proximate, you’ll find values under 0.5.",Wt=space(),St=element("p"),St.textContent="Wrapping up, embeddings and cosine distance functions are fun and really valuable to understand. If you have comments about this post, please email me at chris at extrastatic.com.",Ge=space(),create_component(ze.$$.fragment),set_style(M,"height","20rem"),set_style(M,"margin","0 auto"),set_style(M,"width","auto"),src_url_equal(M.src,E="https://files.extrastatic.dev/attachments/cosine-calc2.gif")||attr(M,"src",E),set_style(V,"height","20rem"),set_style(V,"margin","0 auto"),set_style(V,"width","auto"),src_url_equal(V.src,W="https://upload.wikimedia.org/wikipedia/commons/2/28/Craig_T._Nelson_at_PaleyFest_2013.jpg")||attr(V,"src",W),attr(j,"type","text"),attr(j,"placeholder","Enter text"),attr(re,"class","language-undefined"),attr(Ee,"class","language-undefined"),attr(Je,"class","language-undefined"),attr(Bt,"class","two-flex svelte-1inzrx3"),attr(Ot,"class","two-flex svelte-1inzrx3"),attr(qe,"class","two svelte-1inzrx3")},m(be,Ve){insert(be,c,Ve),insert(be,_,Ve),insert(be,T,Ve),insert(be,C,Ve),insert(be,M,Ve),insert(be,P,Ve),insert(be,R,Ve),insert(be,$,Ve),insert(be,G,Ve),insert(be,O,Ve),insert(be,L,Ve),insert(be,F,Ve),insert(be,V,Ve),insert(be,z,Ve),insert(be,Z,Ve),insert(be,H,Ve),insert(be,Y,Ve),insert(be,U,Ve),insert(be,j,Ve),set_input_value(j,x[1]),insert(be,X,Ve),Xe[K].m(be,Ve),insert(be,J,Ve),insert(be,Q,Ve),insert(be,ee,Ve),insert(be,re,Ve),re.innerHTML=ie,insert(be,ae,Ve),insert(be,ne,Ve),insert(be,te,Ve),insert(be,oe,Ve),insert(be,ue,Ve),mount_component(de,be,Ve),insert(be,pe,Ve),insert(be,he,Ve),insert(be,we,Ve),insert(be,ye,Ve),insert(be,Me,Ve),insert(be,Pe,Ve),insert(be,Re,Ve),insert(be,De,Ve),insert(be,Le,Ve),insert(be,$e,Ve),insert(be,Oe,Ve),insert(be,Ee,Ve),Ee.innerHTML=Be,insert(be,He,Ve),insert(be,We,Ve),insert(be,Ke,Ve),insert(be,Je,Ve),Je.innerHTML=tt,insert(be,mt,Ve),insert(be,pt,Ve),insert(be,bt,Ve),insert(be,gt,Ve),insert(be,ct,Ve),insert(be,yt,Ve),insert(be,At,Ve),insert(be,qe,Ve),append(qe,Bt),Rt[xt].m(Bt,null),append(qe,Dt),append(qe,Ot),Ft[_t].m(Ot,null),insert(be,Gt,Ve),Tt&&Tt.m(be,Ve),insert(be,Ye,Ve),insert(be,Pt,Ve),insert(be,Wt,Ve),insert(be,St,Ve),insert(be,Ge,Ve),mount_component(ze,be,Ve),kt=!0,Nt||($t=listen(j,"input",x[15]),Nt=!0)},p(be,Ve){Ve[0]&2&&j.value!==be[1]&&set_input_value(j,be[1]);let Yt=K;K=Qe(be),K===Yt?Xe[K].p(be,Ve):(group_outros(),transition_out(Xe[Yt],1,1,()=>{Xe[Yt]=null}),check_outros(),q=Xe[K],q?q.p(be,Ve):(q=Xe[K]=et[K](be),q.c()),transition_in(q,1),q.m(J.parentNode,J));let Ut=xt;xt=qt(be),xt===Ut?Rt[xt].p(be,Ve):(group_outros(),transition_out(Rt[Ut],1,1,()=>{Rt[Ut]=null}),check_outros(),Mt=Rt[xt],Mt?Mt.p(be,Ve):(Mt=Rt[xt]=Jt[xt](be),Mt.c()),transition_in(Mt,1),Mt.m(Bt,null));let jt=_t;_t=er(be),_t===jt?Ft[_t].p(be,Ve):(group_outros(),transition_out(Ft[jt],1,1,()=>{Ft[jt]=null}),check_outros(),ft=Ft[_t],ft?ft.p(be,Ve):(ft=Ft[_t]=Qt[_t](be),ft.c()),transition_in(ft,1),ft.m(Ot,null)),be[5]&&be[4]?Tt?(Tt.p(be,Ve),Ve[0]&48&&transition_in(Tt,1)):(Tt=create_if_block$1(be),Tt.c(),transition_in(Tt,1),Tt.m(Ye.parentNode,Ye)):Tt&&(group_outros(),transition_out(Tt,1,1,()=>{Tt=null}),check_outros())},i(be){kt||(transition_in(q),transition_in(de.$$.fragment,be),transition_in(Mt),transition_in(ft),transition_in(Tt),transition_in(ze.$$.fragment,be),kt=!0)},o(be){transition_out(q),transition_out(de.$$.fragment,be),transition_out(Mt),transition_out(ft),transition_out(Tt),transition_out(ze.$$.fragment,be),kt=!1},d(be){be&&detach(c),be&&detach(_),be&&detach(T),be&&detach(C),be&&detach(M),be&&detach(P),be&&detach(R),be&&detach($),be&&detach(G),be&&detach(O),be&&detach(L),be&&detach(F),be&&detach(V),be&&detach(z),be&&detach(Z),be&&detach(H),be&&detach(Y),be&&detach(U),be&&detach(j),be&&detach(X),Xe[K].d(be),be&&detach(J),be&&detach(Q),be&&detach(ee),be&&detach(re),be&&detach(ae),be&&detach(ne),be&&detach(te),be&&detach(oe),be&&detach(ue),destroy_component(de,be),be&&detach(pe),be&&detach(he),be&&detach(we),be&&detach(ye),be&&detach(Me),be&&detach(Pe),be&&detach(Re),be&&detach(De),be&&detach(Le),be&&detach($e),be&&detach(Oe),be&&detach(Ee),be&&detach(He),be&&detach(We),be&&detach(Ke),be&&detach(Je),be&&detach(mt),be&&detach(pt),be&&detach(bt),be&&detach(gt),be&&detach(ct),be&&detach(yt),be&&detach(At),be&&detach(qe),Rt[xt].d(),Ft[_t].d(),be&&detach(Gt),Tt&&Tt.d(be),be&&detach(Ye),be&&detach(Pt),be&&detach(Wt),be&&detach(St),be&&detach(Ge),destroy_component(ze,be),Nt=!1,$t()}}}const metadata$5={title:"What is the cosine distance between Sean and Shawn?",published:!0,date:"2024-04-29T00:00:00.000Z",tags:"ai, embeddings, cosinesimilarity, javascript, python"};function lessThan(x,c){return x_(5,C=q));let O=writable([]);component_subscribe(x,O,q=>_(4,T=q));let L=writable([]);component_subscribe(x,L,q=>_(6,M=q));const F=(...q)=>console.log(...q);function V(){H(R,G)}function W(){H($,O)}function z(){set_store_value(L,M=[],M),_(1,P="")}function Z(){H(P,L)}async function H(q,J){F(3,"Generating embedding for text",q);const Q=await pipeline("feature-extraction","Xenova/all-MiniLM-L6-v2"),{data:ee}=await Q(q,{pooling:"mean",normalize:!0});F(3,"Got data",ee),ee.forEach((re,ie)=>setTimeout(()=>{J.update(ae=>[...ae,re])},ie*5))}const Y=writable(!1);function U(){P=this.value,_(1,P)}function j(){R=this.value,_(2,R)}function X(){$=this.value,_(3,$)}function K(q){binding_callbacks[q?"unshift":"push"](()=>{E=q,_(0,E)})}return[E,P,R,$,T,C,M,G,O,L,V,W,z,Z,Y,U,j,X,K]}class _2024_04_29_distance_sean_shawn extends SvelteComponent{constructor(c){super(),init$3(this,c,instance$2,create_fragment$6,safe_not_equal,{},null,[-1,-1])}}function create_fragment$5(x){let c,_,T,C,M,E,P,R,$,G,O,L,F,V,W,z,Z,H,Y,U,j,X,K,q,J,Q,ee,re,ie,ae,ne;return{c(){c=element("p"),c.innerHTML='(I’m documenting teaching my kids to write Japanese hiragana in ten days. The entire series can be found at #10days4hiragana,this is the prior post, and the kana project at kana.public.do)',_=space(),T=element("p"),T.textContent="Today I heard the words I never thought I would hear from my son: “Dad, learning Japanese is fun!” That made my heart sing. And, he carried his hiragana worksheet to school without me asking!",C=space(),M=element("img"),P=space(),R=element("p"),R.textContent="And, the real show of progress is that he was able to write the word sushi without looking at the stroke sheets. I’m so excited to show him REAL sushi in Japan. And, it reminded me of a fun story when I was in Japan, about the best sushi I ever had.",$=space(),G=element("p"),G.textContent="I told them that when I lived in Japan, I was on a date with a Japanese woman. I was sitting there at a izakaya (pub restaurant, basically) and speaking in Japanese. Sitting next to me was an older man, with big bushy eyebrows, like huge caterpillars dancing around his eye sockets. After a long while, he finally spoke to me and was surprised that I spoke Japanese. Gradually the conversation shifted to him asking me:",O=space(),L=element("p"),L.textContent="“What is your favorite Japanese food?”",F=space(),V=element("img"),z=space(),Z=element("p"),Z.textContent="I told him sushi. The caterpillars almost leapt off his face. Sushi was complicated, because I was a college student and could almost never afford sushi. To this day I still love tamago (egg omelete) sushi, because it is the cheapest and I could eat a few without being embarassed and having to borrow from my college friends. So, I loved sushi, but could almost never afford it and went to the ramen shop instead.",H=space(),Y=element("p"),Y.textContent="When he found out I liked sushi, he said, “Ok, let’s go.” And we went to the nicest sushi restaurant I have ever been to. We had already eaten, so we only ate a few pieces of sushi. And, I recall at the end of the short meal, he pulled out four 10,000 YEN notes, which was about $500 at the time. It was REALLY good sushi.",U=space(),j=element("img"),K=space(),q=element("p"),q.textContent="So, Mr. Miyagi was wrong: I started with a date with a young flower and ended up on a date with an old prune.",J=space(),Q=element("p"),Q.textContent="As we kept working, I realized that we are now at the point where my son and I can start writing vulgar and cuss words. Now we can write kintama (golden testicles). It’s my duty as a dad living in Florida to tell my kids those kinds of things, because Ron DeSantis won’t be permitting that.",ee=space(),re=element("img"),ae=space(),ne=element("p"),ne.textContent="Norah was excited for the “ma” row because she read “mame” (beans) and shouted “Edamame! Does it mean green beans?” No, but it does mean bean, and now you can write it! She’s the one that discovered the ten-ten (two dots) that you add to a character, which means she can convert ta to da.",src_url_equal(M.src,E="https://files.extrastatic.dev/attachments/"+attachments$4.ergonomic_knowledge_user.filename)||attr(M,"src",E),src_url_equal(V.src,W="https://files.extrastatic.dev/attachments/"+attachments$4.virtual_graphical_user_interface.filename)||attr(V,"src",W),src_url_equal(j.src,X="https://files.extrastatic.dev/attachments/"+attachments$4.secured_approach.filename)||attr(j,"src",X),src_url_equal(re.src,ie="https://files.extrastatic.dev/attachments/"+attachments$4.assimilated_local_area_network.filename)||attr(re,"src",ie)},m(te,oe){insert(te,c,oe),insert(te,_,oe),insert(te,T,oe),insert(te,C,oe),insert(te,M,oe),insert(te,P,oe),insert(te,R,oe),insert(te,$,oe),insert(te,G,oe),insert(te,O,oe),insert(te,L,oe),insert(te,F,oe),insert(te,V,oe),insert(te,z,oe),insert(te,Z,oe),insert(te,H,oe),insert(te,Y,oe),insert(te,U,oe),insert(te,j,oe),insert(te,K,oe),insert(te,q,oe),insert(te,J,oe),insert(te,Q,oe),insert(te,ee,oe),insert(te,re,oe),insert(te,ae,oe),insert(te,ne,oe)},p:noop$1,i:noop$1,o:noop$1,d(te){te&&detach(c),te&&detach(_),te&&detach(T),te&&detach(C),te&&detach(M),te&&detach(P),te&&detach(R),te&&detach($),te&&detach(G),te&&detach(O),te&&detach(L),te&&detach(F),te&&detach(V),te&&detach(z),te&&detach(Z),te&&detach(H),te&&detach(Y),te&&detach(U),te&&detach(j),te&&detach(K),te&&detach(q),te&&detach(J),te&&detach(Q),te&&detach(ee),te&&detach(re),te&&detach(ae),te&&detach(ne)}}}const metadata$4={title:"Day 6/10: the words I never thought I would hear",published:!0,date:"2024-03-06T00:00:00.000Z",attachments:{assimilated_local_area_network:{filename:"webiphanysvekyll/2024-03-06_4758701_0.png"},secured_approach:{filename:"webiphanysvekyll/2024-03-06_4758701_1.png"},virtual_graphical_user_interface:{filename:"webiphanysvekyll/2024-03-06_4758701_2.png"},ergonomic_knowledge_user:{filename:"webiphanysvekyll/2024-03-06_4758701_3.png"}},tags:"japanese japan hiragana svelte 10days4hiragana"},{title:title$4,published:published$4,date:date$4,attachments:attachments$4,tags:tags$4}=metadata$4;class _2024_03_06_day_6_10_the_words_i_never_thought_i_would_hear extends SvelteComponent{constructor(c){super(),init$3(this,c,null,create_fragment$5,safe_not_equal,{})}}function create_fragment$4(x){let c,_,T,C,M,E,P,R,$,G,O,L,F,V,W,z,Z,H,Y;return{c(){c=element("p"),c.innerHTML='(I’m documenting teaching my kids to write Japanese hiragana in ten days. The entire series can be found at #10days4hiragana and this is the last post, and the kana project at kana.public.do)',_=space(),T=element("p"),T.textContent="Yesterday I felt like things did not go well because the context was not right for learning (they started right after getting off screens). But, I also felt like I had not put in anything for spaced repetition, which was one of my teaching goals. Yesterday, I was barely able to get them to write down one character on each page when I introduced the ha row. But, this is, perhaps, because each new set of characters was new, inside a new language, with all those anxieties. So, a good time to notice that, and give them something familiar.",C=space(),M=element("p"),M.textContent="Today I gave them the original worksheets with the a and ka rows, characters they had done a few days prior. The girls got going with it and wrote out, without prompting, each character several times. I’ve been telling them to write each character three times, but they had not done that, and this time, maybe because they knew them from a few days ago, they blasted through them, and corrected their own mistakes. It was so awesome to see.",E=space(),P=element("img"),$=space(),G=element("p"),G.textContent="One subversive tactic I had was that doing this in a group would pull in the stragglers. I was hoping that peer pressure would make it harder for one kid to opt out. That kid has generally been my son, who has not had a lot of interest. But, seeing the girls participate had him pull out one of the sheets on his own. And, in a few minutes he had a great question:",O=space(),L=element("p"),L.textContent="“Dad, why is fu (ふ) in the ha (は) row?”",F=space(),V=element("img"),z=space(),Z=element("p"),Z.textContent="It’s a great question, and allowed me to explain how Japanese has very different sounds, and very different understanding of the way to categorize sounds. For example, in the Japanese brain, ha and fu are similar sounds. Looking at them with an English-speaking brain, you wouldn’t think that. But, they are similar in the way our mouths form to make the sound. And, I explained that ra and la don’t really exist in Japanese. In Japanese, you have a sound that is in the middle, and is like making the ra sound, but touching the tongue to your teeth for just an instant, unlike the la sound, which presses the tongue to the teeth for a longer time.",H=space(),Y=element("p"),Y.textContent="This led to a funny story. I asked the kids if they recalled the park where their grandmother lives, where we used to hunt for fairies in the massive redwoods. They couldn’t remember, so I prompted them with “laur…” and my son finished off with Laurelhurst. It is a funny word, because it is about the most difficult set of sounds you could ask a Japaneses person could try to make: four L sounds and a hu sound, none of which exist in the spoken Japanese language. So, our exchange student when I was one years old had a hard time, as my dad used to recount, when he had to say the name of the park he lived next to for a year. Good memories.",src_url_equal(P.src,R="https://files.extrastatic.dev/attachments/"+attachments$3.multi_channelled_alliance.filename)||attr(P,"src",R),src_url_equal(V.src,W="https://files.extrastatic.dev/attachments/"+attachments$3.ergonomic_info_mediaries.filename)||attr(V,"src",W)},m(U,j){insert(U,c,j),insert(U,_,j),insert(U,T,j),insert(U,C,j),insert(U,M,j),insert(U,E,j),insert(U,P,j),insert(U,$,j),insert(U,G,j),insert(U,O,j),insert(U,L,j),insert(U,F,j),insert(U,V,j),insert(U,z,j),insert(U,Z,j),insert(U,H,j),insert(U,Y,j)},p:noop$1,i:noop$1,o:noop$1,d(U){U&&detach(c),U&&detach(_),U&&detach(T),U&&detach(C),U&&detach(M),U&&detach(E),U&&detach(P),U&&detach($),U&&detach(G),U&&detach(O),U&&detach(L),U&&detach(F),U&&detach(V),U&&detach(z),U&&detach(Z),U&&detach(H),U&&detach(Y)}}}const metadata$3={title:"Day 5/10: in Japanese, why is fu in the ha row?",published:!0,date:"2024-03-05T00:00:00.000Z",tags:"japanese japan hiragana svelte 10days4hiragana",attachments:{ergonomic_info_mediaries:{filename:"webiphanysvekyll/2024-03-05_9418504_0.png"},multi_channelled_alliance:{filename:"webiphanysvekyll/2024-03-05_769080_0.png"}}},{title:title$3,published:published$3,date:date$3,tags:tags$3,attachments:attachments$3}=metadata$3;class _2024_03_05_day_5_10_in_japanese_why_is_fu_in_the_ha_row extends SvelteComponent{constructor(c){super(),init$3(this,c,null,create_fragment$4,safe_not_equal,{})}}function create_fragment$3(x){let c,_,T,C,M,E,P,R,$,G,O,L,F,V;return{c(){c=element("p"),c.innerHTML='(I’m documenting teaching my kids to write Japanese hiragana in ten days. The entire series can be found here #10days4hiragana and this is the last post, and the kana project at kana.public.do)',_=space(),T=element("p"),T.textContent="Today my goal was to get the girls to continue on to the next row: the ha (は) characters.",C=space(),M=element("p"),M.textContent="But, they really didn’t want to practice. I did manage to get Norah to work on the ha row. It was a struggle.",E=space(),P=element("img"),$=space(),G=element("p"),G.textContent="To help them find a reason to keep going, I wrote out the words neko (ねこ), inu (いぬ) and sushi (すし). They had fun (maybe?), reviewing those words. I was hoping that would get my son interested as well, but I’m not sure.",O=space(),L=element("p"),L.textContent="Today felt like a step backwards. One of the problems was that the context was not good for them to learn. They had just gotten off their screens, so the adrenaline was flowing, and they were not in a mode to learn.",F=space(),V=element("p"),V.textContent="But, also, I wanted this to be a spaced-repetition practice, and haven’t done anything with that yet. They didn’t yet have time to review the things they have done so far. Tomorrow I’m going to try to introduce some of the prior characters to see if that review helps them learn, and helps them get into a learning more.",src_url_equal(P.src,R="https://files.extrastatic.dev/attachments/"+attachments$2.ameliorated_alliance.filename)||attr(P,"src",R)},m(W,z){insert(W,c,z),insert(W,_,z),insert(W,T,z),insert(W,C,z),insert(W,M,z),insert(W,E,z),insert(W,P,z),insert(W,$,z),insert(W,G,z),insert(W,O,z),insert(W,L,z),insert(W,F,z),insert(W,V,z)},p:noop$1,i:noop$1,o:noop$1,d(W){W&&detach(c),W&&detach(_),W&&detach(T),W&&detach(C),W&&detach(M),W&&detach(E),W&&detach(P),W&&detach($),W&&detach(G),W&&detach(O),W&&detach(L),W&&detach(F),W&&detach(V)}}}const metadata$2={title:"Day 4/10: hiragana loses out to Legos",published:!0,date:"2024-03-04T00:00:00.000Z",attachments:{ameliorated_alliance:{filename:"webiphanysvekyll/2024-03-04_6717711_0.png"}},tags:"japan japanese hiragana svelte spaced-repetition 10days4hiragana"},{title:title$2,published:published$2,date:date$2,attachments:attachments$2,tags:tags$2}=metadata$2;class _2024_03_04_day_4_10_hiragana_loses_out_to_legos extends SvelteComponent{constructor(c){super(),init$3(this,c,null,create_fragment$3,safe_not_equal,{})}}function create_fragment$2(x){let c,_,T,C,M,E,P,R,$,G,O,L,F,V,W,z,Z,H;return{c(){c=element("p"),c.innerHTML='(I’m documenting teaching my kids to write Japanese hiragana in ten days. The entire series can be found at #10days4hiragana and this is the last post, and the kana project at kana.public.do)',_=space(),T=element("p"),T.textContent="On this third day, I dragged my two youngest off their screens and got them to continue writing hiragana. My son refused to come off his iPad, yelling that I was not helping him find his school shirt, so he didn’t participate.",C=space(),M=element("img"),P=space(),R=element("p"),R.textContent="I showed the girls how to draw the hiragana. Then they worked in front of me. The na (な) character is a tricky one, and Norah’s first attempt wasn’t great. The spacing was poor, but hey, she’s seven! And, she was still excited to learn that nana is seven, like she is!",$=space(),G=element("img"),L=space(),F=element("p"),F.textContent="But, then, they really started accelerating. I thought nu (ぬ) and ne (ね) would be hard, but they really enjoyed writing them and were having fun. And it was fun to tell them the word for cat (neko) and dog (inu) which they can now read and write.",V=space(),W=element("img"),Z=space(),H=element("p"),H.textContent="I really get the sense they are taking a lot of pride in learning to write in a very different language. It’s been very rewarding as a dad to see it.",src_url_equal(M.src,E="https://files.extrastatic.dev/attachments/"+attachments$1.visionary_hierarchy.filename)||attr(M,"src",E),src_url_equal(G.src,O="https://files.extrastatic.dev/attachments/"+attachments$1.fully_configurable_strategy.filename)||attr(G,"src",O),src_url_equal(W.src,z="https://files.extrastatic.dev/attachments/"+attachments$1.intuitive_core.filename)||attr(W,"src",z)},m(Y,U){insert(Y,c,U),insert(Y,_,U),insert(Y,T,U),insert(Y,C,U),insert(Y,M,U),insert(Y,P,U),insert(Y,R,U),insert(Y,$,U),insert(Y,G,U),insert(Y,L,U),insert(Y,F,U),insert(Y,V,U),insert(Y,W,U),insert(Y,Z,U),insert(Y,H,U)},p:noop$1,i:noop$1,o:noop$1,d(Y){Y&&detach(c),Y&&detach(_),Y&&detach(T),Y&&detach(C),Y&&detach(M),Y&&detach(P),Y&&detach(R),Y&&detach($),Y&&detach(G),Y&&detach(L),Y&&detach(F),Y&&detach(V),Y&&detach(W),Y&&detach(Z),Y&&detach(H)}}}const metadata$1={title:"Day 3/10: teaching my kids to write Japanese",published:!0,date:"2024-03-02T00:00:00.000Z",tags:"japanese japan hiragana svelte 10days4hiragana",attachments:{intuitive_core:{filename:"webiphanysvekyll/2024-03-02_7325537_0.png"},fully_configurable_strategy:{filename:"webiphanysvekyll/2024-03-02_7325537_1.png"},visionary_hierarchy:{filename:"webiphanysvekyll/2024-03-02_7325537_2.png"}}},{title:title$1,published:published$1,date:date$1,tags:tags$1,attachments:attachments$1}=metadata$1;class _2024_03_02_day_3_10_teaching_my_kids_to_write_japanese extends SvelteComponent{constructor(c){super(),init$3(this,c,null,create_fragment$2,safe_not_equal,{})}}function create_fragment$1(x){let c,_,T,C=oneoff.iframe+"",M,E,P,R,$,G,O,L,F,V,W,z,Z,H,Y,U,j,X,K,q,J,Q,ee,re,ie,ae,ne,te,oe,ue,de;return{c(){c=element("dialog"),_=element("div"),T=element("div"),M=space(),E=element("div"),P=element("button"),P.textContent="Close",R=space(),$=element("p"),$.innerHTML='(I’m documenting teaching my kids to write Japanese hiragana in ten days. The entire series can be found at #10days4hiragana and this is the last post, and the kana project at kana.public.do)',G=space(),O=element("p"),O.innerHTML='In ten days I’m taking my three kids to Japan. Before we go, I want them to learn the Japanese phonetic characters: hiragana. So, I built a little app that animates the hiragana and makes printable worksheets for them to practice. They can use these as one-sheet, or I plan to chop them up into flashcards and use a variation of spaced repetition to help them learn. I wanted this to be something they can do offline and with a pen: there is lots of evidence coming to light recently about the importance of handwriting for memorization (https://archive.ph/q0uAI and https://news.ycombinator.com/item?id=37909756) and I wanted to make something where it was easy for them to practice on a piece of paper and pencil, not on a web app (though it works there as well if they wanted to use an iPad or something).',L=space(),F=element("img"),W=space(),z=element("p"),z.innerHTML=`The project can be viewed here: https://kana.public.do. Or, you can get the code here: https://extrastatic.dev/xrdawson/kana-practice. This is code I extracted from another project which helps you learn Japanese by reading Japanese classical books with a clever combination of animated kanji and flashcards/spaced-repetition. You can see a work in progress sample at Natsume Soseki’s Kokoro on community.public.do (be sure to expand the kanji and click on them!), or sign up to be notified when it is ready here:`,Z=space(),H=element("div"),H.textContent=`${oneoff.button}`,Y=space(),U=element("p"),U.innerHTML='A brief technical note: this is a simple svelte app. Most of the heavy lifting comes from the incredible KanjiVG project http://kanjivg.tagaini.net/ which provides beautiful kanji (and all the hiragana as well) with annotated stroke order. Combining this with the animejs project and you can have fun making animated kanji or hiragana. It was a little tricky animating SVG loaded over the network, but it was a fun project to explore SVG and JavaScript and Kanji.',j=space(),X=element("p"),X.textContent="Last week I printed out the pages and handed them to them in the car as I’m driving them to school. They promptly ignored them and threw them on the floor. Looking back on that, I didn’t set the kids up to succeed. I assumed showing them a page with the stroke order clearly marked would be enough. My takeaway is that it was intimidating to them even with these hints.",K=space(),q=element("p"),q.textContent="Today I took a different tactic which seems obvious in hindsight: demonstrating it myself before they do it. Before driving back from the trampoline park, I took out one of the sheets and showed them how to draw the hiragana. That was helpful for them to gain confidence in a new way of writing. After that, they were off to the races, and it brought tears to my eyes to see them writing Japanese. There were varying levels of perfection, and some tears of frustration on their part, but I kept repeating: “That’s why we practice!” It was so rewarding to see them try this experiment.",J=space(),Q=element("img"),re=space(),ie=element("p"),ie.textContent="I also told them the story about living in Japan and my first embarassing kanji fail. I went to Japan cold turkey in high school, knowing no Japanese. After being there for several weeks and studying every night, I gradually progressed to practicing a few kanji. I then proudly went in to my Japanese high school to show off what I had done. To my utter mortification, my Japanese friends looked at my characters and immediately criticized my stroke order. I never realized how important it was, and I never forgot it.",ae=space(),ne=element("p"),ne.textContent="That was a good segueway to discuss how in Japanese art you often see Japanese characters that are very obscure, but you can often make them out by the stroke order. With an ink quill, you only get one long stroke; the brush never leaves the page. It is really important to follow the prescribed order of strokes. You can see a line that goes on forever and understand that it can be broken into a dozen smaller strokes to create the modern kanji. It’s beautiful and structured, and a facet of Japanese art I never understood until I knew how kanji were composed.",te=space(),oe=element("p"),oe.textContent="Tomorrow we will learn the next ten hiragana. By next Friday, when they get on the plane they are going to know all the hiragana and they will know five words per row. That should be enough to learn different names for sushi and other important words. Then, the fun begins because I can force them to talk in Japanese when they order someone to eat. That’s the best way to get a kid to learn a language, hit them when they are hungry!",attr(_,"class","modal-box"),attr(P,"class","btn btn-sm"),set_style(E,"padding","1rem"),set_style(E,"margin","1rem"),attr(E,"class","modal-backdrop"),attr(c,"id","subscription"),attr(c,"class","modal"),set_style(c,"flex-direction","column"),set_style(c,"height","100%"),set_style(c,"width","100%"),toggle_class(c,"modal-open",x[0]),src_url_equal(F.src,V="https://files.extrastatic.dev/attachments/"+attachments.programmable_leverage.filename)||attr(F,"src",V),attr(H,"class","btn"),src_url_equal(Q.src,ee="https://files.extrastatic.dev/attachments/"+attachments.cloned_installation.filename)||attr(Q,"src",ee)},m(pe,he){insert(pe,c,he),append(c,_),append(_,T),T.innerHTML=C,append(c,M),append(c,E),append(E,P),insert(pe,R,he),insert(pe,$,he),insert(pe,G,he),insert(pe,O,he),insert(pe,L,he),insert(pe,F,he),insert(pe,W,he),insert(pe,z,he),insert(pe,Z,he),insert(pe,H,he),insert(pe,Y,he),insert(pe,U,he),insert(pe,j,he),insert(pe,X,he),insert(pe,K,he),insert(pe,q,he),insert(pe,J,he),insert(pe,Q,he),insert(pe,re,he),insert(pe,ie,he),insert(pe,ae,he),insert(pe,ne,he),insert(pe,te,he),insert(pe,oe,he),ue||(de=[listen(P,"click",x[1]),listen(H,"click",x[2])],ue=!0)},p(pe,[he]){he&1&&toggle_class(c,"modal-open",pe[0])},i:noop$1,o:noop$1,d(pe){pe&&detach(c),pe&&detach(R),pe&&detach($),pe&&detach(G),pe&&detach(O),pe&&detach(L),pe&&detach(F),pe&&detach(W),pe&&detach(z),pe&&detach(Z),pe&&detach(H),pe&&detach(Y),pe&&detach(U),pe&&detach(j),pe&&detach(X),pe&&detach(K),pe&&detach(q),pe&&detach(J),pe&&detach(Q),pe&&detach(re),pe&&detach(ie),pe&&detach(ae),pe&&detach(ne),pe&&detach(te),pe&&detach(oe),ue=!1,run_all(de)}}}const metadata={title:"How I'm teaching my kids Japanese in ten days",published:!0,date:"2024-02-29T00:00:00.000Z",oneoff:{message:"Public.do: read classical Japanese books and augment your Japanese study with flashcards and spaced repetition",iframe:'',button:"Sign up to be notified when public.do launches"},tags:"japanese japan hiragana svelte 10days4hiragana",attachments:{cloned_installation:{filename:"webiphanysvekyll/2024-02-29_5077982_0.png"},programmable_leverage:{filename:"webiphanysvekyll/kana.gif"}}},{title,published,date,oneoff,tags,attachments}=metadata;function instance$1(x,c,_){let T=!1;return[T,()=>_(0,T=!1),()=>_(0,T=!0)]}class _2024_02_29_how_i_m_teaching_my_kids_japanese_in_ten_days extends SvelteComponent{constructor(c){super(),init$3(this,c,instance$1,create_fragment$1,safe_not_equal,{})}}const Index_svelte_svelte_type_style_lang="";function get_each_context(x,c,_){const T=x.slice();return T[8]=c[_],T[10]=_,T}function create_else_block_1(x){let c;return{c(){c=text("No posts exist")},m(_,T){insert(_,c,T)},p:noop$1,i:noop$1,o:noop$1,d(_){_&&detach(c)}}}function create_if_block(x){let c,_,T,C;const M=[create_if_block_1,create_else_block],E=[];function P(R,$){return R[0]?1:0}return c=P(x),_=E[c]=M[c](x),{c(){_.c(),T=empty()},m(R,$){E[c].m(R,$),insert(R,T,$),C=!0},p(R,$){let G=c;c=P(R),c===G?E[c].p(R,$):(group_outros(),transition_out(E[G],1,1,()=>{E[G]=null}),check_outros(),_=E[c],_?_.p(R,$):(_=E[c]=M[c](R),_.c()),transition_in(_,1),_.m(T.parentNode,T))},i(R){C||(transition_in(_),C=!0)},o(R){transition_out(_),C=!1},d(R){E[c].d(R),R&&detach(T)}}}function create_else_block(x){let c,_,T,C,M=x[0].metadata.title+"",E,P,R,$,G,O,L,F,V,W;_=new Pretitle({props:{post:x[0]}});let z=x[0].metadata.date&&create_if_block_6(x);$=new Preroll({props:{post:x[0]}});var Z=x[0].component;function H(Y){return{}}return Z&&(O=construct_svelte_component(Z,H())),F=new Postroll({props:{post:x[0]}}),{c(){c=element("div"),create_component(_.$$.fragment),T=space(),C=element("div"),E=text(M),P=space(),z&&z.c(),R=space(),create_component($.$$.fragment),G=space(),O&&create_component(O.$$.fragment),L=space(),create_component(F.$$.fragment),attr(C,"class","svekyll-post-title"),attr(c,"class","svekyll-post")},m(Y,U){insert(Y,c,U),mount_component(_,c,null),append(c,T),append(c,C),append(C,E),append(c,P),z&&z.m(c,null),append(c,R),mount_component($,c,null),append(c,G),O&&mount_component(O,c,null),append(c,L),mount_component(F,c,null),W=!0},p(Y,U){const j={};U&1&&(j.post=Y[0]),_.$set(j),(!W||U&1)&&M!==(M=Y[0].metadata.title+"")&&set_data(E,M),Y[0].metadata.date?z?z.p(Y,U):(z=create_if_block_6(Y),z.c(),z.m(c,R)):z&&(z.d(1),z=null);const X={};if(U&1&&(X.post=Y[0]),$.$set(X),Z!==(Z=Y[0].component)){if(O){group_outros();const q=O;transition_out(q.$$.fragment,1,0,()=>{destroy_component(q,1)}),check_outros()}Z?(O=construct_svelte_component(Z,H()),create_component(O.$$.fragment),transition_in(O.$$.fragment,1),mount_component(O,c,L)):O=null}const K={};U&1&&(K.post=Y[0]),F.$set(K)},i(Y){W||(transition_in(_.$$.fragment,Y),transition_in($.$$.fragment,Y),O&&transition_in(O.$$.fragment,Y),transition_in(F.$$.fragment,Y),add_render_callback(()=>{V||(V=create_bidirectional_transition(c,fade,{},!0)),V.run(1)}),W=!0)},o(Y){transition_out(_.$$.fragment,Y),transition_out($.$$.fragment,Y),O&&transition_out(O.$$.fragment,Y),transition_out(F.$$.fragment,Y),V||(V=create_bidirectional_transition(c,fade,{},!1)),V.run(0),W=!1},d(Y){Y&&detach(c),destroy_component(_),z&&z.d(),destroy_component($),O&&destroy_component(O),destroy_component(F),Y&&V&&V.end()}}}function create_if_block_1(x){let c,_,T=x[1],C=[];for(let E=0;Etransition_out(C[E],1,1,()=>{C[E]=null});return{c(){c=element("div");for(let E=0;E{P=null}),check_outros())},i($){C||(transition_in(P),add_render_callback(()=>{T||(T=create_bidirectional_transition(c,fade,{},!0)),T.run(1)}),C=!0)},o($){transition_out(P),T||(T=create_bidirectional_transition(c,fade,{},!1)),T.run(0),C=!1},d($){$&&detach(c),P&&P.d(),$&&T&&T.end(),M=!1,E()}}}function create_fragment(x){let c,_,T,C,M,E,P,R,$,G;c=new NavBar({});const O=[create_if_block,create_else_block_1],L=[];function F(V,W){return V[1]?0:1}return C=F(x),M=L[C]=O[C](x),P=new Paginate({props:{count}}),$=new Footer({}),{c(){create_component(c.$$.fragment),_=space(),T=element("div"),M.c(),E=space(),create_component(P.$$.fragment),R=space(),create_component($.$$.fragment),attr(T,"class","container mx-auto svekyll-main")},m(V,W){mount_component(c,V,W),insert(V,_,W),insert(V,T,W),L[C].m(T,null),append(T,E),mount_component(P,T,null),append(T,R),mount_component($,T,null),G=!0},p(V,[W]){M.p(V,W)},i(V){G||(transition_in(c.$$.fragment,V),transition_in(M),transition_in(P.$$.fragment,V),transition_in($.$$.fragment,V),G=!0)},o(V){transition_out(c.$$.fragment,V),transition_out(M),transition_out(P.$$.fragment,V),transition_out($.$$.fragment,V),G=!1},d(V){destroy_component(c,V),V&&detach(_),V&&detach(T),L[C].d(),destroy_component(P),destroy_component($)}}}const slug0="2024-07-29-burying-our-rainbow",slug1="2024-06-04-a-saying-we-have-in-our-family",slug2="2024-05-19-talking-to-a-lobster-phone-about-hell",slug3="2024-05-17-chatgpt-can-bridge-languages-like-python-and-javascript",slug4="2024-04-29-distance-sean-shawn",slug5="2024-03-06-day-6-10-the-words-i-never-thought-i-would-hear",slug6="2024-03-05-day-5-10-in-japanese-why-is-fu-in-the-ha-row-",slug7="2024-03-04-day-4-10-hiragana-loses-out-to-legos",slug8="2024-03-02-day-3-10-teaching-my-kids-to-write-japanese",slug9="2024-02-29-how-i-m-teaching-my-kids-japanese-in-ten-days",count=12;function instance(x,c,_){let T,C,M;component_subscribe(x,blogs,G=>_(4,T=G)),component_subscribe(x,details,G=>_(5,C=G)),component_subscribe(x,sources,G=>_(6,M=G)),set_store_value(sources,M["2024-07-29-burying-our-rainbow"]="LS0tCnRpdGxlOiAiQnVyeWluZyBvdXIgUmFpbmJvdyIKcHVibGlzaGVkOiB0cnVlCmRhdGU6IDIwMjQtMDctMjkKCmF0dGFjaG1lbnRzOgogIG11bHRpX2xheWVyZWRfbGV2ZXJhZ2U6CiAgICBmaWxlbmFtZTogd2ViaXBoYW55c3Zla3lsbC8yMDI0LTA3LTI5XzU1OTUyOTZfMC5wbmcKICAgIG1ldGFkYXRhOgogICAgICBsYXRpdHVkZTogMzAuMDAgIyBzYW5pdGl6ZWQgYnkgc3Zla3lsbAogICAgICBsb25naXR1ZGU6IDMwLjAwICMgc2FuaXRpemVkIGJ5IHN2ZWt5bGwKCnRhZ3M6ICBGbG9yaWRhLCBSYWluYm93LCBjYXQgIAotLS0KClllc3RlcmRheSBJIHJldHJpZXZlZCB0aGUgYm9keSBvZiBvdXIgY2F0LCBSYWluYm93LCBmcm9tIHRoZSBzaGVyaWZmJ3MgYW5pbWFsIGNvbnRyb2wgb2ZmaWNlLgoKPGltZyBzcmM9e2F0dGFjaG1lbnRzLm11bHRpX2xheWVyZWRfbGV2ZXJhZ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G8gZ2xlZWZ1bGx5IGNoYXNlIGxpemFyZHMgYW5kIHRoZW4gcHJvYmFibHkgYXRlIHRoZW0gb25jZSBoZSBnb3QgYm9yZWQgd2l0aCBoaXMgdG95LiBUaGlzIHdheSBoZSBjb3VsZCBjb250aW51ZSB0aGF0IGdhbWUgaW4gdGhlIGFmdGVybGlmZSwgYW5kIHRoZXJlIHdhcyBubyByaXNrIGhlIHdvdWxkIGtpbGwgdGhlIGxpemFyZCBiZWNhdXNlIGl0IHdhcyBhbHJlYWR5IGRlYWQuIEkgd2Fsa2VkIHRoZSBzdHJlZXQgdG8gZmluZCBhIGxpemFyZCB3aG8gbWV0IGhpcyBmYXRlIHdpdGggYSBjYXIgdGlyZSwgYnV0IGNvdWxkIG5vdCBmaW5kIG9uZS4gSSBmb3VuZCBhIGJlYXV0aWZ1bCBidXQgZGVhZCBjYXRlcnBpbGxhciBhbmQgYSBkcmllZCB1cCBkZWFkIGZyb2cgY2FyY2FzcyBhbmQgY2FycmllZCB0aG9zZSBiYWNrIHRvIHRoZSBob2xlLgoKQnV0LCBoZSBsb29rZWQganVzdCBsaWtlIGEgY2F0IHdpdGggdHdvIGJ1dHRzIGFuZCBubyBoZWFkLiBJIHBsYWNlZCBoaW0gaW50byB0aGUgaG9sZSB3aXRoIGhpcyBldGVybmFsIGZyaWVuZHMgdGhlIGZyb2cgYW5kIGNhdGVycGlsbGFyIGFuZCBjb3ZlcmVkIGhpbSB3aXRoIGRpcnQuCgpHb29kYnllLCBSYWluYm93LiBZb3Ugd2VyZSBnb29kIHRvIG15IGtpZHMuIFRoYW5rIHlvdS4KCgoKCiAgCg==",M),set_store_value(sources,M.slugs="2024-07-29-burying-our-rainbow package.json",M),set_store_value(sources,M["package.json"]="ewogICJ2ZXJzaW9uIjogIjAuMC4xIiwKICAic2NyaXB0cyI6IHsKICAgICJidWlsZCI6ICJzdmVreWxsLWNsaSBidWlsZCAmJiAgc3Zla3lsbC1jbGkgZmluYWxpemUiLAogICAgInZlcml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dCB0aGF0IG9uZSBhbmQgdGhhdCBtYWRlIG1lIHNvIGhhcHB5IHRvIHNlZSBoZXIgbGF1Z2guCiAg",M),set_store_value(sources,M.slugs="2024-06-04-a-saying-we-have-in-our-family package.json",M),set_store_value(sources,M["package.json"]="ewogICJ2ZXJzaW9uIjogIjAuMC4xIiwKICAic2NyaXB0cyI6IHsKICAgICJidWlsZCI6ICJzdmVreWxsLWNsaSBidWlsZCAmJiAgc3Zla3lsbC1jbGkgZmluYWxpemUiLAogICAgInZlcmlmeSI6ICJzdmVreWxsLWNsaSB2ZXJpZnkiLAogICAgInVwbG9hZCI6ICJzdmVreWxsLWNsaSB1cGxvYWQiCiAgfSwKICAidHlwZSI6ICJtb2R1bGUiLAogICJkZXBlbmRlbmNpZXMiOiB7CiAgICAic3Zla3lsbC1jbGkiOiAiMC4yLjMiLAogICAgICAiQGh1Z2dpbmdmYWNlL2ppbmphIjogIl4wLjIuMiIsCiAgICAgICJAeGVub3ZhL3RyYW5zZm9ybWVycyI6ICJeMi4xNy4xIiwKICAgICAgImlkYiI6ICJeOC4wLjAiLAogICAgICAib25ueHJ1bnRpbWUtd2ViIjogIl4xLjE3LjMiCiAgfQp9Cg==",M),set_store_value(sources,M["2024-05-19-talking-to-a-lobster-phone-about-hell"]="LS0tCnRpdGxlOiAiVGFsa2luZyB0byBhIGxvYnN0ZXIgcGhvbmUgYWJvdXQgaGVsbCIKcHVibGlzaGVkOiB0cnVlCmRhdGU6IDIwMjQtMDUtMTkKCmF0dGFjaG1lbnRzOgogIG5ldHdvcmtlZF9mdW5jdGlvbjoKICAgIGZpbGVuYW1lOiB3ZWJpcGhhbnlzdmVreWxsLzIwMjQtMDUtMTlfOTg5MDk4N18wLnBuZwogICAgbWV0YWRhdGE6CiAgICAgIGxhdGl0dWRlOiAzMC4wMCAjIHNhbml0aXplZCBieSBzdmVreWxsCiAgICAgIGxvbmdpdHVkZTogMzAuMDAgIyBzYW5pdGl6ZWQgYnkgc3Zla3lsbAoKdGF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GlzdCwgc2hlIGludml0ZXMgeW91IHRvIGV4cGxvcmUgcmVhbG1zIG9mIGZpZXJ5IGltYWdpbmF0aW9uLiBEYXJlIHRvIGFzayBoZXIgYW5kIHR1cm4gaGVyIHdvcmRzIGludG8gYSBwb3J0cmFpdCBvZiB1bmRlcnN0YW5kaW5nLioiCgpBcnQgaXMgaGVhbGluZyBhbmQgdGhpcyBtdXNldW0gaXMgYSBncmVhdCBwbGFjZSB0byBnbyB3aGVuIHlvdXIga2lkIGlzIGluIHBhaW4uCgoKICAK",M),set_store_value(sources,M.slugs="2024-05-19-talking-to-a-lobster-phone-about-hell package.json",M),set_store_value(sources,M["package.json"]="ewogICJ2ZXJzaW9uIjogIjAuMC4xIiwKICAic2NyaXB0cyI6IHsKICAgICJidWlsZCI6ICJzdmVreWxsLWNsaSBidWlsZCAmJiAgc3Zla3lsbC1jbGkgZmluYWxpemUiLAogICAgInZlcmlmeSI6ICJzdmVreWxsLWNsaSB2ZXJpZnkiLAogICAgInVwbG9hZCI6ICJzdmVreWxsLWNsaSB1cGxvYWQiCiAgfSwKICAidHlwZSI6ICJtb2R1bGUiLAogICJkZXBlbmRlbmNpZXMiOiB7CiAgICAic3Zla3lsbC1jbGkiOiAiMC4yLjMiLAogICAgICAiQGh1Z2dpbmdmYWNlL2ppbmphIjogIl4wLjIuMiIsCiAgICAgICJAeGVub3ZhL3RyYW5zZm9ybWVycyI6ICJeMi4xNy4xIiwKICAgICAgImlkYiI6ICJeOC4wLjAiLAogICAgICAib25ueHJ1bnRpbWUtd2ViIjogIl4xLjE3LjMiCiAgfQp9Cg==",M),set_store_value(sources,M["2024-05-17-chatgpt-can-bridge-languages-like-python-and-javascript"]="LS0tCnRpdGxlOiAiQ2hhdEdQVCBjYW4gYnJpZGdlIGxhbmd1YWdlcyBsaWtlIFB5dGhvbiBhbmQgSmF2YVNjcmlwdCIKcHVibGlzaGVkOiB0cnVlCmRhdGU6IDIwMjQtMDUtMTcKdGFnczogY2hhdGdwdCwgY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RlKCk7ICAKZGF0ZTIuc2V0VGltZShkYXRlKTsgIApjb25zb2xlLmxvZyhnZXREYXlTaW5jZUVwb2NoKGRhdGUyKSk7CgpgYGAKClRoYXQgc2F2ZWQgbWUgYSBsb3Qgb2Ygd29yay4KCjxpbWcgc3JjPXthdHRhY2htZW50cy5zeW5lcmdpemVkX3ByaWNpbmdfc3RydWN0dXJlLmZpbGVuYW1lfS8+CgoKCiAgCg==",M),set_store_value(sources,M.slugs="2024-05-17-chatgpt-can-bridge-languages-like-python-and-javascript package.json",M),set_store_value(sources,M["package.json"]="ewogICJ2ZXJzaW9uIjogIjAuMC4xIiwKICAic2NyaXB0cyI6IHsKICAgICJidWlsZCI6ICJzdmVreWxsLWNsaSBidWlsZCAmJiAgc3Zla3lsbC1jbGkgZmluYWxpemUiLAogICAgInZlcmlmeSI6ICJzdmVreWxsLWNsaSB2ZXJpZnkiLAogICAgInVwbG9hZCI6ICJzdmVreWxsLWNsaSB1cGxvYWQiCiAgfSwKICAidHlwZSI6ICJtb2R1bGUiLAogICJkZXBlbmRlbmNpZXMiOiB7CiAgICAic3Zla3lsbC1jbGkiOiAiMC4yLjMiLAogICAgICAiQGh1Z2dpbmdmYWNlL2ppbmphIjogIl4wLjIuMiIsCiAgICAgICJAeGVub3ZhL3RyYW5zZm9ybWVycyI6ICJeMi4xNy4xIiwKICAgICAgImlkYiI6ICJeOC4wLjAiLAogICAgICAib25ueHJ1bnRpbWUtd2ViIjogIl4xLjE3LjMiCiAgfQp9Cg==",M),set_store_value(sources,M["2024-04-29-distance-sean-shawn"]="LS0tCnRpdGxlOiAiV2hhdCBpcyB0aGUgY29zaW5lIGRpc3RhbmNlIGJldHdlZW4gU2VhbiBhbmQgU2hhd24/IgpwdWJsaXNoZWQ6IHRydWUKZGF0ZTogMjAyNC0wNC0yOQp0YWdzOiBhaSwgZW1iZWRkaW5ncywgY29zaW5lc2ltaWxhcml0eSwgamF2YXNjcmlwdCwgcHl0aG9uCi0tLQoKVGhpcyBw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YWl0IGV4dHJhY3Rvcih0ZXh0LCB7IHBvb2xpbmc6ICdtZWFuJywgbm9ybWFsaXplOiB0cnVlIH0pOwpgOwoKICBhc3luYyBmdW5jdGlvbiBnKHRleHQsIHIpIHsKICAgIGF3YWl0IGdlbmVyYXRlRW1iZWRkaW5nKHRleHQsIHIpOwogIH0KICAKICBmdW5jdGlvbiBjbGVhckNvc2luZUNhbGMoKSB7CiAgICAkcmVzdWx0ID0gJHJlc3VsdDIgPSB1bmRlZmluZWQ7CiAgfQoKPC9zY3JpcHQ+Cgo8c3R5bGU+Ci5vdmVyZmxvd3ggewpAYXBwbHkgb3ZlcmZsb3cteC1hdXRvOwp9CgogIDpnbG9iYWwoLmJ0bm4pIHsKICAgIEBhcHBseSBidG4gYmctb3JhbmdlLTMwMCBzaGFkb3ctbGc7CiAgfQoKICAudHdvIHsKICAgIEBhcHBseSBncmlkIGdyaWQtY29scy0yOwogIH0KICAudHdvLWZsZXggewogIEBhcHBseSBmbGV4IGZsZXgtY29sIGNvbC1zcGFuLTI7CiAgfQogIDwvc3R5bGU+Cg==",M),set_store_value(sources,M.slugs="2024-04-29-distance-sean-shawn ./embeddings/Embedding.svelte ./embeddings/Numbers.svelte ./embeddings/TwoDimensions.svelte ./embeddings/CosineCalculator.svelte ./embeddings/Credits.svelte ./embeddings/Mult.svelte ./embeddings/Cartesian.svelte package.json",M),set_store_value(sources,M["./embeddings/Embedding.svelte"]="PHNjcmlwdD4KICBpbXBvcnQgeyBmbHkgfSBmcm9tICdzdmVsdGUvdHJhbnNpdGlvbic7CiAgaW1wb3J0IHsgY2lyY0luT3V0IH0gZnJvbSAnc3ZlbHRlL2Vhc2luZyc7CiAgZXhwb3J0IGxldCByZXN1bHQ7CiAgZXhwb3J0IGxldCBoaWRkZW47CiAgZXhwb3J0IGxldCBuYW1lID0gInVua25vd24iOwoKICBmdW5jdGlvbiBmbG9hdChpKSB7CiAgICByZXR1cm4gcGFyc2VGbG9hdChpKS50b1ByZWNpc2lvbig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ICRyZXN1bHQgYXMgciwgaX0KICAgIHsjaWYgaSA8IDEwfQogICAgICA8c3BhbiBjbGFzcz0iYm9sZGVkIj57IGZsb2F0KHIpIH08L3NwYW4+LAogICAgezplbHNlIGlmIGkgPT09IDEwfQogICAgICAuLi4KICAgIHs6ZWxzZX0KICAgICAgey9pZn0KICAgIHsvZWFjaH0KICAgIF0KPC9zcGFuPgp7L2lmfQoKPHN0eWxlPgouYm9sZGVkIHsKICBAYXBwbHkgZm9udC1ib2xkOwp9CgoubnVtYmVycyB7CiAgQGFwcGx5CiAgZmxleAogIG1heC1oLTE2OwoKfQo8L3N0eWxlPgogIAogIAo=",M),set_store_value(sources,M["./embeddings/TwoDimensions.svelte"]="PHNjcmlwdD4KICBpbXBvcnQgQ2FydGVzaWFuIGZyb20gJy4vQ2FydGVzaWFuLnN2ZWx0ZSc7CiAgaW1wb3J0IE51bWJlcnMgZnJvbSAnLi9OdW1iZXJzLnN2ZWx0ZSc7CiAgaW1wb3J0IHsgb25Nb3VudCB9IGZyb20gJ3N2ZWx0ZSc7CiAgaW1wb3J0IHsgd3JpdGFibGUgfSBmcm9tICdzdmVsdGUvc3RvcmUnOwogIGxldCBkYXRhID0gd3JpdGFibGUoW10pOwogIGxldCBkaXN0YW5jZSA9IDA7CgogIGZ1bmN0aW9uIGZsb2F0KGkpIHsKICAgIHJldHVybiBwYXJzZUZsb2F0KGkpLnRvUHJlY2lzaW9uKDIpOwogIH0KICAKICBmdW5jdGlvbiBmb3JtYXQoaSkgewogICAgcmV0dXJuICdbJyArIGkubWFwKCBqID0+IGouam9pbignLCAnKSApLmpvaW4oJ10gYW5kIFsnKSArICddJwogIH0KICAKICBmdW5jdGlvbiBjb3NpbmVTaW1pbGFyaXR5KEEsIEIpIHsKICAgIHZhciBkb3Rwcm9kdWN0ID0gMDsKICAgIHZhciBtQSA9IDA7CiAgICB2YXIgbUIgPSAwOwogICAgCiAgICBmb3IodmFyIGkgPSAwOyBpIDwgQS5sZW5ndGg7IGkr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U7CiAgfQoKICAudG90YWwtd3JhcHBlciB7CiAgICBAYXBwbHkgcmVsYXRpdmUgcHktMjsKICB9CgogIC5wZXJzb24gewogICAgQGFwcGx5CiAgICBtci00IHByLTQKICAgIGZsZXggZmxleC1jb2wKICAgIGl0ZW1zLWNlbnRlcgogICAganVzdGlmeS1jZW50ZXIKICAgIGgtMzIgdy0zMjsKICB9CiAgCiAgLm5hbWUgewogICAgQGFwcGx5CiAgICByZWxhdGl2ZQogICAgLWJvdHRvbS00CiAgICAtcmlnaHQtMgogICAgc2hhZG93LXhsCiAgICByb3VuZGVkLW1kCiAgICBiZy1ibHVlLTEwMAogICAgdW5kZXJsaW5lCiAgICB3LTMyOwogIH0KICAKICAud3JhcHBlciB7CiAgICBAYXBwbHkKICAgIC1zcGFjZS14LTIKICAgIG92ZXJmbG93LWhpZGRlbgogIH0KCiAgLmltYWdlcyB7CiAgICBAYXBwbHkgZmxleCBmbGV4LXJvdyBoLTQwOwogIH0KCiAgLmJpbyB7CiAgICByaWdodDogLTVyZW07CiAgICBib3R0b206IC0xcmVtOwogICAgQGFwcGx5CiAgICByZWxhdGl2ZQogICAgdGV4dC14cwogICAgdy02NAogICAgOwogIH0KPC9zdHlsZT4K",M),set_store_value(sources,M["./embeddings/Mult.svelte"]="PHNjcmlwdD4KICBpbXBvcnQgeyBvbk1vdW50IH0gZnJvbSAnc3ZlbHRlJzsKICBpbXBvcnQgeyBmbHkgfSBmcm9tICdzdmVsdGUvdHJhbnNpdGlvbic7CiAgZXhwb3J0IGxldCBhOwogIGV4cG9ydCBsZXQgYjsKICBleHBvcnQgbGV0IHRpbWU7CiAgbGV0IHJlc3VsdCA9IDA7CgogIGZ1bmN0aW9uIGZsb2F0KGkpIHsKICAgIHJldHVybiBwYXJzZUZsb2F0KGkpLnRvUHJlY2lzaW9uKDIpOwogIH0KICAKICBmdW5jdGlvbiBydW4oKSB7CiAgICByZXN1bHQgPSAwOwogICAgc2V0VGltZW91dCggKCkgPT4gewogICAgICByZ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SBkYWQgbGl2aW5nIGluIEZsb3JpZGEgdG8gdGVsbCBteSBraWRzIHRob3NlIGtpbmRzIG9mIHRoaW5ncywgYmVjYXVzZSBSb24gRGVTYW50aXMgd29uJ3QgYmUgcGVybWl0dGluZyB0aGF0LgoKPGltZyBzcmM9e2F0dGFjaG1lbnRzLmFzc2ltaWxhdGVkX2xvY2FsX2FyZWFfbmV0d29yay5maWxlbmFtZX0vPgoKTm9yYWggd2FzIGV4Y2l0ZWQgZm9yIHRoZSAibWEiIHJvdyBiZWNhdXNlIHNoZSByZWFkICJtYW1lIiAoYmVhbnMpIGFuZCBzaG91dGVkICJFZGFtYW1lISBEb2VzIGl0IG1lYW4gZ3JlZW4gYmVhbnM/IiBObywgYnV0IGl0IGRvZXMgbWVhbiBiZWFuLCBhbmQgbm93IHlvdSBjYW4gd3JpdGUgaXQhIFNoZSdzIHRoZSBvbmUgdGhhdCBkaXNjb3ZlcmVkIHRoZSB0ZW4tdGVuICh0d28gZG90cykgdGhhdCB5b3UgYWRkIHRvIGEgY2hhcmFjdGVyLCB3aGljaCBtZWFucyBzaGUgY2FuIGNvbnZlcnQgdGEgdG8gZGEuCgo=",M),set_store_value(sources,M.slugs="2024-03-06-day-6-10-the-words-i-never-thought-i-would-hear package.json",M),set_store_value(sources,M["package.json"]="ewogICJ2ZXJzaW9uIjogIjAuMC4xIiwKICAic2NyaXB0cyI6IHsKICAgICJidWlsZCI6ICJzdmVreWxsLWNsaSBidWlsZCAmJiAgc3Zla3lsbC1jbGkgZmluYWxpemUiLAogICAgInZlcmlmeSI6ICJzdmVreWxsLWNsaSB2ZXJpZnkiLAogICAgInVwbG9hZCI6ICJzdmVreWxsLWNsaSB1cGxvYWQiCiAgfSwKICAidHlwZSI6ICJtb2R1bGUiLAogICJkZXBlbmRlbmNpZXMiOiB7CiAgICAic3Zla3lsbC1jbGkiOiAiMC4yLjMiLAogICAgICAiQGh1Z2dpbmdmYWNlL2ppbmphIjogIl4wLjIuMiIsCiAgICAgICJ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IGFuZCBteSBzb24gZmluaXNoZWQgb2ZmIHdpdGggTGF1cmVsaHVyc3QuIEl0IGlzIGEgZnVubnkgd29yZCwgYmVjYXVzZSBpdCBpcyBhYm91dCB0aGUgbW9zdCBkaWZmaWN1bHQgc2V0IG9mIHNvdW5kcyB5b3UgY291bGQgYXNrIGEgSmFwYW5lc2VzIHBlcnNvbiBjb3VsZCB0cnkgdG8gbWFrZTogZm91ciBMIHNvdW5kcyBhbmQgYSBodSBzb3VuZCwgbm9uZSBvZiB3aGljaCBleGlzdCBpbiB0aGUgc3Bva2VuIEphcGFuZXNlIGxhbmd1YWdlLiBTbywgb3VyIGV4Y2hhbmdlIHN0dWRlbnQgd2hlbiBJIHdhcyBvbmUgeWVhcnMgb2xkIGhhZCBhIGhhcmQgdGltZSwgYXMgbXkgZGFkIHVzZWQgdG8gcmVjb3VudCwgd2hlbiBoZSBoYWQgdG8gc2F5IHRoZSBuYW1lIG9mIHRoZSBwYXJrIGhlIGxpdmVkIG5leHQgdG8gZm9yIGEgeWVhci4gR29vZCBtZW1vcmllcy4K",M),set_store_value(sources,M.slugs="2024-03-05-day-5-10-in-japanese-why-is-fu-in-the-ha-row- package.json",M),set_store_value(sources,M["package.json"]="ewogICJ2ZXJzaW9uIjogIjAuMC4xIiwKICAic2NyaXB0cyI6IHsKICAgICJidWlsZCI6ICJzdmVreWxsLWNsaSBidWlsZCAmJiAgc3Zla3lsbC1jbGkgZmluYWxpemUiLAogICAgInZlcmlmeSI6ICJzdmVreWxsLWNsaSB2ZXJpZnkiLAogICAgInVwbG9hZCI6ICJzdmVreWxsLWNsaSB1cGxvYWQiCiAgfSwKICAidHlwZSI6ICJtb2R1bGUiLAogICJkZXBlbmRlbmNpZXMiOiB7CiAgICAic3Zla3lsbC1jbGkiOiAiMC4yLjMiLAogICAgICAiQGh1Z2dpbmdmYWNlL2ppbmphIjogIl4wLjIuMiIsCiAgICAgICJAeGVub3ZhL3RyYW5zZm9ybWVycyI6ICJeMi4xNy4xIi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vbWUgb2YgdGhlIHByaW9yIGNoYXJhY3RlcnMgdG8gc2VlIGlmIHRoYXQgcmV2aWV3IGhlbHBzIHRoZW0gbGVhcm4sIGFuZCBoZWxwcyB0aGVtIGdldCBpbnRvIGEgbGVhcm5pbmcgbW9yZS4KCgogIAo=",M),set_store_value(sources,M.slugs="2024-03-04-day-4-10-hiragana-loses-out-to-legos package.json",M),set_store_value(sources,M["package.json"]="ewogICJ2ZXJzaW9uIjogIjAuMC4xIiwKICAic2NyaXB0cyI6IHsKICAgICJidWlsZCI6ICJzdmVreWxsLWNsaSBidWlsZCAmJiAgc3Zla3lsbC1jbGkgZmluYWxpemUiLAogICAgInZlcmlmeSI6ICJzdmVreWxsLWNsaSB2ZXJpZnkiLAogICAgInVwbG9hZCI6ICJzdmVreWxsLWNsaSB1cGxvYWQiCiAgfSwKICAidHlwZSI6ICJtb2R1bGUiLAogICJkZXBlbmRlbmNpZXMiOiB7CiAgICAic3Zla3lsbC1jbGkiOiAiMC4yLjMiLAogICAgICAiQGh1Z2dpbmdmYWNlL2ppbmphIjogIl4wLjIuMiIsCiAgICAgICJAeGVub3ZhL3RyYW5zZm9ybWVycyI6ICJeMi4xNy4xIiwKICAgICAgImlkYiI6ICJeOC4wLjAiLAogICAgICAib25ueHJ1bnRpbWUtd2ViIjogIl4xLjE3LjMiCiAgfQp9Cg==",M),set_store_value(sources,M["2024-03-02-day-3-10-teaching-my-kids-to-write-japanese"]="LS0tCnRpdGxlOiAiRGF5IDMvMTA6IHRlYWNoaW5nIG15IGtpZHMgdG8gd3JpdGUgSmFwYW5lc2UiCnB1Ymxpc2hlZDogdHJ1ZQpkYXRlOiAyMDI0LTAzLTAyCnRhZ3M6IGphcGFuZXNlIGphcGFuIGhpcmFnYW5hIHN2ZWx0ZSAxMGRheXM0aGlyYWdhbmEKYXR0YWNobWVudHM6CiAgaW50dWl0aXZlX2NvcmU6CiAgICBmaWxlbmFtZTogd2ViaXBoYW55c3Zla3lsbC8yMDI0LTAzLTA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(sources,M.slugs="2024-03-02-day-3-10-teaching-my-kids-to-write-japanese package.json",M),set_store_value(sources,M["package.json"]="ewogICJ2ZXJzaW9uIjogIjAuMC4xIiwKICAic2NyaXB0cyI6IHsKICAgICJidWlsZCI6ICJzdmVreWxsLWNsaSBidWlsZCAmJiAgc3Zla3lsbC1jbGkgZmluYWxpemUiLAogICAgInZlcmlmeSI6ICJzdmVreWxsLWNsaSB2ZXJpZnkiLAogICAgInVwbG9hZCI6ICJzdmVreWxsLWNsaSB1cGxvYWQiCiAgfSwKICAidHlwZSI6ICJtb2R1bGUiLAogICJkZXBlbmRlbmNpZXMiOiB7CiAgICAic3Zla3lsbC1jbGkiOiAiMC4yLjMiLAogICAgICAiQGh1Z2dpbmdmYWNlL2ppbmphIjogIl4wLjIuMiIsCiAgICAgICJAeGVub3ZhL3RyYW5zZm9ybWVycyI6ICJeMi4xNy4xIiwKICAgICAgImlkYiI6ICJeOC4wLjAiLAogICAgICAib25ueHJ1bnRpbWUtd2ViIjogIl4xLjE3LjMiCiAgfQp9Cg==",M),set_store_value(sources,M["2024-02-29-how-i-m-teaching-my-kids-japanese-in-ten-days"]="LS0tCnRpdGxlOiAiSG93IEknbSB0ZWFjaGluZyBteSBraWRzIEphcGFuZXNlIGluIHRlbiBkYXlzIgpwdWJsaXNoZWQ6IHRydWUKZGF0ZTogMjAyNC0wMi0yOQpvbmVvZmY6CiAgbWVzc2FnZTogIlB1YmxpYy5kbzogcmVhZCBjbGFzc2ljYWwgSmFwYW5lc2UgYm9va3MgYW5kIGF1Z21lbnQgeW91ciBKYXBhbmVzZSBzdHVkeSB3aXRoIGZsYXNoY2FyZHMgYW5kIHNwYWNlZCByZXBldGl0aW9uIgogIGlmcmFtZTogJzxpZnJhbWUgd2lkdGg9IjU0MCIgaGVpZ2h0PSI2MDAiIHNyYz0iaHR0cHM6Ly82MWU1NjNmYy5zaWJmb3Jtcy5jb20vc2VydmUvTVVJRkFHMXZPWXVmZ0h2NV9zeTlkV2pMNnRv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yB0byBrbm93IGFsbCB0aGUgaGlyYWdhbmEgYW5kIHRoZXkgd2lsbCBrbm93IGZpdmUgd29yZHMgcGVyIHJvdy4gVGhhdCBzaG91bGQgYmUgZW5vdWdoIHRvIGxlYXJuIGRpZmZlcmVudCBuYW1lcyBmb3Igc3VzaGkgYW5kIG90aGVyIGltcG9ydGFudCB3b3Jkcy4gVGhlbiwgdGhlIGZ1biBiZWdpbnMgYmVjYXVzZSBJIGNhbiBmb3JjZSB0aGVtIHRvIHRhbGsgaW4gSmFwYW5lc2Ugd2hlbiB0aGV5IG9yZGVyIHNvbWVvbmUgdG8gZWF0LiBUaGF0J3MgdGhlIGJlc3Qgd2F5IHRvIGdldCBhIGtpZCB0byBsZWFybiBhIGxhbmd1YWdlLCBoaXQgdGhlbSB3aGVuIHRoZXkgYXJlIGh1bmdyeSEKCg==",M),set_store_value(sources,M.slugs="2024-02-29-how-i-m-teaching-my-kids-japanese-in-ten-days package.json",M),set_store_value(sources,M["package.json"]="ewogICJ2ZXJzaW9uIjogIjAuMC4xIiwKICAic2NyaXB0cyI6IHsKICAgICJidWlsZCI6ICJzdmVreWxsLWNsaSBidWlsZCAmJiAgc3Zla3lsbC1jbGkgZmluYWxpemUiLAogICAgInZlcmlmeSI6ICJzdmVreWxsLWNsaSB2ZXJpZnkiLAogICAgInVwbG9hZCI6ICJzdmVreWxsLWNsaSB1cGxvYWQiCiAgfSwKICAidHlwZSI6ICJtb2R1bGUiLAogICJkZXBlbmRlbmNpZXMiOiB7CiAgICAic3Zla3lsbC1jbGkiOiAiMC4yLjMiLAogICAgICAiQGh1Z2dpbmdmYWNlL2ppbmphIjogIl4wLjIuMiIsCiAgICAgICJAeGVub3ZhL3RyYW5zZm9ybWVycyI6ICJeMi4xNy4xIiwKICAgICAgImlkYiI6ICJeOC4wLjAiLAogICAgICAib25ueHJ1bnRpbWUtd2ViIjogIl4xLjE3LjMiCiAgfQp9Cg==",M),set_store_value(details,C=JSON.parse('{"version":"0.2.3","description":{}}'),C);const E=[{component:_2024_07_29_burying_our_rainbow,metadata:metadata$9,slug:slug0},{component:_2024_06_04_a_saying_we_have_in_our_family,metadata:metadata$8,slug:slug1},{component:_2024_05_19_talking_to_a_lobster_phone_about_hell,metadata:metadata$7,slug:slug2},{component:_2024_05_17_chatgpt_can_bridge_languages_like_python_and_javascript,metadata:metadata$6,slug:slug3},{component:_2024_04_29_distance_sean_shawn,metadata:metadata$5,slug:slug4},{component:_2024_03_06_day_6_10_the_words_i_never_thought_i_would_hear,metadata:metadata$4,slug:slug5},{component:_2024_03_05_day_5_10_in_japanese_why_is_fu_in_the_ha_row,metadata:metadata$3,slug:slug6},{component:_2024_03_04_day_4_10_hiragana_loses_out_to_legos,metadata:metadata$2,slug:slug7},{component:_2024_03_02_day_3_10_teaching_my_kids_to_write_japanese,metadata:metadata$1,slug:slug8},{component:_2024_02_29_how_i_m_teaching_my_kids_japanese_in_ten_days,metadata,slug:slug9}];new Array(12),set_store_value(blogs,T={message:"Other interesting things:",transition_time:5e3,type:"marquee",items:[{name:"Webiphany.com",url:"https://webiphany.com"},{name:"Plz@Me: subscribe to interesting threads and people on HN",url:"https://plzat.me"},{name:"Public.DO: read classic books, serialized over email, in English or foreign languages",url:"https://public.do",description:"Read famous books like Kokoro (with Japanese subtitles) and practice Kanji"},{name:"Basqui@",url:"https://basqui.at",description:"Digital art and the anarchy that follows"},{name:"Katarismo.com: building adventure games with LLMs",url:"https://blog.katarismo.com",description:"A community and ebook on how to build adventure games with large language models"}]},T);let P;function R(G){_(0,P=G);const O="../"+G.slug;log("Page is now",O),history.pushState({page:O},O,O)}onMount(()=>{window.addEventListener("popstate",function(G){_(0,P=void 0)},!1)});const $=G=>R(G);return x.$$.update=()=>{x.$$.dirty&1&&log("Displayed just changed",P)},[P,E,R,$]}class Index extends SvelteComponent{constructor(c){super(),init$3(this,c,instance,create_fragment,safe_not_equal,{})}}const _debug=window.location.search&&window.location.search.includes("SVEKYLL_DEBUG");debug.set(_debug);new Index({target:document.getElementById("app")});