scribe-widget 1.0.15 → 1.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -37,7 +37,7 @@
37
37
  `+h[_].replace(" at new "," at ");return i.displayName&&nt.includes("<anonymous>")&&(nt=nt.replace("<anonymous>",i.displayName)),nt}while(1<=_&&0<=j);break}}}finally{Na$1=!1,Error.prepareStackTrace=s}return(i=i?i.displayName||i.name:"")?Ma$1(i):""}function Pa$1(i){switch(i.tag){case 5:return Ma$1(i.type);case 16:return Ma$1("Lazy");case 13:return Ma$1("Suspense");case 19:return Ma$1("SuspenseList");case 0:case 2:case 15:return i=Oa$1(i.type,!1),i;case 11:return i=Oa$1(i.type.render,!1),i;case 1:return i=Oa$1(i.type,!0),i;default:return""}}function Qa$1(i){if(i==null)return null;if(typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case ya$1:return"Fragment";case wa$1:return"Portal";case Aa$1:return"Profiler";case za$1:return"StrictMode";case Ea$1:return"Suspense";case Fa$1:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case Ca$1:return(i.displayName||"Context")+".Consumer";case Ba$1:return(i._context.displayName||"Context")+".Provider";case Da$1:var e=i.render;return i=i.displayName,i||(i=e.displayName||e.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case Ga$1:return e=i.displayName||null,e!==null?e:Qa$1(i.type)||"Memo";case Ha$1:e=i._payload,i=i._init;try{return Qa$1(i(e))}catch{}}return null}function Ra$1(i){var e=i.type;switch(i.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return i=e.render,i=i.displayName||i.name||"",e.displayName||(i!==""?"ForwardRef("+i+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Qa$1(e);case 8:return e===za$1?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Sa$1(i){switch(typeof i){case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function Ta$1(i){var e=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Ua$1(i){var e=Ta$1(i)?"checked":"value",s=Object.getOwnPropertyDescriptor(i.constructor.prototype,e),c=""+i[e];if(!i.hasOwnProperty(e)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var h=s.get,$=s.set;return Object.defineProperty(i,e,{configurable:!0,get:function(){return h.call(this)},set:function(_){c=""+_,$.call(this,_)}}),Object.defineProperty(i,e,{enumerable:s.enumerable}),{getValue:function(){return c},setValue:function(_){c=""+_},stopTracking:function(){i._valueTracker=null,delete i[e]}}}}function Va$1(i){i._valueTracker||(i._valueTracker=Ua$1(i))}function Wa$1(i){if(!i)return!1;var e=i._valueTracker;if(!e)return!0;var s=e.getValue(),c="";return i&&(c=Ta$1(i)?i.checked?"true":"false":i.value),i=c,i!==s?(e.setValue(i),!0):!1}function Xa$1(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}function Ya$1(i,e){var s=e.checked;return A({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:s??i._wrapperState.initialChecked})}function Za$1(i,e){var s=e.defaultValue==null?"":e.defaultValue,c=e.checked!=null?e.checked:e.defaultChecked;s=Sa$1(e.value!=null?e.value:s),i._wrapperState={initialChecked:c,initialValue:s,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function ab(i,e){e=e.checked,e!=null&&ta$1(i,"checked",e,!1)}function bb(i,e){ab(i,e);var s=Sa$1(e.value),c=e.type;if(s!=null)c==="number"?(s===0&&i.value===""||i.value!=s)&&(i.value=""+s):i.value!==""+s&&(i.value=""+s);else if(c==="submit"||c==="reset"){i.removeAttribute("value");return}e.hasOwnProperty("value")?cb(i,e.type,s):e.hasOwnProperty("defaultValue")&&cb(i,e.type,Sa$1(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(i.defaultChecked=!!e.defaultChecked)}function db(i,e,s){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var c=e.type;if(!(c!=="submit"&&c!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+i._wrapperState.initialValue,s||e===i.value||(i.value=e),i.defaultValue=e}s=i.name,s!==""&&(i.name=""),i.defaultChecked=!!i._wrapperState.initialChecked,s!==""&&(i.name=s)}function cb(i,e,s){(e!=="number"||Xa$1(i.ownerDocument)!==i)&&(s==null?i.defaultValue=""+i._wrapperState.initialValue:i.defaultValue!==""+s&&(i.defaultValue=""+s))}var eb=Array.isArray;function fb(i,e,s,c){if(i=i.options,e){e={};for(var h=0;h<s.length;h++)e["$"+s[h]]=!0;for(s=0;s<i.length;s++)h=e.hasOwnProperty("$"+i[s].value),i[s].selected!==h&&(i[s].selected=h),h&&c&&(i[s].defaultSelected=!0)}else{for(s=""+Sa$1(s),e=null,h=0;h<i.length;h++){if(i[h].value===s){i[h].selected=!0,c&&(i[h].defaultSelected=!0);return}e!==null||i[h].disabled||(e=i[h])}e!==null&&(e.selected=!0)}}function gb(i,e){if(e.dangerouslySetInnerHTML!=null)throw Error(p(91));return A({},e,{value:void 0,defaultValue:void 0,children:""+i._wrapperState.initialValue})}function hb(i,e){var s=e.value;if(s==null){if(s=e.children,e=e.defaultValue,s!=null){if(e!=null)throw Error(p(92));if(eb(s)){if(1<s.length)throw Error(p(93));s=s[0]}e=s}e==null&&(e=""),s=e}i._wrapperState={initialValue:Sa$1(s)}}function ib(i,e){var s=Sa$1(e.value),c=Sa$1(e.defaultValue);s!=null&&(s=""+s,s!==i.value&&(i.value=s),e.defaultValue==null&&i.defaultValue!==s&&(i.defaultValue=s)),c!=null&&(i.defaultValue=""+c)}function jb(i){var e=i.textContent;e===i._wrapperState.initialValue&&e!==""&&e!==null&&(i.value=e)}function kb(i){switch(i){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function lb(i,e){return i==null||i==="http://www.w3.org/1999/xhtml"?kb(e):i==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":i}var mb,nb=function(i){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,s,c,h){MSApp.execUnsafeLocalFunction(function(){return i(e,s,c,h)})}:i}(function(i,e){if(i.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in i)i.innerHTML=e;else{for(mb=mb||document.createElement("div"),mb.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=mb.firstChild;i.firstChild;)i.removeChild(i.firstChild);for(;e.firstChild;)i.appendChild(e.firstChild)}});function ob(i,e){if(e){var s=i.firstChild;if(s&&s===i.lastChild&&s.nodeType===3){s.nodeValue=e;return}}i.textContent=e}var pb={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},qb=["Webkit","ms","Moz","O"];Object.keys(pb).forEach(function(i){qb.forEach(function(e){e=e+i.charAt(0).toUpperCase()+i.substring(1),pb[e]=pb[i]})});function rb(i,e,s){return e==null||typeof e=="boolean"||e===""?"":s||typeof e!="number"||e===0||pb.hasOwnProperty(i)&&pb[i]?(""+e).trim():e+"px"}function sb(i,e){i=i.style;for(var s in e)if(e.hasOwnProperty(s)){var c=s.indexOf("--")===0,h=rb(s,e[s],c);s==="float"&&(s="cssFloat"),c?i.setProperty(s,h):i[s]=h}}var tb=A({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ub(i,e){if(e){if(tb[i]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(p(137,i));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(p(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(p(61))}if(e.style!=null&&typeof e.style!="object")throw Error(p(62))}}function vb(i,e){if(i.indexOf("-")===-1)return typeof e.is=="string";switch(i){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var wb=null;function xb(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var yb=null,zb=null,Ab=null;function Bb(i){if(i=Cb(i)){if(typeof yb!="function")throw Error(p(280));var e=i.stateNode;e&&(e=Db(e),yb(i.stateNode,i.type,e))}}function Eb(i){zb?Ab?Ab.push(i):Ab=[i]:zb=i}function Fb(){if(zb){var i=zb,e=Ab;if(Ab=zb=null,Bb(i),e)for(i=0;i<e.length;i++)Bb(e[i])}}function Gb(i,e){return i(e)}function Hb(){}var Ib=!1;function Jb(i,e,s){if(Ib)return i(e,s);Ib=!0;try{return Gb(i,e,s)}finally{Ib=!1,(zb!==null||Ab!==null)&&(Hb(),Fb())}}function Kb(i,e){var s=i.stateNode;if(s===null)return null;var c=Db(s);if(c===null)return null;s=c[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(i=i.type,c=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!c;break e;default:i=!1}if(i)return null;if(s&&typeof s!="function")throw Error(p(231,e,typeof s));return s}var Lb=!1;if(ia$1)try{var Mb={};Object.defineProperty(Mb,"passive",{get:function(){Lb=!0}}),window.addEventListener("test",Mb,Mb),window.removeEventListener("test",Mb,Mb)}catch{Lb=!1}function Nb(i,e,s,c,h,$,_,j,nt){var et=Array.prototype.slice.call(arguments,3);try{e.apply(s,et)}catch(b){this.onError(b)}}var Ob=!1,Pb=null,Qb=!1,Rb=null,Sb={onError:function(i){Ob=!0,Pb=i}};function Tb(i,e,s,c,h,$,_,j,nt){Ob=!1,Pb=null,Nb.apply(Sb,arguments)}function Ub(i,e,s,c,h,$,_,j,nt){if(Tb.apply(this,arguments),Ob){if(Ob){var et=Pb;Ob=!1,Pb=null}else throw Error(p(198));Qb||(Qb=!0,Rb=et)}}function Vb(i){var e=i,s=i;if(i.alternate)for(;e.return;)e=e.return;else{i=e;do e=i,e.flags&4098&&(s=e.return),i=e.return;while(i)}return e.tag===3?s:null}function Wb(i){if(i.tag===13){var e=i.memoizedState;if(e===null&&(i=i.alternate,i!==null&&(e=i.memoizedState)),e!==null)return e.dehydrated}return null}function Xb(i){if(Vb(i)!==i)throw Error(p(188))}function Yb(i){var e=i.alternate;if(!e){if(e=Vb(i),e===null)throw Error(p(188));return e!==i?null:i}for(var s=i,c=e;;){var h=s.return;if(h===null)break;var $=h.alternate;if($===null){if(c=h.return,c!==null){s=c;continue}break}if(h.child===$.child){for($=h.child;$;){if($===s)return Xb(h),i;if($===c)return Xb(h),e;$=$.sibling}throw Error(p(188))}if(s.return!==c.return)s=h,c=$;else{for(var _=!1,j=h.child;j;){if(j===s){_=!0,s=h,c=$;break}if(j===c){_=!0,c=h,s=$;break}j=j.sibling}if(!_){for(j=$.child;j;){if(j===s){_=!0,s=$,c=h;break}if(j===c){_=!0,c=$,s=h;break}j=j.sibling}if(!_)throw Error(p(189))}}if(s.alternate!==c)throw Error(p(190))}if(s.tag!==3)throw Error(p(188));return s.stateNode.current===s?i:e}function Zb(i){return i=Yb(i),i!==null?$b(i):null}function $b(i){if(i.tag===5||i.tag===6)return i;for(i=i.child;i!==null;){var e=$b(i);if(e!==null)return e;i=i.sibling}return null}var ac=ca$1.unstable_scheduleCallback,bc=ca$1.unstable_cancelCallback,cc=ca$1.unstable_shouldYield,dc=ca$1.unstable_requestPaint,B=ca$1.unstable_now,ec=ca$1.unstable_getCurrentPriorityLevel,fc=ca$1.unstable_ImmediatePriority,gc=ca$1.unstable_UserBlockingPriority,hc=ca$1.unstable_NormalPriority,ic=ca$1.unstable_LowPriority,jc=ca$1.unstable_IdlePriority,kc=null,lc=null;function mc(i){if(lc&&typeof lc.onCommitFiberRoot=="function")try{lc.onCommitFiberRoot(kc,i,void 0,(i.current.flags&128)===128)}catch{}}var oc=Math.clz32?Math.clz32:nc,pc=Math.log,qc=Math.LN2;function nc(i){return i>>>=0,i===0?32:31-(pc(i)/qc|0)|0}var rc=64,sc=4194304;function tc(i){switch(i&-i){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return i&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return i}}function uc(i,e){var s=i.pendingLanes;if(s===0)return 0;var c=0,h=i.suspendedLanes,$=i.pingedLanes,_=s&268435455;if(_!==0){var j=_&~h;j!==0?c=tc(j):($&=_,$!==0&&(c=tc($)))}else _=s&~h,_!==0?c=tc(_):$!==0&&(c=tc($));if(c===0)return 0;if(e!==0&&e!==c&&!(e&h)&&(h=c&-c,$=e&-e,h>=$||h===16&&($&4194240)!==0))return e;if(c&4&&(c|=s&16),e=i.entangledLanes,e!==0)for(i=i.entanglements,e&=c;0<e;)s=31-oc(e),h=1<<s,c|=i[s],e&=~h;return c}function vc(i,e){switch(i){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function wc(i,e){for(var s=i.suspendedLanes,c=i.pingedLanes,h=i.expirationTimes,$=i.pendingLanes;0<$;){var _=31-oc($),j=1<<_,nt=h[_];nt===-1?(!(j&s)||j&c)&&(h[_]=vc(j,e)):nt<=e&&(i.expiredLanes|=j),$&=~j}}function xc(i){return i=i.pendingLanes&-1073741825,i!==0?i:i&1073741824?1073741824:0}function yc(){var i=rc;return rc<<=1,!(rc&4194240)&&(rc=64),i}function zc(i){for(var e=[],s=0;31>s;s++)e.push(i);return e}function Ac(i,e,s){i.pendingLanes|=e,e!==536870912&&(i.suspendedLanes=0,i.pingedLanes=0),i=i.eventTimes,e=31-oc(e),i[e]=s}function Bc(i,e){var s=i.pendingLanes&~e;i.pendingLanes=e,i.suspendedLanes=0,i.pingedLanes=0,i.expiredLanes&=e,i.mutableReadLanes&=e,i.entangledLanes&=e,e=i.entanglements;var c=i.eventTimes;for(i=i.expirationTimes;0<s;){var h=31-oc(s),$=1<<h;e[h]=0,c[h]=-1,i[h]=-1,s&=~$}}function Cc(i,e){var s=i.entangledLanes|=e;for(i=i.entanglements;s;){var c=31-oc(s),h=1<<c;h&e|i[c]&e&&(i[c]|=e),s&=~h}}var C=0;function Dc(i){return i&=-i,1<i?4<i?i&268435455?16:536870912:4:1}var Ec,Fc,Gc,Hc,Ic,Jc=!1,Kc=[],Lc=null,Mc=null,Nc=null,Oc=new Map,Pc=new Map,Qc=[],Rc="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Sc(i,e){switch(i){case"focusin":case"focusout":Lc=null;break;case"dragenter":case"dragleave":Mc=null;break;case"mouseover":case"mouseout":Nc=null;break;case"pointerover":case"pointerout":Oc.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Pc.delete(e.pointerId)}}function Tc(i,e,s,c,h,$){return i===null||i.nativeEvent!==$?(i={blockedOn:e,domEventName:s,eventSystemFlags:c,nativeEvent:$,targetContainers:[h]},e!==null&&(e=Cb(e),e!==null&&Fc(e)),i):(i.eventSystemFlags|=c,e=i.targetContainers,h!==null&&e.indexOf(h)===-1&&e.push(h),i)}function Uc(i,e,s,c,h){switch(e){case"focusin":return Lc=Tc(Lc,i,e,s,c,h),!0;case"dragenter":return Mc=Tc(Mc,i,e,s,c,h),!0;case"mouseover":return Nc=Tc(Nc,i,e,s,c,h),!0;case"pointerover":var $=h.pointerId;return Oc.set($,Tc(Oc.get($)||null,i,e,s,c,h)),!0;case"gotpointercapture":return $=h.pointerId,Pc.set($,Tc(Pc.get($)||null,i,e,s,c,h)),!0}return!1}function Vc(i){var e=Wc(i.target);if(e!==null){var s=Vb(e);if(s!==null){if(e=s.tag,e===13){if(e=Wb(s),e!==null){i.blockedOn=e,Ic(i.priority,function(){Gc(s)});return}}else if(e===3&&s.stateNode.current.memoizedState.isDehydrated){i.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}i.blockedOn=null}function Xc(i){if(i.blockedOn!==null)return!1;for(var e=i.targetContainers;0<e.length;){var s=Yc(i.domEventName,i.eventSystemFlags,e[0],i.nativeEvent);if(s===null){s=i.nativeEvent;var c=new s.constructor(s.type,s);wb=c,s.target.dispatchEvent(c),wb=null}else return e=Cb(s),e!==null&&Fc(e),i.blockedOn=s,!1;e.shift()}return!0}function Zc(i,e,s){Xc(i)&&s.delete(e)}function $c(){Jc=!1,Lc!==null&&Xc(Lc)&&(Lc=null),Mc!==null&&Xc(Mc)&&(Mc=null),Nc!==null&&Xc(Nc)&&(Nc=null),Oc.forEach(Zc),Pc.forEach(Zc)}function ad(i,e){i.blockedOn===e&&(i.blockedOn=null,Jc||(Jc=!0,ca$1.unstable_scheduleCallback(ca$1.unstable_NormalPriority,$c)))}function bd(i){function e(h){return ad(h,i)}if(0<Kc.length){ad(Kc[0],i);for(var s=1;s<Kc.length;s++){var c=Kc[s];c.blockedOn===i&&(c.blockedOn=null)}}for(Lc!==null&&ad(Lc,i),Mc!==null&&ad(Mc,i),Nc!==null&&ad(Nc,i),Oc.forEach(e),Pc.forEach(e),s=0;s<Qc.length;s++)c=Qc[s],c.blockedOn===i&&(c.blockedOn=null);for(;0<Qc.length&&(s=Qc[0],s.blockedOn===null);)Vc(s),s.blockedOn===null&&Qc.shift()}var cd=ua$1.ReactCurrentBatchConfig,dd=!0;function ed(i,e,s,c){var h=C,$=cd.transition;cd.transition=null;try{C=1,fd(i,e,s,c)}finally{C=h,cd.transition=$}}function gd(i,e,s,c){var h=C,$=cd.transition;cd.transition=null;try{C=4,fd(i,e,s,c)}finally{C=h,cd.transition=$}}function fd(i,e,s,c){if(dd){var h=Yc(i,e,s,c);if(h===null)hd(i,e,c,id$1,s),Sc(i,c);else if(Uc(h,i,e,s,c))c.stopPropagation();else if(Sc(i,c),e&4&&-1<Rc.indexOf(i)){for(;h!==null;){var $=Cb(h);if($!==null&&Ec($),$=Yc(i,e,s,c),$===null&&hd(i,e,c,id$1,s),$===h)break;h=$}h!==null&&c.stopPropagation()}else hd(i,e,c,null,s)}}var id$1=null;function Yc(i,e,s,c){if(id$1=null,i=xb(c),i=Wc(i),i!==null)if(e=Vb(i),e===null)i=null;else if(s=e.tag,s===13){if(i=Wb(e),i!==null)return i;i=null}else if(s===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;i=null}else e!==i&&(i=null);return id$1=i,null}function jd(i){switch(i){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(ec()){case fc:return 1;case gc:return 4;case hc:case ic:return 16;case jc:return 536870912;default:return 16}default:return 16}}var kd=null,ld=null,md=null;function nd(){if(md)return md;var i,e=ld,s=e.length,c,h="value"in kd?kd.value:kd.textContent,$=h.length;for(i=0;i<s&&e[i]===h[i];i++);var _=s-i;for(c=1;c<=_&&e[s-c]===h[$-c];c++);return md=h.slice(i,1<c?1-c:void 0)}function od(i){var e=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&e===13&&(i=13)):i=e,i===10&&(i=13),32<=i||i===13?i:0}function pd(){return!0}function qd(){return!1}function rd(i){function e(s,c,h,$,_){this._reactName=s,this._targetInst=h,this.type=c,this.nativeEvent=$,this.target=_,this.currentTarget=null;for(var j in i)i.hasOwnProperty(j)&&(s=i[j],this[j]=s?s($):$[j]);return this.isDefaultPrevented=($.defaultPrevented!=null?$.defaultPrevented:$.returnValue===!1)?pd:qd,this.isPropagationStopped=qd,this}return A(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=pd)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=pd)},persist:function(){},isPersistent:pd}),e}var sd={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},td=rd(sd),ud=A({},sd,{view:0,detail:0}),vd=rd(ud),wd,xd,yd,Ad=A({},ud,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:zd,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==yd&&(yd&&i.type==="mousemove"?(wd=i.screenX-yd.screenX,xd=i.screenY-yd.screenY):xd=wd=0,yd=i),wd)},movementY:function(i){return"movementY"in i?i.movementY:xd}}),Bd=rd(Ad),Cd=A({},Ad,{dataTransfer:0}),Dd=rd(Cd),Ed=A({},ud,{relatedTarget:0}),Fd=rd(Ed),Gd=A({},sd,{animationName:0,elapsedTime:0,pseudoElement:0}),Hd=rd(Gd),Id=A({},sd,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),Jd=rd(Id),Kd=A({},sd,{data:0}),Ld=rd(Kd),Md={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Nd={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Od={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Pd(i){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(i):(i=Od[i])?!!e[i]:!1}function zd(){return Pd}var Qd=A({},ud,{key:function(i){if(i.key){var e=Md[i.key]||i.key;if(e!=="Unidentified")return e}return i.type==="keypress"?(i=od(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?Nd[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:zd,charCode:function(i){return i.type==="keypress"?od(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?od(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),Rd=rd(Qd),Sd=A({},Ad,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Td=rd(Sd),Ud=A({},ud,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:zd}),Vd=rd(Ud),Wd=A({},sd,{propertyName:0,elapsedTime:0,pseudoElement:0}),Xd=rd(Wd),Yd=A({},Ad,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),Zd=rd(Yd),$d=[9,13,27,32],ae$1=ia$1&&"CompositionEvent"in window,be=null;ia$1&&"documentMode"in document&&(be=document.documentMode);var ce$1=ia$1&&"TextEvent"in window&&!be,de$1=ia$1&&(!ae$1||be&&8<be&&11>=be),ee$1=" ",fe=!1;function ge$1(i,e){switch(i){case"keyup":return $d.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function he(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var ie$1=!1;function je$1(i,e){switch(i){case"compositionend":return he(e);case"keypress":return e.which!==32?null:(fe=!0,ee$1);case"textInput":return i=e.data,i===ee$1&&fe?null:i;default:return null}}function ke(i,e){if(ie$1)return i==="compositionend"||!ae$1&&ge$1(i,e)?(i=nd(),md=ld=kd=null,ie$1=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return de$1&&e.locale!=="ko"?null:e.data;default:return null}}var le={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function me(i){var e=i&&i.nodeName&&i.nodeName.toLowerCase();return e==="input"?!!le[i.type]:e==="textarea"}function ne$1(i,e,s,c){Eb(c),e=oe(e,"onChange"),0<e.length&&(s=new td("onChange","change",null,s,c),i.push({event:s,listeners:e}))}var pe$1=null,qe=null;function re$1(i){se$1(i,0)}function te$1(i){var e=ue(i);if(Wa$1(e))return i}function ve(i,e){if(i==="change")return e}var we$1=!1;if(ia$1){var xe$1;if(ia$1){var ye$1="oninput"in document;if(!ye$1){var ze$1=document.createElement("div");ze$1.setAttribute("oninput","return;"),ye$1=typeof ze$1.oninput=="function"}xe$1=ye$1}else xe$1=!1;we$1=xe$1&&(!document.documentMode||9<document.documentMode)}function Ae$1(){pe$1&&(pe$1.detachEvent("onpropertychange",Be$1),qe=pe$1=null)}function Be$1(i){if(i.propertyName==="value"&&te$1(qe)){var e=[];ne$1(e,qe,i,xb(i)),Jb(re$1,e)}}function Ce(i,e,s){i==="focusin"?(Ae$1(),pe$1=e,qe=s,pe$1.attachEvent("onpropertychange",Be$1)):i==="focusout"&&Ae$1()}function De$1(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return te$1(qe)}function Ee$1(i,e){if(i==="click")return te$1(e)}function Fe(i,e){if(i==="input"||i==="change")return te$1(e)}function Ge$1(i,e){return i===e&&(i!==0||1/i===1/e)||i!==i&&e!==e}var He$1=typeof Object.is=="function"?Object.is:Ge$1;function Ie$1(i,e){if(He$1(i,e))return!0;if(typeof i!="object"||i===null||typeof e!="object"||e===null)return!1;var s=Object.keys(i),c=Object.keys(e);if(s.length!==c.length)return!1;for(c=0;c<s.length;c++){var h=s[c];if(!ja$1.call(e,h)||!He$1(i[h],e[h]))return!1}return!0}function Je$1(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function Ke$1(i,e){var s=Je$1(i);i=0;for(var c;s;){if(s.nodeType===3){if(c=i+s.textContent.length,i<=e&&c>=e)return{node:s,offset:e-i};i=c}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=Je$1(s)}}function Le$1(i,e){return i&&e?i===e?!0:i&&i.nodeType===3?!1:e&&e.nodeType===3?Le$1(i,e.parentNode):"contains"in i?i.contains(e):i.compareDocumentPosition?!!(i.compareDocumentPosition(e)&16):!1:!1}function Me$1(){for(var i=window,e=Xa$1();e instanceof i.HTMLIFrameElement;){try{var s=typeof e.contentWindow.location.href=="string"}catch{s=!1}if(s)i=e.contentWindow;else break;e=Xa$1(i.document)}return e}function Ne$1(i){var e=i&&i.nodeName&&i.nodeName.toLowerCase();return e&&(e==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||e==="textarea"||i.contentEditable==="true")}function Oe$1(i){var e=Me$1(),s=i.focusedElem,c=i.selectionRange;if(e!==s&&s&&s.ownerDocument&&Le$1(s.ownerDocument.documentElement,s)){if(c!==null&&Ne$1(s)){if(e=c.start,i=c.end,i===void 0&&(i=e),"selectionStart"in s)s.selectionStart=e,s.selectionEnd=Math.min(i,s.value.length);else if(i=(e=s.ownerDocument||document)&&e.defaultView||window,i.getSelection){i=i.getSelection();var h=s.textContent.length,$=Math.min(c.start,h);c=c.end===void 0?$:Math.min(c.end,h),!i.extend&&$>c&&(h=c,c=$,$=h),h=Ke$1(s,$);var _=Ke$1(s,c);h&&_&&(i.rangeCount!==1||i.anchorNode!==h.node||i.anchorOffset!==h.offset||i.focusNode!==_.node||i.focusOffset!==_.offset)&&(e=e.createRange(),e.setStart(h.node,h.offset),i.removeAllRanges(),$>c?(i.addRange(e),i.extend(_.node,_.offset)):(e.setEnd(_.node,_.offset),i.addRange(e)))}}for(e=[],i=s;i=i.parentNode;)i.nodeType===1&&e.push({element:i,left:i.scrollLeft,top:i.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;s<e.length;s++)i=e[s],i.element.scrollLeft=i.left,i.element.scrollTop=i.top}}var Pe$1=ia$1&&"documentMode"in document&&11>=document.documentMode,Qe$1=null,Re$1=null,Se$1=null,Te$1=!1;function Ue$1(i,e,s){var c=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;Te$1||Qe$1==null||Qe$1!==Xa$1(c)||(c=Qe$1,"selectionStart"in c&&Ne$1(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),Se$1&&Ie$1(Se$1,c)||(Se$1=c,c=oe(Re$1,"onSelect"),0<c.length&&(e=new td("onSelect","select",null,e,s),i.push({event:e,listeners:c}),e.target=Qe$1)))}function Ve$1(i,e){var s={};return s[i.toLowerCase()]=e.toLowerCase(),s["Webkit"+i]="webkit"+e,s["Moz"+i]="moz"+e,s}var We$1={animationend:Ve$1("Animation","AnimationEnd"),animationiteration:Ve$1("Animation","AnimationIteration"),animationstart:Ve$1("Animation","AnimationStart"),transitionend:Ve$1("Transition","TransitionEnd")},Xe={},Ye={};ia$1&&(Ye=document.createElement("div").style,"AnimationEvent"in window||(delete We$1.animationend.animation,delete We$1.animationiteration.animation,delete We$1.animationstart.animation),"TransitionEvent"in window||delete We$1.transitionend.transition);function Ze$1(i){if(Xe[i])return Xe[i];if(!We$1[i])return i;var e=We$1[i],s;for(s in e)if(e.hasOwnProperty(s)&&s in Ye)return Xe[i]=e[s];return i}var $e$1=Ze$1("animationend"),af=Ze$1("animationiteration"),bf=Ze$1("animationstart"),cf=Ze$1("transitionend"),df=new Map,ef="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function ff(i,e){df.set(i,e),fa(e,[i])}for(var gf=0;gf<ef.length;gf++){var hf=ef[gf],jf=hf.toLowerCase(),kf=hf[0].toUpperCase()+hf.slice(1);ff(jf,"on"+kf)}ff($e$1,"onAnimationEnd"),ff(af,"onAnimationIteration"),ff(bf,"onAnimationStart"),ff("dblclick","onDoubleClick"),ff("focusin","onFocus"),ff("focusout","onBlur"),ff(cf,"onTransitionEnd"),ha$1("onMouseEnter",["mouseout","mouseover"]),ha$1("onMouseLeave",["mouseout","mouseover"]),ha$1("onPointerEnter",["pointerout","pointerover"]),ha$1("onPointerLeave",["pointerout","pointerover"]),fa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),fa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),fa("onBeforeInput",["compositionend","keypress","textInput","paste"]),fa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),fa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),fa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var lf="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),mf=new Set("cancel close invalid load scroll toggle".split(" ").concat(lf));function nf(i,e,s){var c=i.type||"unknown-event";i.currentTarget=s,Ub(c,e,void 0,i),i.currentTarget=null}function se$1(i,e){e=(e&4)!==0;for(var s=0;s<i.length;s++){var c=i[s],h=c.event;c=c.listeners;e:{var $=void 0;if(e)for(var _=c.length-1;0<=_;_--){var j=c[_],nt=j.instance,et=j.currentTarget;if(j=j.listener,nt!==$&&h.isPropagationStopped())break e;nf(h,j,et),$=nt}else for(_=0;_<c.length;_++){if(j=c[_],nt=j.instance,et=j.currentTarget,j=j.listener,nt!==$&&h.isPropagationStopped())break e;nf(h,j,et),$=nt}}}if(Qb)throw i=Rb,Qb=!1,Rb=null,i}function D(i,e){var s=e[of];s===void 0&&(s=e[of]=new Set);var c=i+"__bubble";s.has(c)||(pf(e,i,2,!1),s.add(c))}function qf(i,e,s){var c=0;e&&(c|=4),pf(s,i,c,e)}var rf="_reactListening"+Math.random().toString(36).slice(2);function sf(i){if(!i[rf]){i[rf]=!0,da$1.forEach(function(s){s!=="selectionchange"&&(mf.has(s)||qf(s,!1,i),qf(s,!0,i))});var e=i.nodeType===9?i:i.ownerDocument;e===null||e[rf]||(e[rf]=!0,qf("selectionchange",!1,e))}}function pf(i,e,s,c){switch(jd(e)){case 1:var h=ed;break;case 4:h=gd;break;default:h=fd}s=h.bind(null,e,s,i),h=void 0,!Lb||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(h=!0),c?h!==void 0?i.addEventListener(e,s,{capture:!0,passive:h}):i.addEventListener(e,s,!0):h!==void 0?i.addEventListener(e,s,{passive:h}):i.addEventListener(e,s,!1)}function hd(i,e,s,c,h){var $=c;if(!(e&1)&&!(e&2)&&c!==null)e:for(;;){if(c===null)return;var _=c.tag;if(_===3||_===4){var j=c.stateNode.containerInfo;if(j===h||j.nodeType===8&&j.parentNode===h)break;if(_===4)for(_=c.return;_!==null;){var nt=_.tag;if((nt===3||nt===4)&&(nt=_.stateNode.containerInfo,nt===h||nt.nodeType===8&&nt.parentNode===h))return;_=_.return}for(;j!==null;){if(_=Wc(j),_===null)return;if(nt=_.tag,nt===5||nt===6){c=$=_;continue e}j=j.parentNode}}c=c.return}Jb(function(){var et=$,b=xb(s),a=[];e:{var o=df.get(i);if(o!==void 0){var d=td,g=i;switch(i){case"keypress":if(od(s)===0)break e;case"keydown":case"keyup":d=Rd;break;case"focusin":g="focus",d=Fd;break;case"focusout":g="blur",d=Fd;break;case"beforeblur":case"afterblur":d=Fd;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":d=Bd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":d=Dd;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":d=Vd;break;case $e$1:case af:case bf:d=Hd;break;case cf:d=Xd;break;case"scroll":d=vd;break;case"wheel":d=Zd;break;case"copy":case"cut":case"paste":d=Jd;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":d=Td}var it=(e&4)!==0,st=!it&&i==="scroll",tt=it?o!==null?o+"Capture":null:o;it=[];for(var ot=et,rt;ot!==null;){rt=ot;var at=rt.stateNode;if(rt.tag===5&&at!==null&&(rt=at,tt!==null&&(at=Kb(ot,tt),at!=null&&it.push(tf(ot,at,rt)))),st)break;ot=ot.return}0<it.length&&(o=new d(o,g,null,s,b),a.push({event:o,listeners:it}))}}if(!(e&7)){e:{if(o=i==="mouseover"||i==="pointerover",d=i==="mouseout"||i==="pointerout",o&&s!==wb&&(g=s.relatedTarget||s.fromElement)&&(Wc(g)||g[uf]))break e;if((d||o)&&(o=b.window===b?b:(o=b.ownerDocument)?o.defaultView||o.parentWindow:window,d?(g=s.relatedTarget||s.toElement,d=et,g=g?Wc(g):null,g!==null&&(st=Vb(g),g!==st||g.tag!==5&&g.tag!==6)&&(g=null)):(d=null,g=et),d!==g)){if(it=Bd,at="onMouseLeave",tt="onMouseEnter",ot="mouse",(i==="pointerout"||i==="pointerover")&&(it=Td,at="onPointerLeave",tt="onPointerEnter",ot="pointer"),st=d==null?o:ue(d),rt=g==null?o:ue(g),o=new it(at,ot+"leave",d,s,b),o.target=st,o.relatedTarget=rt,at=null,Wc(b)===et&&(it=new it(tt,ot+"enter",g,s,b),it.target=rt,it.relatedTarget=st,at=it),st=at,d&&g)t:{for(it=d,tt=g,ot=0,rt=it;rt;rt=vf(rt))ot++;for(rt=0,at=tt;at;at=vf(at))rt++;for(;0<ot-rt;)it=vf(it),ot--;for(;0<rt-ot;)tt=vf(tt),rt--;for(;ot--;){if(it===tt||tt!==null&&it===tt.alternate)break t;it=vf(it),tt=vf(tt)}it=null}else it=null;d!==null&&wf(a,o,d,it,!1),g!==null&&st!==null&&wf(a,st,g,it,!0)}}e:{if(o=et?ue(et):window,d=o.nodeName&&o.nodeName.toLowerCase(),d==="select"||d==="input"&&o.type==="file")var ut=ve;else if(me(o))if(we$1)ut=Fe;else{ut=De$1;var lt=Ce}else(d=o.nodeName)&&d.toLowerCase()==="input"&&(o.type==="checkbox"||o.type==="radio")&&(ut=Ee$1);if(ut&&(ut=ut(i,et))){ne$1(a,ut,s,b);break e}lt&&lt(i,o,et),i==="focusout"&&(lt=o._wrapperState)&&lt.controlled&&o.type==="number"&&cb(o,"number",o.value)}switch(lt=et?ue(et):window,i){case"focusin":(me(lt)||lt.contentEditable==="true")&&(Qe$1=lt,Re$1=et,Se$1=null);break;case"focusout":Se$1=Re$1=Qe$1=null;break;case"mousedown":Te$1=!0;break;case"contextmenu":case"mouseup":case"dragend":Te$1=!1,Ue$1(a,s,b);break;case"selectionchange":if(Pe$1)break;case"keydown":case"keyup":Ue$1(a,s,b)}var ct;if(ae$1)e:{switch(i){case"compositionstart":var ft="onCompositionStart";break e;case"compositionend":ft="onCompositionEnd";break e;case"compositionupdate":ft="onCompositionUpdate";break e}ft=void 0}else ie$1?ge$1(i,s)&&(ft="onCompositionEnd"):i==="keydown"&&s.keyCode===229&&(ft="onCompositionStart");ft&&(de$1&&s.locale!=="ko"&&(ie$1||ft!=="onCompositionStart"?ft==="onCompositionEnd"&&ie$1&&(ct=nd()):(kd=b,ld="value"in kd?kd.value:kd.textContent,ie$1=!0)),lt=oe(et,ft),0<lt.length&&(ft=new Ld(ft,i,null,s,b),a.push({event:ft,listeners:lt}),ct?ft.data=ct:(ct=he(s),ct!==null&&(ft.data=ct)))),(ct=ce$1?je$1(i,s):ke(i,s))&&(et=oe(et,"onBeforeInput"),0<et.length&&(b=new Ld("onBeforeInput","beforeinput",null,s,b),a.push({event:b,listeners:et}),b.data=ct))}se$1(a,e)})}function tf(i,e,s){return{instance:i,listener:e,currentTarget:s}}function oe(i,e){for(var s=e+"Capture",c=[];i!==null;){var h=i,$=h.stateNode;h.tag===5&&$!==null&&(h=$,$=Kb(i,s),$!=null&&c.unshift(tf(i,$,h)),$=Kb(i,e),$!=null&&c.push(tf(i,$,h))),i=i.return}return c}function vf(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5);return i||null}function wf(i,e,s,c,h){for(var $=e._reactName,_=[];s!==null&&s!==c;){var j=s,nt=j.alternate,et=j.stateNode;if(nt!==null&&nt===c)break;j.tag===5&&et!==null&&(j=et,h?(nt=Kb(s,$),nt!=null&&_.unshift(tf(s,nt,j))):h||(nt=Kb(s,$),nt!=null&&_.push(tf(s,nt,j)))),s=s.return}_.length!==0&&i.push({event:e,listeners:_})}var xf=/\r\n?/g,yf=/\u0000|\uFFFD/g;function zf(i){return(typeof i=="string"?i:""+i).replace(xf,`
38
38
  `).replace(yf,"")}function Af(i,e,s){if(e=zf(e),zf(i)!==e&&s)throw Error(p(425))}function Bf(){}var Cf=null,Df=null;function Ef(i,e){return i==="textarea"||i==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var Ff=typeof setTimeout=="function"?setTimeout:void 0,Gf=typeof clearTimeout=="function"?clearTimeout:void 0,Hf=typeof Promise=="function"?Promise:void 0,Jf=typeof queueMicrotask=="function"?queueMicrotask:typeof Hf<"u"?function(i){return Hf.resolve(null).then(i).catch(If)}:Ff;function If(i){setTimeout(function(){throw i})}function Kf(i,e){var s=e,c=0;do{var h=s.nextSibling;if(i.removeChild(s),h&&h.nodeType===8)if(s=h.data,s==="/$"){if(c===0){i.removeChild(h),bd(e);return}c--}else s!=="$"&&s!=="$?"&&s!=="$!"||c++;s=h}while(s);bd(e)}function Lf(i){for(;i!=null;i=i.nextSibling){var e=i.nodeType;if(e===1||e===3)break;if(e===8){if(e=i.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return i}function Mf(i){i=i.previousSibling;for(var e=0;i;){if(i.nodeType===8){var s=i.data;if(s==="$"||s==="$!"||s==="$?"){if(e===0)return i;e--}else s==="/$"&&e++}i=i.previousSibling}return null}var Nf=Math.random().toString(36).slice(2),Of="__reactFiber$"+Nf,Pf="__reactProps$"+Nf,uf="__reactContainer$"+Nf,of="__reactEvents$"+Nf,Qf="__reactListeners$"+Nf,Rf="__reactHandles$"+Nf;function Wc(i){var e=i[Of];if(e)return e;for(var s=i.parentNode;s;){if(e=s[uf]||s[Of]){if(s=e.alternate,e.child!==null||s!==null&&s.child!==null)for(i=Mf(i);i!==null;){if(s=i[Of])return s;i=Mf(i)}return e}i=s,s=i.parentNode}return null}function Cb(i){return i=i[Of]||i[uf],!i||i.tag!==5&&i.tag!==6&&i.tag!==13&&i.tag!==3?null:i}function ue(i){if(i.tag===5||i.tag===6)return i.stateNode;throw Error(p(33))}function Db(i){return i[Pf]||null}var Sf=[],Tf=-1;function Uf(i){return{current:i}}function E(i){0>Tf||(i.current=Sf[Tf],Sf[Tf]=null,Tf--)}function G(i,e){Tf++,Sf[Tf]=i.current,i.current=e}var Vf={},H=Uf(Vf),Wf=Uf(!1),Xf=Vf;function Yf(i,e){var s=i.type.contextTypes;if(!s)return Vf;var c=i.stateNode;if(c&&c.__reactInternalMemoizedUnmaskedChildContext===e)return c.__reactInternalMemoizedMaskedChildContext;var h={},$;for($ in s)h[$]=e[$];return c&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=e,i.__reactInternalMemoizedMaskedChildContext=h),h}function Zf(i){return i=i.childContextTypes,i!=null}function $f(){E(Wf),E(H)}function ag(i,e,s){if(H.current!==Vf)throw Error(p(168));G(H,e),G(Wf,s)}function bg(i,e,s){var c=i.stateNode;if(e=e.childContextTypes,typeof c.getChildContext!="function")return s;c=c.getChildContext();for(var h in c)if(!(h in e))throw Error(p(108,Ra$1(i)||"Unknown",h));return A({},s,c)}function cg(i){return i=(i=i.stateNode)&&i.__reactInternalMemoizedMergedChildContext||Vf,Xf=H.current,G(H,i),G(Wf,Wf.current),!0}function dg(i,e,s){var c=i.stateNode;if(!c)throw Error(p(169));s?(i=bg(i,e,Xf),c.__reactInternalMemoizedMergedChildContext=i,E(Wf),E(H),G(H,i)):E(Wf),G(Wf,s)}var eg=null,fg=!1,gg=!1;function hg(i){eg===null?eg=[i]:eg.push(i)}function ig(i){fg=!0,hg(i)}function jg(){if(!gg&&eg!==null){gg=!0;var i=0,e=C;try{var s=eg;for(C=1;i<s.length;i++){var c=s[i];do c=c(!0);while(c!==null)}eg=null,fg=!1}catch(h){throw eg!==null&&(eg=eg.slice(i+1)),ac(fc,jg),h}finally{C=e,gg=!1}}return null}var kg=[],lg=0,mg=null,ng=0,og=[],pg=0,qg=null,rg=1,sg="";function tg(i,e){kg[lg++]=ng,kg[lg++]=mg,mg=i,ng=e}function ug(i,e,s){og[pg++]=rg,og[pg++]=sg,og[pg++]=qg,qg=i;var c=rg;i=sg;var h=32-oc(c)-1;c&=~(1<<h),s+=1;var $=32-oc(e)+h;if(30<$){var _=h-h%5;$=(c&(1<<_)-1).toString(32),c>>=_,h-=_,rg=1<<32-oc(e)+h|s<<h|c,sg=$+i}else rg=1<<$|s<<h|c,sg=i}function vg(i){i.return!==null&&(tg(i,1),ug(i,1,0))}function wg(i){for(;i===mg;)mg=kg[--lg],kg[lg]=null,ng=kg[--lg],kg[lg]=null;for(;i===qg;)qg=og[--pg],og[pg]=null,sg=og[--pg],og[pg]=null,rg=og[--pg],og[pg]=null}var xg=null,yg=null,I=!1,zg=null;function Ag(i,e){var s=Bg(5,null,null,0);s.elementType="DELETED",s.stateNode=e,s.return=i,e=i.deletions,e===null?(i.deletions=[s],i.flags|=16):e.push(s)}function Cg(i,e){switch(i.tag){case 5:var s=i.type;return e=e.nodeType!==1||s.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(i.stateNode=e,xg=i,yg=Lf(e.firstChild),!0):!1;case 6:return e=i.pendingProps===""||e.nodeType!==3?null:e,e!==null?(i.stateNode=e,xg=i,yg=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(s=qg!==null?{id:rg,overflow:sg}:null,i.memoizedState={dehydrated:e,treeContext:s,retryLane:1073741824},s=Bg(18,null,null,0),s.stateNode=e,s.return=i,i.child=s,xg=i,yg=null,!0):!1;default:return!1}}function Dg(i){return(i.mode&1)!==0&&(i.flags&128)===0}function Eg(i){if(I){var e=yg;if(e){var s=e;if(!Cg(i,e)){if(Dg(i))throw Error(p(418));e=Lf(s.nextSibling);var c=xg;e&&Cg(i,e)?Ag(c,s):(i.flags=i.flags&-4097|2,I=!1,xg=i)}}else{if(Dg(i))throw Error(p(418));i.flags=i.flags&-4097|2,I=!1,xg=i}}}function Fg(i){for(i=i.return;i!==null&&i.tag!==5&&i.tag!==3&&i.tag!==13;)i=i.return;xg=i}function Gg(i){if(i!==xg)return!1;if(!I)return Fg(i),I=!0,!1;var e;if((e=i.tag!==3)&&!(e=i.tag!==5)&&(e=i.type,e=e!=="head"&&e!=="body"&&!Ef(i.type,i.memoizedProps)),e&&(e=yg)){if(Dg(i))throw Hg(),Error(p(418));for(;e;)Ag(i,e),e=Lf(e.nextSibling)}if(Fg(i),i.tag===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(p(317));e:{for(i=i.nextSibling,e=0;i;){if(i.nodeType===8){var s=i.data;if(s==="/$"){if(e===0){yg=Lf(i.nextSibling);break e}e--}else s!=="$"&&s!=="$!"&&s!=="$?"||e++}i=i.nextSibling}yg=null}}else yg=xg?Lf(i.stateNode.nextSibling):null;return!0}function Hg(){for(var i=yg;i;)i=Lf(i.nextSibling)}function Ig(){yg=xg=null,I=!1}function Jg(i){zg===null?zg=[i]:zg.push(i)}var Kg=ua$1.ReactCurrentBatchConfig;function Lg(i,e,s){if(i=s.ref,i!==null&&typeof i!="function"&&typeof i!="object"){if(s._owner){if(s=s._owner,s){if(s.tag!==1)throw Error(p(309));var c=s.stateNode}if(!c)throw Error(p(147,i));var h=c,$=""+i;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===$?e.ref:(e=function(_){var j=h.refs;_===null?delete j[$]:j[$]=_},e._stringRef=$,e)}if(typeof i!="string")throw Error(p(284));if(!s._owner)throw Error(p(290,i))}return i}function Mg(i,e){throw i=Object.prototype.toString.call(e),Error(p(31,i==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":i))}function Ng(i){var e=i._init;return e(i._payload)}function Og(i){function e(tt,ot){if(i){var rt=tt.deletions;rt===null?(tt.deletions=[ot],tt.flags|=16):rt.push(ot)}}function s(tt,ot){if(!i)return null;for(;ot!==null;)e(tt,ot),ot=ot.sibling;return null}function c(tt,ot){for(tt=new Map;ot!==null;)ot.key!==null?tt.set(ot.key,ot):tt.set(ot.index,ot),ot=ot.sibling;return tt}function h(tt,ot){return tt=Pg(tt,ot),tt.index=0,tt.sibling=null,tt}function $(tt,ot,rt){return tt.index=rt,i?(rt=tt.alternate,rt!==null?(rt=rt.index,rt<ot?(tt.flags|=2,ot):rt):(tt.flags|=2,ot)):(tt.flags|=1048576,ot)}function _(tt){return i&&tt.alternate===null&&(tt.flags|=2),tt}function j(tt,ot,rt,at){return ot===null||ot.tag!==6?(ot=Qg(rt,tt.mode,at),ot.return=tt,ot):(ot=h(ot,rt),ot.return=tt,ot)}function nt(tt,ot,rt,at){var ut=rt.type;return ut===ya$1?b(tt,ot,rt.props.children,at,rt.key):ot!==null&&(ot.elementType===ut||typeof ut=="object"&&ut!==null&&ut.$$typeof===Ha$1&&Ng(ut)===ot.type)?(at=h(ot,rt.props),at.ref=Lg(tt,ot,rt),at.return=tt,at):(at=Rg(rt.type,rt.key,rt.props,null,tt.mode,at),at.ref=Lg(tt,ot,rt),at.return=tt,at)}function et(tt,ot,rt,at){return ot===null||ot.tag!==4||ot.stateNode.containerInfo!==rt.containerInfo||ot.stateNode.implementation!==rt.implementation?(ot=Sg(rt,tt.mode,at),ot.return=tt,ot):(ot=h(ot,rt.children||[]),ot.return=tt,ot)}function b(tt,ot,rt,at,ut){return ot===null||ot.tag!==7?(ot=Tg(rt,tt.mode,at,ut),ot.return=tt,ot):(ot=h(ot,rt),ot.return=tt,ot)}function a(tt,ot,rt){if(typeof ot=="string"&&ot!==""||typeof ot=="number")return ot=Qg(""+ot,tt.mode,rt),ot.return=tt,ot;if(typeof ot=="object"&&ot!==null){switch(ot.$$typeof){case va$1:return rt=Rg(ot.type,ot.key,ot.props,null,tt.mode,rt),rt.ref=Lg(tt,null,ot),rt.return=tt,rt;case wa$1:return ot=Sg(ot,tt.mode,rt),ot.return=tt,ot;case Ha$1:var at=ot._init;return a(tt,at(ot._payload),rt)}if(eb(ot)||Ka$1(ot))return ot=Tg(ot,tt.mode,rt,null),ot.return=tt,ot;Mg(tt,ot)}return null}function o(tt,ot,rt,at){var ut=ot!==null?ot.key:null;if(typeof rt=="string"&&rt!==""||typeof rt=="number")return ut!==null?null:j(tt,ot,""+rt,at);if(typeof rt=="object"&&rt!==null){switch(rt.$$typeof){case va$1:return rt.key===ut?nt(tt,ot,rt,at):null;case wa$1:return rt.key===ut?et(tt,ot,rt,at):null;case Ha$1:return ut=rt._init,o(tt,ot,ut(rt._payload),at)}if(eb(rt)||Ka$1(rt))return ut!==null?null:b(tt,ot,rt,at,null);Mg(tt,rt)}return null}function d(tt,ot,rt,at,ut){if(typeof at=="string"&&at!==""||typeof at=="number")return tt=tt.get(rt)||null,j(ot,tt,""+at,ut);if(typeof at=="object"&&at!==null){switch(at.$$typeof){case va$1:return tt=tt.get(at.key===null?rt:at.key)||null,nt(ot,tt,at,ut);case wa$1:return tt=tt.get(at.key===null?rt:at.key)||null,et(ot,tt,at,ut);case Ha$1:var lt=at._init;return d(tt,ot,rt,lt(at._payload),ut)}if(eb(at)||Ka$1(at))return tt=tt.get(rt)||null,b(ot,tt,at,ut,null);Mg(ot,at)}return null}function g(tt,ot,rt,at){for(var ut=null,lt=null,ct=ot,ft=ot=0,dt=null;ct!==null&&ft<rt.length;ft++){ct.index>ft?(dt=ct,ct=null):dt=ct.sibling;var _t=o(tt,ct,rt[ft],at);if(_t===null){ct===null&&(ct=dt);break}i&&ct&&_t.alternate===null&&e(tt,ct),ot=$(_t,ot,ft),lt===null?ut=_t:lt.sibling=_t,lt=_t,ct=dt}if(ft===rt.length)return s(tt,ct),I&&tg(tt,ft),ut;if(ct===null){for(;ft<rt.length;ft++)ct=a(tt,rt[ft],at),ct!==null&&(ot=$(ct,ot,ft),lt===null?ut=ct:lt.sibling=ct,lt=ct);return I&&tg(tt,ft),ut}for(ct=c(tt,ct);ft<rt.length;ft++)dt=d(ct,tt,ft,rt[ft],at),dt!==null&&(i&&dt.alternate!==null&&ct.delete(dt.key===null?ft:dt.key),ot=$(dt,ot,ft),lt===null?ut=dt:lt.sibling=dt,lt=dt);return i&&ct.forEach(function(wt){return e(tt,wt)}),I&&tg(tt,ft),ut}function it(tt,ot,rt,at){var ut=Ka$1(rt);if(typeof ut!="function")throw Error(p(150));if(rt=ut.call(rt),rt==null)throw Error(p(151));for(var lt=ut=null,ct=ot,ft=ot=0,dt=null,_t=rt.next();ct!==null&&!_t.done;ft++,_t=rt.next()){ct.index>ft?(dt=ct,ct=null):dt=ct.sibling;var wt=o(tt,ct,_t.value,at);if(wt===null){ct===null&&(ct=dt);break}i&&ct&&wt.alternate===null&&e(tt,ct),ot=$(wt,ot,ft),lt===null?ut=wt:lt.sibling=wt,lt=wt,ct=dt}if(_t.done)return s(tt,ct),I&&tg(tt,ft),ut;if(ct===null){for(;!_t.done;ft++,_t=rt.next())_t=a(tt,_t.value,at),_t!==null&&(ot=$(_t,ot,ft),lt===null?ut=_t:lt.sibling=_t,lt=_t);return I&&tg(tt,ft),ut}for(ct=c(tt,ct);!_t.done;ft++,_t=rt.next())_t=d(ct,tt,ft,_t.value,at),_t!==null&&(i&&_t.alternate!==null&&ct.delete(_t.key===null?ft:_t.key),ot=$(_t,ot,ft),lt===null?ut=_t:lt.sibling=_t,lt=_t);return i&&ct.forEach(function(bt){return e(tt,bt)}),I&&tg(tt,ft),ut}function st(tt,ot,rt,at){if(typeof rt=="object"&&rt!==null&&rt.type===ya$1&&rt.key===null&&(rt=rt.props.children),typeof rt=="object"&&rt!==null){switch(rt.$$typeof){case va$1:e:{for(var ut=rt.key,lt=ot;lt!==null;){if(lt.key===ut){if(ut=rt.type,ut===ya$1){if(lt.tag===7){s(tt,lt.sibling),ot=h(lt,rt.props.children),ot.return=tt,tt=ot;break e}}else if(lt.elementType===ut||typeof ut=="object"&&ut!==null&&ut.$$typeof===Ha$1&&Ng(ut)===lt.type){s(tt,lt.sibling),ot=h(lt,rt.props),ot.ref=Lg(tt,lt,rt),ot.return=tt,tt=ot;break e}s(tt,lt);break}else e(tt,lt);lt=lt.sibling}rt.type===ya$1?(ot=Tg(rt.props.children,tt.mode,at,rt.key),ot.return=tt,tt=ot):(at=Rg(rt.type,rt.key,rt.props,null,tt.mode,at),at.ref=Lg(tt,ot,rt),at.return=tt,tt=at)}return _(tt);case wa$1:e:{for(lt=rt.key;ot!==null;){if(ot.key===lt)if(ot.tag===4&&ot.stateNode.containerInfo===rt.containerInfo&&ot.stateNode.implementation===rt.implementation){s(tt,ot.sibling),ot=h(ot,rt.children||[]),ot.return=tt,tt=ot;break e}else{s(tt,ot);break}else e(tt,ot);ot=ot.sibling}ot=Sg(rt,tt.mode,at),ot.return=tt,tt=ot}return _(tt);case Ha$1:return lt=rt._init,st(tt,ot,lt(rt._payload),at)}if(eb(rt))return g(tt,ot,rt,at);if(Ka$1(rt))return it(tt,ot,rt,at);Mg(tt,rt)}return typeof rt=="string"&&rt!==""||typeof rt=="number"?(rt=""+rt,ot!==null&&ot.tag===6?(s(tt,ot.sibling),ot=h(ot,rt),ot.return=tt,tt=ot):(s(tt,ot),ot=Qg(rt,tt.mode,at),ot.return=tt,tt=ot),_(tt)):s(tt,ot)}return st}var Ug=Og(!0),Vg=Og(!1),Wg=Uf(null),Xg=null,Yg=null,Zg=null;function $g(){Zg=Yg=Xg=null}function ah(i){var e=Wg.current;E(Wg),i._currentValue=e}function bh(i,e,s){for(;i!==null;){var c=i.alternate;if((i.childLanes&e)!==e?(i.childLanes|=e,c!==null&&(c.childLanes|=e)):c!==null&&(c.childLanes&e)!==e&&(c.childLanes|=e),i===s)break;i=i.return}}function ch(i,e){Xg=i,Zg=Yg=null,i=i.dependencies,i!==null&&i.firstContext!==null&&(i.lanes&e&&(dh=!0),i.firstContext=null)}function eh(i){var e=i._currentValue;if(Zg!==i)if(i={context:i,memoizedValue:e,next:null},Yg===null){if(Xg===null)throw Error(p(308));Yg=i,Xg.dependencies={lanes:0,firstContext:i}}else Yg=Yg.next=i;return e}var fh=null;function gh(i){fh===null?fh=[i]:fh.push(i)}function hh(i,e,s,c){var h=e.interleaved;return h===null?(s.next=s,gh(e)):(s.next=h.next,h.next=s),e.interleaved=s,ih(i,c)}function ih(i,e){i.lanes|=e;var s=i.alternate;for(s!==null&&(s.lanes|=e),s=i,i=i.return;i!==null;)i.childLanes|=e,s=i.alternate,s!==null&&(s.childLanes|=e),s=i,i=i.return;return s.tag===3?s.stateNode:null}var jh=!1;function kh(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function lh(i,e){i=i.updateQueue,e.updateQueue===i&&(e.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,effects:i.effects})}function mh(i,e){return{eventTime:i,lane:e,tag:0,payload:null,callback:null,next:null}}function nh(i,e,s){var c=i.updateQueue;if(c===null)return null;if(c=c.shared,K&2){var h=c.pending;return h===null?e.next=e:(e.next=h.next,h.next=e),c.pending=e,ih(i,s)}return h=c.interleaved,h===null?(e.next=e,gh(c)):(e.next=h.next,h.next=e),c.interleaved=e,ih(i,s)}function oh(i,e,s){if(e=e.updateQueue,e!==null&&(e=e.shared,(s&4194240)!==0)){var c=e.lanes;c&=i.pendingLanes,s|=c,e.lanes=s,Cc(i,s)}}function ph(i,e){var s=i.updateQueue,c=i.alternate;if(c!==null&&(c=c.updateQueue,s===c)){var h=null,$=null;if(s=s.firstBaseUpdate,s!==null){do{var _={eventTime:s.eventTime,lane:s.lane,tag:s.tag,payload:s.payload,callback:s.callback,next:null};$===null?h=$=_:$=$.next=_,s=s.next}while(s!==null);$===null?h=$=e:$=$.next=e}else h=$=e;s={baseState:c.baseState,firstBaseUpdate:h,lastBaseUpdate:$,shared:c.shared,effects:c.effects},i.updateQueue=s;return}i=s.lastBaseUpdate,i===null?s.firstBaseUpdate=e:i.next=e,s.lastBaseUpdate=e}function qh(i,e,s,c){var h=i.updateQueue;jh=!1;var $=h.firstBaseUpdate,_=h.lastBaseUpdate,j=h.shared.pending;if(j!==null){h.shared.pending=null;var nt=j,et=nt.next;nt.next=null,_===null?$=et:_.next=et,_=nt;var b=i.alternate;b!==null&&(b=b.updateQueue,j=b.lastBaseUpdate,j!==_&&(j===null?b.firstBaseUpdate=et:j.next=et,b.lastBaseUpdate=nt))}if($!==null){var a=h.baseState;_=0,b=et=nt=null,j=$;do{var o=j.lane,d=j.eventTime;if((c&o)===o){b!==null&&(b=b.next={eventTime:d,lane:0,tag:j.tag,payload:j.payload,callback:j.callback,next:null});e:{var g=i,it=j;switch(o=e,d=s,it.tag){case 1:if(g=it.payload,typeof g=="function"){a=g.call(d,a,o);break e}a=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=it.payload,o=typeof g=="function"?g.call(d,a,o):g,o==null)break e;a=A({},a,o);break e;case 2:jh=!0}}j.callback!==null&&j.lane!==0&&(i.flags|=64,o=h.effects,o===null?h.effects=[j]:o.push(j))}else d={eventTime:d,lane:o,tag:j.tag,payload:j.payload,callback:j.callback,next:null},b===null?(et=b=d,nt=a):b=b.next=d,_|=o;if(j=j.next,j===null){if(j=h.shared.pending,j===null)break;o=j,j=o.next,o.next=null,h.lastBaseUpdate=o,h.shared.pending=null}}while(!0);if(b===null&&(nt=a),h.baseState=nt,h.firstBaseUpdate=et,h.lastBaseUpdate=b,e=h.shared.interleaved,e!==null){h=e;do _|=h.lane,h=h.next;while(h!==e)}else $===null&&(h.shared.lanes=0);rh|=_,i.lanes=_,i.memoizedState=a}}function sh(i,e,s){if(i=e.effects,e.effects=null,i!==null)for(e=0;e<i.length;e++){var c=i[e],h=c.callback;if(h!==null){if(c.callback=null,c=s,typeof h!="function")throw Error(p(191,h));h.call(c)}}}var th={},uh=Uf(th),vh=Uf(th),wh=Uf(th);function xh(i){if(i===th)throw Error(p(174));return i}function yh(i,e){switch(G(wh,e),G(vh,i),G(uh,th),i=e.nodeType,i){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:lb(null,"");break;default:i=i===8?e.parentNode:e,e=i.namespaceURI||null,i=i.tagName,e=lb(e,i)}E(uh),G(uh,e)}function zh(){E(uh),E(vh),E(wh)}function Ah(i){xh(wh.current);var e=xh(uh.current),s=lb(e,i.type);e!==s&&(G(vh,i),G(uh,s))}function Bh(i){vh.current===i&&(E(uh),E(vh))}var L=Uf(0);function Ch(i){for(var e=i;e!==null;){if(e.tag===13){var s=e.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||s.data==="$?"||s.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===i)break;for(;e.sibling===null;){if(e.return===null||e.return===i)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Dh=[];function Eh(){for(var i=0;i<Dh.length;i++)Dh[i]._workInProgressVersionPrimary=null;Dh.length=0}var Fh=ua$1.ReactCurrentDispatcher,Gh=ua$1.ReactCurrentBatchConfig,Hh=0,M=null,N=null,O=null,Ih=!1,Jh=!1,Kh=0,Lh=0;function P(){throw Error(p(321))}function Mh(i,e){if(e===null)return!1;for(var s=0;s<e.length&&s<i.length;s++)if(!He$1(i[s],e[s]))return!1;return!0}function Nh(i,e,s,c,h,$){if(Hh=$,M=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Fh.current=i===null||i.memoizedState===null?Oh:Ph,i=s(c,h),Jh){$=0;do{if(Jh=!1,Kh=0,25<=$)throw Error(p(301));$+=1,O=N=null,e.updateQueue=null,Fh.current=Qh,i=s(c,h)}while(Jh)}if(Fh.current=Rh,e=N!==null&&N.next!==null,Hh=0,O=N=M=null,Ih=!1,e)throw Error(p(300));return i}function Sh(){var i=Kh!==0;return Kh=0,i}function Th(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return O===null?M.memoizedState=O=i:O=O.next=i,O}function Uh(){if(N===null){var i=M.alternate;i=i!==null?i.memoizedState:null}else i=N.next;var e=O===null?M.memoizedState:O.next;if(e!==null)O=e,N=i;else{if(i===null)throw Error(p(310));N=i,i={memoizedState:N.memoizedState,baseState:N.baseState,baseQueue:N.baseQueue,queue:N.queue,next:null},O===null?M.memoizedState=O=i:O=O.next=i}return O}function Vh(i,e){return typeof e=="function"?e(i):e}function Wh(i){var e=Uh(),s=e.queue;if(s===null)throw Error(p(311));s.lastRenderedReducer=i;var c=N,h=c.baseQueue,$=s.pending;if($!==null){if(h!==null){var _=h.next;h.next=$.next,$.next=_}c.baseQueue=h=$,s.pending=null}if(h!==null){$=h.next,c=c.baseState;var j=_=null,nt=null,et=$;do{var b=et.lane;if((Hh&b)===b)nt!==null&&(nt=nt.next={lane:0,action:et.action,hasEagerState:et.hasEagerState,eagerState:et.eagerState,next:null}),c=et.hasEagerState?et.eagerState:i(c,et.action);else{var a={lane:b,action:et.action,hasEagerState:et.hasEagerState,eagerState:et.eagerState,next:null};nt===null?(j=nt=a,_=c):nt=nt.next=a,M.lanes|=b,rh|=b}et=et.next}while(et!==null&&et!==$);nt===null?_=c:nt.next=j,He$1(c,e.memoizedState)||(dh=!0),e.memoizedState=c,e.baseState=_,e.baseQueue=nt,s.lastRenderedState=c}if(i=s.interleaved,i!==null){h=i;do $=h.lane,M.lanes|=$,rh|=$,h=h.next;while(h!==i)}else h===null&&(s.lanes=0);return[e.memoizedState,s.dispatch]}function Xh(i){var e=Uh(),s=e.queue;if(s===null)throw Error(p(311));s.lastRenderedReducer=i;var c=s.dispatch,h=s.pending,$=e.memoizedState;if(h!==null){s.pending=null;var _=h=h.next;do $=i($,_.action),_=_.next;while(_!==h);He$1($,e.memoizedState)||(dh=!0),e.memoizedState=$,e.baseQueue===null&&(e.baseState=$),s.lastRenderedState=$}return[$,c]}function Yh(){}function Zh(i,e){var s=M,c=Uh(),h=e(),$=!He$1(c.memoizedState,h);if($&&(c.memoizedState=h,dh=!0),c=c.queue,$h(ai.bind(null,s,c,i),[i]),c.getSnapshot!==e||$||O!==null&&O.memoizedState.tag&1){if(s.flags|=2048,bi(9,ci.bind(null,s,c,h,e),void 0,null),Q===null)throw Error(p(349));Hh&30||di(s,e,h)}return h}function di(i,e,s){i.flags|=16384,i={getSnapshot:e,value:s},e=M.updateQueue,e===null?(e={lastEffect:null,stores:null},M.updateQueue=e,e.stores=[i]):(s=e.stores,s===null?e.stores=[i]:s.push(i))}function ci(i,e,s,c){e.value=s,e.getSnapshot=c,ei(e)&&fi(i)}function ai(i,e,s){return s(function(){ei(e)&&fi(i)})}function ei(i){var e=i.getSnapshot;i=i.value;try{var s=e();return!He$1(i,s)}catch{return!0}}function fi(i){var e=ih(i,1);e!==null&&gi(e,i,1,-1)}function hi(i){var e=Th();return typeof i=="function"&&(i=i()),e.memoizedState=e.baseState=i,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Vh,lastRenderedState:i},e.queue=i,i=i.dispatch=ii.bind(null,M,i),[e.memoizedState,i]}function bi(i,e,s,c){return i={tag:i,create:e,destroy:s,deps:c,next:null},e=M.updateQueue,e===null?(e={lastEffect:null,stores:null},M.updateQueue=e,e.lastEffect=i.next=i):(s=e.lastEffect,s===null?e.lastEffect=i.next=i:(c=s.next,s.next=i,i.next=c,e.lastEffect=i)),i}function ji(){return Uh().memoizedState}function ki(i,e,s,c){var h=Th();M.flags|=i,h.memoizedState=bi(1|e,s,void 0,c===void 0?null:c)}function li(i,e,s,c){var h=Uh();c=c===void 0?null:c;var $=void 0;if(N!==null){var _=N.memoizedState;if($=_.destroy,c!==null&&Mh(c,_.deps)){h.memoizedState=bi(e,s,$,c);return}}M.flags|=i,h.memoizedState=bi(1|e,s,$,c)}function mi(i,e){return ki(8390656,8,i,e)}function $h(i,e){return li(2048,8,i,e)}function ni(i,e){return li(4,2,i,e)}function oi(i,e){return li(4,4,i,e)}function pi(i,e){if(typeof e=="function")return i=i(),e(i),function(){e(null)};if(e!=null)return i=i(),e.current=i,function(){e.current=null}}function qi(i,e,s){return s=s!=null?s.concat([i]):null,li(4,4,pi.bind(null,e,i),s)}function ri(){}function si(i,e){var s=Uh();e=e===void 0?null:e;var c=s.memoizedState;return c!==null&&e!==null&&Mh(e,c[1])?c[0]:(s.memoizedState=[i,e],i)}function ti(i,e){var s=Uh();e=e===void 0?null:e;var c=s.memoizedState;return c!==null&&e!==null&&Mh(e,c[1])?c[0]:(i=i(),s.memoizedState=[i,e],i)}function ui(i,e,s){return Hh&21?(He$1(s,e)||(s=yc(),M.lanes|=s,rh|=s,i.baseState=!0),e):(i.baseState&&(i.baseState=!1,dh=!0),i.memoizedState=s)}function vi(i,e){var s=C;C=s!==0&&4>s?s:4,i(!0);var c=Gh.transition;Gh.transition={};try{i(!1),e()}finally{C=s,Gh.transition=c}}function wi(){return Uh().memoizedState}function xi(i,e,s){var c=yi(i);if(s={lane:c,action:s,hasEagerState:!1,eagerState:null,next:null},zi(i))Ai(e,s);else if(s=hh(i,e,s,c),s!==null){var h=R();gi(s,i,c,h),Bi(s,e,c)}}function ii(i,e,s){var c=yi(i),h={lane:c,action:s,hasEagerState:!1,eagerState:null,next:null};if(zi(i))Ai(e,h);else{var $=i.alternate;if(i.lanes===0&&($===null||$.lanes===0)&&($=e.lastRenderedReducer,$!==null))try{var _=e.lastRenderedState,j=$(_,s);if(h.hasEagerState=!0,h.eagerState=j,He$1(j,_)){var nt=e.interleaved;nt===null?(h.next=h,gh(e)):(h.next=nt.next,nt.next=h),e.interleaved=h;return}}catch{}finally{}s=hh(i,e,h,c),s!==null&&(h=R(),gi(s,i,c,h),Bi(s,e,c))}}function zi(i){var e=i.alternate;return i===M||e!==null&&e===M}function Ai(i,e){Jh=Ih=!0;var s=i.pending;s===null?e.next=e:(e.next=s.next,s.next=e),i.pending=e}function Bi(i,e,s){if(s&4194240){var c=e.lanes;c&=i.pendingLanes,s|=c,e.lanes=s,Cc(i,s)}}var Rh={readContext:eh,useCallback:P,useContext:P,useEffect:P,useImperativeHandle:P,useInsertionEffect:P,useLayoutEffect:P,useMemo:P,useReducer:P,useRef:P,useState:P,useDebugValue:P,useDeferredValue:P,useTransition:P,useMutableSource:P,useSyncExternalStore:P,useId:P,unstable_isNewReconciler:!1},Oh={readContext:eh,useCallback:function(i,e){return Th().memoizedState=[i,e===void 0?null:e],i},useContext:eh,useEffect:mi,useImperativeHandle:function(i,e,s){return s=s!=null?s.concat([i]):null,ki(4194308,4,pi.bind(null,e,i),s)},useLayoutEffect:function(i,e){return ki(4194308,4,i,e)},useInsertionEffect:function(i,e){return ki(4,2,i,e)},useMemo:function(i,e){var s=Th();return e=e===void 0?null:e,i=i(),s.memoizedState=[i,e],i},useReducer:function(i,e,s){var c=Th();return e=s!==void 0?s(e):e,c.memoizedState=c.baseState=e,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:e},c.queue=i,i=i.dispatch=xi.bind(null,M,i),[c.memoizedState,i]},useRef:function(i){var e=Th();return i={current:i},e.memoizedState=i},useState:hi,useDebugValue:ri,useDeferredValue:function(i){return Th().memoizedState=i},useTransition:function(){var i=hi(!1),e=i[0];return i=vi.bind(null,i[1]),Th().memoizedState=i,[e,i]},useMutableSource:function(){},useSyncExternalStore:function(i,e,s){var c=M,h=Th();if(I){if(s===void 0)throw Error(p(407));s=s()}else{if(s=e(),Q===null)throw Error(p(349));Hh&30||di(c,e,s)}h.memoizedState=s;var $={value:s,getSnapshot:e};return h.queue=$,mi(ai.bind(null,c,$,i),[i]),c.flags|=2048,bi(9,ci.bind(null,c,$,s,e),void 0,null),s},useId:function(){var i=Th(),e=Q.identifierPrefix;if(I){var s=sg,c=rg;s=(c&~(1<<32-oc(c)-1)).toString(32)+s,e=":"+e+"R"+s,s=Kh++,0<s&&(e+="H"+s.toString(32)),e+=":"}else s=Lh++,e=":"+e+"r"+s.toString(32)+":";return i.memoizedState=e},unstable_isNewReconciler:!1},Ph={readContext:eh,useCallback:si,useContext:eh,useEffect:$h,useImperativeHandle:qi,useInsertionEffect:ni,useLayoutEffect:oi,useMemo:ti,useReducer:Wh,useRef:ji,useState:function(){return Wh(Vh)},useDebugValue:ri,useDeferredValue:function(i){var e=Uh();return ui(e,N.memoizedState,i)},useTransition:function(){var i=Wh(Vh)[0],e=Uh().memoizedState;return[i,e]},useMutableSource:Yh,useSyncExternalStore:Zh,useId:wi,unstable_isNewReconciler:!1},Qh={readContext:eh,useCallback:si,useContext:eh,useEffect:$h,useImperativeHandle:qi,useInsertionEffect:ni,useLayoutEffect:oi,useMemo:ti,useReducer:Xh,useRef:ji,useState:function(){return Xh(Vh)},useDebugValue:ri,useDeferredValue:function(i){var e=Uh();return N===null?e.memoizedState=i:ui(e,N.memoizedState,i)},useTransition:function(){var i=Xh(Vh)[0],e=Uh().memoizedState;return[i,e]},useMutableSource:Yh,useSyncExternalStore:Zh,useId:wi,unstable_isNewReconciler:!1};function Ci(i,e){if(i&&i.defaultProps){e=A({},e),i=i.defaultProps;for(var s in i)e[s]===void 0&&(e[s]=i[s]);return e}return e}function Di(i,e,s,c){e=i.memoizedState,s=s(c,e),s=s==null?e:A({},e,s),i.memoizedState=s,i.lanes===0&&(i.updateQueue.baseState=s)}var Ei={isMounted:function(i){return(i=i._reactInternals)?Vb(i)===i:!1},enqueueSetState:function(i,e,s){i=i._reactInternals;var c=R(),h=yi(i),$=mh(c,h);$.payload=e,s!=null&&($.callback=s),e=nh(i,$,h),e!==null&&(gi(e,i,h,c),oh(e,i,h))},enqueueReplaceState:function(i,e,s){i=i._reactInternals;var c=R(),h=yi(i),$=mh(c,h);$.tag=1,$.payload=e,s!=null&&($.callback=s),e=nh(i,$,h),e!==null&&(gi(e,i,h,c),oh(e,i,h))},enqueueForceUpdate:function(i,e){i=i._reactInternals;var s=R(),c=yi(i),h=mh(s,c);h.tag=2,e!=null&&(h.callback=e),e=nh(i,h,c),e!==null&&(gi(e,i,c,s),oh(e,i,c))}};function Fi(i,e,s,c,h,$,_){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(c,$,_):e.prototype&&e.prototype.isPureReactComponent?!Ie$1(s,c)||!Ie$1(h,$):!0}function Gi(i,e,s){var c=!1,h=Vf,$=e.contextType;return typeof $=="object"&&$!==null?$=eh($):(h=Zf(e)?Xf:H.current,c=e.contextTypes,$=(c=c!=null)?Yf(i,h):Vf),e=new e(s,$),i.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=Ei,i.stateNode=e,e._reactInternals=i,c&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=h,i.__reactInternalMemoizedMaskedChildContext=$),e}function Hi(i,e,s,c){i=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(s,c),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(s,c),e.state!==i&&Ei.enqueueReplaceState(e,e.state,null)}function Ii(i,e,s,c){var h=i.stateNode;h.props=s,h.state=i.memoizedState,h.refs={},kh(i);var $=e.contextType;typeof $=="object"&&$!==null?h.context=eh($):($=Zf(e)?Xf:H.current,h.context=Yf(i,$)),h.state=i.memoizedState,$=e.getDerivedStateFromProps,typeof $=="function"&&(Di(i,e,$,s),h.state=i.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(e=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),e!==h.state&&Ei.enqueueReplaceState(h,h.state,null),qh(i,s,h,c),h.state=i.memoizedState),typeof h.componentDidMount=="function"&&(i.flags|=4194308)}function Ji(i,e){try{var s="",c=e;do s+=Pa$1(c),c=c.return;while(c);var h=s}catch($){h=`
39
39
  Error generating stack: `+$.message+`
40
- `+$.stack}return{value:i,source:e,stack:h,digest:null}}function Ki(i,e,s){return{value:i,source:null,stack:s??null,digest:e??null}}function Li(i,e){try{console.error(e.value)}catch(s){setTimeout(function(){throw s})}}var Mi=typeof WeakMap=="function"?WeakMap:Map;function Ni(i,e,s){s=mh(-1,s),s.tag=3,s.payload={element:null};var c=e.value;return s.callback=function(){Oi||(Oi=!0,Pi=c),Li(i,e)},s}function Qi(i,e,s){s=mh(-1,s),s.tag=3;var c=i.type.getDerivedStateFromError;if(typeof c=="function"){var h=e.value;s.payload=function(){return c(h)},s.callback=function(){Li(i,e)}}var $=i.stateNode;return $!==null&&typeof $.componentDidCatch=="function"&&(s.callback=function(){Li(i,e),typeof c!="function"&&(Ri===null?Ri=new Set([this]):Ri.add(this));var _=e.stack;this.componentDidCatch(e.value,{componentStack:_!==null?_:""})}),s}function Si(i,e,s){var c=i.pingCache;if(c===null){c=i.pingCache=new Mi;var h=new Set;c.set(e,h)}else h=c.get(e),h===void 0&&(h=new Set,c.set(e,h));h.has(s)||(h.add(s),i=Ti.bind(null,i,e,s),e.then(i,i))}function Ui(i){do{var e;if((e=i.tag===13)&&(e=i.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return i;i=i.return}while(i!==null);return null}function Vi(i,e,s,c,h){return i.mode&1?(i.flags|=65536,i.lanes=h,i):(i===e?i.flags|=65536:(i.flags|=128,s.flags|=131072,s.flags&=-52805,s.tag===1&&(s.alternate===null?s.tag=17:(e=mh(-1,1),e.tag=2,nh(s,e,1))),s.lanes|=1),i)}var Wi=ua$1.ReactCurrentOwner,dh=!1;function Xi(i,e,s,c){e.child=i===null?Vg(e,null,s,c):Ug(e,i.child,s,c)}function Yi(i,e,s,c,h){s=s.render;var $=e.ref;return ch(e,h),c=Nh(i,e,s,c,$,h),s=Sh(),i!==null&&!dh?(e.updateQueue=i.updateQueue,e.flags&=-2053,i.lanes&=~h,Zi(i,e,h)):(I&&s&&vg(e),e.flags|=1,Xi(i,e,c,h),e.child)}function $i(i,e,s,c,h){if(i===null){var $=s.type;return typeof $=="function"&&!aj($)&&$.defaultProps===void 0&&s.compare===null&&s.defaultProps===void 0?(e.tag=15,e.type=$,bj(i,e,$,c,h)):(i=Rg(s.type,null,c,e,e.mode,h),i.ref=e.ref,i.return=e,e.child=i)}if($=i.child,!(i.lanes&h)){var _=$.memoizedProps;if(s=s.compare,s=s!==null?s:Ie$1,s(_,c)&&i.ref===e.ref)return Zi(i,e,h)}return e.flags|=1,i=Pg($,c),i.ref=e.ref,i.return=e,e.child=i}function bj(i,e,s,c,h){if(i!==null){var $=i.memoizedProps;if(Ie$1($,c)&&i.ref===e.ref)if(dh=!1,e.pendingProps=c=$,(i.lanes&h)!==0)i.flags&131072&&(dh=!0);else return e.lanes=i.lanes,Zi(i,e,h)}return cj(i,e,s,c,h)}function dj(i,e,s){var c=e.pendingProps,h=c.children,$=i!==null?i.memoizedState:null;if(c.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},G(ej,fj),fj|=s;else{if(!(s&1073741824))return i=$!==null?$.baseLanes|s:s,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:i,cachePool:null,transitions:null},e.updateQueue=null,G(ej,fj),fj|=i,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},c=$!==null?$.baseLanes:s,G(ej,fj),fj|=c}else $!==null?(c=$.baseLanes|s,e.memoizedState=null):c=s,G(ej,fj),fj|=c;return Xi(i,e,h,s),e.child}function gj(i,e){var s=e.ref;(i===null&&s!==null||i!==null&&i.ref!==s)&&(e.flags|=512,e.flags|=2097152)}function cj(i,e,s,c,h){var $=Zf(s)?Xf:H.current;return $=Yf(e,$),ch(e,h),s=Nh(i,e,s,c,$,h),c=Sh(),i!==null&&!dh?(e.updateQueue=i.updateQueue,e.flags&=-2053,i.lanes&=~h,Zi(i,e,h)):(I&&c&&vg(e),e.flags|=1,Xi(i,e,s,h),e.child)}function hj(i,e,s,c,h){if(Zf(s)){var $=!0;cg(e)}else $=!1;if(ch(e,h),e.stateNode===null)ij(i,e),Gi(e,s,c),Ii(e,s,c,h),c=!0;else if(i===null){var _=e.stateNode,j=e.memoizedProps;_.props=j;var nt=_.context,et=s.contextType;typeof et=="object"&&et!==null?et=eh(et):(et=Zf(s)?Xf:H.current,et=Yf(e,et));var b=s.getDerivedStateFromProps,a=typeof b=="function"||typeof _.getSnapshotBeforeUpdate=="function";a||typeof _.UNSAFE_componentWillReceiveProps!="function"&&typeof _.componentWillReceiveProps!="function"||(j!==c||nt!==et)&&Hi(e,_,c,et),jh=!1;var o=e.memoizedState;_.state=o,qh(e,c,_,h),nt=e.memoizedState,j!==c||o!==nt||Wf.current||jh?(typeof b=="function"&&(Di(e,s,b,c),nt=e.memoizedState),(j=jh||Fi(e,s,j,c,o,nt,et))?(a||typeof _.UNSAFE_componentWillMount!="function"&&typeof _.componentWillMount!="function"||(typeof _.componentWillMount=="function"&&_.componentWillMount(),typeof _.UNSAFE_componentWillMount=="function"&&_.UNSAFE_componentWillMount()),typeof _.componentDidMount=="function"&&(e.flags|=4194308)):(typeof _.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=c,e.memoizedState=nt),_.props=c,_.state=nt,_.context=et,c=j):(typeof _.componentDidMount=="function"&&(e.flags|=4194308),c=!1)}else{_=e.stateNode,lh(i,e),j=e.memoizedProps,et=e.type===e.elementType?j:Ci(e.type,j),_.props=et,a=e.pendingProps,o=_.context,nt=s.contextType,typeof nt=="object"&&nt!==null?nt=eh(nt):(nt=Zf(s)?Xf:H.current,nt=Yf(e,nt));var d=s.getDerivedStateFromProps;(b=typeof d=="function"||typeof _.getSnapshotBeforeUpdate=="function")||typeof _.UNSAFE_componentWillReceiveProps!="function"&&typeof _.componentWillReceiveProps!="function"||(j!==a||o!==nt)&&Hi(e,_,c,nt),jh=!1,o=e.memoizedState,_.state=o,qh(e,c,_,h);var g=e.memoizedState;j!==a||o!==g||Wf.current||jh?(typeof d=="function"&&(Di(e,s,d,c),g=e.memoizedState),(et=jh||Fi(e,s,et,c,o,g,nt)||!1)?(b||typeof _.UNSAFE_componentWillUpdate!="function"&&typeof _.componentWillUpdate!="function"||(typeof _.componentWillUpdate=="function"&&_.componentWillUpdate(c,g,nt),typeof _.UNSAFE_componentWillUpdate=="function"&&_.UNSAFE_componentWillUpdate(c,g,nt)),typeof _.componentDidUpdate=="function"&&(e.flags|=4),typeof _.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof _.componentDidUpdate!="function"||j===i.memoizedProps&&o===i.memoizedState||(e.flags|=4),typeof _.getSnapshotBeforeUpdate!="function"||j===i.memoizedProps&&o===i.memoizedState||(e.flags|=1024),e.memoizedProps=c,e.memoizedState=g),_.props=c,_.state=g,_.context=nt,c=et):(typeof _.componentDidUpdate!="function"||j===i.memoizedProps&&o===i.memoizedState||(e.flags|=4),typeof _.getSnapshotBeforeUpdate!="function"||j===i.memoizedProps&&o===i.memoizedState||(e.flags|=1024),c=!1)}return jj(i,e,s,c,$,h)}function jj(i,e,s,c,h,$){gj(i,e);var _=(e.flags&128)!==0;if(!c&&!_)return h&&dg(e,s,!1),Zi(i,e,$);c=e.stateNode,Wi.current=e;var j=_&&typeof s.getDerivedStateFromError!="function"?null:c.render();return e.flags|=1,i!==null&&_?(e.child=Ug(e,i.child,null,$),e.child=Ug(e,null,j,$)):Xi(i,e,j,$),e.memoizedState=c.state,h&&dg(e,s,!0),e.child}function kj(i){var e=i.stateNode;e.pendingContext?ag(i,e.pendingContext,e.pendingContext!==e.context):e.context&&ag(i,e.context,!1),yh(i,e.containerInfo)}function lj(i,e,s,c,h){return Ig(),Jg(h),e.flags|=256,Xi(i,e,s,c),e.child}var mj={dehydrated:null,treeContext:null,retryLane:0};function nj(i){return{baseLanes:i,cachePool:null,transitions:null}}function oj(i,e,s){var c=e.pendingProps,h=L.current,$=!1,_=(e.flags&128)!==0,j;if((j=_)||(j=i!==null&&i.memoizedState===null?!1:(h&2)!==0),j?($=!0,e.flags&=-129):(i===null||i.memoizedState!==null)&&(h|=1),G(L,h&1),i===null)return Eg(e),i=e.memoizedState,i!==null&&(i=i.dehydrated,i!==null)?(e.mode&1?i.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(_=c.children,i=c.fallback,$?(c=e.mode,$=e.child,_={mode:"hidden",children:_},!(c&1)&&$!==null?($.childLanes=0,$.pendingProps=_):$=pj(_,c,0,null),i=Tg(i,c,s,null),$.return=e,i.return=e,$.sibling=i,e.child=$,e.child.memoizedState=nj(s),e.memoizedState=mj,i):qj(e,_));if(h=i.memoizedState,h!==null&&(j=h.dehydrated,j!==null))return rj(i,e,_,c,j,h,s);if($){$=c.fallback,_=e.mode,h=i.child,j=h.sibling;var nt={mode:"hidden",children:c.children};return!(_&1)&&e.child!==h?(c=e.child,c.childLanes=0,c.pendingProps=nt,e.deletions=null):(c=Pg(h,nt),c.subtreeFlags=h.subtreeFlags&14680064),j!==null?$=Pg(j,$):($=Tg($,_,s,null),$.flags|=2),$.return=e,c.return=e,c.sibling=$,e.child=c,c=$,$=e.child,_=i.child.memoizedState,_=_===null?nj(s):{baseLanes:_.baseLanes|s,cachePool:null,transitions:_.transitions},$.memoizedState=_,$.childLanes=i.childLanes&~s,e.memoizedState=mj,c}return $=i.child,i=$.sibling,c=Pg($,{mode:"visible",children:c.children}),!(e.mode&1)&&(c.lanes=s),c.return=e,c.sibling=null,i!==null&&(s=e.deletions,s===null?(e.deletions=[i],e.flags|=16):s.push(i)),e.child=c,e.memoizedState=null,c}function qj(i,e){return e=pj({mode:"visible",children:e},i.mode,0,null),e.return=i,i.child=e}function sj(i,e,s,c){return c!==null&&Jg(c),Ug(e,i.child,null,s),i=qj(e,e.pendingProps.children),i.flags|=2,e.memoizedState=null,i}function rj(i,e,s,c,h,$,_){if(s)return e.flags&256?(e.flags&=-257,c=Ki(Error(p(422))),sj(i,e,_,c)):e.memoizedState!==null?(e.child=i.child,e.flags|=128,null):($=c.fallback,h=e.mode,c=pj({mode:"visible",children:c.children},h,0,null),$=Tg($,h,_,null),$.flags|=2,c.return=e,$.return=e,c.sibling=$,e.child=c,e.mode&1&&Ug(e,i.child,null,_),e.child.memoizedState=nj(_),e.memoizedState=mj,$);if(!(e.mode&1))return sj(i,e,_,null);if(h.data==="$!"){if(c=h.nextSibling&&h.nextSibling.dataset,c)var j=c.dgst;return c=j,$=Error(p(419)),c=Ki($,c,void 0),sj(i,e,_,c)}if(j=(_&i.childLanes)!==0,dh||j){if(c=Q,c!==null){switch(_&-_){case 4:h=2;break;case 16:h=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:h=32;break;case 536870912:h=268435456;break;default:h=0}h=h&(c.suspendedLanes|_)?0:h,h!==0&&h!==$.retryLane&&($.retryLane=h,ih(i,h),gi(c,i,h,-1))}return tj(),c=Ki(Error(p(421))),sj(i,e,_,c)}return h.data==="$?"?(e.flags|=128,e.child=i.child,e=uj.bind(null,i),h._reactRetry=e,null):(i=$.treeContext,yg=Lf(h.nextSibling),xg=e,I=!0,zg=null,i!==null&&(og[pg++]=rg,og[pg++]=sg,og[pg++]=qg,rg=i.id,sg=i.overflow,qg=e),e=qj(e,c.children),e.flags|=4096,e)}function vj(i,e,s){i.lanes|=e;var c=i.alternate;c!==null&&(c.lanes|=e),bh(i.return,e,s)}function wj(i,e,s,c,h){var $=i.memoizedState;$===null?i.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:c,tail:s,tailMode:h}:($.isBackwards=e,$.rendering=null,$.renderingStartTime=0,$.last=c,$.tail=s,$.tailMode=h)}function xj(i,e,s){var c=e.pendingProps,h=c.revealOrder,$=c.tail;if(Xi(i,e,c.children,s),c=L.current,c&2)c=c&1|2,e.flags|=128;else{if(i!==null&&i.flags&128)e:for(i=e.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&vj(i,s,e);else if(i.tag===19)vj(i,s,e);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===e)break e;for(;i.sibling===null;){if(i.return===null||i.return===e)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}c&=1}if(G(L,c),!(e.mode&1))e.memoizedState=null;else switch(h){case"forwards":for(s=e.child,h=null;s!==null;)i=s.alternate,i!==null&&Ch(i)===null&&(h=s),s=s.sibling;s=h,s===null?(h=e.child,e.child=null):(h=s.sibling,s.sibling=null),wj(e,!1,h,s,$);break;case"backwards":for(s=null,h=e.child,e.child=null;h!==null;){if(i=h.alternate,i!==null&&Ch(i)===null){e.child=h;break}i=h.sibling,h.sibling=s,s=h,h=i}wj(e,!0,s,null,$);break;case"together":wj(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function ij(i,e){!(e.mode&1)&&i!==null&&(i.alternate=null,e.alternate=null,e.flags|=2)}function Zi(i,e,s){if(i!==null&&(e.dependencies=i.dependencies),rh|=e.lanes,!(s&e.childLanes))return null;if(i!==null&&e.child!==i.child)throw Error(p(153));if(e.child!==null){for(i=e.child,s=Pg(i,i.pendingProps),e.child=s,s.return=e;i.sibling!==null;)i=i.sibling,s=s.sibling=Pg(i,i.pendingProps),s.return=e;s.sibling=null}return e.child}function yj(i,e,s){switch(e.tag){case 3:kj(e),Ig();break;case 5:Ah(e);break;case 1:Zf(e.type)&&cg(e);break;case 4:yh(e,e.stateNode.containerInfo);break;case 10:var c=e.type._context,h=e.memoizedProps.value;G(Wg,c._currentValue),c._currentValue=h;break;case 13:if(c=e.memoizedState,c!==null)return c.dehydrated!==null?(G(L,L.current&1),e.flags|=128,null):s&e.child.childLanes?oj(i,e,s):(G(L,L.current&1),i=Zi(i,e,s),i!==null?i.sibling:null);G(L,L.current&1);break;case 19:if(c=(s&e.childLanes)!==0,i.flags&128){if(c)return xj(i,e,s);e.flags|=128}if(h=e.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),G(L,L.current),c)break;return null;case 22:case 23:return e.lanes=0,dj(i,e,s)}return Zi(i,e,s)}var zj,Aj,Bj,Cj;zj=function(i,e){for(var s=e.child;s!==null;){if(s.tag===5||s.tag===6)i.appendChild(s.stateNode);else if(s.tag!==4&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===e)break;for(;s.sibling===null;){if(s.return===null||s.return===e)return;s=s.return}s.sibling.return=s.return,s=s.sibling}},Aj=function(){},Bj=function(i,e,s,c){var h=i.memoizedProps;if(h!==c){i=e.stateNode,xh(uh.current);var $=null;switch(s){case"input":h=Ya$1(i,h),c=Ya$1(i,c),$=[];break;case"select":h=A({},h,{value:void 0}),c=A({},c,{value:void 0}),$=[];break;case"textarea":h=gb(i,h),c=gb(i,c),$=[];break;default:typeof h.onClick!="function"&&typeof c.onClick=="function"&&(i.onclick=Bf)}ub(s,c);var _;s=null;for(et in h)if(!c.hasOwnProperty(et)&&h.hasOwnProperty(et)&&h[et]!=null)if(et==="style"){var j=h[et];for(_ in j)j.hasOwnProperty(_)&&(s||(s={}),s[_]="")}else et!=="dangerouslySetInnerHTML"&&et!=="children"&&et!=="suppressContentEditableWarning"&&et!=="suppressHydrationWarning"&&et!=="autoFocus"&&(ea$1.hasOwnProperty(et)?$||($=[]):($=$||[]).push(et,null));for(et in c){var nt=c[et];if(j=h!=null?h[et]:void 0,c.hasOwnProperty(et)&&nt!==j&&(nt!=null||j!=null))if(et==="style")if(j){for(_ in j)!j.hasOwnProperty(_)||nt&&nt.hasOwnProperty(_)||(s||(s={}),s[_]="");for(_ in nt)nt.hasOwnProperty(_)&&j[_]!==nt[_]&&(s||(s={}),s[_]=nt[_])}else s||($||($=[]),$.push(et,s)),s=nt;else et==="dangerouslySetInnerHTML"?(nt=nt?nt.__html:void 0,j=j?j.__html:void 0,nt!=null&&j!==nt&&($=$||[]).push(et,nt)):et==="children"?typeof nt!="string"&&typeof nt!="number"||($=$||[]).push(et,""+nt):et!=="suppressContentEditableWarning"&&et!=="suppressHydrationWarning"&&(ea$1.hasOwnProperty(et)?(nt!=null&&et==="onScroll"&&D("scroll",i),$||j===nt||($=[])):($=$||[]).push(et,nt))}s&&($=$||[]).push("style",s);var et=$;(e.updateQueue=et)&&(e.flags|=4)}},Cj=function(i,e,s,c){s!==c&&(e.flags|=4)};function Dj(i,e){if(!I)switch(i.tailMode){case"hidden":e=i.tail;for(var s=null;e!==null;)e.alternate!==null&&(s=e),e=e.sibling;s===null?i.tail=null:s.sibling=null;break;case"collapsed":s=i.tail;for(var c=null;s!==null;)s.alternate!==null&&(c=s),s=s.sibling;c===null?e||i.tail===null?i.tail=null:i.tail.sibling=null:c.sibling=null}}function S(i){var e=i.alternate!==null&&i.alternate.child===i.child,s=0,c=0;if(e)for(var h=i.child;h!==null;)s|=h.lanes|h.childLanes,c|=h.subtreeFlags&14680064,c|=h.flags&14680064,h.return=i,h=h.sibling;else for(h=i.child;h!==null;)s|=h.lanes|h.childLanes,c|=h.subtreeFlags,c|=h.flags,h.return=i,h=h.sibling;return i.subtreeFlags|=c,i.childLanes=s,e}function Ej(i,e,s){var c=e.pendingProps;switch(wg(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return S(e),null;case 1:return Zf(e.type)&&$f(),S(e),null;case 3:return c=e.stateNode,zh(),E(Wf),E(H),Eh(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(i===null||i.child===null)&&(Gg(e)?e.flags|=4:i===null||i.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,zg!==null&&(Fj(zg),zg=null))),Aj(i,e),S(e),null;case 5:Bh(e);var h=xh(wh.current);if(s=e.type,i!==null&&e.stateNode!=null)Bj(i,e,s,c,h),i.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!c){if(e.stateNode===null)throw Error(p(166));return S(e),null}if(i=xh(uh.current),Gg(e)){c=e.stateNode,s=e.type;var $=e.memoizedProps;switch(c[Of]=e,c[Pf]=$,i=(e.mode&1)!==0,s){case"dialog":D("cancel",c),D("close",c);break;case"iframe":case"object":case"embed":D("load",c);break;case"video":case"audio":for(h=0;h<lf.length;h++)D(lf[h],c);break;case"source":D("error",c);break;case"img":case"image":case"link":D("error",c),D("load",c);break;case"details":D("toggle",c);break;case"input":Za$1(c,$),D("invalid",c);break;case"select":c._wrapperState={wasMultiple:!!$.multiple},D("invalid",c);break;case"textarea":hb(c,$),D("invalid",c)}ub(s,$),h=null;for(var _ in $)if($.hasOwnProperty(_)){var j=$[_];_==="children"?typeof j=="string"?c.textContent!==j&&($.suppressHydrationWarning!==!0&&Af(c.textContent,j,i),h=["children",j]):typeof j=="number"&&c.textContent!==""+j&&($.suppressHydrationWarning!==!0&&Af(c.textContent,j,i),h=["children",""+j]):ea$1.hasOwnProperty(_)&&j!=null&&_==="onScroll"&&D("scroll",c)}switch(s){case"input":Va$1(c),db(c,$,!0);break;case"textarea":Va$1(c),jb(c);break;case"select":case"option":break;default:typeof $.onClick=="function"&&(c.onclick=Bf)}c=h,e.updateQueue=c,c!==null&&(e.flags|=4)}else{_=h.nodeType===9?h:h.ownerDocument,i==="http://www.w3.org/1999/xhtml"&&(i=kb(s)),i==="http://www.w3.org/1999/xhtml"?s==="script"?(i=_.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild)):typeof c.is=="string"?i=_.createElement(s,{is:c.is}):(i=_.createElement(s),s==="select"&&(_=i,c.multiple?_.multiple=!0:c.size&&(_.size=c.size))):i=_.createElementNS(i,s),i[Of]=e,i[Pf]=c,zj(i,e,!1,!1),e.stateNode=i;e:{switch(_=vb(s,c),s){case"dialog":D("cancel",i),D("close",i),h=c;break;case"iframe":case"object":case"embed":D("load",i),h=c;break;case"video":case"audio":for(h=0;h<lf.length;h++)D(lf[h],i);h=c;break;case"source":D("error",i),h=c;break;case"img":case"image":case"link":D("error",i),D("load",i),h=c;break;case"details":D("toggle",i),h=c;break;case"input":Za$1(i,c),h=Ya$1(i,c),D("invalid",i);break;case"option":h=c;break;case"select":i._wrapperState={wasMultiple:!!c.multiple},h=A({},c,{value:void 0}),D("invalid",i);break;case"textarea":hb(i,c),h=gb(i,c),D("invalid",i);break;default:h=c}ub(s,h),j=h;for($ in j)if(j.hasOwnProperty($)){var nt=j[$];$==="style"?sb(i,nt):$==="dangerouslySetInnerHTML"?(nt=nt?nt.__html:void 0,nt!=null&&nb(i,nt)):$==="children"?typeof nt=="string"?(s!=="textarea"||nt!=="")&&ob(i,nt):typeof nt=="number"&&ob(i,""+nt):$!=="suppressContentEditableWarning"&&$!=="suppressHydrationWarning"&&$!=="autoFocus"&&(ea$1.hasOwnProperty($)?nt!=null&&$==="onScroll"&&D("scroll",i):nt!=null&&ta$1(i,$,nt,_))}switch(s){case"input":Va$1(i),db(i,c,!1);break;case"textarea":Va$1(i),jb(i);break;case"option":c.value!=null&&i.setAttribute("value",""+Sa$1(c.value));break;case"select":i.multiple=!!c.multiple,$=c.value,$!=null?fb(i,!!c.multiple,$,!1):c.defaultValue!=null&&fb(i,!!c.multiple,c.defaultValue,!0);break;default:typeof h.onClick=="function"&&(i.onclick=Bf)}switch(s){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}}c&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return S(e),null;case 6:if(i&&e.stateNode!=null)Cj(i,e,i.memoizedProps,c);else{if(typeof c!="string"&&e.stateNode===null)throw Error(p(166));if(s=xh(wh.current),xh(uh.current),Gg(e)){if(c=e.stateNode,s=e.memoizedProps,c[Of]=e,($=c.nodeValue!==s)&&(i=xg,i!==null))switch(i.tag){case 3:Af(c.nodeValue,s,(i.mode&1)!==0);break;case 5:i.memoizedProps.suppressHydrationWarning!==!0&&Af(c.nodeValue,s,(i.mode&1)!==0)}$&&(e.flags|=4)}else c=(s.nodeType===9?s:s.ownerDocument).createTextNode(c),c[Of]=e,e.stateNode=c}return S(e),null;case 13:if(E(L),c=e.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(I&&yg!==null&&e.mode&1&&!(e.flags&128))Hg(),Ig(),e.flags|=98560,$=!1;else if($=Gg(e),c!==null&&c.dehydrated!==null){if(i===null){if(!$)throw Error(p(318));if($=e.memoizedState,$=$!==null?$.dehydrated:null,!$)throw Error(p(317));$[Of]=e}else Ig(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;S(e),$=!1}else zg!==null&&(Fj(zg),zg=null),$=!0;if(!$)return e.flags&65536?e:null}return e.flags&128?(e.lanes=s,e):(c=c!==null,c!==(i!==null&&i.memoizedState!==null)&&c&&(e.child.flags|=8192,e.mode&1&&(i===null||L.current&1?T===0&&(T=3):tj())),e.updateQueue!==null&&(e.flags|=4),S(e),null);case 4:return zh(),Aj(i,e),i===null&&sf(e.stateNode.containerInfo),S(e),null;case 10:return ah(e.type._context),S(e),null;case 17:return Zf(e.type)&&$f(),S(e),null;case 19:if(E(L),$=e.memoizedState,$===null)return S(e),null;if(c=(e.flags&128)!==0,_=$.rendering,_===null)if(c)Dj($,!1);else{if(T!==0||i!==null&&i.flags&128)for(i=e.child;i!==null;){if(_=Ch(i),_!==null){for(e.flags|=128,Dj($,!1),c=_.updateQueue,c!==null&&(e.updateQueue=c,e.flags|=4),e.subtreeFlags=0,c=s,s=e.child;s!==null;)$=s,i=c,$.flags&=14680066,_=$.alternate,_===null?($.childLanes=0,$.lanes=i,$.child=null,$.subtreeFlags=0,$.memoizedProps=null,$.memoizedState=null,$.updateQueue=null,$.dependencies=null,$.stateNode=null):($.childLanes=_.childLanes,$.lanes=_.lanes,$.child=_.child,$.subtreeFlags=0,$.deletions=null,$.memoizedProps=_.memoizedProps,$.memoizedState=_.memoizedState,$.updateQueue=_.updateQueue,$.type=_.type,i=_.dependencies,$.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),s=s.sibling;return G(L,L.current&1|2),e.child}i=i.sibling}$.tail!==null&&B()>Gj&&(e.flags|=128,c=!0,Dj($,!1),e.lanes=4194304)}else{if(!c)if(i=Ch(_),i!==null){if(e.flags|=128,c=!0,s=i.updateQueue,s!==null&&(e.updateQueue=s,e.flags|=4),Dj($,!0),$.tail===null&&$.tailMode==="hidden"&&!_.alternate&&!I)return S(e),null}else 2*B()-$.renderingStartTime>Gj&&s!==1073741824&&(e.flags|=128,c=!0,Dj($,!1),e.lanes=4194304);$.isBackwards?(_.sibling=e.child,e.child=_):(s=$.last,s!==null?s.sibling=_:e.child=_,$.last=_)}return $.tail!==null?(e=$.tail,$.rendering=e,$.tail=e.sibling,$.renderingStartTime=B(),e.sibling=null,s=L.current,G(L,c?s&1|2:s&1),e):(S(e),null);case 22:case 23:return Hj(),c=e.memoizedState!==null,i!==null&&i.memoizedState!==null!==c&&(e.flags|=8192),c&&e.mode&1?fj&1073741824&&(S(e),e.subtreeFlags&6&&(e.flags|=8192)):S(e),null;case 24:return null;case 25:return null}throw Error(p(156,e.tag))}function Ij(i,e){switch(wg(e),e.tag){case 1:return Zf(e.type)&&$f(),i=e.flags,i&65536?(e.flags=i&-65537|128,e):null;case 3:return zh(),E(Wf),E(H),Eh(),i=e.flags,i&65536&&!(i&128)?(e.flags=i&-65537|128,e):null;case 5:return Bh(e),null;case 13:if(E(L),i=e.memoizedState,i!==null&&i.dehydrated!==null){if(e.alternate===null)throw Error(p(340));Ig()}return i=e.flags,i&65536?(e.flags=i&-65537|128,e):null;case 19:return E(L),null;case 4:return zh(),null;case 10:return ah(e.type._context),null;case 22:case 23:return Hj(),null;case 24:return null;default:return null}}var Jj=!1,U=!1,Kj=typeof WeakSet=="function"?WeakSet:Set,V=null;function Lj(i,e){var s=i.ref;if(s!==null)if(typeof s=="function")try{s(null)}catch(c){W(i,e,c)}else s.current=null}function Mj(i,e,s){try{s()}catch(c){W(i,e,c)}}var Nj=!1;function Oj(i,e){if(Cf=dd,i=Me$1(),Ne$1(i)){if("selectionStart"in i)var s={start:i.selectionStart,end:i.selectionEnd};else e:{s=(s=i.ownerDocument)&&s.defaultView||window;var c=s.getSelection&&s.getSelection();if(c&&c.rangeCount!==0){s=c.anchorNode;var h=c.anchorOffset,$=c.focusNode;c=c.focusOffset;try{s.nodeType,$.nodeType}catch{s=null;break e}var _=0,j=-1,nt=-1,et=0,b=0,a=i,o=null;t:for(;;){for(var d;a!==s||h!==0&&a.nodeType!==3||(j=_+h),a!==$||c!==0&&a.nodeType!==3||(nt=_+c),a.nodeType===3&&(_+=a.nodeValue.length),(d=a.firstChild)!==null;)o=a,a=d;for(;;){if(a===i)break t;if(o===s&&++et===h&&(j=_),o===$&&++b===c&&(nt=_),(d=a.nextSibling)!==null)break;a=o,o=a.parentNode}a=d}s=j===-1||nt===-1?null:{start:j,end:nt}}else s=null}s=s||{start:0,end:0}}else s=null;for(Df={focusedElem:i,selectionRange:s},dd=!1,V=e;V!==null;)if(e=V,i=e.child,(e.subtreeFlags&1028)!==0&&i!==null)i.return=e,V=i;else for(;V!==null;){e=V;try{var g=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var it=g.memoizedProps,st=g.memoizedState,tt=e.stateNode,ot=tt.getSnapshotBeforeUpdate(e.elementType===e.type?it:Ci(e.type,it),st);tt.__reactInternalSnapshotBeforeUpdate=ot}break;case 3:var rt=e.stateNode.containerInfo;rt.nodeType===1?rt.textContent="":rt.nodeType===9&&rt.documentElement&&rt.removeChild(rt.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(p(163))}}catch(at){W(e,e.return,at)}if(i=e.sibling,i!==null){i.return=e.return,V=i;break}V=e.return}return g=Nj,Nj=!1,g}function Pj(i,e,s){var c=e.updateQueue;if(c=c!==null?c.lastEffect:null,c!==null){var h=c=c.next;do{if((h.tag&i)===i){var $=h.destroy;h.destroy=void 0,$!==void 0&&Mj(e,s,$)}h=h.next}while(h!==c)}}function Qj(i,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var s=e=e.next;do{if((s.tag&i)===i){var c=s.create;s.destroy=c()}s=s.next}while(s!==e)}}function Rj(i){var e=i.ref;if(e!==null){var s=i.stateNode;switch(i.tag){case 5:i=s;break;default:i=s}typeof e=="function"?e(i):e.current=i}}function Sj(i){var e=i.alternate;e!==null&&(i.alternate=null,Sj(e)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(e=i.stateNode,e!==null&&(delete e[Of],delete e[Pf],delete e[of],delete e[Qf],delete e[Rf])),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}function Tj(i){return i.tag===5||i.tag===3||i.tag===4}function Uj(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||Tj(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function Vj(i,e,s){var c=i.tag;if(c===5||c===6)i=i.stateNode,e?s.nodeType===8?s.parentNode.insertBefore(i,e):s.insertBefore(i,e):(s.nodeType===8?(e=s.parentNode,e.insertBefore(i,s)):(e=s,e.appendChild(i)),s=s._reactRootContainer,s!=null||e.onclick!==null||(e.onclick=Bf));else if(c!==4&&(i=i.child,i!==null))for(Vj(i,e,s),i=i.sibling;i!==null;)Vj(i,e,s),i=i.sibling}function Wj(i,e,s){var c=i.tag;if(c===5||c===6)i=i.stateNode,e?s.insertBefore(i,e):s.appendChild(i);else if(c!==4&&(i=i.child,i!==null))for(Wj(i,e,s),i=i.sibling;i!==null;)Wj(i,e,s),i=i.sibling}var X=null,Xj=!1;function Yj(i,e,s){for(s=s.child;s!==null;)Zj(i,e,s),s=s.sibling}function Zj(i,e,s){if(lc&&typeof lc.onCommitFiberUnmount=="function")try{lc.onCommitFiberUnmount(kc,s)}catch{}switch(s.tag){case 5:U||Lj(s,e);case 6:var c=X,h=Xj;X=null,Yj(i,e,s),X=c,Xj=h,X!==null&&(Xj?(i=X,s=s.stateNode,i.nodeType===8?i.parentNode.removeChild(s):i.removeChild(s)):X.removeChild(s.stateNode));break;case 18:X!==null&&(Xj?(i=X,s=s.stateNode,i.nodeType===8?Kf(i.parentNode,s):i.nodeType===1&&Kf(i,s),bd(i)):Kf(X,s.stateNode));break;case 4:c=X,h=Xj,X=s.stateNode.containerInfo,Xj=!0,Yj(i,e,s),X=c,Xj=h;break;case 0:case 11:case 14:case 15:if(!U&&(c=s.updateQueue,c!==null&&(c=c.lastEffect,c!==null))){h=c=c.next;do{var $=h,_=$.destroy;$=$.tag,_!==void 0&&($&2||$&4)&&Mj(s,e,_),h=h.next}while(h!==c)}Yj(i,e,s);break;case 1:if(!U&&(Lj(s,e),c=s.stateNode,typeof c.componentWillUnmount=="function"))try{c.props=s.memoizedProps,c.state=s.memoizedState,c.componentWillUnmount()}catch(j){W(s,e,j)}Yj(i,e,s);break;case 21:Yj(i,e,s);break;case 22:s.mode&1?(U=(c=U)||s.memoizedState!==null,Yj(i,e,s),U=c):Yj(i,e,s);break;default:Yj(i,e,s)}}function ak(i){var e=i.updateQueue;if(e!==null){i.updateQueue=null;var s=i.stateNode;s===null&&(s=i.stateNode=new Kj),e.forEach(function(c){var h=bk.bind(null,i,c);s.has(c)||(s.add(c),c.then(h,h))})}}function ck(i,e){var s=e.deletions;if(s!==null)for(var c=0;c<s.length;c++){var h=s[c];try{var $=i,_=e,j=_;e:for(;j!==null;){switch(j.tag){case 5:X=j.stateNode,Xj=!1;break e;case 3:X=j.stateNode.containerInfo,Xj=!0;break e;case 4:X=j.stateNode.containerInfo,Xj=!0;break e}j=j.return}if(X===null)throw Error(p(160));Zj($,_,h),X=null,Xj=!1;var nt=h.alternate;nt!==null&&(nt.return=null),h.return=null}catch(et){W(h,e,et)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)dk(e,i),e=e.sibling}function dk(i,e){var s=i.alternate,c=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:if(ck(e,i),ek(i),c&4){try{Pj(3,i,i.return),Qj(3,i)}catch(it){W(i,i.return,it)}try{Pj(5,i,i.return)}catch(it){W(i,i.return,it)}}break;case 1:ck(e,i),ek(i),c&512&&s!==null&&Lj(s,s.return);break;case 5:if(ck(e,i),ek(i),c&512&&s!==null&&Lj(s,s.return),i.flags&32){var h=i.stateNode;try{ob(h,"")}catch(it){W(i,i.return,it)}}if(c&4&&(h=i.stateNode,h!=null)){var $=i.memoizedProps,_=s!==null?s.memoizedProps:$,j=i.type,nt=i.updateQueue;if(i.updateQueue=null,nt!==null)try{j==="input"&&$.type==="radio"&&$.name!=null&&ab(h,$),vb(j,_);var et=vb(j,$);for(_=0;_<nt.length;_+=2){var b=nt[_],a=nt[_+1];b==="style"?sb(h,a):b==="dangerouslySetInnerHTML"?nb(h,a):b==="children"?ob(h,a):ta$1(h,b,a,et)}switch(j){case"input":bb(h,$);break;case"textarea":ib(h,$);break;case"select":var o=h._wrapperState.wasMultiple;h._wrapperState.wasMultiple=!!$.multiple;var d=$.value;d!=null?fb(h,!!$.multiple,d,!1):o!==!!$.multiple&&($.defaultValue!=null?fb(h,!!$.multiple,$.defaultValue,!0):fb(h,!!$.multiple,$.multiple?[]:"",!1))}h[Pf]=$}catch(it){W(i,i.return,it)}}break;case 6:if(ck(e,i),ek(i),c&4){if(i.stateNode===null)throw Error(p(162));h=i.stateNode,$=i.memoizedProps;try{h.nodeValue=$}catch(it){W(i,i.return,it)}}break;case 3:if(ck(e,i),ek(i),c&4&&s!==null&&s.memoizedState.isDehydrated)try{bd(e.containerInfo)}catch(it){W(i,i.return,it)}break;case 4:ck(e,i),ek(i);break;case 13:ck(e,i),ek(i),h=i.child,h.flags&8192&&($=h.memoizedState!==null,h.stateNode.isHidden=$,!$||h.alternate!==null&&h.alternate.memoizedState!==null||(fk=B())),c&4&&ak(i);break;case 22:if(b=s!==null&&s.memoizedState!==null,i.mode&1?(U=(et=U)||b,ck(e,i),U=et):ck(e,i),ek(i),c&8192){if(et=i.memoizedState!==null,(i.stateNode.isHidden=et)&&!b&&i.mode&1)for(V=i,b=i.child;b!==null;){for(a=V=b;V!==null;){switch(o=V,d=o.child,o.tag){case 0:case 11:case 14:case 15:Pj(4,o,o.return);break;case 1:Lj(o,o.return);var g=o.stateNode;if(typeof g.componentWillUnmount=="function"){c=o,s=o.return;try{e=c,g.props=e.memoizedProps,g.state=e.memoizedState,g.componentWillUnmount()}catch(it){W(c,s,it)}}break;case 5:Lj(o,o.return);break;case 22:if(o.memoizedState!==null){gk(a);continue}}d!==null?(d.return=o,V=d):gk(a)}b=b.sibling}e:for(b=null,a=i;;){if(a.tag===5){if(b===null){b=a;try{h=a.stateNode,et?($=h.style,typeof $.setProperty=="function"?$.setProperty("display","none","important"):$.display="none"):(j=a.stateNode,nt=a.memoizedProps.style,_=nt!=null&&nt.hasOwnProperty("display")?nt.display:null,j.style.display=rb("display",_))}catch(it){W(i,i.return,it)}}}else if(a.tag===6){if(b===null)try{a.stateNode.nodeValue=et?"":a.memoizedProps}catch(it){W(i,i.return,it)}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===i)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===i)break e;for(;a.sibling===null;){if(a.return===null||a.return===i)break e;b===a&&(b=null),a=a.return}b===a&&(b=null),a.sibling.return=a.return,a=a.sibling}}break;case 19:ck(e,i),ek(i),c&4&&ak(i);break;case 21:break;default:ck(e,i),ek(i)}}function ek(i){var e=i.flags;if(e&2){try{e:{for(var s=i.return;s!==null;){if(Tj(s)){var c=s;break e}s=s.return}throw Error(p(160))}switch(c.tag){case 5:var h=c.stateNode;c.flags&32&&(ob(h,""),c.flags&=-33);var $=Uj(i);Wj(i,$,h);break;case 3:case 4:var _=c.stateNode.containerInfo,j=Uj(i);Vj(i,j,_);break;default:throw Error(p(161))}}catch(nt){W(i,i.return,nt)}i.flags&=-3}e&4096&&(i.flags&=-4097)}function hk(i,e,s){V=i,ik(i)}function ik(i,e,s){for(var c=(i.mode&1)!==0;V!==null;){var h=V,$=h.child;if(h.tag===22&&c){var _=h.memoizedState!==null||Jj;if(!_){var j=h.alternate,nt=j!==null&&j.memoizedState!==null||U;j=Jj;var et=U;if(Jj=_,(U=nt)&&!et)for(V=h;V!==null;)_=V,nt=_.child,_.tag===22&&_.memoizedState!==null?jk(h):nt!==null?(nt.return=_,V=nt):jk(h);for(;$!==null;)V=$,ik($),$=$.sibling;V=h,Jj=j,U=et}kk(i)}else h.subtreeFlags&8772&&$!==null?($.return=h,V=$):kk(i)}}function kk(i){for(;V!==null;){var e=V;if(e.flags&8772){var s=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:U||Qj(5,e);break;case 1:var c=e.stateNode;if(e.flags&4&&!U)if(s===null)c.componentDidMount();else{var h=e.elementType===e.type?s.memoizedProps:Ci(e.type,s.memoizedProps);c.componentDidUpdate(h,s.memoizedState,c.__reactInternalSnapshotBeforeUpdate)}var $=e.updateQueue;$!==null&&sh(e,$,c);break;case 3:var _=e.updateQueue;if(_!==null){if(s=null,e.child!==null)switch(e.child.tag){case 5:s=e.child.stateNode;break;case 1:s=e.child.stateNode}sh(e,_,s)}break;case 5:var j=e.stateNode;if(s===null&&e.flags&4){s=j;var nt=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":nt.autoFocus&&s.focus();break;case"img":nt.src&&(s.src=nt.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var et=e.alternate;if(et!==null){var b=et.memoizedState;if(b!==null){var a=b.dehydrated;a!==null&&bd(a)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(p(163))}U||e.flags&512&&Rj(e)}catch(o){W(e,e.return,o)}}if(e===i){V=null;break}if(s=e.sibling,s!==null){s.return=e.return,V=s;break}V=e.return}}function gk(i){for(;V!==null;){var e=V;if(e===i){V=null;break}var s=e.sibling;if(s!==null){s.return=e.return,V=s;break}V=e.return}}function jk(i){for(;V!==null;){var e=V;try{switch(e.tag){case 0:case 11:case 15:var s=e.return;try{Qj(4,e)}catch(nt){W(e,s,nt)}break;case 1:var c=e.stateNode;if(typeof c.componentDidMount=="function"){var h=e.return;try{c.componentDidMount()}catch(nt){W(e,h,nt)}}var $=e.return;try{Rj(e)}catch(nt){W(e,$,nt)}break;case 5:var _=e.return;try{Rj(e)}catch(nt){W(e,_,nt)}}}catch(nt){W(e,e.return,nt)}if(e===i){V=null;break}var j=e.sibling;if(j!==null){j.return=e.return,V=j;break}V=e.return}}var lk=Math.ceil,mk=ua$1.ReactCurrentDispatcher,nk=ua$1.ReactCurrentOwner,ok=ua$1.ReactCurrentBatchConfig,K=0,Q=null,Y=null,Z=0,fj=0,ej=Uf(0),T=0,pk=null,rh=0,qk=0,rk=0,sk=null,tk=null,fk=0,Gj=1/0,uk=null,Oi=!1,Pi=null,Ri=null,vk=!1,wk=null,xk=0,yk=0,zk=null,Ak=-1,Bk=0;function R(){return K&6?B():Ak!==-1?Ak:Ak=B()}function yi(i){return i.mode&1?K&2&&Z!==0?Z&-Z:Kg.transition!==null?(Bk===0&&(Bk=yc()),Bk):(i=C,i!==0||(i=window.event,i=i===void 0?16:jd(i.type)),i):1}function gi(i,e,s,c){if(50<yk)throw yk=0,zk=null,Error(p(185));Ac(i,s,c),(!(K&2)||i!==Q)&&(i===Q&&(!(K&2)&&(qk|=s),T===4&&Ck(i,Z)),Dk(i,c),s===1&&K===0&&!(e.mode&1)&&(Gj=B()+500,fg&&jg()))}function Dk(i,e){var s=i.callbackNode;wc(i,e);var c=uc(i,i===Q?Z:0);if(c===0)s!==null&&bc(s),i.callbackNode=null,i.callbackPriority=0;else if(e=c&-c,i.callbackPriority!==e){if(s!=null&&bc(s),e===1)i.tag===0?ig(Ek.bind(null,i)):hg(Ek.bind(null,i)),Jf(function(){!(K&6)&&jg()}),s=null;else{switch(Dc(c)){case 1:s=fc;break;case 4:s=gc;break;case 16:s=hc;break;case 536870912:s=jc;break;default:s=hc}s=Fk(s,Gk.bind(null,i))}i.callbackPriority=e,i.callbackNode=s}}function Gk(i,e){if(Ak=-1,Bk=0,K&6)throw Error(p(327));var s=i.callbackNode;if(Hk()&&i.callbackNode!==s)return null;var c=uc(i,i===Q?Z:0);if(c===0)return null;if(c&30||c&i.expiredLanes||e)e=Ik(i,c);else{e=c;var h=K;K|=2;var $=Jk();(Q!==i||Z!==e)&&(uk=null,Gj=B()+500,Kk(i,e));do try{Lk();break}catch(j){Mk(i,j)}while(!0);$g(),mk.current=$,K=h,Y!==null?e=0:(Q=null,Z=0,e=T)}if(e!==0){if(e===2&&(h=xc(i),h!==0&&(c=h,e=Nk(i,h))),e===1)throw s=pk,Kk(i,0),Ck(i,c),Dk(i,B()),s;if(e===6)Ck(i,c);else{if(h=i.current.alternate,!(c&30)&&!Ok(h)&&(e=Ik(i,c),e===2&&($=xc(i),$!==0&&(c=$,e=Nk(i,$))),e===1))throw s=pk,Kk(i,0),Ck(i,c),Dk(i,B()),s;switch(i.finishedWork=h,i.finishedLanes=c,e){case 0:case 1:throw Error(p(345));case 2:Pk(i,tk,uk);break;case 3:if(Ck(i,c),(c&130023424)===c&&(e=fk+500-B(),10<e)){if(uc(i,0)!==0)break;if(h=i.suspendedLanes,(h&c)!==c){R(),i.pingedLanes|=i.suspendedLanes&h;break}i.timeoutHandle=Ff(Pk.bind(null,i,tk,uk),e);break}Pk(i,tk,uk);break;case 4:if(Ck(i,c),(c&4194240)===c)break;for(e=i.eventTimes,h=-1;0<c;){var _=31-oc(c);$=1<<_,_=e[_],_>h&&(h=_),c&=~$}if(c=h,c=B()-c,c=(120>c?120:480>c?480:1080>c?1080:1920>c?1920:3e3>c?3e3:4320>c?4320:1960*lk(c/1960))-c,10<c){i.timeoutHandle=Ff(Pk.bind(null,i,tk,uk),c);break}Pk(i,tk,uk);break;case 5:Pk(i,tk,uk);break;default:throw Error(p(329))}}}return Dk(i,B()),i.callbackNode===s?Gk.bind(null,i):null}function Nk(i,e){var s=sk;return i.current.memoizedState.isDehydrated&&(Kk(i,e).flags|=256),i=Ik(i,e),i!==2&&(e=tk,tk=s,e!==null&&Fj(e)),i}function Fj(i){tk===null?tk=i:tk.push.apply(tk,i)}function Ok(i){for(var e=i;;){if(e.flags&16384){var s=e.updateQueue;if(s!==null&&(s=s.stores,s!==null))for(var c=0;c<s.length;c++){var h=s[c],$=h.getSnapshot;h=h.value;try{if(!He$1($(),h))return!1}catch{return!1}}}if(s=e.child,e.subtreeFlags&16384&&s!==null)s.return=e,e=s;else{if(e===i)break;for(;e.sibling===null;){if(e.return===null||e.return===i)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function Ck(i,e){for(e&=~rk,e&=~qk,i.suspendedLanes|=e,i.pingedLanes&=~e,i=i.expirationTimes;0<e;){var s=31-oc(e),c=1<<s;i[s]=-1,e&=~c}}function Ek(i){if(K&6)throw Error(p(327));Hk();var e=uc(i,0);if(!(e&1))return Dk(i,B()),null;var s=Ik(i,e);if(i.tag!==0&&s===2){var c=xc(i);c!==0&&(e=c,s=Nk(i,c))}if(s===1)throw s=pk,Kk(i,0),Ck(i,e),Dk(i,B()),s;if(s===6)throw Error(p(345));return i.finishedWork=i.current.alternate,i.finishedLanes=e,Pk(i,tk,uk),Dk(i,B()),null}function Qk(i,e){var s=K;K|=1;try{return i(e)}finally{K=s,K===0&&(Gj=B()+500,fg&&jg())}}function Rk(i){wk!==null&&wk.tag===0&&!(K&6)&&Hk();var e=K;K|=1;var s=ok.transition,c=C;try{if(ok.transition=null,C=1,i)return i()}finally{C=c,ok.transition=s,K=e,!(K&6)&&jg()}}function Hj(){fj=ej.current,E(ej)}function Kk(i,e){i.finishedWork=null,i.finishedLanes=0;var s=i.timeoutHandle;if(s!==-1&&(i.timeoutHandle=-1,Gf(s)),Y!==null)for(s=Y.return;s!==null;){var c=s;switch(wg(c),c.tag){case 1:c=c.type.childContextTypes,c!=null&&$f();break;case 3:zh(),E(Wf),E(H),Eh();break;case 5:Bh(c);break;case 4:zh();break;case 13:E(L);break;case 19:E(L);break;case 10:ah(c.type._context);break;case 22:case 23:Hj()}s=s.return}if(Q=i,Y=i=Pg(i.current,null),Z=fj=e,T=0,pk=null,rk=qk=rh=0,tk=sk=null,fh!==null){for(e=0;e<fh.length;e++)if(s=fh[e],c=s.interleaved,c!==null){s.interleaved=null;var h=c.next,$=s.pending;if($!==null){var _=$.next;$.next=h,c.next=_}s.pending=c}fh=null}return i}function Mk(i,e){do{var s=Y;try{if($g(),Fh.current=Rh,Ih){for(var c=M.memoizedState;c!==null;){var h=c.queue;h!==null&&(h.pending=null),c=c.next}Ih=!1}if(Hh=0,O=N=M=null,Jh=!1,Kh=0,nk.current=null,s===null||s.return===null){T=1,pk=e,Y=null;break}e:{var $=i,_=s.return,j=s,nt=e;if(e=Z,j.flags|=32768,nt!==null&&typeof nt=="object"&&typeof nt.then=="function"){var et=nt,b=j,a=b.tag;if(!(b.mode&1)&&(a===0||a===11||a===15)){var o=b.alternate;o?(b.updateQueue=o.updateQueue,b.memoizedState=o.memoizedState,b.lanes=o.lanes):(b.updateQueue=null,b.memoizedState=null)}var d=Ui(_);if(d!==null){d.flags&=-257,Vi(d,_,j,$,e),d.mode&1&&Si($,et,e),e=d,nt=et;var g=e.updateQueue;if(g===null){var it=new Set;it.add(nt),e.updateQueue=it}else g.add(nt);break e}else{if(!(e&1)){Si($,et,e),tj();break e}nt=Error(p(426))}}else if(I&&j.mode&1){var st=Ui(_);if(st!==null){!(st.flags&65536)&&(st.flags|=256),Vi(st,_,j,$,e),Jg(Ji(nt,j));break e}}$=nt=Ji(nt,j),T!==4&&(T=2),sk===null?sk=[$]:sk.push($),$=_;do{switch($.tag){case 3:$.flags|=65536,e&=-e,$.lanes|=e;var tt=Ni($,nt,e);ph($,tt);break e;case 1:j=nt;var ot=$.type,rt=$.stateNode;if(!($.flags&128)&&(typeof ot.getDerivedStateFromError=="function"||rt!==null&&typeof rt.componentDidCatch=="function"&&(Ri===null||!Ri.has(rt)))){$.flags|=65536,e&=-e,$.lanes|=e;var at=Qi($,j,e);ph($,at);break e}}$=$.return}while($!==null)}Sk(s)}catch(ut){e=ut,Y===s&&s!==null&&(Y=s=s.return);continue}break}while(!0)}function Jk(){var i=mk.current;return mk.current=Rh,i===null?Rh:i}function tj(){(T===0||T===3||T===2)&&(T=4),Q===null||!(rh&268435455)&&!(qk&268435455)||Ck(Q,Z)}function Ik(i,e){var s=K;K|=2;var c=Jk();(Q!==i||Z!==e)&&(uk=null,Kk(i,e));do try{Tk();break}catch(h){Mk(i,h)}while(!0);if($g(),K=s,mk.current=c,Y!==null)throw Error(p(261));return Q=null,Z=0,T}function Tk(){for(;Y!==null;)Uk(Y)}function Lk(){for(;Y!==null&&!cc();)Uk(Y)}function Uk(i){var e=Vk(i.alternate,i,fj);i.memoizedProps=i.pendingProps,e===null?Sk(i):Y=e,nk.current=null}function Sk(i){var e=i;do{var s=e.alternate;if(i=e.return,e.flags&32768){if(s=Ij(s,e),s!==null){s.flags&=32767,Y=s;return}if(i!==null)i.flags|=32768,i.subtreeFlags=0,i.deletions=null;else{T=6,Y=null;return}}else if(s=Ej(s,e,fj),s!==null){Y=s;return}if(e=e.sibling,e!==null){Y=e;return}Y=e=i}while(e!==null);T===0&&(T=5)}function Pk(i,e,s){var c=C,h=ok.transition;try{ok.transition=null,C=1,Wk(i,e,s,c)}finally{ok.transition=h,C=c}return null}function Wk(i,e,s,c){do Hk();while(wk!==null);if(K&6)throw Error(p(327));s=i.finishedWork;var h=i.finishedLanes;if(s===null)return null;if(i.finishedWork=null,i.finishedLanes=0,s===i.current)throw Error(p(177));i.callbackNode=null,i.callbackPriority=0;var $=s.lanes|s.childLanes;if(Bc(i,$),i===Q&&(Y=Q=null,Z=0),!(s.subtreeFlags&2064)&&!(s.flags&2064)||vk||(vk=!0,Fk(hc,function(){return Hk(),null})),$=(s.flags&15990)!==0,s.subtreeFlags&15990||$){$=ok.transition,ok.transition=null;var _=C;C=1;var j=K;K|=4,nk.current=null,Oj(i,s),dk(s,i),Oe$1(Df),dd=!!Cf,Df=Cf=null,i.current=s,hk(s),dc(),K=j,C=_,ok.transition=$}else i.current=s;if(vk&&(vk=!1,wk=i,xk=h),$=i.pendingLanes,$===0&&(Ri=null),mc(s.stateNode),Dk(i,B()),e!==null)for(c=i.onRecoverableError,s=0;s<e.length;s++)h=e[s],c(h.value,{componentStack:h.stack,digest:h.digest});if(Oi)throw Oi=!1,i=Pi,Pi=null,i;return xk&1&&i.tag!==0&&Hk(),$=i.pendingLanes,$&1?i===zk?yk++:(yk=0,zk=i):yk=0,jg(),null}function Hk(){if(wk!==null){var i=Dc(xk),e=ok.transition,s=C;try{if(ok.transition=null,C=16>i?16:i,wk===null)var c=!1;else{if(i=wk,wk=null,xk=0,K&6)throw Error(p(331));var h=K;for(K|=4,V=i.current;V!==null;){var $=V,_=$.child;if(V.flags&16){var j=$.deletions;if(j!==null){for(var nt=0;nt<j.length;nt++){var et=j[nt];for(V=et;V!==null;){var b=V;switch(b.tag){case 0:case 11:case 15:Pj(8,b,$)}var a=b.child;if(a!==null)a.return=b,V=a;else for(;V!==null;){b=V;var o=b.sibling,d=b.return;if(Sj(b),b===et){V=null;break}if(o!==null){o.return=d,V=o;break}V=d}}}var g=$.alternate;if(g!==null){var it=g.child;if(it!==null){g.child=null;do{var st=it.sibling;it.sibling=null,it=st}while(it!==null)}}V=$}}if($.subtreeFlags&2064&&_!==null)_.return=$,V=_;else e:for(;V!==null;){if($=V,$.flags&2048)switch($.tag){case 0:case 11:case 15:Pj(9,$,$.return)}var tt=$.sibling;if(tt!==null){tt.return=$.return,V=tt;break e}V=$.return}}var ot=i.current;for(V=ot;V!==null;){_=V;var rt=_.child;if(_.subtreeFlags&2064&&rt!==null)rt.return=_,V=rt;else e:for(_=ot;V!==null;){if(j=V,j.flags&2048)try{switch(j.tag){case 0:case 11:case 15:Qj(9,j)}}catch(ut){W(j,j.return,ut)}if(j===_){V=null;break e}var at=j.sibling;if(at!==null){at.return=j.return,V=at;break e}V=j.return}}if(K=h,jg(),lc&&typeof lc.onPostCommitFiberRoot=="function")try{lc.onPostCommitFiberRoot(kc,i)}catch{}c=!0}return c}finally{C=s,ok.transition=e}}return!1}function Xk(i,e,s){e=Ji(s,e),e=Ni(i,e,1),i=nh(i,e,1),e=R(),i!==null&&(Ac(i,1,e),Dk(i,e))}function W(i,e,s){if(i.tag===3)Xk(i,i,s);else for(;e!==null;){if(e.tag===3){Xk(e,i,s);break}else if(e.tag===1){var c=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(Ri===null||!Ri.has(c))){i=Ji(s,i),i=Qi(e,i,1),e=nh(e,i,1),i=R(),e!==null&&(Ac(e,1,i),Dk(e,i));break}}e=e.return}}function Ti(i,e,s){var c=i.pingCache;c!==null&&c.delete(e),e=R(),i.pingedLanes|=i.suspendedLanes&s,Q===i&&(Z&s)===s&&(T===4||T===3&&(Z&130023424)===Z&&500>B()-fk?Kk(i,0):rk|=s),Dk(i,e)}function Yk(i,e){e===0&&(i.mode&1?(e=sc,sc<<=1,!(sc&130023424)&&(sc=4194304)):e=1);var s=R();i=ih(i,e),i!==null&&(Ac(i,e,s),Dk(i,s))}function uj(i){var e=i.memoizedState,s=0;e!==null&&(s=e.retryLane),Yk(i,s)}function bk(i,e){var s=0;switch(i.tag){case 13:var c=i.stateNode,h=i.memoizedState;h!==null&&(s=h.retryLane);break;case 19:c=i.stateNode;break;default:throw Error(p(314))}c!==null&&c.delete(e),Yk(i,s)}var Vk;Vk=function(i,e,s){if(i!==null)if(i.memoizedProps!==e.pendingProps||Wf.current)dh=!0;else{if(!(i.lanes&s)&&!(e.flags&128))return dh=!1,yj(i,e,s);dh=!!(i.flags&131072)}else dh=!1,I&&e.flags&1048576&&ug(e,ng,e.index);switch(e.lanes=0,e.tag){case 2:var c=e.type;ij(i,e),i=e.pendingProps;var h=Yf(e,H.current);ch(e,s),h=Nh(null,e,c,i,h,s);var $=Sh();return e.flags|=1,typeof h=="object"&&h!==null&&typeof h.render=="function"&&h.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Zf(c)?($=!0,cg(e)):$=!1,e.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,kh(e),h.updater=Ei,e.stateNode=h,h._reactInternals=e,Ii(e,c,i,s),e=jj(null,e,c,!0,$,s)):(e.tag=0,I&&$&&vg(e),Xi(null,e,h,s),e=e.child),e;case 16:c=e.elementType;e:{switch(ij(i,e),i=e.pendingProps,h=c._init,c=h(c._payload),e.type=c,h=e.tag=Zk(c),i=Ci(c,i),h){case 0:e=cj(null,e,c,i,s);break e;case 1:e=hj(null,e,c,i,s);break e;case 11:e=Yi(null,e,c,i,s);break e;case 14:e=$i(null,e,c,Ci(c.type,i),s);break e}throw Error(p(306,c,""))}return e;case 0:return c=e.type,h=e.pendingProps,h=e.elementType===c?h:Ci(c,h),cj(i,e,c,h,s);case 1:return c=e.type,h=e.pendingProps,h=e.elementType===c?h:Ci(c,h),hj(i,e,c,h,s);case 3:e:{if(kj(e),i===null)throw Error(p(387));c=e.pendingProps,$=e.memoizedState,h=$.element,lh(i,e),qh(e,c,null,s);var _=e.memoizedState;if(c=_.element,$.isDehydrated)if($={element:c,isDehydrated:!1,cache:_.cache,pendingSuspenseBoundaries:_.pendingSuspenseBoundaries,transitions:_.transitions},e.updateQueue.baseState=$,e.memoizedState=$,e.flags&256){h=Ji(Error(p(423)),e),e=lj(i,e,c,s,h);break e}else if(c!==h){h=Ji(Error(p(424)),e),e=lj(i,e,c,s,h);break e}else for(yg=Lf(e.stateNode.containerInfo.firstChild),xg=e,I=!0,zg=null,s=Vg(e,null,c,s),e.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(Ig(),c===h){e=Zi(i,e,s);break e}Xi(i,e,c,s)}e=e.child}return e;case 5:return Ah(e),i===null&&Eg(e),c=e.type,h=e.pendingProps,$=i!==null?i.memoizedProps:null,_=h.children,Ef(c,h)?_=null:$!==null&&Ef(c,$)&&(e.flags|=32),gj(i,e),Xi(i,e,_,s),e.child;case 6:return i===null&&Eg(e),null;case 13:return oj(i,e,s);case 4:return yh(e,e.stateNode.containerInfo),c=e.pendingProps,i===null?e.child=Ug(e,null,c,s):Xi(i,e,c,s),e.child;case 11:return c=e.type,h=e.pendingProps,h=e.elementType===c?h:Ci(c,h),Yi(i,e,c,h,s);case 7:return Xi(i,e,e.pendingProps,s),e.child;case 8:return Xi(i,e,e.pendingProps.children,s),e.child;case 12:return Xi(i,e,e.pendingProps.children,s),e.child;case 10:e:{if(c=e.type._context,h=e.pendingProps,$=e.memoizedProps,_=h.value,G(Wg,c._currentValue),c._currentValue=_,$!==null)if(He$1($.value,_)){if($.children===h.children&&!Wf.current){e=Zi(i,e,s);break e}}else for($=e.child,$!==null&&($.return=e);$!==null;){var j=$.dependencies;if(j!==null){_=$.child;for(var nt=j.firstContext;nt!==null;){if(nt.context===c){if($.tag===1){nt=mh(-1,s&-s),nt.tag=2;var et=$.updateQueue;if(et!==null){et=et.shared;var b=et.pending;b===null?nt.next=nt:(nt.next=b.next,b.next=nt),et.pending=nt}}$.lanes|=s,nt=$.alternate,nt!==null&&(nt.lanes|=s),bh($.return,s,e),j.lanes|=s;break}nt=nt.next}}else if($.tag===10)_=$.type===e.type?null:$.child;else if($.tag===18){if(_=$.return,_===null)throw Error(p(341));_.lanes|=s,j=_.alternate,j!==null&&(j.lanes|=s),bh(_,s,e),_=$.sibling}else _=$.child;if(_!==null)_.return=$;else for(_=$;_!==null;){if(_===e){_=null;break}if($=_.sibling,$!==null){$.return=_.return,_=$;break}_=_.return}$=_}Xi(i,e,h.children,s),e=e.child}return e;case 9:return h=e.type,c=e.pendingProps.children,ch(e,s),h=eh(h),c=c(h),e.flags|=1,Xi(i,e,c,s),e.child;case 14:return c=e.type,h=Ci(c,e.pendingProps),h=Ci(c.type,h),$i(i,e,c,h,s);case 15:return bj(i,e,e.type,e.pendingProps,s);case 17:return c=e.type,h=e.pendingProps,h=e.elementType===c?h:Ci(c,h),ij(i,e),e.tag=1,Zf(c)?(i=!0,cg(e)):i=!1,ch(e,s),Gi(e,c,h),Ii(e,c,h,s),jj(null,e,c,!0,i,s);case 19:return xj(i,e,s);case 22:return dj(i,e,s)}throw Error(p(156,e.tag))};function Fk(i,e){return ac(i,e)}function $k(i,e,s,c){this.tag=i,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Bg(i,e,s,c){return new $k(i,e,s,c)}function aj(i){return i=i.prototype,!(!i||!i.isReactComponent)}function Zk(i){if(typeof i=="function")return aj(i)?1:0;if(i!=null){if(i=i.$$typeof,i===Da$1)return 11;if(i===Ga$1)return 14}return 2}function Pg(i,e){var s=i.alternate;return s===null?(s=Bg(i.tag,e,i.key,i.mode),s.elementType=i.elementType,s.type=i.type,s.stateNode=i.stateNode,s.alternate=i,i.alternate=s):(s.pendingProps=e,s.type=i.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=i.flags&14680064,s.childLanes=i.childLanes,s.lanes=i.lanes,s.child=i.child,s.memoizedProps=i.memoizedProps,s.memoizedState=i.memoizedState,s.updateQueue=i.updateQueue,e=i.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},s.sibling=i.sibling,s.index=i.index,s.ref=i.ref,s}function Rg(i,e,s,c,h,$){var _=2;if(c=i,typeof i=="function")aj(i)&&(_=1);else if(typeof i=="string")_=5;else e:switch(i){case ya$1:return Tg(s.children,h,$,e);case za$1:_=8,h|=8;break;case Aa$1:return i=Bg(12,s,e,h|2),i.elementType=Aa$1,i.lanes=$,i;case Ea$1:return i=Bg(13,s,e,h),i.elementType=Ea$1,i.lanes=$,i;case Fa$1:return i=Bg(19,s,e,h),i.elementType=Fa$1,i.lanes=$,i;case Ia$1:return pj(s,h,$,e);default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case Ba$1:_=10;break e;case Ca$1:_=9;break e;case Da$1:_=11;break e;case Ga$1:_=14;break e;case Ha$1:_=16,c=null;break e}throw Error(p(130,i==null?i:typeof i,""))}return e=Bg(_,s,e,h),e.elementType=i,e.type=c,e.lanes=$,e}function Tg(i,e,s,c){return i=Bg(7,i,c,e),i.lanes=s,i}function pj(i,e,s,c){return i=Bg(22,i,c,e),i.elementType=Ia$1,i.lanes=s,i.stateNode={isHidden:!1},i}function Qg(i,e,s){return i=Bg(6,i,null,e),i.lanes=s,i}function Sg(i,e,s){return e=Bg(4,i.children!==null?i.children:[],i.key,e),e.lanes=s,e.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},e}function al(i,e,s,c,h){this.tag=e,this.containerInfo=i,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=zc(0),this.expirationTimes=zc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zc(0),this.identifierPrefix=c,this.onRecoverableError=h,this.mutableSourceEagerHydrationData=null}function bl(i,e,s,c,h,$,_,j,nt){return i=new al(i,e,s,j,nt),e===1?(e=1,$===!0&&(e|=8)):e=0,$=Bg(3,null,null,e),i.current=$,$.stateNode=i,$.memoizedState={element:c,isDehydrated:s,cache:null,transitions:null,pendingSuspenseBoundaries:null},kh($),i}function cl(i,e,s){var c=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:wa$1,key:c==null?null:""+c,children:i,containerInfo:e,implementation:s}}function dl(i){if(!i)return Vf;i=i._reactInternals;e:{if(Vb(i)!==i||i.tag!==1)throw Error(p(170));var e=i;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(Zf(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(p(171))}if(i.tag===1){var s=i.type;if(Zf(s))return bg(i,s,e)}return e}function el(i,e,s,c,h,$,_,j,nt){return i=bl(s,c,!0,i,h,$,_,j,nt),i.context=dl(null),s=i.current,c=R(),h=yi(s),$=mh(c,h),$.callback=e??null,nh(s,$,h),i.current.lanes=h,Ac(i,h,c),Dk(i,c),i}function fl(i,e,s,c){var h=e.current,$=R(),_=yi(h);return s=dl(s),e.context===null?e.context=s:e.pendingContext=s,e=mh($,_),e.payload={element:i},c=c===void 0?null:c,c!==null&&(e.callback=c),i=nh(h,e,_),i!==null&&(gi(i,h,_,$),oh(i,h,_)),_}function gl(i){if(i=i.current,!i.child)return null;switch(i.child.tag){case 5:return i.child.stateNode;default:return i.child.stateNode}}function hl(i,e){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var s=i.retryLane;i.retryLane=s!==0&&s<e?s:e}}function il(i,e){hl(i,e),(i=i.alternate)&&hl(i,e)}function jl(){return null}var kl=typeof reportError=="function"?reportError:function(i){console.error(i)};function ll(i){this._internalRoot=i}ml.prototype.render=ll.prototype.render=function(i){var e=this._internalRoot;if(e===null)throw Error(p(409));fl(i,e,null,null)},ml.prototype.unmount=ll.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var e=i.containerInfo;Rk(function(){fl(null,i,null,null)}),e[uf]=null}};function ml(i){this._internalRoot=i}ml.prototype.unstable_scheduleHydration=function(i){if(i){var e=Hc();i={blockedOn:null,target:i,priority:e};for(var s=0;s<Qc.length&&e!==0&&e<Qc[s].priority;s++);Qc.splice(s,0,i),s===0&&Vc(i)}};function nl(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function ol(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11&&(i.nodeType!==8||i.nodeValue!==" react-mount-point-unstable "))}function pl(){}function ql(i,e,s,c,h){if(h){if(typeof c=="function"){var $=c;c=function(){var et=gl(_);$.call(et)}}var _=el(e,c,i,0,null,!1,!1,"",pl);return i._reactRootContainer=_,i[uf]=_.current,sf(i.nodeType===8?i.parentNode:i),Rk(),_}for(;h=i.lastChild;)i.removeChild(h);if(typeof c=="function"){var j=c;c=function(){var et=gl(nt);j.call(et)}}var nt=bl(i,0,!1,null,null,!1,!1,"",pl);return i._reactRootContainer=nt,i[uf]=nt.current,sf(i.nodeType===8?i.parentNode:i),Rk(function(){fl(e,nt,s,c)}),nt}function rl(i,e,s,c,h){var $=s._reactRootContainer;if($){var _=$;if(typeof h=="function"){var j=h;h=function(){var nt=gl(_);j.call(nt)}}fl(e,_,i,h)}else _=ql(s,e,i,h,c);return gl(_)}Ec=function(i){switch(i.tag){case 3:var e=i.stateNode;if(e.current.memoizedState.isDehydrated){var s=tc(e.pendingLanes);s!==0&&(Cc(e,s|1),Dk(e,B()),!(K&6)&&(Gj=B()+500,jg()))}break;case 13:Rk(function(){var c=ih(i,1);if(c!==null){var h=R();gi(c,i,1,h)}}),il(i,1)}},Fc=function(i){if(i.tag===13){var e=ih(i,134217728);if(e!==null){var s=R();gi(e,i,134217728,s)}il(i,134217728)}},Gc=function(i){if(i.tag===13){var e=yi(i),s=ih(i,e);if(s!==null){var c=R();gi(s,i,e,c)}il(i,e)}},Hc=function(){return C},Ic=function(i,e){var s=C;try{return C=i,e()}finally{C=s}},yb=function(i,e,s){switch(e){case"input":if(bb(i,s),e=s.name,s.type==="radio"&&e!=null){for(s=i;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<s.length;e++){var c=s[e];if(c!==i&&c.form===i.form){var h=Db(c);if(!h)throw Error(p(90));Wa$1(c),bb(c,h)}}}break;case"textarea":ib(i,s);break;case"select":e=s.value,e!=null&&fb(i,!!s.multiple,e,!1)}},Gb=Qk,Hb=Rk;var sl={usingClientEntryPoint:!1,Events:[Cb,ue,Db,Eb,Fb,Qk]},tl={findFiberByHostInstance:Wc,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},ul={bundleType:tl.bundleType,version:tl.version,rendererPackageName:tl.rendererPackageName,rendererConfig:tl.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:ua$1.ReactCurrentDispatcher,findHostInstanceByFiber:function(i){return i=Zb(i),i===null?null:i.stateNode},findFiberByHostInstance:tl.findFiberByHostInstance||jl,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var vl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!vl.isDisabled&&vl.supportsFiber)try{kc=vl.inject(ul),lc=vl}catch{}}reactDom_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=sl,reactDom_production_min.createPortal=function(i,e){var s=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!nl(e))throw Error(p(200));return cl(i,e,null,s)},reactDom_production_min.createRoot=function(i,e){if(!nl(i))throw Error(p(299));var s=!1,c="",h=kl;return e!=null&&(e.unstable_strictMode===!0&&(s=!0),e.identifierPrefix!==void 0&&(c=e.identifierPrefix),e.onRecoverableError!==void 0&&(h=e.onRecoverableError)),e=bl(i,1,!1,null,null,s,!1,c,h),i[uf]=e.current,sf(i.nodeType===8?i.parentNode:i),new ll(e)},reactDom_production_min.findDOMNode=function(i){if(i==null)return null;if(i.nodeType===1)return i;var e=i._reactInternals;if(e===void 0)throw typeof i.render=="function"?Error(p(188)):(i=Object.keys(i).join(","),Error(p(268,i)));return i=Zb(e),i=i===null?null:i.stateNode,i},reactDom_production_min.flushSync=function(i){return Rk(i)},reactDom_production_min.hydrate=function(i,e,s){if(!ol(e))throw Error(p(200));return rl(null,i,e,!0,s)},reactDom_production_min.hydrateRoot=function(i,e,s){if(!nl(i))throw Error(p(405));var c=s!=null&&s.hydratedSources||null,h=!1,$="",_=kl;if(s!=null&&(s.unstable_strictMode===!0&&(h=!0),s.identifierPrefix!==void 0&&($=s.identifierPrefix),s.onRecoverableError!==void 0&&(_=s.onRecoverableError)),e=el(e,null,i,1,s??null,h,!1,$,_),i[uf]=e.current,sf(i),c)for(i=0;i<c.length;i++)s=c[i],h=s._getVersion,h=h(s._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[s,h]:e.mutableSourceEagerHydrationData.push(s,h);return new ml(e)},reactDom_production_min.render=function(i,e,s){if(!ol(e))throw Error(p(200));return rl(null,i,e,!1,s)},reactDom_production_min.unmountComponentAtNode=function(i){if(!ol(i))throw Error(p(40));return i._reactRootContainer?(Rk(function(){rl(null,null,i,!1,function(){i._reactRootContainer=null,i[uf]=null})}),!0):!1},reactDom_production_min.unstable_batchedUpdates=Qk,reactDom_production_min.unstable_renderSubtreeIntoContainer=function(i,e,s,c){if(!ol(s))throw Error(p(200));if(i==null||i._reactInternals===void 0)throw Error(p(38));return rl(i,e,s,!1,c)},reactDom_production_min.version="18.3.1-next-f1338f8080-20240426";function checkDCE(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE)}catch(i){console.error(i)}}checkDCE(),reactDom.exports=reactDom_production_min;var reactDomExports=reactDom.exports,createRoot,m=reactDomExports;createRoot=m.createRoot,m.hydrateRoot;const LogoIcon=()=>jsxRuntimeExports.jsxs("svg",{viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("path",{d:"M16 4C9.37 4 4 9.37 4 16s5.37 12 12 12 12-5.37 12-12S22.63 4 16 4z",fill:"#2563eb"}),jsxRuntimeExports.jsx("path",{d:"M16 8c-2.2 0-4 1.8-4 4v4c0 2.2 1.8 4 4 4s4-1.8 4-4v-4c0-2.2-1.8-4-4-4z",fill:"white"}),jsxRuntimeExports.jsx("path",{d:"M22 16c0 3.3-2.7 6-6 6s-6-2.7-6-6H8c0 4.1 3.1 7.5 7 7.9V26h2v-2.1c3.9-.4 7-3.8 7-7.9h-2z",fill:"white"})]}),MicIcon=()=>jsxRuntimeExports.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntimeExports.jsx("path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"}),jsxRuntimeExports.jsx("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),jsxRuntimeExports.jsx("line",{x1:"12",x2:"12",y1:"19",y2:"22"})]}),CloseIcon=()=>jsxRuntimeExports.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntimeExports.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntimeExports.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),MinimizeIcon=()=>jsxRuntimeExports.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntimeExports.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsxRuntimeExports.jsx("path",{d:"M9 3v18"})]}),ErrorIcon=()=>jsxRuntimeExports.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntimeExports.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntimeExports.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),jsxRuntimeExports.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),ChatIcon=()=>jsxRuntimeExports.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntimeExports.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})});function FloatingPanel({children:i,position:e,onClose:s,onMinimize:c}){const h=reactExports.useRef(null),$=reactExports.useRef(!1),_=reactExports.useRef({x:0,y:0,right:20,bottom:20}),j=reactExports.useCallback(et=>{if(et.target.closest("button"))return;$.current=!0;const b=h.current;b&&(_.current={x:et.clientX,y:et.clientY,right:parseInt(b.style.right||"20"),bottom:parseInt(b.style.bottom||"20")})},[]);reactExports.useEffect(()=>{const et=a=>{if(!$.current||!h.current)return;const o=_.current.x-a.clientX,d=_.current.y-a.clientY;h.current.style.right=`${_.current.right+o}px`,h.current.style.bottom=`${_.current.bottom+d}px`},b=()=>{$.current=!1};return document.addEventListener("mousemove",et),document.addEventListener("mouseup",b),()=>{document.removeEventListener("mousemove",et),document.removeEventListener("mouseup",b)}},[]);const nt={bottom:(e==null?void 0:e.bottom)??20,right:(e==null?void 0:e.right)??20,...(e==null?void 0:e.top)!==void 0&&{top:e.top,bottom:"auto"},...(e==null?void 0:e.left)!==void 0&&{left:e.left,right:"auto"}};return jsxRuntimeExports.jsxs("div",{ref:h,className:"scribe-panel",style:nt,children:[jsxRuntimeExports.jsxs("div",{className:"panel-header",onMouseDown:j,children:[jsxRuntimeExports.jsxs("div",{className:"drag-handle",children:[jsxRuntimeExports.jsx("span",{}),jsxRuntimeExports.jsx("span",{}),jsxRuntimeExports.jsx("span",{}),jsxRuntimeExports.jsx("span",{}),jsxRuntimeExports.jsx("span",{}),jsxRuntimeExports.jsx("span",{})]}),jsxRuntimeExports.jsxs("div",{className:"header-actions",children:[jsxRuntimeExports.jsx("button",{className:"header-btn",onClick:c,title:"Minimize",children:jsxRuntimeExports.jsx(MinimizeIcon,{})}),jsxRuntimeExports.jsx("button",{className:"header-btn",onClick:s,title:"Close",children:jsxRuntimeExports.jsx(CloseIcon,{})})]})]}),jsxRuntimeExports.jsx("div",{className:"panel-content",children:i})]})}function ConfigState({onSubmit:i,initialAccessToken:e="",initialBaseUrl:s=""}){const[c,h]=reactExports.useState(e),[$,_]=reactExports.useState(s),[j,nt]=reactExports.useState(""),et=b=>{if(b.preventDefault(),!$.trim()){nt("Base URL is required");return}nt(""),i(c.trim(),$.trim())};return jsxRuntimeExports.jsxs("div",{className:"config-state",style:{zIndex:9999},children:[jsxRuntimeExports.jsxs("div",{className:"logo",children:[jsxRuntimeExports.jsx("div",{className:"logo-icon",children:jsxRuntimeExports.jsx(LogoIcon,{})}),jsxRuntimeExports.jsx("span",{className:"logo-text",children:"eka.scribe"})]}),jsxRuntimeExports.jsxs("form",{className:"config-form",onSubmit:et,children:[jsxRuntimeExports.jsxs("div",{className:"form-group",children:[jsxRuntimeExports.jsx("label",{htmlFor:"eka-access-token",children:"Access Token"}),jsxRuntimeExports.jsx("input",{id:"eka-access-token",type:"text",value:c,onChange:b=>h(b.target.value),placeholder:"Enter your access token (optional)"})]}),jsxRuntimeExports.jsxs("div",{className:"form-group",children:[jsxRuntimeExports.jsx("label",{htmlFor:"eka-base-url",children:"Base URL"}),jsxRuntimeExports.jsx("input",{id:"eka-base-url",type:"text",value:$,onChange:b=>_(b.target.value),placeholder:"https://api.eka.care",required:!0})]}),j&&jsxRuntimeExports.jsx("p",{className:"config-error",children:j}),jsxRuntimeExports.jsx("button",{type:"submit",className:"config-submit-btn",children:"Continue"})]})]})}function IdleState({onStartRecording:i}){return jsxRuntimeExports.jsxs("div",{className:"idle-state",children:[jsxRuntimeExports.jsxs("div",{className:"logo",children:[jsxRuntimeExports.jsx("div",{className:"logo-icon",children:jsxRuntimeExports.jsx(LogoIcon,{})}),jsxRuntimeExports.jsx("span",{className:"logo-text",children:"eka.scribe"})]}),jsxRuntimeExports.jsxs("button",{className:"start-btn",onClick:i,children:["Start Recording",jsxRuntimeExports.jsx("span",{className:"mic-icon",children:jsxRuntimeExports.jsx(MicIcon,{})})]})]})}function PermissionState({onRequestPermission:i}){return jsxRuntimeExports.jsxs("div",{className:"permission-state",children:[jsxRuntimeExports.jsx("div",{className:"permission-icon",children:jsxRuntimeExports.jsx(MicIcon,{})}),jsxRuntimeExports.jsxs("p",{className:"permission-text",children:["Microphone access is required to record audio.",jsxRuntimeExports.jsx("br",{}),"Please allow access when prompted."]}),jsxRuntimeExports.jsx("button",{className:"permission-btn",onClick:i,children:"Allow Microphone"})]})}function formatTime(i){const e=Math.floor(i/60),s=i%60;return`${e.toString().padStart(2,"0")}:${s.toString().padStart(2,"0")}`}function RecordingState({elapsedTime:i,isPaused:e,onPause:s,onResume:c,onStop:h}){return jsxRuntimeExports.jsxs("div",{className:"recording-state",children:[jsxRuntimeExports.jsxs("div",{className:"recording-indicator",children:[jsxRuntimeExports.jsx("div",{className:`recording-icon ${e?"":"active"}`,children:jsxRuntimeExports.jsx(ChatIcon,{})}),jsxRuntimeExports.jsx("span",{className:"timer",children:formatTime(i)})]}),jsxRuntimeExports.jsxs("div",{className:"recording-actions",children:[e?jsxRuntimeExports.jsx("button",{className:"resume-btn",onClick:c,children:"Resume"}):jsxRuntimeExports.jsx("button",{className:"pause-btn",onClick:s,children:"Pause"}),jsxRuntimeExports.jsx("button",{className:"stop-btn",onClick:h,title:"Stop recording",children:jsxRuntimeExports.jsx("div",{className:"stop-icon"})})]})]})}function ProcessingState(){return jsxRuntimeExports.jsxs("div",{className:"processing-state",children:[jsxRuntimeExports.jsx("div",{className:"spinner"}),jsxRuntimeExports.jsx("p",{className:"processing-text",children:"Processing your recording..."})]})}function ResultsState({result:i,onNewRecording:e}){return jsxRuntimeExports.jsxs("div",{className:"results-state",children:[jsxRuntimeExports.jsxs("div",{className:"results-header",children:[jsxRuntimeExports.jsx("span",{className:"results-title",children:"Recording Complete"}),jsxRuntimeExports.jsx("button",{className:"new-recording-btn",onClick:e,children:"New Recording"})]}),jsxRuntimeExports.jsx("div",{className:"results-content",children:jsxRuntimeExports.jsxs("div",{className:"transcript-section",children:[jsxRuntimeExports.jsx("div",{className:"section-title",children:"Transcript"}),jsxRuntimeExports.jsx("div",{className:"transcript-text",children:i.transcript||"No transcript available."})]})})]})}function ErrorState({message:i,onRetry:e}){return jsxRuntimeExports.jsxs("div",{className:"error-state",children:[jsxRuntimeExports.jsx("div",{className:"error-icon",children:jsxRuntimeExports.jsx(ErrorIcon,{})}),jsxRuntimeExports.jsx("p",{className:"error-message",children:i}),jsxRuntimeExports.jsx("button",{className:"retry-btn",onClick:e,children:"Try Again"})]})}function PollingErrorState({message:i,onRetry:e,onStartNew:s}){return jsxRuntimeExports.jsxs("div",{className:"polling-error-state",children:[jsxRuntimeExports.jsx("div",{className:"error-icon",children:jsxRuntimeExports.jsx(ErrorIcon,{})}),jsxRuntimeExports.jsx("p",{className:"error-message",children:i}),jsxRuntimeExports.jsxs("div",{className:"polling-error-actions",children:[jsxRuntimeExports.jsx("button",{className:"retry-polling-btn",onClick:e,children:"Retry Fetching Results"}),jsxRuntimeExports.jsx("button",{className:"start-new-btn",onClick:s,children:"Start New Recording"})]})]})}const WELL_KNOWN_PATH="/.well-known/medscribealliance";var SessionStatus;(function(i){i.CREATED="created",i.PROCESSING="processing",i.COMPLETED="completed",i.PARTIAL="partial",i.FAILED="failed"})(SessionStatus||(SessionStatus={}));var TemplateStatus;(function(i){i.SUCCESS="success",i.FAILED="failed"})(TemplateStatus||(TemplateStatus={}));var UploadType;(function(i){i.CHUNKED="chunked",i.SINGLE="single"})(UploadType||(UploadType={}));var ErrorCode;(function(i){i.AUTHENTICATION_FAILED="authentication_failed",i.TOKEN_EXPIRED="token_expired",i.INVALID_API_KEY="invalid_api_key",i.FORBIDDEN="forbidden",i.RATE_LIMIT_EXCEEDED="rate_limit_exceeded",i.SESSION_NOT_FOUND="session_not_found",i.TEMPLATE_NOT_FOUND="template_not_found",i.WEBHOOK_NOT_FOUND="webhook_not_found",i.SESSION_EXPIRED="session_expired",i.INVALID_REQUEST="invalid_request",i.INVALID_AUDIO_FORMAT="invalid_audio_format",i.CHUNK_TOO_LARGE="chunk_too_large",i.INVALID_TEMPLATE="invalid_template",i.MISSING_REQUIRED_FIELD="missing_required_field",i.PROCESSING_FAILED="processing_failed",i.AUDIO_QUALITY_POOR="audio_quality_poor",i.AUDIO_TOO_SHORT="audio_too_short",i.LANGUAGE_UNSUPPORTED="language_unsupported",i.INTERNAL_ERROR="internal_error",i.SERVICE_UNAVAILABLE="service_unavailable"})(ErrorCode||(ErrorCode={}));var HttpStatus;(function(i){i[i.OK=200]="OK",i[i.CREATED=201]="CREATED",i[i.ACCEPTED=202]="ACCEPTED",i[i.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",i[i.BAD_REQUEST=400]="BAD_REQUEST",i[i.UNAUTHORIZED=401]="UNAUTHORIZED",i[i.FORBIDDEN=403]="FORBIDDEN",i[i.NOT_FOUND=404]="NOT_FOUND",i[i.GONE=410]="GONE",i[i.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",i[i.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",i[i.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",i[i.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE"})(HttpStatus||(HttpStatus={}));class DiscoveryAPI{constructor(e){this.cachedDiscovery=null,this.cacheTimestamp=0,this.cacheDuration=3600*1e3,this.httpClient=e}async getDiscovery(e,s=!1){const c=Date.now();if(!s&&this.cachedDiscovery&&c-this.cacheTimestamp<this.cacheDuration)return this.cachedDiscovery;const h=e+WELL_KNOWN_PATH,$=await this.httpClient.get(h);return this.cachedDiscovery=$,this.cacheTimestamp=c,$}clearCache(){this.cachedDiscovery=null,this.cacheTimestamp=0}getCachedDiscovery(){const e=Date.now();return this.cachedDiscovery&&e-this.cacheTimestamp<this.cacheDuration?this.cachedDiscovery:null}}var ajv={exports:{}},core$2={},validate={},boolSchema={},errors={},codegen={},code$1={};(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.regexpCode=i.getEsmExportName=i.getProperty=i.safeStringify=i.stringify=i.strConcat=i.addCodeArg=i.str=i._=i.nil=i._Code=i.Name=i.IDENTIFIER=i._CodeOrName=void 0;class e{}i._CodeOrName=e,i.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class s extends e{constructor(ot){if(super(),!i.IDENTIFIER.test(ot))throw new Error("CodeGen: name must be a valid identifier");this.str=ot}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}i.Name=s;class c extends e{constructor(ot){super(),this._items=typeof ot=="string"?[ot]:ot}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const ot=this._items[0];return ot===""||ot==='""'}get str(){var ot;return(ot=this._str)!==null&&ot!==void 0?ot:this._str=this._items.reduce((rt,at)=>`${rt}${at}`,"")}get names(){var ot;return(ot=this._names)!==null&&ot!==void 0?ot:this._names=this._items.reduce((rt,at)=>(at instanceof s&&(rt[at.str]=(rt[at.str]||0)+1),rt),{})}}i._Code=c,i.nil=new c("");function h(tt,...ot){const rt=[tt[0]];let at=0;for(;at<ot.length;)j(rt,ot[at]),rt.push(tt[++at]);return new c(rt)}i._=h;const $=new c("+");function _(tt,...ot){const rt=[d(tt[0])];let at=0;for(;at<ot.length;)rt.push($),j(rt,ot[at]),rt.push($,d(tt[++at]));return nt(rt),new c(rt)}i.str=_;function j(tt,ot){ot instanceof c?tt.push(...ot._items):ot instanceof s?tt.push(ot):tt.push(a(ot))}i.addCodeArg=j;function nt(tt){let ot=1;for(;ot<tt.length-1;){if(tt[ot]===$){const rt=et(tt[ot-1],tt[ot+1]);if(rt!==void 0){tt.splice(ot-1,3,rt);continue}tt[ot++]="+"}ot++}}function et(tt,ot){if(ot==='""')return tt;if(tt==='""')return ot;if(typeof tt=="string")return ot instanceof s||tt[tt.length-1]!=='"'?void 0:typeof ot!="string"?`${tt.slice(0,-1)}${ot}"`:ot[0]==='"'?tt.slice(0,-1)+ot.slice(1):void 0;if(typeof ot=="string"&&ot[0]==='"'&&!(tt instanceof s))return`"${tt}${ot.slice(1)}`}function b(tt,ot){return ot.emptyStr()?tt:tt.emptyStr()?ot:_`${tt}${ot}`}i.strConcat=b;function a(tt){return typeof tt=="number"||typeof tt=="boolean"||tt===null?tt:d(Array.isArray(tt)?tt.join(","):tt)}function o(tt){return new c(d(tt))}i.stringify=o;function d(tt){return JSON.stringify(tt).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}i.safeStringify=d;function g(tt){return typeof tt=="string"&&i.IDENTIFIER.test(tt)?new c(`.${tt}`):h`[${tt}]`}i.getProperty=g;function it(tt){if(typeof tt=="string"&&i.IDENTIFIER.test(tt))return new c(`${tt}`);throw new Error(`CodeGen: invalid export name: ${tt}, use explicit $id name mapping`)}i.getEsmExportName=it;function st(tt){return new c(tt.toString())}i.regexpCode=st})(code$1);var scope={};(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.ValueScope=i.ValueScopeName=i.Scope=i.varKinds=i.UsedValueState=void 0;const e=code$1;class s extends Error{constructor(et){super(`CodeGen: "code" for ${et} not defined`),this.value=et.value}}var c;(function(nt){nt[nt.Started=0]="Started",nt[nt.Completed=1]="Completed"})(c||(i.UsedValueState=c={})),i.varKinds={const:new e.Name("const"),let:new e.Name("let"),var:new e.Name("var")};class h{constructor({prefixes:et,parent:b}={}){this._names={},this._prefixes=et,this._parent=b}toName(et){return et instanceof e.Name?et:this.name(et)}name(et){return new e.Name(this._newName(et))}_newName(et){const b=this._names[et]||this._nameGroup(et);return`${et}${b.index++}`}_nameGroup(et){var b,a;if(!((a=(b=this._parent)===null||b===void 0?void 0:b._prefixes)===null||a===void 0)&&a.has(et)||this._prefixes&&!this._prefixes.has(et))throw new Error(`CodeGen: prefix "${et}" is not allowed in this scope`);return this._names[et]={prefix:et,index:0}}}i.Scope=h;class $ extends e.Name{constructor(et,b){super(b),this.prefix=et}setValue(et,{property:b,itemIndex:a}){this.value=et,this.scopePath=(0,e._)`.${new e.Name(b)}[${a}]`}}i.ValueScopeName=$;const _=(0,e._)`\n`;class j extends h{constructor(et){super(et),this._values={},this._scope=et.scope,this.opts={...et,_n:et.lines?_:e.nil}}get(){return this._scope}name(et){return new $(et,this._newName(et))}value(et,b){var a;if(b.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const o=this.toName(et),{prefix:d}=o,g=(a=b.key)!==null&&a!==void 0?a:b.ref;let it=this._values[d];if(it){const ot=it.get(g);if(ot)return ot}else it=this._values[d]=new Map;it.set(g,o);const st=this._scope[d]||(this._scope[d]=[]),tt=st.length;return st[tt]=b.ref,o.setValue(b,{property:d,itemIndex:tt}),o}getValue(et,b){const a=this._values[et];if(a)return a.get(b)}scopeRefs(et,b=this._values){return this._reduceValues(b,a=>{if(a.scopePath===void 0)throw new Error(`CodeGen: name "${a}" has no value`);return(0,e._)`${et}${a.scopePath}`})}scopeCode(et=this._values,b,a){return this._reduceValues(et,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},b,a)}_reduceValues(et,b,a={},o){let d=e.nil;for(const g in et){const it=et[g];if(!it)continue;const st=a[g]=a[g]||new Map;it.forEach(tt=>{if(st.has(tt))return;st.set(tt,c.Started);let ot=b(tt);if(ot){const rt=this.opts.es5?i.varKinds.var:i.varKinds.const;d=(0,e._)`${d}${rt} ${tt} = ${ot};${this.opts._n}`}else if(ot=o==null?void 0:o(tt))d=(0,e._)`${d}${ot}${this.opts._n}`;else throw new s(tt);st.set(tt,c.Completed)})}return d}}i.ValueScope=j})(scope),function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.or=i.and=i.not=i.CodeGen=i.operators=i.varKinds=i.ValueScopeName=i.ValueScope=i.Scope=i.Name=i.regexpCode=i.stringify=i.getProperty=i.nil=i.strConcat=i.str=i._=void 0;const e=code$1,s=scope;var c=code$1;Object.defineProperty(i,"_",{enumerable:!0,get:function(){return c._}}),Object.defineProperty(i,"str",{enumerable:!0,get:function(){return c.str}}),Object.defineProperty(i,"strConcat",{enumerable:!0,get:function(){return c.strConcat}}),Object.defineProperty(i,"nil",{enumerable:!0,get:function(){return c.nil}}),Object.defineProperty(i,"getProperty",{enumerable:!0,get:function(){return c.getProperty}}),Object.defineProperty(i,"stringify",{enumerable:!0,get:function(){return c.stringify}}),Object.defineProperty(i,"regexpCode",{enumerable:!0,get:function(){return c.regexpCode}}),Object.defineProperty(i,"Name",{enumerable:!0,get:function(){return c.Name}});var h=scope;Object.defineProperty(i,"Scope",{enumerable:!0,get:function(){return h.Scope}}),Object.defineProperty(i,"ValueScope",{enumerable:!0,get:function(){return h.ValueScope}}),Object.defineProperty(i,"ValueScopeName",{enumerable:!0,get:function(){return h.ValueScopeName}}),Object.defineProperty(i,"varKinds",{enumerable:!0,get:function(){return h.varKinds}}),i.operators={GT:new e._Code(">"),GTE:new e._Code(">="),LT:new e._Code("<"),LTE:new e._Code("<="),EQ:new e._Code("==="),NEQ:new e._Code("!=="),NOT:new e._Code("!"),OR:new e._Code("||"),AND:new e._Code("&&"),ADD:new e._Code("+")};class ${optimizeNodes(){return this}optimizeNames(pt,yt){return this}}class _ extends ${constructor(pt,yt,Ct){super(),this.varKind=pt,this.name=yt,this.rhs=Ct}render({es5:pt,_n:yt}){const Ct=pt?s.varKinds.var:this.varKind,Ut=this.rhs===void 0?"":` = ${this.rhs}`;return`${Ct} ${this.name}${Ut};`+yt}optimizeNames(pt,yt){if(pt[this.name.str])return this.rhs&&(this.rhs=vt(this.rhs,pt,yt)),this}get names(){return this.rhs instanceof e._CodeOrName?this.rhs.names:{}}}class j extends ${constructor(pt,yt,Ct){super(),this.lhs=pt,this.rhs=yt,this.sideEffects=Ct}render({_n:pt}){return`${this.lhs} = ${this.rhs};`+pt}optimizeNames(pt,yt){if(!(this.lhs instanceof e.Name&&!pt[this.lhs.str]&&!this.sideEffects))return this.rhs=vt(this.rhs,pt,yt),this}get names(){const pt=this.lhs instanceof e.Name?{}:{...this.lhs.names};return Tt(pt,this.rhs)}}class nt extends j{constructor(pt,yt,Ct,Ut){super(pt,Ct,Ut),this.op=yt}render({_n:pt}){return`${this.lhs} ${this.op}= ${this.rhs};`+pt}}class et extends ${constructor(pt){super(),this.label=pt,this.names={}}render({_n:pt}){return`${this.label}:`+pt}}class b extends ${constructor(pt){super(),this.label=pt,this.names={}}render({_n:pt}){return`break${this.label?` ${this.label}`:""};`+pt}}class a extends ${constructor(pt){super(),this.error=pt}render({_n:pt}){return`throw ${this.error};`+pt}get names(){return this.error.names}}class o extends ${constructor(pt){super(),this.code=pt}render({_n:pt}){return`${this.code};`+pt}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(pt,yt){return this.code=vt(this.code,pt,yt),this}get names(){return this.code instanceof e._CodeOrName?this.code.names:{}}}class d extends ${constructor(pt=[]){super(),this.nodes=pt}render(pt){return this.nodes.reduce((yt,Ct)=>yt+Ct.render(pt),"")}optimizeNodes(){const{nodes:pt}=this;let yt=pt.length;for(;yt--;){const Ct=pt[yt].optimizeNodes();Array.isArray(Ct)?pt.splice(yt,1,...Ct):Ct?pt[yt]=Ct:pt.splice(yt,1)}return pt.length>0?this:void 0}optimizeNames(pt,yt){const{nodes:Ct}=this;let Ut=Ct.length;for(;Ut--;){const Nt=Ct[Ut];Nt.optimizeNames(pt,yt)||($t(pt,Nt.names),Ct.splice(Ut,1))}return Ct.length>0?this:void 0}get names(){return this.nodes.reduce((pt,yt)=>bt(pt,yt.names),{})}}class g extends d{render(pt){return"{"+pt._n+super.render(pt)+"}"+pt._n}}class it extends d{}class st extends g{}st.kind="else";class tt extends g{constructor(pt,yt){super(yt),this.condition=pt}render(pt){let yt=`if(${this.condition})`+super.render(pt);return this.else&&(yt+="else "+this.else.render(pt)),yt}optimizeNodes(){super.optimizeNodes();const pt=this.condition;if(pt===!0)return this.nodes;let yt=this.else;if(yt){const Ct=yt.optimizeNodes();yt=this.else=Array.isArray(Ct)?new st(Ct):Ct}if(yt)return pt===!1?yt instanceof tt?yt:yt.nodes:this.nodes.length?this:new tt(At(pt),yt instanceof tt?[yt]:yt.nodes);if(!(pt===!1||!this.nodes.length))return this}optimizeNames(pt,yt){var Ct;if(this.else=(Ct=this.else)===null||Ct===void 0?void 0:Ct.optimizeNames(pt,yt),!!(super.optimizeNames(pt,yt)||this.else))return this.condition=vt(this.condition,pt,yt),this}get names(){const pt=super.names;return Tt(pt,this.condition),this.else&&bt(pt,this.else.names),pt}}tt.kind="if";class ot extends g{}ot.kind="for";class rt extends ot{constructor(pt){super(),this.iteration=pt}render(pt){return`for(${this.iteration})`+super.render(pt)}optimizeNames(pt,yt){if(super.optimizeNames(pt,yt))return this.iteration=vt(this.iteration,pt,yt),this}get names(){return bt(super.names,this.iteration.names)}}class at extends ot{constructor(pt,yt,Ct,Ut){super(),this.varKind=pt,this.name=yt,this.from=Ct,this.to=Ut}render(pt){const yt=pt.es5?s.varKinds.var:this.varKind,{name:Ct,from:Ut,to:Nt}=this;return`for(${yt} ${Ct}=${Ut}; ${Ct}<${Nt}; ${Ct}++)`+super.render(pt)}get names(){const pt=Tt(super.names,this.from);return Tt(pt,this.to)}}class ut extends ot{constructor(pt,yt,Ct,Ut){super(),this.loop=pt,this.varKind=yt,this.name=Ct,this.iterable=Ut}render(pt){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(pt)}optimizeNames(pt,yt){if(super.optimizeNames(pt,yt))return this.iterable=vt(this.iterable,pt,yt),this}get names(){return bt(super.names,this.iterable.names)}}class lt extends g{constructor(pt,yt,Ct){super(),this.name=pt,this.args=yt,this.async=Ct}render(pt){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(pt)}}lt.kind="func";class ct extends d{render(pt){return"return "+super.render(pt)}}ct.kind="return";class ft extends g{render(pt){let yt="try"+super.render(pt);return this.catch&&(yt+=this.catch.render(pt)),this.finally&&(yt+=this.finally.render(pt)),yt}optimizeNodes(){var pt,yt;return super.optimizeNodes(),(pt=this.catch)===null||pt===void 0||pt.optimizeNodes(),(yt=this.finally)===null||yt===void 0||yt.optimizeNodes(),this}optimizeNames(pt,yt){var Ct,Ut;return super.optimizeNames(pt,yt),(Ct=this.catch)===null||Ct===void 0||Ct.optimizeNames(pt,yt),(Ut=this.finally)===null||Ut===void 0||Ut.optimizeNames(pt,yt),this}get names(){const pt=super.names;return this.catch&&bt(pt,this.catch.names),this.finally&&bt(pt,this.finally.names),pt}}class dt extends g{constructor(pt){super(),this.error=pt}render(pt){return`catch(${this.error})`+super.render(pt)}}dt.kind="catch";class _t extends g{render(pt){return"finally"+super.render(pt)}}_t.kind="finally";class wt{constructor(pt,yt={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...yt,_n:yt.lines?`
40
+ `+$.stack}return{value:i,source:e,stack:h,digest:null}}function Ki(i,e,s){return{value:i,source:null,stack:s??null,digest:e??null}}function Li(i,e){try{console.error(e.value)}catch(s){setTimeout(function(){throw s})}}var Mi=typeof WeakMap=="function"?WeakMap:Map;function Ni(i,e,s){s=mh(-1,s),s.tag=3,s.payload={element:null};var c=e.value;return s.callback=function(){Oi||(Oi=!0,Pi=c),Li(i,e)},s}function Qi(i,e,s){s=mh(-1,s),s.tag=3;var c=i.type.getDerivedStateFromError;if(typeof c=="function"){var h=e.value;s.payload=function(){return c(h)},s.callback=function(){Li(i,e)}}var $=i.stateNode;return $!==null&&typeof $.componentDidCatch=="function"&&(s.callback=function(){Li(i,e),typeof c!="function"&&(Ri===null?Ri=new Set([this]):Ri.add(this));var _=e.stack;this.componentDidCatch(e.value,{componentStack:_!==null?_:""})}),s}function Si(i,e,s){var c=i.pingCache;if(c===null){c=i.pingCache=new Mi;var h=new Set;c.set(e,h)}else h=c.get(e),h===void 0&&(h=new Set,c.set(e,h));h.has(s)||(h.add(s),i=Ti.bind(null,i,e,s),e.then(i,i))}function Ui(i){do{var e;if((e=i.tag===13)&&(e=i.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return i;i=i.return}while(i!==null);return null}function Vi(i,e,s,c,h){return i.mode&1?(i.flags|=65536,i.lanes=h,i):(i===e?i.flags|=65536:(i.flags|=128,s.flags|=131072,s.flags&=-52805,s.tag===1&&(s.alternate===null?s.tag=17:(e=mh(-1,1),e.tag=2,nh(s,e,1))),s.lanes|=1),i)}var Wi=ua$1.ReactCurrentOwner,dh=!1;function Xi(i,e,s,c){e.child=i===null?Vg(e,null,s,c):Ug(e,i.child,s,c)}function Yi(i,e,s,c,h){s=s.render;var $=e.ref;return ch(e,h),c=Nh(i,e,s,c,$,h),s=Sh(),i!==null&&!dh?(e.updateQueue=i.updateQueue,e.flags&=-2053,i.lanes&=~h,Zi(i,e,h)):(I&&s&&vg(e),e.flags|=1,Xi(i,e,c,h),e.child)}function $i(i,e,s,c,h){if(i===null){var $=s.type;return typeof $=="function"&&!aj($)&&$.defaultProps===void 0&&s.compare===null&&s.defaultProps===void 0?(e.tag=15,e.type=$,bj(i,e,$,c,h)):(i=Rg(s.type,null,c,e,e.mode,h),i.ref=e.ref,i.return=e,e.child=i)}if($=i.child,!(i.lanes&h)){var _=$.memoizedProps;if(s=s.compare,s=s!==null?s:Ie$1,s(_,c)&&i.ref===e.ref)return Zi(i,e,h)}return e.flags|=1,i=Pg($,c),i.ref=e.ref,i.return=e,e.child=i}function bj(i,e,s,c,h){if(i!==null){var $=i.memoizedProps;if(Ie$1($,c)&&i.ref===e.ref)if(dh=!1,e.pendingProps=c=$,(i.lanes&h)!==0)i.flags&131072&&(dh=!0);else return e.lanes=i.lanes,Zi(i,e,h)}return cj(i,e,s,c,h)}function dj(i,e,s){var c=e.pendingProps,h=c.children,$=i!==null?i.memoizedState:null;if(c.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},G(ej,fj),fj|=s;else{if(!(s&1073741824))return i=$!==null?$.baseLanes|s:s,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:i,cachePool:null,transitions:null},e.updateQueue=null,G(ej,fj),fj|=i,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},c=$!==null?$.baseLanes:s,G(ej,fj),fj|=c}else $!==null?(c=$.baseLanes|s,e.memoizedState=null):c=s,G(ej,fj),fj|=c;return Xi(i,e,h,s),e.child}function gj(i,e){var s=e.ref;(i===null&&s!==null||i!==null&&i.ref!==s)&&(e.flags|=512,e.flags|=2097152)}function cj(i,e,s,c,h){var $=Zf(s)?Xf:H.current;return $=Yf(e,$),ch(e,h),s=Nh(i,e,s,c,$,h),c=Sh(),i!==null&&!dh?(e.updateQueue=i.updateQueue,e.flags&=-2053,i.lanes&=~h,Zi(i,e,h)):(I&&c&&vg(e),e.flags|=1,Xi(i,e,s,h),e.child)}function hj(i,e,s,c,h){if(Zf(s)){var $=!0;cg(e)}else $=!1;if(ch(e,h),e.stateNode===null)ij(i,e),Gi(e,s,c),Ii(e,s,c,h),c=!0;else if(i===null){var _=e.stateNode,j=e.memoizedProps;_.props=j;var nt=_.context,et=s.contextType;typeof et=="object"&&et!==null?et=eh(et):(et=Zf(s)?Xf:H.current,et=Yf(e,et));var b=s.getDerivedStateFromProps,a=typeof b=="function"||typeof _.getSnapshotBeforeUpdate=="function";a||typeof _.UNSAFE_componentWillReceiveProps!="function"&&typeof _.componentWillReceiveProps!="function"||(j!==c||nt!==et)&&Hi(e,_,c,et),jh=!1;var o=e.memoizedState;_.state=o,qh(e,c,_,h),nt=e.memoizedState,j!==c||o!==nt||Wf.current||jh?(typeof b=="function"&&(Di(e,s,b,c),nt=e.memoizedState),(j=jh||Fi(e,s,j,c,o,nt,et))?(a||typeof _.UNSAFE_componentWillMount!="function"&&typeof _.componentWillMount!="function"||(typeof _.componentWillMount=="function"&&_.componentWillMount(),typeof _.UNSAFE_componentWillMount=="function"&&_.UNSAFE_componentWillMount()),typeof _.componentDidMount=="function"&&(e.flags|=4194308)):(typeof _.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=c,e.memoizedState=nt),_.props=c,_.state=nt,_.context=et,c=j):(typeof _.componentDidMount=="function"&&(e.flags|=4194308),c=!1)}else{_=e.stateNode,lh(i,e),j=e.memoizedProps,et=e.type===e.elementType?j:Ci(e.type,j),_.props=et,a=e.pendingProps,o=_.context,nt=s.contextType,typeof nt=="object"&&nt!==null?nt=eh(nt):(nt=Zf(s)?Xf:H.current,nt=Yf(e,nt));var d=s.getDerivedStateFromProps;(b=typeof d=="function"||typeof _.getSnapshotBeforeUpdate=="function")||typeof _.UNSAFE_componentWillReceiveProps!="function"&&typeof _.componentWillReceiveProps!="function"||(j!==a||o!==nt)&&Hi(e,_,c,nt),jh=!1,o=e.memoizedState,_.state=o,qh(e,c,_,h);var g=e.memoizedState;j!==a||o!==g||Wf.current||jh?(typeof d=="function"&&(Di(e,s,d,c),g=e.memoizedState),(et=jh||Fi(e,s,et,c,o,g,nt)||!1)?(b||typeof _.UNSAFE_componentWillUpdate!="function"&&typeof _.componentWillUpdate!="function"||(typeof _.componentWillUpdate=="function"&&_.componentWillUpdate(c,g,nt),typeof _.UNSAFE_componentWillUpdate=="function"&&_.UNSAFE_componentWillUpdate(c,g,nt)),typeof _.componentDidUpdate=="function"&&(e.flags|=4),typeof _.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof _.componentDidUpdate!="function"||j===i.memoizedProps&&o===i.memoizedState||(e.flags|=4),typeof _.getSnapshotBeforeUpdate!="function"||j===i.memoizedProps&&o===i.memoizedState||(e.flags|=1024),e.memoizedProps=c,e.memoizedState=g),_.props=c,_.state=g,_.context=nt,c=et):(typeof _.componentDidUpdate!="function"||j===i.memoizedProps&&o===i.memoizedState||(e.flags|=4),typeof _.getSnapshotBeforeUpdate!="function"||j===i.memoizedProps&&o===i.memoizedState||(e.flags|=1024),c=!1)}return jj(i,e,s,c,$,h)}function jj(i,e,s,c,h,$){gj(i,e);var _=(e.flags&128)!==0;if(!c&&!_)return h&&dg(e,s,!1),Zi(i,e,$);c=e.stateNode,Wi.current=e;var j=_&&typeof s.getDerivedStateFromError!="function"?null:c.render();return e.flags|=1,i!==null&&_?(e.child=Ug(e,i.child,null,$),e.child=Ug(e,null,j,$)):Xi(i,e,j,$),e.memoizedState=c.state,h&&dg(e,s,!0),e.child}function kj(i){var e=i.stateNode;e.pendingContext?ag(i,e.pendingContext,e.pendingContext!==e.context):e.context&&ag(i,e.context,!1),yh(i,e.containerInfo)}function lj(i,e,s,c,h){return Ig(),Jg(h),e.flags|=256,Xi(i,e,s,c),e.child}var mj={dehydrated:null,treeContext:null,retryLane:0};function nj(i){return{baseLanes:i,cachePool:null,transitions:null}}function oj(i,e,s){var c=e.pendingProps,h=L.current,$=!1,_=(e.flags&128)!==0,j;if((j=_)||(j=i!==null&&i.memoizedState===null?!1:(h&2)!==0),j?($=!0,e.flags&=-129):(i===null||i.memoizedState!==null)&&(h|=1),G(L,h&1),i===null)return Eg(e),i=e.memoizedState,i!==null&&(i=i.dehydrated,i!==null)?(e.mode&1?i.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(_=c.children,i=c.fallback,$?(c=e.mode,$=e.child,_={mode:"hidden",children:_},!(c&1)&&$!==null?($.childLanes=0,$.pendingProps=_):$=pj(_,c,0,null),i=Tg(i,c,s,null),$.return=e,i.return=e,$.sibling=i,e.child=$,e.child.memoizedState=nj(s),e.memoizedState=mj,i):qj(e,_));if(h=i.memoizedState,h!==null&&(j=h.dehydrated,j!==null))return rj(i,e,_,c,j,h,s);if($){$=c.fallback,_=e.mode,h=i.child,j=h.sibling;var nt={mode:"hidden",children:c.children};return!(_&1)&&e.child!==h?(c=e.child,c.childLanes=0,c.pendingProps=nt,e.deletions=null):(c=Pg(h,nt),c.subtreeFlags=h.subtreeFlags&14680064),j!==null?$=Pg(j,$):($=Tg($,_,s,null),$.flags|=2),$.return=e,c.return=e,c.sibling=$,e.child=c,c=$,$=e.child,_=i.child.memoizedState,_=_===null?nj(s):{baseLanes:_.baseLanes|s,cachePool:null,transitions:_.transitions},$.memoizedState=_,$.childLanes=i.childLanes&~s,e.memoizedState=mj,c}return $=i.child,i=$.sibling,c=Pg($,{mode:"visible",children:c.children}),!(e.mode&1)&&(c.lanes=s),c.return=e,c.sibling=null,i!==null&&(s=e.deletions,s===null?(e.deletions=[i],e.flags|=16):s.push(i)),e.child=c,e.memoizedState=null,c}function qj(i,e){return e=pj({mode:"visible",children:e},i.mode,0,null),e.return=i,i.child=e}function sj(i,e,s,c){return c!==null&&Jg(c),Ug(e,i.child,null,s),i=qj(e,e.pendingProps.children),i.flags|=2,e.memoizedState=null,i}function rj(i,e,s,c,h,$,_){if(s)return e.flags&256?(e.flags&=-257,c=Ki(Error(p(422))),sj(i,e,_,c)):e.memoizedState!==null?(e.child=i.child,e.flags|=128,null):($=c.fallback,h=e.mode,c=pj({mode:"visible",children:c.children},h,0,null),$=Tg($,h,_,null),$.flags|=2,c.return=e,$.return=e,c.sibling=$,e.child=c,e.mode&1&&Ug(e,i.child,null,_),e.child.memoizedState=nj(_),e.memoizedState=mj,$);if(!(e.mode&1))return sj(i,e,_,null);if(h.data==="$!"){if(c=h.nextSibling&&h.nextSibling.dataset,c)var j=c.dgst;return c=j,$=Error(p(419)),c=Ki($,c,void 0),sj(i,e,_,c)}if(j=(_&i.childLanes)!==0,dh||j){if(c=Q,c!==null){switch(_&-_){case 4:h=2;break;case 16:h=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:h=32;break;case 536870912:h=268435456;break;default:h=0}h=h&(c.suspendedLanes|_)?0:h,h!==0&&h!==$.retryLane&&($.retryLane=h,ih(i,h),gi(c,i,h,-1))}return tj(),c=Ki(Error(p(421))),sj(i,e,_,c)}return h.data==="$?"?(e.flags|=128,e.child=i.child,e=uj.bind(null,i),h._reactRetry=e,null):(i=$.treeContext,yg=Lf(h.nextSibling),xg=e,I=!0,zg=null,i!==null&&(og[pg++]=rg,og[pg++]=sg,og[pg++]=qg,rg=i.id,sg=i.overflow,qg=e),e=qj(e,c.children),e.flags|=4096,e)}function vj(i,e,s){i.lanes|=e;var c=i.alternate;c!==null&&(c.lanes|=e),bh(i.return,e,s)}function wj(i,e,s,c,h){var $=i.memoizedState;$===null?i.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:c,tail:s,tailMode:h}:($.isBackwards=e,$.rendering=null,$.renderingStartTime=0,$.last=c,$.tail=s,$.tailMode=h)}function xj(i,e,s){var c=e.pendingProps,h=c.revealOrder,$=c.tail;if(Xi(i,e,c.children,s),c=L.current,c&2)c=c&1|2,e.flags|=128;else{if(i!==null&&i.flags&128)e:for(i=e.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&vj(i,s,e);else if(i.tag===19)vj(i,s,e);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===e)break e;for(;i.sibling===null;){if(i.return===null||i.return===e)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}c&=1}if(G(L,c),!(e.mode&1))e.memoizedState=null;else switch(h){case"forwards":for(s=e.child,h=null;s!==null;)i=s.alternate,i!==null&&Ch(i)===null&&(h=s),s=s.sibling;s=h,s===null?(h=e.child,e.child=null):(h=s.sibling,s.sibling=null),wj(e,!1,h,s,$);break;case"backwards":for(s=null,h=e.child,e.child=null;h!==null;){if(i=h.alternate,i!==null&&Ch(i)===null){e.child=h;break}i=h.sibling,h.sibling=s,s=h,h=i}wj(e,!0,s,null,$);break;case"together":wj(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function ij(i,e){!(e.mode&1)&&i!==null&&(i.alternate=null,e.alternate=null,e.flags|=2)}function Zi(i,e,s){if(i!==null&&(e.dependencies=i.dependencies),rh|=e.lanes,!(s&e.childLanes))return null;if(i!==null&&e.child!==i.child)throw Error(p(153));if(e.child!==null){for(i=e.child,s=Pg(i,i.pendingProps),e.child=s,s.return=e;i.sibling!==null;)i=i.sibling,s=s.sibling=Pg(i,i.pendingProps),s.return=e;s.sibling=null}return e.child}function yj(i,e,s){switch(e.tag){case 3:kj(e),Ig();break;case 5:Ah(e);break;case 1:Zf(e.type)&&cg(e);break;case 4:yh(e,e.stateNode.containerInfo);break;case 10:var c=e.type._context,h=e.memoizedProps.value;G(Wg,c._currentValue),c._currentValue=h;break;case 13:if(c=e.memoizedState,c!==null)return c.dehydrated!==null?(G(L,L.current&1),e.flags|=128,null):s&e.child.childLanes?oj(i,e,s):(G(L,L.current&1),i=Zi(i,e,s),i!==null?i.sibling:null);G(L,L.current&1);break;case 19:if(c=(s&e.childLanes)!==0,i.flags&128){if(c)return xj(i,e,s);e.flags|=128}if(h=e.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),G(L,L.current),c)break;return null;case 22:case 23:return e.lanes=0,dj(i,e,s)}return Zi(i,e,s)}var zj,Aj,Bj,Cj;zj=function(i,e){for(var s=e.child;s!==null;){if(s.tag===5||s.tag===6)i.appendChild(s.stateNode);else if(s.tag!==4&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===e)break;for(;s.sibling===null;){if(s.return===null||s.return===e)return;s=s.return}s.sibling.return=s.return,s=s.sibling}},Aj=function(){},Bj=function(i,e,s,c){var h=i.memoizedProps;if(h!==c){i=e.stateNode,xh(uh.current);var $=null;switch(s){case"input":h=Ya$1(i,h),c=Ya$1(i,c),$=[];break;case"select":h=A({},h,{value:void 0}),c=A({},c,{value:void 0}),$=[];break;case"textarea":h=gb(i,h),c=gb(i,c),$=[];break;default:typeof h.onClick!="function"&&typeof c.onClick=="function"&&(i.onclick=Bf)}ub(s,c);var _;s=null;for(et in h)if(!c.hasOwnProperty(et)&&h.hasOwnProperty(et)&&h[et]!=null)if(et==="style"){var j=h[et];for(_ in j)j.hasOwnProperty(_)&&(s||(s={}),s[_]="")}else et!=="dangerouslySetInnerHTML"&&et!=="children"&&et!=="suppressContentEditableWarning"&&et!=="suppressHydrationWarning"&&et!=="autoFocus"&&(ea$1.hasOwnProperty(et)?$||($=[]):($=$||[]).push(et,null));for(et in c){var nt=c[et];if(j=h!=null?h[et]:void 0,c.hasOwnProperty(et)&&nt!==j&&(nt!=null||j!=null))if(et==="style")if(j){for(_ in j)!j.hasOwnProperty(_)||nt&&nt.hasOwnProperty(_)||(s||(s={}),s[_]="");for(_ in nt)nt.hasOwnProperty(_)&&j[_]!==nt[_]&&(s||(s={}),s[_]=nt[_])}else s||($||($=[]),$.push(et,s)),s=nt;else et==="dangerouslySetInnerHTML"?(nt=nt?nt.__html:void 0,j=j?j.__html:void 0,nt!=null&&j!==nt&&($=$||[]).push(et,nt)):et==="children"?typeof nt!="string"&&typeof nt!="number"||($=$||[]).push(et,""+nt):et!=="suppressContentEditableWarning"&&et!=="suppressHydrationWarning"&&(ea$1.hasOwnProperty(et)?(nt!=null&&et==="onScroll"&&D("scroll",i),$||j===nt||($=[])):($=$||[]).push(et,nt))}s&&($=$||[]).push("style",s);var et=$;(e.updateQueue=et)&&(e.flags|=4)}},Cj=function(i,e,s,c){s!==c&&(e.flags|=4)};function Dj(i,e){if(!I)switch(i.tailMode){case"hidden":e=i.tail;for(var s=null;e!==null;)e.alternate!==null&&(s=e),e=e.sibling;s===null?i.tail=null:s.sibling=null;break;case"collapsed":s=i.tail;for(var c=null;s!==null;)s.alternate!==null&&(c=s),s=s.sibling;c===null?e||i.tail===null?i.tail=null:i.tail.sibling=null:c.sibling=null}}function S(i){var e=i.alternate!==null&&i.alternate.child===i.child,s=0,c=0;if(e)for(var h=i.child;h!==null;)s|=h.lanes|h.childLanes,c|=h.subtreeFlags&14680064,c|=h.flags&14680064,h.return=i,h=h.sibling;else for(h=i.child;h!==null;)s|=h.lanes|h.childLanes,c|=h.subtreeFlags,c|=h.flags,h.return=i,h=h.sibling;return i.subtreeFlags|=c,i.childLanes=s,e}function Ej(i,e,s){var c=e.pendingProps;switch(wg(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return S(e),null;case 1:return Zf(e.type)&&$f(),S(e),null;case 3:return c=e.stateNode,zh(),E(Wf),E(H),Eh(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(i===null||i.child===null)&&(Gg(e)?e.flags|=4:i===null||i.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,zg!==null&&(Fj(zg),zg=null))),Aj(i,e),S(e),null;case 5:Bh(e);var h=xh(wh.current);if(s=e.type,i!==null&&e.stateNode!=null)Bj(i,e,s,c,h),i.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!c){if(e.stateNode===null)throw Error(p(166));return S(e),null}if(i=xh(uh.current),Gg(e)){c=e.stateNode,s=e.type;var $=e.memoizedProps;switch(c[Of]=e,c[Pf]=$,i=(e.mode&1)!==0,s){case"dialog":D("cancel",c),D("close",c);break;case"iframe":case"object":case"embed":D("load",c);break;case"video":case"audio":for(h=0;h<lf.length;h++)D(lf[h],c);break;case"source":D("error",c);break;case"img":case"image":case"link":D("error",c),D("load",c);break;case"details":D("toggle",c);break;case"input":Za$1(c,$),D("invalid",c);break;case"select":c._wrapperState={wasMultiple:!!$.multiple},D("invalid",c);break;case"textarea":hb(c,$),D("invalid",c)}ub(s,$),h=null;for(var _ in $)if($.hasOwnProperty(_)){var j=$[_];_==="children"?typeof j=="string"?c.textContent!==j&&($.suppressHydrationWarning!==!0&&Af(c.textContent,j,i),h=["children",j]):typeof j=="number"&&c.textContent!==""+j&&($.suppressHydrationWarning!==!0&&Af(c.textContent,j,i),h=["children",""+j]):ea$1.hasOwnProperty(_)&&j!=null&&_==="onScroll"&&D("scroll",c)}switch(s){case"input":Va$1(c),db(c,$,!0);break;case"textarea":Va$1(c),jb(c);break;case"select":case"option":break;default:typeof $.onClick=="function"&&(c.onclick=Bf)}c=h,e.updateQueue=c,c!==null&&(e.flags|=4)}else{_=h.nodeType===9?h:h.ownerDocument,i==="http://www.w3.org/1999/xhtml"&&(i=kb(s)),i==="http://www.w3.org/1999/xhtml"?s==="script"?(i=_.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild)):typeof c.is=="string"?i=_.createElement(s,{is:c.is}):(i=_.createElement(s),s==="select"&&(_=i,c.multiple?_.multiple=!0:c.size&&(_.size=c.size))):i=_.createElementNS(i,s),i[Of]=e,i[Pf]=c,zj(i,e,!1,!1),e.stateNode=i;e:{switch(_=vb(s,c),s){case"dialog":D("cancel",i),D("close",i),h=c;break;case"iframe":case"object":case"embed":D("load",i),h=c;break;case"video":case"audio":for(h=0;h<lf.length;h++)D(lf[h],i);h=c;break;case"source":D("error",i),h=c;break;case"img":case"image":case"link":D("error",i),D("load",i),h=c;break;case"details":D("toggle",i),h=c;break;case"input":Za$1(i,c),h=Ya$1(i,c),D("invalid",i);break;case"option":h=c;break;case"select":i._wrapperState={wasMultiple:!!c.multiple},h=A({},c,{value:void 0}),D("invalid",i);break;case"textarea":hb(i,c),h=gb(i,c),D("invalid",i);break;default:h=c}ub(s,h),j=h;for($ in j)if(j.hasOwnProperty($)){var nt=j[$];$==="style"?sb(i,nt):$==="dangerouslySetInnerHTML"?(nt=nt?nt.__html:void 0,nt!=null&&nb(i,nt)):$==="children"?typeof nt=="string"?(s!=="textarea"||nt!=="")&&ob(i,nt):typeof nt=="number"&&ob(i,""+nt):$!=="suppressContentEditableWarning"&&$!=="suppressHydrationWarning"&&$!=="autoFocus"&&(ea$1.hasOwnProperty($)?nt!=null&&$==="onScroll"&&D("scroll",i):nt!=null&&ta$1(i,$,nt,_))}switch(s){case"input":Va$1(i),db(i,c,!1);break;case"textarea":Va$1(i),jb(i);break;case"option":c.value!=null&&i.setAttribute("value",""+Sa$1(c.value));break;case"select":i.multiple=!!c.multiple,$=c.value,$!=null?fb(i,!!c.multiple,$,!1):c.defaultValue!=null&&fb(i,!!c.multiple,c.defaultValue,!0);break;default:typeof h.onClick=="function"&&(i.onclick=Bf)}switch(s){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}}c&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return S(e),null;case 6:if(i&&e.stateNode!=null)Cj(i,e,i.memoizedProps,c);else{if(typeof c!="string"&&e.stateNode===null)throw Error(p(166));if(s=xh(wh.current),xh(uh.current),Gg(e)){if(c=e.stateNode,s=e.memoizedProps,c[Of]=e,($=c.nodeValue!==s)&&(i=xg,i!==null))switch(i.tag){case 3:Af(c.nodeValue,s,(i.mode&1)!==0);break;case 5:i.memoizedProps.suppressHydrationWarning!==!0&&Af(c.nodeValue,s,(i.mode&1)!==0)}$&&(e.flags|=4)}else c=(s.nodeType===9?s:s.ownerDocument).createTextNode(c),c[Of]=e,e.stateNode=c}return S(e),null;case 13:if(E(L),c=e.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(I&&yg!==null&&e.mode&1&&!(e.flags&128))Hg(),Ig(),e.flags|=98560,$=!1;else if($=Gg(e),c!==null&&c.dehydrated!==null){if(i===null){if(!$)throw Error(p(318));if($=e.memoizedState,$=$!==null?$.dehydrated:null,!$)throw Error(p(317));$[Of]=e}else Ig(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;S(e),$=!1}else zg!==null&&(Fj(zg),zg=null),$=!0;if(!$)return e.flags&65536?e:null}return e.flags&128?(e.lanes=s,e):(c=c!==null,c!==(i!==null&&i.memoizedState!==null)&&c&&(e.child.flags|=8192,e.mode&1&&(i===null||L.current&1?T===0&&(T=3):tj())),e.updateQueue!==null&&(e.flags|=4),S(e),null);case 4:return zh(),Aj(i,e),i===null&&sf(e.stateNode.containerInfo),S(e),null;case 10:return ah(e.type._context),S(e),null;case 17:return Zf(e.type)&&$f(),S(e),null;case 19:if(E(L),$=e.memoizedState,$===null)return S(e),null;if(c=(e.flags&128)!==0,_=$.rendering,_===null)if(c)Dj($,!1);else{if(T!==0||i!==null&&i.flags&128)for(i=e.child;i!==null;){if(_=Ch(i),_!==null){for(e.flags|=128,Dj($,!1),c=_.updateQueue,c!==null&&(e.updateQueue=c,e.flags|=4),e.subtreeFlags=0,c=s,s=e.child;s!==null;)$=s,i=c,$.flags&=14680066,_=$.alternate,_===null?($.childLanes=0,$.lanes=i,$.child=null,$.subtreeFlags=0,$.memoizedProps=null,$.memoizedState=null,$.updateQueue=null,$.dependencies=null,$.stateNode=null):($.childLanes=_.childLanes,$.lanes=_.lanes,$.child=_.child,$.subtreeFlags=0,$.deletions=null,$.memoizedProps=_.memoizedProps,$.memoizedState=_.memoizedState,$.updateQueue=_.updateQueue,$.type=_.type,i=_.dependencies,$.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),s=s.sibling;return G(L,L.current&1|2),e.child}i=i.sibling}$.tail!==null&&B()>Gj&&(e.flags|=128,c=!0,Dj($,!1),e.lanes=4194304)}else{if(!c)if(i=Ch(_),i!==null){if(e.flags|=128,c=!0,s=i.updateQueue,s!==null&&(e.updateQueue=s,e.flags|=4),Dj($,!0),$.tail===null&&$.tailMode==="hidden"&&!_.alternate&&!I)return S(e),null}else 2*B()-$.renderingStartTime>Gj&&s!==1073741824&&(e.flags|=128,c=!0,Dj($,!1),e.lanes=4194304);$.isBackwards?(_.sibling=e.child,e.child=_):(s=$.last,s!==null?s.sibling=_:e.child=_,$.last=_)}return $.tail!==null?(e=$.tail,$.rendering=e,$.tail=e.sibling,$.renderingStartTime=B(),e.sibling=null,s=L.current,G(L,c?s&1|2:s&1),e):(S(e),null);case 22:case 23:return Hj(),c=e.memoizedState!==null,i!==null&&i.memoizedState!==null!==c&&(e.flags|=8192),c&&e.mode&1?fj&1073741824&&(S(e),e.subtreeFlags&6&&(e.flags|=8192)):S(e),null;case 24:return null;case 25:return null}throw Error(p(156,e.tag))}function Ij(i,e){switch(wg(e),e.tag){case 1:return Zf(e.type)&&$f(),i=e.flags,i&65536?(e.flags=i&-65537|128,e):null;case 3:return zh(),E(Wf),E(H),Eh(),i=e.flags,i&65536&&!(i&128)?(e.flags=i&-65537|128,e):null;case 5:return Bh(e),null;case 13:if(E(L),i=e.memoizedState,i!==null&&i.dehydrated!==null){if(e.alternate===null)throw Error(p(340));Ig()}return i=e.flags,i&65536?(e.flags=i&-65537|128,e):null;case 19:return E(L),null;case 4:return zh(),null;case 10:return ah(e.type._context),null;case 22:case 23:return Hj(),null;case 24:return null;default:return null}}var Jj=!1,U=!1,Kj=typeof WeakSet=="function"?WeakSet:Set,V=null;function Lj(i,e){var s=i.ref;if(s!==null)if(typeof s=="function")try{s(null)}catch(c){W(i,e,c)}else s.current=null}function Mj(i,e,s){try{s()}catch(c){W(i,e,c)}}var Nj=!1;function Oj(i,e){if(Cf=dd,i=Me$1(),Ne$1(i)){if("selectionStart"in i)var s={start:i.selectionStart,end:i.selectionEnd};else e:{s=(s=i.ownerDocument)&&s.defaultView||window;var c=s.getSelection&&s.getSelection();if(c&&c.rangeCount!==0){s=c.anchorNode;var h=c.anchorOffset,$=c.focusNode;c=c.focusOffset;try{s.nodeType,$.nodeType}catch{s=null;break e}var _=0,j=-1,nt=-1,et=0,b=0,a=i,o=null;t:for(;;){for(var d;a!==s||h!==0&&a.nodeType!==3||(j=_+h),a!==$||c!==0&&a.nodeType!==3||(nt=_+c),a.nodeType===3&&(_+=a.nodeValue.length),(d=a.firstChild)!==null;)o=a,a=d;for(;;){if(a===i)break t;if(o===s&&++et===h&&(j=_),o===$&&++b===c&&(nt=_),(d=a.nextSibling)!==null)break;a=o,o=a.parentNode}a=d}s=j===-1||nt===-1?null:{start:j,end:nt}}else s=null}s=s||{start:0,end:0}}else s=null;for(Df={focusedElem:i,selectionRange:s},dd=!1,V=e;V!==null;)if(e=V,i=e.child,(e.subtreeFlags&1028)!==0&&i!==null)i.return=e,V=i;else for(;V!==null;){e=V;try{var g=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var it=g.memoizedProps,st=g.memoizedState,tt=e.stateNode,ot=tt.getSnapshotBeforeUpdate(e.elementType===e.type?it:Ci(e.type,it),st);tt.__reactInternalSnapshotBeforeUpdate=ot}break;case 3:var rt=e.stateNode.containerInfo;rt.nodeType===1?rt.textContent="":rt.nodeType===9&&rt.documentElement&&rt.removeChild(rt.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(p(163))}}catch(at){W(e,e.return,at)}if(i=e.sibling,i!==null){i.return=e.return,V=i;break}V=e.return}return g=Nj,Nj=!1,g}function Pj(i,e,s){var c=e.updateQueue;if(c=c!==null?c.lastEffect:null,c!==null){var h=c=c.next;do{if((h.tag&i)===i){var $=h.destroy;h.destroy=void 0,$!==void 0&&Mj(e,s,$)}h=h.next}while(h!==c)}}function Qj(i,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var s=e=e.next;do{if((s.tag&i)===i){var c=s.create;s.destroy=c()}s=s.next}while(s!==e)}}function Rj(i){var e=i.ref;if(e!==null){var s=i.stateNode;switch(i.tag){case 5:i=s;break;default:i=s}typeof e=="function"?e(i):e.current=i}}function Sj(i){var e=i.alternate;e!==null&&(i.alternate=null,Sj(e)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(e=i.stateNode,e!==null&&(delete e[Of],delete e[Pf],delete e[of],delete e[Qf],delete e[Rf])),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}function Tj(i){return i.tag===5||i.tag===3||i.tag===4}function Uj(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||Tj(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function Vj(i,e,s){var c=i.tag;if(c===5||c===6)i=i.stateNode,e?s.nodeType===8?s.parentNode.insertBefore(i,e):s.insertBefore(i,e):(s.nodeType===8?(e=s.parentNode,e.insertBefore(i,s)):(e=s,e.appendChild(i)),s=s._reactRootContainer,s!=null||e.onclick!==null||(e.onclick=Bf));else if(c!==4&&(i=i.child,i!==null))for(Vj(i,e,s),i=i.sibling;i!==null;)Vj(i,e,s),i=i.sibling}function Wj(i,e,s){var c=i.tag;if(c===5||c===6)i=i.stateNode,e?s.insertBefore(i,e):s.appendChild(i);else if(c!==4&&(i=i.child,i!==null))for(Wj(i,e,s),i=i.sibling;i!==null;)Wj(i,e,s),i=i.sibling}var X=null,Xj=!1;function Yj(i,e,s){for(s=s.child;s!==null;)Zj(i,e,s),s=s.sibling}function Zj(i,e,s){if(lc&&typeof lc.onCommitFiberUnmount=="function")try{lc.onCommitFiberUnmount(kc,s)}catch{}switch(s.tag){case 5:U||Lj(s,e);case 6:var c=X,h=Xj;X=null,Yj(i,e,s),X=c,Xj=h,X!==null&&(Xj?(i=X,s=s.stateNode,i.nodeType===8?i.parentNode.removeChild(s):i.removeChild(s)):X.removeChild(s.stateNode));break;case 18:X!==null&&(Xj?(i=X,s=s.stateNode,i.nodeType===8?Kf(i.parentNode,s):i.nodeType===1&&Kf(i,s),bd(i)):Kf(X,s.stateNode));break;case 4:c=X,h=Xj,X=s.stateNode.containerInfo,Xj=!0,Yj(i,e,s),X=c,Xj=h;break;case 0:case 11:case 14:case 15:if(!U&&(c=s.updateQueue,c!==null&&(c=c.lastEffect,c!==null))){h=c=c.next;do{var $=h,_=$.destroy;$=$.tag,_!==void 0&&($&2||$&4)&&Mj(s,e,_),h=h.next}while(h!==c)}Yj(i,e,s);break;case 1:if(!U&&(Lj(s,e),c=s.stateNode,typeof c.componentWillUnmount=="function"))try{c.props=s.memoizedProps,c.state=s.memoizedState,c.componentWillUnmount()}catch(j){W(s,e,j)}Yj(i,e,s);break;case 21:Yj(i,e,s);break;case 22:s.mode&1?(U=(c=U)||s.memoizedState!==null,Yj(i,e,s),U=c):Yj(i,e,s);break;default:Yj(i,e,s)}}function ak(i){var e=i.updateQueue;if(e!==null){i.updateQueue=null;var s=i.stateNode;s===null&&(s=i.stateNode=new Kj),e.forEach(function(c){var h=bk.bind(null,i,c);s.has(c)||(s.add(c),c.then(h,h))})}}function ck(i,e){var s=e.deletions;if(s!==null)for(var c=0;c<s.length;c++){var h=s[c];try{var $=i,_=e,j=_;e:for(;j!==null;){switch(j.tag){case 5:X=j.stateNode,Xj=!1;break e;case 3:X=j.stateNode.containerInfo,Xj=!0;break e;case 4:X=j.stateNode.containerInfo,Xj=!0;break e}j=j.return}if(X===null)throw Error(p(160));Zj($,_,h),X=null,Xj=!1;var nt=h.alternate;nt!==null&&(nt.return=null),h.return=null}catch(et){W(h,e,et)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)dk(e,i),e=e.sibling}function dk(i,e){var s=i.alternate,c=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:if(ck(e,i),ek(i),c&4){try{Pj(3,i,i.return),Qj(3,i)}catch(it){W(i,i.return,it)}try{Pj(5,i,i.return)}catch(it){W(i,i.return,it)}}break;case 1:ck(e,i),ek(i),c&512&&s!==null&&Lj(s,s.return);break;case 5:if(ck(e,i),ek(i),c&512&&s!==null&&Lj(s,s.return),i.flags&32){var h=i.stateNode;try{ob(h,"")}catch(it){W(i,i.return,it)}}if(c&4&&(h=i.stateNode,h!=null)){var $=i.memoizedProps,_=s!==null?s.memoizedProps:$,j=i.type,nt=i.updateQueue;if(i.updateQueue=null,nt!==null)try{j==="input"&&$.type==="radio"&&$.name!=null&&ab(h,$),vb(j,_);var et=vb(j,$);for(_=0;_<nt.length;_+=2){var b=nt[_],a=nt[_+1];b==="style"?sb(h,a):b==="dangerouslySetInnerHTML"?nb(h,a):b==="children"?ob(h,a):ta$1(h,b,a,et)}switch(j){case"input":bb(h,$);break;case"textarea":ib(h,$);break;case"select":var o=h._wrapperState.wasMultiple;h._wrapperState.wasMultiple=!!$.multiple;var d=$.value;d!=null?fb(h,!!$.multiple,d,!1):o!==!!$.multiple&&($.defaultValue!=null?fb(h,!!$.multiple,$.defaultValue,!0):fb(h,!!$.multiple,$.multiple?[]:"",!1))}h[Pf]=$}catch(it){W(i,i.return,it)}}break;case 6:if(ck(e,i),ek(i),c&4){if(i.stateNode===null)throw Error(p(162));h=i.stateNode,$=i.memoizedProps;try{h.nodeValue=$}catch(it){W(i,i.return,it)}}break;case 3:if(ck(e,i),ek(i),c&4&&s!==null&&s.memoizedState.isDehydrated)try{bd(e.containerInfo)}catch(it){W(i,i.return,it)}break;case 4:ck(e,i),ek(i);break;case 13:ck(e,i),ek(i),h=i.child,h.flags&8192&&($=h.memoizedState!==null,h.stateNode.isHidden=$,!$||h.alternate!==null&&h.alternate.memoizedState!==null||(fk=B())),c&4&&ak(i);break;case 22:if(b=s!==null&&s.memoizedState!==null,i.mode&1?(U=(et=U)||b,ck(e,i),U=et):ck(e,i),ek(i),c&8192){if(et=i.memoizedState!==null,(i.stateNode.isHidden=et)&&!b&&i.mode&1)for(V=i,b=i.child;b!==null;){for(a=V=b;V!==null;){switch(o=V,d=o.child,o.tag){case 0:case 11:case 14:case 15:Pj(4,o,o.return);break;case 1:Lj(o,o.return);var g=o.stateNode;if(typeof g.componentWillUnmount=="function"){c=o,s=o.return;try{e=c,g.props=e.memoizedProps,g.state=e.memoizedState,g.componentWillUnmount()}catch(it){W(c,s,it)}}break;case 5:Lj(o,o.return);break;case 22:if(o.memoizedState!==null){gk(a);continue}}d!==null?(d.return=o,V=d):gk(a)}b=b.sibling}e:for(b=null,a=i;;){if(a.tag===5){if(b===null){b=a;try{h=a.stateNode,et?($=h.style,typeof $.setProperty=="function"?$.setProperty("display","none","important"):$.display="none"):(j=a.stateNode,nt=a.memoizedProps.style,_=nt!=null&&nt.hasOwnProperty("display")?nt.display:null,j.style.display=rb("display",_))}catch(it){W(i,i.return,it)}}}else if(a.tag===6){if(b===null)try{a.stateNode.nodeValue=et?"":a.memoizedProps}catch(it){W(i,i.return,it)}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===i)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===i)break e;for(;a.sibling===null;){if(a.return===null||a.return===i)break e;b===a&&(b=null),a=a.return}b===a&&(b=null),a.sibling.return=a.return,a=a.sibling}}break;case 19:ck(e,i),ek(i),c&4&&ak(i);break;case 21:break;default:ck(e,i),ek(i)}}function ek(i){var e=i.flags;if(e&2){try{e:{for(var s=i.return;s!==null;){if(Tj(s)){var c=s;break e}s=s.return}throw Error(p(160))}switch(c.tag){case 5:var h=c.stateNode;c.flags&32&&(ob(h,""),c.flags&=-33);var $=Uj(i);Wj(i,$,h);break;case 3:case 4:var _=c.stateNode.containerInfo,j=Uj(i);Vj(i,j,_);break;default:throw Error(p(161))}}catch(nt){W(i,i.return,nt)}i.flags&=-3}e&4096&&(i.flags&=-4097)}function hk(i,e,s){V=i,ik(i)}function ik(i,e,s){for(var c=(i.mode&1)!==0;V!==null;){var h=V,$=h.child;if(h.tag===22&&c){var _=h.memoizedState!==null||Jj;if(!_){var j=h.alternate,nt=j!==null&&j.memoizedState!==null||U;j=Jj;var et=U;if(Jj=_,(U=nt)&&!et)for(V=h;V!==null;)_=V,nt=_.child,_.tag===22&&_.memoizedState!==null?jk(h):nt!==null?(nt.return=_,V=nt):jk(h);for(;$!==null;)V=$,ik($),$=$.sibling;V=h,Jj=j,U=et}kk(i)}else h.subtreeFlags&8772&&$!==null?($.return=h,V=$):kk(i)}}function kk(i){for(;V!==null;){var e=V;if(e.flags&8772){var s=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:U||Qj(5,e);break;case 1:var c=e.stateNode;if(e.flags&4&&!U)if(s===null)c.componentDidMount();else{var h=e.elementType===e.type?s.memoizedProps:Ci(e.type,s.memoizedProps);c.componentDidUpdate(h,s.memoizedState,c.__reactInternalSnapshotBeforeUpdate)}var $=e.updateQueue;$!==null&&sh(e,$,c);break;case 3:var _=e.updateQueue;if(_!==null){if(s=null,e.child!==null)switch(e.child.tag){case 5:s=e.child.stateNode;break;case 1:s=e.child.stateNode}sh(e,_,s)}break;case 5:var j=e.stateNode;if(s===null&&e.flags&4){s=j;var nt=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":nt.autoFocus&&s.focus();break;case"img":nt.src&&(s.src=nt.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var et=e.alternate;if(et!==null){var b=et.memoizedState;if(b!==null){var a=b.dehydrated;a!==null&&bd(a)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(p(163))}U||e.flags&512&&Rj(e)}catch(o){W(e,e.return,o)}}if(e===i){V=null;break}if(s=e.sibling,s!==null){s.return=e.return,V=s;break}V=e.return}}function gk(i){for(;V!==null;){var e=V;if(e===i){V=null;break}var s=e.sibling;if(s!==null){s.return=e.return,V=s;break}V=e.return}}function jk(i){for(;V!==null;){var e=V;try{switch(e.tag){case 0:case 11:case 15:var s=e.return;try{Qj(4,e)}catch(nt){W(e,s,nt)}break;case 1:var c=e.stateNode;if(typeof c.componentDidMount=="function"){var h=e.return;try{c.componentDidMount()}catch(nt){W(e,h,nt)}}var $=e.return;try{Rj(e)}catch(nt){W(e,$,nt)}break;case 5:var _=e.return;try{Rj(e)}catch(nt){W(e,_,nt)}}}catch(nt){W(e,e.return,nt)}if(e===i){V=null;break}var j=e.sibling;if(j!==null){j.return=e.return,V=j;break}V=e.return}}var lk=Math.ceil,mk=ua$1.ReactCurrentDispatcher,nk=ua$1.ReactCurrentOwner,ok=ua$1.ReactCurrentBatchConfig,K=0,Q=null,Y=null,Z=0,fj=0,ej=Uf(0),T=0,pk=null,rh=0,qk=0,rk=0,sk=null,tk=null,fk=0,Gj=1/0,uk=null,Oi=!1,Pi=null,Ri=null,vk=!1,wk=null,xk=0,yk=0,zk=null,Ak=-1,Bk=0;function R(){return K&6?B():Ak!==-1?Ak:Ak=B()}function yi(i){return i.mode&1?K&2&&Z!==0?Z&-Z:Kg.transition!==null?(Bk===0&&(Bk=yc()),Bk):(i=C,i!==0||(i=window.event,i=i===void 0?16:jd(i.type)),i):1}function gi(i,e,s,c){if(50<yk)throw yk=0,zk=null,Error(p(185));Ac(i,s,c),(!(K&2)||i!==Q)&&(i===Q&&(!(K&2)&&(qk|=s),T===4&&Ck(i,Z)),Dk(i,c),s===1&&K===0&&!(e.mode&1)&&(Gj=B()+500,fg&&jg()))}function Dk(i,e){var s=i.callbackNode;wc(i,e);var c=uc(i,i===Q?Z:0);if(c===0)s!==null&&bc(s),i.callbackNode=null,i.callbackPriority=0;else if(e=c&-c,i.callbackPriority!==e){if(s!=null&&bc(s),e===1)i.tag===0?ig(Ek.bind(null,i)):hg(Ek.bind(null,i)),Jf(function(){!(K&6)&&jg()}),s=null;else{switch(Dc(c)){case 1:s=fc;break;case 4:s=gc;break;case 16:s=hc;break;case 536870912:s=jc;break;default:s=hc}s=Fk(s,Gk.bind(null,i))}i.callbackPriority=e,i.callbackNode=s}}function Gk(i,e){if(Ak=-1,Bk=0,K&6)throw Error(p(327));var s=i.callbackNode;if(Hk()&&i.callbackNode!==s)return null;var c=uc(i,i===Q?Z:0);if(c===0)return null;if(c&30||c&i.expiredLanes||e)e=Ik(i,c);else{e=c;var h=K;K|=2;var $=Jk();(Q!==i||Z!==e)&&(uk=null,Gj=B()+500,Kk(i,e));do try{Lk();break}catch(j){Mk(i,j)}while(!0);$g(),mk.current=$,K=h,Y!==null?e=0:(Q=null,Z=0,e=T)}if(e!==0){if(e===2&&(h=xc(i),h!==0&&(c=h,e=Nk(i,h))),e===1)throw s=pk,Kk(i,0),Ck(i,c),Dk(i,B()),s;if(e===6)Ck(i,c);else{if(h=i.current.alternate,!(c&30)&&!Ok(h)&&(e=Ik(i,c),e===2&&($=xc(i),$!==0&&(c=$,e=Nk(i,$))),e===1))throw s=pk,Kk(i,0),Ck(i,c),Dk(i,B()),s;switch(i.finishedWork=h,i.finishedLanes=c,e){case 0:case 1:throw Error(p(345));case 2:Pk(i,tk,uk);break;case 3:if(Ck(i,c),(c&130023424)===c&&(e=fk+500-B(),10<e)){if(uc(i,0)!==0)break;if(h=i.suspendedLanes,(h&c)!==c){R(),i.pingedLanes|=i.suspendedLanes&h;break}i.timeoutHandle=Ff(Pk.bind(null,i,tk,uk),e);break}Pk(i,tk,uk);break;case 4:if(Ck(i,c),(c&4194240)===c)break;for(e=i.eventTimes,h=-1;0<c;){var _=31-oc(c);$=1<<_,_=e[_],_>h&&(h=_),c&=~$}if(c=h,c=B()-c,c=(120>c?120:480>c?480:1080>c?1080:1920>c?1920:3e3>c?3e3:4320>c?4320:1960*lk(c/1960))-c,10<c){i.timeoutHandle=Ff(Pk.bind(null,i,tk,uk),c);break}Pk(i,tk,uk);break;case 5:Pk(i,tk,uk);break;default:throw Error(p(329))}}}return Dk(i,B()),i.callbackNode===s?Gk.bind(null,i):null}function Nk(i,e){var s=sk;return i.current.memoizedState.isDehydrated&&(Kk(i,e).flags|=256),i=Ik(i,e),i!==2&&(e=tk,tk=s,e!==null&&Fj(e)),i}function Fj(i){tk===null?tk=i:tk.push.apply(tk,i)}function Ok(i){for(var e=i;;){if(e.flags&16384){var s=e.updateQueue;if(s!==null&&(s=s.stores,s!==null))for(var c=0;c<s.length;c++){var h=s[c],$=h.getSnapshot;h=h.value;try{if(!He$1($(),h))return!1}catch{return!1}}}if(s=e.child,e.subtreeFlags&16384&&s!==null)s.return=e,e=s;else{if(e===i)break;for(;e.sibling===null;){if(e.return===null||e.return===i)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function Ck(i,e){for(e&=~rk,e&=~qk,i.suspendedLanes|=e,i.pingedLanes&=~e,i=i.expirationTimes;0<e;){var s=31-oc(e),c=1<<s;i[s]=-1,e&=~c}}function Ek(i){if(K&6)throw Error(p(327));Hk();var e=uc(i,0);if(!(e&1))return Dk(i,B()),null;var s=Ik(i,e);if(i.tag!==0&&s===2){var c=xc(i);c!==0&&(e=c,s=Nk(i,c))}if(s===1)throw s=pk,Kk(i,0),Ck(i,e),Dk(i,B()),s;if(s===6)throw Error(p(345));return i.finishedWork=i.current.alternate,i.finishedLanes=e,Pk(i,tk,uk),Dk(i,B()),null}function Qk(i,e){var s=K;K|=1;try{return i(e)}finally{K=s,K===0&&(Gj=B()+500,fg&&jg())}}function Rk(i){wk!==null&&wk.tag===0&&!(K&6)&&Hk();var e=K;K|=1;var s=ok.transition,c=C;try{if(ok.transition=null,C=1,i)return i()}finally{C=c,ok.transition=s,K=e,!(K&6)&&jg()}}function Hj(){fj=ej.current,E(ej)}function Kk(i,e){i.finishedWork=null,i.finishedLanes=0;var s=i.timeoutHandle;if(s!==-1&&(i.timeoutHandle=-1,Gf(s)),Y!==null)for(s=Y.return;s!==null;){var c=s;switch(wg(c),c.tag){case 1:c=c.type.childContextTypes,c!=null&&$f();break;case 3:zh(),E(Wf),E(H),Eh();break;case 5:Bh(c);break;case 4:zh();break;case 13:E(L);break;case 19:E(L);break;case 10:ah(c.type._context);break;case 22:case 23:Hj()}s=s.return}if(Q=i,Y=i=Pg(i.current,null),Z=fj=e,T=0,pk=null,rk=qk=rh=0,tk=sk=null,fh!==null){for(e=0;e<fh.length;e++)if(s=fh[e],c=s.interleaved,c!==null){s.interleaved=null;var h=c.next,$=s.pending;if($!==null){var _=$.next;$.next=h,c.next=_}s.pending=c}fh=null}return i}function Mk(i,e){do{var s=Y;try{if($g(),Fh.current=Rh,Ih){for(var c=M.memoizedState;c!==null;){var h=c.queue;h!==null&&(h.pending=null),c=c.next}Ih=!1}if(Hh=0,O=N=M=null,Jh=!1,Kh=0,nk.current=null,s===null||s.return===null){T=1,pk=e,Y=null;break}e:{var $=i,_=s.return,j=s,nt=e;if(e=Z,j.flags|=32768,nt!==null&&typeof nt=="object"&&typeof nt.then=="function"){var et=nt,b=j,a=b.tag;if(!(b.mode&1)&&(a===0||a===11||a===15)){var o=b.alternate;o?(b.updateQueue=o.updateQueue,b.memoizedState=o.memoizedState,b.lanes=o.lanes):(b.updateQueue=null,b.memoizedState=null)}var d=Ui(_);if(d!==null){d.flags&=-257,Vi(d,_,j,$,e),d.mode&1&&Si($,et,e),e=d,nt=et;var g=e.updateQueue;if(g===null){var it=new Set;it.add(nt),e.updateQueue=it}else g.add(nt);break e}else{if(!(e&1)){Si($,et,e),tj();break e}nt=Error(p(426))}}else if(I&&j.mode&1){var st=Ui(_);if(st!==null){!(st.flags&65536)&&(st.flags|=256),Vi(st,_,j,$,e),Jg(Ji(nt,j));break e}}$=nt=Ji(nt,j),T!==4&&(T=2),sk===null?sk=[$]:sk.push($),$=_;do{switch($.tag){case 3:$.flags|=65536,e&=-e,$.lanes|=e;var tt=Ni($,nt,e);ph($,tt);break e;case 1:j=nt;var ot=$.type,rt=$.stateNode;if(!($.flags&128)&&(typeof ot.getDerivedStateFromError=="function"||rt!==null&&typeof rt.componentDidCatch=="function"&&(Ri===null||!Ri.has(rt)))){$.flags|=65536,e&=-e,$.lanes|=e;var at=Qi($,j,e);ph($,at);break e}}$=$.return}while($!==null)}Sk(s)}catch(ut){e=ut,Y===s&&s!==null&&(Y=s=s.return);continue}break}while(!0)}function Jk(){var i=mk.current;return mk.current=Rh,i===null?Rh:i}function tj(){(T===0||T===3||T===2)&&(T=4),Q===null||!(rh&268435455)&&!(qk&268435455)||Ck(Q,Z)}function Ik(i,e){var s=K;K|=2;var c=Jk();(Q!==i||Z!==e)&&(uk=null,Kk(i,e));do try{Tk();break}catch(h){Mk(i,h)}while(!0);if($g(),K=s,mk.current=c,Y!==null)throw Error(p(261));return Q=null,Z=0,T}function Tk(){for(;Y!==null;)Uk(Y)}function Lk(){for(;Y!==null&&!cc();)Uk(Y)}function Uk(i){var e=Vk(i.alternate,i,fj);i.memoizedProps=i.pendingProps,e===null?Sk(i):Y=e,nk.current=null}function Sk(i){var e=i;do{var s=e.alternate;if(i=e.return,e.flags&32768){if(s=Ij(s,e),s!==null){s.flags&=32767,Y=s;return}if(i!==null)i.flags|=32768,i.subtreeFlags=0,i.deletions=null;else{T=6,Y=null;return}}else if(s=Ej(s,e,fj),s!==null){Y=s;return}if(e=e.sibling,e!==null){Y=e;return}Y=e=i}while(e!==null);T===0&&(T=5)}function Pk(i,e,s){var c=C,h=ok.transition;try{ok.transition=null,C=1,Wk(i,e,s,c)}finally{ok.transition=h,C=c}return null}function Wk(i,e,s,c){do Hk();while(wk!==null);if(K&6)throw Error(p(327));s=i.finishedWork;var h=i.finishedLanes;if(s===null)return null;if(i.finishedWork=null,i.finishedLanes=0,s===i.current)throw Error(p(177));i.callbackNode=null,i.callbackPriority=0;var $=s.lanes|s.childLanes;if(Bc(i,$),i===Q&&(Y=Q=null,Z=0),!(s.subtreeFlags&2064)&&!(s.flags&2064)||vk||(vk=!0,Fk(hc,function(){return Hk(),null})),$=(s.flags&15990)!==0,s.subtreeFlags&15990||$){$=ok.transition,ok.transition=null;var _=C;C=1;var j=K;K|=4,nk.current=null,Oj(i,s),dk(s,i),Oe$1(Df),dd=!!Cf,Df=Cf=null,i.current=s,hk(s),dc(),K=j,C=_,ok.transition=$}else i.current=s;if(vk&&(vk=!1,wk=i,xk=h),$=i.pendingLanes,$===0&&(Ri=null),mc(s.stateNode),Dk(i,B()),e!==null)for(c=i.onRecoverableError,s=0;s<e.length;s++)h=e[s],c(h.value,{componentStack:h.stack,digest:h.digest});if(Oi)throw Oi=!1,i=Pi,Pi=null,i;return xk&1&&i.tag!==0&&Hk(),$=i.pendingLanes,$&1?i===zk?yk++:(yk=0,zk=i):yk=0,jg(),null}function Hk(){if(wk!==null){var i=Dc(xk),e=ok.transition,s=C;try{if(ok.transition=null,C=16>i?16:i,wk===null)var c=!1;else{if(i=wk,wk=null,xk=0,K&6)throw Error(p(331));var h=K;for(K|=4,V=i.current;V!==null;){var $=V,_=$.child;if(V.flags&16){var j=$.deletions;if(j!==null){for(var nt=0;nt<j.length;nt++){var et=j[nt];for(V=et;V!==null;){var b=V;switch(b.tag){case 0:case 11:case 15:Pj(8,b,$)}var a=b.child;if(a!==null)a.return=b,V=a;else for(;V!==null;){b=V;var o=b.sibling,d=b.return;if(Sj(b),b===et){V=null;break}if(o!==null){o.return=d,V=o;break}V=d}}}var g=$.alternate;if(g!==null){var it=g.child;if(it!==null){g.child=null;do{var st=it.sibling;it.sibling=null,it=st}while(it!==null)}}V=$}}if($.subtreeFlags&2064&&_!==null)_.return=$,V=_;else e:for(;V!==null;){if($=V,$.flags&2048)switch($.tag){case 0:case 11:case 15:Pj(9,$,$.return)}var tt=$.sibling;if(tt!==null){tt.return=$.return,V=tt;break e}V=$.return}}var ot=i.current;for(V=ot;V!==null;){_=V;var rt=_.child;if(_.subtreeFlags&2064&&rt!==null)rt.return=_,V=rt;else e:for(_=ot;V!==null;){if(j=V,j.flags&2048)try{switch(j.tag){case 0:case 11:case 15:Qj(9,j)}}catch(ut){W(j,j.return,ut)}if(j===_){V=null;break e}var at=j.sibling;if(at!==null){at.return=j.return,V=at;break e}V=j.return}}if(K=h,jg(),lc&&typeof lc.onPostCommitFiberRoot=="function")try{lc.onPostCommitFiberRoot(kc,i)}catch{}c=!0}return c}finally{C=s,ok.transition=e}}return!1}function Xk(i,e,s){e=Ji(s,e),e=Ni(i,e,1),i=nh(i,e,1),e=R(),i!==null&&(Ac(i,1,e),Dk(i,e))}function W(i,e,s){if(i.tag===3)Xk(i,i,s);else for(;e!==null;){if(e.tag===3){Xk(e,i,s);break}else if(e.tag===1){var c=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(Ri===null||!Ri.has(c))){i=Ji(s,i),i=Qi(e,i,1),e=nh(e,i,1),i=R(),e!==null&&(Ac(e,1,i),Dk(e,i));break}}e=e.return}}function Ti(i,e,s){var c=i.pingCache;c!==null&&c.delete(e),e=R(),i.pingedLanes|=i.suspendedLanes&s,Q===i&&(Z&s)===s&&(T===4||T===3&&(Z&130023424)===Z&&500>B()-fk?Kk(i,0):rk|=s),Dk(i,e)}function Yk(i,e){e===0&&(i.mode&1?(e=sc,sc<<=1,!(sc&130023424)&&(sc=4194304)):e=1);var s=R();i=ih(i,e),i!==null&&(Ac(i,e,s),Dk(i,s))}function uj(i){var e=i.memoizedState,s=0;e!==null&&(s=e.retryLane),Yk(i,s)}function bk(i,e){var s=0;switch(i.tag){case 13:var c=i.stateNode,h=i.memoizedState;h!==null&&(s=h.retryLane);break;case 19:c=i.stateNode;break;default:throw Error(p(314))}c!==null&&c.delete(e),Yk(i,s)}var Vk;Vk=function(i,e,s){if(i!==null)if(i.memoizedProps!==e.pendingProps||Wf.current)dh=!0;else{if(!(i.lanes&s)&&!(e.flags&128))return dh=!1,yj(i,e,s);dh=!!(i.flags&131072)}else dh=!1,I&&e.flags&1048576&&ug(e,ng,e.index);switch(e.lanes=0,e.tag){case 2:var c=e.type;ij(i,e),i=e.pendingProps;var h=Yf(e,H.current);ch(e,s),h=Nh(null,e,c,i,h,s);var $=Sh();return e.flags|=1,typeof h=="object"&&h!==null&&typeof h.render=="function"&&h.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Zf(c)?($=!0,cg(e)):$=!1,e.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,kh(e),h.updater=Ei,e.stateNode=h,h._reactInternals=e,Ii(e,c,i,s),e=jj(null,e,c,!0,$,s)):(e.tag=0,I&&$&&vg(e),Xi(null,e,h,s),e=e.child),e;case 16:c=e.elementType;e:{switch(ij(i,e),i=e.pendingProps,h=c._init,c=h(c._payload),e.type=c,h=e.tag=Zk(c),i=Ci(c,i),h){case 0:e=cj(null,e,c,i,s);break e;case 1:e=hj(null,e,c,i,s);break e;case 11:e=Yi(null,e,c,i,s);break e;case 14:e=$i(null,e,c,Ci(c.type,i),s);break e}throw Error(p(306,c,""))}return e;case 0:return c=e.type,h=e.pendingProps,h=e.elementType===c?h:Ci(c,h),cj(i,e,c,h,s);case 1:return c=e.type,h=e.pendingProps,h=e.elementType===c?h:Ci(c,h),hj(i,e,c,h,s);case 3:e:{if(kj(e),i===null)throw Error(p(387));c=e.pendingProps,$=e.memoizedState,h=$.element,lh(i,e),qh(e,c,null,s);var _=e.memoizedState;if(c=_.element,$.isDehydrated)if($={element:c,isDehydrated:!1,cache:_.cache,pendingSuspenseBoundaries:_.pendingSuspenseBoundaries,transitions:_.transitions},e.updateQueue.baseState=$,e.memoizedState=$,e.flags&256){h=Ji(Error(p(423)),e),e=lj(i,e,c,s,h);break e}else if(c!==h){h=Ji(Error(p(424)),e),e=lj(i,e,c,s,h);break e}else for(yg=Lf(e.stateNode.containerInfo.firstChild),xg=e,I=!0,zg=null,s=Vg(e,null,c,s),e.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(Ig(),c===h){e=Zi(i,e,s);break e}Xi(i,e,c,s)}e=e.child}return e;case 5:return Ah(e),i===null&&Eg(e),c=e.type,h=e.pendingProps,$=i!==null?i.memoizedProps:null,_=h.children,Ef(c,h)?_=null:$!==null&&Ef(c,$)&&(e.flags|=32),gj(i,e),Xi(i,e,_,s),e.child;case 6:return i===null&&Eg(e),null;case 13:return oj(i,e,s);case 4:return yh(e,e.stateNode.containerInfo),c=e.pendingProps,i===null?e.child=Ug(e,null,c,s):Xi(i,e,c,s),e.child;case 11:return c=e.type,h=e.pendingProps,h=e.elementType===c?h:Ci(c,h),Yi(i,e,c,h,s);case 7:return Xi(i,e,e.pendingProps,s),e.child;case 8:return Xi(i,e,e.pendingProps.children,s),e.child;case 12:return Xi(i,e,e.pendingProps.children,s),e.child;case 10:e:{if(c=e.type._context,h=e.pendingProps,$=e.memoizedProps,_=h.value,G(Wg,c._currentValue),c._currentValue=_,$!==null)if(He$1($.value,_)){if($.children===h.children&&!Wf.current){e=Zi(i,e,s);break e}}else for($=e.child,$!==null&&($.return=e);$!==null;){var j=$.dependencies;if(j!==null){_=$.child;for(var nt=j.firstContext;nt!==null;){if(nt.context===c){if($.tag===1){nt=mh(-1,s&-s),nt.tag=2;var et=$.updateQueue;if(et!==null){et=et.shared;var b=et.pending;b===null?nt.next=nt:(nt.next=b.next,b.next=nt),et.pending=nt}}$.lanes|=s,nt=$.alternate,nt!==null&&(nt.lanes|=s),bh($.return,s,e),j.lanes|=s;break}nt=nt.next}}else if($.tag===10)_=$.type===e.type?null:$.child;else if($.tag===18){if(_=$.return,_===null)throw Error(p(341));_.lanes|=s,j=_.alternate,j!==null&&(j.lanes|=s),bh(_,s,e),_=$.sibling}else _=$.child;if(_!==null)_.return=$;else for(_=$;_!==null;){if(_===e){_=null;break}if($=_.sibling,$!==null){$.return=_.return,_=$;break}_=_.return}$=_}Xi(i,e,h.children,s),e=e.child}return e;case 9:return h=e.type,c=e.pendingProps.children,ch(e,s),h=eh(h),c=c(h),e.flags|=1,Xi(i,e,c,s),e.child;case 14:return c=e.type,h=Ci(c,e.pendingProps),h=Ci(c.type,h),$i(i,e,c,h,s);case 15:return bj(i,e,e.type,e.pendingProps,s);case 17:return c=e.type,h=e.pendingProps,h=e.elementType===c?h:Ci(c,h),ij(i,e),e.tag=1,Zf(c)?(i=!0,cg(e)):i=!1,ch(e,s),Gi(e,c,h),Ii(e,c,h,s),jj(null,e,c,!0,i,s);case 19:return xj(i,e,s);case 22:return dj(i,e,s)}throw Error(p(156,e.tag))};function Fk(i,e){return ac(i,e)}function $k(i,e,s,c){this.tag=i,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Bg(i,e,s,c){return new $k(i,e,s,c)}function aj(i){return i=i.prototype,!(!i||!i.isReactComponent)}function Zk(i){if(typeof i=="function")return aj(i)?1:0;if(i!=null){if(i=i.$$typeof,i===Da$1)return 11;if(i===Ga$1)return 14}return 2}function Pg(i,e){var s=i.alternate;return s===null?(s=Bg(i.tag,e,i.key,i.mode),s.elementType=i.elementType,s.type=i.type,s.stateNode=i.stateNode,s.alternate=i,i.alternate=s):(s.pendingProps=e,s.type=i.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=i.flags&14680064,s.childLanes=i.childLanes,s.lanes=i.lanes,s.child=i.child,s.memoizedProps=i.memoizedProps,s.memoizedState=i.memoizedState,s.updateQueue=i.updateQueue,e=i.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},s.sibling=i.sibling,s.index=i.index,s.ref=i.ref,s}function Rg(i,e,s,c,h,$){var _=2;if(c=i,typeof i=="function")aj(i)&&(_=1);else if(typeof i=="string")_=5;else e:switch(i){case ya$1:return Tg(s.children,h,$,e);case za$1:_=8,h|=8;break;case Aa$1:return i=Bg(12,s,e,h|2),i.elementType=Aa$1,i.lanes=$,i;case Ea$1:return i=Bg(13,s,e,h),i.elementType=Ea$1,i.lanes=$,i;case Fa$1:return i=Bg(19,s,e,h),i.elementType=Fa$1,i.lanes=$,i;case Ia$1:return pj(s,h,$,e);default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case Ba$1:_=10;break e;case Ca$1:_=9;break e;case Da$1:_=11;break e;case Ga$1:_=14;break e;case Ha$1:_=16,c=null;break e}throw Error(p(130,i==null?i:typeof i,""))}return e=Bg(_,s,e,h),e.elementType=i,e.type=c,e.lanes=$,e}function Tg(i,e,s,c){return i=Bg(7,i,c,e),i.lanes=s,i}function pj(i,e,s,c){return i=Bg(22,i,c,e),i.elementType=Ia$1,i.lanes=s,i.stateNode={isHidden:!1},i}function Qg(i,e,s){return i=Bg(6,i,null,e),i.lanes=s,i}function Sg(i,e,s){return e=Bg(4,i.children!==null?i.children:[],i.key,e),e.lanes=s,e.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},e}function al(i,e,s,c,h){this.tag=e,this.containerInfo=i,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=zc(0),this.expirationTimes=zc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zc(0),this.identifierPrefix=c,this.onRecoverableError=h,this.mutableSourceEagerHydrationData=null}function bl(i,e,s,c,h,$,_,j,nt){return i=new al(i,e,s,j,nt),e===1?(e=1,$===!0&&(e|=8)):e=0,$=Bg(3,null,null,e),i.current=$,$.stateNode=i,$.memoizedState={element:c,isDehydrated:s,cache:null,transitions:null,pendingSuspenseBoundaries:null},kh($),i}function cl(i,e,s){var c=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:wa$1,key:c==null?null:""+c,children:i,containerInfo:e,implementation:s}}function dl(i){if(!i)return Vf;i=i._reactInternals;e:{if(Vb(i)!==i||i.tag!==1)throw Error(p(170));var e=i;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(Zf(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(p(171))}if(i.tag===1){var s=i.type;if(Zf(s))return bg(i,s,e)}return e}function el(i,e,s,c,h,$,_,j,nt){return i=bl(s,c,!0,i,h,$,_,j,nt),i.context=dl(null),s=i.current,c=R(),h=yi(s),$=mh(c,h),$.callback=e??null,nh(s,$,h),i.current.lanes=h,Ac(i,h,c),Dk(i,c),i}function fl(i,e,s,c){var h=e.current,$=R(),_=yi(h);return s=dl(s),e.context===null?e.context=s:e.pendingContext=s,e=mh($,_),e.payload={element:i},c=c===void 0?null:c,c!==null&&(e.callback=c),i=nh(h,e,_),i!==null&&(gi(i,h,_,$),oh(i,h,_)),_}function gl(i){if(i=i.current,!i.child)return null;switch(i.child.tag){case 5:return i.child.stateNode;default:return i.child.stateNode}}function hl(i,e){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var s=i.retryLane;i.retryLane=s!==0&&s<e?s:e}}function il(i,e){hl(i,e),(i=i.alternate)&&hl(i,e)}function jl(){return null}var kl=typeof reportError=="function"?reportError:function(i){console.error(i)};function ll(i){this._internalRoot=i}ml.prototype.render=ll.prototype.render=function(i){var e=this._internalRoot;if(e===null)throw Error(p(409));fl(i,e,null,null)},ml.prototype.unmount=ll.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var e=i.containerInfo;Rk(function(){fl(null,i,null,null)}),e[uf]=null}};function ml(i){this._internalRoot=i}ml.prototype.unstable_scheduleHydration=function(i){if(i){var e=Hc();i={blockedOn:null,target:i,priority:e};for(var s=0;s<Qc.length&&e!==0&&e<Qc[s].priority;s++);Qc.splice(s,0,i),s===0&&Vc(i)}};function nl(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function ol(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11&&(i.nodeType!==8||i.nodeValue!==" react-mount-point-unstable "))}function pl(){}function ql(i,e,s,c,h){if(h){if(typeof c=="function"){var $=c;c=function(){var et=gl(_);$.call(et)}}var _=el(e,c,i,0,null,!1,!1,"",pl);return i._reactRootContainer=_,i[uf]=_.current,sf(i.nodeType===8?i.parentNode:i),Rk(),_}for(;h=i.lastChild;)i.removeChild(h);if(typeof c=="function"){var j=c;c=function(){var et=gl(nt);j.call(et)}}var nt=bl(i,0,!1,null,null,!1,!1,"",pl);return i._reactRootContainer=nt,i[uf]=nt.current,sf(i.nodeType===8?i.parentNode:i),Rk(function(){fl(e,nt,s,c)}),nt}function rl(i,e,s,c,h){var $=s._reactRootContainer;if($){var _=$;if(typeof h=="function"){var j=h;h=function(){var nt=gl(_);j.call(nt)}}fl(e,_,i,h)}else _=ql(s,e,i,h,c);return gl(_)}Ec=function(i){switch(i.tag){case 3:var e=i.stateNode;if(e.current.memoizedState.isDehydrated){var s=tc(e.pendingLanes);s!==0&&(Cc(e,s|1),Dk(e,B()),!(K&6)&&(Gj=B()+500,jg()))}break;case 13:Rk(function(){var c=ih(i,1);if(c!==null){var h=R();gi(c,i,1,h)}}),il(i,1)}},Fc=function(i){if(i.tag===13){var e=ih(i,134217728);if(e!==null){var s=R();gi(e,i,134217728,s)}il(i,134217728)}},Gc=function(i){if(i.tag===13){var e=yi(i),s=ih(i,e);if(s!==null){var c=R();gi(s,i,e,c)}il(i,e)}},Hc=function(){return C},Ic=function(i,e){var s=C;try{return C=i,e()}finally{C=s}},yb=function(i,e,s){switch(e){case"input":if(bb(i,s),e=s.name,s.type==="radio"&&e!=null){for(s=i;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<s.length;e++){var c=s[e];if(c!==i&&c.form===i.form){var h=Db(c);if(!h)throw Error(p(90));Wa$1(c),bb(c,h)}}}break;case"textarea":ib(i,s);break;case"select":e=s.value,e!=null&&fb(i,!!s.multiple,e,!1)}},Gb=Qk,Hb=Rk;var sl={usingClientEntryPoint:!1,Events:[Cb,ue,Db,Eb,Fb,Qk]},tl={findFiberByHostInstance:Wc,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},ul={bundleType:tl.bundleType,version:tl.version,rendererPackageName:tl.rendererPackageName,rendererConfig:tl.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:ua$1.ReactCurrentDispatcher,findHostInstanceByFiber:function(i){return i=Zb(i),i===null?null:i.stateNode},findFiberByHostInstance:tl.findFiberByHostInstance||jl,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var vl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!vl.isDisabled&&vl.supportsFiber)try{kc=vl.inject(ul),lc=vl}catch{}}reactDom_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=sl,reactDom_production_min.createPortal=function(i,e){var s=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!nl(e))throw Error(p(200));return cl(i,e,null,s)},reactDom_production_min.createRoot=function(i,e){if(!nl(i))throw Error(p(299));var s=!1,c="",h=kl;return e!=null&&(e.unstable_strictMode===!0&&(s=!0),e.identifierPrefix!==void 0&&(c=e.identifierPrefix),e.onRecoverableError!==void 0&&(h=e.onRecoverableError)),e=bl(i,1,!1,null,null,s,!1,c,h),i[uf]=e.current,sf(i.nodeType===8?i.parentNode:i),new ll(e)},reactDom_production_min.findDOMNode=function(i){if(i==null)return null;if(i.nodeType===1)return i;var e=i._reactInternals;if(e===void 0)throw typeof i.render=="function"?Error(p(188)):(i=Object.keys(i).join(","),Error(p(268,i)));return i=Zb(e),i=i===null?null:i.stateNode,i},reactDom_production_min.flushSync=function(i){return Rk(i)},reactDom_production_min.hydrate=function(i,e,s){if(!ol(e))throw Error(p(200));return rl(null,i,e,!0,s)},reactDom_production_min.hydrateRoot=function(i,e,s){if(!nl(i))throw Error(p(405));var c=s!=null&&s.hydratedSources||null,h=!1,$="",_=kl;if(s!=null&&(s.unstable_strictMode===!0&&(h=!0),s.identifierPrefix!==void 0&&($=s.identifierPrefix),s.onRecoverableError!==void 0&&(_=s.onRecoverableError)),e=el(e,null,i,1,s??null,h,!1,$,_),i[uf]=e.current,sf(i),c)for(i=0;i<c.length;i++)s=c[i],h=s._getVersion,h=h(s._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[s,h]:e.mutableSourceEagerHydrationData.push(s,h);return new ml(e)},reactDom_production_min.render=function(i,e,s){if(!ol(e))throw Error(p(200));return rl(null,i,e,!1,s)},reactDom_production_min.unmountComponentAtNode=function(i){if(!ol(i))throw Error(p(40));return i._reactRootContainer?(Rk(function(){rl(null,null,i,!1,function(){i._reactRootContainer=null,i[uf]=null})}),!0):!1},reactDom_production_min.unstable_batchedUpdates=Qk,reactDom_production_min.unstable_renderSubtreeIntoContainer=function(i,e,s,c){if(!ol(s))throw Error(p(200));if(i==null||i._reactInternals===void 0)throw Error(p(38));return rl(i,e,s,!1,c)},reactDom_production_min.version="18.3.1-next-f1338f8080-20240426";function checkDCE(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE)}catch(i){console.error(i)}}checkDCE(),reactDom.exports=reactDom_production_min;var reactDomExports=reactDom.exports,createRoot,m=reactDomExports;createRoot=m.createRoot,m.hydrateRoot;const LogoIcon=()=>jsxRuntimeExports.jsxs("svg",{viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("path",{d:"M16 4C9.37 4 4 9.37 4 16s5.37 12 12 12 12-5.37 12-12S22.63 4 16 4z",fill:"#2563eb"}),jsxRuntimeExports.jsx("path",{d:"M16 8c-2.2 0-4 1.8-4 4v4c0 2.2 1.8 4 4 4s4-1.8 4-4v-4c0-2.2-1.8-4-4-4z",fill:"white"}),jsxRuntimeExports.jsx("path",{d:"M22 16c0 3.3-2.7 6-6 6s-6-2.7-6-6H8c0 4.1 3.1 7.5 7 7.9V26h2v-2.1c3.9-.4 7-3.8 7-7.9h-2z",fill:"white"})]}),MicIcon=()=>jsxRuntimeExports.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntimeExports.jsx("path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"}),jsxRuntimeExports.jsx("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),jsxRuntimeExports.jsx("line",{x1:"12",x2:"12",y1:"19",y2:"22"})]}),CloseIcon=()=>jsxRuntimeExports.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntimeExports.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntimeExports.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),MinimizeIcon=()=>jsxRuntimeExports.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntimeExports.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsxRuntimeExports.jsx("path",{d:"M9 3v18"})]}),ErrorIcon=()=>jsxRuntimeExports.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntimeExports.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntimeExports.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),jsxRuntimeExports.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),ChatIcon=()=>jsxRuntimeExports.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntimeExports.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})});function FloatingPanel({children:i,position:e,onClose:s,onMinimize:c}){const h=reactExports.useRef(null),$=reactExports.useRef(!1),_=reactExports.useRef({x:0,y:0,right:20,bottom:20}),j=reactExports.useCallback(et=>{if(et.target.closest("button"))return;$.current=!0;const b=h.current;b&&(_.current={x:et.clientX,y:et.clientY,right:parseInt(b.style.right||"20"),bottom:parseInt(b.style.bottom||"20")})},[]);reactExports.useEffect(()=>{const et=a=>{if(!$.current||!h.current)return;const o=_.current.x-a.clientX,d=_.current.y-a.clientY;h.current.style.right=`${_.current.right+o}px`,h.current.style.bottom=`${_.current.bottom+d}px`},b=()=>{$.current=!1};return document.addEventListener("mousemove",et),document.addEventListener("mouseup",b),()=>{document.removeEventListener("mousemove",et),document.removeEventListener("mouseup",b)}},[]);const nt={bottom:(e==null?void 0:e.bottom)??20,right:(e==null?void 0:e.right)??20,...(e==null?void 0:e.top)!==void 0&&{top:e.top,bottom:"auto"},...(e==null?void 0:e.left)!==void 0&&{left:e.left,right:"auto"}};return jsxRuntimeExports.jsxs("div",{ref:h,className:"scribe-panel",style:nt,children:[jsxRuntimeExports.jsxs("div",{className:"panel-header",onMouseDown:j,children:[jsxRuntimeExports.jsxs("div",{className:"drag-handle",children:[jsxRuntimeExports.jsx("span",{}),jsxRuntimeExports.jsx("span",{}),jsxRuntimeExports.jsx("span",{}),jsxRuntimeExports.jsx("span",{}),jsxRuntimeExports.jsx("span",{}),jsxRuntimeExports.jsx("span",{})]}),jsxRuntimeExports.jsxs("div",{className:"header-actions",children:[jsxRuntimeExports.jsx("button",{className:"header-btn",onClick:c,title:"Minimize",children:jsxRuntimeExports.jsx(MinimizeIcon,{})}),jsxRuntimeExports.jsx("button",{className:"header-btn",onClick:s,title:"Close",children:jsxRuntimeExports.jsx(CloseIcon,{})})]})]}),jsxRuntimeExports.jsx("div",{className:"panel-content",children:i})]})}function ConfigState({onSubmit:i,initialAccessToken:e="",initialBaseUrl:s=""}){const[c,h]=reactExports.useState(e),[$,_]=reactExports.useState(s),[j,nt]=reactExports.useState(""),et=b=>{if(b.preventDefault(),!$.trim()){nt("Base URL is required");return}nt(""),i(c.trim(),$.trim())};return jsxRuntimeExports.jsxs("div",{className:"config-state",style:{zIndex:9999},children:[jsxRuntimeExports.jsxs("div",{className:"logo",children:[jsxRuntimeExports.jsx("div",{className:"logo-icon",children:jsxRuntimeExports.jsx(LogoIcon,{})}),jsxRuntimeExports.jsx("span",{className:"logo-text",children:"eka.scribe"})]}),jsxRuntimeExports.jsxs("form",{className:"config-form",onSubmit:et,children:[jsxRuntimeExports.jsxs("div",{className:"form-group",children:[jsxRuntimeExports.jsx("label",{htmlFor:"eka-access-token",children:"Access Token"}),jsxRuntimeExports.jsx("input",{id:"eka-access-token",type:"text",value:c,onChange:b=>h(b.target.value),placeholder:"Enter your access token (optional)"})]}),jsxRuntimeExports.jsxs("div",{className:"form-group",children:[jsxRuntimeExports.jsx("label",{htmlFor:"eka-base-url",children:"Base URL"}),jsxRuntimeExports.jsx("input",{id:"eka-base-url",type:"text",value:$,onChange:b=>_(b.target.value),placeholder:"https://api.eka.care",required:!0})]}),j&&jsxRuntimeExports.jsx("p",{className:"config-error",children:j}),jsxRuntimeExports.jsx("button",{type:"submit",className:"config-submit-btn",children:"Continue"})]})]})}function IdleState({onStartRecording:i}){return jsxRuntimeExports.jsxs("div",{className:"idle-state",children:[jsxRuntimeExports.jsxs("div",{className:"logo",children:[jsxRuntimeExports.jsx("div",{className:"logo-icon",children:jsxRuntimeExports.jsx(LogoIcon,{})}),jsxRuntimeExports.jsx("span",{className:"logo-text",children:"eka.scribe"})]}),jsxRuntimeExports.jsxs("button",{className:"start-btn",onClick:i,children:["Start Recording",jsxRuntimeExports.jsx("span",{className:"mic-icon",children:jsxRuntimeExports.jsx(MicIcon,{})})]})]})}function PermissionState({onRequestPermission:i}){return jsxRuntimeExports.jsxs("div",{className:"permission-state",children:[jsxRuntimeExports.jsx("div",{className:"permission-icon",children:jsxRuntimeExports.jsx(MicIcon,{})}),jsxRuntimeExports.jsxs("p",{className:"permission-text",children:["Microphone access is required to record audio.",jsxRuntimeExports.jsx("br",{}),"Please allow access when prompted."]}),jsxRuntimeExports.jsx("button",{className:"permission-btn",onClick:i,children:"Allow Microphone"})]})}function formatTime(i){const e=Math.floor(i/60),s=i%60;return`${e.toString().padStart(2,"0")}:${s.toString().padStart(2,"0")}`}function RecordingState({elapsedTime:i,isPaused:e,onPause:s,onResume:c,onStop:h}){return jsxRuntimeExports.jsxs("div",{className:"recording-state",children:[jsxRuntimeExports.jsxs("div",{className:"recording-indicator",children:[jsxRuntimeExports.jsx("div",{className:`recording-icon ${e?"":"active"}`,children:jsxRuntimeExports.jsx(ChatIcon,{})}),jsxRuntimeExports.jsx("span",{className:"timer",children:formatTime(i)})]}),jsxRuntimeExports.jsxs("div",{className:"recording-actions",children:[e?jsxRuntimeExports.jsx("button",{className:"resume-btn",onClick:c,children:"Resume"}):jsxRuntimeExports.jsx("button",{className:"pause-btn",onClick:s,children:"Pause"}),jsxRuntimeExports.jsx("button",{className:"stop-btn",onClick:h,title:"Stop recording",children:jsxRuntimeExports.jsx("div",{className:"stop-icon"})})]})]})}function ProcessingState(){return jsxRuntimeExports.jsxs("div",{className:"processing-state",children:[jsxRuntimeExports.jsx("div",{className:"spinner"}),jsxRuntimeExports.jsx("p",{className:"processing-text",children:"Processing your recording..."})]})}const EMR_LIST=[{id:"eka_emr",name:"Eka EMR",description:"Eka Care Electronic Medical Records"},{id:"open_emr",name:"OpenEMR",description:"Open-source Electronic Health Records"},{id:"open_mrs",name:"OpenMRS",description:"Open Medical Record System"}];function ResultsState({result:i,onNewRecording:e,onSelectEMR:s}){return console.log("prescription result - WIDGET",i),jsxRuntimeExports.jsxs("div",{className:"results-state",children:[jsxRuntimeExports.jsxs("div",{className:"results-header",children:[jsxRuntimeExports.jsx("span",{className:"results-title",children:"Recording Complete"}),jsxRuntimeExports.jsx("button",{className:"new-recording-btn",onClick:e,children:"New Recording"})]}),jsxRuntimeExports.jsxs("div",{className:"results-content",children:[jsxRuntimeExports.jsxs("div",{className:"transcript-section",children:[jsxRuntimeExports.jsx("div",{className:"section-title",children:"Transcript"}),jsxRuntimeExports.jsx("div",{className:"transcript-text",children:i.transcript||"No transcript available."})]}),jsxRuntimeExports.jsxs("div",{className:"emr-section",children:[jsxRuntimeExports.jsx("div",{className:"section-title",children:"Integrated EMRs"}),jsxRuntimeExports.jsx("div",{className:"emr-list-inline",children:EMR_LIST.map(c=>jsxRuntimeExports.jsxs("button",{className:"emr-item",onClick:()=>s(c.id),children:[jsxRuntimeExports.jsxs("div",{className:"emr-item-info",children:[jsxRuntimeExports.jsx("span",{className:"emr-item-name",children:c.name}),jsxRuntimeExports.jsx("span",{className:"emr-item-desc",children:c.description})]}),jsxRuntimeExports.jsx("svg",{className:"emr-item-arrow",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntimeExports.jsx("path",{d:"M9 18l6-6-6-6"})})]},c.id))})]})]})]})}function ErrorState({message:i,onRetry:e}){return jsxRuntimeExports.jsxs("div",{className:"error-state",children:[jsxRuntimeExports.jsx("div",{className:"error-icon",children:jsxRuntimeExports.jsx(ErrorIcon,{})}),jsxRuntimeExports.jsx("p",{className:"error-message",children:i}),jsxRuntimeExports.jsx("button",{className:"retry-btn",onClick:e,children:"Try Again"})]})}function PollingErrorState({message:i,onRetry:e,onStartNew:s}){return jsxRuntimeExports.jsxs("div",{className:"polling-error-state",children:[jsxRuntimeExports.jsx("div",{className:"error-icon",children:jsxRuntimeExports.jsx(ErrorIcon,{})}),jsxRuntimeExports.jsx("p",{className:"error-message",children:i}),jsxRuntimeExports.jsxs("div",{className:"polling-error-actions",children:[jsxRuntimeExports.jsx("button",{className:"retry-polling-btn",onClick:e,children:"Retry Fetching Results"}),jsxRuntimeExports.jsx("button",{className:"start-new-btn",onClick:s,children:"Start New Recording"})]})]})}const WELL_KNOWN_PATH="/.well-known/medscribealliance";var SessionStatus;(function(i){i.CREATED="created",i.PROCESSING="processing",i.COMPLETED="completed",i.PARTIAL="partial",i.FAILED="failed"})(SessionStatus||(SessionStatus={}));var TemplateStatus;(function(i){i.SUCCESS="success",i.FAILED="failed"})(TemplateStatus||(TemplateStatus={}));var UploadType;(function(i){i.CHUNKED="chunked",i.SINGLE="single"})(UploadType||(UploadType={}));var ErrorCode;(function(i){i.AUTHENTICATION_FAILED="authentication_failed",i.TOKEN_EXPIRED="token_expired",i.INVALID_API_KEY="invalid_api_key",i.FORBIDDEN="forbidden",i.RATE_LIMIT_EXCEEDED="rate_limit_exceeded",i.SESSION_NOT_FOUND="session_not_found",i.TEMPLATE_NOT_FOUND="template_not_found",i.WEBHOOK_NOT_FOUND="webhook_not_found",i.SESSION_EXPIRED="session_expired",i.INVALID_REQUEST="invalid_request",i.INVALID_AUDIO_FORMAT="invalid_audio_format",i.CHUNK_TOO_LARGE="chunk_too_large",i.INVALID_TEMPLATE="invalid_template",i.MISSING_REQUIRED_FIELD="missing_required_field",i.PROCESSING_FAILED="processing_failed",i.AUDIO_QUALITY_POOR="audio_quality_poor",i.AUDIO_TOO_SHORT="audio_too_short",i.LANGUAGE_UNSUPPORTED="language_unsupported",i.INTERNAL_ERROR="internal_error",i.SERVICE_UNAVAILABLE="service_unavailable"})(ErrorCode||(ErrorCode={}));var HttpStatus;(function(i){i[i.OK=200]="OK",i[i.CREATED=201]="CREATED",i[i.ACCEPTED=202]="ACCEPTED",i[i.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",i[i.BAD_REQUEST=400]="BAD_REQUEST",i[i.UNAUTHORIZED=401]="UNAUTHORIZED",i[i.FORBIDDEN=403]="FORBIDDEN",i[i.NOT_FOUND=404]="NOT_FOUND",i[i.GONE=410]="GONE",i[i.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",i[i.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",i[i.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",i[i.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE"})(HttpStatus||(HttpStatus={}));class DiscoveryAPI{constructor(e){this.cachedDiscovery=null,this.cacheTimestamp=0,this.cacheDuration=3600*1e3,this.httpClient=e}async getDiscovery(e,s=!1){const c=Date.now();if(!s&&this.cachedDiscovery&&c-this.cacheTimestamp<this.cacheDuration)return this.cachedDiscovery;const h=e+WELL_KNOWN_PATH,$=await this.httpClient.get(h);return this.cachedDiscovery=$,this.cacheTimestamp=c,$}clearCache(){this.cachedDiscovery=null,this.cacheTimestamp=0}getCachedDiscovery(){const e=Date.now();return this.cachedDiscovery&&e-this.cacheTimestamp<this.cacheDuration?this.cachedDiscovery:null}}var ajv={exports:{}},core$2={},validate={},boolSchema={},errors={},codegen={},code$1={};(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.regexpCode=i.getEsmExportName=i.getProperty=i.safeStringify=i.stringify=i.strConcat=i.addCodeArg=i.str=i._=i.nil=i._Code=i.Name=i.IDENTIFIER=i._CodeOrName=void 0;class e{}i._CodeOrName=e,i.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class s extends e{constructor(ot){if(super(),!i.IDENTIFIER.test(ot))throw new Error("CodeGen: name must be a valid identifier");this.str=ot}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}i.Name=s;class c extends e{constructor(ot){super(),this._items=typeof ot=="string"?[ot]:ot}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const ot=this._items[0];return ot===""||ot==='""'}get str(){var ot;return(ot=this._str)!==null&&ot!==void 0?ot:this._str=this._items.reduce((rt,at)=>`${rt}${at}`,"")}get names(){var ot;return(ot=this._names)!==null&&ot!==void 0?ot:this._names=this._items.reduce((rt,at)=>(at instanceof s&&(rt[at.str]=(rt[at.str]||0)+1),rt),{})}}i._Code=c,i.nil=new c("");function h(tt,...ot){const rt=[tt[0]];let at=0;for(;at<ot.length;)j(rt,ot[at]),rt.push(tt[++at]);return new c(rt)}i._=h;const $=new c("+");function _(tt,...ot){const rt=[d(tt[0])];let at=0;for(;at<ot.length;)rt.push($),j(rt,ot[at]),rt.push($,d(tt[++at]));return nt(rt),new c(rt)}i.str=_;function j(tt,ot){ot instanceof c?tt.push(...ot._items):ot instanceof s?tt.push(ot):tt.push(a(ot))}i.addCodeArg=j;function nt(tt){let ot=1;for(;ot<tt.length-1;){if(tt[ot]===$){const rt=et(tt[ot-1],tt[ot+1]);if(rt!==void 0){tt.splice(ot-1,3,rt);continue}tt[ot++]="+"}ot++}}function et(tt,ot){if(ot==='""')return tt;if(tt==='""')return ot;if(typeof tt=="string")return ot instanceof s||tt[tt.length-1]!=='"'?void 0:typeof ot!="string"?`${tt.slice(0,-1)}${ot}"`:ot[0]==='"'?tt.slice(0,-1)+ot.slice(1):void 0;if(typeof ot=="string"&&ot[0]==='"'&&!(tt instanceof s))return`"${tt}${ot.slice(1)}`}function b(tt,ot){return ot.emptyStr()?tt:tt.emptyStr()?ot:_`${tt}${ot}`}i.strConcat=b;function a(tt){return typeof tt=="number"||typeof tt=="boolean"||tt===null?tt:d(Array.isArray(tt)?tt.join(","):tt)}function o(tt){return new c(d(tt))}i.stringify=o;function d(tt){return JSON.stringify(tt).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}i.safeStringify=d;function g(tt){return typeof tt=="string"&&i.IDENTIFIER.test(tt)?new c(`.${tt}`):h`[${tt}]`}i.getProperty=g;function it(tt){if(typeof tt=="string"&&i.IDENTIFIER.test(tt))return new c(`${tt}`);throw new Error(`CodeGen: invalid export name: ${tt}, use explicit $id name mapping`)}i.getEsmExportName=it;function st(tt){return new c(tt.toString())}i.regexpCode=st})(code$1);var scope={};(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.ValueScope=i.ValueScopeName=i.Scope=i.varKinds=i.UsedValueState=void 0;const e=code$1;class s extends Error{constructor(et){super(`CodeGen: "code" for ${et} not defined`),this.value=et.value}}var c;(function(nt){nt[nt.Started=0]="Started",nt[nt.Completed=1]="Completed"})(c||(i.UsedValueState=c={})),i.varKinds={const:new e.Name("const"),let:new e.Name("let"),var:new e.Name("var")};class h{constructor({prefixes:et,parent:b}={}){this._names={},this._prefixes=et,this._parent=b}toName(et){return et instanceof e.Name?et:this.name(et)}name(et){return new e.Name(this._newName(et))}_newName(et){const b=this._names[et]||this._nameGroup(et);return`${et}${b.index++}`}_nameGroup(et){var b,a;if(!((a=(b=this._parent)===null||b===void 0?void 0:b._prefixes)===null||a===void 0)&&a.has(et)||this._prefixes&&!this._prefixes.has(et))throw new Error(`CodeGen: prefix "${et}" is not allowed in this scope`);return this._names[et]={prefix:et,index:0}}}i.Scope=h;class $ extends e.Name{constructor(et,b){super(b),this.prefix=et}setValue(et,{property:b,itemIndex:a}){this.value=et,this.scopePath=(0,e._)`.${new e.Name(b)}[${a}]`}}i.ValueScopeName=$;const _=(0,e._)`\n`;class j extends h{constructor(et){super(et),this._values={},this._scope=et.scope,this.opts={...et,_n:et.lines?_:e.nil}}get(){return this._scope}name(et){return new $(et,this._newName(et))}value(et,b){var a;if(b.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const o=this.toName(et),{prefix:d}=o,g=(a=b.key)!==null&&a!==void 0?a:b.ref;let it=this._values[d];if(it){const ot=it.get(g);if(ot)return ot}else it=this._values[d]=new Map;it.set(g,o);const st=this._scope[d]||(this._scope[d]=[]),tt=st.length;return st[tt]=b.ref,o.setValue(b,{property:d,itemIndex:tt}),o}getValue(et,b){const a=this._values[et];if(a)return a.get(b)}scopeRefs(et,b=this._values){return this._reduceValues(b,a=>{if(a.scopePath===void 0)throw new Error(`CodeGen: name "${a}" has no value`);return(0,e._)`${et}${a.scopePath}`})}scopeCode(et=this._values,b,a){return this._reduceValues(et,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},b,a)}_reduceValues(et,b,a={},o){let d=e.nil;for(const g in et){const it=et[g];if(!it)continue;const st=a[g]=a[g]||new Map;it.forEach(tt=>{if(st.has(tt))return;st.set(tt,c.Started);let ot=b(tt);if(ot){const rt=this.opts.es5?i.varKinds.var:i.varKinds.const;d=(0,e._)`${d}${rt} ${tt} = ${ot};${this.opts._n}`}else if(ot=o==null?void 0:o(tt))d=(0,e._)`${d}${ot}${this.opts._n}`;else throw new s(tt);st.set(tt,c.Completed)})}return d}}i.ValueScope=j})(scope),function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.or=i.and=i.not=i.CodeGen=i.operators=i.varKinds=i.ValueScopeName=i.ValueScope=i.Scope=i.Name=i.regexpCode=i.stringify=i.getProperty=i.nil=i.strConcat=i.str=i._=void 0;const e=code$1,s=scope;var c=code$1;Object.defineProperty(i,"_",{enumerable:!0,get:function(){return c._}}),Object.defineProperty(i,"str",{enumerable:!0,get:function(){return c.str}}),Object.defineProperty(i,"strConcat",{enumerable:!0,get:function(){return c.strConcat}}),Object.defineProperty(i,"nil",{enumerable:!0,get:function(){return c.nil}}),Object.defineProperty(i,"getProperty",{enumerable:!0,get:function(){return c.getProperty}}),Object.defineProperty(i,"stringify",{enumerable:!0,get:function(){return c.stringify}}),Object.defineProperty(i,"regexpCode",{enumerable:!0,get:function(){return c.regexpCode}}),Object.defineProperty(i,"Name",{enumerable:!0,get:function(){return c.Name}});var h=scope;Object.defineProperty(i,"Scope",{enumerable:!0,get:function(){return h.Scope}}),Object.defineProperty(i,"ValueScope",{enumerable:!0,get:function(){return h.ValueScope}}),Object.defineProperty(i,"ValueScopeName",{enumerable:!0,get:function(){return h.ValueScopeName}}),Object.defineProperty(i,"varKinds",{enumerable:!0,get:function(){return h.varKinds}}),i.operators={GT:new e._Code(">"),GTE:new e._Code(">="),LT:new e._Code("<"),LTE:new e._Code("<="),EQ:new e._Code("==="),NEQ:new e._Code("!=="),NOT:new e._Code("!"),OR:new e._Code("||"),AND:new e._Code("&&"),ADD:new e._Code("+")};class ${optimizeNodes(){return this}optimizeNames(pt,yt){return this}}class _ extends ${constructor(pt,yt,Ct){super(),this.varKind=pt,this.name=yt,this.rhs=Ct}render({es5:pt,_n:yt}){const Ct=pt?s.varKinds.var:this.varKind,Ut=this.rhs===void 0?"":` = ${this.rhs}`;return`${Ct} ${this.name}${Ut};`+yt}optimizeNames(pt,yt){if(pt[this.name.str])return this.rhs&&(this.rhs=vt(this.rhs,pt,yt)),this}get names(){return this.rhs instanceof e._CodeOrName?this.rhs.names:{}}}class j extends ${constructor(pt,yt,Ct){super(),this.lhs=pt,this.rhs=yt,this.sideEffects=Ct}render({_n:pt}){return`${this.lhs} = ${this.rhs};`+pt}optimizeNames(pt,yt){if(!(this.lhs instanceof e.Name&&!pt[this.lhs.str]&&!this.sideEffects))return this.rhs=vt(this.rhs,pt,yt),this}get names(){const pt=this.lhs instanceof e.Name?{}:{...this.lhs.names};return Tt(pt,this.rhs)}}class nt extends j{constructor(pt,yt,Ct,Ut){super(pt,Ct,Ut),this.op=yt}render({_n:pt}){return`${this.lhs} ${this.op}= ${this.rhs};`+pt}}class et extends ${constructor(pt){super(),this.label=pt,this.names={}}render({_n:pt}){return`${this.label}:`+pt}}class b extends ${constructor(pt){super(),this.label=pt,this.names={}}render({_n:pt}){return`break${this.label?` ${this.label}`:""};`+pt}}class a extends ${constructor(pt){super(),this.error=pt}render({_n:pt}){return`throw ${this.error};`+pt}get names(){return this.error.names}}class o extends ${constructor(pt){super(),this.code=pt}render({_n:pt}){return`${this.code};`+pt}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(pt,yt){return this.code=vt(this.code,pt,yt),this}get names(){return this.code instanceof e._CodeOrName?this.code.names:{}}}class d extends ${constructor(pt=[]){super(),this.nodes=pt}render(pt){return this.nodes.reduce((yt,Ct)=>yt+Ct.render(pt),"")}optimizeNodes(){const{nodes:pt}=this;let yt=pt.length;for(;yt--;){const Ct=pt[yt].optimizeNodes();Array.isArray(Ct)?pt.splice(yt,1,...Ct):Ct?pt[yt]=Ct:pt.splice(yt,1)}return pt.length>0?this:void 0}optimizeNames(pt,yt){const{nodes:Ct}=this;let Ut=Ct.length;for(;Ut--;){const Nt=Ct[Ut];Nt.optimizeNames(pt,yt)||($t(pt,Nt.names),Ct.splice(Ut,1))}return Ct.length>0?this:void 0}get names(){return this.nodes.reduce((pt,yt)=>bt(pt,yt.names),{})}}class g extends d{render(pt){return"{"+pt._n+super.render(pt)+"}"+pt._n}}class it extends d{}class st extends g{}st.kind="else";class tt extends g{constructor(pt,yt){super(yt),this.condition=pt}render(pt){let yt=`if(${this.condition})`+super.render(pt);return this.else&&(yt+="else "+this.else.render(pt)),yt}optimizeNodes(){super.optimizeNodes();const pt=this.condition;if(pt===!0)return this.nodes;let yt=this.else;if(yt){const Ct=yt.optimizeNodes();yt=this.else=Array.isArray(Ct)?new st(Ct):Ct}if(yt)return pt===!1?yt instanceof tt?yt:yt.nodes:this.nodes.length?this:new tt(At(pt),yt instanceof tt?[yt]:yt.nodes);if(!(pt===!1||!this.nodes.length))return this}optimizeNames(pt,yt){var Ct;if(this.else=(Ct=this.else)===null||Ct===void 0?void 0:Ct.optimizeNames(pt,yt),!!(super.optimizeNames(pt,yt)||this.else))return this.condition=vt(this.condition,pt,yt),this}get names(){const pt=super.names;return Tt(pt,this.condition),this.else&&bt(pt,this.else.names),pt}}tt.kind="if";class ot extends g{}ot.kind="for";class rt extends ot{constructor(pt){super(),this.iteration=pt}render(pt){return`for(${this.iteration})`+super.render(pt)}optimizeNames(pt,yt){if(super.optimizeNames(pt,yt))return this.iteration=vt(this.iteration,pt,yt),this}get names(){return bt(super.names,this.iteration.names)}}class at extends ot{constructor(pt,yt,Ct,Ut){super(),this.varKind=pt,this.name=yt,this.from=Ct,this.to=Ut}render(pt){const yt=pt.es5?s.varKinds.var:this.varKind,{name:Ct,from:Ut,to:Nt}=this;return`for(${yt} ${Ct}=${Ut}; ${Ct}<${Nt}; ${Ct}++)`+super.render(pt)}get names(){const pt=Tt(super.names,this.from);return Tt(pt,this.to)}}class ut extends ot{constructor(pt,yt,Ct,Ut){super(),this.loop=pt,this.varKind=yt,this.name=Ct,this.iterable=Ut}render(pt){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(pt)}optimizeNames(pt,yt){if(super.optimizeNames(pt,yt))return this.iterable=vt(this.iterable,pt,yt),this}get names(){return bt(super.names,this.iterable.names)}}class lt extends g{constructor(pt,yt,Ct){super(),this.name=pt,this.args=yt,this.async=Ct}render(pt){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(pt)}}lt.kind="func";class ct extends d{render(pt){return"return "+super.render(pt)}}ct.kind="return";class ft extends g{render(pt){let yt="try"+super.render(pt);return this.catch&&(yt+=this.catch.render(pt)),this.finally&&(yt+=this.finally.render(pt)),yt}optimizeNodes(){var pt,yt;return super.optimizeNodes(),(pt=this.catch)===null||pt===void 0||pt.optimizeNodes(),(yt=this.finally)===null||yt===void 0||yt.optimizeNodes(),this}optimizeNames(pt,yt){var Ct,Ut;return super.optimizeNames(pt,yt),(Ct=this.catch)===null||Ct===void 0||Ct.optimizeNames(pt,yt),(Ut=this.finally)===null||Ut===void 0||Ut.optimizeNames(pt,yt),this}get names(){const pt=super.names;return this.catch&&bt(pt,this.catch.names),this.finally&&bt(pt,this.finally.names),pt}}class dt extends g{constructor(pt){super(),this.error=pt}render(pt){return`catch(${this.error})`+super.render(pt)}}dt.kind="catch";class _t extends g{render(pt){return"finally"+super.render(pt)}}_t.kind="finally";class wt{constructor(pt,yt={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...yt,_n:yt.lines?`
41
41
  `:""},this._extScope=pt,this._scope=new s.Scope({parent:pt}),this._nodes=[new it]}toString(){return this._root.render(this.opts)}name(pt){return this._scope.name(pt)}scopeName(pt){return this._extScope.name(pt)}scopeValue(pt,yt){const Ct=this._extScope.value(pt,yt);return(this._values[Ct.prefix]||(this._values[Ct.prefix]=new Set)).add(Ct),Ct}getScopeValue(pt,yt){return this._extScope.getValue(pt,yt)}scopeRefs(pt){return this._extScope.scopeRefs(pt,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(pt,yt,Ct,Ut){const Nt=this._scope.toName(yt);return Ct!==void 0&&Ut&&(this._constants[Nt.str]=Ct),this._leafNode(new _(pt,Nt,Ct)),Nt}const(pt,yt,Ct){return this._def(s.varKinds.const,pt,yt,Ct)}let(pt,yt,Ct){return this._def(s.varKinds.let,pt,yt,Ct)}var(pt,yt,Ct){return this._def(s.varKinds.var,pt,yt,Ct)}assign(pt,yt,Ct){return this._leafNode(new j(pt,yt,Ct))}add(pt,yt){return this._leafNode(new nt(pt,i.operators.ADD,yt))}code(pt){return typeof pt=="function"?pt():pt!==e.nil&&this._leafNode(new o(pt)),this}object(...pt){const yt=["{"];for(const[Ct,Ut]of pt)yt.length>1&&yt.push(","),yt.push(Ct),(Ct!==Ut||this.opts.es5)&&(yt.push(":"),(0,e.addCodeArg)(yt,Ut));return yt.push("}"),new e._Code(yt)}if(pt,yt,Ct){if(this._blockNode(new tt(pt)),yt&&Ct)this.code(yt).else().code(Ct).endIf();else if(yt)this.code(yt).endIf();else if(Ct)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(pt){return this._elseNode(new tt(pt))}else(){return this._elseNode(new st)}endIf(){return this._endBlockNode(tt,st)}_for(pt,yt){return this._blockNode(pt),yt&&this.code(yt).endFor(),this}for(pt,yt){return this._for(new rt(pt),yt)}forRange(pt,yt,Ct,Ut,Nt=this.opts.es5?s.varKinds.var:s.varKinds.let){const Ht=this._scope.toName(pt);return this._for(new at(Nt,Ht,yt,Ct),()=>Ut(Ht))}forOf(pt,yt,Ct,Ut=s.varKinds.const){const Nt=this._scope.toName(pt);if(this.opts.es5){const Ht=yt instanceof e.Name?yt:this.var("_arr",yt);return this.forRange("_i",0,(0,e._)`${Ht}.length`,Jt=>{this.var(Nt,(0,e._)`${Ht}[${Jt}]`),Ct(Nt)})}return this._for(new ut("of",Ut,Nt,yt),()=>Ct(Nt))}forIn(pt,yt,Ct,Ut=this.opts.es5?s.varKinds.var:s.varKinds.const){if(this.opts.ownProperties)return this.forOf(pt,(0,e._)`Object.keys(${yt})`,Ct);const Nt=this._scope.toName(pt);return this._for(new ut("in",Ut,Nt,yt),()=>Ct(Nt))}endFor(){return this._endBlockNode(ot)}label(pt){return this._leafNode(new et(pt))}break(pt){return this._leafNode(new b(pt))}return(pt){const yt=new ct;if(this._blockNode(yt),this.code(pt),yt.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(ct)}try(pt,yt,Ct){if(!yt&&!Ct)throw new Error('CodeGen: "try" without "catch" and "finally"');const Ut=new ft;if(this._blockNode(Ut),this.code(pt),yt){const Nt=this.name("e");this._currNode=Ut.catch=new dt(Nt),yt(Nt)}return Ct&&(this._currNode=Ut.finally=new _t,this.code(Ct)),this._endBlockNode(dt,_t)}throw(pt){return this._leafNode(new a(pt))}block(pt,yt){return this._blockStarts.push(this._nodes.length),pt&&this.code(pt).endBlock(yt),this}endBlock(pt){const yt=this._blockStarts.pop();if(yt===void 0)throw new Error("CodeGen: not in self-balancing block");const Ct=this._nodes.length-yt;if(Ct<0||pt!==void 0&&Ct!==pt)throw new Error(`CodeGen: wrong number of nodes: ${Ct} vs ${pt} expected`);return this._nodes.length=yt,this}func(pt,yt=e.nil,Ct,Ut){return this._blockNode(new lt(pt,yt,Ct)),Ut&&this.code(Ut).endFunc(),this}endFunc(){return this._endBlockNode(lt)}optimize(pt=1){for(;pt-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(pt){return this._currNode.nodes.push(pt),this}_blockNode(pt){this._currNode.nodes.push(pt),this._nodes.push(pt)}_endBlockNode(pt,yt){const Ct=this._currNode;if(Ct instanceof pt||yt&&Ct instanceof yt)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${yt?`${pt.kind}/${yt.kind}`:pt.kind}"`)}_elseNode(pt){const yt=this._currNode;if(!(yt instanceof tt))throw new Error('CodeGen: "else" without "if"');return this._currNode=yt.else=pt,this}get _root(){return this._nodes[0]}get _currNode(){const pt=this._nodes;return pt[pt.length-1]}set _currNode(pt){const yt=this._nodes;yt[yt.length-1]=pt}}i.CodeGen=wt;function bt(ht,pt){for(const yt in pt)ht[yt]=(ht[yt]||0)+(pt[yt]||0);return ht}function Tt(ht,pt){return pt instanceof e._CodeOrName?bt(ht,pt.names):ht}function vt(ht,pt,yt){if(ht instanceof e.Name)return Ct(ht);if(!Ut(ht))return ht;return new e._Code(ht._items.reduce((Nt,Ht)=>(Ht instanceof e.Name&&(Ht=Ct(Ht)),Ht instanceof e._Code?Nt.push(...Ht._items):Nt.push(Ht),Nt),[]));function Ct(Nt){const Ht=yt[Nt.str];return Ht===void 0||pt[Nt.str]!==1?Nt:(delete pt[Nt.str],Ht)}function Ut(Nt){return Nt instanceof e._Code&&Nt._items.some(Ht=>Ht instanceof e.Name&&pt[Ht.str]===1&&yt[Ht.str]!==void 0)}}function $t(ht,pt){for(const yt in pt)ht[yt]=(ht[yt]||0)-(pt[yt]||0)}function At(ht){return typeof ht=="boolean"||typeof ht=="number"||ht===null?!ht:(0,e._)`!${gt(ht)}`}i.not=At;const Ot=mt(i.operators.AND);function It(...ht){return ht.reduce(Ot)}i.and=It;const jt=mt(i.operators.OR);function Et(...ht){return ht.reduce(jt)}i.or=Et;function mt(ht){return(pt,yt)=>pt===e.nil?yt:yt===e.nil?pt:(0,e._)`${gt(pt)} ${ht} ${gt(yt)}`}function gt(ht){return ht instanceof e.Name?ht:(0,e._)`(${ht})`}}(codegen);var util={};Object.defineProperty(util,"__esModule",{value:!0}),util.checkStrictMode=util.getErrorPath=util.Type=util.useFunc=util.setEvaluated=util.evaluatedPropsToName=util.mergeEvaluated=util.eachItem=util.unescapeJsonPointer=util.escapeJsonPointer=util.escapeFragment=util.unescapeFragment=util.schemaRefOrVal=util.schemaHasRulesButRef=util.schemaHasRules=util.checkUnknownRules=util.alwaysValidSchema=util.toHash=void 0;const codegen_1$v=codegen,code_1$a=code$1;function toHash(i){const e={};for(const s of i)e[s]=!0;return e}util.toHash=toHash;function alwaysValidSchema(i,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(checkUnknownRules(i,e),!schemaHasRules(e,i.self.RULES.all))}util.alwaysValidSchema=alwaysValidSchema;function checkUnknownRules(i,e=i.schema){const{opts:s,self:c}=i;if(!s.strictSchema||typeof e=="boolean")return;const h=c.RULES.keywords;for(const $ in e)h[$]||checkStrictMode(i,`unknown keyword: "${$}"`)}util.checkUnknownRules=checkUnknownRules;function schemaHasRules(i,e){if(typeof i=="boolean")return!i;for(const s in i)if(e[s])return!0;return!1}util.schemaHasRules=schemaHasRules;function schemaHasRulesButRef(i,e){if(typeof i=="boolean")return!i;for(const s in i)if(s!=="$ref"&&e.all[s])return!0;return!1}util.schemaHasRulesButRef=schemaHasRulesButRef;function schemaRefOrVal({topSchemaRef:i,schemaPath:e},s,c,h){if(!h){if(typeof s=="number"||typeof s=="boolean")return s;if(typeof s=="string")return(0,codegen_1$v._)`${s}`}return(0,codegen_1$v._)`${i}${e}${(0,codegen_1$v.getProperty)(c)}`}util.schemaRefOrVal=schemaRefOrVal;function unescapeFragment(i){return unescapeJsonPointer(decodeURIComponent(i))}util.unescapeFragment=unescapeFragment;function escapeFragment(i){return encodeURIComponent(escapeJsonPointer(i))}util.escapeFragment=escapeFragment;function escapeJsonPointer(i){return typeof i=="number"?`${i}`:i.replace(/~/g,"~0").replace(/\//g,"~1")}util.escapeJsonPointer=escapeJsonPointer;function unescapeJsonPointer(i){return i.replace(/~1/g,"/").replace(/~0/g,"~")}util.unescapeJsonPointer=unescapeJsonPointer;function eachItem(i,e){if(Array.isArray(i))for(const s of i)e(s);else e(i)}util.eachItem=eachItem;function makeMergeEvaluated({mergeNames:i,mergeToName:e,mergeValues:s,resultToName:c}){return(h,$,_,j)=>{const nt=_===void 0?$:_ instanceof codegen_1$v.Name?($ instanceof codegen_1$v.Name?i(h,$,_):e(h,$,_),_):$ instanceof codegen_1$v.Name?(e(h,_,$),$):s($,_);return j===codegen_1$v.Name&&!(nt instanceof codegen_1$v.Name)?c(h,nt):nt}}util.mergeEvaluated={props:makeMergeEvaluated({mergeNames:(i,e,s)=>i.if((0,codegen_1$v._)`${s} !== true && ${e} !== undefined`,()=>{i.if((0,codegen_1$v._)`${e} === true`,()=>i.assign(s,!0),()=>i.assign(s,(0,codegen_1$v._)`${s} || {}`).code((0,codegen_1$v._)`Object.assign(${s}, ${e})`))}),mergeToName:(i,e,s)=>i.if((0,codegen_1$v._)`${s} !== true`,()=>{e===!0?i.assign(s,!0):(i.assign(s,(0,codegen_1$v._)`${s} || {}`),setEvaluated(i,s,e))}),mergeValues:(i,e)=>i===!0?!0:{...i,...e},resultToName:evaluatedPropsToName}),items:makeMergeEvaluated({mergeNames:(i,e,s)=>i.if((0,codegen_1$v._)`${s} !== true && ${e} !== undefined`,()=>i.assign(s,(0,codegen_1$v._)`${e} === true ? true : ${s} > ${e} ? ${s} : ${e}`)),mergeToName:(i,e,s)=>i.if((0,codegen_1$v._)`${s} !== true`,()=>i.assign(s,e===!0?!0:(0,codegen_1$v._)`${s} > ${e} ? ${s} : ${e}`)),mergeValues:(i,e)=>i===!0?!0:Math.max(i,e),resultToName:(i,e)=>i.var("items",e)})};function evaluatedPropsToName(i,e){if(e===!0)return i.var("props",!0);const s=i.var("props",(0,codegen_1$v._)`{}`);return e!==void 0&&setEvaluated(i,s,e),s}util.evaluatedPropsToName=evaluatedPropsToName;function setEvaluated(i,e,s){Object.keys(s).forEach(c=>i.assign((0,codegen_1$v._)`${e}${(0,codegen_1$v.getProperty)(c)}`,!0))}util.setEvaluated=setEvaluated;const snippets={};function useFunc(i,e){return i.scopeValue("func",{ref:e,code:snippets[e.code]||(snippets[e.code]=new code_1$a._Code(e.code))})}util.useFunc=useFunc;var Type;(function(i){i[i.Num=0]="Num",i[i.Str=1]="Str"})(Type||(util.Type=Type={}));function getErrorPath(i,e,s){if(i instanceof codegen_1$v.Name){const c=e===Type.Num;return s?c?(0,codegen_1$v._)`"[" + ${i} + "]"`:(0,codegen_1$v._)`"['" + ${i} + "']"`:c?(0,codegen_1$v._)`"/" + ${i}`:(0,codegen_1$v._)`"/" + ${i}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return s?(0,codegen_1$v.getProperty)(i).toString():"/"+escapeJsonPointer(i)}util.getErrorPath=getErrorPath;function checkStrictMode(i,e,s=i.opts.strictSchema){if(s){if(e=`strict mode: ${e}`,s===!0)throw new Error(e);i.self.logger.warn(e)}}util.checkStrictMode=checkStrictMode;var names$1={};Object.defineProperty(names$1,"__esModule",{value:!0});const codegen_1$u=codegen,names={data:new codegen_1$u.Name("data"),valCxt:new codegen_1$u.Name("valCxt"),instancePath:new codegen_1$u.Name("instancePath"),parentData:new codegen_1$u.Name("parentData"),parentDataProperty:new codegen_1$u.Name("parentDataProperty"),rootData:new codegen_1$u.Name("rootData"),dynamicAnchors:new codegen_1$u.Name("dynamicAnchors"),vErrors:new codegen_1$u.Name("vErrors"),errors:new codegen_1$u.Name("errors"),this:new codegen_1$u.Name("this"),self:new codegen_1$u.Name("self"),scope:new codegen_1$u.Name("scope"),json:new codegen_1$u.Name("json"),jsonPos:new codegen_1$u.Name("jsonPos"),jsonLen:new codegen_1$u.Name("jsonLen"),jsonPart:new codegen_1$u.Name("jsonPart")};names$1.default=names,function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.extendErrors=i.resetErrorsCount=i.reportExtraError=i.reportError=i.keyword$DataError=i.keywordError=void 0;const e=codegen,s=util,c=names$1;i.keywordError={message:({keyword:st})=>(0,e.str)`must pass "${st}" keyword validation`},i.keyword$DataError={message:({keyword:st,schemaType:tt})=>tt?(0,e.str)`"${st}" keyword must be ${tt} ($data)`:(0,e.str)`"${st}" keyword is invalid ($data)`};function h(st,tt=i.keywordError,ot,rt){const{it:at}=st,{gen:ut,compositeRule:lt,allErrors:ct}=at,ft=a(st,tt,ot);rt??(lt||ct)?nt(ut,ft):et(at,(0,e._)`[${ft}]`)}i.reportError=h;function $(st,tt=i.keywordError,ot){const{it:rt}=st,{gen:at,compositeRule:ut,allErrors:lt}=rt,ct=a(st,tt,ot);nt(at,ct),ut||lt||et(rt,c.default.vErrors)}i.reportExtraError=$;function _(st,tt){st.assign(c.default.errors,tt),st.if((0,e._)`${c.default.vErrors} !== null`,()=>st.if(tt,()=>st.assign((0,e._)`${c.default.vErrors}.length`,tt),()=>st.assign(c.default.vErrors,null)))}i.resetErrorsCount=_;function j({gen:st,keyword:tt,schemaValue:ot,data:rt,errsCount:at,it:ut}){if(at===void 0)throw new Error("ajv implementation error");const lt=st.name("err");st.forRange("i",at,c.default.errors,ct=>{st.const(lt,(0,e._)`${c.default.vErrors}[${ct}]`),st.if((0,e._)`${lt}.instancePath === undefined`,()=>st.assign((0,e._)`${lt}.instancePath`,(0,e.strConcat)(c.default.instancePath,ut.errorPath))),st.assign((0,e._)`${lt}.schemaPath`,(0,e.str)`${ut.errSchemaPath}/${tt}`),ut.opts.verbose&&(st.assign((0,e._)`${lt}.schema`,ot),st.assign((0,e._)`${lt}.data`,rt))})}i.extendErrors=j;function nt(st,tt){const ot=st.const("err",tt);st.if((0,e._)`${c.default.vErrors} === null`,()=>st.assign(c.default.vErrors,(0,e._)`[${ot}]`),(0,e._)`${c.default.vErrors}.push(${ot})`),st.code((0,e._)`${c.default.errors}++`)}function et(st,tt){const{gen:ot,validateName:rt,schemaEnv:at}=st;at.$async?ot.throw((0,e._)`new ${st.ValidationError}(${tt})`):(ot.assign((0,e._)`${rt}.errors`,tt),ot.return(!1))}const b={keyword:new e.Name("keyword"),schemaPath:new e.Name("schemaPath"),params:new e.Name("params"),propertyName:new e.Name("propertyName"),message:new e.Name("message"),schema:new e.Name("schema"),parentSchema:new e.Name("parentSchema")};function a(st,tt,ot){const{createErrors:rt}=st.it;return rt===!1?(0,e._)`{}`:o(st,tt,ot)}function o(st,tt,ot={}){const{gen:rt,it:at}=st,ut=[d(at,ot),g(st,ot)];return it(st,tt,ut),rt.object(...ut)}function d({errorPath:st},{instancePath:tt}){const ot=tt?(0,e.str)`${st}${(0,s.getErrorPath)(tt,s.Type.Str)}`:st;return[c.default.instancePath,(0,e.strConcat)(c.default.instancePath,ot)]}function g({keyword:st,it:{errSchemaPath:tt}},{schemaPath:ot,parentSchema:rt}){let at=rt?tt:(0,e.str)`${tt}/${st}`;return ot&&(at=(0,e.str)`${at}${(0,s.getErrorPath)(ot,s.Type.Str)}`),[b.schemaPath,at]}function it(st,{params:tt,message:ot},rt){const{keyword:at,data:ut,schemaValue:lt,it:ct}=st,{opts:ft,propertyName:dt,topSchemaRef:_t,schemaPath:wt}=ct;rt.push([b.keyword,at],[b.params,typeof tt=="function"?tt(st):tt||(0,e._)`{}`]),ft.messages&&rt.push([b.message,typeof ot=="function"?ot(st):ot]),ft.verbose&&rt.push([b.schema,lt],[b.parentSchema,(0,e._)`${_t}${wt}`],[c.default.data,ut]),dt&&rt.push([b.propertyName,dt])}}(errors),Object.defineProperty(boolSchema,"__esModule",{value:!0}),boolSchema.boolOrEmptySchema=boolSchema.topBoolOrEmptySchema=void 0;const errors_1$3=errors,codegen_1$t=codegen,names_1$6=names$1,boolError={message:"boolean schema is false"};function topBoolOrEmptySchema(i){const{gen:e,schema:s,validateName:c}=i;s===!1?falseSchemaError(i,!1):typeof s=="object"&&s.$async===!0?e.return(names_1$6.default.data):(e.assign((0,codegen_1$t._)`${c}.errors`,null),e.return(!0))}boolSchema.topBoolOrEmptySchema=topBoolOrEmptySchema;function boolOrEmptySchema(i,e){const{gen:s,schema:c}=i;c===!1?(s.var(e,!1),falseSchemaError(i)):s.var(e,!0)}boolSchema.boolOrEmptySchema=boolOrEmptySchema;function falseSchemaError(i,e){const{gen:s,data:c}=i,h={gen:s,keyword:"false schema",data:c,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:i};(0,errors_1$3.reportError)(h,boolError,void 0,e)}var dataType={},rules={};Object.defineProperty(rules,"__esModule",{value:!0}),rules.getRules=rules.isJSONType=void 0;const _jsonTypes=["string","number","integer","boolean","null","object","array"],jsonTypes=new Set(_jsonTypes);function isJSONType(i){return typeof i=="string"&&jsonTypes.has(i)}rules.isJSONType=isJSONType;function getRules(){const i={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...i,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},i.number,i.string,i.array,i.object],post:{rules:[]},all:{},keywords:{}}}rules.getRules=getRules;var applicability={};Object.defineProperty(applicability,"__esModule",{value:!0}),applicability.shouldUseRule=applicability.shouldUseGroup=applicability.schemaHasRulesForType=void 0;function schemaHasRulesForType({schema:i,self:e},s){const c=e.RULES.types[s];return c&&c!==!0&&shouldUseGroup(i,c)}applicability.schemaHasRulesForType=schemaHasRulesForType;function shouldUseGroup(i,e){return e.rules.some(s=>shouldUseRule(i,s))}applicability.shouldUseGroup=shouldUseGroup;function shouldUseRule(i,e){var s;return i[e.keyword]!==void 0||((s=e.definition.implements)===null||s===void 0?void 0:s.some(c=>i[c]!==void 0))}applicability.shouldUseRule=shouldUseRule,Object.defineProperty(dataType,"__esModule",{value:!0}),dataType.reportTypeError=dataType.checkDataTypes=dataType.checkDataType=dataType.coerceAndCheckDataType=dataType.getJSONTypes=dataType.getSchemaTypes=dataType.DataType=void 0;const rules_1=rules,applicability_1$1=applicability,errors_1$2=errors,codegen_1$s=codegen,util_1$q=util;var DataType;(function(i){i[i.Correct=0]="Correct",i[i.Wrong=1]="Wrong"})(DataType||(dataType.DataType=DataType={}));function getSchemaTypes(i){const e=getJSONTypes(i.type);if(e.includes("null")){if(i.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&i.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');i.nullable===!0&&e.push("null")}return e}dataType.getSchemaTypes=getSchemaTypes;function getJSONTypes(i){const e=Array.isArray(i)?i:i?[i]:[];if(e.every(rules_1.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}dataType.getJSONTypes=getJSONTypes;function coerceAndCheckDataType(i,e){const{gen:s,data:c,opts:h}=i,$=coerceToTypes(e,h.coerceTypes),_=e.length>0&&!($.length===0&&e.length===1&&(0,applicability_1$1.schemaHasRulesForType)(i,e[0]));if(_){const j=checkDataTypes(e,c,h.strictNumbers,DataType.Wrong);s.if(j,()=>{$.length?coerceData(i,e,$):reportTypeError(i)})}return _}dataType.coerceAndCheckDataType=coerceAndCheckDataType;const COERCIBLE=new Set(["string","number","integer","boolean","null"]);function coerceToTypes(i,e){return e?i.filter(s=>COERCIBLE.has(s)||e==="array"&&s==="array"):[]}function coerceData(i,e,s){const{gen:c,data:h,opts:$}=i,_=c.let("dataType",(0,codegen_1$s._)`typeof ${h}`),j=c.let("coerced",(0,codegen_1$s._)`undefined`);$.coerceTypes==="array"&&c.if((0,codegen_1$s._)`${_} == 'object' && Array.isArray(${h}) && ${h}.length == 1`,()=>c.assign(h,(0,codegen_1$s._)`${h}[0]`).assign(_,(0,codegen_1$s._)`typeof ${h}`).if(checkDataTypes(e,h,$.strictNumbers),()=>c.assign(j,h))),c.if((0,codegen_1$s._)`${j} !== undefined`);for(const et of s)(COERCIBLE.has(et)||et==="array"&&$.coerceTypes==="array")&&nt(et);c.else(),reportTypeError(i),c.endIf(),c.if((0,codegen_1$s._)`${j} !== undefined`,()=>{c.assign(h,j),assignParentData(i,j)});function nt(et){switch(et){case"string":c.elseIf((0,codegen_1$s._)`${_} == "number" || ${_} == "boolean"`).assign(j,(0,codegen_1$s._)`"" + ${h}`).elseIf((0,codegen_1$s._)`${h} === null`).assign(j,(0,codegen_1$s._)`""`);return;case"number":c.elseIf((0,codegen_1$s._)`${_} == "boolean" || ${h} === null
42
42
  || (${_} == "string" && ${h} && ${h} == +${h})`).assign(j,(0,codegen_1$s._)`+${h}`);return;case"integer":c.elseIf((0,codegen_1$s._)`${_} === "boolean" || ${h} === null
43
43
  || (${_} === "string" && ${h} && ${h} == +${h} && !(${h} % 1))`).assign(j,(0,codegen_1$s._)`+${h}`);return;case"boolean":c.elseIf((0,codegen_1$s._)`${h} === "false" || ${h} === 0 || ${h} === null`).assign(j,!1).elseIf((0,codegen_1$s._)`${h} === "true" || ${h} === 1`).assign(j,!0);return;case"null":c.elseIf((0,codegen_1$s._)`${h} === "" || ${h} === 0 || ${h} === false`),c.assign(j,null);return;case"array":c.elseIf((0,codegen_1$s._)`${_} === "string" || ${_} === "number"
@@ -1848,4 +1848,4 @@ ${j}
1848
1848
  `);const nt=this.glContext.compileShader(j,this.glContext.gl.FRAGMENT_SHADER),et=this.glContext.createProgram(this.vertexShader,nt);return this.glContext.deleteShader(nt),et}bindOutput(j){const nt=j.width,et=j.height;h.Logger.verbose("ProrgramManager",`Binding output texture to Framebuffer: w/h=${nt}/${et}, shape=${j.shape}, type=${j.tensor.type}`),this.glContext.attachFramebuffer(j.texture,nt,et)}bindAttributes(j){const nt=j.position,et=j.textureCoord;this.glContext.setVertexAttributes(nt,et),this.attributesBound=!0}bindUniforms(j,nt,et){var b;const a=this.glContext.gl;let o=0;for(const{name:d,type:g,location:it,arrayLength:st}of j){const tt=(b=nt.find(ot=>ot.name===d))===null||b===void 0?void 0:b.data;if(g!=="sampler2D"&&!tt)throw new Error(`variable '${d}' does not have data defined in program info`);switch(g){case"sampler2D":this.bindTexture(et[o],it,o),o++;break;case"float":st?a.uniform1fv(it,tt):a.uniform1f(it,tt);break;case"int":st?a.uniform1iv(it,tt):a.uniform1i(it,tt);break;default:throw new Error(`Uniform not implemented: ${g}`)}}}bindTexture(j,nt,et){this.glContext.bindTextureToUniform(j.texture,et,nt)}getAttribLocations(j){return{position:this.getAttribLocation(j,"position"),textureCoord:this.getAttribLocation(j,"textureCoord")}}getUniformLocations(j,nt,et){const b=[];if(nt)for(const a of nt)b.push({name:a,type:"sampler2D",location:this.getUniformLocation(j,a)});if(et)for(const a of et)b.push(Object.assign(Object.assign({},a),{location:this.getUniformLocation(j,a.name)}));return b}getUniformLocation(j,nt){const et=this.glContext.gl.getUniformLocation(j,nt);if(et===null)throw new Error(`Uniform ${nt} not found.`);return et}getAttribLocation(j,nt){return this.glContext.gl.getAttribLocation(j,nt)}}},6416:(i,e,s)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLSessionHandler=void 0;const c=s(6231),h=s(1047),$=s(8316),_=s(1640),j=s(1958),nt=s(7859),et=s(5702);e.WebGLSessionHandler=class{constructor(b,a){this.backend=b,this.context=a,this.layoutStrategy=new nt.PreferLogicalStrategy(b.glContext.maxTextureSize),this.programManager=new j.ProgramManager(this.context.profiler,b.glContext,this.layoutStrategy),this.textureManager=new et.TextureManager(b.glContext,this.layoutStrategy,this.context.profiler,{reuseTextures:b.textureCacheMode==="full"}),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache=new Map,this.pack=b.pack,this.pack2unpackMap=new Map,this.unpack2packMap=new Map}createInferenceHandler(){return new $.WebGLInferenceHandler(this)}onGraphInitialized(b){const a=b.getValues().filter(o=>o.from===-1&&o.tensor).map(o=>o.tensor.dataId);this.initializers=new Set(a)}isInitializer(b){return!!this.initializers&&this.initializers.has(b)}addInitializer(b){this.initializers.add(b)}getTextureData(b,a){return a?this.packedTextureDataCache.get(b):this.unpackedTextureDataCache.get(b)}setTextureData(b,a,o=!1){c.Logger.verbose("WebGLSessionHandler","Storing Texture data in cache"),o?this.packedTextureDataCache.set(b,a):this.unpackedTextureDataCache.set(b,a)}dispose(){this.programManager.dispose(),this.textureManager.clearActiveTextures(),this.packedTextureDataCache.forEach(b=>this.textureManager.releaseTexture(b,!0)),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache.forEach(b=>this.textureManager.releaseTexture(b,!0)),this.unpackedTextureDataCache=new Map}resolve(b,a,o){const d=(0,h.resolveOperator)(b,a,_.WEBGL_OP_RESOLVE_RULES);return{impl:d.opImpl,context:d.opInit?d.opInit(b,o):b}}}},7769:(i,e,s)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Uint8DataEncoder=e.RGBAFloatDataEncoder=e.RedFloat32DataEncoder=void 0;const c=s(6231);e.RedFloat32DataEncoder=class{constructor(h,$=1){if($===1)this.internalFormat=h.R32F,this.format=h.RED,this.textureType=h.FLOAT,this.channelSize=$;else{if($!==4)throw new Error(`Invalid number of channels: ${$}`);this.internalFormat=h.RGBA32F,this.format=h.RGBA,this.textureType=h.FLOAT,this.channelSize=$}}encode(h,$){let _,j;return h.constructor!==Float32Array&&(c.Logger.warning("Encoder","data was not of type Float32; creating new Float32Array"),j=new Float32Array(h)),$*this.channelSize>h.length?(c.Logger.warning("Encoder","Source data too small. Allocating larger array"),j=h,_=this.allocate($*this.channelSize),j.forEach((nt,et)=>_[et]=nt)):(j=h,_=j),_}allocate(h){return new Float32Array(4*h)}decode(h,$){return this.channelSize===1?h.filter((_,j)=>j%4==0).subarray(0,$):h.subarray(0,$)}},e.RGBAFloatDataEncoder=class{constructor(h,$=1,_){if($!==1&&$!==4)throw new Error(`Invalid number of channels: ${$}`);this.internalFormat=h.RGBA,this.format=h.RGBA,this.channelSize=$,this.textureType=_||h.FLOAT}encode(h,$){let _=h;return this.channelSize===1&&(c.Logger.verbose("Encoder","Exploding into a larger array"),_=this.allocate($),h.forEach((j,nt)=>_[4*nt]=j)),_}allocate(h){return new Float32Array(4*h)}decode(h,$){return this.channelSize===1?h.filter((_,j)=>j%4==0).subarray(0,$):h.subarray(0,$)}},e.Uint8DataEncoder=class{constructor(h,$=1){if(this.channelSize=4,$===1)this.internalFormat=h.ALPHA,this.format=h.ALPHA,this.textureType=h.UNSIGNED_BYTE,this.channelSize=$;else{if($!==4)throw new Error(`Invalid number of channels: ${$}`);this.internalFormat=h.RGBA,this.format=h.RGBA,this.textureType=h.UNSIGNED_BYTE,this.channelSize=$}}encode(h,$){return new Uint8Array(h.buffer,h.byteOffset,h.byteLength)}allocate(h){return new Uint8Array(h*this.channelSize)}decode(h,$){if(h instanceof Uint8Array)return h.subarray(0,$);throw new Error(`Invalid array type: ${h.constructor}`)}}},7859:(i,e,s)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getBatchDim=e.sizeToSquarishShape=e.getRowsCols=e.sizeFromShape=e.isInt=e.parseAxisParam=e.squeezeShape=e.PreferLogicalStrategy=e.AlwaysKeepOriginalSizeStrategy=void 0;const c=s(6231),h=s(2517);function $(b,a){const o=[],d=[],g=a!=null&&Array.isArray(a)&&a.length===0,it=a==null||g?null:_(a,b).sort();let st=0;for(let tt=0;tt<b.length;++tt){if(it!=null){if(it[st]===tt&&b[tt]!==1)throw new Error(`Can't squeeze axis ${tt} since its dim '${b[tt]}' is not 1`);(it[st]==null||it[st]>tt)&&b[tt]===1&&(o.push(b[tt]),d.push(tt)),it[st]<=tt&&st++}b[tt]!==1&&(o.push(b[tt]),d.push(tt))}return{newShape:o,keptDims:d}}function _(b,a){const o=a.length;return b=b==null?a.map((d,g)=>g):[].concat(b),(0,h.assert)(b.every(d=>d>=-o&&d<o),()=>`All values in axis param must be in range [-${o}, ${o}) but got axis ${b}`),(0,h.assert)(b.every(j),()=>`All values in axis param must be integers but got axis ${b}`),b.map(d=>d<0?o+d:d)}function j(b){return b%1==0}function nt(b){if(b.length===0)return 1;let a=b[0];for(let o=1;o<b.length;o++)a*=b[o];return a}function et(b){const a=Math.ceil(Math.sqrt(b));return[a,Math.ceil(b/a)]}e.AlwaysKeepOriginalSizeStrategy=class{constructor(b){this.maxTextureSize=b}computeTextureWH(b,a){if(b.length===0)return[1,1];const o=this.maxTextureSize;if(a&&a.breakAxis!==void 0){const it=a.breakAxis>=b.length?1:b.slice(a.breakAxis).reduce((tt,ot)=>tt*ot),st=a.breakAxis<=0?1:b.slice(0,a.breakAxis).reduce((tt,ot)=>tt*ot);if(!(it>o||st>o))return[it,st];c.Logger.verbose("TextureLayout",`Given width/height preferences were unattainable: shape:${b}, breakAxis:${a.breakAxis}`)}const d=b.reduce((it,st)=>it*st);let g=Math.floor(Math.sqrt(d));for(;g<o&&g<d&&d%g!=0;g++);if(g>=o||d%g!=0)throw new Error(`The given dimensions are outside this GPU's boundaries: ${b}`);return[g,d/g]}},e.PreferLogicalStrategy=class{constructor(b){this.maxTextureSize=b}computeTextureWH(b,a){const o=this.computeTexture(b,a);return a&&a.isPacked&&(o[0]/=2,o[1]/=2),a&&a.reverseWH?[o[1],o[0]]:o}computeTexture(b,a){const o=a&&a.isPacked;if(b.length===0)return o?[2,2]:[1,1];let d=this.maxTextureSize;if(a&&a.breakAxis!==void 0){const st=a.breakAxis>=b.length?1:b.slice(a.breakAxis).reduce((ot,rt)=>ot*rt),tt=a.breakAxis<=0?1:b.slice(0,a.breakAxis).reduce((ot,rt)=>ot*rt);if(!(st>d||tt>d))return[st,tt];c.Logger.verbose("TextureLayout",`Given width/height preferences were unattainable: shape:${b}, breakAxis:${a.breakAxis}`)}let g=b.slice(0);o&&(d*=2,g=g.map((st,tt)=>tt>=g.length-2?g[tt]%2==0?g[tt]:g[tt]+1:g[tt]),g.length===1&&(g=[2,g[0]])),g.length!==2&&(g=$(g).newShape);const it=nt(g);return g.length<=1&&it<=d?[1,it]:g.length===2&&g[0]<=d&&g[1]<=d?g:g.length===3&&g[0]*g[1]<=d&&g[2]<=d?[g[0]*g[1],g[2]]:g.length===3&&g[0]<=d&&g[1]*g[2]<=d?[g[0],g[1]*g[2]]:g.length===4&&g[0]*g[1]*g[2]<=d&&g[3]<=d?[g[0]*g[1]*g[2],g[3]]:g.length===4&&g[0]<=d&&g[1]*g[2]*g[3]<=d?[g[0],g[1]*g[2]*g[3]]:o?et(it/4).map(st=>2*st):et(it)}},e.squeezeShape=$,e.parseAxisParam=_,e.isInt=j,e.sizeFromShape=nt,e.getRowsCols=function(b){if(b.length===0)throw Error("Cannot get rows and columns of an empty shape array.");return[b.length>1?b[b.length-2]:1,b[b.length-1]]},e.sizeToSquarishShape=et,e.getBatchDim=function(b,a=2){return nt(b.slice(0,b.length-a))}},4057:(i,e,s)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createTextureLayoutFromShape=e.calculateTextureWidthAndHeight=e.createTextureLayoutFromTextureType=void 0;const c=s(2517),h=s(2039);e.createTextureLayoutFromTextureType=($,_,j)=>{const nt=j===h.TextureType.unpacked||j===h.TextureType.unpackedReversed?1:4,et=j===h.TextureType.packed,b=j===h.TextureType.unpackedReversed||j===h.TextureType.packed,a=j===h.TextureType.packedLastDimension?_.length-1:void 0,o=j===h.TextureType.packedLastDimension?_.map((d,g)=>g===_.length-1?4*d:d):void 0;return(0,e.createTextureLayoutFromShape)($,_,nt,o,{isPacked:et,reverseWH:b,breakAxis:a})},e.calculateTextureWidthAndHeight=($,_,j)=>{const nt=(0,e.createTextureLayoutFromTextureType)($,_,j);return[nt.width,nt.height]},e.createTextureLayoutFromShape=($,_,j=1,nt,et)=>{const b=!(!et||!et.isPacked),[a,o]=$.computeTextureWH(b&&nt||_,et),d=_.length;let g=_.slice(0);if(d===0&&(g=[1]),j===1)nt=_;else if(b){if(j!==4)throw new Error("a packed texture must be 4-channel");nt=_,d>0&&(g[d-1]=Math.ceil(g[d-1]/2)),d>1&&(g[d-2]=Math.ceil(g[d-2]/2))}else if(!nt)throw new Error("Unpacked shape is needed when using channels > 1");return{width:a,height:o,channels:j,isPacked:b,shape:g,strides:c.ShapeUtil.computeStrides(g),unpackedShape:nt,reversedWH:et&&et.reverseWH}}},5702:(i,e,s)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TextureManager=void 0;const c=s(6231);e.TextureManager=class{constructor(h,$,_,j){this.glContext=h,this.layoutStrategy=$,this.profiler=_,this.config=j,this.pendingRead=new Map,j.reuseTextures&&(this.inUseTextures=new Map,this.idleTextures=new Map,this.textureLookup=new Map)}createTextureFromLayout(h,$,_,j){const nt=this.toEncoderType(h),et=this.glContext.getEncoder(nt,$.channels||1,j);if($.isPacked&&j===1)throw new Error("not implemented");const b=$.width,a=$.height;let o,d;if(this.config.reuseTextures){o=`${b}x${a}_${et.format}_${et.internalFormat}_${et.textureType}`,d=this.inUseTextures.get(o),d||(d=[],this.inUseTextures.set(o,d));const it=this.idleTextures.get(o);if(it&&it.length>0){const st=it.pop();return d.push(st),j===1&&this.glContext.updateTexture(st,b,a,et,this.toTextureData(h,_)),st}}c.Logger.verbose("TextureManager",`Creating new texture of size ${$.width}x${$.height}`);const g=this.glContext.allocateTexture(b,a,et,this.toTextureData(h,_));return this.config.reuseTextures&&(d.push(g),this.textureLookup.set(g,o)),g}readTexture(h,$,_){return _||(_=1),this.profiler.event("backend","TextureManager.readTexture",()=>{const j=h.shape.reduce((et,b)=>et*b)*_,nt=this.glContext.readTexture(h.texture,h.width,h.height,j,this.toEncoderType($),_);return this.toTensorData($,nt)})}async readTextureAsync(h,$,_){const j=h.tensor.dataId;if(_||(_=1),this.pendingRead.has(j)){const nt=this.pendingRead.get(j);return new Promise(et=>nt==null?void 0:nt.push(et))}return this.profiler.event("backend","TextureManager.readTextureAsync",async()=>{this.pendingRead.set(j,[]);const nt=h.shape.reduce((o,d)=>o*d)*_;await this.glContext.createAndWaitForFence();const et=this.glContext.readTexture(h.texture,h.width,h.height,nt,this.toEncoderType($),_),b=this.toTensorData($,et),a=this.pendingRead.get(j);return this.pendingRead.delete(j),a==null||a.forEach(o=>o(b)),b})}readUint8TextureAsFloat(h){return this.profiler.event("backend","TextureManager.readUint8TextureAsFloat",()=>{const $=h.shape.reduce((j,nt)=>j*nt),_=this.glContext.readTexture(h.texture,h.width,h.height,4*$,"byte",4);return new Float32Array(_.buffer,_.byteOffset,$)})}releaseTexture(h,$){let _;if(this.config.reuseTextures&&(_=this.textureLookup.get(h.texture),_)){$&&this.textureLookup.delete(_);const j=this.inUseTextures.get(_);if(j){const nt=j.indexOf(h.texture);if(nt!==-1){j.splice(nt,1);let et=this.idleTextures.get(_);et||(et=[],this.idleTextures.set(_,et)),et.push(h.texture)}}}_&&!$||(c.Logger.verbose("TextureManager",`Deleting texture of size ${h.width}x${h.height}`),this.glContext.deleteTexture(h.texture))}toTensorData(h,$){switch(h){case"int16":return $ instanceof Int16Array?$:Int16Array.from($);case"int32":return $ instanceof Int32Array?$:Int32Array.from($);case"int8":return $ instanceof Int8Array?$:Int8Array.from($);case"uint16":return $ instanceof Uint16Array?$:Uint16Array.from($);case"uint32":return $ instanceof Uint32Array?$:Uint32Array.from($);case"uint8":case"bool":return $ instanceof Uint8Array?$:Uint8Array.from($);case"float32":return $ instanceof Float32Array?$:Float32Array.from($);case"float64":return $ instanceof Float64Array?$:Float64Array.from($);default:throw new Error(`TensorData type ${h} is not supported`)}}toTextureData(h,$){if($)return $ instanceof Float32Array?$:new Float32Array($)}toEncoderType(h){return"float"}clearActiveTextures(){this.glContext.clearActiveTextures()}}},2039:(i,e)=>{var s;Object.defineProperty(e,"__esModule",{value:!0}),e.TextureType=void 0,(s=e.TextureType||(e.TextureType={}))[s.unpacked=0]="unpacked",s[s.unpackedReversed=1]="unpackedReversed",s[s.packed=2]="packed",s[s.downloadUint8AsFloat=3]="downloadUint8AsFloat",s[s.packedLastDimension=4]="packedLastDimension"},9390:(i,e,s)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getGlChannels=e.getCoordsDataType=e.getSqueezedParams=e.squeezeInputShape=e.generateShaderFuncNameFromInputSamplerNameAtOutCoords=e.generateShaderFuncNameFromInputSamplerName=e.repeatedTry=e.getPackedShape=void 0;const c=s(2517);e.getPackedShape=function(h){const $=h.length;return h.slice(0,$-1).concat(h[$-1]/4)},e.repeatedTry=async function(h,$=j=>0,_){return new Promise((j,nt)=>{let et=0;const b=()=>{if(h())return void j();et++;const a=$(et);_!=null&&et>=_?nt():setTimeout(b,a)};b()})},e.generateShaderFuncNameFromInputSamplerName=function(h){return(0,c.assert)(h!==void 0&&h.length!==0,()=>"empty string found for sampler name"),"get"+h.charAt(0).toUpperCase()+h.slice(1)},e.generateShaderFuncNameFromInputSamplerNameAtOutCoords=function(h){return(0,c.assert)(h!==void 0&&h.length!==0,()=>"empty string found for sampler name"),"get"+h.charAt(0).toUpperCase()+h.slice(1)+"AtOutCoords"},e.squeezeInputShape=function(h,$){let _=JSON.parse(JSON.stringify(h));return _=$,_},e.getSqueezedParams=function(h,$){return $.map(_=>h[_]).join(", ")},e.getCoordsDataType=function(h){if(h<=1)return"int";if(h===2)return"ivec2";if(h===3)return"ivec3";if(h===4)return"ivec4";if(h===5)return"ivec5";if(h===6)return"ivec6";throw Error(`GPU for rank ${h} is not yet supported`)},e.getGlChannels=function(h=6){return["x","y","z","w","u","v"].slice(0,h)}},7305:(i,e,s)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createNewWebGLContext=e.createWebGLContext=void 0;const c=s(6231),h=s(1713),$={};function _(j){const nt=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 a=document.createElement("canvas");return a.width=1,a.height=1,a}();let et;const b={alpha:!1,depth:!1,antialias:!1,stencil:!1,preserveDrawingBuffer:!1,premultipliedAlpha:!1,failIfMajorPerformanceCaveat:!1};if((!j||j==="webgl2")&&(et=nt.getContext("webgl2",b),et))try{return new h.WebGLContext(et,2)}catch(a){c.Logger.warning("GlContextFactory",`failed to create WebGLContext using contextId 'webgl2'. Error: ${a}`)}if((!j||j==="webgl")&&(et=nt.getContext("webgl",b)||nt.getContext("experimental-webgl",b),et))try{return new h.WebGLContext(et,1)}catch(a){c.Logger.warning("GlContextFactory",`failed to create WebGLContext using contextId 'webgl' or 'experimental-webgl'. Error: ${a}`)}throw new Error("WebGL is not supported")}e.createWebGLContext=function j(nt){let et;nt&&nt!=="webgl2"||!("webgl2"in $)?nt&&nt!=="webgl"||!("webgl"in $)||(et=$.webgl):et=$.webgl2,et=et||_(nt),nt=nt||et.version===1?"webgl":"webgl2";const b=et.gl;return $[nt]=et,b.isContextLost()?(delete $[nt],j(nt)):(b.disable(b.DEPTH_TEST),b.disable(b.STENCIL_TEST),b.disable(b.BLEND),b.disable(b.DITHER),b.disable(b.POLYGON_OFFSET_FILL),b.disable(b.SAMPLE_COVERAGE),b.enable(b.SCISSOR_TEST),b.enable(b.CULL_FACE),b.cullFace(b.BACK),et)},e.createNewWebGLContext=_},1713:function(i,e,s){var c=this&&this.__createBinding||(Object.create?function(b,a,o,d){d===void 0&&(d=o);var g=Object.getOwnPropertyDescriptor(a,o);g&&!("get"in g?!a.__esModule:g.writable||g.configurable)||(g={enumerable:!0,get:function(){return a[o]}}),Object.defineProperty(b,d,g)}:function(b,a,o,d){d===void 0&&(d=o),b[d]=a[o]}),h=this&&this.__setModuleDefault||(Object.create?function(b,a){Object.defineProperty(b,"default",{enumerable:!0,value:a})}:function(b,a){b.default=a}),$=this&&this.__importStar||function(b){if(b&&b.__esModule)return b;var a={};if(b!=null)for(var o in b)o!=="default"&&Object.prototype.hasOwnProperty.call(b,o)&&c(a,b,o);return h(a,b),a};Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLContext=e.linearSearchLastTrue=void 0;const _=s(1670),j=$(s(7769)),nt=s(9390);function et(b){let a=0;for(;a<b.length&&b[a]();++a);return a-1}e.linearSearchLastTrue=et,e.WebGLContext=class{constructor(b,a){this.frameBufferBound=!1,this.itemsToPoll=[],this.gl=b,this.version=a,this.getExtensions(),this.vertexbuffer=this.createVertexbuffer(),this.framebuffer=this.createFramebuffer(),this.queryVitalParameters()}allocateTexture(b,a,o,d){const g=this.gl,it=g.createTexture();g.bindTexture(g.TEXTURE_2D,it),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MIN_FILTER,g.NEAREST),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MAG_FILTER,g.NEAREST),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_S,g.CLAMP_TO_EDGE),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_T,g.CLAMP_TO_EDGE);const st=d?o.encode(d,b*a):null;return g.texImage2D(g.TEXTURE_2D,0,o.internalFormat,b,a,0,o.format,o.textureType,st),this.checkError(),it}updateTexture(b,a,o,d,g){const it=this.gl;it.bindTexture(it.TEXTURE_2D,b);const st=d.encode(g,a*o);it.texSubImage2D(it.TEXTURE_2D,0,0,0,a,o,d.format,d.textureType,st),this.checkError()}attachFramebuffer(b,a,o){const d=this.gl;d.bindTexture(d.TEXTURE_2D,b),d.bindFramebuffer(d.FRAMEBUFFER,this.framebuffer),d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,b,0),this.checkError(),d.viewport(0,0,a,o),d.scissor(0,0,a,o)}readTexture(b,a,o,d,g,it){const st=this.gl;it||(it=1),this.frameBufferBound||this.attachFramebuffer(b,a,o);const tt=this.getEncoder(g,it),ot=tt.allocate(a*o);return st.bindTexture(st.TEXTURE_2D,b),st.framebufferTexture2D(st.FRAMEBUFFER,st.COLOR_ATTACHMENT0,st.TEXTURE_2D,b,0),st.readPixels(0,0,a,o,st.RGBA,tt.textureType,ot),this.checkError(),tt.decode(ot,d)}isFramebufferReady(){return!0}getActiveTexture(){const b=this.gl;return"TEXTURE"+(b.getParameter(this.gl.ACTIVE_TEXTURE)-b.TEXTURE0)}getTextureBinding(){return this.gl.getParameter(this.gl.TEXTURE_BINDING_2D)}getFramebufferBinding(){return this.gl.getParameter(this.gl.FRAMEBUFFER_BINDING)}setVertexAttributes(b,a){const o=this.gl;o.vertexAttribPointer(b,3,o.FLOAT,!1,20,0),o.enableVertexAttribArray(b),a!==-1&&(o.vertexAttribPointer(a,2,o.FLOAT,!1,20,12),o.enableVertexAttribArray(a)),this.checkError()}createProgram(b,a){const o=this.gl,d=o.createProgram();return o.attachShader(d,b),o.attachShader(d,a),o.linkProgram(d),d}compileShader(b,a){const o=this.gl,d=o.createShader(a);if(!d)throw new Error(`createShader() returned null with type ${a}`);if(o.shaderSource(d,b),o.compileShader(d),o.getShaderParameter(d,o.COMPILE_STATUS)===!1)throw new Error(`Failed to compile shader: ${o.getShaderInfoLog(d)}
1849
1849
  Shader source:
1850
1850
  ${b}`);return d}deleteShader(b){this.gl.deleteShader(b)}bindTextureToUniform(b,a,o){const d=this.gl;d.activeTexture(d.TEXTURE0+a),this.checkError(),d.bindTexture(d.TEXTURE_2D,b),this.checkError(),d.uniform1i(o,a),this.checkError()}draw(){this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.checkError()}checkError(){if(_.env.debug){const b=this.gl,a=b.getError();let o="";switch(a){case b.NO_ERROR:return;case b.INVALID_ENUM:o="INVALID_ENUM";break;case b.INVALID_VALUE:o="INVALID_VALUE";break;case b.INVALID_OPERATION:o="INVALID_OPERATION";break;case b.INVALID_FRAMEBUFFER_OPERATION:o="INVALID_FRAMEBUFFER_OPERATION";break;case b.OUT_OF_MEMORY:o="OUT_OF_MEMORY";break;case b.CONTEXT_LOST_WEBGL:o="CONTEXT_LOST_WEBGL";break;default:o=`Unknown WebGL Error: ${a.toString(16)}`}throw new Error(o)}}deleteTexture(b){this.gl.deleteTexture(b)}deleteProgram(b){this.gl.deleteProgram(b)}getEncoder(b,a,o=0){if(this.version===2)return new j.RedFloat32DataEncoder(this.gl,a);switch(b){case"float":return o===1||this.isRenderFloat32Supported?new j.RGBAFloatDataEncoder(this.gl,a):new j.RGBAFloatDataEncoder(this.gl,a,this.textureHalfFloatExtension.HALF_FLOAT_OES);case"int":throw new Error("not implemented");case"byte":return new j.Uint8DataEncoder(this.gl,a);default:throw new Error(`Invalid dataType: ${b}`)}}clearActiveTextures(){const b=this.gl;for(let a=0;a<this.maxTextureImageUnits;++a)b.activeTexture(b.TEXTURE0+a),b.bindTexture(b.TEXTURE_2D,null)}dispose(){if(this.disposed)return;const b=this.gl;b.bindFramebuffer(b.FRAMEBUFFER,null),b.deleteFramebuffer(this.framebuffer),b.bindBuffer(b.ARRAY_BUFFER,null),b.deleteBuffer(this.vertexbuffer),b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,null),b.finish(),this.disposed=!0}createDefaultGeometry(){return new Float32Array([-1,1,0,0,1,-1,-1,0,0,0,1,1,0,1,1,1,-1,0,1,0])}createVertexbuffer(){const b=this.gl,a=b.createBuffer();if(!a)throw new Error("createBuffer() returned null");const o=this.createDefaultGeometry();return b.bindBuffer(b.ARRAY_BUFFER,a),b.bufferData(b.ARRAY_BUFFER,o,b.STATIC_DRAW),this.checkError(),a}createFramebuffer(){const b=this.gl.createFramebuffer();if(!b)throw new Error("createFramebuffer returned null");return b}queryVitalParameters(){const b=this.gl;if(this.isFloatTextureAttachableToFrameBuffer=this.checkFloatTextureAttachableToFrameBuffer(),this.isRenderFloat32Supported=this.checkRenderFloat32(),this.isFloat32DownloadSupported=this.checkFloat32Download(),this.version===1&&!this.textureHalfFloatExtension&&!this.isRenderFloat32Supported)throw new Error("both float32 and float16 TextureType are not supported");this.isBlendSupported=!this.isRenderFloat32Supported||this.checkFloat32Blend(),this.maxTextureSize=b.getParameter(b.MAX_TEXTURE_SIZE),this.maxTextureImageUnits=b.getParameter(b.MAX_TEXTURE_IMAGE_UNITS),this.version}getExtensions(){this.version===2?(this.colorBufferFloatExtension=this.gl.getExtension("EXT_color_buffer_float"),this.disjointTimerQueryWebgl2Extension=this.gl.getExtension("EXT_disjoint_timer_query_webgl2")):(this.textureFloatExtension=this.gl.getExtension("OES_texture_float"),this.textureHalfFloatExtension=this.gl.getExtension("OES_texture_half_float"))}checkFloatTextureAttachableToFrameBuffer(){const b=this.gl,a=b.createTexture();b.bindTexture(b.TEXTURE_2D,a);const o=this.version===2?b.RGBA32F:b.RGBA;b.texImage2D(b.TEXTURE_2D,0,o,1,1,0,b.RGBA,b.FLOAT,null);const d=b.createFramebuffer();b.bindFramebuffer(b.FRAMEBUFFER,d),b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,a,0);const g=b.checkFramebufferStatus(b.FRAMEBUFFER)===b.FRAMEBUFFER_COMPLETE;return b.bindTexture(b.TEXTURE_2D,null),b.bindFramebuffer(b.FRAMEBUFFER,null),b.deleteTexture(a),b.deleteFramebuffer(d),g}checkRenderFloat32(){if(this.version===2){if(!this.colorBufferFloatExtension)return!1}else if(!this.textureFloatExtension)return!1;return this.isFloatTextureAttachableToFrameBuffer}checkFloat32Download(){if(this.version===2){if(!this.colorBufferFloatExtension)return!1}else if(!this.textureFloatExtension||!this.gl.getExtension("WEBGL_color_buffer_float"))return!1;return this.isFloatTextureAttachableToFrameBuffer}checkFloat32Blend(){const b=this.gl;let a,o,d,g,it;try{a=b.createTexture(),o=b.createFramebuffer(),b.bindTexture(b.TEXTURE_2D,a);const st=this.version===2?b.RGBA32F:b.RGBA;return b.texImage2D(b.TEXTURE_2D,0,st,1,1,0,b.RGBA,b.FLOAT,null),b.bindFramebuffer(b.FRAMEBUFFER,o),b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,a,0),b.enable(b.BLEND),d=b.createShader(b.VERTEX_SHADER),!!d&&(b.shaderSource(d,"void main(){}"),b.compileShader(d),g=b.createShader(b.FRAGMENT_SHADER),!!g&&(b.shaderSource(g,"precision highp float;void main(){gl_FragColor=vec4(0.5);}"),b.compileShader(g),it=b.createProgram(),!!it&&(b.attachShader(it,d),b.attachShader(it,g),b.linkProgram(it),b.useProgram(it),b.drawArrays(b.POINTS,0,1),b.getError()===b.NO_ERROR)))}finally{b.disable(b.BLEND),it&&b.deleteProgram(it),d&&b.deleteShader(d),g&&b.deleteShader(g),o&&(b.bindFramebuffer(b.FRAMEBUFFER,null),b.deleteFramebuffer(o)),a&&(b.bindTexture(b.TEXTURE_2D,null),b.deleteTexture(a))}}beginTimer(){if(this.version===2&&this.disjointTimerQueryWebgl2Extension){const b=this.gl,a=this.disjointTimerQueryWebgl2Extension,o=b.createQuery();return b.beginQuery(a.TIME_ELAPSED_EXT,o),o}throw new Error("WebGL1 profiling currently not supported.")}endTimer(){if(this.version!==2||!this.disjointTimerQueryWebgl2Extension)throw new Error("WebGL1 profiling currently not supported");{const b=this.gl,a=this.disjointTimerQueryWebgl2Extension;b.endQuery(a.TIME_ELAPSED_EXT)}}isTimerResultAvailable(b){let a=!1,o=!1;if(this.version!==2||!this.disjointTimerQueryWebgl2Extension)throw new Error("WebGL1 profiling currently not supported");{const d=this.gl,g=this.disjointTimerQueryWebgl2Extension;a=d.getQueryParameter(b,d.QUERY_RESULT_AVAILABLE),o=d.getParameter(g.GPU_DISJOINT_EXT)}return a&&!o}getTimerResult(b){let a=0;if(this.version!==2)throw new Error("WebGL1 profiling currently not supported");{const o=this.gl;a=o.getQueryParameter(b,o.QUERY_RESULT),o.deleteQuery(b)}return a/1e6}async waitForQueryAndGetTime(b){return await(0,nt.repeatedTry)(()=>this.isTimerResultAvailable(b)),this.getTimerResult(b)}async createAndWaitForFence(){const b=this.createFence(this.gl);return this.pollFence(b)}createFence(b){let a;const o=b,d=o.fenceSync(o.SYNC_GPU_COMMANDS_COMPLETE,0);return b.flush(),a=d===null?()=>!0:()=>{const g=o.clientWaitSync(d,0,0);return g===o.ALREADY_SIGNALED||g===o.CONDITION_SATISFIED},{query:d,isFencePassed:a}}async pollFence(b){return new Promise(a=>{this.addItemToPoll(()=>b.isFencePassed(),()=>a())})}pollItems(){const b=et(this.itemsToPoll.map(a=>a.isDoneFn));for(let a=0;a<=b;++a){const{resolveFn:o}=this.itemsToPoll[a];o()}this.itemsToPoll=this.itemsToPoll.slice(b+1)}async addItemToPoll(b,a){this.itemsToPoll.push({isDoneFn:b,resolveFn:a}),this.itemsToPoll.length>1||await(0,nt.repeatedTry)(()=>(this.pollItems(),this.itemsToPoll.length===0))}}},1036:(i,e,s)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ExecutionPlan=void 0;const c=s(6231);class h{constructor(_,j){this.op=_,this.node=j}}e.ExecutionPlan=class{constructor($,_,j){this.graph=$,this.profiler=j,this.initialize(_)}initialize($){this.profiler.event("session","ExecutionPlan.initialize",()=>{const _=this.graph.getNodes();if(_.length!==$.length)throw new Error("The size of nodes and OPs do not match.");this._ops=$.map((j,nt)=>new h(j,_[nt])),this.reset(),this._starter=[],this._ops.forEach((j,nt)=>{let et=!0;for(const b of j.node.inputs)if(!this._values[b]&&this.graph.getInputIndices().indexOf(b)===-1){et=!1;break}et&&this._starter.push(nt)})})}reset(){this._values=this.graph.getValues().map($=>$.tensor)}async execute($,_){return this.profiler.event("session","ExecutionPlan.execute",async()=>{this.reset();const j=$.createInferenceHandler(),nt=this.graph.getInputIndices();if(_.length!==nt.length)throw new Error(`number of input tensors don't match the number of inputs to the model: actual: ${_.length} expected: ${nt.length}`);_.forEach((g,it)=>{const st=nt[it];this._values[st]=g});const et=this._starter.slice(0),b=this.graph.getValues(),a=this.graph.getNodes();let o=0;for(;o<et.length;){const g=et[o++],it=this._ops[g],st=it.node.inputs.map(at=>this._values[at]);if(st.indexOf(void 0)!==-1)throw new Error(`unresolved input detected: op: ${it.node}`);const tt=st;c.Logger.verbose("ExecPlan",`Runing op:${it.node.name} (${tt.map((at,ut)=>`'${it.node.inputs[ut]}': ${at.type}[${at.dims.join(",")}]`).join(", ")})`);const ot=await this.profiler.event("node",it.node.name,async()=>it.op.impl(j,tt,it.op.context));if(ot.length!==it.node.outputs.length)throw new Error("the size of output does not match model definition.");ot.forEach((at,ut)=>{const lt=it.node.outputs[ut];if(this._values[lt])throw new Error(`output [${lt}] already has value: op:${it.node.name}`);this._values[lt]=at});const rt=new Set;ot.forEach((at,ut)=>{const lt=it.node.outputs[ut];for(const ct of b[lt].to){const ft=a[ct];let dt=!0;for(const _t of ft.inputs)if(!this._values[_t]){dt=!1;break}dt&&rt.add(ct)}}),et.push(...rt)}const d=[];for(let g=0;g<this.graph.getOutputIndices().length;g++){const it=this.graph.getOutputIndices()[g],st=this._values[it];if(st===void 0)throw new Error(`required output [${it}] does not have value`);it===0?await st.getData():st.data,d.push(st)}return c.Logger.verbose("ExecPlan","disposing of inferenceHandler"),j.dispose(),d})}}},7070:(i,e,s)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Graph=void 0;const c=s(1446),h=s(7778),$=s(9395),_=s(9162),j=s(2517);var nt=$.onnxruntime.experimental.fbs;e.Graph={from:(o,d)=>new a(o,d)};class et{constructor(d){this._from=void 0,this._to=[],this.tensor=void 0,this.type=void 0,d&&(this.type=j.ProtoUtil.tensorValueTypeFromProto(d.type.tensorType))}get from(){return this._from}get to(){return this._to}}class b{constructor(d,g){d instanceof c.onnx.NodeProto?(this.name=d.name,this.opType=d.opType,this.attributes=new h.Attribute(d.attribute)):d instanceof nt.Node&&(this.name=g??d.name(),this.opType=d.opType(),this.attributes=new h.Attribute(j.ProtoUtil.tensorAttributesFromORTFormat(d))),this.inputs=[],this.outputs=[],this.executeNode=!0}}class a{constructor(d,g){if(!d)throw new TypeError("graph is empty");this.buildGraph(d),this.transformGraph(g),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(d){if(d instanceof c.onnx.GraphProto)this.buildGraphFromOnnxFormat(d);else{if(!(d instanceof nt.Graph))throw new TypeError("Graph type is not supported.");this.buildGraphFromOrtFormat(d)}}buildGraphFromOnnxFormat(d){const g=new Map;this._allData=[],this._allInputIndices=[],this._allInputNames=[],this._allOutputIndices=[],this._allOutputNames=[],this._nodes=[];const it=new Map;if(!d.input)throw new Error("missing information in graph: input");const st=[];for(const tt of d.input){if(g.has(tt.name))throw new Error(`duplicated input name: ${tt.name}`);const ot=this._allData.push(new et(tt))-1;g.set(tt.name,ot),st.push(tt.name)}if(!d.initializer)throw new Error("missing information in graph: initializer");for(const tt of d.initializer){let ot=g.get(tt.name);if(ot===void 0){const rt=new et;rt.type={shape:{dims:j.ProtoUtil.tensorDimsFromProto(tt.dims)},tensorType:j.ProtoUtil.tensorDataTypeFromProto(tt.dataType)},ot=this._allData.push(rt)-1,g.set(tt.name,ot)}this._allData[ot]._from=-1,this._allData[ot].tensor=_.Tensor.fromProto(tt)}for(let tt=0;tt<this._allData.length;tt++)this._allData[tt].tensor||(this._allInputIndices.push(tt),this._allInputNames.push(st[tt]));if(!d.output)throw new Error("missing information in graph: output");for(const tt of d.output){if(g.has(tt.name))throw new Error(`duplicated output name: ${tt.name}`);const ot=this._allData.push(new et(tt))-1;g.set(tt.name,ot),this._allOutputIndices.push(ot),this._allOutputNames.push(tt.name)}if(!d.node)throw new Error("missing information in graph: node");for(const tt of d.node){if(!tt.name)for(let rt=0;;rt++){const at=`unnamed_${tt.opType}_${rt}`;if(!it.has(at)){tt.name=at;break}}if(it.has(tt.name))throw new Error(`duplicated node name: ${tt.name}`);const ot=this._nodes.push(new b(tt))-1;it.set(tt.name,ot)}for(let tt=0;tt<this._nodes.length;tt++){const ot=this._nodes[tt],rt=d.node[tt];if(!rt.output)throw new Error(`missing output for node: ${rt.name}`);for(const at of rt.output){let ut=g.get(at);if(ut===void 0&&(ut=this._allData.push(new et)-1,g.set(at,ut)),ot.outputs.push(ut),this._allData[ut]._from!==void 0)throw new Error(`multiple nodes output to one data value: ${ut}`);if(this._allData[ut]._from=tt,rt.opType==="Constant"){if(!rt.attribute||rt.attribute.length!==1||!rt.attribute[0].t)throw new Error("missing attributes or missing tensor value in attributes for this Constant operator");if(!rt.output||rt.output.length!==1)throw new Error("missing output or incorrect number of outputs for this Constant operator");ot.outputs.pop(),ot.executeNode=!1,this._allData[ut]._from=-1,this._allData[ut].tensor=_.Tensor.fromProto(rt.attribute[0].t)}}}for(let tt=0;tt<this._nodes.length;tt++){const ot=this._nodes[tt],rt=d.node[tt];if(!rt.input)throw new Error(`missing input for node: ${rt.name}`);for(const at of rt.input){const ut=g.get(at);if(ut===void 0){if(at===""&&rt.input.length===3&&rt.opType==="Resize")continue;throw new Error(`unrecognized input '${at}' for node: ${rt.name}`)}ot.inputs.push(ut),this._allData[ut]._to.push(tt)}}return!0}buildGraphFromOrtFormat(d){var g,it,st;const tt=new Map;this._allData=[],this._allInputIndices=[],this._allInputNames=[],this._allOutputIndices=[],this._allOutputNames=[],this._nodes=[];const ot=new Map,rt=[];for(let at=0;at<d.inputsLength();at++){const ut=d.inputs(at);if(tt.has(ut))throw new Error(`duplicated input name: ${ut}`);for(let lt=0;lt<d.nodeArgsLength();lt++)if(((g=d.nodeArgs(lt))===null||g===void 0?void 0:g.name())===ut){const ct=new et;if(((st=(it=d.nodeArgs(lt))===null||it===void 0?void 0:it.type())===null||st===void 0?void 0:st.valueType())!==nt.TypeInfoValue.tensor_type)throw new Error("Unexpected value type for the nodeArg.");const ft=d.nodeArgs(lt).type().value(new nt.TensorTypeAndShape),dt=j.ProtoUtil.tensorDataTypeFromProto(ft.elemType()),_t=ft.shape(),wt=[];for(let Tt=0;Tt<_t.dimLength();Tt++)wt.push(j.LongUtil.longToNumber(_t.dim(Tt).value().dimValue()));ct.type={shape:{dims:wt},tensorType:dt};const bt=this._allData.push(ct)-1;tt.set(ut,bt),rt.push(ut)}}for(let at=0;at<d.initializersLength();at++){const ut=d.initializers(at);let lt=tt.get(ut.name());if(lt===void 0){const ct=new et,ft=j.ProtoUtil.tensorDimsFromORTFormat(ut),dt=j.ProtoUtil.tensorDataTypeFromProto(ut.dataType());ct.type={shape:{dims:ft},tensorType:dt},lt=this._allData.push(ct)-1,tt.set(ut.name(),lt)}this._allData[lt]._from=-1,this._allData[lt].tensor=_.Tensor.fromOrtTensor(ut)}for(let at=0;at<this._allData.length;at++)this._allData[at].tensor||(this._allInputIndices.push(at),this._allInputNames.push(rt[at]));for(let at=0;at<d.outputsLength();at++){const ut=d.outputs(at);if(tt.has(ut))throw new Error(`duplicated output name: ${ut}`);const lt=this._allData.push(new et)-1;tt.set(ut,lt),this._allOutputIndices.push(lt),this._allOutputNames.push(ut)}if(!d.nodes)throw new Error("missing information in graph: node");for(let at=0;at<d.nodesLength();at++){const ut=d.nodes(at);let lt=ut.name();if(!lt)for(let ft=0;lt=`unnamed_${ut.opType()}_${ft}`,ot.has(lt);ft++);if(ot.has(lt))throw new Error(`duplicated node name: ${lt}`);const ct=this._nodes.push(new b(ut,lt))-1;ot.set(lt,ct)}for(let at=0;at<this._nodes.length;at++){const ut=this._nodes[at],lt=d.nodes(at);if(lt==null)throw new Error(`No node exists at index ${at}`);if((lt==null?void 0:lt.outputsLength())===0)throw new Error(`missing output for node: ${lt.name}`);for(let ct=0;ct<(lt==null?void 0:lt.outputsLength());ct++){const ft=lt==null?void 0:lt.outputs(ct);let dt=tt.get(ft);if(dt===void 0&&(dt=this._allData.push(new et)-1,tt.set(ft,dt)),ut.outputs.push(dt),this._allData[dt]._from!==void 0)throw new Error(`multiple nodes output to one data value: ${dt}`);if(this._allData[dt]._from=at,lt.opType()==="Constant"){if(lt.attributesLength()!==1||!lt.attributes(0).t())throw new Error("missing attributes or missing tensor value in attributes for this Constant operator");if(lt.outputsLength()!==1)throw new Error("missing output or incorrect number of outputs for this Constant operator");ut.outputs.pop(),ut.executeNode=!1,this._allData[dt]._from=-1,this._allData[dt].tensor=_.Tensor.fromOrtTensor(lt.attributes(0).t())}}}for(let at=0;at<this._nodes.length;at++){const ut=this._nodes[at],lt=d.nodes(at);if(lt.inputsLength()===0)throw new Error(`missing input for node: ${lt.name}`);for(let ct=0;ct<lt.inputsLength();ct++){const ft=lt.inputs(ct),dt=tt.get(ft);if(dt===void 0)throw new Error(`unrecognized input '${ft}' for node: ${lt.name()}`);ut.inputs.push(dt),this._allData[dt]._to.push(at)}}}checkIsAcyclic(){const d=new Set;this._allInputIndices.forEach(st=>{this._allData[st]._to.forEach(tt=>{d.add(tt)})});const g=Array.from(d),it=new Array(this._nodes.length).fill("white");for(;g.length>0;){const st=g.pop();it[st]==="gray"?it[st]="black":(g.push(st),it[st]="gray",this._nodes[st].outputs.forEach(tt=>{const ot=this._allData[tt];if(ot.tensor!==void 0)throw new Error("node outputs should not be initialized");if(ot._from!==st)throw new Error("from property of the Value object doesn't match index of Node being processed");ot._to.forEach(rt=>{if(it[rt]==="gray")throw new Error("model graph is cyclic");it[rt]==="white"&&g.push(rt)})}))}}transformGraph(d){this.removeAllIdentityNodes(),this.removeAllDropoutNodes(),this.fuseConvActivationNodes(),d&&d.transformGraph(this),this.finalizeGraph()}finalizeGraph(){let d=0;for(let g=0;g<this._nodes.length;g++)this._nodes[g].executeNode?d>0&&(this._nodes[g].inputs.forEach(it=>{const st=this._allData[it]._to.indexOf(g+d);st!==-1&&(this._allData[it]._to[st]=g)}),this._nodes[g].outputs.forEach(it=>{this._allData[it]._from&&this._allData[it]._from===g+d&&(this._allData[it]._from=g)})):(d++,this._nodes[g].outputs.forEach(it=>{this._allData[it]._from=-2}),this._nodes.splice(g,1),g--);d=0;for(let g=0;g<this._allData.length;g++)if(this._allData[g].from!==-2||this._allOutputIndices.indexOf(g+d)!==-1){if(d>0){let it=-1;this._allData[g].from!==void 0&&this._allData[g].from!==-1?(it=this._nodes[this._allData[g].from].outputs.indexOf(g+d),it!==-1&&(this._nodes[this._allData[g].from].outputs[it]=g)):(it=this._allInputIndices.indexOf(g+d),it!==-1&&(this._allInputIndices[it]=g)),this._allData[g].to.forEach(st=>{it=this._nodes[st].inputs.indexOf(g+d),it!==-1&&(this._nodes[st].inputs[it]=g)}),this._allData[g].to.length===0&&(it=this._allOutputIndices.indexOf(g+d),it!==-1&&(this._allOutputIndices[it]=g))}}else d++,this._allData.splice(g,1),g--}deleteNode(d){const g=this._nodes[d];if(g.outputs.length>1){for(let at=1;at<g.outputs.length;at++)if(this._allData[g.outputs[at]].to.length>0)throw new Error("Node deletion with more than one output connected to other nodes is not supported. ")}g.executeNode=!1;const it=g.inputs[0],st=g.outputs[0],tt=this._allData[st].to,ot=this._allData[it].to.indexOf(d);if(ot===-1)throw new Error("The Value object doesn't have the current Node in it's 'to' property ");this._allData[it].to.splice(ot,1),this._allData[st]._to=[];const rt=this._allOutputIndices.indexOf(st);if(rt!==-1&&(this._allOutputIndices[rt]=it),tt&&tt.length>0)for(const at of tt){const ut=this._nodes[at].inputs.indexOf(st);if(ut===-1)throw new Error("The Node object doesn't have the output Value in it's 'inputs' property ");this._nodes[at].inputs[ut]=it,this._allData[it].to.push(at)}}removeAllDropoutNodes(){let d=0;for(const g of this._nodes){if(g.opType==="Dropout"){if(g.inputs.length!==1)throw new Error("Dropout nodes should only contain one input. ");if(g.outputs.length!==1&&g.outputs.length!==2)throw new Error("Dropout nodes should contain either 1 or 2 output(s)");if(g.outputs.length===2&&this._allData[g.outputs[1]]._to.length!==0)throw new Error("Dropout nodes's second output should not be referenced by other nodes");this.deleteNode(d)}d++}}removeAllIdentityNodes(){let d=0;for(const g of this._nodes)g.opType==="Identity"&&this.deleteNode(d),d++}isActivation(d){switch(d.opType){case"Relu":case"Sigmoid":case"Clip":return!0;default:return!1}}fuseConvActivationNodes(){for(const d of this._nodes)if(d.opType==="Conv"){const g=this._allData[d.outputs[0]]._to;if(g.length===1&&this.isActivation(this._nodes[g[0]])){const it=this._nodes[g[0]];if(it.opType==="Clip")if(it.inputs.length===1)try{d.attributes.set("activation_params","floats",[it.attributes.getFloat("min"),it.attributes.getFloat("max")])}catch{d.attributes.set("activation_params","floats",[j.MIN_CLIP,j.MAX_CLIP])}else{if(!(it.inputs.length>=3&&this._allData[it.inputs[1]].tensor!==void 0&&this._allData[it.inputs[2]].tensor!==void 0))continue;d.attributes.set("activation_params","floats",[this._allData[it.inputs[1]].tensor.floatData[0],this._allData[it.inputs[2]].tensor.floatData[0]])}d.attributes.set("activation","string",it.opType),this.deleteNode(g[0])}}}}},6231:(i,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.now=e.Profiler=e.Logger=void 0;const s={verbose:1e3,info:2e3,warning:4e3,error:5e3,fatal:6e3},c={none:new class{log(b,a,o){}},console:new class{log(b,a,o){console.log(`${this.color(b)} ${o?"\x1B[35m"+o+"\x1B[0m ":""}${a}`)}color(b){switch(b){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: ${b}`)}}}},h={provider:"console",minimalSeverity:"warning",logDateTime:!0,logSourceLocation:!1};let $={"":h};function _(b,a,o,d){if(a===void 0)return g=b,{verbose:_.verbose.bind(null,g),info:_.info.bind(null,g),warning:_.warning.bind(null,g),error:_.error.bind(null,g),fatal:_.fatal.bind(null,g)};if(o===void 0)j(b,a);else if(typeof o=="number"&&d===void 0)j(b,a);else if(typeof o=="string"&&d===void 0)j(b,o,0,a);else{if(typeof o!="string"||typeof d!="number")throw new TypeError("input is valid");j(b,o,0,a)}var g}function j(b,a,o,d){const g=$[d||""]||$[""];s[b]<s[g.minimalSeverity]||(g.logDateTime&&(a=`${new Date().toISOString()}|${a}`),g.logSourceLocation,c[g.provider].log(b,a,d))}(function(b){function a(d){$={},o("",d||{})}function o(d,g){if(d==="*")a(g);else{const it=$[d]||h;$[d]={provider:g.provider||it.provider,minimalSeverity:g.minimalSeverity||it.minimalSeverity,logDateTime:g.logDateTime===void 0?it.logDateTime:g.logDateTime,logSourceLocation:g.logSourceLocation===void 0?it.logSourceLocation:g.logSourceLocation}}}b.verbose=function(d,g){b("verbose",d,g)},b.info=function(d,g){b("info",d,g)},b.warning=function(d,g){b("warning",d,g)},b.error=function(d,g){b("error",d,g)},b.fatal=function(d,g){b("fatal",d,g)},b.reset=a,b.set=o,b.setWithEnv=function(d){const g={};d.logLevel&&(g.minimalSeverity=d.logLevel),o("",g)}})(_||(_={})),e.Logger=_;class nt{constructor(a,o,d,g,it,st){this.category=a,this.name=o,this.startTime=d,this.endCallback=g,this.timer=it,this.ctx=st}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 et{constructor(a,o,d,g){this.category=a,this.name=o,this.startTime=d,this.endTime=g}}e.Profiler=class{static create(b){return b===void 0?new this:new this(b.maxNumberEvents,b.flushBatchSize,b.flushIntervalInMilliseconds)}constructor(b,a,o){this._started=!1,this._flushPointer=0,this._started=!1,this._maxNumberEvents=b===void 0?1e4:b,this._flushBatchSize=a===void 0?10:a,this._flushIntervalInMilliseconds=o===void 0?5e3:o}start(){this._started=!0,this._timingEvents=[],this._flushTime=(0,e.now)(),this._flushPointer=0}stop(){for(this._started=!1;this._flushPointer<this._timingEvents.length;this._flushPointer++)this.logOneEvent(this._timingEvents[this._flushPointer])}event(b,a,o,d){const g=this._started?this.begin(b,a,d):void 0;let it=!1;const st=o();if(st&&typeof st.then=="function")return it=!0,new Promise((tt,ot)=>{st.then(async rt=>{g&&await g.end(),tt(rt)},async rt=>{g&&await g.end(),ot(rt)})});if(!it&&g){const tt=g.end();if(tt&&typeof tt.then=="function")return new Promise((ot,rt)=>{tt.then(()=>{ot(st)},at=>{rt(at)})})}return st}begin(b,a,o){if(!this._started)throw new Error("profiler is not started yet");if(o===void 0){const d=(0,e.now)();return this.flush(d),new nt(b,a,d,g=>this.endSync(g))}{const d=o.beginTimer();return new nt(b,a,0,async g=>this.end(g),d,o)}}async end(b){const a=await b.checkTimer();this._timingEvents.length<this._maxNumberEvents&&(this._timingEvents.push(new et(b.category,b.name,b.startTime,a)),this.flush(a))}endSync(b){const a=(0,e.now)();this._timingEvents.length<this._maxNumberEvents&&(this._timingEvents.push(new et(b.category,b.name,b.startTime,a)),this.flush(a))}logOneEvent(b){e.Logger.verbose(`Profiler.${b.category}`,`${(b.endTime-b.startTime).toFixed(2)}ms on event '${b.name}' at ${b.endTime.toFixed(2)}`)}flush(b){if(this._timingEvents.length-this._flushPointer>=this._flushBatchSize||b-this._flushTime>=this._flushIntervalInMilliseconds){for(const a=this._flushPointer;this._flushPointer<a+this._flushBatchSize&&this._flushPointer<this._timingEvents.length;this._flushPointer++)this.logOneEvent(this._timingEvents[this._flushPointer]);this._flushTime=(0,e.now)()}}get started(){return this._started}},e.now=typeof performance<"u"&&performance.now?()=>performance.now():Date.now},2644:(i,e,s)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Model=void 0;const c=s(5686),h=s(1446),$=s(7070),_=s(9395),j=s(2517);var nt=_.onnxruntime.experimental.fbs;e.Model=class{constructor(){}load(et,b,a){if(!a)try{return void this.loadFromOnnxFormat(et,b)}catch(o){if(a!==void 0)throw o}this.loadFromOrtFormat(et,b)}loadFromOnnxFormat(et,b){const a=h.onnx.ModelProto.decode(et);if(j.LongUtil.longToNumber(a.irVersion)<3)throw new Error("only support ONNX model with IR_VERSION>=3");this._opsets=a.opsetImport.map(o=>({domain:o.domain,version:j.LongUtil.longToNumber(o.version)})),this._graph=$.Graph.from(a.graph,b)}loadFromOrtFormat(et,b){const a=new c.flatbuffers.ByteBuffer(et),o=nt.InferenceSession.getRootAsInferenceSession(a).model();if(j.LongUtil.longToNumber(o.irVersion())<3)throw new Error("only support ONNX model with IR_VERSION>=3");this._opsets=[];for(let d=0;d<o.opsetImportLength();d++){const g=o.opsetImport(d);this._opsets.push({domain:g==null?void 0:g.domain(),version:j.LongUtil.longToNumber(g.version())})}this._graph=$.Graph.from(o.graph(),b)}get graph(){return this._graph}get opsets(){return this._opsets}}},782:(i,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.FLOAT_TYPES=e.INT_TYPES=e.NUMBER_TYPES=void 0,e.NUMBER_TYPES=["float32","float64","int32","int16","int8","uint16","uint32","uint8"],e.INT_TYPES=["int32","int16","int8","uint16","uint32","uint8"],e.FLOAT_TYPES=["float32","float64"]},1047:(i,e)=>{function s(c,h){if(h.endsWith("+")){const $=Number.parseInt(h.substring(0,h.length-1),10);return!isNaN($)&&$<=c}if(h.split("-").length===2){const $=h.split("-"),_=Number.parseInt($[0],10),j=Number.parseInt($[1],10);return!isNaN(_)&&!isNaN(j)&&_<=c&&c<=j}return Number.parseInt(h,10)===c}Object.defineProperty(e,"__esModule",{value:!0}),e.resolveOperator=void 0,e.resolveOperator=function(c,h,$){for(const _ of $){const j=_[0],nt=_[1],et=_[2],b=_[3],a=_[4];if(c.opType===j){for(const o of h)if((o.domain===nt||o.domain==="ai.onnx"&&nt==="")&&s(o.version,et))return{opImpl:b,opInit:a}}}throw new TypeError(`cannot resolve operator '${c.opType}' with opsets: ${h.map(_=>`${_.domain||"ai.onnx"} v${_.version}`).join(", ")}`)}},9395:(i,e,s)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.onnxruntime=void 0;const c=s(5686);var h,$;h=e.onnxruntime||(e.onnxruntime={}),function(_){(function(j){j[j.UNDEFINED=0]="UNDEFINED",j[j.FLOAT=1]="FLOAT",j[j.INT=2]="INT",j[j.STRING=3]="STRING",j[j.TENSOR=4]="TENSOR",j[j.GRAPH=5]="GRAPH",j[j.FLOATS=6]="FLOATS",j[j.INTS=7]="INTS",j[j.STRINGS=8]="STRINGS",j[j.TENSORS=9]="TENSORS",j[j.GRAPHS=10]="GRAPHS",j[j.SPARSE_TENSOR=11]="SPARSE_TENSOR",j[j.SPARSE_TENSORS=12]="SPARSE_TENSORS"})(_.AttributeType||(_.AttributeType={}))}(($=h.experimental||(h.experimental={})).fbs||($.fbs={})),function(_){(function(j){(function(nt){(function(et){et[et.UNKNOWN=0]="UNKNOWN",et[et.VALUE=1]="VALUE",et[et.PARAM=2]="PARAM"})(nt.DimensionValueType||(nt.DimensionValueType={}))})(j.fbs||(j.fbs={}))})(_.experimental||(_.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(_){(function(j){(function(nt){(function(et){et[et.UNDEFINED=0]="UNDEFINED",et[et.FLOAT=1]="FLOAT",et[et.UINT8=2]="UINT8",et[et.INT8=3]="INT8",et[et.UINT16=4]="UINT16",et[et.INT16=5]="INT16",et[et.INT32=6]="INT32",et[et.INT64=7]="INT64",et[et.STRING=8]="STRING",et[et.BOOL=9]="BOOL",et[et.FLOAT16=10]="FLOAT16",et[et.DOUBLE=11]="DOUBLE",et[et.UINT32=12]="UINT32",et[et.UINT64=13]="UINT64",et[et.COMPLEX64=14]="COMPLEX64",et[et.COMPLEX128=15]="COMPLEX128",et[et.BFLOAT16=16]="BFLOAT16"})(nt.TensorDataType||(nt.TensorDataType={}))})(j.fbs||(j.fbs={}))})(_.experimental||(_.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(_){(function(j){(function(nt){(function(et){et[et.Primitive=0]="Primitive",et[et.Fused=1]="Fused"})(nt.NodeType||(nt.NodeType={}))})(j.fbs||(j.fbs={}))})(_.experimental||(_.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(_){(function(j){(function(nt){(function(et){et[et.NONE=0]="NONE",et[et.tensor_type=1]="tensor_type",et[et.sequence_type=2]="sequence_type",et[et.map_type=3]="map_type"})(nt.TypeInfoValue||(nt.TypeInfoValue={}))})(j.fbs||(j.fbs={}))})(_.experimental||(_.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(_){(function(j){(function(nt){class et{constructor(){this.bb=null,this.bb_pos=0}__init(a,o){return this.bb_pos=a,this.bb=o,this}static getRootAsShape(a,o){return(o||new et).__init(a.readInt32(a.position())+a.position(),a)}static getSizePrefixedRootAsShape(a,o){return a.setPosition(a.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(o||new et).__init(a.readInt32(a.position())+a.position(),a)}dim(a,o){let d=this.bb.__offset(this.bb_pos,4);return d?(o||new _.experimental.fbs.Dimension).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+d)+4*a),this.bb):null}dimLength(){let a=this.bb.__offset(this.bb_pos,4);return a?this.bb.__vector_len(this.bb_pos+a):0}static startShape(a){a.startObject(1)}static addDim(a,o){a.addFieldOffset(0,o,0)}static createDimVector(a,o){a.startVector(4,o.length,4);for(let d=o.length-1;d>=0;d--)a.addOffset(o[d]);return a.endVector()}static startDimVector(a,o){a.startVector(4,o,4)}static endShape(a){return a.endObject()}static createShape(a,o){return et.startShape(a),et.addDim(a,o),et.endShape(a)}}nt.Shape=et})(j.fbs||(j.fbs={}))})(_.experimental||(_.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(_){(function(j){(function(nt){class et{constructor(){this.bb=null,this.bb_pos=0}__init(a,o){return this.bb_pos=a,this.bb=o,this}static getRootAsDimension(a,o){return(o||new et).__init(a.readInt32(a.position())+a.position(),a)}static getSizePrefixedRootAsDimension(a,o){return a.setPosition(a.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(o||new et).__init(a.readInt32(a.position())+a.position(),a)}value(a){let o=this.bb.__offset(this.bb_pos,4);return o?(a||new _.experimental.fbs.DimensionValue).__init(this.bb.__indirect(this.bb_pos+o),this.bb):null}denotation(a){let o=this.bb.__offset(this.bb_pos,6);return o?this.bb.__string(this.bb_pos+o,a):null}static startDimension(a){a.startObject(2)}static addValue(a,o){a.addFieldOffset(0,o,0)}static addDenotation(a,o){a.addFieldOffset(1,o,0)}static endDimension(a){return a.endObject()}static createDimension(a,o,d){return et.startDimension(a),et.addValue(a,o),et.addDenotation(a,d),et.endDimension(a)}}nt.Dimension=et})(j.fbs||(j.fbs={}))})(_.experimental||(_.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(_){(function(j){(function(nt){class et{constructor(){this.bb=null,this.bb_pos=0}__init(a,o){return this.bb_pos=a,this.bb=o,this}static getRootAsDimensionValue(a,o){return(o||new et).__init(a.readInt32(a.position())+a.position(),a)}static getSizePrefixedRootAsDimensionValue(a,o){return a.setPosition(a.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(o||new et).__init(a.readInt32(a.position())+a.position(),a)}dimType(){let a=this.bb.__offset(this.bb_pos,4);return a?this.bb.readInt8(this.bb_pos+a):_.experimental.fbs.DimensionValueType.UNKNOWN}dimValue(){let a=this.bb.__offset(this.bb_pos,6);return a?this.bb.readInt64(this.bb_pos+a):this.bb.createLong(0,0)}dimParam(a){let o=this.bb.__offset(this.bb_pos,8);return o?this.bb.__string(this.bb_pos+o,a):null}static startDimensionValue(a){a.startObject(3)}static addDimType(a,o){a.addFieldInt8(0,o,_.experimental.fbs.DimensionValueType.UNKNOWN)}static addDimValue(a,o){a.addFieldInt64(1,o,a.createLong(0,0))}static addDimParam(a,o){a.addFieldOffset(2,o,0)}static endDimensionValue(a){return a.endObject()}static createDimensionValue(a,o,d,g){return et.startDimensionValue(a),et.addDimType(a,o),et.addDimValue(a,d),et.addDimParam(a,g),et.endDimensionValue(a)}}nt.DimensionValue=et})(j.fbs||(j.fbs={}))})(_.experimental||(_.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(_){(function(j){(function(nt){class et{constructor(){this.bb=null,this.bb_pos=0}__init(a,o){return this.bb_pos=a,this.bb=o,this}static getRootAsTensorTypeAndShape(a,o){return(o||new et).__init(a.readInt32(a.position())+a.position(),a)}static getSizePrefixedRootAsTensorTypeAndShape(a,o){return a.setPosition(a.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(o||new et).__init(a.readInt32(a.position())+a.position(),a)}elemType(){let a=this.bb.__offset(this.bb_pos,4);return a?this.bb.readInt32(this.bb_pos+a):_.experimental.fbs.TensorDataType.UNDEFINED}shape(a){let o=this.bb.__offset(this.bb_pos,6);return o?(a||new _.experimental.fbs.Shape).__init(this.bb.__indirect(this.bb_pos+o),this.bb):null}static startTensorTypeAndShape(a){a.startObject(2)}static addElemType(a,o){a.addFieldInt32(0,o,_.experimental.fbs.TensorDataType.UNDEFINED)}static addShape(a,o){a.addFieldOffset(1,o,0)}static endTensorTypeAndShape(a){return a.endObject()}static createTensorTypeAndShape(a,o,d){return et.startTensorTypeAndShape(a),et.addElemType(a,o),et.addShape(a,d),et.endTensorTypeAndShape(a)}}nt.TensorTypeAndShape=et})(j.fbs||(j.fbs={}))})(_.experimental||(_.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(_){(function(j){(function(nt){class et{constructor(){this.bb=null,this.bb_pos=0}__init(a,o){return this.bb_pos=a,this.bb=o,this}static getRootAsMapType(a,o){return(o||new et).__init(a.readInt32(a.position())+a.position(),a)}static getSizePrefixedRootAsMapType(a,o){return a.setPosition(a.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(o||new et).__init(a.readInt32(a.position())+a.position(),a)}keyType(){let a=this.bb.__offset(this.bb_pos,4);return a?this.bb.readInt32(this.bb_pos+a):_.experimental.fbs.TensorDataType.UNDEFINED}valueType(a){let o=this.bb.__offset(this.bb_pos,6);return o?(a||new _.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+o),this.bb):null}static startMapType(a){a.startObject(2)}static addKeyType(a,o){a.addFieldInt32(0,o,_.experimental.fbs.TensorDataType.UNDEFINED)}static addValueType(a,o){a.addFieldOffset(1,o,0)}static endMapType(a){return a.endObject()}static createMapType(a,o,d){return et.startMapType(a),et.addKeyType(a,o),et.addValueType(a,d),et.endMapType(a)}}nt.MapType=et})(j.fbs||(j.fbs={}))})(_.experimental||(_.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(_){(function(j){(function(nt){class et{constructor(){this.bb=null,this.bb_pos=0}__init(a,o){return this.bb_pos=a,this.bb=o,this}static getRootAsSequenceType(a,o){return(o||new et).__init(a.readInt32(a.position())+a.position(),a)}static getSizePrefixedRootAsSequenceType(a,o){return a.setPosition(a.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(o||new et).__init(a.readInt32(a.position())+a.position(),a)}elemType(a){let o=this.bb.__offset(this.bb_pos,4);return o?(a||new _.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+o),this.bb):null}static startSequenceType(a){a.startObject(1)}static addElemType(a,o){a.addFieldOffset(0,o,0)}static endSequenceType(a){return a.endObject()}static createSequenceType(a,o){return et.startSequenceType(a),et.addElemType(a,o),et.endSequenceType(a)}}nt.SequenceType=et})(j.fbs||(j.fbs={}))})(_.experimental||(_.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(_){(function(j){(j.fbs||(j.fbs={})).EdgeEnd=class{constructor(){this.bb=null,this.bb_pos=0}__init(nt,et){return this.bb_pos=nt,this.bb=et,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(nt,et,b,a){return nt.prep(4,12),nt.writeInt32(a),nt.writeInt32(b),nt.writeInt32(et),nt.offset()}}})(_.experimental||(_.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(_){(function(j){(function(nt){class et{constructor(){this.bb=null,this.bb_pos=0}__init(a,o){return this.bb_pos=a,this.bb=o,this}static getRootAsNodeEdge(a,o){return(o||new et).__init(a.readInt32(a.position())+a.position(),a)}static getSizePrefixedRootAsNodeEdge(a,o){return a.setPosition(a.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(o||new et).__init(a.readInt32(a.position())+a.position(),a)}nodeIndex(){let a=this.bb.__offset(this.bb_pos,4);return a?this.bb.readUint32(this.bb_pos+a):0}inputEdges(a,o){let d=this.bb.__offset(this.bb_pos,6);return d?(o||new _.experimental.fbs.EdgeEnd).__init(this.bb.__vector(this.bb_pos+d)+12*a,this.bb):null}inputEdgesLength(){let a=this.bb.__offset(this.bb_pos,6);return a?this.bb.__vector_len(this.bb_pos+a):0}outputEdges(a,o){let d=this.bb.__offset(this.bb_pos,8);return d?(o||new _.experimental.fbs.EdgeEnd).__init(this.bb.__vector(this.bb_pos+d)+12*a,this.bb):null}outputEdgesLength(){let a=this.bb.__offset(this.bb_pos,8);return a?this.bb.__vector_len(this.bb_pos+a):0}static startNodeEdge(a){a.startObject(3)}static addNodeIndex(a,o){a.addFieldInt32(0,o,0)}static addInputEdges(a,o){a.addFieldOffset(1,o,0)}static startInputEdgesVector(a,o){a.startVector(12,o,4)}static addOutputEdges(a,o){a.addFieldOffset(2,o,0)}static startOutputEdgesVector(a,o){a.startVector(12,o,4)}static endNodeEdge(a){return a.endObject()}static createNodeEdge(a,o,d,g){return et.startNodeEdge(a),et.addNodeIndex(a,o),et.addInputEdges(a,d),et.addOutputEdges(a,g),et.endNodeEdge(a)}}nt.NodeEdge=et})(j.fbs||(j.fbs={}))})(_.experimental||(_.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(_){(function(j){(function(nt){class et{constructor(){this.bb=null,this.bb_pos=0}__init(a,o){return this.bb_pos=a,this.bb=o,this}static getRootAsNode(a,o){return(o||new et).__init(a.readInt32(a.position())+a.position(),a)}static getSizePrefixedRootAsNode(a,o){return a.setPosition(a.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(o||new et).__init(a.readInt32(a.position())+a.position(),a)}name(a){let o=this.bb.__offset(this.bb_pos,4);return o?this.bb.__string(this.bb_pos+o,a):null}docString(a){let o=this.bb.__offset(this.bb_pos,6);return o?this.bb.__string(this.bb_pos+o,a):null}domain(a){let o=this.bb.__offset(this.bb_pos,8);return o?this.bb.__string(this.bb_pos+o,a):null}sinceVersion(){let a=this.bb.__offset(this.bb_pos,10);return a?this.bb.readInt32(this.bb_pos+a):0}index(){let a=this.bb.__offset(this.bb_pos,12);return a?this.bb.readUint32(this.bb_pos+a):0}opType(a){let o=this.bb.__offset(this.bb_pos,14);return o?this.bb.__string(this.bb_pos+o,a):null}type(){let a=this.bb.__offset(this.bb_pos,16);return a?this.bb.readInt32(this.bb_pos+a):_.experimental.fbs.NodeType.Primitive}executionProviderType(a){let o=this.bb.__offset(this.bb_pos,18);return o?this.bb.__string(this.bb_pos+o,a):null}inputs(a,o){let d=this.bb.__offset(this.bb_pos,20);return d?this.bb.__string(this.bb.__vector(this.bb_pos+d)+4*a,o):null}inputsLength(){let a=this.bb.__offset(this.bb_pos,20);return a?this.bb.__vector_len(this.bb_pos+a):0}outputs(a,o){let d=this.bb.__offset(this.bb_pos,22);return d?this.bb.__string(this.bb.__vector(this.bb_pos+d)+4*a,o):null}outputsLength(){let a=this.bb.__offset(this.bb_pos,22);return a?this.bb.__vector_len(this.bb_pos+a):0}attributes(a,o){let d=this.bb.__offset(this.bb_pos,24);return d?(o||new _.experimental.fbs.Attribute).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+d)+4*a),this.bb):null}attributesLength(){let a=this.bb.__offset(this.bb_pos,24);return a?this.bb.__vector_len(this.bb_pos+a):0}inputArgCounts(a){let o=this.bb.__offset(this.bb_pos,26);return o?this.bb.readInt32(this.bb.__vector(this.bb_pos+o)+4*a):0}inputArgCountsLength(){let a=this.bb.__offset(this.bb_pos,26);return a?this.bb.__vector_len(this.bb_pos+a):0}inputArgCountsArray(){let a=this.bb.__offset(this.bb_pos,26);return a?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+a),this.bb.__vector_len(this.bb_pos+a)):null}implicitInputs(a,o){let d=this.bb.__offset(this.bb_pos,28);return d?this.bb.__string(this.bb.__vector(this.bb_pos+d)+4*a,o):null}implicitInputsLength(){let a=this.bb.__offset(this.bb_pos,28);return a?this.bb.__vector_len(this.bb_pos+a):0}static startNode(a){a.startObject(13)}static addName(a,o){a.addFieldOffset(0,o,0)}static addDocString(a,o){a.addFieldOffset(1,o,0)}static addDomain(a,o){a.addFieldOffset(2,o,0)}static addSinceVersion(a,o){a.addFieldInt32(3,o,0)}static addIndex(a,o){a.addFieldInt32(4,o,0)}static addOpType(a,o){a.addFieldOffset(5,o,0)}static addType(a,o){a.addFieldInt32(6,o,_.experimental.fbs.NodeType.Primitive)}static addExecutionProviderType(a,o){a.addFieldOffset(7,o,0)}static addInputs(a,o){a.addFieldOffset(8,o,0)}static createInputsVector(a,o){a.startVector(4,o.length,4);for(let d=o.length-1;d>=0;d--)a.addOffset(o[d]);return a.endVector()}static startInputsVector(a,o){a.startVector(4,o,4)}static addOutputs(a,o){a.addFieldOffset(9,o,0)}static createOutputsVector(a,o){a.startVector(4,o.length,4);for(let d=o.length-1;d>=0;d--)a.addOffset(o[d]);return a.endVector()}static startOutputsVector(a,o){a.startVector(4,o,4)}static addAttributes(a,o){a.addFieldOffset(10,o,0)}static createAttributesVector(a,o){a.startVector(4,o.length,4);for(let d=o.length-1;d>=0;d--)a.addOffset(o[d]);return a.endVector()}static startAttributesVector(a,o){a.startVector(4,o,4)}static addInputArgCounts(a,o){a.addFieldOffset(11,o,0)}static createInputArgCountsVector(a,o){a.startVector(4,o.length,4);for(let d=o.length-1;d>=0;d--)a.addInt32(o[d]);return a.endVector()}static startInputArgCountsVector(a,o){a.startVector(4,o,4)}static addImplicitInputs(a,o){a.addFieldOffset(12,o,0)}static createImplicitInputsVector(a,o){a.startVector(4,o.length,4);for(let d=o.length-1;d>=0;d--)a.addOffset(o[d]);return a.endVector()}static startImplicitInputsVector(a,o){a.startVector(4,o,4)}static endNode(a){return a.endObject()}static createNode(a,o,d,g,it,st,tt,ot,rt,at,ut,lt,ct,ft){return et.startNode(a),et.addName(a,o),et.addDocString(a,d),et.addDomain(a,g),et.addSinceVersion(a,it),et.addIndex(a,st),et.addOpType(a,tt),et.addType(a,ot),et.addExecutionProviderType(a,rt),et.addInputs(a,at),et.addOutputs(a,ut),et.addAttributes(a,lt),et.addInputArgCounts(a,ct),et.addImplicitInputs(a,ft),et.endNode(a)}}nt.Node=et})(j.fbs||(j.fbs={}))})(_.experimental||(_.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(_){(function(j){(function(nt){class et{constructor(){this.bb=null,this.bb_pos=0}__init(a,o){return this.bb_pos=a,this.bb=o,this}static getRootAsValueInfo(a,o){return(o||new et).__init(a.readInt32(a.position())+a.position(),a)}static getSizePrefixedRootAsValueInfo(a,o){return a.setPosition(a.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(o||new et).__init(a.readInt32(a.position())+a.position(),a)}name(a){let o=this.bb.__offset(this.bb_pos,4);return o?this.bb.__string(this.bb_pos+o,a):null}docString(a){let o=this.bb.__offset(this.bb_pos,6);return o?this.bb.__string(this.bb_pos+o,a):null}type(a){let o=this.bb.__offset(this.bb_pos,8);return o?(a||new _.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+o),this.bb):null}static startValueInfo(a){a.startObject(3)}static addName(a,o){a.addFieldOffset(0,o,0)}static addDocString(a,o){a.addFieldOffset(1,o,0)}static addType(a,o){a.addFieldOffset(2,o,0)}static endValueInfo(a){return a.endObject()}static createValueInfo(a,o,d,g){return et.startValueInfo(a),et.addName(a,o),et.addDocString(a,d),et.addType(a,g),et.endValueInfo(a)}}nt.ValueInfo=et})(j.fbs||(j.fbs={}))})(_.experimental||(_.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(_){(function(j){(function(nt){class et{constructor(){this.bb=null,this.bb_pos=0}__init(a,o){return this.bb_pos=a,this.bb=o,this}static getRootAsTypeInfo(a,o){return(o||new et).__init(a.readInt32(a.position())+a.position(),a)}static getSizePrefixedRootAsTypeInfo(a,o){return a.setPosition(a.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(o||new et).__init(a.readInt32(a.position())+a.position(),a)}denotation(a){let o=this.bb.__offset(this.bb_pos,4);return o?this.bb.__string(this.bb_pos+o,a):null}valueType(){let a=this.bb.__offset(this.bb_pos,6);return a?this.bb.readUint8(this.bb_pos+a):_.experimental.fbs.TypeInfoValue.NONE}value(a){let o=this.bb.__offset(this.bb_pos,8);return o?this.bb.__union(a,this.bb_pos+o):null}static startTypeInfo(a){a.startObject(3)}static addDenotation(a,o){a.addFieldOffset(0,o,0)}static addValueType(a,o){a.addFieldInt8(1,o,_.experimental.fbs.TypeInfoValue.NONE)}static addValue(a,o){a.addFieldOffset(2,o,0)}static endTypeInfo(a){return a.endObject()}static createTypeInfo(a,o,d,g){return et.startTypeInfo(a),et.addDenotation(a,o),et.addValueType(a,d),et.addValue(a,g),et.endTypeInfo(a)}}nt.TypeInfo=et})(j.fbs||(j.fbs={}))})(_.experimental||(_.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(_){(function(j){(function(nt){class et{constructor(){this.bb=null,this.bb_pos=0}__init(a,o){return this.bb_pos=a,this.bb=o,this}static getRootAsOperatorSetId(a,o){return(o||new et).__init(a.readInt32(a.position())+a.position(),a)}static getSizePrefixedRootAsOperatorSetId(a,o){return a.setPosition(a.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(o||new et).__init(a.readInt32(a.position())+a.position(),a)}domain(a){let o=this.bb.__offset(this.bb_pos,4);return o?this.bb.__string(this.bb_pos+o,a):null}version(){let a=this.bb.__offset(this.bb_pos,6);return a?this.bb.readInt64(this.bb_pos+a):this.bb.createLong(0,0)}static startOperatorSetId(a){a.startObject(2)}static addDomain(a,o){a.addFieldOffset(0,o,0)}static addVersion(a,o){a.addFieldInt64(1,o,a.createLong(0,0))}static endOperatorSetId(a){return a.endObject()}static createOperatorSetId(a,o,d){return et.startOperatorSetId(a),et.addDomain(a,o),et.addVersion(a,d),et.endOperatorSetId(a)}}nt.OperatorSetId=et})(j.fbs||(j.fbs={}))})(_.experimental||(_.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(_){(function(j){(function(nt){class et{constructor(){this.bb=null,this.bb_pos=0}__init(a,o){return this.bb_pos=a,this.bb=o,this}static getRootAsTensor(a,o){return(o||new et).__init(a.readInt32(a.position())+a.position(),a)}static getSizePrefixedRootAsTensor(a,o){return a.setPosition(a.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(o||new et).__init(a.readInt32(a.position())+a.position(),a)}name(a){let o=this.bb.__offset(this.bb_pos,4);return o?this.bb.__string(this.bb_pos+o,a):null}docString(a){let o=this.bb.__offset(this.bb_pos,6);return o?this.bb.__string(this.bb_pos+o,a):null}dims(a){let o=this.bb.__offset(this.bb_pos,8);return o?this.bb.readInt64(this.bb.__vector(this.bb_pos+o)+8*a):this.bb.createLong(0,0)}dimsLength(){let a=this.bb.__offset(this.bb_pos,8);return a?this.bb.__vector_len(this.bb_pos+a):0}dataType(){let a=this.bb.__offset(this.bb_pos,10);return a?this.bb.readInt32(this.bb_pos+a):_.experimental.fbs.TensorDataType.UNDEFINED}rawData(a){let o=this.bb.__offset(this.bb_pos,12);return o?this.bb.readUint8(this.bb.__vector(this.bb_pos+o)+a):0}rawDataLength(){let a=this.bb.__offset(this.bb_pos,12);return a?this.bb.__vector_len(this.bb_pos+a):0}rawDataArray(){let a=this.bb.__offset(this.bb_pos,12);return a?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+a),this.bb.__vector_len(this.bb_pos+a)):null}stringData(a,o){let d=this.bb.__offset(this.bb_pos,14);return d?this.bb.__string(this.bb.__vector(this.bb_pos+d)+4*a,o):null}stringDataLength(){let a=this.bb.__offset(this.bb_pos,14);return a?this.bb.__vector_len(this.bb_pos+a):0}static startTensor(a){a.startObject(6)}static addName(a,o){a.addFieldOffset(0,o,0)}static addDocString(a,o){a.addFieldOffset(1,o,0)}static addDims(a,o){a.addFieldOffset(2,o,0)}static createDimsVector(a,o){a.startVector(8,o.length,8);for(let d=o.length-1;d>=0;d--)a.addInt64(o[d]);return a.endVector()}static startDimsVector(a,o){a.startVector(8,o,8)}static addDataType(a,o){a.addFieldInt32(3,o,_.experimental.fbs.TensorDataType.UNDEFINED)}static addRawData(a,o){a.addFieldOffset(4,o,0)}static createRawDataVector(a,o){a.startVector(1,o.length,1);for(let d=o.length-1;d>=0;d--)a.addInt8(o[d]);return a.endVector()}static startRawDataVector(a,o){a.startVector(1,o,1)}static addStringData(a,o){a.addFieldOffset(5,o,0)}static createStringDataVector(a,o){a.startVector(4,o.length,4);for(let d=o.length-1;d>=0;d--)a.addOffset(o[d]);return a.endVector()}static startStringDataVector(a,o){a.startVector(4,o,4)}static endTensor(a){return a.endObject()}static createTensor(a,o,d,g,it,st,tt){return et.startTensor(a),et.addName(a,o),et.addDocString(a,d),et.addDims(a,g),et.addDataType(a,it),et.addRawData(a,st),et.addStringData(a,tt),et.endTensor(a)}}nt.Tensor=et})(j.fbs||(j.fbs={}))})(_.experimental||(_.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(_){(function(j){(function(nt){class et{constructor(){this.bb=null,this.bb_pos=0}__init(a,o){return this.bb_pos=a,this.bb=o,this}static getRootAsSparseTensor(a,o){return(o||new et).__init(a.readInt32(a.position())+a.position(),a)}static getSizePrefixedRootAsSparseTensor(a,o){return a.setPosition(a.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(o||new et).__init(a.readInt32(a.position())+a.position(),a)}values(a){let o=this.bb.__offset(this.bb_pos,4);return o?(a||new _.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+o),this.bb):null}indices(a){let o=this.bb.__offset(this.bb_pos,6);return o?(a||new _.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+o),this.bb):null}dims(a){let o=this.bb.__offset(this.bb_pos,8);return o?this.bb.readInt64(this.bb.__vector(this.bb_pos+o)+8*a):this.bb.createLong(0,0)}dimsLength(){let a=this.bb.__offset(this.bb_pos,8);return a?this.bb.__vector_len(this.bb_pos+a):0}static startSparseTensor(a){a.startObject(3)}static addValues(a,o){a.addFieldOffset(0,o,0)}static addIndices(a,o){a.addFieldOffset(1,o,0)}static addDims(a,o){a.addFieldOffset(2,o,0)}static createDimsVector(a,o){a.startVector(8,o.length,8);for(let d=o.length-1;d>=0;d--)a.addInt64(o[d]);return a.endVector()}static startDimsVector(a,o){a.startVector(8,o,8)}static endSparseTensor(a){return a.endObject()}static createSparseTensor(a,o,d,g){return et.startSparseTensor(a),et.addValues(a,o),et.addIndices(a,d),et.addDims(a,g),et.endSparseTensor(a)}}nt.SparseTensor=et})(j.fbs||(j.fbs={}))})(_.experimental||(_.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(_){(function(j){(function(nt){class et{constructor(){this.bb=null,this.bb_pos=0}__init(a,o){return this.bb_pos=a,this.bb=o,this}static getRootAsAttribute(a,o){return(o||new et).__init(a.readInt32(a.position())+a.position(),a)}static getSizePrefixedRootAsAttribute(a,o){return a.setPosition(a.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(o||new et).__init(a.readInt32(a.position())+a.position(),a)}name(a){let o=this.bb.__offset(this.bb_pos,4);return o?this.bb.__string(this.bb_pos+o,a):null}docString(a){let o=this.bb.__offset(this.bb_pos,6);return o?this.bb.__string(this.bb_pos+o,a):null}type(){let a=this.bb.__offset(this.bb_pos,8);return a?this.bb.readInt32(this.bb_pos+a):_.experimental.fbs.AttributeType.UNDEFINED}f(){let a=this.bb.__offset(this.bb_pos,10);return a?this.bb.readFloat32(this.bb_pos+a):0}i(){let a=this.bb.__offset(this.bb_pos,12);return a?this.bb.readInt64(this.bb_pos+a):this.bb.createLong(0,0)}s(a){let o=this.bb.__offset(this.bb_pos,14);return o?this.bb.__string(this.bb_pos+o,a):null}t(a){let o=this.bb.__offset(this.bb_pos,16);return o?(a||new _.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+o),this.bb):null}g(a){let o=this.bb.__offset(this.bb_pos,18);return o?(a||new _.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb_pos+o),this.bb):null}floats(a){let o=this.bb.__offset(this.bb_pos,20);return o?this.bb.readFloat32(this.bb.__vector(this.bb_pos+o)+4*a):0}floatsLength(){let a=this.bb.__offset(this.bb_pos,20);return a?this.bb.__vector_len(this.bb_pos+a):0}floatsArray(){let a=this.bb.__offset(this.bb_pos,20);return a?new Float32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+a),this.bb.__vector_len(this.bb_pos+a)):null}ints(a){let o=this.bb.__offset(this.bb_pos,22);return o?this.bb.readInt64(this.bb.__vector(this.bb_pos+o)+8*a):this.bb.createLong(0,0)}intsLength(){let a=this.bb.__offset(this.bb_pos,22);return a?this.bb.__vector_len(this.bb_pos+a):0}strings(a,o){let d=this.bb.__offset(this.bb_pos,24);return d?this.bb.__string(this.bb.__vector(this.bb_pos+d)+4*a,o):null}stringsLength(){let a=this.bb.__offset(this.bb_pos,24);return a?this.bb.__vector_len(this.bb_pos+a):0}tensors(a,o){let d=this.bb.__offset(this.bb_pos,26);return d?(o||new _.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+d)+4*a),this.bb):null}tensorsLength(){let a=this.bb.__offset(this.bb_pos,26);return a?this.bb.__vector_len(this.bb_pos+a):0}graphs(a,o){let d=this.bb.__offset(this.bb_pos,28);return d?(o||new _.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+d)+4*a),this.bb):null}graphsLength(){let a=this.bb.__offset(this.bb_pos,28);return a?this.bb.__vector_len(this.bb_pos+a):0}static startAttribute(a){a.startObject(13)}static addName(a,o){a.addFieldOffset(0,o,0)}static addDocString(a,o){a.addFieldOffset(1,o,0)}static addType(a,o){a.addFieldInt32(2,o,_.experimental.fbs.AttributeType.UNDEFINED)}static addF(a,o){a.addFieldFloat32(3,o,0)}static addI(a,o){a.addFieldInt64(4,o,a.createLong(0,0))}static addS(a,o){a.addFieldOffset(5,o,0)}static addT(a,o){a.addFieldOffset(6,o,0)}static addG(a,o){a.addFieldOffset(7,o,0)}static addFloats(a,o){a.addFieldOffset(8,o,0)}static createFloatsVector(a,o){a.startVector(4,o.length,4);for(let d=o.length-1;d>=0;d--)a.addFloat32(o[d]);return a.endVector()}static startFloatsVector(a,o){a.startVector(4,o,4)}static addInts(a,o){a.addFieldOffset(9,o,0)}static createIntsVector(a,o){a.startVector(8,o.length,8);for(let d=o.length-1;d>=0;d--)a.addInt64(o[d]);return a.endVector()}static startIntsVector(a,o){a.startVector(8,o,8)}static addStrings(a,o){a.addFieldOffset(10,o,0)}static createStringsVector(a,o){a.startVector(4,o.length,4);for(let d=o.length-1;d>=0;d--)a.addOffset(o[d]);return a.endVector()}static startStringsVector(a,o){a.startVector(4,o,4)}static addTensors(a,o){a.addFieldOffset(11,o,0)}static createTensorsVector(a,o){a.startVector(4,o.length,4);for(let d=o.length-1;d>=0;d--)a.addOffset(o[d]);return a.endVector()}static startTensorsVector(a,o){a.startVector(4,o,4)}static addGraphs(a,o){a.addFieldOffset(12,o,0)}static createGraphsVector(a,o){a.startVector(4,o.length,4);for(let d=o.length-1;d>=0;d--)a.addOffset(o[d]);return a.endVector()}static startGraphsVector(a,o){a.startVector(4,o,4)}static endAttribute(a){return a.endObject()}static createAttribute(a,o,d,g,it,st,tt,ot,rt,at,ut,lt,ct,ft){return et.startAttribute(a),et.addName(a,o),et.addDocString(a,d),et.addType(a,g),et.addF(a,it),et.addI(a,st),et.addS(a,tt),et.addT(a,ot),et.addG(a,rt),et.addFloats(a,at),et.addInts(a,ut),et.addStrings(a,lt),et.addTensors(a,ct),et.addGraphs(a,ft),et.endAttribute(a)}}nt.Attribute=et})(j.fbs||(j.fbs={}))})(_.experimental||(_.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(_){(function(j){(function(nt){class et{constructor(){this.bb=null,this.bb_pos=0}__init(a,o){return this.bb_pos=a,this.bb=o,this}static getRootAsGraph(a,o){return(o||new et).__init(a.readInt32(a.position())+a.position(),a)}static getSizePrefixedRootAsGraph(a,o){return a.setPosition(a.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(o||new et).__init(a.readInt32(a.position())+a.position(),a)}initializers(a,o){let d=this.bb.__offset(this.bb_pos,4);return d?(o||new _.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+d)+4*a),this.bb):null}initializersLength(){let a=this.bb.__offset(this.bb_pos,4);return a?this.bb.__vector_len(this.bb_pos+a):0}nodeArgs(a,o){let d=this.bb.__offset(this.bb_pos,6);return d?(o||new _.experimental.fbs.ValueInfo).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+d)+4*a),this.bb):null}nodeArgsLength(){let a=this.bb.__offset(this.bb_pos,6);return a?this.bb.__vector_len(this.bb_pos+a):0}nodes(a,o){let d=this.bb.__offset(this.bb_pos,8);return d?(o||new _.experimental.fbs.Node).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+d)+4*a),this.bb):null}nodesLength(){let a=this.bb.__offset(this.bb_pos,8);return a?this.bb.__vector_len(this.bb_pos+a):0}maxNodeIndex(){let a=this.bb.__offset(this.bb_pos,10);return a?this.bb.readUint32(this.bb_pos+a):0}nodeEdges(a,o){let d=this.bb.__offset(this.bb_pos,12);return d?(o||new _.experimental.fbs.NodeEdge).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+d)+4*a),this.bb):null}nodeEdgesLength(){let a=this.bb.__offset(this.bb_pos,12);return a?this.bb.__vector_len(this.bb_pos+a):0}inputs(a,o){let d=this.bb.__offset(this.bb_pos,14);return d?this.bb.__string(this.bb.__vector(this.bb_pos+d)+4*a,o):null}inputsLength(){let a=this.bb.__offset(this.bb_pos,14);return a?this.bb.__vector_len(this.bb_pos+a):0}outputs(a,o){let d=this.bb.__offset(this.bb_pos,16);return d?this.bb.__string(this.bb.__vector(this.bb_pos+d)+4*a,o):null}outputsLength(){let a=this.bb.__offset(this.bb_pos,16);return a?this.bb.__vector_len(this.bb_pos+a):0}sparseInitializers(a,o){let d=this.bb.__offset(this.bb_pos,18);return d?(o||new _.experimental.fbs.SparseTensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+d)+4*a),this.bb):null}sparseInitializersLength(){let a=this.bb.__offset(this.bb_pos,18);return a?this.bb.__vector_len(this.bb_pos+a):0}static startGraph(a){a.startObject(8)}static addInitializers(a,o){a.addFieldOffset(0,o,0)}static createInitializersVector(a,o){a.startVector(4,o.length,4);for(let d=o.length-1;d>=0;d--)a.addOffset(o[d]);return a.endVector()}static startInitializersVector(a,o){a.startVector(4,o,4)}static addNodeArgs(a,o){a.addFieldOffset(1,o,0)}static createNodeArgsVector(a,o){a.startVector(4,o.length,4);for(let d=o.length-1;d>=0;d--)a.addOffset(o[d]);return a.endVector()}static startNodeArgsVector(a,o){a.startVector(4,o,4)}static addNodes(a,o){a.addFieldOffset(2,o,0)}static createNodesVector(a,o){a.startVector(4,o.length,4);for(let d=o.length-1;d>=0;d--)a.addOffset(o[d]);return a.endVector()}static startNodesVector(a,o){a.startVector(4,o,4)}static addMaxNodeIndex(a,o){a.addFieldInt32(3,o,0)}static addNodeEdges(a,o){a.addFieldOffset(4,o,0)}static createNodeEdgesVector(a,o){a.startVector(4,o.length,4);for(let d=o.length-1;d>=0;d--)a.addOffset(o[d]);return a.endVector()}static startNodeEdgesVector(a,o){a.startVector(4,o,4)}static addInputs(a,o){a.addFieldOffset(5,o,0)}static createInputsVector(a,o){a.startVector(4,o.length,4);for(let d=o.length-1;d>=0;d--)a.addOffset(o[d]);return a.endVector()}static startInputsVector(a,o){a.startVector(4,o,4)}static addOutputs(a,o){a.addFieldOffset(6,o,0)}static createOutputsVector(a,o){a.startVector(4,o.length,4);for(let d=o.length-1;d>=0;d--)a.addOffset(o[d]);return a.endVector()}static startOutputsVector(a,o){a.startVector(4,o,4)}static addSparseInitializers(a,o){a.addFieldOffset(7,o,0)}static createSparseInitializersVector(a,o){a.startVector(4,o.length,4);for(let d=o.length-1;d>=0;d--)a.addOffset(o[d]);return a.endVector()}static startSparseInitializersVector(a,o){a.startVector(4,o,4)}static endGraph(a){return a.endObject()}static createGraph(a,o,d,g,it,st,tt,ot,rt){return et.startGraph(a),et.addInitializers(a,o),et.addNodeArgs(a,d),et.addNodes(a,g),et.addMaxNodeIndex(a,it),et.addNodeEdges(a,st),et.addInputs(a,tt),et.addOutputs(a,ot),et.addSparseInitializers(a,rt),et.endGraph(a)}}nt.Graph=et})(j.fbs||(j.fbs={}))})(_.experimental||(_.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(_){(function(j){(function(nt){class et{constructor(){this.bb=null,this.bb_pos=0}__init(a,o){return this.bb_pos=a,this.bb=o,this}static getRootAsModel(a,o){return(o||new et).__init(a.readInt32(a.position())+a.position(),a)}static getSizePrefixedRootAsModel(a,o){return a.setPosition(a.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(o||new et).__init(a.readInt32(a.position())+a.position(),a)}irVersion(){let a=this.bb.__offset(this.bb_pos,4);return a?this.bb.readInt64(this.bb_pos+a):this.bb.createLong(0,0)}opsetImport(a,o){let d=this.bb.__offset(this.bb_pos,6);return d?(o||new _.experimental.fbs.OperatorSetId).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+d)+4*a),this.bb):null}opsetImportLength(){let a=this.bb.__offset(this.bb_pos,6);return a?this.bb.__vector_len(this.bb_pos+a):0}producerName(a){let o=this.bb.__offset(this.bb_pos,8);return o?this.bb.__string(this.bb_pos+o,a):null}producerVersion(a){let o=this.bb.__offset(this.bb_pos,10);return o?this.bb.__string(this.bb_pos+o,a):null}domain(a){let o=this.bb.__offset(this.bb_pos,12);return o?this.bb.__string(this.bb_pos+o,a):null}modelVersion(){let a=this.bb.__offset(this.bb_pos,14);return a?this.bb.readInt64(this.bb_pos+a):this.bb.createLong(0,0)}docString(a){let o=this.bb.__offset(this.bb_pos,16);return o?this.bb.__string(this.bb_pos+o,a):null}graph(a){let o=this.bb.__offset(this.bb_pos,18);return o?(a||new _.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb_pos+o),this.bb):null}graphDocString(a){let o=this.bb.__offset(this.bb_pos,20);return o?this.bb.__string(this.bb_pos+o,a):null}static startModel(a){a.startObject(9)}static addIrVersion(a,o){a.addFieldInt64(0,o,a.createLong(0,0))}static addOpsetImport(a,o){a.addFieldOffset(1,o,0)}static createOpsetImportVector(a,o){a.startVector(4,o.length,4);for(let d=o.length-1;d>=0;d--)a.addOffset(o[d]);return a.endVector()}static startOpsetImportVector(a,o){a.startVector(4,o,4)}static addProducerName(a,o){a.addFieldOffset(2,o,0)}static addProducerVersion(a,o){a.addFieldOffset(3,o,0)}static addDomain(a,o){a.addFieldOffset(4,o,0)}static addModelVersion(a,o){a.addFieldInt64(5,o,a.createLong(0,0))}static addDocString(a,o){a.addFieldOffset(6,o,0)}static addGraph(a,o){a.addFieldOffset(7,o,0)}static addGraphDocString(a,o){a.addFieldOffset(8,o,0)}static endModel(a){return a.endObject()}static createModel(a,o,d,g,it,st,tt,ot,rt,at){return et.startModel(a),et.addIrVersion(a,o),et.addOpsetImport(a,d),et.addProducerName(a,g),et.addProducerVersion(a,it),et.addDomain(a,st),et.addModelVersion(a,tt),et.addDocString(a,ot),et.addGraph(a,rt),et.addGraphDocString(a,at),et.endModel(a)}}nt.Model=et})(j.fbs||(j.fbs={}))})(_.experimental||(_.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(_){(function(j){(function(nt){class et{constructor(){this.bb=null,this.bb_pos=0}__init(a,o){return this.bb_pos=a,this.bb=o,this}static getRootAsKernelCreateInfos(a,o){return(o||new et).__init(a.readInt32(a.position())+a.position(),a)}static getSizePrefixedRootAsKernelCreateInfos(a,o){return a.setPosition(a.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(o||new et).__init(a.readInt32(a.position())+a.position(),a)}nodeIndices(a){let o=this.bb.__offset(this.bb_pos,4);return o?this.bb.readUint32(this.bb.__vector(this.bb_pos+o)+4*a):0}nodeIndicesLength(){let a=this.bb.__offset(this.bb_pos,4);return a?this.bb.__vector_len(this.bb_pos+a):0}nodeIndicesArray(){let a=this.bb.__offset(this.bb_pos,4);return a?new Uint32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+a),this.bb.__vector_len(this.bb_pos+a)):null}kernelDefHashes(a){let o=this.bb.__offset(this.bb_pos,6);return o?this.bb.readUint64(this.bb.__vector(this.bb_pos+o)+8*a):this.bb.createLong(0,0)}kernelDefHashesLength(){let a=this.bb.__offset(this.bb_pos,6);return a?this.bb.__vector_len(this.bb_pos+a):0}static startKernelCreateInfos(a){a.startObject(2)}static addNodeIndices(a,o){a.addFieldOffset(0,o,0)}static createNodeIndicesVector(a,o){a.startVector(4,o.length,4);for(let d=o.length-1;d>=0;d--)a.addInt32(o[d]);return a.endVector()}static startNodeIndicesVector(a,o){a.startVector(4,o,4)}static addKernelDefHashes(a,o){a.addFieldOffset(1,o,0)}static createKernelDefHashesVector(a,o){a.startVector(8,o.length,8);for(let d=o.length-1;d>=0;d--)a.addInt64(o[d]);return a.endVector()}static startKernelDefHashesVector(a,o){a.startVector(8,o,8)}static endKernelCreateInfos(a){return a.endObject()}static createKernelCreateInfos(a,o,d){return et.startKernelCreateInfos(a),et.addNodeIndices(a,o),et.addKernelDefHashes(a,d),et.endKernelCreateInfos(a)}}nt.KernelCreateInfos=et})(j.fbs||(j.fbs={}))})(_.experimental||(_.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(_){(function(j){(function(nt){class et{constructor(){this.bb=null,this.bb_pos=0}__init(a,o){return this.bb_pos=a,this.bb=o,this}static getRootAsSubGraphSessionState(a,o){return(o||new et).__init(a.readInt32(a.position())+a.position(),a)}static getSizePrefixedRootAsSubGraphSessionState(a,o){return a.setPosition(a.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(o||new et).__init(a.readInt32(a.position())+a.position(),a)}graphId(a){let o=this.bb.__offset(this.bb_pos,4);return o?this.bb.__string(this.bb_pos+o,a):null}sessionState(a){let o=this.bb.__offset(this.bb_pos,6);return o?(a||new _.experimental.fbs.SessionState).__init(this.bb.__indirect(this.bb_pos+o),this.bb):null}static startSubGraphSessionState(a){a.startObject(2)}static addGraphId(a,o){a.addFieldOffset(0,o,0)}static addSessionState(a,o){a.addFieldOffset(1,o,0)}static endSubGraphSessionState(a){let o=a.endObject();return a.requiredField(o,4),o}static createSubGraphSessionState(a,o,d){return et.startSubGraphSessionState(a),et.addGraphId(a,o),et.addSessionState(a,d),et.endSubGraphSessionState(a)}}nt.SubGraphSessionState=et})(j.fbs||(j.fbs={}))})(_.experimental||(_.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(_){(function(j){(function(nt){class et{constructor(){this.bb=null,this.bb_pos=0}__init(a,o){return this.bb_pos=a,this.bb=o,this}static getRootAsSessionState(a,o){return(o||new et).__init(a.readInt32(a.position())+a.position(),a)}static getSizePrefixedRootAsSessionState(a,o){return a.setPosition(a.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(o||new et).__init(a.readInt32(a.position())+a.position(),a)}kernels(a){let o=this.bb.__offset(this.bb_pos,4);return o?(a||new _.experimental.fbs.KernelCreateInfos).__init(this.bb.__indirect(this.bb_pos+o),this.bb):null}subGraphSessionStates(a,o){let d=this.bb.__offset(this.bb_pos,6);return d?(o||new _.experimental.fbs.SubGraphSessionState).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+d)+4*a),this.bb):null}subGraphSessionStatesLength(){let a=this.bb.__offset(this.bb_pos,6);return a?this.bb.__vector_len(this.bb_pos+a):0}static startSessionState(a){a.startObject(2)}static addKernels(a,o){a.addFieldOffset(0,o,0)}static addSubGraphSessionStates(a,o){a.addFieldOffset(1,o,0)}static createSubGraphSessionStatesVector(a,o){a.startVector(4,o.length,4);for(let d=o.length-1;d>=0;d--)a.addOffset(o[d]);return a.endVector()}static startSubGraphSessionStatesVector(a,o){a.startVector(4,o,4)}static endSessionState(a){return a.endObject()}static createSessionState(a,o,d){return et.startSessionState(a),et.addKernels(a,o),et.addSubGraphSessionStates(a,d),et.endSessionState(a)}}nt.SessionState=et})(j.fbs||(j.fbs={}))})(_.experimental||(_.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(_){(function(j){(function(nt){class et{constructor(){this.bb=null,this.bb_pos=0}__init(a,o){return this.bb_pos=a,this.bb=o,this}static getRootAsInferenceSession(a,o){return(o||new et).__init(a.readInt32(a.position())+a.position(),a)}static getSizePrefixedRootAsInferenceSession(a,o){return a.setPosition(a.position()+c.flatbuffers.SIZE_PREFIX_LENGTH),(o||new et).__init(a.readInt32(a.position())+a.position(),a)}static bufferHasIdentifier(a){return a.__has_identifier("ORTM")}ortVersion(a){let o=this.bb.__offset(this.bb_pos,4);return o?this.bb.__string(this.bb_pos+o,a):null}model(a){let o=this.bb.__offset(this.bb_pos,6);return o?(a||new _.experimental.fbs.Model).__init(this.bb.__indirect(this.bb_pos+o),this.bb):null}sessionState(a){let o=this.bb.__offset(this.bb_pos,8);return o?(a||new _.experimental.fbs.SessionState).__init(this.bb.__indirect(this.bb_pos+o),this.bb):null}static startInferenceSession(a){a.startObject(3)}static addOrtVersion(a,o){a.addFieldOffset(0,o,0)}static addModel(a,o){a.addFieldOffset(1,o,0)}static addSessionState(a,o){a.addFieldOffset(2,o,0)}static endInferenceSession(a){return a.endObject()}static finishInferenceSessionBuffer(a,o){a.finish(o,"ORTM")}static finishSizePrefixedInferenceSessionBuffer(a,o){a.finish(o,"ORTM",!0)}static createInferenceSession(a,o,d,g){return et.startInferenceSession(a),et.addOrtVersion(a,o),et.addModel(a,d),et.addSessionState(a,g),et.endInferenceSession(a)}}nt.InferenceSession=et})(j.fbs||(j.fbs={}))})(_.experimental||(_.experimental={}))}(e.onnxruntime||(e.onnxruntime={}))},7448:(i,e,s)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.OnnxjsSessionHandler=void 0;const c=s(1670),h=s(9162);e.OnnxjsSessionHandler=class{constructor($){this.session=$,this.inputNames=this.session.inputNames,this.outputNames=this.session.outputNames}async dispose(){}async run($,_,j){const nt=new Map;for(const a in $)if(Object.hasOwnProperty.call($,a)){const o=$[a];nt.set(a,new h.Tensor(o.dims,o.type,void 0,void 0,o.data))}const et=await this.session.run(nt),b={};return et.forEach((a,o)=>{b[o]=new c.Tensor(a.type,a.data,a.dims)}),b}startProfiling(){this.session.startProfiling()}endProfiling(){this.session.endProfiling()}}},6919:(i,e,s)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Session=void 0;const c=s(7067),h=s(1296),$=s(7091),_=s(1036),j=s(6231),nt=s(2644);e.Session=class{constructor(et={}){this._initialized=!1,this.backendHint=et.backendHint,this.profiler=j.Profiler.create(et.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(et,b,a){await this.profiler.event("session","Session.loadModel",async()=>{const o=await(0,$.resolveBackend)(this.backendHint);if(this.sessionHandler=o.createSessionHandler(this.context),this._model=new nt.Model,typeof et=="string"){const d=et.endsWith(".ort");if(typeof fetch>"u"){const g=await(0,h.promisify)(c.readFile)(et);this.initialize(g,d)}else{const g=await fetch(et),it=await g.arrayBuffer();this.initialize(new Uint8Array(it),d)}}else if(ArrayBuffer.isView(et))this.initialize(et);else{const d=new Uint8Array(et,b||0,a||et.byteLength);this.initialize(d)}})}initialize(et,b){if(this._initialized)throw new Error("already initialized");this.profiler.event("session","Session.initialize",()=>{const a=this.sessionHandler.transformGraph?this.sessionHandler:void 0;this._model.load(et,a,b),this.sessionHandler.onGraphInitialized&&this.sessionHandler.onGraphInitialized(this._model.graph),this.initializeOps(this._model.graph),this._executionPlan=new _.ExecutionPlan(this._model.graph,this._ops,this.profiler)}),this._initialized=!0}async run(et){if(!this._initialized)throw new Error("session not initialized yet");return this.profiler.event("session","Session.run",async()=>{const b=this.normalizeAndValidateInputs(et),a=await this._executionPlan.execute(this.sessionHandler,b);return this.createOutput(a)})}normalizeAndValidateInputs(et){const b=this._model.graph.getInputNames();if(Array.isArray(et)){if(et.length!==b.length)throw new Error(`incorrect input array length: expected ${b.length} but got ${et.length}`)}else{if(et.size!==b.length)throw new Error(`incorrect input map size: expected ${b.length} but got ${et.size}`);const a=new Array(et.size);let o=0;for(let d=0;d<b.length;++d){const g=et.get(b[d]);if(!g)throw new Error(`missing input tensor for: '${name}'`);a[o++]=g}et=a}if(this.context.graphInputTypes&&this.context.graphInputTypes.length!==0&&this.context.graphInputDims&&this.context.graphInputDims.length!==0)this.validateInputTensorDims(this.context.graphInputDims,et,!1);else{const a=this._model.graph.getInputIndices(),o=this._model.graph.getValues(),d=new Array(a.length);for(let g=0;g<a.length;++g){const it=o[a[g]];d[g]=it.type.shape.dims,this.context.graphInputTypes.push(it.type.tensorType),this.context.graphInputDims.push(et[g].dims)}this.validateInputTensorDims(d,et,!0)}return this.validateInputTensorTypes(this.context.graphInputTypes,et),et}validateInputTensorTypes(et,b){for(let a=0;a<b.length;a++){const o=et[a],d=b[a].type;if(o!==d)throw new Error(`input tensor[${a}] check failed: expected type '${o}' but got ${d}`)}}validateInputTensorDims(et,b,a){for(let o=0;o<b.length;o++){const d=et[o],g=b[o].dims;if(!this.compareTensorDims(d,g,a))throw new Error(`input tensor[${o}] check failed: expected shape '[${d.join(",")}]' but got [${g.join(",")}]`)}}compareTensorDims(et,b,a){if(et.length!==b.length)return!1;for(let o=0;o<et.length;++o)if(et[o]!==b[o]&&(!a||et[o]!==0))return!1;return!0}createOutput(et){const b=this._model.graph.getOutputNames();if(et.length!==b.length)throw new Error("expected number of outputs do not match number of generated outputs");const a=new Map;for(let o=0;o<b.length;++o)a.set(b[o],et[o]);return a}initializeOps(et){const b=et.getNodes();this._ops=new Array(b.length);for(let a=0;a<b.length;a++)this._ops[a]=this.sessionHandler.resolve(b[a],this._model.opsets,et)}}},9162:function(i,e,s){var c=this&&this.__importDefault||function(it){return it&&it.__esModule?it:{default:it}};Object.defineProperty(e,"__esModule",{value:!0}),e.Tensor=void 0;const h=s(3442),$=c(s(3720)),_=s(1446),j=s(9395),nt=s(2517);var et=j.onnxruntime.experimental.fbs;class b{get data(){if(this.cache===void 0){const st=this.dataProvider(this.dataId);if(st.length!==this.size)throw new Error("Length of data provided by the Data Provider is inconsistent with the dims of this Tensor.");this.cache=st}return this.cache}get stringData(){if(this.type!=="string")throw new TypeError("data type is not string");return this.data}get integerData(){switch(this.type){case"uint8":case"int8":case"uint16":case"int16":case"int32":case"uint32":case"bool":return this.data;default:throw new TypeError("data type is not integer (uint8, int8, uint16, int16, int32, uint32, bool)")}}get floatData(){switch(this.type){case"float32":case"float64":return this.data;default:throw new TypeError("data type is not float (float32, float64)")}}get numberData(){if(this.type!=="string")return this.data;throw new TypeError("type cannot be non-number (string)")}get(st){return this.data[nt.ShapeUtil.indicesToOffset(st,this.strides)]}set(st,tt){this.data[nt.ShapeUtil.indicesToOffset(st,this.strides)]=tt}async getData(){return this.cache===void 0&&(this.cache=await this.asyncDataProvider(this.dataId)),this.cache}get strides(){return this._strides||(this._strides=nt.ShapeUtil.computeStrides(this.dims)),this._strides}constructor(st,tt,ot,rt,at,ut=h.Guid.create()){this.dims=st,this.type=tt,this.dataProvider=ot,this.asyncDataProvider=rt,this.cache=at,this.dataId=ut,this.size=nt.ShapeUtil.validateDimsAndCalcSize(st);const lt=this.size,ct=ot===void 0&&rt===void 0&&at===void 0;if(at!==void 0&&at.length!==lt)throw new RangeError("Input dims doesn't match data length.");if(tt==="string"){if(!(at===void 0||Array.isArray(at)&&at.every(ft=>typeof ft=="string")))throw new TypeError("cache should be a string array");ct&&(this.cache=new Array(lt))}else{if(at!==void 0){const ft=o(tt);if(!(at instanceof ft))throw new TypeError(`cache should be type ${ft.name}`)}if(ct){const ft=new ArrayBuffer(lt*function(dt){switch(dt){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 ${dt}`)}}(tt));this.cache=function(dt,_t){return new(o(_t))(dt)}(ft,tt)}}}static fromProto(st){if(!st)throw new Error("cannot construct Value from an empty tensor");const tt=nt.ProtoUtil.tensorDataTypeFromProto(st.dataType),ot=nt.ProtoUtil.tensorDimsFromProto(st.dims),rt=new b(ot,tt);if(tt==="string")st.stringData.forEach((at,ut)=>{rt.data[ut]=(0,nt.decodeUtf8String)(at)});else if(st.rawData&&typeof st.rawData.byteLength=="number"&&st.rawData.byteLength>0){const at=rt.data,ut=new DataView(st.rawData.buffer,st.rawData.byteOffset,st.rawData.byteLength),lt=a(st.dataType),ct=st.rawData.byteLength/lt;if(st.rawData.byteLength%lt!=0)throw new Error("invalid buffer length");if(at.length!==ct)throw new Error("buffer length mismatch");for(let ft=0;ft<ct;ft++){const dt=g(ut,st.dataType,ft*lt);at[ft]=dt}}else{let at;switch(st.dataType){case _.onnx.TensorProto.DataType.FLOAT:at=st.floatData;break;case _.onnx.TensorProto.DataType.INT32:case _.onnx.TensorProto.DataType.INT16:case _.onnx.TensorProto.DataType.UINT16:case _.onnx.TensorProto.DataType.INT8:case _.onnx.TensorProto.DataType.UINT8:case _.onnx.TensorProto.DataType.BOOL:at=st.int32Data;break;case _.onnx.TensorProto.DataType.INT64:at=st.int64Data;break;case _.onnx.TensorProto.DataType.DOUBLE:at=st.doubleData;break;case _.onnx.TensorProto.DataType.UINT32:case _.onnx.TensorProto.DataType.UINT64:at=st.uint64Data;break;default:throw new Error("unspecific error")}if(at==null)throw new Error("failed to populate data from a tensorproto value");const ut=rt.data;if(ut.length!==at.length)throw new Error("array length mismatch");for(let lt=0;lt<at.length;lt++){const ct=at[lt];$.default.isLong(ct)?ut[lt]=d(ct,st.dataType):ut[lt]=ct}}return rt}static fromData(st,tt,ot){return new b(tt,ot,void 0,void 0,st)}static fromOrtTensor(st){if(!st)throw new Error("cannot construct Value from an empty tensor");const tt=nt.ProtoUtil.tensorDimsFromORTFormat(st),ot=nt.ProtoUtil.tensorDataTypeFromProto(st.dataType()),rt=new b(tt,ot);if(ot==="string")for(let at=0;at<st.stringDataLength();at++)rt.data[at]=st.stringData(at);else if(st.rawDataArray()&&typeof st.rawDataLength()=="number"&&st.rawDataLength()>0){const at=rt.data,ut=new DataView(st.rawDataArray().buffer,st.rawDataArray().byteOffset,st.rawDataLength()),lt=a(st.dataType()),ct=st.rawDataLength()/lt;if(st.rawDataLength()%lt!=0)throw new Error("invalid buffer length");if(at.length!==ct)throw new Error("buffer length mismatch");for(let ft=0;ft<ct;ft++){const dt=g(ut,st.dataType(),ft*lt);at[ft]=dt}}return rt}}function a(it){switch(it){case _.onnx.TensorProto.DataType.UINT8:case _.onnx.TensorProto.DataType.INT8:case _.onnx.TensorProto.DataType.BOOL:return 1;case _.onnx.TensorProto.DataType.UINT16:case _.onnx.TensorProto.DataType.INT16:return 2;case _.onnx.TensorProto.DataType.FLOAT:case _.onnx.TensorProto.DataType.INT32:case _.onnx.TensorProto.DataType.UINT32:return 4;case _.onnx.TensorProto.DataType.INT64:case _.onnx.TensorProto.DataType.DOUBLE:case _.onnx.TensorProto.DataType.UINT64:return 8;default:throw new Error(`cannot calculate sizeof() on type ${_.onnx.TensorProto.DataType[it]}`)}}function o(it){switch(it){case"bool":case"uint8":return Uint8Array;case"int8":return Int8Array;case"int16":return Int16Array;case"uint16":return Uint16Array;case"int32":return Int32Array;case"uint32":return Uint32Array;case"float32":return Float32Array;case"float64":return Float64Array;default:throw new Error("unspecified error")}}function d(it,st){if(st===_.onnx.TensorProto.DataType.INT64||st===et.TensorDataType.INT64){if(it.greaterThanOrEqual(2147483648)||it.lessThan(-2147483648))throw new TypeError("int64 is not supported")}else{if(st!==_.onnx.TensorProto.DataType.UINT32&&st!==et.TensorDataType.UINT32&&st!==_.onnx.TensorProto.DataType.UINT64&&st!==et.TensorDataType.UINT64)throw new TypeError(`not a LONG type: ${_.onnx.TensorProto.DataType[st]}`);if(it.greaterThanOrEqual(4294967296)||it.lessThan(0))throw new TypeError("uint64 is not supported")}return it.toNumber()}function g(it,st,tt){switch(st){case _.onnx.TensorProto.DataType.BOOL:case _.onnx.TensorProto.DataType.UINT8:return it.getUint8(tt);case _.onnx.TensorProto.DataType.INT8:return it.getInt8(tt);case _.onnx.TensorProto.DataType.UINT16:return it.getUint16(tt,!0);case _.onnx.TensorProto.DataType.INT16:return it.getInt16(tt,!0);case _.onnx.TensorProto.DataType.FLOAT:return it.getFloat32(tt,!0);case _.onnx.TensorProto.DataType.INT32:return it.getInt32(tt,!0);case _.onnx.TensorProto.DataType.UINT32:return it.getUint32(tt,!0);case _.onnx.TensorProto.DataType.INT64:return d($.default.fromBits(it.getUint32(tt,!0),it.getUint32(tt+4,!0),!1),st);case _.onnx.TensorProto.DataType.DOUBLE:return it.getFloat64(tt,!0);case _.onnx.TensorProto.DataType.UINT64:return d($.default.fromBits(it.getUint32(tt,!0),it.getUint32(tt+4,!0),!0),st);default:throw new Error(`cannot read from DataView for type ${_.onnx.TensorProto.DataType[st]}`)}}e.Tensor=b},2517:function(i,e,s){var c=this&&this.__importDefault||function(st){return st&&st.__esModule?st:{default:st}};Object.defineProperty(e,"__esModule",{value:!0}),e.decodeUtf8String=e.MAX_CLIP=e.MIN_CLIP=e.PoolConvUtil=e.ReduceUtil=e.SplitUtil=e.MathUtil=e.ShapeUtil=e.LongUtil=e.ProtoUtil=e.GemmUtil=e.arrayCopyHelper=e.BroadcastUtil=e.MatMulUtil=e.ArrayUtil=e.assert=e.checkInputsShape=void 0;const h=s(5686),$=c(s(3720)),_=s(1446),j=s(9162);e.checkInputsShape=function(st,...tt){if(!st||st.length!==tt.length)return!1;for(let ot=0;ot<st.length;ot++)if(!st[ot].dims||st[ot].dims.length!==tt[ot])return!1;return!0},e.assert=function(st,tt){if(!st)throw new Error(typeof tt=="string"?tt:tt())},e.ArrayUtil=class{static arraysEqual(st,tt){if(st.length!==tt.length)return!1;for(let ot=0;ot<st.length;ot++)if(st[ot]!==tt[ot])return!1;return!0}};class nt{static preprocessInputShapes(tt,ot){return[tt.length===1?[1,tt[0]]:tt,ot.length===1?[ot[0],1]:ot]}static postprocessOutputShape(tt,ot,rt){ot===1&&tt.splice(tt.length-2,1),rt===1&&tt.pop()}static calcMatMulShape(tt,ot){return tt[1]!==ot[0]?void 0:[tt[0],ot[1]]}}e.MatMulUtil=nt;class et{static calcShape(tt,ot,rt=!1){const at=tt.length,ut=ot.length;if(at===0)return ot;if(ut===0)return tt;const lt=Math.max(tt.length,ot.length),ct=new Array(lt);if(rt){if(at<2||ut<2)return;const ft=nt.calcMatMulShape([tt[at-2],tt[at-1]],[ot[ut-2],ot[ut-1]]);if(ft===void 0)return;[ct[lt-2],ct[lt-1]]=ft}for(let ft=rt?3:1;ft<=lt;ft++){const dt=at-ft<0?1:tt[at-ft],_t=ut-ft<0?1:ot[ut-ft];if(dt!==_t&&dt>1&&_t>1)return;ct[lt-ft]=Math.max(dt,_t)}return ct}static index(tt,ot){const rt=new Array(ot.length);return et.fillIndex(tt,ot,rt),rt}static fillIndex(tt,ot,rt){const at=tt.length-ot.length;for(let ut=0;ut<ot.length;ut++)rt[ut]=tt[at+ut]%ot[ut]}static calc(tt,ot,rt,at,ut){const lt=et.calcShape(tt.dims,ot.dims);if(lt){if(at&&!o.areEqual(lt,tt.dims))return;const ct=o.size(lt),ft=at?tt:new j.Tensor(lt,ut||tt.type);if(lt.length===0)ft.set([],rt(tt.get([]),ot.get([])));else{const dt=new Array(lt.length),_t=new Array(tt.dims.length),wt=new Array(ot.dims.length);let bt,Tt=0,vt=0,$t=!1,At=!1;tt.dims.length===0&&(Tt=tt.get([]),$t=!0),ot.dims.length===0&&(vt=ot.get([]),At=!0);for(let Ot=0;Ot<ct;Ot++){bt=Ot;for(let It=lt.length-1;It>=0;It--)dt[It]=bt%lt[It],bt=Math.floor(bt/lt[It]);$t||(et.fillIndex(dt,tt.dims,_t),Tt=tt.get(_t)),At||(et.fillIndex(dt,ot.dims,wt),vt=ot.get(wt)),ft.set(dt,rt(Tt,vt))}}return ft}}static isValidBroadcast(tt,ot){const rt=tt.length,at=ot.length;if(rt>at)return!1;for(let ut=1;ut<=rt;ut++)if(tt[rt-ut]!==1&&tt[rt-ut]!==ot[at-ut])return!1;return!0}static getBroadcastDims(tt,ot){const rt=tt.length,at=[];for(let ut=0;ut<rt;ut++){const lt=rt-1-ut,ct=tt[lt]||1;(ot[ot.length-1-ut]||1)>1&&ct===1&&at.unshift(lt)}return at}}e.BroadcastUtil=et,e.arrayCopyHelper=function(st,tt,ot,rt,at){if(rt<0||rt>=tt.length)throw new Error("sourceIndex out of bounds");if(ot<0||ot>=st.length)throw new Error("targetIndex out of bounds");if(rt+at>tt.length)throw new Error("source indices to be copied are outside bounds");if(ot+at>st.length)throw new Error("target array is too small to hold result");for(let ut=0;ut<at;ut++)st[ot+ut]=tt[rt+ut]},e.GemmUtil=class{static getShapeOfGemmResult(st,tt,ot,rt,at){if(st.length!==2||ot.length!==2)throw new Error("shape need to be of size 2");let ut,lt,ct;tt?(ut=st[1],lt=st[0]):(ut=st[0],lt=st[1]);let ft=-1;if(rt?(ct=ot[0],ft=1):(ct=ot[1],ft=0),ot[ft]!==lt)throw new Error("dimension mismatch");if(ut<=0||ct<=0||lt<=0)throw new Error("invalid shape specified");if(at&&!et.isValidBroadcast(at,[ut,ct]))throw new Error("gemm: invalid bias shape for broadcast");return[ut,ct,lt]}};class b{static tensorDataTypeFromProto(tt){switch(tt){case _.onnx.TensorProto.DataType.INT8:return"int8";case _.onnx.TensorProto.DataType.UINT8:return"uint8";case _.onnx.TensorProto.DataType.BOOL:return"bool";case _.onnx.TensorProto.DataType.INT16:return"int16";case _.onnx.TensorProto.DataType.UINT16:return"uint16";case _.onnx.TensorProto.DataType.INT32:return"int32";case _.onnx.TensorProto.DataType.UINT32:return"uint32";case _.onnx.TensorProto.DataType.FLOAT:return"float32";case _.onnx.TensorProto.DataType.DOUBLE:return"float64";case _.onnx.TensorProto.DataType.STRING:return"string";case _.onnx.TensorProto.DataType.INT64:return"int32";case _.onnx.TensorProto.DataType.UINT64:return"uint32";default:throw new Error(`unsupported data type: ${_.onnx.TensorProto.DataType[tt]}`)}}static tensorDataTypeStringToEnum(tt){switch(tt){case"int8":return _.onnx.TensorProto.DataType.INT8;case"uint8":return _.onnx.TensorProto.DataType.UINT8;case"bool":return _.onnx.TensorProto.DataType.BOOL;case"int16":return _.onnx.TensorProto.DataType.INT16;case"uint16":return _.onnx.TensorProto.DataType.UINT16;case"int32":return _.onnx.TensorProto.DataType.INT32;case"uint32":return _.onnx.TensorProto.DataType.UINT32;case"float32":return _.onnx.TensorProto.DataType.FLOAT;case"float64":return _.onnx.TensorProto.DataType.DOUBLE;case"string":return _.onnx.TensorProto.DataType.STRING;case"int64":return _.onnx.TensorProto.DataType.INT64;case"uint64":return _.onnx.TensorProto.DataType.UINT64;default:throw new Error(`unsupported data type: ${tt}`)}}static tensorDimsFromProto(tt){return tt.map(ot=>$.default.isLong(ot)?ot.toNumber():ot)}static tensorValueTypeFromProto(tt){return{tensorType:b.tensorDataTypeFromProto(tt.elemType),shape:{dims:b.tensorDimsFromProto(tt.shape.dim.map(ot=>ot.dimValue))}}}static tensorDimsFromORTFormat(tt){const ot=[];for(let rt=0;rt<tt.dimsLength();rt++)ot.push(a.longToNumber(tt.dims(rt)));return ot}static tensorAttributesFromORTFormat(tt){const ot=[];for(let rt=0;rt<tt.attributesLength();rt++)ot.push(tt.attributes(rt));return ot}}e.ProtoUtil=b;class a{static longToNumber(tt,ot){return $.default.isLong(tt)?tt.toNumber():tt instanceof h.flatbuffers.Long?$.default.fromValue({low:tt.low,high:tt.high,unsigned:ot!=null&&ot}).toNumber():tt}static isLong(tt){return $.default.isLong(tt)||tt instanceof h.flatbuffers.Long}}e.LongUtil=a;class o{static size(tt){return o.getSizeFromDimensionRange(tt,0,tt.length)}static sizeFromDimension(tt,ot){if(ot<0||ot>tt.length)throw new Error(`invalid dimension of ${ot} for sizeFromDimension as Tensor has ${tt.length} dimensions.`);return o.getSizeFromDimensionRange(tt,ot,tt.length)}static sizeToDimension(tt,ot){if(ot<0||ot>tt.length)throw new Error(`invalid dimension of ${ot} for sizeToDimension as Tensor has ${tt.length} dimensions.`);return o.getSizeFromDimensionRange(tt,0,ot)}static getSizeFromDimensionRange(tt,ot,rt){let at=1;for(let ut=ot;ut<rt;ut++){if(tt[ut]<=0)throw new Error("cannot get valid size from specified dimension range. Most likely the range contains 0 or negative values in them.");at*=tt[ut]}return at}static computeStrides(tt){const ot=tt.length;if(ot===0)return[];if(ot===1)return[1];const rt=new Array(ot);rt[ot-1]=1,rt[ot-2]=tt[ot-1];for(let at=ot-3;at>=0;--at)rt[at]=rt[at+1]*tt[at+1];return rt}static transpose(tt){return tt.slice().reverse()}static indicesToOffset(tt,ot,rt){rt===void 0&&(rt=tt.length);let at=0;for(let ut=0;ut<rt;++ut)at+=ot[ut]*tt[ut];return at}static offsetToIndices(tt,ot){const rt=ot.length;if(rt===0)return[];if(rt===1)return[tt*ot[0]];const at=new Array(ot.length);for(let ut=0;ut<at.length-1;++ut)at[ut]=Math.floor(tt/ot[ut]),tt-=at[ut]*ot[ut];return at[at.length-1]=tt,at}static normalizeAxis(tt,ot){if(tt<-ot&&tt>=ot)throw new Error("unsupported axis for this operation.");return tt<0?tt+ot:tt}static normalizeAxes(tt,ot){return tt.map(rt=>this.normalizeAxis(rt,ot))}static incrementIndex(tt,ot,rt){if(ot.length===0||tt.length===0)throw new Error("Index incrementing unsupported for scalar Tensor");if(rt===void 0)rt=ot.length;else if(rt<=0||rt>ot.length)throw new Error("Incorrect axis to increment on");for(let at=rt-1;at>=0&&(tt[at]++,!(tt[at]<ot[at]));--at)tt[at]=0}static calculateReshapedDims(tt,ot){if(ot.length===0){if(tt.length===0||o.size(tt)===1)return[];throw new Error("cannot reshape to a scalar Tensor")}const rt=ot.length,at=new Array(rt);let ut=-1,lt=1;for(let ft=0;ft<rt;ft++){if(ot[ft]<-1)throw new Error("a dimension in shape hints cannot be less than -1");if(ot[ft]===-1){if(ut!==-1)throw new Error("at most one dimension in shape hints can be -1");ut=ft}else{if(ot[ft]===0){if(ft>=tt.length)throw new Error("the dimension with value zero exceeds the dimension size of the input tensor");at[ft]=tt[ft]}else at[ft]=ot[ft];lt*=at[ft]}}const ct=o.size(tt);if(ut!==-1){if(ct%lt!=0)throw new Error(`the input tensor cannot be reshaped to the requested shape. Input shape: [${tt}] Output shape: [${ot}]`);at[ut]=ct/lt}else if(lt!==ct)throw new Error("reshapedDims and originalDims don't have matching sizes");return at}static sortBasedOnPerm(tt,ot){return ot?ot.map(rt=>tt[rt]):tt.slice().reverse()}static padShape(tt,ot){const rt=tt.length;return tt.map((at,ut)=>at+ot[ut]+ot[ut+rt])}static areEqual(tt,ot){return tt.length===ot.length&&tt.every((rt,at)=>rt===ot[at])}static validateDimsAndCalcSize(tt){if(tt.length>6)throw new TypeError("Only rank 0 to 6 is supported for tensor shape.");let ot=1;for(const rt of tt){if(!Number.isInteger(rt))throw new TypeError(`Invalid shape: ${rt} is not an integer`);if(rt<0||rt>2147483647)throw new TypeError(`Invalid shape: length ${rt} is not allowed`);ot*=rt}return ot}static flattenShape(tt,ot){ot<0&&(ot+=tt.length);const rt=tt.reduce((ut,lt)=>ut*lt,1),at=tt.slice(ot).reduce((ut,lt)=>ut*lt,1);return[rt/at,at]}static squeezeShape(tt,ot){const rt=new Array;ot=o.normalizeAxes(ot,tt.length);for(let at=0;at<tt.length;at++){const ut=ot.indexOf(at)>=0;if(ut&&tt[at]!==1)throw new Error("squeeze an axis of size different than 1");(ot.length===0&&tt[at]>1||ot.length>0&&!ut)&&rt.push(tt[at])}return rt}static unsqueezeShape(tt,ot){const rt=new Array(tt.length+ot.length);rt.fill(0);for(let ut=0;ut<ot.length;ut++){const lt=o.normalizeAxis(ot[ut],rt.length);if(lt>=rt.length)throw new Error("'axes' has an out of range axis");if(rt[lt]!==0)throw new Error("'axes' has a duplicate axis");rt[lt]=1}let at=0;for(let ut=0;ut<rt.length;ut++)rt[ut]===0&&(rt[ut]=tt[at++]);if(at!==tt.length)throw new Error("the unsqueezed dimension could not be established");return rt}}e.ShapeUtil=o,e.MathUtil=class{static sqr(st,tt,ot,rt,at){if(rt<0||rt>=tt.length)throw new Error("sourceIndex out of bounds");if(ot<0||ot>=st.length)throw new Error("targetIndex out of bounds");if(rt+at>tt.length)throw new Error("source indices to be copied are outside bounds");if(ot+at>st.length)throw new Error("target array is too small to hold result");for(let ut=0;ut<at;ut++)st[ot+ut]+=Math.pow(tt[rt+ut],2)}static axpy(st,tt,ot,rt,at,ut){if(rt<0||rt>=tt.length)throw new Error("sourceIndex out of bounds");if(ot<0||ot>=st.length)throw new Error("targetIndex out of bounds");if(rt+at>tt.length)throw new Error("source indices to be copied are outside bounds");if(ot+at>st.length)throw new Error("target array is too small to hold result");for(let lt=0;lt<at;lt++)st[ot+lt]+=ut*tt[rt+lt]}static powx(st,tt,ot,rt,at,ut){if(rt<0||rt>=tt.length)throw new Error("sourceIndex out of bounds");if(ot<0||ot>=st.length)throw new Error("targetIndex out of bounds");if(rt+at>tt.length)throw new Error("source indices to be copied are outside bounds");if(ot+at>st.length)throw new Error("target array is too small to hold result");for(let lt=0;lt<at;lt++)st[ot+lt]=Math.pow(tt[rt+lt],ut)}static mul(st,tt,ot,rt,at){if(rt<0||rt>=tt.length)throw new Error("sourceIndex out of bounds");if(ot<0||ot>=st.length)throw new Error("targetIndex out of bounds");if(rt+at>tt.length)throw new Error("source indices to be copied are outside bounds");if(ot+at>st.length)throw new Error("target array is too small to hold result");for(let ut=0;ut<at;ut++)st[ot+ut]=tt[rt+ut]*st[ot+ut]}};class d{static splitShape(tt,ot,rt,at){if(rt.length===0){if(!at)throw new Error("need to know number of outputs when the 'split' attribute is not specified");d.determineSplit(tt[ot],at,rt)}const ut=[],lt=[0];for(let ct=0;ct<rt.length;++ct){ct!==0&&lt.push(lt[ct-1]+rt[ct-1]);const ft=tt.slice();ft[ot]=rt[ct],ut.push(ft)}return[ut,lt]}static determineSplit(tt,ot,rt){if(tt%ot!=0)throw new Error("cannot split tensor to equal sized parts");for(let at=0;at<ot;++at)rt.push(tt/ot)}}e.SplitUtil=d;class g{static calcReduce(tt,ot,rt,at,ut){const lt=tt.dims.slice(0);ot.length===0&&lt.forEach((Tt,vt)=>ot.push(vt));const ct=g.calcReduceShape(lt,ot,!0),ft=o.size(ct),dt=new j.Tensor(ct,tt.type),_t=o.computeStrides(ct),wt=o.computeStrides(lt),bt=new Array(lt.length);for(let Tt=0;Tt<ft;Tt++){const vt=o.offsetToIndices(Tt,_t);et.fillIndex(vt,lt,bt),dt.set(vt,g.calcReduceByAxis(tt.numberData,ot,lt,0,o.indicesToOffset(bt,wt),at,ut))}return rt?dt:new j.Tensor(g.calcReduceShape(lt,ot,rt),dt.type,void 0,void 0,dt.data,dt.dataId)}static calcReduceByAxis(tt,ot,rt,at,ut,lt,ct){let ft=0;if(at>=ot.length)return lt(tt[ut]);const dt=ot[at],_t=dt>=rt.length?1:o.size(rt.slice(dt+1));for(let wt=0;wt<rt[dt];wt++)ft=wt===0?g.calcReduceByAxis(tt,ot,rt,at+1,ut,lt,ct):ct(ft,g.calcReduceByAxis(tt,ot,rt,at+1,ut,lt,ct)),ut+=_t;return ft}static calcReduceShape(tt,ot,rt){const at=tt.slice();for(let ut=0;ut<ot.length;ut++)at[ot[ut]]=rt?1:0;return at.filter(ut=>ut!==0)}}e.ReduceUtil=g;class it{static adjustPoolAttributes(tt,ot,rt,at,ut,lt){if(!tt&&rt.length!==ot.length-2)throw new Error("length of specified kernel shapes should be 2 less than length of input dimensions");if(tt)for(let ct=0;ct<ot.length-2;ct++)ct>=rt.length?rt.push(ot[ct+2]):rt[ct]=ot[ct+2];for(let ct=0;ct<rt.length;ct++)if(ct<at.length){if(at[ct]<0)throw new Error("strides should be greater than or equal to 1")}else at.push(1);for(let ct=0;ct<rt.length;ct++)if(ct<ut.length){if(ut[ct]<0)throw new Error("dilations should be greater than or equal to 1")}else ut.push(1);for(let ct=0;ct<2*rt.length;ct++)if(ct<lt.length){if(lt[ct]<0)throw new Error("pad should be greater than or equal to 1")}else lt.push(0);for(let ct=0;ct<rt.length;ct++){if(rt[ct]<=0)throw new Error("kernel shapes need to be greater than 0");if(lt[ct]>=rt[ct]||lt[ct+rt.length]>=rt[ct])throw new Error("pads should be smaller than kernel")}}static adjustPadsBasedOnAutoPad(tt,ot,rt,at,ut,lt){if(lt){if(ut.length!==2*(tt.length-2))throw new Error("length of pads should be twice the length of data dimensions");if(ot.length!==tt.length-2)throw new Error("length of strides should be the length of data dimensions");if(at.length!==tt.length-2)throw new Error("length of kernel shapes should be the length of data dimensions");for(let ct=0;ct<tt.length-2;ct++)it.adjustPadAndReturnShape(tt[ct+2],ot[ct],rt[ct],at[ct],ut,ct,ct+tt.length-2,lt)}}static computePoolOutputShape(tt,ot,rt,at,ut,lt,ct){if(ot.length<=0)throw new Error("input shape must be of size greater than 0");const ft=[ot[0],ot[1]];return it.computeShapeHelper(tt,ot,ft,rt,at,ut,lt,ct),ft}static computeConvOutputShape(tt,ot,rt,at,ut,lt,ct){if(tt.length<=0||ot.length<=0)throw new Error("invalid input tensor dims or invalid filter tensor dims");const ft=[tt[0],ot[0]];return it.computeShapeHelper(!1,tt,ft,rt,at,ut,lt,ct),ft}static computeShapeHelper(tt,ot,rt,at,ut,lt,ct,ft){if(tt)for(let dt=0;dt<ot.length-2;dt++)rt.push(1);else for(let dt=0;dt<ot.length-2;dt++)rt.push(it.adjustPadAndReturnShape(ot[dt+2],at[dt],ut[dt],lt[dt],ct,dt,dt+ot.length-2,ft))}static adjustPadAndReturnShape(tt,ot,rt,at,ut,lt,ct,ft){const dt=rt*(at-1)+1;if(!ft||ft==="NOTSET")return Math.floor((tt+ut[lt]+ut[ct]-dt)/ot+1);switch(ft){case"VALID":return ut[lt]=0,ut[ct]=0,Math.floor((tt-dt)/ot+1);case"SAME_LOWER":case"SAME_UPPER":if(rt!==1)throw new Error("Dilation not supported for SAME_UPPER or SAME_LOWER");{const _t=((tt+ot-1)/ot-1)*ot+at-tt;return ut[lt]=Math.floor(ft==="SAME_LOWER"?(_t+1)/2:_t/2),ut[ct]=_t-ut[lt],Math.floor((tt+_t-at)/ot+1)}default:throw new Error("Unsupported AutoPad type")}}}e.PoolConvUtil=it,e.MIN_CLIP=-34028234663852886e22,e.MAX_CLIP=34028234663852886e22,e.decodeUtf8String=function(st){return new TextDecoder().decode(st)}},7967:(i,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.iterateExtraOptions=void 0,e.iterateExtraOptions=(s,c,h,$)=>{if(typeof s=="object"&&s!==null){if(h.has(s))throw new Error("Circular reference in options");h.add(s)}Object.entries(s).forEach(([_,j])=>{const nt=c?c+_:_;if(typeof j=="object")(0,e.iterateExtraOptions)(j,nt+".",h,$);else if(typeof j=="string"||typeof j=="number")$(nt,j.toString());else{if(typeof j!="boolean")throw new Error("Can't handle extra config type: "+typeof j);$(nt,j?"1":"0")}})}},2157:function(i,e,s){var c,h=this&&this.__createBinding||(Object.create?function(_t,wt,bt,Tt){Tt===void 0&&(Tt=bt);var vt=Object.getOwnPropertyDescriptor(wt,bt);vt&&!("get"in vt?!wt.__esModule:vt.writable||vt.configurable)||(vt={enumerable:!0,get:function(){return wt[bt]}}),Object.defineProperty(_t,Tt,vt)}:function(_t,wt,bt,Tt){Tt===void 0&&(Tt=bt),_t[Tt]=wt[bt]}),$=this&&this.__setModuleDefault||(Object.create?function(_t,wt){Object.defineProperty(_t,"default",{enumerable:!0,value:wt})}:function(_t,wt){_t.default=wt}),_=this&&this.__importStar||function(_t){if(_t&&_t.__esModule)return _t;var wt={};if(_t!=null)for(var bt in _t)bt!=="default"&&Object.prototype.hasOwnProperty.call(_t,bt)&&h(wt,_t,bt);return $(wt,_t),wt};Object.defineProperty(e,"__esModule",{value:!0}),e.endProfiling=e.run=e.releaseSession=e.createSession=e.createSessionFinalize=e.createSessionAllocate=e.initOrt=e.initWasm=void 0;const j=s(1670),nt=_(s(349)),et=s(6361),b=()=>!!j.env.wasm.proxy&&typeof document<"u";let a,o,d,g=!1,it=!1,st=!1;const tt=[],ot=[],rt=[],at=[],ut=[],lt=[],ct=()=>{if(g||!it||st||!a)throw new Error("worker not ready")},ft=_t=>{switch(_t.data.type){case"init-wasm":g=!1,_t.data.err?(st=!0,o[1](_t.data.err)):(it=!0,o[0]());break;case"init-ort":_t.data.err?d[1](_t.data.err):d[0]();break;case"create_allocate":_t.data.err?tt.shift()[1](_t.data.err):tt.shift()[0](_t.data.out);break;case"create_finalize":_t.data.err?ot.shift()[1](_t.data.err):ot.shift()[0](_t.data.out);break;case"create":_t.data.err?rt.shift()[1](_t.data.err):rt.shift()[0](_t.data.out);break;case"release":_t.data.err?at.shift()[1](_t.data.err):at.shift()[0]();break;case"run":_t.data.err?ut.shift()[1](_t.data.err):ut.shift()[0](_t.data.out);break;case"end-profiling":_t.data.err?lt.shift()[1](_t.data.err):lt.shift()[0]()}},dt=typeof document<"u"?(c=document==null?void 0:document.currentScript)===null||c===void 0?void 0:c.src:void 0;e.initWasm=async()=>{if(b()){if(it)return;if(g)throw new Error("multiple calls to 'initWasm()' detected.");if(st)throw new Error("previous call to 'initWasm()' failed.");return g=!0,j.env.wasm.wasmPaths===void 0&&dt&&dt.indexOf("blob:")!==0&&(j.env.wasm.wasmPaths=dt.substr(0,+dt.lastIndexOf("/")+1)),new Promise((_t,wt)=>{a==null||a.terminate(),a=s(9710).Z(),a.onmessage=ft,o=[_t,wt];const bt={type:"init-wasm",in:j.env.wasm};a.postMessage(bt)})}return(0,et.initializeWebAssembly)(j.env.wasm)},e.initOrt=async(_t,wt)=>{if(b())return ct(),new Promise((bt,Tt)=>{d=[bt,Tt];const vt={type:"init-ort",in:{numThreads:_t,loggingLevel:wt}};a.postMessage(vt)});nt.initOrt(_t,wt)},e.createSessionAllocate=async _t=>b()?(ct(),new Promise((wt,bt)=>{tt.push([wt,bt]);const Tt={type:"create_allocate",in:{model:_t}};a.postMessage(Tt,[_t.buffer])})):nt.createSessionAllocate(_t),e.createSessionFinalize=async(_t,wt)=>b()?(ct(),new Promise((bt,Tt)=>{ot.push([bt,Tt]);const vt={type:"create_finalize",in:{modeldata:_t,options:wt}};a.postMessage(vt)})):nt.createSessionFinalize(_t,wt),e.createSession=async(_t,wt)=>b()?(ct(),new Promise((bt,Tt)=>{rt.push([bt,Tt]);const vt={type:"create",in:{model:_t,options:wt}};a.postMessage(vt,[_t.buffer])})):nt.createSession(_t,wt),e.releaseSession=async _t=>{if(b())return ct(),new Promise((wt,bt)=>{at.push([wt,bt]);const Tt={type:"release",in:_t};a.postMessage(Tt)});nt.releaseSession(_t)},e.run=async(_t,wt,bt,Tt,vt)=>b()?(ct(),new Promise(($t,At)=>{ut.push([$t,At]);const Ot={type:"run",in:{sessionId:_t,inputIndices:wt,inputs:bt,outputIndices:Tt,options:vt}};a.postMessage(Ot,nt.extractTransferableBuffers(bt))})):nt.run(_t,wt,bt,Tt,vt),e.endProfiling=async _t=>{if(b())return ct(),new Promise((wt,bt)=>{lt.push([wt,bt]);const Tt={type:"end-profiling",in:_t};a.postMessage(Tt)});nt.endProfiling(_t)}},586:(i,e,s)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.setRunOptions=void 0;const c=s(7967),h=s(4983),$=s(6361);e.setRunOptions=_=>{const j=(0,$.getInstance)();let nt=0;const et=[],b=_||{};try{if((_==null?void 0:_.logSeverityLevel)===void 0)b.logSeverityLevel=2;else if(typeof _.logSeverityLevel!="number"||!Number.isInteger(_.logSeverityLevel)||_.logSeverityLevel<0||_.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${_.logSeverityLevel}`);if((_==null?void 0:_.logVerbosityLevel)===void 0)b.logVerbosityLevel=0;else if(typeof _.logVerbosityLevel!="number"||!Number.isInteger(_.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${_.logVerbosityLevel}`);(_==null?void 0:_.terminate)===void 0&&(b.terminate=!1);let a=0;if((_==null?void 0:_.tag)!==void 0&&(a=(0,h.allocWasmString)(_.tag,et)),nt=j._OrtCreateRunOptions(b.logSeverityLevel,b.logVerbosityLevel,!!b.terminate,a),nt===0)throw new Error("Can't create run options");return(_==null?void 0:_.extra)!==void 0&&(0,c.iterateExtraOptions)(_.extra,"",new WeakSet,(o,d)=>{const g=(0,h.allocWasmString)(o,et),it=(0,h.allocWasmString)(d,et);if(j._OrtAddRunConfigEntry(nt,g,it)!==0)throw new Error(`Can't set a run config entry: ${o} - ${d}`)}),[nt,et]}catch(a){throw nt!==0&&j._OrtReleaseRunOptions(nt),et.forEach(j._free),a}}},2306:(i,e,s)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.OnnxruntimeWebAssemblySessionHandler=void 0;const c=s(2806),h=s(1670),$=s(2850),_=s(2157);let j;e.OnnxruntimeWebAssemblySessionHandler=class{async createSessionAllocate(nt){const et=await fetch(nt),b=await et.arrayBuffer();return(0,_.createSessionAllocate)(new Uint8Array(b))}async loadModel(nt,et){if(j||(await(0,_.initOrt)(h.env.wasm.numThreads,(b=>{switch(b){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: ${b}`)}})(h.env.logLevel)),j=!0),typeof nt=="string")if(typeof fetch>"u"){const b=await(0,$.promisify)(c.readFile)(nt);[this.sessionId,this.inputNames,this.outputNames]=await(0,_.createSession)(b,et)}else{const b=await this.createSessionAllocate(nt);[this.sessionId,this.inputNames,this.outputNames]=await(0,_.createSessionFinalize)(b,et)}else[this.sessionId,this.inputNames,this.outputNames]=await(0,_.createSession)(nt,et)}async dispose(){return(0,_.releaseSession)(this.sessionId)}async run(nt,et,b){const a=[],o=[];Object.entries(nt).forEach(st=>{const tt=st[0],ot=st[1],rt=this.inputNames.indexOf(tt);if(rt===-1)throw new Error(`invalid input '${tt}'`);a.push(ot),o.push(rt)});const d=[];Object.entries(et).forEach(st=>{const tt=st[0],ot=this.outputNames.indexOf(tt);if(ot===-1)throw new Error(`invalid output '${tt}'`);d.push(ot)});const g=await(0,_.run)(this.sessionId,o,a.map(st=>[st.type,st.dims,st.data]),d,b),it={};for(let st=0;st<g.length;st++)it[this.outputNames[d[st]]]=new h.Tensor(g[st][0],g[st][2],g[st][1]);return it}startProfiling(){}endProfiling(){(0,_.endProfiling)(this.sessionId)}}},4919:(i,e,s)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.setSessionOptions=void 0;const c=s(7967),h=s(4983),$=s(6361);e.setSessionOptions=_=>{const j=(0,$.getInstance)();let nt=0;const et=[],b=_||{};(a=>{a.extra||(a.extra={}),a.extra.session||(a.extra.session={});const o=a.extra.session;o.use_ort_model_bytes_directly||(o.use_ort_model_bytes_directly="1")})(b);try{(_==null?void 0:_.graphOptimizationLevel)===void 0&&(b.graphOptimizationLevel="all");const a=(g=>{switch(g){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${g}`)}})(b.graphOptimizationLevel);(_==null?void 0:_.enableCpuMemArena)===void 0&&(b.enableCpuMemArena=!0),(_==null?void 0:_.enableMemPattern)===void 0&&(b.enableMemPattern=!0),(_==null?void 0:_.executionMode)===void 0&&(b.executionMode="sequential");const o=(g=>{switch(g){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${g}`)}})(b.executionMode);let d=0;if((_==null?void 0:_.logId)!==void 0&&(d=(0,h.allocWasmString)(_.logId,et)),(_==null?void 0:_.logSeverityLevel)===void 0)b.logSeverityLevel=2;else if(typeof _.logSeverityLevel!="number"||!Number.isInteger(_.logSeverityLevel)||_.logSeverityLevel<0||_.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${_.logSeverityLevel}`);if((_==null?void 0:_.logVerbosityLevel)===void 0)b.logVerbosityLevel=0;else if(typeof _.logVerbosityLevel!="number"||!Number.isInteger(_.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${_.logVerbosityLevel}`);if((_==null?void 0:_.enableProfiling)===void 0&&(b.enableProfiling=!1),nt=j._OrtCreateSessionOptions(a,!!b.enableCpuMemArena,!!b.enableMemPattern,o,!!b.enableProfiling,0,d,b.logSeverityLevel,b.logVerbosityLevel),nt===0)throw new Error("Can't create session options");return _!=null&&_.executionProviders&&((g,it,st)=>{for(const tt of it){let ot=typeof tt=="string"?tt:tt.name;switch(ot){case"xnnpack":ot="XNNPACK";break;case"wasm":case"cpu":continue;default:throw new Error(`not supported EP: ${ot}`)}const rt=(0,h.allocWasmString)(ot,st);if((0,$.getInstance)()._OrtAppendExecutionProvider(g,rt)!==0)throw new Error(`Can't append execution provider: ${ot}`)}})(nt,_.executionProviders,et),(_==null?void 0:_.extra)!==void 0&&(0,c.iterateExtraOptions)(_.extra,"",new WeakSet,(g,it)=>{const st=(0,h.allocWasmString)(g,et),tt=(0,h.allocWasmString)(it,et);if(j._OrtAddSessionConfigEntry(nt,st,tt)!==0)throw new Error(`Can't set a session config entry: ${g} - ${it}`)}),[nt,et]}catch(a){throw nt!==0&&j._OrtReleaseSessionOptions(nt),et.forEach(j._free),a}}},4983:(i,e,s)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.allocWasmString=void 0;const c=s(6361);e.allocWasmString=(h,$)=>{const _=(0,c.getInstance)(),j=_.lengthBytesUTF8(h)+1,nt=_._malloc(j);return _.stringToUTF8(h,nt,j),$.push(nt),nt}},349:(i,e,s)=>{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 c=s(586),h=s(4919),$=s(4983),_=s(6361);e.initOrt=(a,o)=>{const d=(0,_.getInstance)()._OrtInit(a,o);if(d!==0)throw new Error(`Can't initialize onnxruntime. error code = ${d}`)};const j=new Map;e.createSessionAllocate=a=>{const o=(0,_.getInstance)(),d=o._malloc(a.byteLength);return o.HEAPU8.set(a,d),[d,a.byteLength]},e.createSessionFinalize=(a,o)=>{const d=(0,_.getInstance)();let g=0,it=0,st=[];try{if([it,st]=(0,h.setSessionOptions)(o),g=d._OrtCreateSession(a[0],a[1],it),g===0)throw new Error("Can't create a session")}finally{d._free(a[0]),d._OrtReleaseSessionOptions(it),st.forEach(d._free)}const tt=d._OrtGetInputCount(g),ot=d._OrtGetOutputCount(g),rt=[],at=[],ut=[],lt=[];for(let ct=0;ct<tt;ct++){const ft=d._OrtGetInputName(g,ct);if(ft===0)throw new Error("Can't get an input name");at.push(ft),rt.push(d.UTF8ToString(ft))}for(let ct=0;ct<ot;ct++){const ft=d._OrtGetOutputName(g,ct);if(ft===0)throw new Error("Can't get an output name");lt.push(ft),ut.push(d.UTF8ToString(ft))}return j.set(g,[g,at,lt]),[g,rt,ut]},e.createSession=(a,o)=>{const d=(0,e.createSessionAllocate)(a);return(0,e.createSessionFinalize)(d,o)},e.releaseSession=a=>{const o=(0,_.getInstance)(),d=j.get(a);if(!d)throw new Error("invalid session id");const g=d[0],it=d[1],st=d[2];it.forEach(o._OrtFree),st.forEach(o._OrtFree),o._OrtReleaseSession(g),j.delete(a)};const nt=a=>{switch(a){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: ${a}`)}},et=a=>{switch(a){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: ${a}`)}},b=a=>{switch(a){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: ${a}`)}};e.run=(a,o,d,g,it)=>{const st=(0,_.getInstance)(),tt=j.get(a);if(!tt)throw new Error("invalid session id");const ot=tt[0],rt=tt[1],at=tt[2],ut=o.length,lt=g.length;let ct=0,ft=[];const dt=[],_t=[];try{[ct,ft]=(0,c.setRunOptions)(it);for(let At=0;At<ut;At++){const Ot=d[At][0],It=d[At][1],jt=d[At][2];let Et,mt;if(Array.isArray(jt)){mt=4*jt.length,Et=st._malloc(mt),_t.push(Et);let pt=Et/4;for(let yt=0;yt<jt.length;yt++){if(typeof jt[yt]!="string")throw new TypeError(`tensor data at index ${yt} is not a string`);st.HEAPU32[pt++]=(0,$.allocWasmString)(jt[yt],_t)}}else mt=jt.byteLength,Et=st._malloc(mt),_t.push(Et),st.HEAPU8.set(new Uint8Array(jt.buffer,jt.byteOffset,mt),Et);const gt=st.stackSave(),ht=st.stackAlloc(4*It.length);try{let pt=ht/4;It.forEach(Ct=>st.HEAP32[pt++]=Ct);const yt=st._OrtCreateTensor(nt(Ot),Et,mt,ht,It.length);if(yt===0)throw new Error("Can't create a tensor");dt.push(yt)}finally{st.stackRestore(gt)}}const wt=st.stackSave(),bt=st.stackAlloc(4*ut),Tt=st.stackAlloc(4*ut),vt=st.stackAlloc(4*lt),$t=st.stackAlloc(4*lt);try{let At=bt/4,Ot=Tt/4,It=vt/4,jt=$t/4;for(let gt=0;gt<ut;gt++)st.HEAPU32[At++]=dt[gt],st.HEAPU32[Ot++]=rt[o[gt]];for(let gt=0;gt<lt;gt++)st.HEAPU32[It++]=0,st.HEAPU32[jt++]=at[g[gt]];let Et=st._OrtRun(ot,Tt,bt,ut,$t,lt,vt,ct);const mt=[];if(Et===0)for(let gt=0;gt<lt;gt++){const ht=st.HEAPU32[vt/4+gt],pt=st.stackSave(),yt=st.stackAlloc(16);let Ct,Ut=0;try{if(Et=st._OrtGetTensorData(ht,yt,yt+4,yt+8,yt+12),Et!==0)throw new Error(`Can't access output tensor data. error code = ${Et}`);let Nt=yt/4;const Ht=st.HEAPU32[Nt++];Ut=st.HEAPU32[Nt++];const Jt=st.HEAPU32[Nt++],un=st.HEAPU32[Nt++],yn=[];for(let mn=0;mn<un;mn++)yn.push(st.HEAPU32[Jt/4+mn]);st._OrtFree(Jt);const vn=yn.length===0?1:yn.reduce((mn,Tn)=>mn*Tn);if(Ct=et(Ht),Ct==="string"){const mn=[];let Tn=Ut/4;for(let kn=0;kn<vn;kn++){const Gn=st.HEAPU32[Tn++],wr=kn===vn-1?void 0:st.HEAPU32[Tn]-Gn;mn.push(st.UTF8ToString(Gn,wr))}mt.push([Ct,yn,mn])}else{const mn=new(b(Ct))(vn);new Uint8Array(mn.buffer,mn.byteOffset,mn.byteLength).set(st.HEAPU8.subarray(Ut,Ut+mn.byteLength)),mt.push([Ct,yn,mn])}}finally{st.stackRestore(pt),Ct==="string"&&Ut&&st._free(Ut),st._OrtReleaseTensor(ht)}}if(Et===0)return mt;throw new Error(`failed to call OrtRun(). error code = ${Et}.`)}finally{st.stackRestore(wt)}}finally{dt.forEach(st._OrtReleaseTensor),_t.forEach(st._free),st._OrtReleaseRunOptions(ct),ft.forEach(st._free)}},e.endProfiling=a=>{const o=(0,_.getInstance)(),d=j.get(a);if(!d)throw new Error("invalid session id");const g=d[0],it=o._OrtEndProfiling(g);if(it===0)throw new Error("Can't get an profile file name");o._OrtFree(it)},e.extractTransferableBuffers=a=>{const o=[];for(const d of a){const g=d[2];!Array.isArray(g)&&g.buffer&&o.push(g.buffer)}return o}},6361:function(i,e,s){var c=this&&this.__createBinding||(Object.create?function(it,st,tt,ot){ot===void 0&&(ot=tt);var rt=Object.getOwnPropertyDescriptor(st,tt);rt&&!("get"in rt?!st.__esModule:rt.writable||rt.configurable)||(rt={enumerable:!0,get:function(){return st[tt]}}),Object.defineProperty(it,ot,rt)}:function(it,st,tt,ot){ot===void 0&&(ot=tt),it[ot]=st[tt]}),h=this&&this.__setModuleDefault||(Object.create?function(it,st){Object.defineProperty(it,"default",{enumerable:!0,value:st})}:function(it,st){it.default=st}),$=this&&this.__importStar||function(it){if(it&&it.__esModule)return it;var st={};if(it!=null)for(var tt in it)tt!=="default"&&Object.prototype.hasOwnProperty.call(it,tt)&&c(st,it,tt);return h(st,it),st},_=this&&this.__importDefault||function(it){return it&&it.__esModule?it:{default:it}};Object.defineProperty(e,"__esModule",{value:!0}),e.dispose=e.getInstance=e.initializeWebAssembly=void 0;const j=$(s(6449)),nt=_(s(932)),et=s(3474);let b,a=!1,o=!1,d=!1;const g=(it,st)=>st?it?"ort-wasm-simd-threaded.wasm":"ort-wasm-threaded.wasm":it?"ort-wasm-simd.wasm":"ort-wasm.wasm";e.initializeWebAssembly=async it=>{if(a)return Promise.resolve();if(o)throw new Error("multiple calls to 'initializeWebAssembly()' detected.");if(d)throw new Error("previous call to 'initializeWebAssembly()' failed.");o=!0;const st=it.initTimeout,tt=it.numThreads,ot=it.simd,rt=tt>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}})(),at=ot&&(()=>{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}})(),ut=typeof it.wasmPaths=="string"?it.wasmPaths:void 0,lt=g(!1,rt),ct=g(at,rt),ft=typeof it.wasmPaths=="object"?it.wasmPaths[ct]:void 0;let dt=!1;const _t=[];if(st>0&&_t.push(new Promise(wt=>{setTimeout(()=>{dt=!0,wt()},st)})),_t.push(new Promise((wt,bt)=>{const Tt=rt?et:nt.default,vt={locateFile:($t,At)=>rt&&$t.endsWith(".worker.js")&&typeof Blob<"u"?URL.createObjectURL(new Blob([s(4154)],{type:"text/javascript"})):$t===lt?ft??(ut??At)+ct:At+$t};if(rt)if(typeof Blob>"u")vt.mainScriptUrlOrBlob=j.join("/","ort-wasm-threaded.js");else{const $t=`var ortWasmThreaded=(function(){var _scriptDir;return ${Tt.toString()}})();`;vt.mainScriptUrlOrBlob=new Blob([$t],{type:"text/javascript"})}Tt(vt).then($t=>{o=!1,a=!0,b=$t,wt()},$t=>{o=!1,d=!0,bt($t)})})),await Promise.race(_t),dt)throw new Error(`WebAssembly backend initializing failed due to timeout: ${st}ms`)},e.getInstance=()=>{if(a&&b)return b;throw new Error("WebAssembly is not initialized yet.")},e.dispose=()=>{var it;!a||o||d||(o=!0,(it=b.PThread)===null||it===void 0||it.terminateAllThreads(),b=void 0,o=!1,a=!1,d=!0)}},9710:(i,e,s)=>{s.d(e,{Z:()=>$});var c=s(477),h=s.n(c);function $(){return h()('/*!\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<process.argv.length&&(m=process.argv[1].replace(/\\\\/g,"/")),process.argv.slice(2),process.on("uncaughtException",(function(t){if(!(t instanceof ct))throw t})),process.on("unhandledRejection",(function(t){throw t})),g=(t,e)=>{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<n-e&&t.buffer&&L)return L.decode(t.buffer instanceof SharedArrayBuffer?t.slice(e,n):t.subarray(e,n));for(r="";e<n;){var a=t[e++];if(128&a){var i=63&t[e++];if(192==(224&a))r+=String.fromCharCode((31&a)<<6|i);else{var o=63&t[e++];65536>(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<r))return 0;var a=n>>>=0;r=n+r-1;for(var i=0;i<t.length;++i){var o=t.charCodeAt(i);if(55296<=o&&57343>=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<t.length;++n){var r=t.charCodeAt(n);127>=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<t.length;)t.shift()(u)}function yt(t){var e=Ee();return t=t(),Me(e),t}function bt(t){if(O)return $t(2,0,t);try{pt(t)}catch(t){t instanceof ct||"unwind"==t||g(1,t)}}u.PThread=ht,u.establishStackSpace=function(){var t=he(),e=a()[t+44>>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<o?(i()[n>>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<n;u++){var c=r[2+u];o()[i+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<a.length;++u)e()[o++>>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<n;u++){var c=i()[e>>2>>>0],s=i()[e+4>>2>>>0];e+=8;for(var l=0;l<s;l++)ae(t,r()[c+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.length<e;)t=n[0]+t;return t}function u(t,e){return o(t,e,"0")}function c(t,e){function n(t){return 0>t?-1:0<t?1:0}var r;return 0===(r=n(t.getFullYear()-e.getFullYear()))&&0===(r=n(t.getMonth()-e.getMonth()))&&(r=n(t.getDate()-e.getDate())),r}function s(t){switch(t.getDay()){case 0:return new Date(t.getFullYear()-1,11,29);case 1:return t;case 2:return new Date(t.getFullYear(),0,3);case 3:return new Date(t.getFullYear(),0,2);case 4:return new Date(t.getFullYear(),0,1);case 5:return new Date(t.getFullYear()-1,11,31);case 6:return new Date(t.getFullYear()-1,11,30)}}function l(t){var e=t.Wb;for(t=new Date(new Date(t.Xb+1900,0,1).getTime());0<e;){var n=t.getMonth(),r=(ue(t.getFullYear())?ce:se)[n];if(!(e>r-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:12<t&&(t-=12),u(t,2)},"%j":function(t){for(var e=0,n=0;n<=t.ec-1;e+=(ue(t.Xb+1900)?ce:se)[n++]);return u(t.jc+e,3)},"%m":function(t){return u(t.ec+1,2)},"%M":function(t){return u(t.Kc,2)},"%n":function(){return"\\n"},"%p":function(t){return 0<=t.dc&&12>t.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&&gt(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;a<r.length;a++){var i=r[a];if(0===i||i===n)break;if(xe(i,n,e.Sb+16))return oe=i,t}return oe=n,t},l: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;a<r.length;a++){var i=r[a];if(0===i||i===n)break;if(xe(i,n,e.Sb+16))return oe=i,t}return oe=n,t},h: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;a<r.length;a++){var i=r[a];if(0===i||i===n)break;if(xe(i,n,e.Sb+16))return oe=i,t}return oe=n,t},t:Tt,M:function(){var t=_t.pop();t||at("no exception to throw");var e=t.Zb;throw t.kc()||(_t.push(t),t.ic(!0),t.hc(!1),Ot++),At=e,e},c:function(t,e,n){throw new St(t).fc(e,n),At=t,Ot++,t},pa:function(){return Ot},Fa:function(t){ge(t,!w,1,!v),ht.pc()},T:function(t){O?postMessage({cmd:"cleanupThread",thread:t}):st(t)},xa:Mt,j:function(t){throw At||(At=t),t},H:Ct,Ma:xt,ua:Rt,wa:jt,oa:kt,Ka:Dt,Ca:Pt,Ja:Ut,V:Ft,va:It,sa:Wt,La:Ht,ta:Lt,Ta:function(){},X:function(){at("To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking")},Ua:function(){at("To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking")},W:function(){return Date.now()},ya:function(){return 2097152},Oa:function(){return!0},za:function(t,e,n,r){if(t==e)setTimeout((()=>zt(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<n!=(c==r)&&(o=Math.max(u,o),e.setTime(e.getTime()+6e4*((0<n?c:o)-r))),a()[t+24>>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<e;r++)Xt[r]=o()[n+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<t)return!1;for(var n=1;4>=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<a;i++)e()[r+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<et))if(O)c(u),O||dt(X),postMessage({cmd:"loaded"});else{if(u.preRun)for("function"==typeof u.preRun&&(u.preRun=[u.preRun]);u.preRun.length;)K();dt(q),0<et||(u.setStatus?(u.setStatus("Running..."),setTimeout((function(){setTimeout((function(){u.setStatus("")}),1),t()}),1)):t())}}if(u.UTF8ToString=Y,u.stringToUTF8=function(t,e,n){return B(t,r(),e,n)},u.lengthBytesUTF8=G,u.keepRuntimeAlive=Q,u.wasmMemory=j,u.stackSave=Ee,u.stackRestore=Me,u.stackAlloc=Ce,u.ExitStatus=ct,u.PThread=ht,rt=function t(){ve||ze(),ve||(rt=t)},u.preInit)for("function"==typeof u.preInit&&(u.preInit=[u.preInit]);0<u.preInit.length;)u.preInit.pop()();return ze(),t.ready});t.exports=r},932:(t,e,n)=>{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<process.argv.length&&(p=process.argv[1].replace(/\\\\/g,"/")),process.argv.slice(2),process.on("uncaughtException",(function(t){if(!(t instanceof J))throw t})),process.on("unhandledRejection",(function(t){throw t})),h=(t,e)=>{if(_||0<L)throw process.exitCode=t,e;e instanceof J||w("exiting due to exception: "+e),process.exit(t)},e.inspect=function(){return"[Emscripten Module object]"}):(d||y)&&(y?m=self.location.href:"undefined"!=typeof document&&document.currentScript&&(m=document.currentScript.src),_scriptDir&&(m=_scriptDir),m=0!==m.indexOf("blob:")?m.substr(0,m.replace(/[?#].*/,"").lastIndexOf("/")+1):"",i=t=>{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<n-e&&t.buffer&&x)return x.decode(t.subarray(e,n));for(r="";e<n;){var a=t[e++];if(128&a){var i=63&t[e++];if(192==(224&a))r+=String.fromCharCode((31&a)<<6|i);else{var o=63&t[e++];65536>(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<r))return 0;var a=n>>>=0;r=n+r-1;for(var i=0;i<t.length;++i){var o=t.charCodeAt(i);if(55296<=o&&57343>=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<t.length;++n){var r=t.charCodeAt(n);127>=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<t.length;)t.shift()(e)}var Q=[],K=0,tt=0;function et(t){this.Db=t,this.zb=t-24,this.Ub=function(t){M[this.zb+4>>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.length<e;)t=n[0]+t;return t}function i(t,e){return a(t,e,"0")}function o(t,e){function n(t){return 0>t?-1:0<t?1:0}var r;return 0===(r=n(t.getFullYear()-e.getFullYear()))&&0===(r=n(t.getMonth()-e.getMonth()))&&(r=n(t.getDate()-e.getDate())),r}function u(t){switch(t.getDay()){case 0:return new Date(t.getFullYear()-1,11,29);case 1:return t;case 2:return new Date(t.getFullYear(),0,3);case 3:return new Date(t.getFullYear(),0,2);case 4:return new Date(t.getFullYear(),0,1);case 5:return new Date(t.getFullYear()-1,11,31);case 6:return new Date(t.getFullYear()-1,11,30)}}function c(t){var e=t.Bb;for(t=new Date(new Date(t.Cb+1900,0,1).getTime());0<e;){var n=t.getMonth(),r=(pt(t.getFullYear())?ht:dt)[n];if(!(e>r-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:12<t&&(t-=12),i(t,2)},"%j":function(t){for(var e=0,n=0;n<=t.Hb-1;e+=(pt(t.Cb+1900)?ht:dt)[n++]);return i(t.Kb+e,3)},"%m":function(t){return i(t.Hb+1,2)},"%M":function(t){return i(t.Zb,2)},"%n":function(){return"\\n"},"%p":function(t){return 0<=t.Gb&&12>t.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<r.length;a++){var i=r[a];if(0===i||i===n)break;if(Et(i,n,e.zb+16))return ft=i,t}return ft=n,t},k: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<r.length;a++){var i=r[a];if(0===i||i===n)break;if(Et(i,n,e.zb+16))return ft=i,t}return ft=n,t},g: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<r.length;a++){var i=r[a];if(0===i||i===n)break;if(Et(i,n,e.zb+16))return ft=i,t}return ft=n,t},s:nt,L:function(){var t=Q.pop();t||V("no exception to throw");var e=t.Db;throw t.Lb()||(Q.push(t),t.Jb(!0),t.Ib(!1),K++),tt=e,e},b:function(t,e,n){throw new et(t).Rb(e,n),tt=t,K++,t},la:function(){return K},i:function(t){throw tt||(tt=t),t},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(){V("To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking")},Ia:function(){V("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(t,e){t=new Date(1e3*(M[t>>>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<n!=(u==r)&&(i=Math.max(o,i),e.setTime(e.getTime()+6e4*((0<n?u:i)-r))),E[t+24>>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<a?(M[n>>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<r.length;++i)S[a++>>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<L||(_t(),Z(W),wt(0),st[1].length&&lt(1,10),st[2].length&&lt(2,10)),_||0<L||(e.onExit&&e.onExit(t),C=!0),h(t,new J(t))},E:function(){return 52},Q:function(){return 52},ca:function(){return 70},P:function(t,e,n,r){for(var a=0,i=0;i<n;i++){var o=M[e>>2>>>0],u=M[e+4>>2>>>0];e+=8;for(var c=0;c<u;c++)lt(t,T[o+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<r;a++)S[e+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<B)){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)z();Z(F),0<B||(e.setStatus?(e.setStatus("Running..."),setTimeout((function(){setTimeout((function(){e.setStatus("")}),1),t()}),1)):t())}}if(e.UTF8ToString=j,e.stringToUTF8=function(t,e,n){return k(t,T,e,n)},e.lengthBytesUTF8=D,e.stackSave=At,e.stackRestore=St,e.stackAlloc=Tt,N=function t(){mt||Wt(),mt||(N=t)},e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);0<e.preInit.length;)e.preInit.pop()();return Wt(),t.ready});t.exports=r},967:(t,e)=>{"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<s;t++){const e=n._OrtGetInputName(r,t);if(0===e)throw new Error("Can\'t get an input name");p.push(e),f.push(n.UTF8ToString(e))}for(let t=0;t<l;t++){const e=n._OrtGetOutputName(r,t);if(0===e)throw new Error("Can\'t get an output name");d.push(e),h.push(n.UTF8ToString(e))}return u.set(r,[r,p,d]),[r,f,h]},e.createSession=(t,n)=>{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;t<m;t++){const e=n[t][0],r=n[t][1],a=n[t][2];let o,u;if(Array.isArray(a)){u=4*a.length,o=p._malloc(u),O.push(o);let t=o/4;for(let e=0;e<a.length;e++){if("string"!=typeof a[e])throw new TypeError(`tensor data at index ${e} is not a string`);p.HEAPU32[t++]=(0,i.allocWasmString)(a[e],O)}}else u=a.byteLength,o=p._malloc(u),O.push(o),p.HEAPU8.set(new Uint8Array(a.buffer,a.byteOffset,u),o);const s=p.stackSave(),l=p.stackAlloc(4*r.length);try{let t=l/4;r.forEach((e=>p.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;t<m;t++)p.HEAPU32[n++]=_[t],p.HEAPU32[r++]=y[e[t]];for(let t=0;t<g;t++)p.HEAPU32[i++]=0,p.HEAPU32[c++]=b[a[t]];let f=p._OrtRun(d,u,o,m,A,g,h,v);const w=[];if(0===f)for(let t=0;t<g;t++){const e=p.HEAPU32[h/4+t],n=p.stackSave(),r=p.stackAlloc(16);let a,i=0;try{if(f=p._OrtGetTensorData(e,r,r+4,r+8,r+12),0!==f)throw new Error(`Can\'t access output tensor data. error code = ${f}`);let t=r/4;const o=p.HEAPU32[t++];i=p.HEAPU32[t++];const u=p.HEAPU32[t++],c=p.HEAPU32[t++],h=[];for(let t=0;t<c;t++)h.push(p.HEAPU32[u/4+t]);p._OrtFree(u);const d=0===h.length?1:h.reduce(((t,e)=>t*e));if(a=s(o),"string"===a){const t=[];let e=i/4;for(let n=0;n<d;n++){const r=p.HEAPU32[e++],a=n===d-1?void 0:p.HEAPU32[e]-r;t.push(p.UTF8ToString(r,a))}w.push([a,h,t])}else{const t=new(l(a))(d);new Uint8Array(t.buffer,t.byteOffset,t.byteLength).set(p.HEAPU8.subarray(i,i+t.byteLength)),w.push([a,h,t])}}finally{p.stackRestore(n),"string"===a&&i&&p._free(i),p._OrtReleaseTensor(e)}}if(0===f)return w;throw new Error(`failed to call OrtRun(). error code = ${f}.`)}finally{p.stackRestore(t)}}finally{_.forEach(p._OrtReleaseTensor),O.forEach(p._free),p._OrtReleaseRunOptions(v),w.forEach(p._free)}},e.endProfiling=t=>{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:i=>{i.exports=function(e,s,c,h){var $=self||window;try{try{var _;try{_=new $.Blob([e])}catch{(_=new($.BlobBuilder||$.WebKitBlobBuilder||$.MozBlobBuilder||$.MSBlobBuilder)).append(e),_=_.getBlob()}var j=$.URL||$.webkitURL,nt=j.createObjectURL(_),et=new $[s](nt,c);return j.revokeObjectURL(nt),et}catch{return new $[s]("data:application/javascript,".concat(encodeURIComponent(e)),c)}}catch{if(!h)throw Error("Inline worker is not supported");return new $[s](h,c)}}},4154:i=>{i.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}};
1851
- `},1670:i=>{i.exports=__WEBPACK_EXTERNAL_MODULE__1670__},7067:()=>{},1296:()=>{},1384:()=>{},3993:()=>{},908:()=>{},6953:()=>{},9925:()=>{},2806:()=>{},6449:()=>{},2850:()=>{},5381:()=>{},5686:(i,e,s)=>{s.r(e),s.d(e,{flatbuffers:()=>c});var c={};c.Offset,c.Table,c.SIZEOF_SHORT=2,c.SIZEOF_INT=4,c.FILE_IDENTIFIER_LENGTH=4,c.SIZE_PREFIX_LENGTH=4,c.Encoding={UTF8_BYTES:1,UTF16_STRING:2},c.int32=new Int32Array(2),c.float32=new Float32Array(c.int32.buffer),c.float64=new Float64Array(c.int32.buffer),c.isLittleEndian=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1,c.Long=function(h,$){this.low=0|h,this.high=0|$},c.Long.create=function(h,$){return h==0&&$==0?c.Long.ZERO:new c.Long(h,$)},c.Long.prototype.toFloat64=function(){return(this.low>>>0)+4294967296*this.high},c.Long.prototype.equals=function(h){return this.low==h.low&&this.high==h.high},c.Long.ZERO=new c.Long(0,0),c.Builder=function(h){if(h)$=h;else var $=1024;this.bb=c.ByteBuffer.allocate($),this.space=$,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},c.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},c.Builder.prototype.forceDefaults=function(h){this.force_defaults=h},c.Builder.prototype.dataBuffer=function(){return this.bb},c.Builder.prototype.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},c.Builder.prototype.prep=function(h,$){h>this.minalign&&(this.minalign=h);for(var _=1+~(this.bb.capacity()-this.space+$)&h-1;this.space<_+h+$;){var j=this.bb.capacity();this.bb=c.Builder.growByteBuffer(this.bb),this.space+=this.bb.capacity()-j}this.pad(_)},c.Builder.prototype.pad=function(h){for(var $=0;$<h;$++)this.bb.writeInt8(--this.space,0)},c.Builder.prototype.writeInt8=function(h){this.bb.writeInt8(this.space-=1,h)},c.Builder.prototype.writeInt16=function(h){this.bb.writeInt16(this.space-=2,h)},c.Builder.prototype.writeInt32=function(h){this.bb.writeInt32(this.space-=4,h)},c.Builder.prototype.writeInt64=function(h){this.bb.writeInt64(this.space-=8,h)},c.Builder.prototype.writeFloat32=function(h){this.bb.writeFloat32(this.space-=4,h)},c.Builder.prototype.writeFloat64=function(h){this.bb.writeFloat64(this.space-=8,h)},c.Builder.prototype.addInt8=function(h){this.prep(1,0),this.writeInt8(h)},c.Builder.prototype.addInt16=function(h){this.prep(2,0),this.writeInt16(h)},c.Builder.prototype.addInt32=function(h){this.prep(4,0),this.writeInt32(h)},c.Builder.prototype.addInt64=function(h){this.prep(8,0),this.writeInt64(h)},c.Builder.prototype.addFloat32=function(h){this.prep(4,0),this.writeFloat32(h)},c.Builder.prototype.addFloat64=function(h){this.prep(8,0),this.writeFloat64(h)},c.Builder.prototype.addFieldInt8=function(h,$,_){(this.force_defaults||$!=_)&&(this.addInt8($),this.slot(h))},c.Builder.prototype.addFieldInt16=function(h,$,_){(this.force_defaults||$!=_)&&(this.addInt16($),this.slot(h))},c.Builder.prototype.addFieldInt32=function(h,$,_){(this.force_defaults||$!=_)&&(this.addInt32($),this.slot(h))},c.Builder.prototype.addFieldInt64=function(h,$,_){!this.force_defaults&&$.equals(_)||(this.addInt64($),this.slot(h))},c.Builder.prototype.addFieldFloat32=function(h,$,_){(this.force_defaults||$!=_)&&(this.addFloat32($),this.slot(h))},c.Builder.prototype.addFieldFloat64=function(h,$,_){(this.force_defaults||$!=_)&&(this.addFloat64($),this.slot(h))},c.Builder.prototype.addFieldOffset=function(h,$,_){(this.force_defaults||$!=_)&&(this.addOffset($),this.slot(h))},c.Builder.prototype.addFieldStruct=function(h,$,_){$!=_&&(this.nested($),this.slot(h))},c.Builder.prototype.nested=function(h){if(h!=this.offset())throw new Error("FlatBuffers: struct must be serialized inline.")},c.Builder.prototype.notNested=function(){if(this.isNested)throw new Error("FlatBuffers: object serialization must not be nested.")},c.Builder.prototype.slot=function(h){this.vtable[h]=this.offset()},c.Builder.prototype.offset=function(){return this.bb.capacity()-this.space},c.Builder.growByteBuffer=function(h){var $=h.capacity();if(3221225472&$)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");var _=$<<1,j=c.ByteBuffer.allocate(_);return j.setPosition(_-$),j.bytes().set(h.bytes(),_-$),j},c.Builder.prototype.addOffset=function(h){this.prep(c.SIZEOF_INT,0),this.writeInt32(this.offset()-h+c.SIZEOF_INT)},c.Builder.prototype.startObject=function(h){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=h;for(var $=0;$<h;$++)this.vtable[$]=0;this.isNested=!0,this.object_start=this.offset()},c.Builder.prototype.endObject=function(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);for(var h=this.offset(),$=this.vtable_in_use-1;$>=0&&this.vtable[$]==0;$--);for(var _=$+1;$>=0;$--)this.addInt16(this.vtable[$]!=0?h-this.vtable[$]:0);this.addInt16(h-this.object_start);var j=(_+2)*c.SIZEOF_SHORT;this.addInt16(j);var nt=0,et=this.space;e:for($=0;$<this.vtables.length;$++){var b=this.bb.capacity()-this.vtables[$];if(j==this.bb.readInt16(b)){for(var a=c.SIZEOF_SHORT;a<j;a+=c.SIZEOF_SHORT)if(this.bb.readInt16(et+a)!=this.bb.readInt16(b+a))continue e;nt=this.vtables[$];break}}return nt?(this.space=this.bb.capacity()-h,this.bb.writeInt32(this.space,nt-h)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-h,this.offset()-h)),this.isNested=!1,h},c.Builder.prototype.finish=function(h,$,_){var j=_?c.SIZE_PREFIX_LENGTH:0;if($){var nt=$;if(this.prep(this.minalign,c.SIZEOF_INT+c.FILE_IDENTIFIER_LENGTH+j),nt.length!=c.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+c.FILE_IDENTIFIER_LENGTH);for(var et=c.FILE_IDENTIFIER_LENGTH-1;et>=0;et--)this.writeInt8(nt.charCodeAt(et))}this.prep(this.minalign,c.SIZEOF_INT+j),this.addOffset(h),j&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)},c.Builder.prototype.finishSizePrefixed=function(h,$){this.finish(h,$,!0)},c.Builder.prototype.requiredField=function(h,$){var _=this.bb.capacity()-h,j=_-this.bb.readInt32(_);if(this.bb.readInt16(j+$)==0)throw new Error("FlatBuffers: field "+$+" must be set")},c.Builder.prototype.startVector=function(h,$,_){this.notNested(),this.vector_num_elems=$,this.prep(c.SIZEOF_INT,h*$),this.prep(_,h*$)},c.Builder.prototype.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},c.Builder.prototype.createString=function(h){if(h instanceof Uint8Array)var $=h;else{$=[];for(var _=0;_<h.length;){var j,nt=h.charCodeAt(_++);(j=nt<55296||nt>=56320?nt:(nt<<10)+h.charCodeAt(_++)+-56613888)<128?$.push(j):(j<2048?$.push(j>>6&31|192):(j<65536?$.push(j>>12&15|224):$.push(j>>18&7|240,j>>12&63|128),$.push(j>>6&63|128)),$.push(63&j|128))}}this.addInt8(0),this.startVector(1,$.length,1),this.bb.setPosition(this.space-=$.length),_=0;for(var et=this.space,b=this.bb.bytes();_<$.length;_++)b[et++]=$[_];return this.endVector()},c.Builder.prototype.createLong=function(h,$){return c.Long.create(h,$)},c.ByteBuffer=function(h){this.bytes_=h,this.position_=0},c.ByteBuffer.allocate=function(h){return new c.ByteBuffer(new Uint8Array(h))},c.ByteBuffer.prototype.clear=function(){this.position_=0},c.ByteBuffer.prototype.bytes=function(){return this.bytes_},c.ByteBuffer.prototype.position=function(){return this.position_},c.ByteBuffer.prototype.setPosition=function(h){this.position_=h},c.ByteBuffer.prototype.capacity=function(){return this.bytes_.length},c.ByteBuffer.prototype.readInt8=function(h){return this.readUint8(h)<<24>>24},c.ByteBuffer.prototype.readUint8=function(h){return this.bytes_[h]},c.ByteBuffer.prototype.readInt16=function(h){return this.readUint16(h)<<16>>16},c.ByteBuffer.prototype.readUint16=function(h){return this.bytes_[h]|this.bytes_[h+1]<<8},c.ByteBuffer.prototype.readInt32=function(h){return this.bytes_[h]|this.bytes_[h+1]<<8|this.bytes_[h+2]<<16|this.bytes_[h+3]<<24},c.ByteBuffer.prototype.readUint32=function(h){return this.readInt32(h)>>>0},c.ByteBuffer.prototype.readInt64=function(h){return new c.Long(this.readInt32(h),this.readInt32(h+4))},c.ByteBuffer.prototype.readUint64=function(h){return new c.Long(this.readUint32(h),this.readUint32(h+4))},c.ByteBuffer.prototype.readFloat32=function(h){return c.int32[0]=this.readInt32(h),c.float32[0]},c.ByteBuffer.prototype.readFloat64=function(h){return c.int32[c.isLittleEndian?0:1]=this.readInt32(h),c.int32[c.isLittleEndian?1:0]=this.readInt32(h+4),c.float64[0]},c.ByteBuffer.prototype.writeInt8=function(h,$){this.bytes_[h]=$},c.ByteBuffer.prototype.writeUint8=function(h,$){this.bytes_[h]=$},c.ByteBuffer.prototype.writeInt16=function(h,$){this.bytes_[h]=$,this.bytes_[h+1]=$>>8},c.ByteBuffer.prototype.writeUint16=function(h,$){this.bytes_[h]=$,this.bytes_[h+1]=$>>8},c.ByteBuffer.prototype.writeInt32=function(h,$){this.bytes_[h]=$,this.bytes_[h+1]=$>>8,this.bytes_[h+2]=$>>16,this.bytes_[h+3]=$>>24},c.ByteBuffer.prototype.writeUint32=function(h,$){this.bytes_[h]=$,this.bytes_[h+1]=$>>8,this.bytes_[h+2]=$>>16,this.bytes_[h+3]=$>>24},c.ByteBuffer.prototype.writeInt64=function(h,$){this.writeInt32(h,$.low),this.writeInt32(h+4,$.high)},c.ByteBuffer.prototype.writeUint64=function(h,$){this.writeUint32(h,$.low),this.writeUint32(h+4,$.high)},c.ByteBuffer.prototype.writeFloat32=function(h,$){c.float32[0]=$,this.writeInt32(h,c.int32[0])},c.ByteBuffer.prototype.writeFloat64=function(h,$){c.float64[0]=$,this.writeInt32(h,c.int32[c.isLittleEndian?0:1]),this.writeInt32(h+4,c.int32[c.isLittleEndian?1:0])},c.ByteBuffer.prototype.getBufferIdentifier=function(){if(this.bytes_.length<this.position_+c.SIZEOF_INT+c.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");for(var h="",$=0;$<c.FILE_IDENTIFIER_LENGTH;$++)h+=String.fromCharCode(this.readInt8(this.position_+c.SIZEOF_INT+$));return h},c.ByteBuffer.prototype.__offset=function(h,$){var _=h-this.readInt32(h);return $<this.readInt16(_)?this.readInt16(_+$):0},c.ByteBuffer.prototype.__union=function(h,$){return h.bb_pos=$+this.readInt32($),h.bb=this,h},c.ByteBuffer.prototype.__string=function(h,$){h+=this.readInt32(h);var _=this.readInt32(h),j="",nt=0;if(h+=c.SIZEOF_INT,$===c.Encoding.UTF8_BYTES)return this.bytes_.subarray(h,h+_);for(;nt<_;){var et,b=this.readUint8(h+nt++);if(b<192)et=b;else{var a=this.readUint8(h+nt++);if(b<224)et=(31&b)<<6|63&a;else{var o=this.readUint8(h+nt++);et=b<240?(15&b)<<12|(63&a)<<6|63&o:(7&b)<<18|(63&a)<<12|(63&o)<<6|63&this.readUint8(h+nt++)}}et<65536?j+=String.fromCharCode(et):(et-=65536,j+=String.fromCharCode(55296+(et>>10),56320+(1023&et)))}return j},c.ByteBuffer.prototype.__indirect=function(h){return h+this.readInt32(h)},c.ByteBuffer.prototype.__vector=function(h){return h+this.readInt32(h)+c.SIZEOF_INT},c.ByteBuffer.prototype.__vector_len=function(h){return this.readInt32(h+this.readInt32(h))},c.ByteBuffer.prototype.__has_identifier=function(h){if(h.length!=c.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+c.FILE_IDENTIFIER_LENGTH);for(var $=0;$<c.FILE_IDENTIFIER_LENGTH;$++)if(h.charCodeAt($)!=this.readInt8(this.position_+c.SIZEOF_INT+$))return!1;return!0},c.ByteBuffer.prototype.createLong=function(h,$){return c.Long.create(h,$)}}},__webpack_module_cache__={};function __webpack_require__(i){var e=__webpack_module_cache__[i];if(e!==void 0)return e.exports;var s=__webpack_module_cache__[i]={exports:{}};return __webpack_modules__[i].call(s.exports,s,s.exports,__webpack_require__),s.exports}__webpack_require__.n=i=>{var e=i&&i.__esModule?()=>i.default:()=>i;return __webpack_require__.d(e,{a:e}),e},__webpack_require__.d=(i,e)=>{for(var s in e)__webpack_require__.o(e,s)&&!__webpack_require__.o(i,s)&&Object.defineProperty(i,s,{enumerable:!0,get:e[s]})},__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=(i,e)=>Object.prototype.hasOwnProperty.call(i,e),__webpack_require__.r=i=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})};var __webpack_exports__=__webpack_require__(6018);return __webpack_exports__})())})(ortWeb_min);var ortWeb_minExports=ortWeb_min.exports,assetPath={};Object.defineProperty(assetPath,"__esModule",{value:!0}),assetPath.baseAssetPath=void 0;const isWeb=typeof window<"u"&&typeof window.document<"u",currentScript=isWeb?window.document.currentScript:null;let basePath="/";currentScript&&(basePath=currentScript.src.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),assetPath.baseAssetPath=basePath;var defaultModelFetcher$1={};Object.defineProperty(defaultModelFetcher$1,"__esModule",{value:!0}),defaultModelFetcher$1.defaultModelFetcher=void 0;const defaultModelFetcher=i=>fetch(i).then(e=>e.arrayBuffer());defaultModelFetcher$1.defaultModelFetcher=defaultModelFetcher;var frameProcessor={},logging={};(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.log=i.LOG_PREFIX=void 0,i.LOG_PREFIX="[VAD]";const e=["error","debug","warn"];function s(h){return(...$)=>{console[h](i.LOG_PREFIX,...$)}}const c=e.reduce((h,$)=>(h[$]=s($),h),{});i.log=c})(logging);var messages={};Object.defineProperty(messages,"__esModule",{value:!0}),messages.Message=void 0;var Message;(function(i){i.AudioFrame="AUDIO_FRAME",i.SpeechStart="SPEECH_START",i.VADMisfire="VAD_MISFIRE",i.SpeechEnd="SPEECH_END",i.SpeechStop="SPEECH_STOP"})(Message||(messages.Message=Message={})),Object.defineProperty(frameProcessor,"__esModule",{value:!0}),frameProcessor.FrameProcessor=frameProcessor.validateOptions=frameProcessor.defaultV5FrameProcessorOptions=frameProcessor.defaultLegacyFrameProcessorOptions=void 0;const logging_1$3=logging,messages_1=messages,RECOMMENDED_FRAME_SAMPLES=[512,1024,1536];frameProcessor.defaultLegacyFrameProcessorOptions={positiveSpeechThreshold:.5,negativeSpeechThreshold:.5-.15,preSpeechPadFrames:1,redemptionFrames:8,frameSamples:1536,minSpeechFrames:3,submitUserSpeechOnPause:!1},frameProcessor.defaultV5FrameProcessorOptions={positiveSpeechThreshold:.5,negativeSpeechThreshold:.5-.15,preSpeechPadFrames:3,redemptionFrames:24,frameSamples:512,minSpeechFrames:9,submitUserSpeechOnPause:!1};function validateOptions(i){RECOMMENDED_FRAME_SAMPLES.includes(i.frameSamples)||logging_1$3.log.warn("You are using an unusual frame size"),(i.positiveSpeechThreshold<0||i.positiveSpeechThreshold>1)&&logging_1$3.log.error("positiveSpeechThreshold should be a number between 0 and 1"),(i.negativeSpeechThreshold<0||i.negativeSpeechThreshold>i.positiveSpeechThreshold)&&logging_1$3.log.error("negativeSpeechThreshold should be between 0 and positiveSpeechThreshold"),i.preSpeechPadFrames<0&&logging_1$3.log.error("preSpeechPadFrames should be positive"),i.redemptionFrames<0&&logging_1$3.log.error("redemptionFrames should be positive")}frameProcessor.validateOptions=validateOptions;const concatArrays=i=>{const e=i.reduce((c,h)=>(c.push(c.at(-1)+h.length),c),[0]),s=new Float32Array(e.at(-1));return i.forEach((c,h)=>{const $=e[h];s.set(c,$)}),s};class FrameProcessor{constructor(e,s,c){this.modelProcessFunc=e,this.modelResetFunc=s,this.options=c,this.speaking=!1,this.redemptionCounter=0,this.active=!1,this.reset=()=>{this.speaking=!1,this.audioBuffer=[],this.modelResetFunc(),this.redemptionCounter=0},this.pause=()=>(this.active=!1,this.options.submitUserSpeechOnPause?this.endSegment():(this.reset(),{})),this.resume=()=>{this.active=!0},this.endSegment=()=>{const h=this.audioBuffer;this.audioBuffer=[];const $=this.speaking;this.reset();const _=h.reduce((j,nt)=>j+ +nt.isSpeech,0);if($)if(_>=this.options.minSpeechFrames){const j=concatArrays(h.map(nt=>nt.frame));return{msg:messages_1.Message.SpeechEnd,audio:j}}else return{msg:messages_1.Message.VADMisfire};return{}},this.process=async h=>{if(!this.active)return{};const $=await this.modelProcessFunc(h);if(this.audioBuffer.push({frame:h,isSpeech:$.isSpeech>=this.options.positiveSpeechThreshold}),$.isSpeech>=this.options.positiveSpeechThreshold&&this.redemptionCounter&&(this.redemptionCounter=0),$.isSpeech>=this.options.positiveSpeechThreshold&&!this.speaking)return this.speaking=!0,{probs:$,msg:messages_1.Message.SpeechStart,frame:h};if($.isSpeech<this.options.negativeSpeechThreshold&&this.speaking&&++this.redemptionCounter>=this.options.redemptionFrames){this.redemptionCounter=0,this.speaking=!1;const _=this.audioBuffer;if(this.audioBuffer=[],_.reduce((nt,et)=>nt+ +et.isSpeech,0)>=this.options.minSpeechFrames){const nt=concatArrays(_.map(et=>et.frame));return{probs:$,msg:messages_1.Message.SpeechEnd,audio:nt,frame:h}}else return{probs:$,msg:messages_1.Message.VADMisfire,frame:h}}if(!this.speaking)for(;this.audioBuffer.length>this.options.preSpeechPadFrames;)this.audioBuffer.shift();return{probs:$,frame:h}},this.audioBuffer=[],this.reset()}}frameProcessor.FrameProcessor=FrameProcessor;var nonRealTimeVad={},models={},common={};Object.defineProperty(common,"__esModule",{value:!0});var legacy={},_a$1;Object.defineProperty(legacy,"__esModule",{value:!0}),legacy.SileroLegacy=void 0;const logging_1$2=logging;class SileroLegacy{constructor(e,s,c,h,$){this.ortInstance=e,this._session=s,this._h=c,this._c=h,this._sr=$,this.reset_state=()=>{const _=Array(128).fill(0);this._h=new this.ortInstance.Tensor("float32",_,[2,1,64]),this._c=new this.ortInstance.Tensor("float32",_,[2,1,64])},this.process=async _=>{var o;const nt={input:new this.ortInstance.Tensor("float32",_,[1,_.length]),h:this._h,c:this._c,sr:this._sr},et=await this._session.run(nt);this._h=et.hn,this._c=et.cn;const[b]=(o=et.output)==null?void 0:o.data;return{notSpeech:1-b,isSpeech:b}}}}legacy.SileroLegacy=SileroLegacy,_a$1=SileroLegacy,SileroLegacy.new=async(i,e)=>{logging_1$2.log.debug("initializing vad");const s=await e(),c=await i.InferenceSession.create(s),h=new i.Tensor("int64",[16000n]),$=Array(2*64).fill(0),_=new i.Tensor("float32",$,[2,1,64]),j=new i.Tensor("float32",$,[2,1,64]);return logging_1$2.log.debug("vad is initialized"),new _a$1(i,c,_,j,h)};var v5={},_a;Object.defineProperty(v5,"__esModule",{value:!0}),v5.SileroV5=void 0;const logging_1$1=logging;function getNewState(i){const e=Array(256).fill(0);return new i.Tensor("float32",e,[2,1,128])}class SileroV5{constructor(e,s,c,h){this._session=e,this._state=s,this._sr=c,this.ortInstance=h,this.reset_state=()=>{this._state=getNewState(this.ortInstance)},this.process=async $=>{var a;const j={input:new this.ortInstance.Tensor("float32",$,[1,$.length]),state:this._state,sr:this._sr},nt=await this._session.run(j);this._state=nt.stateN;const[et]=(a=nt.output)==null?void 0:a.data;return{notSpeech:1-et,isSpeech:et}}}}v5.SileroV5=SileroV5,_a=SileroV5,SileroV5.new=async(i,e)=>{logging_1$1.log.debug("Loading VAD...");const s=await e(),c=await i.InferenceSession.create(s),h=new i.Tensor("int64",[16000n]),$=getNewState(i);return logging_1$1.log.debug("...finished loading VAD"),new _a(c,$,h,i)},function(i){var e=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function($,_,j,nt){nt===void 0&&(nt=j);var et=Object.getOwnPropertyDescriptor(_,j);(!et||("get"in et?!_.__esModule:et.writable||et.configurable))&&(et={enumerable:!0,get:function(){return _[j]}}),Object.defineProperty($,nt,et)}:function($,_,j,nt){nt===void 0&&(nt=j),$[nt]=_[j]}),s=commonjsGlobal&&commonjsGlobal.__exportStar||function($,_){for(var j in $)j!=="default"&&!Object.prototype.hasOwnProperty.call(_,j)&&e(_,$,j)};Object.defineProperty(i,"__esModule",{value:!0}),i.SileroV5=i.SileroLegacy=void 0,s(common,i);var c=legacy;Object.defineProperty(i,"SileroLegacy",{enumerable:!0,get:function(){return c.SileroLegacy}});var h=v5;Object.defineProperty(i,"SileroV5",{enumerable:!0,get:function(){return h.SileroV5}})}(models);var resampler={};Object.defineProperty(resampler,"__esModule",{value:!0}),resampler.Resampler=void 0;const logging_1=logging;class Resampler{constructor(e){this.options=e,this.process=s=>{const c=[];for(const h of s)for(this.inputBuffer.push(h);this.hasEnoughDataForFrame();){const $=this.generateOutputFrame();c.push($)}return c},this.stream=async function*(s){for(const c of s)for(this.inputBuffer.push(c);this.hasEnoughDataForFrame();)yield this.generateOutputFrame()},e.nativeSampleRate<16e3&&logging_1.log.error("nativeSampleRate is too low. Should have 16000 = targetSampleRate <= nativeSampleRate"),this.inputBuffer=[]}hasEnoughDataForFrame(){return this.inputBuffer.length*this.options.targetSampleRate/this.options.nativeSampleRate>=this.options.targetFrameSize}generateOutputFrame(){const e=new Float32Array(this.options.targetFrameSize);let s=0,c=0;for(;s<this.options.targetFrameSize;){let h=0,$=0;for(;c<Math.min(this.inputBuffer.length,(s+1)*this.options.nativeSampleRate/this.options.targetSampleRate);){const _=this.inputBuffer[c];_!==void 0&&(h+=_,$++),c++}e[s]=h/$,s++}return this.inputBuffer=this.inputBuffer.slice(c),e}}resampler.Resampler=Resampler,function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.PlatformAgnosticNonRealTimeVAD=i.defaultNonRealTimeVADOptions=void 0;const e=frameProcessor,s=messages,c=models,h=resampler;i.defaultNonRealTimeVADOptions={...e.defaultLegacyFrameProcessorOptions,ortConfig:void 0};class ${static async _new(j,nt,et={}){const b={...i.defaultNonRealTimeVADOptions,...et};b.ortConfig!==void 0&&b.ortConfig(nt);const a=new this(j,nt,b);return await a.init(),a}constructor(j,nt,et){this.modelFetcher=j,this.ort=nt,this.options=et,this.init=async()=>{const b=await c.SileroLegacy.new(this.ort,this.modelFetcher);this.frameProcessor=new e.FrameProcessor(b.process,b.reset_state,{frameSamples:this.options.frameSamples,positiveSpeechThreshold:this.options.positiveSpeechThreshold,negativeSpeechThreshold:this.options.negativeSpeechThreshold,redemptionFrames:this.options.redemptionFrames,preSpeechPadFrames:this.options.preSpeechPadFrames,minSpeechFrames:this.options.minSpeechFrames,submitUserSpeechOnPause:this.options.submitUserSpeechOnPause}),this.frameProcessor.resume()},this.run=async function*(b,a){const o={nativeSampleRate:a,targetSampleRate:16e3,targetFrameSize:this.options.frameSamples},d=new h.Resampler(o);let g=0,it=0,st=0;for await(const rt of d.stream(b)){const{msg:at,audio:ut}=await this.frameProcessor.process(rt);switch(at){case s.Message.SpeechStart:g=st*this.options.frameSamples/16;break;case s.Message.SpeechEnd:it=(st+1)*this.options.frameSamples/16,yield{audio:ut,start:g,end:it};break}st++}const{msg:tt,audio:ot}=this.frameProcessor.endSegment();tt==s.Message.SpeechEnd&&(yield{audio:ot,start:g,end:st*this.options.frameSamples/16})},(0,e.validateOptions)(et)}}i.PlatformAgnosticNonRealTimeVAD=$}(nonRealTimeVad);var utils={};Object.defineProperty(utils,"__esModule",{value:!0}),utils.audioFileToArray=utils.encodeWAV=utils.arrayBufferToBase64=utils.minFramesForTargetMS=void 0;function minFramesForTargetMS(i,e,s=16e3){return Math.ceil(i*s/1e3/e)}utils.minFramesForTargetMS=minFramesForTargetMS;function arrayBufferToBase64(i){const e=new Uint8Array(i),s=e.byteLength,c=new Array(s);for(var h=0;h<s;h++){const $=e[h];if($===void 0)break;c[h]=String.fromCharCode($)}return btoa(c.join(""))}utils.arrayBufferToBase64=arrayBufferToBase64;function encodeWAV(i,e=3,s=16e3,c=1,h=32){var $=h/8,_=c*$,j=new ArrayBuffer(44+i.length*$),nt=new DataView(j);return writeString(nt,0,"RIFF"),nt.setUint32(4,36+i.length*$,!0),writeString(nt,8,"WAVE"),writeString(nt,12,"fmt "),nt.setUint32(16,16,!0),nt.setUint16(20,e,!0),nt.setUint16(22,c,!0),nt.setUint32(24,s,!0),nt.setUint32(28,s*_,!0),nt.setUint16(32,_,!0),nt.setUint16(34,h,!0),writeString(nt,36,"data"),nt.setUint32(40,i.length*$,!0),e===1?floatTo16BitPCM(nt,44,i):writeFloat32(nt,44,i),j}utils.encodeWAV=encodeWAV;function writeFloat32(i,e,s){for(var c=0;c<s.length;c++,e+=4)i.setFloat32(e,s[c],!0)}function floatTo16BitPCM(i,e,s){for(var c=0;c<s.length;c++,e+=2){var h=Math.max(-1,Math.min(1,s[c]));i.setInt16(e,h<0?h*32768:h*32767,!0)}}function writeString(i,e,s){for(var c=0;c<s.length;c++)i.setUint8(e+c,s.charCodeAt(c))}async function audioFileToArray(i){const e=new OfflineAudioContext(1,1,44100),s=new FileReader;let c=null;if(await new Promise(_=>{s.addEventListener("loadend",j=>{const nt=s.result;e.decodeAudioData(nt,et=>{c=et,e.startRendering().then(b=>{console.log("Rendering completed successfully"),_()}).catch(b=>{console.error(`Rendering failed: ${b}`)})},et=>{console.log(`Error with decoding audio data: ${et}`)})}),s.readAsArrayBuffer(i)}),c===null)throw Error("some shit");let h=c,$=new Float32Array(h.length);for(let _=0;_<h.length;_++)for(let j=0;j<h.numberOfChannels;j++)$[_]+=h.getChannelData(j)[_];return{audio:$,sampleRate:h.sampleRate}}utils.audioFileToArray=audioFileToArray;var realTimeVad={};(function(i){var e=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(tt,ot,rt,at){at===void 0&&(at=rt);var ut=Object.getOwnPropertyDescriptor(ot,rt);(!ut||("get"in ut?!ot.__esModule:ut.writable||ut.configurable))&&(ut={enumerable:!0,get:function(){return ot[rt]}}),Object.defineProperty(tt,at,ut)}:function(tt,ot,rt,at){at===void 0&&(at=rt),tt[at]=ot[rt]}),s=commonjsGlobal&&commonjsGlobal.__setModuleDefault||(Object.create?function(tt,ot){Object.defineProperty(tt,"default",{enumerable:!0,value:ot})}:function(tt,ot){tt.default=ot}),c=commonjsGlobal&&commonjsGlobal.__importStar||function(tt){if(tt&&tt.__esModule)return tt;var ot={};if(tt!=null)for(var rt in tt)rt!=="default"&&Object.prototype.hasOwnProperty.call(tt,rt)&&e(ot,tt,rt);return s(ot,tt),ot};Object.defineProperty(i,"__esModule",{value:!0}),i.AudioNodeVAD=i.MicVAD=i.getDefaultRealTimeVADOptions=i.ort=i.DEFAULT_MODEL=void 0;const h=c(ortWeb_minExports),$=defaultModelFetcher$1,_=frameProcessor,j=logging,nt=messages,et=models,b=resampler;i.DEFAULT_MODEL="legacy",i.ort=h;const a="vad.worklet.bundle.min.js",o="silero_vad_v5.onnx",d="silero_vad_legacy.onnx",g=tt=>({...tt==="v5"?_.defaultV5FrameProcessorOptions:_.defaultLegacyFrameProcessorOptions,onFrameProcessed:rt=>{},onVADMisfire:()=>{j.log.debug("VAD misfire")},onSpeechStart:()=>{j.log.debug("Detected speech start")},onSpeechEnd:()=>{j.log.debug("Detected speech end")},baseAssetPath:"https://cdn.jsdelivr.net/npm/@ricky0123/vad-web@0.0.22/dist/",onnxWASMBasePath:"https://cdn.jsdelivr.net/npm/onnxruntime-web@1.14.0/dist/",stream:void 0,ortConfig:void 0,model:i.DEFAULT_MODEL,workletOptions:{}});i.getDefaultRealTimeVADOptions=g;class it{static async new(ot={}){const rt={...(0,i.getDefaultRealTimeVADOptions)(ot.model??i.DEFAULT_MODEL),...ot};(0,_.validateOptions)(rt);let at;rt.stream===void 0?at=await navigator.mediaDevices.getUserMedia({audio:{...rt.additionalAudioConstraints,channelCount:1,echoCancellation:!0,autoGainControl:!0,noiseSuppression:!0}}):at=rt.stream;const ut=new AudioContext,lt=new MediaStreamAudioSourceNode(ut,{mediaStream:at}),ct=await st.new(ut,rt);return ct.receive(lt),new it(rt,ut,at,ct,lt)}constructor(ot,rt,at,ut,lt,ct=!1){this.options=ot,this.audioContext=rt,this.stream=at,this.audioNodeVAD=ut,this.sourceNode=lt,this.listening=ct,this.pause=()=>{this.audioNodeVAD.pause(),this.listening=!1},this.start=()=>{this.audioNodeVAD.start(),this.listening=!0},this.destroy=()=>{this.listening&&this.pause(),this.options.stream===void 0&&this.stream.getTracks().forEach(ft=>ft.stop()),this.sourceNode.disconnect(),this.audioNodeVAD.destroy(),this.audioContext.close()}}}i.MicVAD=it;class st{static async new(ot,rt={}){const at={...(0,i.getDefaultRealTimeVADOptions)(rt.model??i.DEFAULT_MODEL),...rt};(0,_.validateOptions)(at),i.ort.env.wasm.wasmPaths=at.onnxWASMBasePath,at.ortConfig!==void 0&&at.ortConfig(i.ort);const ut=at.model==="v5"?o:d,lt=at.baseAssetPath+ut,ct=at.model==="v5"?et.SileroV5.new:et.SileroLegacy.new;let ft;try{ft=await ct(i.ort,()=>(0,$.defaultModelFetcher)(lt))}catch(wt){throw console.error(`Encountered an error while loading model file ${lt}`),wt}const dt=new _.FrameProcessor(ft.process,ft.reset_state,{frameSamples:at.frameSamples,positiveSpeechThreshold:at.positiveSpeechThreshold,negativeSpeechThreshold:at.negativeSpeechThreshold,redemptionFrames:at.redemptionFrames,preSpeechPadFrames:at.preSpeechPadFrames,minSpeechFrames:at.minSpeechFrames,submitUserSpeechOnPause:at.submitUserSpeechOnPause}),_t=new st(ot,at,dt);return await _t.setupAudioNode(),_t}constructor(ot,rt,at){this.ctx=ot,this.options=rt,this.bufferIndex=0,this.pause=()=>{const ut=this.frameProcessor.pause();this.handleFrameProcessorEvent(ut)},this.start=()=>{this.frameProcessor.resume()},this.receive=ut=>{ut.connect(this.audioNode)},this.processFrame=async ut=>{const lt=await this.frameProcessor.process(ut);this.handleFrameProcessorEvent(lt)},this.handleFrameProcessorEvent=ut=>{switch(ut.probs!==void 0&&this.options.onFrameProcessed(ut.probs,ut.frame),ut.msg){case nt.Message.SpeechStart:this.options.onSpeechStart();break;case nt.Message.VADMisfire:this.options.onVADMisfire();break;case nt.Message.SpeechEnd:this.options.onSpeechEnd(ut.audio);break}},this.destroy=()=>{var ut;this.audioNode instanceof AudioWorkletNode&&this.audioNode.port.postMessage({message:nt.Message.SpeechStop}),this.audioNode.disconnect(),(ut=this.gainNode)==null||ut.disconnect()},this.frameProcessor=at}async setupAudioNode(){if("audioWorklet"in this.ctx&&typeof AudioWorkletNode=="function")try{const ut=this.options.baseAssetPath+a;await this.ctx.audioWorklet.addModule(ut);const lt=this.options.workletOptions??{};lt.processorOptions={...lt.processorOptions??{},frameSamples:this.options.frameSamples},this.audioNode=new AudioWorkletNode(this.ctx,"vad-helper-worklet",lt),this.audioNode.port.onmessage=async ct=>{var ft;switch((ft=ct.data)==null?void 0:ft.message){case nt.Message.AudioFrame:let dt=ct.data.data;dt instanceof ArrayBuffer||(dt=new ArrayBuffer(ct.data.data.byteLength),new Uint8Array(dt).set(new Uint8Array(ct.data.data)));const _t=new Float32Array(dt);await this.processFrame(_t);break}};return}catch(ut){console.log("AudioWorklet setup failed, falling back to ScriptProcessor",ut)}this.resampler=new b.Resampler({nativeSampleRate:this.ctx.sampleRate,targetSampleRate:16e3,targetFrameSize:this.options.frameSamples??480});const rt=4096;this.audioNode=this.ctx.createScriptProcessor(rt,1,1),this.gainNode=this.ctx.createGain(),this.gainNode.gain.value=0;let at=!1;this.audioNode.onaudioprocess=async ut=>{if(!at){at=!0;try{const lt=ut.inputBuffer.getChannelData(0);if(ut.outputBuffer.getChannelData(0).fill(0),this.resampler){const ft=this.resampler.process(lt);for(const dt of ft)await this.processFrame(dt)}}catch(lt){console.error("Error processing audio:",lt)}finally{at=!1}}},this.audioNode.connect(this.gainNode),this.gainNode.connect(this.ctx.destination)}}i.AudioNodeVAD=st})(realTimeVad),function(i){var e=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(d,g,it,st){st===void 0&&(st=it);var tt=Object.getOwnPropertyDescriptor(g,it);(!tt||("get"in tt?!g.__esModule:tt.writable||tt.configurable))&&(tt={enumerable:!0,get:function(){return g[it]}}),Object.defineProperty(d,st,tt)}:function(d,g,it,st){st===void 0&&(st=it),d[st]=g[it]}),s=commonjsGlobal&&commonjsGlobal.__setModuleDefault||(Object.create?function(d,g){Object.defineProperty(d,"default",{enumerable:!0,value:g})}:function(d,g){d.default=g}),c=commonjsGlobal&&commonjsGlobal.__importStar||function(d){if(d&&d.__esModule)return d;var g={};if(d!=null)for(var it in d)it!=="default"&&Object.prototype.hasOwnProperty.call(d,it)&&e(g,d,it);return s(g,d),g};Object.defineProperty(i,"__esModule",{value:!0}),i.NonRealTimeVAD=i.Message=i.FrameProcessor=i.getDefaultRealTimeVADOptions=i.MicVAD=i.DEFAULT_MODEL=i.AudioNodeVAD=i.utils=i.defaultNonRealTimeVADOptions=void 0;const h=c(ortWeb_minExports),$=assetPath,_=defaultModelFetcher$1,j=frameProcessor;Object.defineProperty(i,"FrameProcessor",{enumerable:!0,get:function(){return j.FrameProcessor}});const nt=messages;Object.defineProperty(i,"Message",{enumerable:!0,get:function(){return nt.Message}});const et=nonRealTimeVad,b=utils;i.defaultNonRealTimeVADOptions={modelURL:$.baseAssetPath+"silero_vad_legacy.onnx",modelFetcher:_.defaultModelFetcher};class a extends et.PlatformAgnosticNonRealTimeVAD{static async new(g={}){const{modelURL:it,modelFetcher:st}={...i.defaultNonRealTimeVADOptions,...g};return await this._new(()=>st(it),h,g)}}i.NonRealTimeVAD=a,i.utils={audioFileToArray:b.audioFileToArray,minFramesForTargetMS:b.minFramesForTargetMS,arrayBufferToBase64:b.arrayBufferToBase64,encodeWAV:b.encodeWAV};var o=realTimeVad;Object.defineProperty(i,"AudioNodeVAD",{enumerable:!0,get:function(){return o.AudioNodeVAD}}),Object.defineProperty(i,"DEFAULT_MODEL",{enumerable:!0,get:function(){return o.DEFAULT_MODEL}}),Object.defineProperty(i,"MicVAD",{enumerable:!0,get:function(){return o.MicVAD}}),Object.defineProperty(i,"getDefaultRealTimeVADOptions",{enumerable:!0,get:function(){return o.getDefaultRealTimeVADOptions}})}(dist);class VadWebClient{constructor(e,s,c,h,$,_){this.micStream=null,this.is_vad_loading=!0,this.noSpeechStartTime=null,this.recording_started=!1,this.lastWarningTime=null,this.warningCooldownPeriod=2e3,this.vad_past=[],this.last_clip_index=0,this.clip_points=[0],this.sil_duration_acc=0,this.pref_length_samples=e*h,this.desp_length_samples=s*h,this.max_length_samples=c*h,this.shor_thsld=SHORT_SILENCE_THRESHOLD*h,this.long_thsld=LONG_SILENCE_THRESHOLD*h,this.frame_size=FRAME_SIZE,this.speech_pad_frames=PRE_SPEECH_PAD_FRAMES,this.micVad={},this.audioFileManager=$,this.audioBufferManager=_}setDependencies(e,s){this.audioFileManager=e,this.audioBufferManager=s}setCallbacks(e,s,c){this.onVadFramesCallback=e,this.onVadFrameProcessedCallback=s,this.onUserSpeechCallback=c}stopMicStream(){var e,s;try{(s=(e=this.micStream)==null?void 0:e.getTracks)==null||s.call(e).forEach(c=>c.stop())}catch{}finally{this.micStream=null}}checkNoSpeech(e){if(!this.recording_started)return;const s=Date.now();e===0?this.noSpeechStartTime===null?this.noSpeechStartTime=s:s-this.noSpeechStartTime>=1e4&&(this.lastWarningTime===null||s-this.lastWarningTime>=this.warningCooldownPeriod)&&(this.onVadFramesCallback&&this.onVadFramesCallback({message:"No audio detected for a while. Please talk or stop the recording if done.",error_code:ErrorCode.AUDIO_QUALITY_POOR,status_code:HttpStatus.BAD_REQUEST}),this.lastWarningTime=s,this.noSpeechStartTime=s):(this.noSpeechStartTime=null,this.lastWarningTime=null,this.onVadFramesCallback&&this.onVadFramesCallback({message:"Audio captured. Recording continues.",status_code:HttpStatus.OK}))}getMicVad(){return this.micVad}isVadLoading(){return this.is_vad_loading}processVadFrame(e){let s=!1;this.vad_past.length>0&&(e===0&&(this.sil_duration_acc+=1),e===1&&(this.sil_duration_acc=0));const c=(this.vad_past.length-this.last_clip_index)*this.frame_size,h=this.sil_duration_acc*this.frame_size;return c>this.pref_length_samples&&h>this.long_thsld&&(this.last_clip_index=this.vad_past.length-Math.min(Math.floor(this.sil_duration_acc/2),5),this.clip_points.push(this.last_clip_index),this.sil_duration_acc=0,s=!0),c>this.desp_length_samples&&h>this.shor_thsld&&(this.last_clip_index=this.vad_past.length-Math.min(Math.floor(this.sil_duration_acc/2),5),this.clip_points.push(this.last_clip_index),this.sil_duration_acc=0,s=!0),c>=this.max_length_samples&&(this.last_clip_index=this.vad_past.length,this.clip_points.push(this.last_clip_index),this.sil_duration_acc=0,s=!0),this.vad_past.push(e),s?[!0,this.clip_points[this.clip_points.length-1]]:[!1,this.clip_points[this.clip_points.length-1]]}async initVad(e){this.is_vad_loading=!0,this.stopMicStream();let s;try{s=await navigator.mediaDevices.getUserMedia({audio:e?{deviceId:{exact:e}}:!0})}catch(c){if((c==null?void 0:c.name)==="OverconstrainedError"||(c==null?void 0:c.name)==="NotFoundError")s=await navigator.mediaDevices.getUserMedia({audio:!0});else throw c}this.micStream=s;try{const c=await dist.MicVAD.new({stream:s,frameSamples:this.frame_size,preSpeechPadFrames:this.speech_pad_frames,onFrameProcessed:(h,$)=>{var b,a,o;if(this.onVadFrameProcessedCallback&&this.onVadFrameProcessedCallback({probabilities:h,frame:$}),!this.recording_started)return;(b=this.audioFileManager)==null||b.incrementTotalRawSamples($),(a=this.audioBufferManager)==null||a.append($);const{isSpeech:_}=h;let j=0;if(_>=.5&&(j=1),this.checkNoSpeech(j),this.processVadFrame(j)[0]){const d=(o=this.audioBufferManager)==null?void 0:o.getAudioData();d&&this.processAudioChunk({audioFrames:d})}},onSpeechStart:()=>{var h;(h=this.onUserSpeechCallback)==null||h.call(this,!0)},onSpeechEnd:()=>{var h;(h=this.onUserSpeechCallback)==null||h.call(this,!1)}});return this.is_vad_loading=!1,this.micVad=c,!this.is_vad_loading}catch(c){throw console.error("Error initializing VAD:",c),this.stopMicStream(),this.is_vad_loading=!1,c}}async reinitializeVad(e){return await this.initVad(e)}async processAudioChunk({audioFrames:e}){if(!e||!this.audioFileManager||!this.audioBufferManager)return;const c=`chunk_${(this.audioFileManager.audioChunks.length||0)+1}.${OUTPUT_FORMAT}`,h=this.audioFileManager.getRawSampleDetails(),$=this.audioBufferManager.calculateChunkTimestamps(h.totalRawSamples);try{const _={fileName:c,timestamp:{st:$.start,et:$.end},status:"pending",audioFrames:e},j=this.audioFileManager.updateAudioInfo(_);this.audioFileManager.incrementInsertedSamples(this.audioBufferManager.getCurrentSampleLength(),this.audioBufferManager.getCurrentFrameLength()),this.audioBufferManager.resetBufferState(),await this.audioFileManager.uploadAudio({audioFrames:e,fileName:c,chunkIndex:j-1})}catch(_){console.error("Error uploading audio chunk:",_)}}startVad(){this.micVad&&typeof this.micVad.start=="function"&&this.micVad.start(),this.recording_started=!0}pauseVad(){this.micVad&&typeof this.micVad.pause=="function"&&this.micVad.pause(),this.recording_started=!1}destroyVad(){this.micVad&&typeof this.micVad.destroy=="function"&&this.micVad.destroy(),this.stopMicStream(),this.recording_started=!1}resetVadWebInstance(){this.micVad&&typeof this.micVad.destroy=="function"&&this.micVad.destroy(),this.stopMicStream(),this.vad_past=[],this.last_clip_index=0,this.clip_points=[0],this.sil_duration_acc=0,this.noSpeechStartTime=null,this.lastWarningTime=null,this.recording_started=!1,this.is_vad_loading=!0}configureVadConstants({pref_length:e,desp_length:s,max_length:c,sr:h,frame_size:$,pre_speech_pad_frames:_,short_thsld:j,long_thsld:nt}){this.pref_length_samples=e*h,this.desp_length_samples=s*h,this.max_length_samples=c*h,this.shor_thsld=j*h,this.long_thsld=nt*h,this.frame_size=$,this.speech_pad_frames=_}}class ChunkedRecorder{constructor(e){this._isPaused=!1,this.eventEmitter=e,this.bufferManager=new AudioBufferManager(SAMPLING_RATE,AUDIO_BUFFER_SIZE_IN_S),this.fileManager=new AudioFileManager,this.vadClient=new VadWebClient(PREF_CHUNK_LENGTH,DESP_CHUNK_LENGTH,MAX_CHUNK_LENGTH,SAMPLING_RATE,this.fileManager,this.bufferManager),this.eventEmitter&&(this.fileManager.setUploadProgressCallback((s,c)=>{}),this.vadClient.setCallbacks(s=>{},s=>{},s=>{}))}initialize(e,s){if(!e.upload_url)throw new Error("Upload URL is required for chunked recording");const c={};console.log(s,"initialize - WIDGET"),s!=null&&s.accessToken&&(c.Authorization=`Bearer ${s.accessToken}`),this.fileManager.setSessionInfo({sessionId:e.session_id,uploadUrl:e.upload_url,uploadHeaders:c}),console.log("ChunkedRecorder initialized with session:",e.session_id)}async start(e){console.log("Starting ChunkedRecorder with deviceId:",e),await this.vadClient.initVad(e);const s=this.vadClient.getMicVad();if((this.vadClient.isVadLoading()||!s||Object.keys(s).length===0)&&await this.vadClient.reinitializeVad(e))throw new Error("VAD instance is not initialized.");this.vadClient.startVad()}pause(){this._isPaused||(this.vadClient.pauseVad(),this._isPaused=!0)}resume(){this._isPaused&&(this.vadClient.startVad(),this._isPaused=!1)}isPaused(){return this._isPaused}async stop(){this._isPaused=!1,this.vadClient.resetVadWebInstance(),await this.fileManager.waitForAllUploads();const e=await this.fileManager.retryFailedUploads(),s=this.fileManager.getTotalAudioChunks().length;return{failedUploads:e,totalFiles:s}}reset(){this._isPaused=!1,this.vadClient.resetVadWebInstance(),this.fileManager.resetFileManagerInstance(),this.bufferManager.resetBufferState()}}class SingleRecorder{constructor(e){this.mediaRecorder=null,this.audioChunks=[],this.uploadUrl="",this.uploadHeaders={},this.stream=null,this._isPaused=!1,this.eventEmitter=e}initialize(e,s){if(!e.upload_url)throw new Error("Upload URL is required for single recording");this.uploadUrl=e.upload_url,s!=null&&s.accessToken&&(this.uploadHeaders.Authorization=`Bearer ${s.accessToken}`)}async start(e){this.audioChunks=[];let s;try{s=await navigator.mediaDevices.getUserMedia({audio:e?{deviceId:{exact:e}}:!0})}catch(c){if((c==null?void 0:c.name)==="OverconstrainedError"||(c==null?void 0:c.name)==="NotFoundError")s=await navigator.mediaDevices.getUserMedia({audio:!0});else throw c}this.stream=s,this.mediaRecorder=new MediaRecorder(s),this.mediaRecorder.ondataavailable=c=>{c.data.size>0&&this.audioChunks.push(c.data)},this.mediaRecorder.start()}pause(){this.mediaRecorder&&this.mediaRecorder.state==="recording"&&(this.mediaRecorder.pause(),this._isPaused=!0)}resume(){this.mediaRecorder&&this.mediaRecorder.state==="paused"&&(this.mediaRecorder.resume(),this._isPaused=!1)}isPaused(){return this._isPaused}async stop(){return this._isPaused=!1,new Promise(e=>{if(!this.mediaRecorder){e({failedUploads:[],totalFiles:0});return}this.mediaRecorder.onstop=async()=>{var $;const s=new Blob(this.audioChunks,{type:"audio/webm"}),c=`recording_${Date.now()}.webm`;(await uploadFileWithFormData(this.uploadUrl,c,s,this.uploadHeaders)).success?e({failedUploads:[],totalFiles:1}):e({failedUploads:[c],totalFiles:1}),($=this.stream)==null||$.getTracks().forEach(_=>_.stop()),this.stream=null,this.mediaRecorder=null},this.mediaRecorder.stop()})}reset(){var e;this._isPaused=!1,this.mediaRecorder&&this.mediaRecorder.state!=="inactive"&&this.mediaRecorder.stop(),(e=this.stream)==null||e.getTracks().forEach(s=>s.stop()),this.stream=null,this.mediaRecorder=null,this.audioChunks=[]}}class EventEmitter{constructor(){this.listeners=new Map}on(e,s){var c;this.listeners.has(e)||this.listeners.set(e,new Set),(c=this.listeners.get(e))==null||c.add(s)}off(e,s){var c;(c=this.listeners.get(e))==null||c.delete(s)}emit(e){var s;(s=this.listeners.get(e.type))==null||s.forEach(c=>{try{c(e)}catch(h){console.error("Error in event listener:",h)}})}}class ScribeClient{static getInstance(e){return ScribeClient.instance||(ScribeClient.instance=new ScribeClient(e)),ScribeClient.instance}static resetInstance(){ScribeClient.instance&&(ScribeClient.instance.reset().catch(()=>{}),ScribeClient.instance=null)}constructor(e){this.discoveryDocument=null,this.currentSession=null,this.isInitialized=!1,this.recorder=null,this.validateConfig(e),this.config={debug:!1,autoDiscovery:!0,...e},this.httpClient=new HttpClient(this.config.apiKey,this.config.accessToken,this.config.debug),this.discoveryAPI=new DiscoveryAPI(this.httpClient),this.sessionAPI=new SessionAPI(this.httpClient,this.config.baseUrl||""),this.eventEmitter=new EventEmitter}async init(){if(this.isInitialized){this.config.debug&&console.log("[ScribeSDK] Already initialized");return}if(!this.config.baseUrl)throw new ValidationError("baseUrl is required for initialization");if(this.config.autoDiscovery)try{this.discoveryDocument=await this.discoveryAPI.getDiscovery(this.config.baseUrl),this.discoveryDocument.endpoints.base_url&&this.sessionAPI.setBaseUrl(this.discoveryDocument.endpoints.base_url),this.emitEvent({type:"discovery:complete",data:this.discoveryDocument}),this.config.debug&&console.log("[ScribeSDK] Discovery complete:",this.discoveryDocument)}catch(e){throw this.emitEvent({type:"error",error:e instanceof Error?e:new Error("Discovery failed")}),e}else this.sessionAPI.setBaseUrl(this.config.baseUrl);this.isInitialized=!0}async startRecording(e){if(this.isInitialized||await this.init(),(await navigator.permissions.query({name:"microphone"})).state!=="granted")throw new ValidationError("Microphone access is required to start recording.");try{const c={templates:e.templates,model:e.model,language_hint:e.languageHint,transcript_language:e.transcriptLanguage,upload_type:e.uploadType||UploadType.CHUNKED,communication_protocol:e.communicationProtocol||"http",additional_data:e.additionalData};return this.currentSession=await this.sessionAPI.createSession(c),this.emitEvent({type:"session:created",data:this.currentSession}),this.config.debug&&console.log("[ScribeSDK] Session created:",this.currentSession),e.uploadType===UploadType.SINGLE?this.recorder=new SingleRecorder(this.eventEmitter):this.recorder=new ChunkedRecorder(this.eventEmitter),this.recorder.initialize(this.currentSession,{accessToken:this.config.accessToken}),await this.recorder.start(e.deviceId),this.currentSession}catch(c){throw this.emitEvent({type:"error",error:c instanceof Error?c:new Error("Failed to start recording")}),c}}pauseRecording(){if(!this.recorder)throw new ValidationError("No active recording to pause");this.recorder.pause(),this.emitEvent({type:"recording:paused"}),this.config.debug&&console.log("[ScribeSDK] Recording paused")}resumeRecording(){if(!this.recorder)throw new ValidationError("No active recording to resume");this.recorder.resume(),this.emitEvent({type:"recording:resumed"}),this.config.debug&&console.log("[ScribeSDK] Recording resumed")}isRecordingPaused(){var e;return((e=this.recorder)==null?void 0:e.isPaused())??!1}async endRecording(){if(!this.currentSession)throw new ValidationError("No active session to end");try{let e=0;if(this.recorder){const{failedUploads:c,totalFiles:h}=await this.recorder.stop();if(c.length>0)throw console.warn("Some audio files failed to upload:",c),new ScribeError(`Failed to upload audio recordings: ${c.join(", ")}`,"upload_failed");e=h||0,this.recorder=null}const s=await this.sessionAPI.endSession(this.currentSession.session_id,e);return this.emitEvent({type:"session:ended",data:s}),this.config.debug&&console.log("[ScribeSDK] Session ended:",s),s}catch(e){throw this.emitEvent({type:"error",error:e instanceof Error?e:new Error("Failed to end recording")}),e}}async reset(){this.recorder&&(await this.recorder.stop().catch(()=>{}),this.recorder=null),this.currentSession=null,this.discoveryAPI.clearCache(),this.discoveryDocument=null,this.isInitialized=!1}emitEvent(e){this.eventEmitter.emit(e)}async getOutputStatus(e){var c;const s=e||((c=this.currentSession)==null?void 0:c.session_id);if(!s)throw new ValidationError("No session ID provided and no active session");try{const h=await this.sessionAPI.getSessionStatus(s);return this.emitEvent({type:"session:status_update",data:h}),this.config.debug&&console.log("[ScribeSDK] Session status:",h),h}catch(h){throw this.emitEvent({type:"error",error:h instanceof Error?h:new Error("Failed to get output status")}),h}}async pollForCompletion(e,s={}){var h;const c=e||((h=this.currentSession)==null?void 0:h.session_id);if(!c)throw new ValidationError("No session ID provided and no active session");return this.sessionAPI.pollSessionStatus(c,{...s,onProgress:$=>{this.emitEvent({type:"session:status_update",data:$}),s.onProgress&&s.onProgress($)}})}getCurrentSession(){return this.currentSession}getDiscoveryDocument(){return this.discoveryDocument}on(e,s){this.eventEmitter.on(e,s)}off(e,s){this.eventEmitter.off(e,s)}clearSession(){this.currentSession=null}validateConfig(e){if(!e.baseUrl)throw new ValidationError("baseUrl is required for initialization")}}ScribeClient.instance=null;function useScribeSession(i){const[e,s]=reactExports.useState("idle"),[c,h]=reactExports.useState(0),[$,_]=reactExports.useState(null),[j,nt]=reactExports.useState(""),et=reactExports.useRef(null),b=reactExports.useRef(null),a=reactExports.useRef(0),o=reactExports.useRef(0),d=reactExports.useCallback((..._t)=>{i.debug&&console.log("[EkaScribe]",..._t)},[i.debug]);reactExports.useEffect(()=>{if(!i.baseUrl){d("Skipping SDK init - no baseUrl provided");return}return(async()=>{try{et.current=ScribeClient.getInstance({accessToken:i.accessToken,baseUrl:i.baseUrl,debug:i.debug}),await et.current.init(),d("SDK initialized")}catch(wt){d("Failed to initialize SDK",wt)}})(),()=>{b.current&&clearInterval(b.current)}},[i.accessToken,i.baseUrl,i.debug,d]);const g=reactExports.useCallback(()=>{b.current=window.setInterval(()=>{const _t=Math.floor((Date.now()-a.current)/1e3);h(_t)},1e3)},[]),it=reactExports.useCallback(()=>{b.current&&(clearInterval(b.current),b.current=null)},[]),st=async()=>{try{return(await navigator.permissions.query({name:"microphone"})).state}catch{return"prompt"}},tt=async()=>{try{return(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach(wt=>wt.stop()),!0}catch(_t){return d("Microphone permission denied",_t),!1}},ot=reactExports.useCallback((_t,wt=!1)=>{nt(_t),s(wt?"polling_error":"error")},[]),rt=reactExports.useCallback(async()=>{if(!et.current)return ot("SDK not initialized. Please try again.",!0),!1;try{s("processing"),d("Polling for completion...");const _t=await et.current.pollForCompletion(void 0,{maxAttempts:60,intervalMs:2e3,onProgress:wt=>{d("Status update:",wt.status)}});return _(_t),d("Final result:",_t),s("results"),i.onResult&&i.onResult(_t),!0}catch(_t){return d("Polling failed",_t),ot("Failed to fetch results. Please retry.",!0),i.onError&&_t instanceof Error&&i.onError(_t),!1}},[i,d,ot]),at=reactExports.useCallback(async()=>{const _t=await st();if(_t==="denied"){ot("Microphone access is blocked. Please enable it in your browser settings.");return}if(_t==="prompt"&&(s("permission"),!await tt())){ot("Microphone access is required to record.");return}if(!et.current){ot("SDK not initialized. Please try again.");return}try{s("recording"),await et.current.startRecording({templates:["eka_emr_template"],languageHint:i.languageHint}),a.current=Date.now(),o.current=0,h(0),g(),d("Recording started")}catch(wt){d("Failed to start recording",wt),ot("Failed to start recording. Please try again.")}},[i.templates,i.languageHint,d,ot,g]),ut=reactExports.useCallback(()=>{et.current&&(et.current.pauseRecording(),s("paused"),o.current=Date.now(),it(),d("Recording paused"))},[d,it]),lt=reactExports.useCallback(()=>{et.current&&(et.current.resumeRecording(),s("recording"),o.current&&(a.current+=Date.now()-o.current,o.current=0),g(),d("Recording resumed"))},[d,g]),ct=reactExports.useCallback(async()=>{if(et.current)try{it(),s("processing"),d("Stopping recording...");const _t=await et.current.endRecording();d("Recording ended",_t),await rt()}catch(_t){d("Failed to stop recording",_t),ot("Failed to process recording. Please try again."),i.onError&&_t instanceof Error&&i.onError(_t)}},[i,d,ot,it,rt]),ft=reactExports.useCallback(async()=>{d("Retrying polling..."),await rt()},[d,rt]),dt=reactExports.useCallback(()=>{_(null),nt(""),h(0),s("idle")},[]);return{state:e,elapsedTime:c,result:$,errorMessage:j,startRecording:at,pauseRecording:ut,resumeRecording:lt,stopRecording:ct,retryPolling:ft,reset:dt}}function App({config:i,onClose:e}){const[s,c]=reactExports.useState(!1),[h,$]=reactExports.useState(i.baseUrl?{accessToken:i.accessToken,baseUrl:i.baseUrl}:null),_=reactExports.useMemo(()=>h?{...i,accessToken:h.accessToken,baseUrl:h.baseUrl}:i,[i,h]),j=!h,{state:nt,elapsedTime:et,result:b,errorMessage:a,startRecording:o,pauseRecording:d,resumeRecording:g,stopRecording:it,retryPolling:st,reset:tt}=useScribeSession(_),ot=reactExports.useCallback(()=>{tt(),$(null)},[tt]);if(s)return null;const rt=(ut,lt)=>{$({accessToken:ut,baseUrl:lt})},at=()=>{if(j)return jsxRuntimeExports.jsx(ConfigState,{onSubmit:rt,initialAccessToken:i.accessToken||"",initialBaseUrl:i.baseUrl||""});switch(nt){case"idle":return jsxRuntimeExports.jsx(IdleState,{onStartRecording:o});case"permission":return jsxRuntimeExports.jsx(PermissionState,{onRequestPermission:o});case"recording":case"paused":return jsxRuntimeExports.jsx(RecordingState,{elapsedTime:et,isPaused:nt==="paused",onPause:d,onResume:g,onStop:it});case"processing":return jsxRuntimeExports.jsx(ProcessingState,{});case"results":return b?jsxRuntimeExports.jsx(ResultsState,{result:b,onNewRecording:ot}):null;case"polling_error":return jsxRuntimeExports.jsx(PollingErrorState,{message:a,onRetry:st,onStartNew:ot});case"error":return jsxRuntimeExports.jsx(ErrorState,{message:a,onRetry:ot});default:return jsxRuntimeExports.jsx(IdleState,{onStartRecording:o})}};return jsxRuntimeExports.jsx(FloatingPanel,{position:_.position,onClose:e,onMinimize:()=>c(!0),children:at()})}const widgetStyles=":host{all:initial;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,sans-serif}*{box-sizing:border-box;margin:0;padding:0}.scribe-panel{position:fixed;bottom:20px;right:20px;background:#fff;border-radius:16px;box-shadow:0 4px 24px #0000001f,0 0 0 1px #0000000d;z-index:2147483647;overflow:hidden;min-width:320px}.panel-header{display:flex;align-items:center;justify-content:space-between;padding:8px 12px;background:#fafafa;border-bottom:1px solid #eee;cursor:grab}.panel-header:active{cursor:grabbing}.drag-handle{display:flex;gap:2px;flex-wrap:wrap;width:16px;opacity:.4}.drag-handle span{width:4px;height:4px;background:#666;border-radius:50%}.header-actions{display:flex;gap:8px}.header-btn{background:none;border:none;cursor:pointer;padding:4px;color:#666;display:flex;align-items:center;justify-content:center;width:24px;height:24px}.header-btn:hover{color:#333}.header-btn svg{width:16px;height:16px}.panel-content{padding:20px 24px}.idle-state{display:flex;align-items:center;gap:24px}.logo{display:flex;align-items:center;gap:8px}.logo-icon{width:32px;height:32px}.logo-icon svg{width:100%;height:100%}.logo-text{font-size:20px;font-weight:600;color:#2563eb}.start-btn{display:flex;align-items:center;gap:8px;background:#2563eb;color:#fff;border:none;padding:12px 24px;border-radius:24px;font-size:16px;font-weight:500;cursor:pointer;transition:background .2s}.start-btn:hover{background:#1d4ed8}.start-btn:disabled{background:#93c5fd;cursor:not-allowed}.mic-icon{width:20px;height:20px}.mic-icon svg{width:100%;height:100%}.recording-state{display:flex;align-items:center;gap:16px}.recording-indicator{display:flex;align-items:center;gap:12px;color:#666}.recording-icon{width:24px;height:24px;color:#666}.recording-icon svg{width:100%;height:100%}.recording-icon.active{color:#ef4444;animation:pulse 1.5s infinite}@keyframes pulse{0%,to{opacity:1}50%{opacity:.5}}.timer{font-size:20px;font-weight:500;font-variant-numeric:tabular-nums;color:#374151}.recording-actions{display:flex;gap:8px;margin-left:auto}.resume-btn{background:#fff;color:#2563eb;border:2px solid #2563eb;padding:10px 20px;border-radius:8px;font-size:14px;font-weight:500;cursor:pointer;transition:all .2s}.resume-btn:hover{background:#eff6ff}.pause-btn{background:#fff;color:#f59e0b;border:2px solid #f59e0b;padding:10px 20px;border-radius:8px;font-size:14px;font-weight:500;cursor:pointer;transition:all .2s}.pause-btn:hover{background:#fffbeb}.stop-btn{background:#ef4444;color:#fff;border:none;padding:10px 16px;border-radius:8px;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .2s}.stop-btn:hover{background:#dc2626}.stop-icon{width:16px;height:16px;background:#fff;border-radius:2px}.processing-state{display:flex;flex-direction:column;align-items:center;gap:16px;padding:20px}.spinner{width:40px;height:40px;border:3px solid #e5e7eb;border-top-color:#2563eb;border-radius:50%;animation:spin 1s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.processing-text{color:#6b7280;font-size:14px}.results-state{display:flex;flex-direction:column;gap:16px;max-height:400px}.results-header{display:flex;align-items:center;justify-content:space-between}.results-title{font-size:16px;font-weight:600;color:#111827}.new-recording-btn{background:#2563eb;color:#fff;border:none;padding:8px 16px;border-radius:6px;font-size:13px;cursor:pointer;transition:background .2s}.new-recording-btn:hover{background:#1d4ed8}.results-content{overflow-y:auto;max-height:300px}.transcript-section{margin-bottom:16px}.section-title{font-size:13px;font-weight:600;color:#6b7280;text-transform:uppercase;letter-spacing:.05em;margin-bottom:8px}.transcript-text{font-size:14px;line-height:1.6;color:#374151;background:#f9fafb;padding:12px;border-radius:8px;white-space:pre-wrap}.error-state{display:flex;flex-direction:column;align-items:center;gap:12px;padding:20px;text-align:center}.error-icon{width:48px;height:48px;color:#ef4444}.error-icon svg{width:100%;height:100%}.error-message{color:#ef4444;font-size:14px}.retry-btn{background:#ef4444;color:#fff;border:none;padding:10px 20px;border-radius:8px;font-size:14px;cursor:pointer;transition:background .2s}.retry-btn:hover{background:#dc2626}.permission-state{display:flex;flex-direction:column;align-items:center;gap:16px;padding:20px;text-align:center}.permission-icon{width:48px;height:48px;color:#2563eb}.permission-icon svg{width:100%;height:100%}.permission-text{color:#374151;font-size:14px;line-height:1.5}.permission-btn{background:#2563eb;color:#fff;border:none;padding:12px 24px;border-radius:8px;font-size:14px;font-weight:500;cursor:pointer;transition:background .2s}.permission-btn:hover{background:#1d4ed8}.config-state{display:flex;flex-direction:column;gap:20px}.config-state .logo{justify-content:center}.config-form{display:flex;flex-direction:column;gap:12px}.config-form .form-group{display:flex;flex-direction:column;gap:4px}.config-form label{font-size:13px;font-weight:500;color:#374151}.config-form input{padding:10px 12px;border:1px solid #d1d5db;border-radius:8px;font-size:14px;color:#111827;background:#fff;transition:border-color .2s,box-shadow .2s}.config-form input:focus{outline:none;border-color:#2563eb;box-shadow:0 0 0 3px #2563eb1a}.config-form input::placeholder{color:#9ca3af}.config-error{color:#ef4444;font-size:13px;margin:0}.config-submit-btn{background:#2563eb;color:#fff;border:none;padding:12px 24px;border-radius:8px;font-size:14px;font-weight:500;cursor:pointer;transition:background .2s;margin-top:4px}.config-submit-btn:hover{background:#1d4ed8}.polling-error-state{display:flex;flex-direction:column;align-items:center;gap:12px;padding:20px;text-align:center}.polling-error-actions{display:flex;flex-direction:column;gap:8px;width:100%;margin-top:8px}.retry-polling-btn{background:#2563eb;color:#fff;border:none;padding:12px 20px;border-radius:8px;font-size:14px;font-weight:500;cursor:pointer;transition:background .2s;width:100%}.retry-polling-btn:hover{background:#1d4ed8}.start-new-btn{background:transparent;color:#6b7280;border:1px solid #d1d5db;padding:10px 20px;border-radius:8px;font-size:13px;cursor:pointer;transition:all .2s;width:100%}.start-new-btn:hover{background:#f3f4f6;color:#374151}";class ScribeWidget{constructor(e){Qr(this,"container");Qr(this,"shadowRoot");Qr(this,"root",null);Qr(this,"config");Qr(this,"visible",!0);this.config={templates:["soap"],languageHint:["en"],position:{bottom:20,right:20},...e},this.container=document.createElement("div"),this.container.id="eka-scribe-widget",this.shadowRoot=this.container.attachShadow({mode:"closed"});const s=document.createElement("style");s.textContent=widgetStyles,this.shadowRoot.appendChild(s);const c=document.createElement("div");c.id="eka-scribe-root",this.shadowRoot.appendChild(c),this.root=createRoot(c)}render(){!this.root||!this.visible||this.root.render(jsxRuntimeExports.jsx(App,{config:this.config,onClose:()=>this.hide()}))}mount(e){const s=typeof e=="string"?document.querySelector(e):e||document.body;s&&(s.appendChild(this.container),this.render())}unmount(){this.root&&(this.root.unmount(),this.root=null),this.container.remove()}show(){this.visible=!0,this.container.style.display="block",this.render()}hide(){this.visible=!1,this.container.style.display="none"}isVisible(){return this.visible}}let widgetInstance=null;function init(i={}){return widgetInstance&&widgetInstance.unmount(),console.log(i,"config - WIDGET"),widgetInstance=new ScribeWidget(i),widgetInstance.mount(),widgetInstance}function getInstance(){return widgetInstance}const EkaScribe={init,getInstance,Widget:ScribeWidget};if(typeof window<"u"&&typeof document<"u"){const i=()=>{const e=document.currentScript||document.querySelector('script[src*="scribe-widget"]');e!=null&&e.hasAttribute("data-no-auto-init")||(console.log(widgetInstance,"widget instance"),widgetInstance||init({baseUrl:""}))};document.readyState==="loading"?document.addEventListener("DOMContentLoaded - WIDGET",i):(console.log("load document - WIDGET"),i())}exports.ScribeWidget=ScribeWidget,exports.default=EkaScribe,exports.getInstance=getInstance,exports.init=init,Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1851
+ `},1670:i=>{i.exports=__WEBPACK_EXTERNAL_MODULE__1670__},7067:()=>{},1296:()=>{},1384:()=>{},3993:()=>{},908:()=>{},6953:()=>{},9925:()=>{},2806:()=>{},6449:()=>{},2850:()=>{},5381:()=>{},5686:(i,e,s)=>{s.r(e),s.d(e,{flatbuffers:()=>c});var c={};c.Offset,c.Table,c.SIZEOF_SHORT=2,c.SIZEOF_INT=4,c.FILE_IDENTIFIER_LENGTH=4,c.SIZE_PREFIX_LENGTH=4,c.Encoding={UTF8_BYTES:1,UTF16_STRING:2},c.int32=new Int32Array(2),c.float32=new Float32Array(c.int32.buffer),c.float64=new Float64Array(c.int32.buffer),c.isLittleEndian=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1,c.Long=function(h,$){this.low=0|h,this.high=0|$},c.Long.create=function(h,$){return h==0&&$==0?c.Long.ZERO:new c.Long(h,$)},c.Long.prototype.toFloat64=function(){return(this.low>>>0)+4294967296*this.high},c.Long.prototype.equals=function(h){return this.low==h.low&&this.high==h.high},c.Long.ZERO=new c.Long(0,0),c.Builder=function(h){if(h)$=h;else var $=1024;this.bb=c.ByteBuffer.allocate($),this.space=$,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},c.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},c.Builder.prototype.forceDefaults=function(h){this.force_defaults=h},c.Builder.prototype.dataBuffer=function(){return this.bb},c.Builder.prototype.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},c.Builder.prototype.prep=function(h,$){h>this.minalign&&(this.minalign=h);for(var _=1+~(this.bb.capacity()-this.space+$)&h-1;this.space<_+h+$;){var j=this.bb.capacity();this.bb=c.Builder.growByteBuffer(this.bb),this.space+=this.bb.capacity()-j}this.pad(_)},c.Builder.prototype.pad=function(h){for(var $=0;$<h;$++)this.bb.writeInt8(--this.space,0)},c.Builder.prototype.writeInt8=function(h){this.bb.writeInt8(this.space-=1,h)},c.Builder.prototype.writeInt16=function(h){this.bb.writeInt16(this.space-=2,h)},c.Builder.prototype.writeInt32=function(h){this.bb.writeInt32(this.space-=4,h)},c.Builder.prototype.writeInt64=function(h){this.bb.writeInt64(this.space-=8,h)},c.Builder.prototype.writeFloat32=function(h){this.bb.writeFloat32(this.space-=4,h)},c.Builder.prototype.writeFloat64=function(h){this.bb.writeFloat64(this.space-=8,h)},c.Builder.prototype.addInt8=function(h){this.prep(1,0),this.writeInt8(h)},c.Builder.prototype.addInt16=function(h){this.prep(2,0),this.writeInt16(h)},c.Builder.prototype.addInt32=function(h){this.prep(4,0),this.writeInt32(h)},c.Builder.prototype.addInt64=function(h){this.prep(8,0),this.writeInt64(h)},c.Builder.prototype.addFloat32=function(h){this.prep(4,0),this.writeFloat32(h)},c.Builder.prototype.addFloat64=function(h){this.prep(8,0),this.writeFloat64(h)},c.Builder.prototype.addFieldInt8=function(h,$,_){(this.force_defaults||$!=_)&&(this.addInt8($),this.slot(h))},c.Builder.prototype.addFieldInt16=function(h,$,_){(this.force_defaults||$!=_)&&(this.addInt16($),this.slot(h))},c.Builder.prototype.addFieldInt32=function(h,$,_){(this.force_defaults||$!=_)&&(this.addInt32($),this.slot(h))},c.Builder.prototype.addFieldInt64=function(h,$,_){!this.force_defaults&&$.equals(_)||(this.addInt64($),this.slot(h))},c.Builder.prototype.addFieldFloat32=function(h,$,_){(this.force_defaults||$!=_)&&(this.addFloat32($),this.slot(h))},c.Builder.prototype.addFieldFloat64=function(h,$,_){(this.force_defaults||$!=_)&&(this.addFloat64($),this.slot(h))},c.Builder.prototype.addFieldOffset=function(h,$,_){(this.force_defaults||$!=_)&&(this.addOffset($),this.slot(h))},c.Builder.prototype.addFieldStruct=function(h,$,_){$!=_&&(this.nested($),this.slot(h))},c.Builder.prototype.nested=function(h){if(h!=this.offset())throw new Error("FlatBuffers: struct must be serialized inline.")},c.Builder.prototype.notNested=function(){if(this.isNested)throw new Error("FlatBuffers: object serialization must not be nested.")},c.Builder.prototype.slot=function(h){this.vtable[h]=this.offset()},c.Builder.prototype.offset=function(){return this.bb.capacity()-this.space},c.Builder.growByteBuffer=function(h){var $=h.capacity();if(3221225472&$)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");var _=$<<1,j=c.ByteBuffer.allocate(_);return j.setPosition(_-$),j.bytes().set(h.bytes(),_-$),j},c.Builder.prototype.addOffset=function(h){this.prep(c.SIZEOF_INT,0),this.writeInt32(this.offset()-h+c.SIZEOF_INT)},c.Builder.prototype.startObject=function(h){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=h;for(var $=0;$<h;$++)this.vtable[$]=0;this.isNested=!0,this.object_start=this.offset()},c.Builder.prototype.endObject=function(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);for(var h=this.offset(),$=this.vtable_in_use-1;$>=0&&this.vtable[$]==0;$--);for(var _=$+1;$>=0;$--)this.addInt16(this.vtable[$]!=0?h-this.vtable[$]:0);this.addInt16(h-this.object_start);var j=(_+2)*c.SIZEOF_SHORT;this.addInt16(j);var nt=0,et=this.space;e:for($=0;$<this.vtables.length;$++){var b=this.bb.capacity()-this.vtables[$];if(j==this.bb.readInt16(b)){for(var a=c.SIZEOF_SHORT;a<j;a+=c.SIZEOF_SHORT)if(this.bb.readInt16(et+a)!=this.bb.readInt16(b+a))continue e;nt=this.vtables[$];break}}return nt?(this.space=this.bb.capacity()-h,this.bb.writeInt32(this.space,nt-h)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-h,this.offset()-h)),this.isNested=!1,h},c.Builder.prototype.finish=function(h,$,_){var j=_?c.SIZE_PREFIX_LENGTH:0;if($){var nt=$;if(this.prep(this.minalign,c.SIZEOF_INT+c.FILE_IDENTIFIER_LENGTH+j),nt.length!=c.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+c.FILE_IDENTIFIER_LENGTH);for(var et=c.FILE_IDENTIFIER_LENGTH-1;et>=0;et--)this.writeInt8(nt.charCodeAt(et))}this.prep(this.minalign,c.SIZEOF_INT+j),this.addOffset(h),j&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)},c.Builder.prototype.finishSizePrefixed=function(h,$){this.finish(h,$,!0)},c.Builder.prototype.requiredField=function(h,$){var _=this.bb.capacity()-h,j=_-this.bb.readInt32(_);if(this.bb.readInt16(j+$)==0)throw new Error("FlatBuffers: field "+$+" must be set")},c.Builder.prototype.startVector=function(h,$,_){this.notNested(),this.vector_num_elems=$,this.prep(c.SIZEOF_INT,h*$),this.prep(_,h*$)},c.Builder.prototype.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},c.Builder.prototype.createString=function(h){if(h instanceof Uint8Array)var $=h;else{$=[];for(var _=0;_<h.length;){var j,nt=h.charCodeAt(_++);(j=nt<55296||nt>=56320?nt:(nt<<10)+h.charCodeAt(_++)+-56613888)<128?$.push(j):(j<2048?$.push(j>>6&31|192):(j<65536?$.push(j>>12&15|224):$.push(j>>18&7|240,j>>12&63|128),$.push(j>>6&63|128)),$.push(63&j|128))}}this.addInt8(0),this.startVector(1,$.length,1),this.bb.setPosition(this.space-=$.length),_=0;for(var et=this.space,b=this.bb.bytes();_<$.length;_++)b[et++]=$[_];return this.endVector()},c.Builder.prototype.createLong=function(h,$){return c.Long.create(h,$)},c.ByteBuffer=function(h){this.bytes_=h,this.position_=0},c.ByteBuffer.allocate=function(h){return new c.ByteBuffer(new Uint8Array(h))},c.ByteBuffer.prototype.clear=function(){this.position_=0},c.ByteBuffer.prototype.bytes=function(){return this.bytes_},c.ByteBuffer.prototype.position=function(){return this.position_},c.ByteBuffer.prototype.setPosition=function(h){this.position_=h},c.ByteBuffer.prototype.capacity=function(){return this.bytes_.length},c.ByteBuffer.prototype.readInt8=function(h){return this.readUint8(h)<<24>>24},c.ByteBuffer.prototype.readUint8=function(h){return this.bytes_[h]},c.ByteBuffer.prototype.readInt16=function(h){return this.readUint16(h)<<16>>16},c.ByteBuffer.prototype.readUint16=function(h){return this.bytes_[h]|this.bytes_[h+1]<<8},c.ByteBuffer.prototype.readInt32=function(h){return this.bytes_[h]|this.bytes_[h+1]<<8|this.bytes_[h+2]<<16|this.bytes_[h+3]<<24},c.ByteBuffer.prototype.readUint32=function(h){return this.readInt32(h)>>>0},c.ByteBuffer.prototype.readInt64=function(h){return new c.Long(this.readInt32(h),this.readInt32(h+4))},c.ByteBuffer.prototype.readUint64=function(h){return new c.Long(this.readUint32(h),this.readUint32(h+4))},c.ByteBuffer.prototype.readFloat32=function(h){return c.int32[0]=this.readInt32(h),c.float32[0]},c.ByteBuffer.prototype.readFloat64=function(h){return c.int32[c.isLittleEndian?0:1]=this.readInt32(h),c.int32[c.isLittleEndian?1:0]=this.readInt32(h+4),c.float64[0]},c.ByteBuffer.prototype.writeInt8=function(h,$){this.bytes_[h]=$},c.ByteBuffer.prototype.writeUint8=function(h,$){this.bytes_[h]=$},c.ByteBuffer.prototype.writeInt16=function(h,$){this.bytes_[h]=$,this.bytes_[h+1]=$>>8},c.ByteBuffer.prototype.writeUint16=function(h,$){this.bytes_[h]=$,this.bytes_[h+1]=$>>8},c.ByteBuffer.prototype.writeInt32=function(h,$){this.bytes_[h]=$,this.bytes_[h+1]=$>>8,this.bytes_[h+2]=$>>16,this.bytes_[h+3]=$>>24},c.ByteBuffer.prototype.writeUint32=function(h,$){this.bytes_[h]=$,this.bytes_[h+1]=$>>8,this.bytes_[h+2]=$>>16,this.bytes_[h+3]=$>>24},c.ByteBuffer.prototype.writeInt64=function(h,$){this.writeInt32(h,$.low),this.writeInt32(h+4,$.high)},c.ByteBuffer.prototype.writeUint64=function(h,$){this.writeUint32(h,$.low),this.writeUint32(h+4,$.high)},c.ByteBuffer.prototype.writeFloat32=function(h,$){c.float32[0]=$,this.writeInt32(h,c.int32[0])},c.ByteBuffer.prototype.writeFloat64=function(h,$){c.float64[0]=$,this.writeInt32(h,c.int32[c.isLittleEndian?0:1]),this.writeInt32(h+4,c.int32[c.isLittleEndian?1:0])},c.ByteBuffer.prototype.getBufferIdentifier=function(){if(this.bytes_.length<this.position_+c.SIZEOF_INT+c.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");for(var h="",$=0;$<c.FILE_IDENTIFIER_LENGTH;$++)h+=String.fromCharCode(this.readInt8(this.position_+c.SIZEOF_INT+$));return h},c.ByteBuffer.prototype.__offset=function(h,$){var _=h-this.readInt32(h);return $<this.readInt16(_)?this.readInt16(_+$):0},c.ByteBuffer.prototype.__union=function(h,$){return h.bb_pos=$+this.readInt32($),h.bb=this,h},c.ByteBuffer.prototype.__string=function(h,$){h+=this.readInt32(h);var _=this.readInt32(h),j="",nt=0;if(h+=c.SIZEOF_INT,$===c.Encoding.UTF8_BYTES)return this.bytes_.subarray(h,h+_);for(;nt<_;){var et,b=this.readUint8(h+nt++);if(b<192)et=b;else{var a=this.readUint8(h+nt++);if(b<224)et=(31&b)<<6|63&a;else{var o=this.readUint8(h+nt++);et=b<240?(15&b)<<12|(63&a)<<6|63&o:(7&b)<<18|(63&a)<<12|(63&o)<<6|63&this.readUint8(h+nt++)}}et<65536?j+=String.fromCharCode(et):(et-=65536,j+=String.fromCharCode(55296+(et>>10),56320+(1023&et)))}return j},c.ByteBuffer.prototype.__indirect=function(h){return h+this.readInt32(h)},c.ByteBuffer.prototype.__vector=function(h){return h+this.readInt32(h)+c.SIZEOF_INT},c.ByteBuffer.prototype.__vector_len=function(h){return this.readInt32(h+this.readInt32(h))},c.ByteBuffer.prototype.__has_identifier=function(h){if(h.length!=c.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+c.FILE_IDENTIFIER_LENGTH);for(var $=0;$<c.FILE_IDENTIFIER_LENGTH;$++)if(h.charCodeAt($)!=this.readInt8(this.position_+c.SIZEOF_INT+$))return!1;return!0},c.ByteBuffer.prototype.createLong=function(h,$){return c.Long.create(h,$)}}},__webpack_module_cache__={};function __webpack_require__(i){var e=__webpack_module_cache__[i];if(e!==void 0)return e.exports;var s=__webpack_module_cache__[i]={exports:{}};return __webpack_modules__[i].call(s.exports,s,s.exports,__webpack_require__),s.exports}__webpack_require__.n=i=>{var e=i&&i.__esModule?()=>i.default:()=>i;return __webpack_require__.d(e,{a:e}),e},__webpack_require__.d=(i,e)=>{for(var s in e)__webpack_require__.o(e,s)&&!__webpack_require__.o(i,s)&&Object.defineProperty(i,s,{enumerable:!0,get:e[s]})},__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=(i,e)=>Object.prototype.hasOwnProperty.call(i,e),__webpack_require__.r=i=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})};var __webpack_exports__=__webpack_require__(6018);return __webpack_exports__})())})(ortWeb_min);var ortWeb_minExports=ortWeb_min.exports,assetPath={};Object.defineProperty(assetPath,"__esModule",{value:!0}),assetPath.baseAssetPath=void 0;const isWeb=typeof window<"u"&&typeof window.document<"u",currentScript=isWeb?window.document.currentScript:null;let basePath="/";currentScript&&(basePath=currentScript.src.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),assetPath.baseAssetPath=basePath;var defaultModelFetcher$1={};Object.defineProperty(defaultModelFetcher$1,"__esModule",{value:!0}),defaultModelFetcher$1.defaultModelFetcher=void 0;const defaultModelFetcher=i=>fetch(i).then(e=>e.arrayBuffer());defaultModelFetcher$1.defaultModelFetcher=defaultModelFetcher;var frameProcessor={},logging={};(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.log=i.LOG_PREFIX=void 0,i.LOG_PREFIX="[VAD]";const e=["error","debug","warn"];function s(h){return(...$)=>{console[h](i.LOG_PREFIX,...$)}}const c=e.reduce((h,$)=>(h[$]=s($),h),{});i.log=c})(logging);var messages={};Object.defineProperty(messages,"__esModule",{value:!0}),messages.Message=void 0;var Message;(function(i){i.AudioFrame="AUDIO_FRAME",i.SpeechStart="SPEECH_START",i.VADMisfire="VAD_MISFIRE",i.SpeechEnd="SPEECH_END",i.SpeechStop="SPEECH_STOP"})(Message||(messages.Message=Message={})),Object.defineProperty(frameProcessor,"__esModule",{value:!0}),frameProcessor.FrameProcessor=frameProcessor.validateOptions=frameProcessor.defaultV5FrameProcessorOptions=frameProcessor.defaultLegacyFrameProcessorOptions=void 0;const logging_1$3=logging,messages_1=messages,RECOMMENDED_FRAME_SAMPLES=[512,1024,1536];frameProcessor.defaultLegacyFrameProcessorOptions={positiveSpeechThreshold:.5,negativeSpeechThreshold:.5-.15,preSpeechPadFrames:1,redemptionFrames:8,frameSamples:1536,minSpeechFrames:3,submitUserSpeechOnPause:!1},frameProcessor.defaultV5FrameProcessorOptions={positiveSpeechThreshold:.5,negativeSpeechThreshold:.5-.15,preSpeechPadFrames:3,redemptionFrames:24,frameSamples:512,minSpeechFrames:9,submitUserSpeechOnPause:!1};function validateOptions(i){RECOMMENDED_FRAME_SAMPLES.includes(i.frameSamples)||logging_1$3.log.warn("You are using an unusual frame size"),(i.positiveSpeechThreshold<0||i.positiveSpeechThreshold>1)&&logging_1$3.log.error("positiveSpeechThreshold should be a number between 0 and 1"),(i.negativeSpeechThreshold<0||i.negativeSpeechThreshold>i.positiveSpeechThreshold)&&logging_1$3.log.error("negativeSpeechThreshold should be between 0 and positiveSpeechThreshold"),i.preSpeechPadFrames<0&&logging_1$3.log.error("preSpeechPadFrames should be positive"),i.redemptionFrames<0&&logging_1$3.log.error("redemptionFrames should be positive")}frameProcessor.validateOptions=validateOptions;const concatArrays=i=>{const e=i.reduce((c,h)=>(c.push(c.at(-1)+h.length),c),[0]),s=new Float32Array(e.at(-1));return i.forEach((c,h)=>{const $=e[h];s.set(c,$)}),s};class FrameProcessor{constructor(e,s,c){this.modelProcessFunc=e,this.modelResetFunc=s,this.options=c,this.speaking=!1,this.redemptionCounter=0,this.active=!1,this.reset=()=>{this.speaking=!1,this.audioBuffer=[],this.modelResetFunc(),this.redemptionCounter=0},this.pause=()=>(this.active=!1,this.options.submitUserSpeechOnPause?this.endSegment():(this.reset(),{})),this.resume=()=>{this.active=!0},this.endSegment=()=>{const h=this.audioBuffer;this.audioBuffer=[];const $=this.speaking;this.reset();const _=h.reduce((j,nt)=>j+ +nt.isSpeech,0);if($)if(_>=this.options.minSpeechFrames){const j=concatArrays(h.map(nt=>nt.frame));return{msg:messages_1.Message.SpeechEnd,audio:j}}else return{msg:messages_1.Message.VADMisfire};return{}},this.process=async h=>{if(!this.active)return{};const $=await this.modelProcessFunc(h);if(this.audioBuffer.push({frame:h,isSpeech:$.isSpeech>=this.options.positiveSpeechThreshold}),$.isSpeech>=this.options.positiveSpeechThreshold&&this.redemptionCounter&&(this.redemptionCounter=0),$.isSpeech>=this.options.positiveSpeechThreshold&&!this.speaking)return this.speaking=!0,{probs:$,msg:messages_1.Message.SpeechStart,frame:h};if($.isSpeech<this.options.negativeSpeechThreshold&&this.speaking&&++this.redemptionCounter>=this.options.redemptionFrames){this.redemptionCounter=0,this.speaking=!1;const _=this.audioBuffer;if(this.audioBuffer=[],_.reduce((nt,et)=>nt+ +et.isSpeech,0)>=this.options.minSpeechFrames){const nt=concatArrays(_.map(et=>et.frame));return{probs:$,msg:messages_1.Message.SpeechEnd,audio:nt,frame:h}}else return{probs:$,msg:messages_1.Message.VADMisfire,frame:h}}if(!this.speaking)for(;this.audioBuffer.length>this.options.preSpeechPadFrames;)this.audioBuffer.shift();return{probs:$,frame:h}},this.audioBuffer=[],this.reset()}}frameProcessor.FrameProcessor=FrameProcessor;var nonRealTimeVad={},models={},common={};Object.defineProperty(common,"__esModule",{value:!0});var legacy={},_a$1;Object.defineProperty(legacy,"__esModule",{value:!0}),legacy.SileroLegacy=void 0;const logging_1$2=logging;class SileroLegacy{constructor(e,s,c,h,$){this.ortInstance=e,this._session=s,this._h=c,this._c=h,this._sr=$,this.reset_state=()=>{const _=Array(128).fill(0);this._h=new this.ortInstance.Tensor("float32",_,[2,1,64]),this._c=new this.ortInstance.Tensor("float32",_,[2,1,64])},this.process=async _=>{var o;const nt={input:new this.ortInstance.Tensor("float32",_,[1,_.length]),h:this._h,c:this._c,sr:this._sr},et=await this._session.run(nt);this._h=et.hn,this._c=et.cn;const[b]=(o=et.output)==null?void 0:o.data;return{notSpeech:1-b,isSpeech:b}}}}legacy.SileroLegacy=SileroLegacy,_a$1=SileroLegacy,SileroLegacy.new=async(i,e)=>{logging_1$2.log.debug("initializing vad");const s=await e(),c=await i.InferenceSession.create(s),h=new i.Tensor("int64",[16000n]),$=Array(2*64).fill(0),_=new i.Tensor("float32",$,[2,1,64]),j=new i.Tensor("float32",$,[2,1,64]);return logging_1$2.log.debug("vad is initialized"),new _a$1(i,c,_,j,h)};var v5={},_a;Object.defineProperty(v5,"__esModule",{value:!0}),v5.SileroV5=void 0;const logging_1$1=logging;function getNewState(i){const e=Array(256).fill(0);return new i.Tensor("float32",e,[2,1,128])}class SileroV5{constructor(e,s,c,h){this._session=e,this._state=s,this._sr=c,this.ortInstance=h,this.reset_state=()=>{this._state=getNewState(this.ortInstance)},this.process=async $=>{var a;const j={input:new this.ortInstance.Tensor("float32",$,[1,$.length]),state:this._state,sr:this._sr},nt=await this._session.run(j);this._state=nt.stateN;const[et]=(a=nt.output)==null?void 0:a.data;return{notSpeech:1-et,isSpeech:et}}}}v5.SileroV5=SileroV5,_a=SileroV5,SileroV5.new=async(i,e)=>{logging_1$1.log.debug("Loading VAD...");const s=await e(),c=await i.InferenceSession.create(s),h=new i.Tensor("int64",[16000n]),$=getNewState(i);return logging_1$1.log.debug("...finished loading VAD"),new _a(c,$,h,i)},function(i){var e=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function($,_,j,nt){nt===void 0&&(nt=j);var et=Object.getOwnPropertyDescriptor(_,j);(!et||("get"in et?!_.__esModule:et.writable||et.configurable))&&(et={enumerable:!0,get:function(){return _[j]}}),Object.defineProperty($,nt,et)}:function($,_,j,nt){nt===void 0&&(nt=j),$[nt]=_[j]}),s=commonjsGlobal&&commonjsGlobal.__exportStar||function($,_){for(var j in $)j!=="default"&&!Object.prototype.hasOwnProperty.call(_,j)&&e(_,$,j)};Object.defineProperty(i,"__esModule",{value:!0}),i.SileroV5=i.SileroLegacy=void 0,s(common,i);var c=legacy;Object.defineProperty(i,"SileroLegacy",{enumerable:!0,get:function(){return c.SileroLegacy}});var h=v5;Object.defineProperty(i,"SileroV5",{enumerable:!0,get:function(){return h.SileroV5}})}(models);var resampler={};Object.defineProperty(resampler,"__esModule",{value:!0}),resampler.Resampler=void 0;const logging_1=logging;class Resampler{constructor(e){this.options=e,this.process=s=>{const c=[];for(const h of s)for(this.inputBuffer.push(h);this.hasEnoughDataForFrame();){const $=this.generateOutputFrame();c.push($)}return c},this.stream=async function*(s){for(const c of s)for(this.inputBuffer.push(c);this.hasEnoughDataForFrame();)yield this.generateOutputFrame()},e.nativeSampleRate<16e3&&logging_1.log.error("nativeSampleRate is too low. Should have 16000 = targetSampleRate <= nativeSampleRate"),this.inputBuffer=[]}hasEnoughDataForFrame(){return this.inputBuffer.length*this.options.targetSampleRate/this.options.nativeSampleRate>=this.options.targetFrameSize}generateOutputFrame(){const e=new Float32Array(this.options.targetFrameSize);let s=0,c=0;for(;s<this.options.targetFrameSize;){let h=0,$=0;for(;c<Math.min(this.inputBuffer.length,(s+1)*this.options.nativeSampleRate/this.options.targetSampleRate);){const _=this.inputBuffer[c];_!==void 0&&(h+=_,$++),c++}e[s]=h/$,s++}return this.inputBuffer=this.inputBuffer.slice(c),e}}resampler.Resampler=Resampler,function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.PlatformAgnosticNonRealTimeVAD=i.defaultNonRealTimeVADOptions=void 0;const e=frameProcessor,s=messages,c=models,h=resampler;i.defaultNonRealTimeVADOptions={...e.defaultLegacyFrameProcessorOptions,ortConfig:void 0};class ${static async _new(j,nt,et={}){const b={...i.defaultNonRealTimeVADOptions,...et};b.ortConfig!==void 0&&b.ortConfig(nt);const a=new this(j,nt,b);return await a.init(),a}constructor(j,nt,et){this.modelFetcher=j,this.ort=nt,this.options=et,this.init=async()=>{const b=await c.SileroLegacy.new(this.ort,this.modelFetcher);this.frameProcessor=new e.FrameProcessor(b.process,b.reset_state,{frameSamples:this.options.frameSamples,positiveSpeechThreshold:this.options.positiveSpeechThreshold,negativeSpeechThreshold:this.options.negativeSpeechThreshold,redemptionFrames:this.options.redemptionFrames,preSpeechPadFrames:this.options.preSpeechPadFrames,minSpeechFrames:this.options.minSpeechFrames,submitUserSpeechOnPause:this.options.submitUserSpeechOnPause}),this.frameProcessor.resume()},this.run=async function*(b,a){const o={nativeSampleRate:a,targetSampleRate:16e3,targetFrameSize:this.options.frameSamples},d=new h.Resampler(o);let g=0,it=0,st=0;for await(const rt of d.stream(b)){const{msg:at,audio:ut}=await this.frameProcessor.process(rt);switch(at){case s.Message.SpeechStart:g=st*this.options.frameSamples/16;break;case s.Message.SpeechEnd:it=(st+1)*this.options.frameSamples/16,yield{audio:ut,start:g,end:it};break}st++}const{msg:tt,audio:ot}=this.frameProcessor.endSegment();tt==s.Message.SpeechEnd&&(yield{audio:ot,start:g,end:st*this.options.frameSamples/16})},(0,e.validateOptions)(et)}}i.PlatformAgnosticNonRealTimeVAD=$}(nonRealTimeVad);var utils={};Object.defineProperty(utils,"__esModule",{value:!0}),utils.audioFileToArray=utils.encodeWAV=utils.arrayBufferToBase64=utils.minFramesForTargetMS=void 0;function minFramesForTargetMS(i,e,s=16e3){return Math.ceil(i*s/1e3/e)}utils.minFramesForTargetMS=minFramesForTargetMS;function arrayBufferToBase64(i){const e=new Uint8Array(i),s=e.byteLength,c=new Array(s);for(var h=0;h<s;h++){const $=e[h];if($===void 0)break;c[h]=String.fromCharCode($)}return btoa(c.join(""))}utils.arrayBufferToBase64=arrayBufferToBase64;function encodeWAV(i,e=3,s=16e3,c=1,h=32){var $=h/8,_=c*$,j=new ArrayBuffer(44+i.length*$),nt=new DataView(j);return writeString(nt,0,"RIFF"),nt.setUint32(4,36+i.length*$,!0),writeString(nt,8,"WAVE"),writeString(nt,12,"fmt "),nt.setUint32(16,16,!0),nt.setUint16(20,e,!0),nt.setUint16(22,c,!0),nt.setUint32(24,s,!0),nt.setUint32(28,s*_,!0),nt.setUint16(32,_,!0),nt.setUint16(34,h,!0),writeString(nt,36,"data"),nt.setUint32(40,i.length*$,!0),e===1?floatTo16BitPCM(nt,44,i):writeFloat32(nt,44,i),j}utils.encodeWAV=encodeWAV;function writeFloat32(i,e,s){for(var c=0;c<s.length;c++,e+=4)i.setFloat32(e,s[c],!0)}function floatTo16BitPCM(i,e,s){for(var c=0;c<s.length;c++,e+=2){var h=Math.max(-1,Math.min(1,s[c]));i.setInt16(e,h<0?h*32768:h*32767,!0)}}function writeString(i,e,s){for(var c=0;c<s.length;c++)i.setUint8(e+c,s.charCodeAt(c))}async function audioFileToArray(i){const e=new OfflineAudioContext(1,1,44100),s=new FileReader;let c=null;if(await new Promise(_=>{s.addEventListener("loadend",j=>{const nt=s.result;e.decodeAudioData(nt,et=>{c=et,e.startRendering().then(b=>{console.log("Rendering completed successfully"),_()}).catch(b=>{console.error(`Rendering failed: ${b}`)})},et=>{console.log(`Error with decoding audio data: ${et}`)})}),s.readAsArrayBuffer(i)}),c===null)throw Error("some shit");let h=c,$=new Float32Array(h.length);for(let _=0;_<h.length;_++)for(let j=0;j<h.numberOfChannels;j++)$[_]+=h.getChannelData(j)[_];return{audio:$,sampleRate:h.sampleRate}}utils.audioFileToArray=audioFileToArray;var realTimeVad={};(function(i){var e=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(tt,ot,rt,at){at===void 0&&(at=rt);var ut=Object.getOwnPropertyDescriptor(ot,rt);(!ut||("get"in ut?!ot.__esModule:ut.writable||ut.configurable))&&(ut={enumerable:!0,get:function(){return ot[rt]}}),Object.defineProperty(tt,at,ut)}:function(tt,ot,rt,at){at===void 0&&(at=rt),tt[at]=ot[rt]}),s=commonjsGlobal&&commonjsGlobal.__setModuleDefault||(Object.create?function(tt,ot){Object.defineProperty(tt,"default",{enumerable:!0,value:ot})}:function(tt,ot){tt.default=ot}),c=commonjsGlobal&&commonjsGlobal.__importStar||function(tt){if(tt&&tt.__esModule)return tt;var ot={};if(tt!=null)for(var rt in tt)rt!=="default"&&Object.prototype.hasOwnProperty.call(tt,rt)&&e(ot,tt,rt);return s(ot,tt),ot};Object.defineProperty(i,"__esModule",{value:!0}),i.AudioNodeVAD=i.MicVAD=i.getDefaultRealTimeVADOptions=i.ort=i.DEFAULT_MODEL=void 0;const h=c(ortWeb_minExports),$=defaultModelFetcher$1,_=frameProcessor,j=logging,nt=messages,et=models,b=resampler;i.DEFAULT_MODEL="legacy",i.ort=h;const a="vad.worklet.bundle.min.js",o="silero_vad_v5.onnx",d="silero_vad_legacy.onnx",g=tt=>({...tt==="v5"?_.defaultV5FrameProcessorOptions:_.defaultLegacyFrameProcessorOptions,onFrameProcessed:rt=>{},onVADMisfire:()=>{j.log.debug("VAD misfire")},onSpeechStart:()=>{j.log.debug("Detected speech start")},onSpeechEnd:()=>{j.log.debug("Detected speech end")},baseAssetPath:"https://cdn.jsdelivr.net/npm/@ricky0123/vad-web@0.0.22/dist/",onnxWASMBasePath:"https://cdn.jsdelivr.net/npm/onnxruntime-web@1.14.0/dist/",stream:void 0,ortConfig:void 0,model:i.DEFAULT_MODEL,workletOptions:{}});i.getDefaultRealTimeVADOptions=g;class it{static async new(ot={}){const rt={...(0,i.getDefaultRealTimeVADOptions)(ot.model??i.DEFAULT_MODEL),...ot};(0,_.validateOptions)(rt);let at;rt.stream===void 0?at=await navigator.mediaDevices.getUserMedia({audio:{...rt.additionalAudioConstraints,channelCount:1,echoCancellation:!0,autoGainControl:!0,noiseSuppression:!0}}):at=rt.stream;const ut=new AudioContext,lt=new MediaStreamAudioSourceNode(ut,{mediaStream:at}),ct=await st.new(ut,rt);return ct.receive(lt),new it(rt,ut,at,ct,lt)}constructor(ot,rt,at,ut,lt,ct=!1){this.options=ot,this.audioContext=rt,this.stream=at,this.audioNodeVAD=ut,this.sourceNode=lt,this.listening=ct,this.pause=()=>{this.audioNodeVAD.pause(),this.listening=!1},this.start=()=>{this.audioNodeVAD.start(),this.listening=!0},this.destroy=()=>{this.listening&&this.pause(),this.options.stream===void 0&&this.stream.getTracks().forEach(ft=>ft.stop()),this.sourceNode.disconnect(),this.audioNodeVAD.destroy(),this.audioContext.close()}}}i.MicVAD=it;class st{static async new(ot,rt={}){const at={...(0,i.getDefaultRealTimeVADOptions)(rt.model??i.DEFAULT_MODEL),...rt};(0,_.validateOptions)(at),i.ort.env.wasm.wasmPaths=at.onnxWASMBasePath,at.ortConfig!==void 0&&at.ortConfig(i.ort);const ut=at.model==="v5"?o:d,lt=at.baseAssetPath+ut,ct=at.model==="v5"?et.SileroV5.new:et.SileroLegacy.new;let ft;try{ft=await ct(i.ort,()=>(0,$.defaultModelFetcher)(lt))}catch(wt){throw console.error(`Encountered an error while loading model file ${lt}`),wt}const dt=new _.FrameProcessor(ft.process,ft.reset_state,{frameSamples:at.frameSamples,positiveSpeechThreshold:at.positiveSpeechThreshold,negativeSpeechThreshold:at.negativeSpeechThreshold,redemptionFrames:at.redemptionFrames,preSpeechPadFrames:at.preSpeechPadFrames,minSpeechFrames:at.minSpeechFrames,submitUserSpeechOnPause:at.submitUserSpeechOnPause}),_t=new st(ot,at,dt);return await _t.setupAudioNode(),_t}constructor(ot,rt,at){this.ctx=ot,this.options=rt,this.bufferIndex=0,this.pause=()=>{const ut=this.frameProcessor.pause();this.handleFrameProcessorEvent(ut)},this.start=()=>{this.frameProcessor.resume()},this.receive=ut=>{ut.connect(this.audioNode)},this.processFrame=async ut=>{const lt=await this.frameProcessor.process(ut);this.handleFrameProcessorEvent(lt)},this.handleFrameProcessorEvent=ut=>{switch(ut.probs!==void 0&&this.options.onFrameProcessed(ut.probs,ut.frame),ut.msg){case nt.Message.SpeechStart:this.options.onSpeechStart();break;case nt.Message.VADMisfire:this.options.onVADMisfire();break;case nt.Message.SpeechEnd:this.options.onSpeechEnd(ut.audio);break}},this.destroy=()=>{var ut;this.audioNode instanceof AudioWorkletNode&&this.audioNode.port.postMessage({message:nt.Message.SpeechStop}),this.audioNode.disconnect(),(ut=this.gainNode)==null||ut.disconnect()},this.frameProcessor=at}async setupAudioNode(){if("audioWorklet"in this.ctx&&typeof AudioWorkletNode=="function")try{const ut=this.options.baseAssetPath+a;await this.ctx.audioWorklet.addModule(ut);const lt=this.options.workletOptions??{};lt.processorOptions={...lt.processorOptions??{},frameSamples:this.options.frameSamples},this.audioNode=new AudioWorkletNode(this.ctx,"vad-helper-worklet",lt),this.audioNode.port.onmessage=async ct=>{var ft;switch((ft=ct.data)==null?void 0:ft.message){case nt.Message.AudioFrame:let dt=ct.data.data;dt instanceof ArrayBuffer||(dt=new ArrayBuffer(ct.data.data.byteLength),new Uint8Array(dt).set(new Uint8Array(ct.data.data)));const _t=new Float32Array(dt);await this.processFrame(_t);break}};return}catch(ut){console.log("AudioWorklet setup failed, falling back to ScriptProcessor",ut)}this.resampler=new b.Resampler({nativeSampleRate:this.ctx.sampleRate,targetSampleRate:16e3,targetFrameSize:this.options.frameSamples??480});const rt=4096;this.audioNode=this.ctx.createScriptProcessor(rt,1,1),this.gainNode=this.ctx.createGain(),this.gainNode.gain.value=0;let at=!1;this.audioNode.onaudioprocess=async ut=>{if(!at){at=!0;try{const lt=ut.inputBuffer.getChannelData(0);if(ut.outputBuffer.getChannelData(0).fill(0),this.resampler){const ft=this.resampler.process(lt);for(const dt of ft)await this.processFrame(dt)}}catch(lt){console.error("Error processing audio:",lt)}finally{at=!1}}},this.audioNode.connect(this.gainNode),this.gainNode.connect(this.ctx.destination)}}i.AudioNodeVAD=st})(realTimeVad),function(i){var e=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(d,g,it,st){st===void 0&&(st=it);var tt=Object.getOwnPropertyDescriptor(g,it);(!tt||("get"in tt?!g.__esModule:tt.writable||tt.configurable))&&(tt={enumerable:!0,get:function(){return g[it]}}),Object.defineProperty(d,st,tt)}:function(d,g,it,st){st===void 0&&(st=it),d[st]=g[it]}),s=commonjsGlobal&&commonjsGlobal.__setModuleDefault||(Object.create?function(d,g){Object.defineProperty(d,"default",{enumerable:!0,value:g})}:function(d,g){d.default=g}),c=commonjsGlobal&&commonjsGlobal.__importStar||function(d){if(d&&d.__esModule)return d;var g={};if(d!=null)for(var it in d)it!=="default"&&Object.prototype.hasOwnProperty.call(d,it)&&e(g,d,it);return s(g,d),g};Object.defineProperty(i,"__esModule",{value:!0}),i.NonRealTimeVAD=i.Message=i.FrameProcessor=i.getDefaultRealTimeVADOptions=i.MicVAD=i.DEFAULT_MODEL=i.AudioNodeVAD=i.utils=i.defaultNonRealTimeVADOptions=void 0;const h=c(ortWeb_minExports),$=assetPath,_=defaultModelFetcher$1,j=frameProcessor;Object.defineProperty(i,"FrameProcessor",{enumerable:!0,get:function(){return j.FrameProcessor}});const nt=messages;Object.defineProperty(i,"Message",{enumerable:!0,get:function(){return nt.Message}});const et=nonRealTimeVad,b=utils;i.defaultNonRealTimeVADOptions={modelURL:$.baseAssetPath+"silero_vad_legacy.onnx",modelFetcher:_.defaultModelFetcher};class a extends et.PlatformAgnosticNonRealTimeVAD{static async new(g={}){const{modelURL:it,modelFetcher:st}={...i.defaultNonRealTimeVADOptions,...g};return await this._new(()=>st(it),h,g)}}i.NonRealTimeVAD=a,i.utils={audioFileToArray:b.audioFileToArray,minFramesForTargetMS:b.minFramesForTargetMS,arrayBufferToBase64:b.arrayBufferToBase64,encodeWAV:b.encodeWAV};var o=realTimeVad;Object.defineProperty(i,"AudioNodeVAD",{enumerable:!0,get:function(){return o.AudioNodeVAD}}),Object.defineProperty(i,"DEFAULT_MODEL",{enumerable:!0,get:function(){return o.DEFAULT_MODEL}}),Object.defineProperty(i,"MicVAD",{enumerable:!0,get:function(){return o.MicVAD}}),Object.defineProperty(i,"getDefaultRealTimeVADOptions",{enumerable:!0,get:function(){return o.getDefaultRealTimeVADOptions}})}(dist);class VadWebClient{constructor(e,s,c,h,$,_){this.micStream=null,this.is_vad_loading=!0,this.noSpeechStartTime=null,this.recording_started=!1,this.lastWarningTime=null,this.warningCooldownPeriod=2e3,this.vad_past=[],this.last_clip_index=0,this.clip_points=[0],this.sil_duration_acc=0,this.pref_length_samples=e*h,this.desp_length_samples=s*h,this.max_length_samples=c*h,this.shor_thsld=SHORT_SILENCE_THRESHOLD*h,this.long_thsld=LONG_SILENCE_THRESHOLD*h,this.frame_size=FRAME_SIZE,this.speech_pad_frames=PRE_SPEECH_PAD_FRAMES,this.micVad={},this.audioFileManager=$,this.audioBufferManager=_}setDependencies(e,s){this.audioFileManager=e,this.audioBufferManager=s}setCallbacks(e,s,c){this.onVadFramesCallback=e,this.onVadFrameProcessedCallback=s,this.onUserSpeechCallback=c}stopMicStream(){var e,s;try{(s=(e=this.micStream)==null?void 0:e.getTracks)==null||s.call(e).forEach(c=>c.stop())}catch{}finally{this.micStream=null}}checkNoSpeech(e){if(!this.recording_started)return;const s=Date.now();e===0?this.noSpeechStartTime===null?this.noSpeechStartTime=s:s-this.noSpeechStartTime>=1e4&&(this.lastWarningTime===null||s-this.lastWarningTime>=this.warningCooldownPeriod)&&(this.onVadFramesCallback&&this.onVadFramesCallback({message:"No audio detected for a while. Please talk or stop the recording if done.",error_code:ErrorCode.AUDIO_QUALITY_POOR,status_code:HttpStatus.BAD_REQUEST}),this.lastWarningTime=s,this.noSpeechStartTime=s):(this.noSpeechStartTime=null,this.lastWarningTime=null,this.onVadFramesCallback&&this.onVadFramesCallback({message:"Audio captured. Recording continues.",status_code:HttpStatus.OK}))}getMicVad(){return this.micVad}isVadLoading(){return this.is_vad_loading}processVadFrame(e){let s=!1;this.vad_past.length>0&&(e===0&&(this.sil_duration_acc+=1),e===1&&(this.sil_duration_acc=0));const c=(this.vad_past.length-this.last_clip_index)*this.frame_size,h=this.sil_duration_acc*this.frame_size;return c>this.pref_length_samples&&h>this.long_thsld&&(this.last_clip_index=this.vad_past.length-Math.min(Math.floor(this.sil_duration_acc/2),5),this.clip_points.push(this.last_clip_index),this.sil_duration_acc=0,s=!0),c>this.desp_length_samples&&h>this.shor_thsld&&(this.last_clip_index=this.vad_past.length-Math.min(Math.floor(this.sil_duration_acc/2),5),this.clip_points.push(this.last_clip_index),this.sil_duration_acc=0,s=!0),c>=this.max_length_samples&&(this.last_clip_index=this.vad_past.length,this.clip_points.push(this.last_clip_index),this.sil_duration_acc=0,s=!0),this.vad_past.push(e),s?[!0,this.clip_points[this.clip_points.length-1]]:[!1,this.clip_points[this.clip_points.length-1]]}async initVad(e){this.is_vad_loading=!0,this.stopMicStream();let s;try{s=await navigator.mediaDevices.getUserMedia({audio:e?{deviceId:{exact:e}}:!0})}catch(c){if((c==null?void 0:c.name)==="OverconstrainedError"||(c==null?void 0:c.name)==="NotFoundError")s=await navigator.mediaDevices.getUserMedia({audio:!0});else throw c}this.micStream=s;try{const c=await dist.MicVAD.new({stream:s,frameSamples:this.frame_size,preSpeechPadFrames:this.speech_pad_frames,onFrameProcessed:(h,$)=>{var b,a,o;if(this.onVadFrameProcessedCallback&&this.onVadFrameProcessedCallback({probabilities:h,frame:$}),!this.recording_started)return;(b=this.audioFileManager)==null||b.incrementTotalRawSamples($),(a=this.audioBufferManager)==null||a.append($);const{isSpeech:_}=h;let j=0;if(_>=.5&&(j=1),this.checkNoSpeech(j),this.processVadFrame(j)[0]){const d=(o=this.audioBufferManager)==null?void 0:o.getAudioData();d&&this.processAudioChunk({audioFrames:d})}},onSpeechStart:()=>{var h;(h=this.onUserSpeechCallback)==null||h.call(this,!0)},onSpeechEnd:()=>{var h;(h=this.onUserSpeechCallback)==null||h.call(this,!1)}});return this.is_vad_loading=!1,this.micVad=c,!this.is_vad_loading}catch(c){throw console.error("Error initializing VAD:",c),this.stopMicStream(),this.is_vad_loading=!1,c}}async reinitializeVad(e){return await this.initVad(e)}async processAudioChunk({audioFrames:e}){if(!e||!this.audioFileManager||!this.audioBufferManager)return;const c=`chunk_${(this.audioFileManager.audioChunks.length||0)+1}.${OUTPUT_FORMAT}`,h=this.audioFileManager.getRawSampleDetails(),$=this.audioBufferManager.calculateChunkTimestamps(h.totalRawSamples);try{const _={fileName:c,timestamp:{st:$.start,et:$.end},status:"pending",audioFrames:e},j=this.audioFileManager.updateAudioInfo(_);this.audioFileManager.incrementInsertedSamples(this.audioBufferManager.getCurrentSampleLength(),this.audioBufferManager.getCurrentFrameLength()),this.audioBufferManager.resetBufferState(),await this.audioFileManager.uploadAudio({audioFrames:e,fileName:c,chunkIndex:j-1})}catch(_){console.error("Error uploading audio chunk:",_)}}startVad(){this.micVad&&typeof this.micVad.start=="function"&&this.micVad.start(),this.recording_started=!0}pauseVad(){this.micVad&&typeof this.micVad.pause=="function"&&this.micVad.pause(),this.recording_started=!1}destroyVad(){this.micVad&&typeof this.micVad.destroy=="function"&&this.micVad.destroy(),this.stopMicStream(),this.recording_started=!1}resetVadWebInstance(){this.micVad&&typeof this.micVad.destroy=="function"&&this.micVad.destroy(),this.stopMicStream(),this.vad_past=[],this.last_clip_index=0,this.clip_points=[0],this.sil_duration_acc=0,this.noSpeechStartTime=null,this.lastWarningTime=null,this.recording_started=!1,this.is_vad_loading=!0}configureVadConstants({pref_length:e,desp_length:s,max_length:c,sr:h,frame_size:$,pre_speech_pad_frames:_,short_thsld:j,long_thsld:nt}){this.pref_length_samples=e*h,this.desp_length_samples=s*h,this.max_length_samples=c*h,this.shor_thsld=j*h,this.long_thsld=nt*h,this.frame_size=$,this.speech_pad_frames=_}}class ChunkedRecorder{constructor(e){this._isPaused=!1,this.eventEmitter=e,this.bufferManager=new AudioBufferManager(SAMPLING_RATE,AUDIO_BUFFER_SIZE_IN_S),this.fileManager=new AudioFileManager,this.vadClient=new VadWebClient(PREF_CHUNK_LENGTH,DESP_CHUNK_LENGTH,MAX_CHUNK_LENGTH,SAMPLING_RATE,this.fileManager,this.bufferManager),this.eventEmitter&&(this.fileManager.setUploadProgressCallback((s,c)=>{}),this.vadClient.setCallbacks(s=>{},s=>{},s=>{}))}initialize(e,s){if(!e.upload_url)throw new Error("Upload URL is required for chunked recording");const c={};console.log(s,"initialize - WIDGET"),s!=null&&s.accessToken&&(c.Authorization=`Bearer ${s.accessToken}`),this.fileManager.setSessionInfo({sessionId:e.session_id,uploadUrl:e.upload_url,uploadHeaders:c}),console.log("ChunkedRecorder initialized with session:",e.session_id)}async start(e){console.log("Starting ChunkedRecorder with deviceId:",e),await this.vadClient.initVad(e);const s=this.vadClient.getMicVad();if((this.vadClient.isVadLoading()||!s||Object.keys(s).length===0)&&await this.vadClient.reinitializeVad(e))throw new Error("VAD instance is not initialized.");this.vadClient.startVad()}pause(){this._isPaused||(this.vadClient.pauseVad(),this._isPaused=!0)}resume(){this._isPaused&&(this.vadClient.startVad(),this._isPaused=!1)}isPaused(){return this._isPaused}async stop(){this._isPaused=!1,this.vadClient.resetVadWebInstance(),await this.fileManager.waitForAllUploads();const e=await this.fileManager.retryFailedUploads(),s=this.fileManager.getTotalAudioChunks().length;return{failedUploads:e,totalFiles:s}}reset(){this._isPaused=!1,this.vadClient.resetVadWebInstance(),this.fileManager.resetFileManagerInstance(),this.bufferManager.resetBufferState()}}class SingleRecorder{constructor(e){this.mediaRecorder=null,this.audioChunks=[],this.uploadUrl="",this.uploadHeaders={},this.stream=null,this._isPaused=!1,this.eventEmitter=e}initialize(e,s){if(!e.upload_url)throw new Error("Upload URL is required for single recording");this.uploadUrl=e.upload_url,s!=null&&s.accessToken&&(this.uploadHeaders.Authorization=`Bearer ${s.accessToken}`)}async start(e){this.audioChunks=[];let s;try{s=await navigator.mediaDevices.getUserMedia({audio:e?{deviceId:{exact:e}}:!0})}catch(c){if((c==null?void 0:c.name)==="OverconstrainedError"||(c==null?void 0:c.name)==="NotFoundError")s=await navigator.mediaDevices.getUserMedia({audio:!0});else throw c}this.stream=s,this.mediaRecorder=new MediaRecorder(s),this.mediaRecorder.ondataavailable=c=>{c.data.size>0&&this.audioChunks.push(c.data)},this.mediaRecorder.start()}pause(){this.mediaRecorder&&this.mediaRecorder.state==="recording"&&(this.mediaRecorder.pause(),this._isPaused=!0)}resume(){this.mediaRecorder&&this.mediaRecorder.state==="paused"&&(this.mediaRecorder.resume(),this._isPaused=!1)}isPaused(){return this._isPaused}async stop(){return this._isPaused=!1,new Promise(e=>{if(!this.mediaRecorder){e({failedUploads:[],totalFiles:0});return}this.mediaRecorder.onstop=async()=>{var $;const s=new Blob(this.audioChunks,{type:"audio/webm"}),c=`recording_${Date.now()}.webm`;(await uploadFileWithFormData(this.uploadUrl,c,s,this.uploadHeaders)).success?e({failedUploads:[],totalFiles:1}):e({failedUploads:[c],totalFiles:1}),($=this.stream)==null||$.getTracks().forEach(_=>_.stop()),this.stream=null,this.mediaRecorder=null},this.mediaRecorder.stop()})}reset(){var e;this._isPaused=!1,this.mediaRecorder&&this.mediaRecorder.state!=="inactive"&&this.mediaRecorder.stop(),(e=this.stream)==null||e.getTracks().forEach(s=>s.stop()),this.stream=null,this.mediaRecorder=null,this.audioChunks=[]}}class EventEmitter{constructor(){this.listeners=new Map}on(e,s){var c;this.listeners.has(e)||this.listeners.set(e,new Set),(c=this.listeners.get(e))==null||c.add(s)}off(e,s){var c;(c=this.listeners.get(e))==null||c.delete(s)}emit(e){var s;(s=this.listeners.get(e.type))==null||s.forEach(c=>{try{c(e)}catch(h){console.error("Error in event listener:",h)}})}}class ScribeClient{static getInstance(e){return ScribeClient.instance||(ScribeClient.instance=new ScribeClient(e)),ScribeClient.instance}static resetInstance(){ScribeClient.instance&&(ScribeClient.instance.reset().catch(()=>{}),ScribeClient.instance=null)}constructor(e){this.discoveryDocument=null,this.currentSession=null,this.isInitialized=!1,this.recorder=null,this.validateConfig(e),this.config={debug:!1,autoDiscovery:!0,...e},this.httpClient=new HttpClient(this.config.apiKey,this.config.accessToken,this.config.debug),this.discoveryAPI=new DiscoveryAPI(this.httpClient),this.sessionAPI=new SessionAPI(this.httpClient,this.config.baseUrl||""),this.eventEmitter=new EventEmitter}async init(){if(this.isInitialized){this.config.debug&&console.log("[ScribeSDK] Already initialized");return}if(!this.config.baseUrl)throw new ValidationError("baseUrl is required for initialization");if(this.config.autoDiscovery)try{this.discoveryDocument=await this.discoveryAPI.getDiscovery(this.config.baseUrl),this.discoveryDocument.endpoints.base_url&&this.sessionAPI.setBaseUrl(this.discoveryDocument.endpoints.base_url),this.emitEvent({type:"discovery:complete",data:this.discoveryDocument}),this.config.debug&&console.log("[ScribeSDK] Discovery complete:",this.discoveryDocument)}catch(e){throw this.emitEvent({type:"error",error:e instanceof Error?e:new Error("Discovery failed")}),e}else this.sessionAPI.setBaseUrl(this.config.baseUrl);this.isInitialized=!0}async startRecording(e){if(this.isInitialized||await this.init(),(await navigator.permissions.query({name:"microphone"})).state!=="granted")throw new ValidationError("Microphone access is required to start recording.");try{const c={templates:e.templates,model:e.model,language_hint:e.languageHint,transcript_language:e.transcriptLanguage,upload_type:e.uploadType||UploadType.CHUNKED,communication_protocol:e.communicationProtocol||"http",additional_data:e.additionalData};return this.currentSession=await this.sessionAPI.createSession(c),this.emitEvent({type:"session:created",data:this.currentSession}),this.config.debug&&console.log("[ScribeSDK] Session created:",this.currentSession),e.uploadType===UploadType.SINGLE?this.recorder=new SingleRecorder(this.eventEmitter):this.recorder=new ChunkedRecorder(this.eventEmitter),this.recorder.initialize(this.currentSession,{accessToken:this.config.accessToken}),await this.recorder.start(e.deviceId),this.currentSession}catch(c){throw this.emitEvent({type:"error",error:c instanceof Error?c:new Error("Failed to start recording")}),c}}pauseRecording(){if(!this.recorder)throw new ValidationError("No active recording to pause");this.recorder.pause(),this.emitEvent({type:"recording:paused"}),this.config.debug&&console.log("[ScribeSDK] Recording paused")}resumeRecording(){if(!this.recorder)throw new ValidationError("No active recording to resume");this.recorder.resume(),this.emitEvent({type:"recording:resumed"}),this.config.debug&&console.log("[ScribeSDK] Recording resumed")}isRecordingPaused(){var e;return((e=this.recorder)==null?void 0:e.isPaused())??!1}async endRecording(){if(!this.currentSession)throw new ValidationError("No active session to end");try{let e=0;if(this.recorder){const{failedUploads:c,totalFiles:h}=await this.recorder.stop();if(c.length>0)throw console.warn("Some audio files failed to upload:",c),new ScribeError(`Failed to upload audio recordings: ${c.join(", ")}`,"upload_failed");e=h||0,this.recorder=null}const s=await this.sessionAPI.endSession(this.currentSession.session_id,e);return this.emitEvent({type:"session:ended",data:s}),this.config.debug&&console.log("[ScribeSDK] Session ended:",s),s}catch(e){throw this.emitEvent({type:"error",error:e instanceof Error?e:new Error("Failed to end recording")}),e}}async reset(){this.recorder&&(await this.recorder.stop().catch(()=>{}),this.recorder=null),this.currentSession=null,this.discoveryAPI.clearCache(),this.discoveryDocument=null,this.isInitialized=!1}emitEvent(e){this.eventEmitter.emit(e)}async getOutputStatus(e){var c;const s=e||((c=this.currentSession)==null?void 0:c.session_id);if(!s)throw new ValidationError("No session ID provided and no active session");try{const h=await this.sessionAPI.getSessionStatus(s);return this.emitEvent({type:"session:status_update",data:h}),this.config.debug&&console.log("[ScribeSDK] Session status:",h),h}catch(h){throw this.emitEvent({type:"error",error:h instanceof Error?h:new Error("Failed to get output status")}),h}}async pollForCompletion(e,s={}){var h;const c=e||((h=this.currentSession)==null?void 0:h.session_id);if(!c)throw new ValidationError("No session ID provided and no active session");return this.sessionAPI.pollSessionStatus(c,{...s,onProgress:$=>{this.emitEvent({type:"session:status_update",data:$}),s.onProgress&&s.onProgress($)}})}getCurrentSession(){return this.currentSession}getDiscoveryDocument(){return this.discoveryDocument}on(e,s){this.eventEmitter.on(e,s)}off(e,s){this.eventEmitter.off(e,s)}clearSession(){this.currentSession=null}validateConfig(e){if(!e.baseUrl)throw new ValidationError("baseUrl is required for initialization")}}ScribeClient.instance=null;function useScribeSession(i){const[e,s]=reactExports.useState("idle"),[c,h]=reactExports.useState(0),[$,_]=reactExports.useState(null),[j,nt]=reactExports.useState(""),et=reactExports.useRef(null),b=reactExports.useRef(null),a=reactExports.useRef(0),o=reactExports.useRef(0),d=reactExports.useCallback((..._t)=>{i.debug&&console.log("[EkaScribe]",..._t)},[i.debug]);reactExports.useEffect(()=>{if(!i.baseUrl){d("Skipping SDK init - no baseUrl provided");return}return(async()=>{try{et.current=ScribeClient.getInstance({accessToken:i.accessToken,baseUrl:i.baseUrl,debug:i.debug}),await et.current.init(),d("SDK initialized")}catch(wt){d("Failed to initialize SDK",wt)}})(),()=>{b.current&&clearInterval(b.current)}},[i.accessToken,i.baseUrl,i.debug,d]);const g=reactExports.useCallback(()=>{b.current=window.setInterval(()=>{const _t=Math.floor((Date.now()-a.current)/1e3);h(_t)},1e3)},[]),it=reactExports.useCallback(()=>{b.current&&(clearInterval(b.current),b.current=null)},[]),st=async()=>{try{return(await navigator.permissions.query({name:"microphone"})).state}catch{return"prompt"}},tt=async()=>{try{return(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach(wt=>wt.stop()),!0}catch(_t){return d("Microphone permission denied",_t),!1}},ot=reactExports.useCallback((_t,wt=!1)=>{nt(_t),s(wt?"polling_error":"error")},[]),rt=reactExports.useCallback(async()=>{if(!et.current)return ot("SDK not initialized. Please try again.",!0),!1;try{s("processing"),d("Polling for completion...");const _t=await et.current.pollForCompletion(void 0,{maxAttempts:60,intervalMs:2e3,onProgress:wt=>{d("Status update:",wt.status)}});return _(_t),d("Final result:",_t),s("results"),i.onResult&&i.onResult(_t),!0}catch(_t){return d("Polling failed",_t),ot("Failed to fetch results. Please retry.",!0),i.onError&&_t instanceof Error&&i.onError(_t),!1}},[i,d,ot]),at=reactExports.useCallback(async()=>{const _t=await st();if(_t==="denied"){ot("Microphone access is blocked. Please enable it in your browser settings.");return}if(_t==="prompt"&&(s("permission"),!await tt())){ot("Microphone access is required to record.");return}if(!et.current){ot("SDK not initialized. Please try again.");return}try{s("recording"),await et.current.startRecording({templates:["eka_emr_template"],languageHint:i.languageHint}),a.current=Date.now(),o.current=0,h(0),g(),d("Recording started")}catch(wt){d("Failed to start recording",wt),ot("Failed to start recording. Please try again.")}},[i.templates,i.languageHint,d,ot,g]),ut=reactExports.useCallback(()=>{et.current&&(et.current.pauseRecording(),s("paused"),o.current=Date.now(),it(),d("Recording paused"))},[d,it]),lt=reactExports.useCallback(()=>{et.current&&(et.current.resumeRecording(),s("recording"),o.current&&(a.current+=Date.now()-o.current,o.current=0),g(),d("Recording resumed"))},[d,g]),ct=reactExports.useCallback(async()=>{if(et.current)try{it(),s("processing"),d("Stopping recording...");const _t=await et.current.endRecording();d("Recording ended",_t),await rt()}catch(_t){d("Failed to stop recording",_t),ot("Failed to process recording. Please try again."),i.onError&&_t instanceof Error&&i.onError(_t)}},[i,d,ot,it,rt]),ft=reactExports.useCallback(async()=>{d("Retrying polling..."),await rt()},[d,rt]),dt=reactExports.useCallback(()=>{_(null),nt(""),h(0),s("idle")},[]);return{state:e,elapsedTime:c,result:$,errorMessage:j,startRecording:at,pauseRecording:ut,resumeRecording:lt,stopRecording:ct,retryPolling:ft,reset:dt}}function App({config:i,onClose:e}){const[s,c]=reactExports.useState(!1),[h,$]=reactExports.useState(i.baseUrl?{accessToken:i.accessToken,baseUrl:i.baseUrl}:null),_=reactExports.useMemo(()=>h?{...i,accessToken:h.accessToken,baseUrl:h.baseUrl}:i,[i,h]),j=!h,{state:nt,elapsedTime:et,result:b,errorMessage:a,startRecording:o,pauseRecording:d,resumeRecording:g,stopRecording:it,retryPolling:st,reset:tt}=useScribeSession(_),ot=reactExports.useCallback(()=>{tt(),$(null)},[tt]),rt=reactExports.useCallback(lt=>{console.log("Selected EMR:",lt)},[]);if(s)return null;const at=(lt,ct)=>{$({accessToken:lt,baseUrl:ct})},ut=()=>{if(j)return jsxRuntimeExports.jsx(ConfigState,{onSubmit:at,initialAccessToken:i.accessToken||"",initialBaseUrl:i.baseUrl||""});switch(nt){case"idle":return jsxRuntimeExports.jsx(IdleState,{onStartRecording:o});case"permission":return jsxRuntimeExports.jsx(PermissionState,{onRequestPermission:o});case"recording":case"paused":return jsxRuntimeExports.jsx(RecordingState,{elapsedTime:et,isPaused:nt==="paused",onPause:d,onResume:g,onStop:it});case"processing":return jsxRuntimeExports.jsx(ProcessingState,{});case"results":return b?jsxRuntimeExports.jsx(ResultsState,{result:b,onNewRecording:ot,onSelectEMR:rt}):null;case"polling_error":return jsxRuntimeExports.jsx(PollingErrorState,{message:a,onRetry:st,onStartNew:ot});case"error":return jsxRuntimeExports.jsx(ErrorState,{message:a,onRetry:ot});default:return jsxRuntimeExports.jsx(IdleState,{onStartRecording:o})}};return jsxRuntimeExports.jsx(FloatingPanel,{position:_.position,onClose:e,onMinimize:()=>c(!0),children:ut()})}const widgetStyles=":host{all:initial;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,sans-serif}*{box-sizing:border-box;margin:0;padding:0}.scribe-panel{position:fixed;bottom:20px;right:20px;background:#fff;border-radius:16px;box-shadow:0 4px 24px #0000001f,0 0 0 1px #0000000d;z-index:2147483647;overflow:hidden;width:380px;max-width:calc(100vw - 40px)}.panel-header{display:flex;align-items:center;justify-content:space-between;padding:8px 12px;background:#fafafa;border-bottom:1px solid #eee;cursor:grab}.panel-header:active{cursor:grabbing}.drag-handle{display:flex;gap:2px;flex-wrap:wrap;width:16px;opacity:.4}.drag-handle span{width:4px;height:4px;background:#666;border-radius:50%}.header-actions{display:flex;gap:8px}.header-btn{background:none;border:none;cursor:pointer;padding:4px;color:#666;display:flex;align-items:center;justify-content:center;width:24px;height:24px}.header-btn:hover{color:#333}.header-btn svg{width:16px;height:16px}.panel-content{padding:20px 24px}.idle-state{display:flex;align-items:center;gap:24px}.logo{display:flex;align-items:center;gap:8px}.logo-icon{width:32px;height:32px}.logo-icon svg{width:100%;height:100%}.logo-text{font-size:20px;font-weight:600;color:#2563eb}.start-btn{display:flex;align-items:center;gap:8px;background:#2563eb;color:#fff;border:none;padding:12px 24px;border-radius:24px;font-size:16px;font-weight:500;cursor:pointer;transition:background .2s}.start-btn:hover{background:#1d4ed8}.start-btn:disabled{background:#93c5fd;cursor:not-allowed}.mic-icon{width:20px;height:20px}.mic-icon svg{width:100%;height:100%}.recording-state{display:flex;align-items:center;gap:16px}.recording-indicator{display:flex;align-items:center;gap:12px;color:#666}.recording-icon{width:24px;height:24px;color:#666}.recording-icon svg{width:100%;height:100%}.recording-icon.active{color:#ef4444;animation:pulse 1.5s infinite}@keyframes pulse{0%,to{opacity:1}50%{opacity:.5}}.timer{font-size:20px;font-weight:500;font-variant-numeric:tabular-nums;color:#374151}.recording-actions{display:flex;gap:8px;margin-left:auto}.resume-btn{background:#fff;color:#2563eb;border:2px solid #2563eb;padding:10px 20px;border-radius:8px;font-size:14px;font-weight:500;cursor:pointer;transition:all .2s}.resume-btn:hover{background:#eff6ff}.pause-btn{background:#fff;color:#f59e0b;border:2px solid #f59e0b;padding:10px 20px;border-radius:8px;font-size:14px;font-weight:500;cursor:pointer;transition:all .2s}.pause-btn:hover{background:#fffbeb}.stop-btn{background:#ef4444;color:#fff;border:none;padding:10px 16px;border-radius:8px;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .2s}.stop-btn:hover{background:#dc2626}.stop-icon{width:16px;height:16px;background:#fff;border-radius:2px}.processing-state{display:flex;flex-direction:column;align-items:center;gap:16px;padding:20px}.spinner{width:40px;height:40px;border:3px solid #e5e7eb;border-top-color:#2563eb;border-radius:50%;animation:spin 1s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.processing-text{color:#6b7280;font-size:14px}.results-state{display:flex;flex-direction:column;gap:16px;max-height:400px}.results-header{display:flex;align-items:center;justify-content:space-between}.results-title{font-size:16px;font-weight:600;color:#111827}.new-recording-btn{background:#2563eb;color:#fff;border:none;padding:8px 16px;border-radius:6px;font-size:13px;cursor:pointer;transition:background .2s}.new-recording-btn:hover{background:#1d4ed8}.results-content{overflow-y:auto;max-height:300px}.transcript-section{margin-bottom:16px}.section-title{font-size:13px;font-weight:600;color:#6b7280;text-transform:uppercase;letter-spacing:.05em;margin-bottom:8px}.transcript-text{font-size:14px;line-height:1.6;color:#374151;background:#f9fafb;padding:12px;border-radius:8px;white-space:pre-wrap}.error-state{display:flex;flex-direction:column;align-items:center;gap:12px;padding:20px;text-align:center}.error-icon{width:48px;height:48px;color:#ef4444}.error-icon svg{width:100%;height:100%}.error-message{color:#ef4444;font-size:14px}.retry-btn{background:#ef4444;color:#fff;border:none;padding:10px 20px;border-radius:8px;font-size:14px;cursor:pointer;transition:background .2s}.retry-btn:hover{background:#dc2626}.permission-state{display:flex;flex-direction:column;align-items:center;gap:16px;padding:20px;text-align:center}.permission-icon{width:48px;height:48px;color:#2563eb}.permission-icon svg{width:100%;height:100%}.permission-text{color:#374151;font-size:14px;line-height:1.5}.permission-btn{background:#2563eb;color:#fff;border:none;padding:12px 24px;border-radius:8px;font-size:14px;font-weight:500;cursor:pointer;transition:background .2s}.permission-btn:hover{background:#1d4ed8}.config-state{display:flex;flex-direction:column;gap:20px}.config-state .logo{justify-content:center}.config-form{display:flex;flex-direction:column;gap:12px}.config-form .form-group{display:flex;flex-direction:column;gap:4px}.config-form label{font-size:13px;font-weight:500;color:#374151}.config-form input{padding:10px 12px;border:1px solid #d1d5db;border-radius:8px;font-size:14px;color:#111827;background:#fff;transition:border-color .2s,box-shadow .2s}.config-form input:focus{outline:none;border-color:#2563eb;box-shadow:0 0 0 3px #2563eb1a}.config-form input::placeholder{color:#9ca3af}.config-error{color:#ef4444;font-size:13px;margin:0}.config-submit-btn{background:#2563eb;color:#fff;border:none;padding:12px 24px;border-radius:8px;font-size:14px;font-weight:500;cursor:pointer;transition:background .2s;margin-top:4px}.config-submit-btn:hover{background:#1d4ed8}.polling-error-state{display:flex;flex-direction:column;align-items:center;gap:12px;padding:20px;text-align:center}.polling-error-actions{display:flex;flex-direction:column;gap:8px;width:100%;margin-top:8px}.retry-polling-btn{background:#2563eb;color:#fff;border:none;padding:12px 20px;border-radius:8px;font-size:14px;font-weight:500;cursor:pointer;transition:background .2s;width:100%}.retry-polling-btn:hover{background:#1d4ed8}.start-new-btn{background:transparent;color:#6b7280;border:1px solid #d1d5db;padding:10px 20px;border-radius:8px;font-size:13px;cursor:pointer;transition:all .2s;width:100%}.start-new-btn:hover{background:#f3f4f6;color:#374151}.emr-section{margin-top:16px;padding-top:16px;border-top:1px solid #e5e7eb}.emr-list-inline{display:flex;flex-direction:column;gap:8px}.emr-list-state{display:flex;flex-direction:column;gap:16px}.emr-list-header{display:flex;align-items:center;gap:12px}.back-btn{background:none;border:none;cursor:pointer;padding:4px;color:#6b7280;display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:6px;transition:all .2s}.back-btn:hover{background:#f3f4f6;color:#374151}.back-btn svg{width:20px;height:20px}.emr-list-title{font-size:16px;font-weight:600;color:#111827}.emr-list-content{display:flex;flex-direction:column;gap:8px;max-height:240px;overflow-y:auto}.emr-item{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;background:#f9fafb;border:1px solid #e5e7eb;border-radius:8px;cursor:pointer;transition:all .2s;text-align:left}.emr-item:hover{background:#f3f4f6;border-color:#d1d5db}.emr-item-info{display:flex;flex-direction:column;gap:2px}.emr-item-name{font-size:14px;font-weight:500;color:#111827}.emr-item-desc{font-size:12px;color:#6b7280}.emr-item-arrow{width:20px;height:20px;color:#9ca3af;flex-shrink:0}.emr-list-footer{padding-top:12px;border-top:1px solid #e5e7eb}.start-new-recording-btn{width:100%;background:#2563eb;color:#fff;border:none;padding:12px 20px;border-radius:8px;font-size:14px;font-weight:500;cursor:pointer;transition:background .2s}.start-new-recording-btn:hover{background:#1d4ed8}";class ScribeWidget{constructor(e){Qr(this,"container");Qr(this,"shadowRoot");Qr(this,"root",null);Qr(this,"config");Qr(this,"visible",!0);this.config={templates:["soap"],languageHint:["en"],position:{bottom:20,right:20},...e},this.container=document.createElement("div"),this.container.id="eka-scribe-widget",this.shadowRoot=this.container.attachShadow({mode:"closed"});const s=document.createElement("style");s.textContent=widgetStyles,this.shadowRoot.appendChild(s);const c=document.createElement("div");c.id="eka-scribe-root",this.shadowRoot.appendChild(c),this.root=createRoot(c)}render(){!this.root||!this.visible||this.root.render(jsxRuntimeExports.jsx(App,{config:this.config,onClose:()=>this.hide()}))}mount(e){const s=typeof e=="string"?document.querySelector(e):e||document.body;s&&(s.appendChild(this.container),this.render())}unmount(){this.root&&(this.root.unmount(),this.root=null),this.container.remove()}show(){this.visible=!0,this.container.style.display="block",this.render()}hide(){this.visible=!1,this.container.style.display="none"}isVisible(){return this.visible}}let widgetInstance=null;function init(i={}){return widgetInstance&&widgetInstance.unmount(),console.log(i,"config - WIDGET"),widgetInstance=new ScribeWidget(i),widgetInstance.mount(),widgetInstance}function getInstance(){return widgetInstance}const EkaScribe={init,getInstance,Widget:ScribeWidget};if(typeof window<"u"&&typeof document<"u"){const i=()=>{const e=document.currentScript||document.querySelector('script[src*="scribe-widget"]');e!=null&&e.hasAttribute("data-no-auto-init")||(console.log(widgetInstance,"widget instance"),widgetInstance||init({baseUrl:""}))};document.readyState==="loading"?document.addEventListener("DOMContentLoaded - WIDGET",i):(console.log("load document - WIDGET"),i())}exports.ScribeWidget=ScribeWidget,exports.default=EkaScribe,exports.getInstance=getInstance,exports.init=init,Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});