diff --git "a/frontend/assets/main-nu7uwxNJ.js" "b/frontend/assets/main-nu7uwxNJ.js" new file mode 100644--- /dev/null +++ "b/frontend/assets/main-nu7uwxNJ.js" @@ -0,0 +1,2430 @@ +var Ts=Object.defineProperty;var Ps=(i,o,s)=>o in i?Ts(i,o,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[o]=s;var xt=(i,o,s)=>Ps(i,typeof o!="symbol"?o+"":o,s);function _mergeNamespaces(i,o){for(var s=0;sa[_]})}}}return Object.freeze(Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}))}(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const _ of document.querySelectorAll('link[rel="modulepreload"]'))a(_);new MutationObserver(_=>{for(const $ of _)if($.type==="childList")for(const _e of $.addedNodes)_e.tagName==="LINK"&&_e.rel==="modulepreload"&&a(_e)}).observe(document,{childList:!0,subtree:!0});function s(_){const $={};return _.integrity&&($.integrity=_.integrity),_.referrerPolicy&&($.referrerPolicy=_.referrerPolicy),_.crossOrigin==="use-credentials"?$.credentials="include":_.crossOrigin==="anonymous"?$.credentials="omit":$.credentials="same-origin",$}function a(_){if(_.ep)return;_.ep=!0;const $=s(_);fetch(_.href,$)}})();var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}function getAugmentedNamespace(i){if(i.__esModule)return i;var o=i.default;if(typeof o=="function"){var s=function a(){return this instanceof a?Reflect.construct(o,arguments,this.constructor):o.apply(this,arguments)};s.prototype=o.prototype}else s={};return Object.defineProperty(s,"__esModule",{value:!0}),Object.keys(i).forEach(function(a){var _=Object.getOwnPropertyDescriptor(i,a);Object.defineProperty(s,a,_.get?_:{enumerable:!0,get:function(){return i[a]}})}),s}var jsxRuntime={exports:{}},reactJsxRuntime_production_min={},react={exports:{}},react_production_min={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var l$2=Symbol.for("react.element"),n$2=Symbol.for("react.portal"),p$3=Symbol.for("react.fragment"),q$2=Symbol.for("react.strict_mode"),r$1=Symbol.for("react.profiler"),t$1=Symbol.for("react.provider"),u=Symbol.for("react.context"),v$2=Symbol.for("react.forward_ref"),w$2=Symbol.for("react.suspense"),x$1=Symbol.for("react.memo"),y$1=Symbol.for("react.lazy"),z$2=Symbol.iterator;function A$2(i){return i===null||typeof i!="object"?null:(i=z$2&&i[z$2]||i["@@iterator"],typeof i=="function"?i:null)}var B$1={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C$1=Object.assign,D$1={};function E$1(i,o,s){this.props=i,this.context=o,this.refs=D$1,this.updater=s||B$1}E$1.prototype.isReactComponent={};E$1.prototype.setState=function(i,o){if(typeof i!="object"&&typeof i!="function"&&i!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,i,o,"setState")};E$1.prototype.forceUpdate=function(i){this.updater.enqueueForceUpdate(this,i,"forceUpdate")};function F(){}F.prototype=E$1.prototype;function G$1(i,o,s){this.props=i,this.context=o,this.refs=D$1,this.updater=s||B$1}var H$1=G$1.prototype=new F;H$1.constructor=G$1;C$1(H$1,E$1.prototype);H$1.isPureReactComponent=!0;var I$1=Array.isArray,J=Object.prototype.hasOwnProperty,K$1={current:null},L$1={key:!0,ref:!0,__self:!0,__source:!0};function M$1(i,o,s){var a,_={},$=null,_e=null;if(o!=null)for(a in o.ref!==void 0&&(_e=o.ref),o.key!==void 0&&($=""+o.key),o)J.call(o,a)&&!L$1.hasOwnProperty(a)&&(_[a]=o[a]);var tt=arguments.length-2;if(tt===1)_.children=s;else if(1>>1,Kt=At[Yt];if(0<_(Kt,Mt))At[Yt]=Mt,At[jt]=Kt,jt=Yt;else break e}}function s(At){return At.length===0?null:At[0]}function a(At){if(At.length===0)return null;var Mt=At[0],jt=At.pop();if(jt!==Mt){At[0]=jt;e:for(var Yt=0,Kt=At.length,sr=Kt>>>1;Yt_(Gt,jt))Qt_(tr,Gt)?(At[Yt]=tr,At[Qt]=jt,Yt=Qt):(At[Yt]=Gt,At[ar]=jt,Yt=ar);else if(Qt_(tr,jt))At[Yt]=tr,At[Qt]=jt,Yt=Qt;else break e}}return Mt}function _(At,Mt){var jt=At.sortIndex-Mt.sortIndex;return jt!==0?jt:At.id-Mt.id}if(typeof performance=="object"&&typeof performance.now=="function"){var $=performance;i.unstable_now=function(){return $.now()}}else{var _e=Date,tt=_e.now();i.unstable_now=function(){return _e.now()-tt}}var st=[],it=[],nt=1,et=null,j=3,rt=!1,ot=!1,at=!1,lt=typeof setTimeout=="function"?setTimeout:null,ut=typeof clearTimeout=="function"?clearTimeout:null,ct=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function dt(At){for(var Mt=s(it);Mt!==null;){if(Mt.callback===null)a(it);else if(Mt.startTime<=At)a(it),Mt.sortIndex=Mt.expirationTime,o(st,Mt);else break;Mt=s(it)}}function ft(At){if(at=!1,dt(At),!ot)if(s(st)!==null)ot=!0,St(ht);else{var Mt=s(it);Mt!==null&&Rt(ft,Mt.startTime-At)}}function ht(At,Mt){ot=!1,at&&(at=!1,ut(mt),mt=-1),rt=!0;var jt=j;try{for(dt(Mt),et=s(st);et!==null&&(!(et.expirationTime>Mt)||At&&!wt());){var Yt=et.callback;if(typeof Yt=="function"){et.callback=null,j=et.priorityLevel;var Kt=Yt(et.expirationTime<=Mt);Mt=i.unstable_now(),typeof Kt=="function"?et.callback=Kt:et===s(st)&&a(st),dt(Mt)}else a(st);et=s(st)}if(et!==null)var sr=!0;else{var ar=s(it);ar!==null&&Rt(ft,ar.startTime-Mt),sr=!1}return sr}finally{et=null,j=jt,rt=!1}}var bt=!1,yt=null,mt=-1,gt=5,vt=-1;function wt(){return!(i.unstable_now()-vtAt||125Yt?(At.sortIndex=jt,o(it,At),s(st)===null&&At===s(it)&&(at?(ut(mt),mt=-1):at=!0,Rt(ft,jt-Yt))):(At.sortIndex=Kt,o(st,At),ot||rt||(ot=!0,St(ht))),At},i.unstable_shouldYield=wt,i.unstable_wrapCallback=function(At){var Mt=j;return function(){var jt=j;j=Mt;try{return At.apply(this,arguments)}finally{j=jt}}}})(scheduler_production_min);scheduler.exports=scheduler_production_min;var schedulerExports=scheduler.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var aa=reactExports,ca=schedulerExports;function p$1(i){for(var o="https://reactjs.org/docs/error-decoder.html?invariant="+i,s=1;s"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ja=Object.prototype.hasOwnProperty,ka=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,la={},ma={};function oa(i){return ja.call(ma,i)?!0:ja.call(la,i)?!1:ka.test(i)?ma[i]=!0:(la[i]=!0,!1)}function pa(i,o,s,a){if(s!==null&&s.type===0)return!1;switch(typeof o){case"function":case"symbol":return!0;case"boolean":return a?!1:s!==null?!s.acceptsBooleans:(i=i.toLowerCase().slice(0,5),i!=="data-"&&i!=="aria-");default:return!1}}function qa(i,o,s,a){if(o===null||typeof o>"u"||pa(i,o,s,a))return!0;if(a)return!1;if(s!==null)switch(s.type){case 3:return!o;case 4:return o===!1;case 5:return isNaN(o);case 6:return isNaN(o)||1>o}return!1}function v$1(i,o,s,a,_,$,_e){this.acceptsBooleans=o===2||o===3||o===4,this.attributeName=a,this.attributeNamespace=_,this.mustUseProperty=s,this.propertyName=i,this.type=o,this.sanitizeURL=$,this.removeEmptyString=_e}var z$1={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(i){z$1[i]=new v$1(i,0,!1,i,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(i){var o=i[0];z$1[o]=new v$1(o,1,!1,i[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(i){z$1[i]=new v$1(i,2,!1,i.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(i){z$1[i]=new v$1(i,2,!1,i,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(i){z$1[i]=new v$1(i,3,!1,i.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(i){z$1[i]=new v$1(i,3,!0,i,null,!1,!1)});["capture","download"].forEach(function(i){z$1[i]=new v$1(i,4,!1,i,null,!1,!1)});["cols","rows","size","span"].forEach(function(i){z$1[i]=new v$1(i,6,!1,i,null,!1,!1)});["rowSpan","start"].forEach(function(i){z$1[i]=new v$1(i,5,!1,i.toLowerCase(),null,!1,!1)});var ra=/[\-:]([a-z])/g;function sa(i){return i[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(i){var o=i.replace(ra,sa);z$1[o]=new v$1(o,1,!1,i,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(i){var o=i.replace(ra,sa);z$1[o]=new v$1(o,1,!1,i,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(i){var o=i.replace(ra,sa);z$1[o]=new v$1(o,1,!1,i,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(i){z$1[i]=new v$1(i,1,!1,i.toLowerCase(),null,!1,!1)});z$1.xlinkHref=new v$1("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(i){z$1[i]=new v$1(i,1,!1,i.toLowerCase(),null,!0,!0)});function ta(i,o,s,a){var _=z$1.hasOwnProperty(o)?z$1[o]:null;(_!==null?_.type!==0:a||!(2tt||_[_e]!==$[tt]){var st=` +`+_[_e].replace(" at new "," at ");return i.displayName&&st.includes("")&&(st=st.replace("",i.displayName)),st}while(1<=_e&&0<=tt);break}}}finally{Na=!1,Error.prepareStackTrace=s}return(i=i?i.displayName||i.name:"")?Ma(i):""}function Pa(i){switch(i.tag){case 5:return Ma(i.type);case 16:return Ma("Lazy");case 13:return Ma("Suspense");case 19:return Ma("SuspenseList");case 0:case 2:case 15:return i=Oa(i.type,!1),i;case 11:return i=Oa(i.type.render,!1),i;case 1:return i=Oa(i.type,!0),i;default:return""}}function Qa(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:return"Fragment";case wa:return"Portal";case Aa:return"Profiler";case za:return"StrictMode";case Ea:return"Suspense";case Fa:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case Ca:return(i.displayName||"Context")+".Consumer";case Ba:return(i._context.displayName||"Context")+".Provider";case Da:var o=i.render;return i=i.displayName,i||(i=o.displayName||o.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case Ga:return o=i.displayName||null,o!==null?o:Qa(i.type)||"Memo";case Ha:o=i._payload,i=i._init;try{return Qa(i(o))}catch{}}return null}function Ra(i){var o=i.type;switch(i.tag){case 24:return"Cache";case 9:return(o.displayName||"Context")+".Consumer";case 10:return(o._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return i=o.render,i=i.displayName||i.name||"",o.displayName||(i!==""?"ForwardRef("+i+")":"ForwardRef");case 7:return"Fragment";case 5:return o;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Qa(o);case 8:return o===za?"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 o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o}return null}function Sa(i){switch(typeof i){case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function Ta(i){var o=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function Ua(i){var o=Ta(i)?"checked":"value",s=Object.getOwnPropertyDescriptor(i.constructor.prototype,o),a=""+i[o];if(!i.hasOwnProperty(o)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var _=s.get,$=s.set;return Object.defineProperty(i,o,{configurable:!0,get:function(){return _.call(this)},set:function(_e){a=""+_e,$.call(this,_e)}}),Object.defineProperty(i,o,{enumerable:s.enumerable}),{getValue:function(){return a},setValue:function(_e){a=""+_e},stopTracking:function(){i._valueTracker=null,delete i[o]}}}}function Va(i){i._valueTracker||(i._valueTracker=Ua(i))}function Wa(i){if(!i)return!1;var o=i._valueTracker;if(!o)return!0;var s=o.getValue(),a="";return i&&(a=Ta(i)?i.checked?"true":"false":i.value),i=a,i!==s?(o.setValue(i),!0):!1}function Xa(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(i,o){var s=o.checked;return A$1({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:s??i._wrapperState.initialChecked})}function Za(i,o){var s=o.defaultValue==null?"":o.defaultValue,a=o.checked!=null?o.checked:o.defaultChecked;s=Sa(o.value!=null?o.value:s),i._wrapperState={initialChecked:a,initialValue:s,controlled:o.type==="checkbox"||o.type==="radio"?o.checked!=null:o.value!=null}}function ab(i,o){o=o.checked,o!=null&&ta(i,"checked",o,!1)}function bb(i,o){ab(i,o);var s=Sa(o.value),a=o.type;if(s!=null)a==="number"?(s===0&&i.value===""||i.value!=s)&&(i.value=""+s):i.value!==""+s&&(i.value=""+s);else if(a==="submit"||a==="reset"){i.removeAttribute("value");return}o.hasOwnProperty("value")?cb(i,o.type,s):o.hasOwnProperty("defaultValue")&&cb(i,o.type,Sa(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(i.defaultChecked=!!o.defaultChecked)}function db(i,o,s){if(o.hasOwnProperty("value")||o.hasOwnProperty("defaultValue")){var a=o.type;if(!(a!=="submit"&&a!=="reset"||o.value!==void 0&&o.value!==null))return;o=""+i._wrapperState.initialValue,s||o===i.value||(i.value=o),i.defaultValue=o}s=i.name,s!==""&&(i.name=""),i.defaultChecked=!!i._wrapperState.initialChecked,s!==""&&(i.name=s)}function cb(i,o,s){(o!=="number"||Xa(i.ownerDocument)!==i)&&(s==null?i.defaultValue=""+i._wrapperState.initialValue:i.defaultValue!==""+s&&(i.defaultValue=""+s))}var eb=Array.isArray;function fb(i,o,s,a){if(i=i.options,o){o={};for(var _=0;_"+o.valueOf().toString()+"",o=mb.firstChild;i.firstChild;)i.removeChild(i.firstChild);for(;o.firstChild;)i.appendChild(o.firstChild)}});function ob(i,o){if(o){var s=i.firstChild;if(s&&s===i.lastChild&&s.nodeType===3){s.nodeValue=o;return}}i.textContent=o}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(o){o=o+i.charAt(0).toUpperCase()+i.substring(1),pb[o]=pb[i]})});function rb(i,o,s){return o==null||typeof o=="boolean"||o===""?"":s||typeof o!="number"||o===0||pb.hasOwnProperty(i)&&pb[i]?(""+o).trim():o+"px"}function sb(i,o){i=i.style;for(var s in o)if(o.hasOwnProperty(s)){var a=s.indexOf("--")===0,_=rb(s,o[s],a);s==="float"&&(s="cssFloat"),a?i.setProperty(s,_):i[s]=_}}var tb=A$1({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,o){if(o){if(tb[i]&&(o.children!=null||o.dangerouslySetInnerHTML!=null))throw Error(p$1(137,i));if(o.dangerouslySetInnerHTML!=null){if(o.children!=null)throw Error(p$1(60));if(typeof o.dangerouslySetInnerHTML!="object"||!("__html"in o.dangerouslySetInnerHTML))throw Error(p$1(61))}if(o.style!=null&&typeof o.style!="object")throw Error(p$1(62))}}function vb(i,o){if(i.indexOf("-")===-1)return typeof o.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$1(280));var o=i.stateNode;o&&(o=Db(o),yb(i.stateNode,i.type,o))}}function Eb(i){zb?Ab?Ab.push(i):Ab=[i]:zb=i}function Fb(){if(zb){var i=zb,o=Ab;if(Ab=zb=null,Bb(i),o)for(i=0;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,o){var s=i.pendingLanes;if(s===0)return 0;var a=0,_=i.suspendedLanes,$=i.pingedLanes,_e=s&268435455;if(_e!==0){var tt=_e&~_;tt!==0?a=tc(tt):($&=_e,$!==0&&(a=tc($)))}else _e=s&~_,_e!==0?a=tc(_e):$!==0&&(a=tc($));if(a===0)return 0;if(o!==0&&o!==a&&!(o&_)&&(_=a&-a,$=o&-o,_>=$||_===16&&($&4194240)!==0))return o;if(a&4&&(a|=s&16),o=i.entangledLanes,o!==0)for(i=i.entanglements,o&=a;0s;s++)o.push(i);return o}function Ac(i,o,s){i.pendingLanes|=o,o!==536870912&&(i.suspendedLanes=0,i.pingedLanes=0),i=i.eventTimes,o=31-oc(o),i[o]=s}function Bc(i,o){var s=i.pendingLanes&~o;i.pendingLanes=o,i.suspendedLanes=0,i.pingedLanes=0,i.expiredLanes&=o,i.mutableReadLanes&=o,i.entangledLanes&=o,o=i.entanglements;var a=i.eventTimes;for(i=i.expirationTimes;0=be),ee=" ",fe=!1;function ge(i,o){switch(i){case"keyup":return $d.indexOf(o.keyCode)!==-1;case"keydown":return o.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;function je(i,o){switch(i){case"compositionend":return he(o);case"keypress":return o.which!==32?null:(fe=!0,ee);case"textInput":return i=o.data,i===ee&&fe?null:i;default:return null}}function ke(i,o){if(ie)return i==="compositionend"||!ae&&ge(i,o)?(i=nd(),md=ld=kd=null,ie=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1=o)return{node:s,offset:o-i};i=a}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=Je(s)}}function Le(i,o){return i&&o?i===o?!0:i&&i.nodeType===3?!1:o&&o.nodeType===3?Le(i,o.parentNode):"contains"in i?i.contains(o):i.compareDocumentPosition?!!(i.compareDocumentPosition(o)&16):!1:!1}function Me(){for(var i=window,o=Xa();o instanceof i.HTMLIFrameElement;){try{var s=typeof o.contentWindow.location.href=="string"}catch{s=!1}if(s)i=o.contentWindow;else break;o=Xa(i.document)}return o}function Ne(i){var o=i&&i.nodeName&&i.nodeName.toLowerCase();return o&&(o==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||o==="textarea"||i.contentEditable==="true")}function Oe(i){var o=Me(),s=i.focusedElem,a=i.selectionRange;if(o!==s&&s&&s.ownerDocument&&Le(s.ownerDocument.documentElement,s)){if(a!==null&&Ne(s)){if(o=a.start,i=a.end,i===void 0&&(i=o),"selectionStart"in s)s.selectionStart=o,s.selectionEnd=Math.min(i,s.value.length);else if(i=(o=s.ownerDocument||document)&&o.defaultView||window,i.getSelection){i=i.getSelection();var _=s.textContent.length,$=Math.min(a.start,_);a=a.end===void 0?$:Math.min(a.end,_),!i.extend&&$>a&&(_=a,a=$,$=_),_=Ke(s,$);var _e=Ke(s,a);_&&_e&&(i.rangeCount!==1||i.anchorNode!==_.node||i.anchorOffset!==_.offset||i.focusNode!==_e.node||i.focusOffset!==_e.offset)&&(o=o.createRange(),o.setStart(_.node,_.offset),i.removeAllRanges(),$>a?(i.addRange(o),i.extend(_e.node,_e.offset)):(o.setEnd(_e.node,_e.offset),i.addRange(o)))}}for(o=[],i=s;i=i.parentNode;)i.nodeType===1&&o.push({element:i,left:i.scrollLeft,top:i.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;s=document.documentMode,Qe=null,Re=null,Se=null,Te=!1;function Ue(i,o,s){var a=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;Te||Qe==null||Qe!==Xa(a)||(a=Qe,"selectionStart"in a&&Ne(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),Se&&Ie(Se,a)||(Se=a,a=oe(Re,"onSelect"),0Tf||(i.current=Sf[Tf],Sf[Tf]=null,Tf--)}function G(i,o){Tf++,Sf[Tf]=i.current,i.current=o}var Vf={},H=Uf(Vf),Wf=Uf(!1),Xf=Vf;function Yf(i,o){var s=i.type.contextTypes;if(!s)return Vf;var a=i.stateNode;if(a&&a.__reactInternalMemoizedUnmaskedChildContext===o)return a.__reactInternalMemoizedMaskedChildContext;var _={},$;for($ in s)_[$]=o[$];return a&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=o,i.__reactInternalMemoizedMaskedChildContext=_),_}function Zf(i){return i=i.childContextTypes,i!=null}function $f(){E(Wf),E(H)}function ag(i,o,s){if(H.current!==Vf)throw Error(p$1(168));G(H,o),G(Wf,s)}function bg(i,o,s){var a=i.stateNode;if(o=o.childContextTypes,typeof a.getChildContext!="function")return s;a=a.getChildContext();for(var _ in a)if(!(_ in o))throw Error(p$1(108,Ra(i)||"Unknown",_));return A$1({},s,a)}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,o,s){var a=i.stateNode;if(!a)throw Error(p$1(169));s?(i=bg(i,o,Xf),a.__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,o=C;try{var s=eg;for(C=1;i>=_e,_-=_e,rg=1<<32-oc(o)+_|s<<_|a,sg=$+i}else rg=1<<$|s<<_|a,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,o){var s=Bg(5,null,null,0);s.elementType="DELETED",s.stateNode=o,s.return=i,o=i.deletions,o===null?(i.deletions=[s],i.flags|=16):o.push(s)}function Cg(i,o){switch(i.tag){case 5:var s=i.type;return o=o.nodeType!==1||s.toLowerCase()!==o.nodeName.toLowerCase()?null:o,o!==null?(i.stateNode=o,xg=i,yg=Lf(o.firstChild),!0):!1;case 6:return o=i.pendingProps===""||o.nodeType!==3?null:o,o!==null?(i.stateNode=o,xg=i,yg=null,!0):!1;case 13:return o=o.nodeType!==8?null:o,o!==null?(s=qg!==null?{id:rg,overflow:sg}:null,i.memoizedState={dehydrated:o,treeContext:s,retryLane:1073741824},s=Bg(18,null,null,0),s.stateNode=o,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 o=yg;if(o){var s=o;if(!Cg(i,o)){if(Dg(i))throw Error(p$1(418));o=Lf(s.nextSibling);var a=xg;o&&Cg(i,o)?Ag(a,s):(i.flags=i.flags&-4097|2,I=!1,xg=i)}}else{if(Dg(i))throw Error(p$1(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 o;if((o=i.tag!==3)&&!(o=i.tag!==5)&&(o=i.type,o=o!=="head"&&o!=="body"&&!Ef(i.type,i.memoizedProps)),o&&(o=yg)){if(Dg(i))throw Hg(),Error(p$1(418));for(;o;)Ag(i,o),o=Lf(o.nextSibling)}if(Fg(i),i.tag===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(p$1(317));e:{for(i=i.nextSibling,o=0;i;){if(i.nodeType===8){var s=i.data;if(s==="/$"){if(o===0){yg=Lf(i.nextSibling);break e}o--}else s!=="$"&&s!=="$!"&&s!=="$?"||o++}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,o,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$1(309));var a=s.stateNode}if(!a)throw Error(p$1(147,i));var _=a,$=""+i;return o!==null&&o.ref!==null&&typeof o.ref=="function"&&o.ref._stringRef===$?o.ref:(o=function(_e){var tt=_.refs;_e===null?delete tt[$]:tt[$]=_e},o._stringRef=$,o)}if(typeof i!="string")throw Error(p$1(284));if(!s._owner)throw Error(p$1(290,i))}return i}function Mg(i,o){throw i=Object.prototype.toString.call(o),Error(p$1(31,i==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":i))}function Ng(i){var o=i._init;return o(i._payload)}function Og(i){function o(ut,ct){if(i){var dt=ut.deletions;dt===null?(ut.deletions=[ct],ut.flags|=16):dt.push(ct)}}function s(ut,ct){if(!i)return null;for(;ct!==null;)o(ut,ct),ct=ct.sibling;return null}function a(ut,ct){for(ut=new Map;ct!==null;)ct.key!==null?ut.set(ct.key,ct):ut.set(ct.index,ct),ct=ct.sibling;return ut}function _(ut,ct){return ut=Pg(ut,ct),ut.index=0,ut.sibling=null,ut}function $(ut,ct,dt){return ut.index=dt,i?(dt=ut.alternate,dt!==null?(dt=dt.index,dtmt?(gt=yt,yt=null):gt=yt.sibling;var vt=j(ut,yt,dt[mt],ft);if(vt===null){yt===null&&(yt=gt);break}i&&yt&&vt.alternate===null&&o(ut,yt),ct=$(vt,ct,mt),bt===null?ht=vt:bt.sibling=vt,bt=vt,yt=gt}if(mt===dt.length)return s(ut,yt),I&&tg(ut,mt),ht;if(yt===null){for(;mtmt?(gt=yt,yt=null):gt=yt.sibling;var wt=j(ut,yt,vt.value,ft);if(wt===null){yt===null&&(yt=gt);break}i&&yt&&wt.alternate===null&&o(ut,yt),ct=$(wt,ct,mt),bt===null?ht=wt:bt.sibling=wt,bt=wt,yt=gt}if(vt.done)return s(ut,yt),I&&tg(ut,mt),ht;if(yt===null){for(;!vt.done;mt++,vt=dt.next())vt=et(ut,vt.value,ft),vt!==null&&(ct=$(vt,ct,mt),bt===null?ht=vt:bt.sibling=vt,bt=vt);return I&&tg(ut,mt),ht}for(yt=a(ut,yt);!vt.done;mt++,vt=dt.next())vt=rt(yt,ut,mt,vt.value,ft),vt!==null&&(i&&vt.alternate!==null&&yt.delete(vt.key===null?mt:vt.key),ct=$(vt,ct,mt),bt===null?ht=vt:bt.sibling=vt,bt=vt);return i&&yt.forEach(function(Ct){return o(ut,Ct)}),I&&tg(ut,mt),ht}function lt(ut,ct,dt,ft){if(typeof dt=="object"&&dt!==null&&dt.type===ya&&dt.key===null&&(dt=dt.props.children),typeof dt=="object"&&dt!==null){switch(dt.$$typeof){case va:e:{for(var ht=dt.key,bt=ct;bt!==null;){if(bt.key===ht){if(ht=dt.type,ht===ya){if(bt.tag===7){s(ut,bt.sibling),ct=_(bt,dt.props.children),ct.return=ut,ut=ct;break e}}else if(bt.elementType===ht||typeof ht=="object"&&ht!==null&&ht.$$typeof===Ha&&Ng(ht)===bt.type){s(ut,bt.sibling),ct=_(bt,dt.props),ct.ref=Lg(ut,bt,dt),ct.return=ut,ut=ct;break e}s(ut,bt);break}else o(ut,bt);bt=bt.sibling}dt.type===ya?(ct=Tg(dt.props.children,ut.mode,ft,dt.key),ct.return=ut,ut=ct):(ft=Rg(dt.type,dt.key,dt.props,null,ut.mode,ft),ft.ref=Lg(ut,ct,dt),ft.return=ut,ut=ft)}return _e(ut);case wa:e:{for(bt=dt.key;ct!==null;){if(ct.key===bt)if(ct.tag===4&&ct.stateNode.containerInfo===dt.containerInfo&&ct.stateNode.implementation===dt.implementation){s(ut,ct.sibling),ct=_(ct,dt.children||[]),ct.return=ut,ut=ct;break e}else{s(ut,ct);break}else o(ut,ct);ct=ct.sibling}ct=Sg(dt,ut.mode,ft),ct.return=ut,ut=ct}return _e(ut);case Ha:return bt=dt._init,lt(ut,ct,bt(dt._payload),ft)}if(eb(dt))return ot(ut,ct,dt,ft);if(Ka(dt))return at(ut,ct,dt,ft);Mg(ut,dt)}return typeof dt=="string"&&dt!==""||typeof dt=="number"?(dt=""+dt,ct!==null&&ct.tag===6?(s(ut,ct.sibling),ct=_(ct,dt),ct.return=ut,ut=ct):(s(ut,ct),ct=Qg(dt,ut.mode,ft),ct.return=ut,ut=ct),_e(ut)):s(ut,ct)}return lt}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 o=Wg.current;E(Wg),i._currentValue=o}function bh(i,o,s){for(;i!==null;){var a=i.alternate;if((i.childLanes&o)!==o?(i.childLanes|=o,a!==null&&(a.childLanes|=o)):a!==null&&(a.childLanes&o)!==o&&(a.childLanes|=o),i===s)break;i=i.return}}function ch(i,o){Xg=i,Zg=Yg=null,i=i.dependencies,i!==null&&i.firstContext!==null&&(i.lanes&o&&(dh=!0),i.firstContext=null)}function eh(i){var o=i._currentValue;if(Zg!==i)if(i={context:i,memoizedValue:o,next:null},Yg===null){if(Xg===null)throw Error(p$1(308));Yg=i,Xg.dependencies={lanes:0,firstContext:i}}else Yg=Yg.next=i;return o}var fh=null;function gh(i){fh===null?fh=[i]:fh.push(i)}function hh(i,o,s,a){var _=o.interleaved;return _===null?(s.next=s,gh(o)):(s.next=_.next,_.next=s),o.interleaved=s,ih(i,a)}function ih(i,o){i.lanes|=o;var s=i.alternate;for(s!==null&&(s.lanes|=o),s=i,i=i.return;i!==null;)i.childLanes|=o,s=i.alternate,s!==null&&(s.childLanes|=o),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,o){i=i.updateQueue,o.updateQueue===i&&(o.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,effects:i.effects})}function mh(i,o){return{eventTime:i,lane:o,tag:0,payload:null,callback:null,next:null}}function nh(i,o,s){var a=i.updateQueue;if(a===null)return null;if(a=a.shared,K&2){var _=a.pending;return _===null?o.next=o:(o.next=_.next,_.next=o),a.pending=o,ih(i,s)}return _=a.interleaved,_===null?(o.next=o,gh(a)):(o.next=_.next,_.next=o),a.interleaved=o,ih(i,s)}function oh(i,o,s){if(o=o.updateQueue,o!==null&&(o=o.shared,(s&4194240)!==0)){var a=o.lanes;a&=i.pendingLanes,s|=a,o.lanes=s,Cc(i,s)}}function ph(i,o){var s=i.updateQueue,a=i.alternate;if(a!==null&&(a=a.updateQueue,s===a)){var _=null,$=null;if(s=s.firstBaseUpdate,s!==null){do{var _e={eventTime:s.eventTime,lane:s.lane,tag:s.tag,payload:s.payload,callback:s.callback,next:null};$===null?_=$=_e:$=$.next=_e,s=s.next}while(s!==null);$===null?_=$=o:$=$.next=o}else _=$=o;s={baseState:a.baseState,firstBaseUpdate:_,lastBaseUpdate:$,shared:a.shared,effects:a.effects},i.updateQueue=s;return}i=s.lastBaseUpdate,i===null?s.firstBaseUpdate=o:i.next=o,s.lastBaseUpdate=o}function qh(i,o,s,a){var _=i.updateQueue;jh=!1;var $=_.firstBaseUpdate,_e=_.lastBaseUpdate,tt=_.shared.pending;if(tt!==null){_.shared.pending=null;var st=tt,it=st.next;st.next=null,_e===null?$=it:_e.next=it,_e=st;var nt=i.alternate;nt!==null&&(nt=nt.updateQueue,tt=nt.lastBaseUpdate,tt!==_e&&(tt===null?nt.firstBaseUpdate=it:tt.next=it,nt.lastBaseUpdate=st))}if($!==null){var et=_.baseState;_e=0,nt=it=st=null,tt=$;do{var j=tt.lane,rt=tt.eventTime;if((a&j)===j){nt!==null&&(nt=nt.next={eventTime:rt,lane:0,tag:tt.tag,payload:tt.payload,callback:tt.callback,next:null});e:{var ot=i,at=tt;switch(j=o,rt=s,at.tag){case 1:if(ot=at.payload,typeof ot=="function"){et=ot.call(rt,et,j);break e}et=ot;break e;case 3:ot.flags=ot.flags&-65537|128;case 0:if(ot=at.payload,j=typeof ot=="function"?ot.call(rt,et,j):ot,j==null)break e;et=A$1({},et,j);break e;case 2:jh=!0}}tt.callback!==null&&tt.lane!==0&&(i.flags|=64,j=_.effects,j===null?_.effects=[tt]:j.push(tt))}else rt={eventTime:rt,lane:j,tag:tt.tag,payload:tt.payload,callback:tt.callback,next:null},nt===null?(it=nt=rt,st=et):nt=nt.next=rt,_e|=j;if(tt=tt.next,tt===null){if(tt=_.shared.pending,tt===null)break;j=tt,tt=j.next,j.next=null,_.lastBaseUpdate=j,_.shared.pending=null}}while(!0);if(nt===null&&(st=et),_.baseState=st,_.firstBaseUpdate=it,_.lastBaseUpdate=nt,o=_.shared.interleaved,o!==null){_=o;do _e|=_.lane,_=_.next;while(_!==o)}else $===null&&(_.shared.lanes=0);rh|=_e,i.lanes=_e,i.memoizedState=et}}function sh(i,o,s){if(i=o.effects,o.effects=null,i!==null)for(o=0;os?s:4,i(!0);var a=Gh.transition;Gh.transition={};try{i(!1),o()}finally{C=s,Gh.transition=a}}function wi(){return Uh().memoizedState}function xi(i,o,s){var a=yi(i);if(s={lane:a,action:s,hasEagerState:!1,eagerState:null,next:null},zi(i))Ai(o,s);else if(s=hh(i,o,s,a),s!==null){var _=R();gi(s,i,a,_),Bi(s,o,a)}}function ii(i,o,s){var a=yi(i),_={lane:a,action:s,hasEagerState:!1,eagerState:null,next:null};if(zi(i))Ai(o,_);else{var $=i.alternate;if(i.lanes===0&&($===null||$.lanes===0)&&($=o.lastRenderedReducer,$!==null))try{var _e=o.lastRenderedState,tt=$(_e,s);if(_.hasEagerState=!0,_.eagerState=tt,He(tt,_e)){var st=o.interleaved;st===null?(_.next=_,gh(o)):(_.next=st.next,st.next=_),o.interleaved=_;return}}catch{}finally{}s=hh(i,o,_,a),s!==null&&(_=R(),gi(s,i,a,_),Bi(s,o,a))}}function zi(i){var o=i.alternate;return i===M||o!==null&&o===M}function Ai(i,o){Jh=Ih=!0;var s=i.pending;s===null?o.next=o:(o.next=s.next,s.next=o),i.pending=o}function Bi(i,o,s){if(s&4194240){var a=o.lanes;a&=i.pendingLanes,s|=a,o.lanes=s,Cc(i,s)}}var Rh={readContext:eh,useCallback:P$1,useContext:P$1,useEffect:P$1,useImperativeHandle:P$1,useInsertionEffect:P$1,useLayoutEffect:P$1,useMemo:P$1,useReducer:P$1,useRef:P$1,useState:P$1,useDebugValue:P$1,useDeferredValue:P$1,useTransition:P$1,useMutableSource:P$1,useSyncExternalStore:P$1,useId:P$1,unstable_isNewReconciler:!1},Oh={readContext:eh,useCallback:function(i,o){return Th().memoizedState=[i,o===void 0?null:o],i},useContext:eh,useEffect:mi,useImperativeHandle:function(i,o,s){return s=s!=null?s.concat([i]):null,ki(4194308,4,pi.bind(null,o,i),s)},useLayoutEffect:function(i,o){return ki(4194308,4,i,o)},useInsertionEffect:function(i,o){return ki(4,2,i,o)},useMemo:function(i,o){var s=Th();return o=o===void 0?null:o,i=i(),s.memoizedState=[i,o],i},useReducer:function(i,o,s){var a=Th();return o=s!==void 0?s(o):o,a.memoizedState=a.baseState=o,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:o},a.queue=i,i=i.dispatch=xi.bind(null,M,i),[a.memoizedState,i]},useRef:function(i){var o=Th();return i={current:i},o.memoizedState=i},useState:hi,useDebugValue:ri,useDeferredValue:function(i){return Th().memoizedState=i},useTransition:function(){var i=hi(!1),o=i[0];return i=vi.bind(null,i[1]),Th().memoizedState=i,[o,i]},useMutableSource:function(){},useSyncExternalStore:function(i,o,s){var a=M,_=Th();if(I){if(s===void 0)throw Error(p$1(407));s=s()}else{if(s=o(),Q===null)throw Error(p$1(349));Hh&30||di(a,o,s)}_.memoizedState=s;var $={value:s,getSnapshot:o};return _.queue=$,mi(ai.bind(null,a,$,i),[i]),a.flags|=2048,bi(9,ci.bind(null,a,$,s,o),void 0,null),s},useId:function(){var i=Th(),o=Q.identifierPrefix;if(I){var s=sg,a=rg;s=(a&~(1<<32-oc(a)-1)).toString(32)+s,o=":"+o+"R"+s,s=Kh++,0<\/script>",i=i.removeChild(i.firstChild)):typeof a.is=="string"?i=_e.createElement(s,{is:a.is}):(i=_e.createElement(s),s==="select"&&(_e=i,a.multiple?_e.multiple=!0:a.size&&(_e.size=a.size))):i=_e.createElementNS(i,s),i[Of]=o,i[Pf]=a,zj(i,o,!1,!1),o.stateNode=i;e:{switch(_e=vb(s,a),s){case"dialog":D("cancel",i),D("close",i),_=a;break;case"iframe":case"object":case"embed":D("load",i),_=a;break;case"video":case"audio":for(_=0;_Gj&&(o.flags|=128,a=!0,Dj($,!1),o.lanes=4194304)}else{if(!a)if(i=Ch(_e),i!==null){if(o.flags|=128,a=!0,s=i.updateQueue,s!==null&&(o.updateQueue=s,o.flags|=4),Dj($,!0),$.tail===null&&$.tailMode==="hidden"&&!_e.alternate&&!I)return S(o),null}else 2*B()-$.renderingStartTime>Gj&&s!==1073741824&&(o.flags|=128,a=!0,Dj($,!1),o.lanes=4194304);$.isBackwards?(_e.sibling=o.child,o.child=_e):(s=$.last,s!==null?s.sibling=_e:o.child=_e,$.last=_e)}return $.tail!==null?(o=$.tail,$.rendering=o,$.tail=o.sibling,$.renderingStartTime=B(),o.sibling=null,s=L.current,G(L,a?s&1|2:s&1),o):(S(o),null);case 22:case 23:return Hj(),a=o.memoizedState!==null,i!==null&&i.memoizedState!==null!==a&&(o.flags|=8192),a&&o.mode&1?fj&1073741824&&(S(o),o.subtreeFlags&6&&(o.flags|=8192)):S(o),null;case 24:return null;case 25:return null}throw Error(p$1(156,o.tag))}function Ij(i,o){switch(wg(o),o.tag){case 1:return Zf(o.type)&&$f(),i=o.flags,i&65536?(o.flags=i&-65537|128,o):null;case 3:return zh(),E(Wf),E(H),Eh(),i=o.flags,i&65536&&!(i&128)?(o.flags=i&-65537|128,o):null;case 5:return Bh(o),null;case 13:if(E(L),i=o.memoizedState,i!==null&&i.dehydrated!==null){if(o.alternate===null)throw Error(p$1(340));Ig()}return i=o.flags,i&65536?(o.flags=i&-65537|128,o):null;case 19:return E(L),null;case 4:return zh(),null;case 10:return ah(o.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,o){var s=i.ref;if(s!==null)if(typeof s=="function")try{s(null)}catch(a){W(i,o,a)}else s.current=null}function Mj(i,o,s){try{s()}catch(a){W(i,o,a)}}var Nj=!1;function Oj(i,o){if(Cf=dd,i=Me(),Ne(i)){if("selectionStart"in i)var s={start:i.selectionStart,end:i.selectionEnd};else e:{s=(s=i.ownerDocument)&&s.defaultView||window;var a=s.getSelection&&s.getSelection();if(a&&a.rangeCount!==0){s=a.anchorNode;var _=a.anchorOffset,$=a.focusNode;a=a.focusOffset;try{s.nodeType,$.nodeType}catch{s=null;break e}var _e=0,tt=-1,st=-1,it=0,nt=0,et=i,j=null;t:for(;;){for(var rt;et!==s||_!==0&&et.nodeType!==3||(tt=_e+_),et!==$||a!==0&&et.nodeType!==3||(st=_e+a),et.nodeType===3&&(_e+=et.nodeValue.length),(rt=et.firstChild)!==null;)j=et,et=rt;for(;;){if(et===i)break t;if(j===s&&++it===_&&(tt=_e),j===$&&++nt===a&&(st=_e),(rt=et.nextSibling)!==null)break;et=j,j=et.parentNode}et=rt}s=tt===-1||st===-1?null:{start:tt,end:st}}else s=null}s=s||{start:0,end:0}}else s=null;for(Df={focusedElem:i,selectionRange:s},dd=!1,V=o;V!==null;)if(o=V,i=o.child,(o.subtreeFlags&1028)!==0&&i!==null)i.return=o,V=i;else for(;V!==null;){o=V;try{var ot=o.alternate;if(o.flags&1024)switch(o.tag){case 0:case 11:case 15:break;case 1:if(ot!==null){var at=ot.memoizedProps,lt=ot.memoizedState,ut=o.stateNode,ct=ut.getSnapshotBeforeUpdate(o.elementType===o.type?at:Ci(o.type,at),lt);ut.__reactInternalSnapshotBeforeUpdate=ct}break;case 3:var dt=o.stateNode.containerInfo;dt.nodeType===1?dt.textContent="":dt.nodeType===9&&dt.documentElement&&dt.removeChild(dt.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(p$1(163))}}catch(ft){W(o,o.return,ft)}if(i=o.sibling,i!==null){i.return=o.return,V=i;break}V=o.return}return ot=Nj,Nj=!1,ot}function Pj(i,o,s){var a=o.updateQueue;if(a=a!==null?a.lastEffect:null,a!==null){var _=a=a.next;do{if((_.tag&i)===i){var $=_.destroy;_.destroy=void 0,$!==void 0&&Mj(o,s,$)}_=_.next}while(_!==a)}}function Qj(i,o){if(o=o.updateQueue,o=o!==null?o.lastEffect:null,o!==null){var s=o=o.next;do{if((s.tag&i)===i){var a=s.create;s.destroy=a()}s=s.next}while(s!==o)}}function Rj(i){var o=i.ref;if(o!==null){var s=i.stateNode;switch(i.tag){case 5:i=s;break;default:i=s}typeof o=="function"?o(i):o.current=i}}function Sj(i){var o=i.alternate;o!==null&&(i.alternate=null,Sj(o)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(o=i.stateNode,o!==null&&(delete o[Of],delete o[Pf],delete o[of],delete o[Qf],delete o[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,o,s){var a=i.tag;if(a===5||a===6)i=i.stateNode,o?s.nodeType===8?s.parentNode.insertBefore(i,o):s.insertBefore(i,o):(s.nodeType===8?(o=s.parentNode,o.insertBefore(i,s)):(o=s,o.appendChild(i)),s=s._reactRootContainer,s!=null||o.onclick!==null||(o.onclick=Bf));else if(a!==4&&(i=i.child,i!==null))for(Vj(i,o,s),i=i.sibling;i!==null;)Vj(i,o,s),i=i.sibling}function Wj(i,o,s){var a=i.tag;if(a===5||a===6)i=i.stateNode,o?s.insertBefore(i,o):s.appendChild(i);else if(a!==4&&(i=i.child,i!==null))for(Wj(i,o,s),i=i.sibling;i!==null;)Wj(i,o,s),i=i.sibling}var X$1=null,Xj=!1;function Yj(i,o,s){for(s=s.child;s!==null;)Zj(i,o,s),s=s.sibling}function Zj(i,o,s){if(lc&&typeof lc.onCommitFiberUnmount=="function")try{lc.onCommitFiberUnmount(kc,s)}catch{}switch(s.tag){case 5:U||Lj(s,o);case 6:var a=X$1,_=Xj;X$1=null,Yj(i,o,s),X$1=a,Xj=_,X$1!==null&&(Xj?(i=X$1,s=s.stateNode,i.nodeType===8?i.parentNode.removeChild(s):i.removeChild(s)):X$1.removeChild(s.stateNode));break;case 18:X$1!==null&&(Xj?(i=X$1,s=s.stateNode,i.nodeType===8?Kf(i.parentNode,s):i.nodeType===1&&Kf(i,s),bd(i)):Kf(X$1,s.stateNode));break;case 4:a=X$1,_=Xj,X$1=s.stateNode.containerInfo,Xj=!0,Yj(i,o,s),X$1=a,Xj=_;break;case 0:case 11:case 14:case 15:if(!U&&(a=s.updateQueue,a!==null&&(a=a.lastEffect,a!==null))){_=a=a.next;do{var $=_,_e=$.destroy;$=$.tag,_e!==void 0&&($&2||$&4)&&Mj(s,o,_e),_=_.next}while(_!==a)}Yj(i,o,s);break;case 1:if(!U&&(Lj(s,o),a=s.stateNode,typeof a.componentWillUnmount=="function"))try{a.props=s.memoizedProps,a.state=s.memoizedState,a.componentWillUnmount()}catch(tt){W(s,o,tt)}Yj(i,o,s);break;case 21:Yj(i,o,s);break;case 22:s.mode&1?(U=(a=U)||s.memoizedState!==null,Yj(i,o,s),U=a):Yj(i,o,s);break;default:Yj(i,o,s)}}function ak(i){var o=i.updateQueue;if(o!==null){i.updateQueue=null;var s=i.stateNode;s===null&&(s=i.stateNode=new Kj),o.forEach(function(a){var _=bk.bind(null,i,a);s.has(a)||(s.add(a),a.then(_,_))})}}function ck(i,o){var s=o.deletions;if(s!==null)for(var a=0;a_&&(_=_e),a&=~$}if(a=_,a=B()-a,a=(120>a?120:480>a?480:1080>a?1080:1920>a?1920:3e3>a?3e3:4320>a?4320:1960*lk(a/1960))-a,10i?16:i,wk===null)var a=!1;else{if(i=wk,wk=null,xk=0,K&6)throw Error(p$1(331));var _=K;for(K|=4,V=i.current;V!==null;){var $=V,_e=$.child;if(V.flags&16){var tt=$.deletions;if(tt!==null){for(var st=0;stB()-fk?Kk(i,0):rk|=s),Dk(i,o)}function Yk(i,o){o===0&&(i.mode&1?(o=sc,sc<<=1,!(sc&130023424)&&(sc=4194304)):o=1);var s=R();i=ih(i,o),i!==null&&(Ac(i,o,s),Dk(i,s))}function uj(i){var o=i.memoizedState,s=0;o!==null&&(s=o.retryLane),Yk(i,s)}function bk(i,o){var s=0;switch(i.tag){case 13:var a=i.stateNode,_=i.memoizedState;_!==null&&(s=_.retryLane);break;case 19:a=i.stateNode;break;default:throw Error(p$1(314))}a!==null&&a.delete(o),Yk(i,s)}var Vk;Vk=function(i,o,s){if(i!==null)if(i.memoizedProps!==o.pendingProps||Wf.current)dh=!0;else{if(!(i.lanes&s)&&!(o.flags&128))return dh=!1,yj(i,o,s);dh=!!(i.flags&131072)}else dh=!1,I&&o.flags&1048576&&ug(o,ng,o.index);switch(o.lanes=0,o.tag){case 2:var a=o.type;ij(i,o),i=o.pendingProps;var _=Yf(o,H.current);ch(o,s),_=Nh(null,o,a,i,_,s);var $=Sh();return o.flags|=1,typeof _=="object"&&_!==null&&typeof _.render=="function"&&_.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,Zf(a)?($=!0,cg(o)):$=!1,o.memoizedState=_.state!==null&&_.state!==void 0?_.state:null,kh(o),_.updater=Ei,o.stateNode=_,_._reactInternals=o,Ii(o,a,i,s),o=jj(null,o,a,!0,$,s)):(o.tag=0,I&&$&&vg(o),Xi(null,o,_,s),o=o.child),o;case 16:a=o.elementType;e:{switch(ij(i,o),i=o.pendingProps,_=a._init,a=_(a._payload),o.type=a,_=o.tag=Zk(a),i=Ci(a,i),_){case 0:o=cj(null,o,a,i,s);break e;case 1:o=hj(null,o,a,i,s);break e;case 11:o=Yi(null,o,a,i,s);break e;case 14:o=$i(null,o,a,Ci(a.type,i),s);break e}throw Error(p$1(306,a,""))}return o;case 0:return a=o.type,_=o.pendingProps,_=o.elementType===a?_:Ci(a,_),cj(i,o,a,_,s);case 1:return a=o.type,_=o.pendingProps,_=o.elementType===a?_:Ci(a,_),hj(i,o,a,_,s);case 3:e:{if(kj(o),i===null)throw Error(p$1(387));a=o.pendingProps,$=o.memoizedState,_=$.element,lh(i,o),qh(o,a,null,s);var _e=o.memoizedState;if(a=_e.element,$.isDehydrated)if($={element:a,isDehydrated:!1,cache:_e.cache,pendingSuspenseBoundaries:_e.pendingSuspenseBoundaries,transitions:_e.transitions},o.updateQueue.baseState=$,o.memoizedState=$,o.flags&256){_=Ji(Error(p$1(423)),o),o=lj(i,o,a,s,_);break e}else if(a!==_){_=Ji(Error(p$1(424)),o),o=lj(i,o,a,s,_);break e}else for(yg=Lf(o.stateNode.containerInfo.firstChild),xg=o,I=!0,zg=null,s=Vg(o,null,a,s),o.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(Ig(),a===_){o=Zi(i,o,s);break e}Xi(i,o,a,s)}o=o.child}return o;case 5:return Ah(o),i===null&&Eg(o),a=o.type,_=o.pendingProps,$=i!==null?i.memoizedProps:null,_e=_.children,Ef(a,_)?_e=null:$!==null&&Ef(a,$)&&(o.flags|=32),gj(i,o),Xi(i,o,_e,s),o.child;case 6:return i===null&&Eg(o),null;case 13:return oj(i,o,s);case 4:return yh(o,o.stateNode.containerInfo),a=o.pendingProps,i===null?o.child=Ug(o,null,a,s):Xi(i,o,a,s),o.child;case 11:return a=o.type,_=o.pendingProps,_=o.elementType===a?_:Ci(a,_),Yi(i,o,a,_,s);case 7:return Xi(i,o,o.pendingProps,s),o.child;case 8:return Xi(i,o,o.pendingProps.children,s),o.child;case 12:return Xi(i,o,o.pendingProps.children,s),o.child;case 10:e:{if(a=o.type._context,_=o.pendingProps,$=o.memoizedProps,_e=_.value,G(Wg,a._currentValue),a._currentValue=_e,$!==null)if(He($.value,_e)){if($.children===_.children&&!Wf.current){o=Zi(i,o,s);break e}}else for($=o.child,$!==null&&($.return=o);$!==null;){var tt=$.dependencies;if(tt!==null){_e=$.child;for(var st=tt.firstContext;st!==null;){if(st.context===a){if($.tag===1){st=mh(-1,s&-s),st.tag=2;var it=$.updateQueue;if(it!==null){it=it.shared;var nt=it.pending;nt===null?st.next=st:(st.next=nt.next,nt.next=st),it.pending=st}}$.lanes|=s,st=$.alternate,st!==null&&(st.lanes|=s),bh($.return,s,o),tt.lanes|=s;break}st=st.next}}else if($.tag===10)_e=$.type===o.type?null:$.child;else if($.tag===18){if(_e=$.return,_e===null)throw Error(p$1(341));_e.lanes|=s,tt=_e.alternate,tt!==null&&(tt.lanes|=s),bh(_e,s,o),_e=$.sibling}else _e=$.child;if(_e!==null)_e.return=$;else for(_e=$;_e!==null;){if(_e===o){_e=null;break}if($=_e.sibling,$!==null){$.return=_e.return,_e=$;break}_e=_e.return}$=_e}Xi(i,o,_.children,s),o=o.child}return o;case 9:return _=o.type,a=o.pendingProps.children,ch(o,s),_=eh(_),a=a(_),o.flags|=1,Xi(i,o,a,s),o.child;case 14:return a=o.type,_=Ci(a,o.pendingProps),_=Ci(a.type,_),$i(i,o,a,_,s);case 15:return bj(i,o,o.type,o.pendingProps,s);case 17:return a=o.type,_=o.pendingProps,_=o.elementType===a?_:Ci(a,_),ij(i,o),o.tag=1,Zf(a)?(i=!0,cg(o)):i=!1,ch(o,s),Gi(o,a,_),Ii(o,a,_,s),jj(null,o,a,!0,i,s);case 19:return xj(i,o,s);case 22:return dj(i,o,s)}throw Error(p$1(156,o.tag))};function Fk(i,o){return ac(i,o)}function $k(i,o,s,a){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=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Bg(i,o,s,a){return new $k(i,o,s,a)}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)return 11;if(i===Ga)return 14}return 2}function Pg(i,o){var s=i.alternate;return s===null?(s=Bg(i.tag,o,i.key,i.mode),s.elementType=i.elementType,s.type=i.type,s.stateNode=i.stateNode,s.alternate=i,i.alternate=s):(s.pendingProps=o,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,o=i.dependencies,s.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},s.sibling=i.sibling,s.index=i.index,s.ref=i.ref,s}function Rg(i,o,s,a,_,$){var _e=2;if(a=i,typeof i=="function")aj(i)&&(_e=1);else if(typeof i=="string")_e=5;else e:switch(i){case ya:return Tg(s.children,_,$,o);case za:_e=8,_|=8;break;case Aa:return i=Bg(12,s,o,_|2),i.elementType=Aa,i.lanes=$,i;case Ea:return i=Bg(13,s,o,_),i.elementType=Ea,i.lanes=$,i;case Fa:return i=Bg(19,s,o,_),i.elementType=Fa,i.lanes=$,i;case Ia:return pj(s,_,$,o);default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case Ba:_e=10;break e;case Ca:_e=9;break e;case Da:_e=11;break e;case Ga:_e=14;break e;case Ha:_e=16,a=null;break e}throw Error(p$1(130,i==null?i:typeof i,""))}return o=Bg(_e,s,o,_),o.elementType=i,o.type=a,o.lanes=$,o}function Tg(i,o,s,a){return i=Bg(7,i,a,o),i.lanes=s,i}function pj(i,o,s,a){return i=Bg(22,i,a,o),i.elementType=Ia,i.lanes=s,i.stateNode={isHidden:!1},i}function Qg(i,o,s){return i=Bg(6,i,null,o),i.lanes=s,i}function Sg(i,o,s){return o=Bg(4,i.children!==null?i.children:[],i.key,o),o.lanes=s,o.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},o}function al(i,o,s,a,_){this.tag=o,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=a,this.onRecoverableError=_,this.mutableSourceEagerHydrationData=null}function bl(i,o,s,a,_,$,_e,tt,st){return i=new al(i,o,s,tt,st),o===1?(o=1,$===!0&&(o|=8)):o=0,$=Bg(3,null,null,o),i.current=$,$.stateNode=i,$.memoizedState={element:a,isDehydrated:s,cache:null,transitions:null,pendingSuspenseBoundaries:null},kh($),i}function cl(i,o,s){var a=3"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$1=reactDomExports;createRoot=m$1.createRoot,m$1.hydrateRoot;const cx=(...i)=>i.filter(Boolean).map(o=>o.trim()).join(" ");function getErrorMessage$1(i,o){return`${i} returned \`undefined\`. Seems you forgot to wrap component within ${o}`}function createContext$1(i={}){const{name:o,strict:s=!0,hookName:a="useContext",providerName:_="Provider",errorMessage:$,defaultValue:_e}=i,tt=reactExports.createContext(_e);tt.displayName=o;function st(){var nt;const it=reactExports.useContext(tt);if(!it&&s){const et=new Error($??getErrorMessage$1(a,_));throw et.name="ContextError",(nt=Error.captureStackTrace)==null||nt.call(Error,et,st),et}return it}return[tt.Provider,st,tt]}function callAll$1(...i){return function(...s){i.forEach(a=>a==null?void 0:a(...s))}}const clsx$1=(...i)=>i.map(o=>{var s;return(s=o==null?void 0:o.trim)==null?void 0:s.call(o)}).filter(Boolean).join(" "),eventRegex=/^on[A-Z]/;function mergeProps$1(...i){let o={};for(let s of i){for(let a in o){if(eventRegex.test(a)&&typeof o[a]=="function"&&typeof s[a]=="function"){o[a]=callAll$1(o[a],s[a]);continue}if(a==="className"||a==="class"){o[a]=clsx$1(o[a],s[a]);continue}if(a==="style"){o[a]=Object.assign({},o[a]??{},s[a]??{});continue}o[a]=s[a]!==void 0?s[a]:o[a]}for(let a in s)o[a]===void 0&&(o[a]=s[a])}return o}const EMPTY_STYLES=Object.freeze({}),EMPTY_SLOT_STYLES=Object.freeze({});function memoize(i){var o=Object.create(null);return function(s){return o[s]===void 0&&(o[s]=i(s)),o[s]}}var reactPropsRegex=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,isPropValid$1=memoize(function(i){return reactPropsRegex.test(i)||i.charCodeAt(0)===111&&i.charCodeAt(1)===110&&i.charCodeAt(2)<91});function sheetForTag(i){if(i.sheet)return i.sheet;for(var o=0;o0?charat(characters,--position):0,column--,character===10&&(column=1,line--),character}function next$1(){return character=position2||token(character)>3?"":" "}function escaping(i,o){for(;--o&&next$1()&&!(character<48||character>102||character>57&&character<65||character>70&&character<97););return slice$1(i,caret()+(o<6&&peek()==32&&next$1()==32))}function delimiter(i){for(;next$1();)switch(character){case i:return position;case 34:case 39:i!==34&&i!==39&&delimiter(character);break;case 40:i===41&&delimiter(i);break;case 92:next$1();break}return position}function commenter(i,o){for(;next$1()&&i+character!==57;)if(i+character===84&&peek()===47)break;return"/*"+slice$1(o,position-1)+"*"+from(i===47?i:next$1())}function identifier(i){for(;!token(peek());)next$1();return slice$1(i,position)}function compile(i){return dealloc(parse$1("",null,null,null,[""],i=alloc(i),0,[0],i))}function parse$1(i,o,s,a,_,$,_e,tt,st){for(var it=0,nt=0,et=_e,j=0,rt=0,ot=0,at=1,lt=1,ut=1,ct=0,dt="",ft=_,ht=$,bt=a,yt=dt;lt;)switch(ot=ct,ct=next$1()){case 40:if(ot!=108&&charat(yt,et-1)==58){indexof(yt+=replace(delimit(ct),"&","&\f"),"&\f")!=-1&&(ut=-1);break}case 34:case 39:case 91:yt+=delimit(ct);break;case 9:case 10:case 13:case 32:yt+=whitespace(ot);break;case 92:yt+=escaping(caret()-1,7);continue;case 47:switch(peek()){case 42:case 47:append(comment(commenter(next$1(),caret()),o,s),st);break;default:yt+="/"}break;case 123*at:tt[it++]=strlen(yt)*ut;case 125*at:case 59:case 0:switch(ct){case 0:case 125:lt=0;case 59+nt:ut==-1&&(yt=replace(yt,/\f/g,"")),rt>0&&strlen(yt)-et&&append(rt>32?declaration(yt+";",a,s,et-1):declaration(replace(yt," ","")+";",a,s,et-2),st);break;case 59:yt+=";";default:if(append(bt=ruleset(yt,o,s,it,nt,_,tt,dt,ft=[],ht=[],et),$),ct===123)if(nt===0)parse$1(yt,o,bt,bt,ft,$,et,tt,ht);else switch(j===99&&charat(yt,3)===110?100:j){case 100:case 108:case 109:case 115:parse$1(i,bt,bt,a&&append(ruleset(i,bt,bt,0,0,_,tt,dt,_,ft=[],et),ht),_,ht,et,tt,a?ft:ht);break;default:parse$1(yt,bt,bt,bt,[""],ht,0,tt,ht)}}it=nt=rt=0,at=ut=1,dt=yt="",et=_e;break;case 58:et=1+strlen(yt),rt=ot;default:if(at<1){if(ct==123)--at;else if(ct==125&&at++==0&&prev$1()==125)continue}switch(yt+=from(ct),ct*at){case 38:ut=nt>0?1:(yt+="\f",-1);break;case 44:tt[it++]=(strlen(yt)-1)*ut,ut=1;break;case 64:peek()===45&&(yt+=delimit(next$1())),j=peek(),nt=et=strlen(dt=yt+=identifier(caret())),ct++;break;case 45:ot===45&&strlen(yt)==2&&(at=0)}}return $}function ruleset(i,o,s,a,_,$,_e,tt,st,it,nt){for(var et=_-1,j=_===0?$:[""],rt=sizeof(j),ot=0,at=0,lt=0;ot0?j[ut]+" "+ct:replace(ct,/&\f/g,j[ut])))&&(st[lt++]=dt);return node(i,o,s,_===0?RULESET:tt,st,it,nt)}function comment(i,o,s){return node(i,o,s,COMMENT,from(char()),substr(i,2,-2),0)}function declaration(i,o,s,a){return node(i,o,s,DECLARATION,substr(i,0,a),substr(i,a+1,-1),a)}function serialize$1(i,o){for(var s="",a=sizeof(i),_=0;_6)switch(charat(i,o+1)){case 109:if(charat(i,o+4)!==45)break;case 102:return replace(i,/(.+:)(.+)-([^]+)/,"$1"+WEBKIT+"$2-$3$1"+MOZ+(charat(i,o+3)==108?"$3":"$2-$3"))+i;case 115:return~indexof(i,"stretch")?prefix$1(replace(i,"stretch","fill-available"),o)+i:i}break;case 4949:if(charat(i,o+1)!==115)break;case 6444:switch(charat(i,strlen(i)-3-(~indexof(i,"!important")&&10))){case 107:return replace(i,":",":"+WEBKIT)+i;case 101:return replace(i,/(.+:)([^;!]+)(;|!.+)?/,"$1"+WEBKIT+(charat(i,14)===45?"inline-":"")+"box$3$1"+WEBKIT+"$2$3$1"+MS+"$2box$3")+i}break;case 5936:switch(charat(i,o+11)){case 114:return WEBKIT+i+MS+replace(i,/[svh]\w+-[tblr]{2}/,"tb")+i;case 108:return WEBKIT+i+MS+replace(i,/[svh]\w+-[tblr]{2}/,"tb-rl")+i;case 45:return WEBKIT+i+MS+replace(i,/[svh]\w+-[tblr]{2}/,"lr")+i}return WEBKIT+i+MS+i+i}return i}var prefixer=function(o,s,a,_){if(o.length>-1&&!o.return)switch(o.type){case DECLARATION:o.return=prefix$1(o.value,o.length);break;case KEYFRAMES:return serialize$1([copy$1(o,{value:replace(o.value,"@","@"+WEBKIT)})],_);case RULESET:if(o.length)return combine(o.props,function($){switch(match$3($,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return serialize$1([copy$1(o,{props:[replace($,/:(read-\w+)/,":"+MOZ+"$1")]})],_);case"::placeholder":return serialize$1([copy$1(o,{props:[replace($,/:(plac\w+)/,":"+WEBKIT+"input-$1")]}),copy$1(o,{props:[replace($,/:(plac\w+)/,":"+MOZ+"$1")]}),copy$1(o,{props:[replace($,/:(plac\w+)/,MS+"input-$1")]})],_)}return""})}},defaultStylisPlugins=[prefixer],createCache=function(o){var s=o.key;if(s==="css"){var a=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(a,function(at){var lt=at.getAttribute("data-emotion");lt.indexOf(" ")!==-1&&(document.head.appendChild(at),at.setAttribute("data-s",""))})}var _=o.stylisPlugins||defaultStylisPlugins,$={},_e,tt=[];_e=o.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+s+' "]'),function(at){for(var lt=at.getAttribute("data-emotion").split(" "),ut=1;ut=4;++a,_-=4)s=i.charCodeAt(a)&255|(i.charCodeAt(++a)&255)<<8|(i.charCodeAt(++a)&255)<<16|(i.charCodeAt(++a)&255)<<24,s=(s&65535)*1540483477+((s>>>16)*59797<<16),s^=s>>>24,o=(s&65535)*1540483477+((s>>>16)*59797<<16)^(o&65535)*1540483477+((o>>>16)*59797<<16);switch(_){case 3:o^=(i.charCodeAt(a+2)&255)<<16;case 2:o^=(i.charCodeAt(a+1)&255)<<8;case 1:o^=i.charCodeAt(a)&255,o=(o&65535)*1540483477+((o>>>16)*59797<<16)}return o^=o>>>13,o=(o&65535)*1540483477+((o>>>16)*59797<<16),((o^o>>>15)>>>0).toString(36)}var unitlessKeys={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},hyphenateRegex=/[A-Z]|^ms/g,animationRegex=/_EMO_([^_]+?)_([^]*?)_EMO_/g,isCustomProperty=function(o){return o.charCodeAt(1)===45},isProcessableValue=function(o){return o!=null&&typeof o!="boolean"},processStyleName=memoize(function(i){return isCustomProperty(i)?i:i.replace(hyphenateRegex,"-$&").toLowerCase()}),processStyleValue=function(o,s){switch(o){case"animation":case"animationName":if(typeof s=="string")return s.replace(animationRegex,function(a,_,$){return cursor$1={name:_,styles:$,next:cursor$1},_})}return unitlessKeys[o]!==1&&!isCustomProperty(o)&&typeof s=="number"&&s!==0?s+"px":s};function handleInterpolation(i,o,s){if(s==null)return"";var a=s;if(a.__emotion_styles!==void 0)return a;switch(typeof s){case"boolean":return"";case"object":{var _=s;if(_.anim===1)return cursor$1={name:_.name,styles:_.styles,next:cursor$1},_.name;var $=s;if($.styles!==void 0){var _e=$.next;if(_e!==void 0)for(;_e!==void 0;)cursor$1={name:_e.name,styles:_e.styles,next:cursor$1},_e=_e.next;var tt=$.styles+";";return tt}return createStringFromObject(i,o,s)}case"function":{if(i!==void 0){var st=cursor$1,it=s(i);return cursor$1=st,handleInterpolation(i,o,it)}break}}var nt=s;if(o==null)return nt;var et=o[nt];return et!==void 0?et:nt}function createStringFromObject(i,o,s){var a="";if(Array.isArray(s))for(var _=0;_{i.forEach(s=>{assignRef(s,o)})}}function compact$1(i){const o=Object.assign({},i);for(let s in o)o[s]===void 0&&delete o[s];return o}function interopDefault(i){return i.default||i}const isObject$4=i=>i!=null&&typeof i=="object"&&!Array.isArray(i),isString$3=i=>typeof i=="string",isFunction$2=i=>typeof i=="function";function getElementRef(i){var s;const o=reactExports.version;return!isString$3(o)||o.startsWith("18.")?i==null?void 0:i.ref:(s=i==null?void 0:i.props)==null?void 0:s.ref}const[ChakraContextProvider,useChakraContext]=createContext$1({name:"ChakraContext",strict:!0,providerName:""});function ChakraProvider(i){const{value:o,children:s}=i;return jsxRuntimeExports.jsxs(ChakraContextProvider,{value:o,children:[!o._config.disableLayers&&jsxRuntimeExports.jsx(Global,{styles:o.layers.atRule}),jsxRuntimeExports.jsx(Global,{styles:o._global}),s]})}const splitPropFn=(i,o)=>{const s={},a={},_=Object.keys(i);for(const $ of _)o($)?a[$]=i[$]:s[$]=i[$];return[a,s]},splitProps=(i,o)=>{const s=isFunction$2(o)?o:a=>o.includes(a);return splitPropFn(i,s)},htmlProps=new Set(["htmlWidth","htmlHeight","htmlSize","htmlTranslate"]);function isHtmlProp(i){return typeof i=="string"&&htmlProps.has(i)}function useResolvedProps(i,o,s){const{css:a,isValidProperty:_}=useChakraContext(),{children:$,..._e}=i,tt=reactExports.useMemo(()=>{const[j,rt]=splitProps(_e,ct=>s(ct,o.variantKeys)),[ot,at]=splitProps(rt,o.variantKeys),[lt,ut]=splitProps(at,_);return{forwardedProps:j,variantProps:ot,styleProps:lt,elementProps:ut}},[o.variantKeys,s,_e,_]),{css:st,...it}=tt.styleProps,nt=reactExports.useMemo(()=>{const j={...tt.variantProps};return o.variantKeys.includes("colorPalette")||(j.colorPalette=_e.colorPalette),o.variantKeys.includes("orientation")||(j.orientation=_e.orientation),o(j)},[o,tt.variantProps,_e.colorPalette,_e.orientation]);return{styles:reactExports.useMemo(()=>a(nt,...toArray$1(st),it),[a,nt,st,it]),props:{...tt.forwardedProps,...tt.elementProps,children:$}}}const toArray$1=i=>(Array.isArray(i)?i:[i]).filter(Boolean).flat(),isPropValid=interopDefault(isPropValid$1),testOmitPropsOnStringTag=isPropValid,testOmitPropsOnComponent=i=>i!=="theme",composeShouldForwardProps=(i,o,s)=>{let a;if(o){const _=o.shouldForwardProp;a=i.__emotion_forwardProp&&_?$=>i.__emotion_forwardProp($)&&_($):_}return typeof a!="function"&&s&&(a=i.__emotion_forwardProp),a};let isBrowser=typeof document<"u";const Insertion=({cache:i,serialized:o,isStringTag:s})=>{registerStyles(i,o,s);const a=useInsertionEffectAlwaysWithSyncFallback(()=>insertStyles(i,o,s));if(!isBrowser&&a!==void 0){let _=o.name,$=o.next;for(;$!==void 0;)_=cx(_,$.name),$=$.next;return jsxRuntimeExports.jsx("style",{"data-emotion":cx(i.key,_),dangerouslySetInnerHTML:{__html:a},nonce:i.sheet.nonce})}return null},createStyled=(i,o={},s={})=>{const a=i.__emotion_real===i,_=a&&i.__emotion_base||i;let $,_e;s!==void 0&&($=s.label,_e=s.target);let tt=[];const st=withEmotionCache((it,nt,et)=>{var It;const{cva:j,isValidProperty:rt}=useChakraContext(),ot=o.__cva__?o:j(o),at=mergeCva$1(i.__emotion_cva,ot),lt=Pt=>(St,Rt)=>Pt.includes(St)?!0:!(Rt!=null&&Rt.includes(St))&&!rt(St);!s.shouldForwardProp&&s.forwardProps&&(s.shouldForwardProp=lt(s.forwardProps));const ut=(Pt,St)=>{const Rt=typeof i=="string"&&i.charCodeAt(0)>96?testOmitPropsOnStringTag:testOmitPropsOnComponent,At=!(St!=null&&St.includes(Pt))&&!rt(Pt);return Rt(Pt)&&At},ct=composeShouldForwardProps(i,s,a)||ut,dt=reactExports.useMemo(()=>Object.assign({},s.defaultProps,compact$1(it)),[it]),{props:ft,styles:ht}=useResolvedProps(dt,at,ct);let bt="",yt=[ht],mt=ft;if(ft.theme==null){mt={};for(let Pt in ft)mt[Pt]=ft[Pt];mt.theme=reactExports.useContext(ThemeContext)}typeof ft.className=="string"?bt=getRegisteredStyles(nt.registered,yt,ft.className):ft.className!=null&&(bt=cx(bt,ft.className));const gt=serializeStyles(tt.concat(yt),nt.registered,mt);bt=cx(bt,`${nt.key}-${gt.name}`),_e!==void 0&&(bt=cx(bt,_e));const vt=!ct("as");let wt=vt&&ft.as||_,Ct={};for(let Pt in ft)if(!(vt&&Pt==="as")){if(isHtmlProp(Pt)){const St=Pt.replace("html","").toLowerCase();Ct[St]=ft[Pt];continue}ct(Pt)&&(Ct[Pt]=ft[Pt])}Ct.className=bt.trim(),Ct.ref=et;const kt=s.forwardAsChild||((It=s.forwardProps)==null?void 0:It.includes("asChild"));if(ft.asChild&&!kt){const Pt=reactExports.Children.only(ft.children);wt=Pt.type,Ct.children=null,Reflect.deleteProperty(Ct,"asChild"),Ct=mergeProps$1(Ct,Pt.props),Ct.ref=mergeRefs(et,getElementRef(Pt))}return Ct.as&&kt?(Ct.as=void 0,jsxRuntimeExports.jsxs(reactExports.Fragment,{children:[jsxRuntimeExports.jsx(Insertion,{cache:nt,serialized:gt,isStringTag:typeof wt=="string"}),jsxRuntimeExports.jsx(wt,{asChild:!0,...Ct,children:jsxRuntimeExports.jsx(ft.as,{children:Ct.children})})]})):jsxRuntimeExports.jsxs(reactExports.Fragment,{children:[jsxRuntimeExports.jsx(Insertion,{cache:nt,serialized:gt,isStringTag:typeof wt=="string"}),jsxRuntimeExports.jsx(wt,{...Ct})]})});return st.displayName=$!==void 0?$:`chakra(${typeof _=="string"?_:_.displayName||_.name||"Component"})`,st.__emotion_real=st,st.__emotion_base=_,st.__emotion_forwardProp=s.shouldForwardProp,st.__emotion_cva=o,Object.defineProperty(st,"toString",{value(){return`.${_e}`}}),st},styledFn=createStyled.bind(),cache=new Map,chakraImpl=new Proxy(styledFn,{apply(i,o,s){return styledFn(...s)},get(i,o){return cache.has(o)||cache.set(o,styledFn(o)),cache.get(o)}}),chakra=chakraImpl,mergeCva$1=(i,o)=>i&&!o?i:!i&&o?o:i.merge(o);function useRecipe(i){const{key:o,recipe:s}=i,a=useChakraContext();return reactExports.useMemo(()=>{const _=s||(o!=null?a.getRecipe(o):{});return a.cva(structuredClone(_))},[o,s,a])}const upperFirst$1=i=>i.charAt(0).toUpperCase()+i.slice(1);function createRecipeContext(i){const{key:o,recipe:s}=i,a=upperFirst$1(o||s.className||"Component"),[_,$]=createContext$1({strict:!1,name:`${a}PropsContext`,providerName:`${a}PropsContext`});function _e(it){const{unstyled:nt,...et}=it,j=useRecipe({key:o,recipe:et.recipe||s}),[rt,ot]=reactExports.useMemo(()=>j.splitVariantProps(et),[j,et]);return{styles:nt?EMPTY_STYLES:j(rt),className:j.className,props:ot}}const tt=(it,nt)=>{const et=chakra(it,{},nt),j=reactExports.forwardRef((rt,ot)=>{const at=$(),lt=reactExports.useMemo(()=>mergeProps$1(at,rt),[rt,at]),{styles:ut,className:ct,props:dt}=_e(lt);return jsxRuntimeExports.jsx(et,{...dt,ref:ot,css:[ut,lt.css],className:cx(ct,lt.className)})});return j.displayName=it.displayName||it.name,j};function st(){return _}return{withContext:tt,PropsProvider:_,withPropsProvider:st,usePropsContext:$,useRecipeResult:_e}}var wrap$3=(i,o)=>i.map((s,a)=>i[(Math.max(o,0)+a)%i.length]),pipe=(...i)=>o=>i.reduce((s,a)=>a(s),o),noop$5=()=>{},isObject$3=i=>typeof i=="object"&&i!==null,MAX_Z_INDEX=2147483647,dataAttr$1=i=>i?"":void 0,ariaAttr=i=>i?"true":void 0,ELEMENT_NODE=1,DOCUMENT_NODE=9,DOCUMENT_FRAGMENT_NODE=11,isHTMLElement$1=i=>isObject$3(i)&&i.nodeType===ELEMENT_NODE&&typeof i.nodeName=="string",isDocument=i=>isObject$3(i)&&i.nodeType===DOCUMENT_NODE,isWindow=i=>isObject$3(i)&&i===i.window,getNodeName$1=i=>isHTMLElement$1(i)?i.localName||"":"#document";function isRootElement(i){return["html","body","#document"].includes(getNodeName$1(i))}var isNode$2=i=>isObject$3(i)&&i.nodeType!==void 0,isShadowRoot$1=i=>isNode$2(i)&&i.nodeType===DOCUMENT_FRAGMENT_NODE&&"host"in i,isInputElement=i=>isHTMLElement$1(i)&&i.localName==="input",isAnchorElement=i=>!!(i!=null&&i.matches("a[href]")),isElementVisible=i=>isHTMLElement$1(i)?i.offsetWidth>0||i.offsetHeight>0||i.getClientRects().length>0:!1,TEXTAREA_SELECT_REGEX=/(textarea|select)/;function isEditableElement(i){if(i==null||!isHTMLElement$1(i))return!1;try{return isInputElement(i)&&i.selectionStart!=null||TEXTAREA_SELECT_REGEX.test(i.localName)||i.isContentEditable||i.getAttribute("contenteditable")==="true"||i.getAttribute("contenteditable")===""}catch{return!1}}function contains(i,o){var a;if(!i||!o||!isHTMLElement$1(i)||!isHTMLElement$1(o))return!1;const s=(a=o.getRootNode)==null?void 0:a.call(o);if(i===o||i.contains(o))return!0;if(s&&isShadowRoot$1(s)){let _=o;for(;_;){if(i===_)return!0;_=_.parentNode||_.host}}return!1}function getDocument(i){return isDocument(i)?i:isWindow(i)?i.document:(i==null?void 0:i.ownerDocument)??document}function getDocumentElement$1(i){return getDocument(i).documentElement}function getWindow$1(i){var o;return isShadowRoot$1(i)?getWindow$1(i.host):isDocument(i)?i.defaultView??window:isHTMLElement$1(i)?((o=i.ownerDocument)==null?void 0:o.defaultView)??window:window}function getActiveElement(i){let o=i.activeElement;for(;o!=null&&o.shadowRoot;){const s=o.shadowRoot.activeElement;if(s===o)break;o=s}return o}function getParentNode$2(i){if(getNodeName$1(i)==="html")return i;const o=i.assignedSlot||i.parentNode||isShadowRoot$1(i)&&i.host||getDocumentElement$1(i);return isShadowRoot$1(o)?o.host:o}var styleCache=new WeakMap;function getComputedStyle$2(i){return styleCache.has(i)||styleCache.set(i,getWindow$1(i).getComputedStyle(i)),styleCache.get(i)}var isDom=()=>typeof document<"u";function getPlatform(){const i=navigator.userAgentData;return(i==null?void 0:i.platform)??navigator.platform}function getUserAgent(){const i=navigator.userAgentData;return i&&Array.isArray(i.brands)?i.brands.map(({brand:o,version:s})=>`${o}/${s}`).join(" "):navigator.userAgent}var pt=i=>isDom()&&i.test(getPlatform()),ua=i=>isDom()&&i.test(getUserAgent()),vn=i=>isDom()&&i.test(navigator.vendor),isTouchDevice=()=>isDom()&&!!navigator.maxTouchPoints,isIPhone=()=>pt(/^iPhone/i),isIPad=()=>pt(/^iPad/i)||isMac()&&navigator.maxTouchPoints>1,isIos=()=>isIPhone()||isIPad(),isApple=()=>isMac()||isIos(),isMac=()=>pt(/^Mac/i),isSafari=()=>isApple()&&vn(/apple/i),isFirefox=()=>ua(/Firefox/i),isAndroid=()=>ua(/Android/i);function getComposedPath(i){var o,s,a;return((o=i.composedPath)==null?void 0:o.call(i))??((a=(s=i.nativeEvent)==null?void 0:s.composedPath)==null?void 0:a.call(s))}function getEventTarget(i){const o=getComposedPath(i);return(o==null?void 0:o[0])??i.target}var isSelfTarget=i=>contains(i.currentTarget,getEventTarget(i));function isOpeningInNewTab(i){const o=i.currentTarget;if(!o)return!1;const s=isApple();if(s&&!i.metaKey||!s&&!i.ctrlKey)return!1;const a=o.localName;return a==="a"||a==="button"&&o.type==="submit"||a==="input"&&o.type==="submit"}function isDownloadingEvent(i){const o=i.currentTarget;if(!o)return!1;const s=o.localName;return i.altKey?s==="a"||s==="button"&&o.type==="submit"||s==="input"&&o.type==="submit":!1}function isComposingEvent(i){return getNativeEvent(i).isComposing||i.keyCode===229}function isPrintableKey(i){return i.key.length===1&&!i.ctrlKey&&!i.metaKey}function isVirtualClick(i){return i.mozInputSource===0&&i.isTrusted?!0:isAndroid()&&i.pointerType?i.type==="click"&&i.buttons===1:i.detail===0&&!i.pointerType}var isLeftClick=i=>i.button===0,isContextMenuEvent=i=>i.button===2||isMac()&&i.ctrlKey&&i.button===0,isModifierKey=i=>i.ctrlKey||i.altKey||i.metaKey,isTouchEvent=i=>"touches"in i&&i.touches.length>0,keyMap={Up:"ArrowUp",Down:"ArrowDown",Esc:"Escape"," ":"Space",",":"Comma",Left:"ArrowLeft",Right:"ArrowRight"},rtlKeyMap={ArrowLeft:"ArrowRight",ArrowRight:"ArrowLeft"};function getEventKey(i,o={}){const{dir:s="ltr",orientation:a="horizontal"}=o;let _=i.key;return _=keyMap[_]??_,s==="rtl"&&a==="horizontal"&&_ in rtlKeyMap&&(_=rtlKeyMap[_]),_}function getNativeEvent(i){return i.nativeEvent??i}var pageKeys=new Set(["PageUp","PageDown"]),arrowKeys=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);function getEventStep(i){return i.ctrlKey||i.metaKey?.1:pageKeys.has(i.key)||i.shiftKey&&arrowKeys.has(i.key)?10:1}function getEventPoint(i,o="client"){const s=isTouchEvent(i)?i.touches[0]||i.changedTouches[0]:i;return{x:s[`${o}X`],y:s[`${o}Y`]}}var addDomEvent=(i,o,s,a)=>{const _=typeof i=="function"?i():i;return _==null||_.addEventListener(o,s,a),()=>{_==null||_.removeEventListener(o,s,a)}};function getDescriptor(i,o){const{type:s="HTMLInputElement",property:a="value"}=o,_=getWindow$1(i)[s].prototype;return Object.getOwnPropertyDescriptor(_,a)??{}}function getElementType(i){if(i.localName==="input")return"HTMLInputElement";if(i.localName==="textarea")return"HTMLTextAreaElement";if(i.localName==="select")return"HTMLSelectElement"}function setElementValue(i,o,s="value"){var _;if(!i)return;const a=getElementType(i);a&&((_=getDescriptor(i,{type:a,property:s}).set)==null||_.call(i,o)),i.setAttribute(s,o)}function setElementChecked(i,o){var a;if(!i)return;(a=getDescriptor(i,{type:"HTMLInputElement",property:"checked"}).set)==null||a.call(i,o),o?i.setAttribute("checked",""):i.removeAttribute("checked")}function dispatchInputCheckedEvent(i,o){const{checked:s,bubbles:a=!0}=o;if(!i)return;const _=getWindow$1(i);i instanceof _.HTMLInputElement&&(setElementChecked(i,s),i.dispatchEvent(new _.Event("click",{bubbles:a})))}function getClosestForm(i){return isFormElement(i)?i.form:i.closest("form")}function isFormElement(i){return i.matches("textarea, input, select, button")}function trackFormReset(i,o){if(!i)return;const s=getClosestForm(i),a=_=>{_.defaultPrevented||o()};return s==null||s.addEventListener("reset",a,{passive:!0}),()=>s==null?void 0:s.removeEventListener("reset",a)}function trackFieldsetDisabled(i,o){const s=i==null?void 0:i.closest("fieldset");if(!s)return;o(s.disabled);const a=getWindow$1(s),_=new a.MutationObserver(()=>o(s.disabled));return _.observe(s,{attributes:!0,attributeFilter:["disabled"]}),()=>_.disconnect()}function trackFormControl(i,o){if(!i)return;const{onFieldsetDisabledChange:s,onFormReset:a}=o,_=[trackFormReset(i,a),trackFieldsetDisabled(i,s)];return()=>_.forEach($=>$==null?void 0:$())}var isFrame=i=>isHTMLElement$1(i)&&i.tagName==="IFRAME",hasTabIndex=i=>!Number.isNaN(parseInt(i.getAttribute("tabindex")||"0",10)),hasNegativeTabIndex=i=>parseInt(i.getAttribute("tabindex")||"0",10)<0,focusableSelector="input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false']), details > summary:first-of-type",getFocusables=(i,o=!1)=>{if(!i)return[];const s=Array.from(i.querySelectorAll(focusableSelector));(o==!0||o=="if-empty"&&s.length===0)&&isHTMLElement$1(i)&&isFocusable(i)&&s.unshift(i);const _=s.filter(isFocusable);return _.forEach(($,_e)=>{if(isFrame($)&&$.contentDocument){const tt=$.contentDocument.body;_.splice(_e,1,...getFocusables(tt))}}),_};function isFocusable(i){return!i||i.closest("[inert]")?!1:i.matches(focusableSelector)&&isElementVisible(i)}function getTabbables(i,o){if(!i)return[];const a=Array.from(i.querySelectorAll(focusableSelector)).filter(isTabbable);return a.forEach((_,$)=>{if(isFrame(_)&&_.contentDocument){const _e=_.contentDocument.body,tt=getTabbables(_e);a.splice($,1,...tt)}}),a.length,a}function isTabbable(i){return i!=null&&i.tabIndex>0?!0:isFocusable(i)&&!hasNegativeTabIndex(i)}function getTabbableEdges(i,o){const s=getTabbables(i,o),a=s[0]||null,_=s[s.length-1]||null;return[a,_]}function getTabIndex(i){return i.tabIndex<0&&(/^(audio|video|details)$/.test(i.localName)||isEditableElement(i))&&!hasTabIndex(i)?0:i.tabIndex}function getInitialFocus(i){const{root:o,getInitialEl:s,filter:a,enabled:_=!0}=i;if(!_)return;let $=null;if($||($=typeof s=="function"?s():s),$||($=o==null?void 0:o.querySelector("[data-autofocus],[autofocus]")),!$){const _e=getTabbables(o);$=a?_e.filter(a)[0]:_e[0]}return $||o||void 0}function isValidTabEvent(i){const o=i.currentTarget;if(!o)return!1;const[s,a]=getTabbableEdges(o),_=o.ownerDocument||document;return!(_.activeElement===s&&i.shiftKey||_.activeElement===a&&!i.shiftKey||!s&&!a)}function nextTick(i){const o=new Set;function s(a){const _=globalThis.requestAnimationFrame(a);o.add(()=>globalThis.cancelAnimationFrame(_))}return s(()=>s(i)),function(){o.forEach(_=>_())}}function raf$1(i){let o;const s=globalThis.requestAnimationFrame(()=>{o=i()});return()=>{globalThis.cancelAnimationFrame(s),o==null||o()}}function queueBeforeEvent(i,o,s){const a=raf$1(()=>{i.removeEventListener(o,_,!0),s()}),_=()=>{a(),s()};return i.addEventListener(o,_,{once:!0,capture:!0}),a}function observeAttributesImpl(i,o){if(!i)return;const{attributes:s,callback:a}=o,_=i.ownerDocument.defaultView||window,$=new _.MutationObserver(_e=>{for(const tt of _e)tt.type==="attributes"&&tt.attributeName&&s.includes(tt.attributeName)&&a(tt)});return $.observe(i,{attributes:!0,attributeFilter:s}),()=>$.disconnect()}function observeAttributes(i,o){const{defer:s}=o,a=s?raf$1:$=>$(),_=[];return _.push(a(()=>{const $=typeof i=="function"?i():i;_.push(observeAttributesImpl($,o))})),()=>{_.forEach($=>$==null?void 0:$())}}function clickIfLink(i){const o=()=>i.click();isFirefox()?queueBeforeEvent(i,"keyup",o):queueMicrotask(o)}function getNearestOverflowAncestor$1(i){const o=getParentNode$2(i);return isRootElement(o)?getDocument(o).body:isHTMLElement$1(o)&&isOverflowElement$1(o)?o:getNearestOverflowAncestor$1(o)}function getOverflowAncestors$1(i,o=[]){const s=getNearestOverflowAncestor$1(i),a=s===i.ownerDocument.body,_=getWindow$1(s);return a?o.concat(_,_.visualViewport||[],isOverflowElement$1(s)?s:[]):o.concat(s,getOverflowAncestors$1(s,[]))}var OVERFLOW_RE=/auto|scroll|overlay|hidden|clip/;function isOverflowElement$1(i){const o=getWindow$1(i),{overflow:s,overflowX:a,overflowY:_,display:$}=o.getComputedStyle(i);return OVERFLOW_RE.test(s+_+a)&&!["inline","contents"].includes($)}function isScrollable(i){return i.scrollHeight>i.clientHeight||i.scrollWidth>i.clientWidth}function scrollIntoView(i,o){const{rootEl:s,...a}=o||{};!i||!s||!isOverflowElement$1(s)||!isScrollable(s)||i.scrollIntoView(a)}function requestPointerLock(i,o){const s=i.body,a="pointerLockElement"in i||"mozPointerLockElement"in i,_=()=>!!i.pointerLockElement;function $(){}function _e(st){_(),console.error("PointerLock error occurred:",st),i.exitPointerLock()}if(!a)return;try{s.requestPointerLock()}catch{}const tt=[addDomEvent(i,"pointerlockchange",$,!1),addDomEvent(i,"pointerlockerror",_e,!1)];return()=>{tt.forEach(st=>st()),i.exitPointerLock()}}function trackPress(i){const{pointerNode:o,keyboardNode:s=o,onPress:a,onPressStart:_,onPressEnd:$,isValidKey:_e=dt=>dt.key==="Enter"}=i;if(!o)return noop$5;const tt=getWindow$1(o),st=getDocument(o);let it=noop$5,nt=noop$5,et=noop$5;const j=dt=>({point:getEventPoint(dt),event:dt});function rt(dt){_==null||_(j(dt))}function ot(dt){$==null||$(j(dt))}const lt=addDomEvent(o,"pointerdown",dt=>{nt();const ht=addDomEvent(tt,"pointerup",yt=>{const mt=getEventTarget(yt);contains(o,mt)?a==null||a(j(yt)):$==null||$(j(yt))},{passive:!a,once:!0}),bt=addDomEvent(tt,"pointercancel",ot,{passive:!$,once:!0});nt=pipe(ht,bt),st.activeElement===s&&dt.pointerType==="mouse"&&dt.preventDefault(),rt(dt)},{passive:!_}),ut=addDomEvent(s,"focus",ct);it=pipe(lt,ut);function ct(){const dt=yt=>{if(!_e(yt))return;const mt=vt=>{if(!_e(vt))return;const wt=new tt.PointerEvent("pointerup"),Ct=j(wt);a==null||a(Ct),$==null||$(Ct)};nt(),nt=addDomEvent(s,"keyup",mt);const gt=new tt.PointerEvent("pointerdown");rt(gt)},ft=()=>{const yt=new tt.PointerEvent("pointercancel");ot(yt)},ht=addDomEvent(s,"keydown",dt),bt=addDomEvent(s,"blur",ft);et=pipe(ht,bt)}return()=>{it(),nt(),et()}}function queryAll(i,o){return Array.from((i==null?void 0:i.querySelectorAll(o))??[])}var defaultItemToId=i=>i.id;function itemById(i,o,s=defaultItemToId){return i.find(a=>s(a)===o)}function indexOfId(i,o,s=defaultItemToId){const a=itemById(i,o,s);return a?i.indexOf(a):-1}function nextById(i,o,s=!0){let a=indexOfId(i,o);return a=s?(a+1)%i.length:Math.min(a+1,i.length-1),i[a]}function prevById(i,o,s=!0){let a=indexOfId(i,o);return a===-1?s?i[i.length-1]:null:(a=s?(a-1+i.length)%i.length:Math.max(0,a-1),i[a])}function trackElementRect(i,o){const{onEntry:s,measure:a,box:_="border-box"}=o,$=(Array.isArray(i)?i:[i]).filter(isHTMLElement$1),_e=getWindow$1($[0]),tt=it=>{const nt=$.map(et=>a(et));s({rects:nt,entries:it})};tt([]);const st=new _e.ResizeObserver(tt);return $.forEach(it=>st.observe(it,{box:_})),()=>st.disconnect()}var sanitize=i=>i.split("").map(o=>{const s=o.charCodeAt(0);return s>0&&s<128?o:s>=128&&s<=255?`/x${s.toString(16)}`.replace("/","\\"):""}).join("").trim(),getValueText=i=>{var o;return sanitize(((o=i.dataset)==null?void 0:o.valuetext)??i.textContent??"")},match$2=(i,o)=>i.trim().toLowerCase().startsWith(o.toLowerCase());function getByText(i,o,s,a=defaultItemToId){const _=s?indexOfId(i,s,a):-1;let $=s?wrap$3(i,_):i;return o.length===1&&($=$.filter(tt=>a(tt)!==s)),$.find(tt=>match$2(getValueText(tt),o))}function setStyle(i,o){if(!i)return noop$5;const s=Object.keys(o).reduce((a,_)=>(a[_]=i.style.getPropertyValue(_),a),{});return Object.assign(i.style,o),()=>{Object.assign(i.style,s),i.style.length===0&&i.removeAttribute("style")}}function setStyleProperty(i,o,s){if(!i)return noop$5;const a=i.style.getPropertyValue(o);return i.style.setProperty(o,s),()=>{i.style.setProperty(o,a),i.style.length===0&&i.removeAttribute("style")}}function getByTypeaheadImpl(i,o){const{state:s,activeId:a,key:_,timeout:$=350,itemToId:_e}=o,tt=s.keysSoFar+_,it=tt.length>1&&Array.from(tt).every(ot=>ot===tt[0])?tt[0]:tt;let nt=i.slice();const et=getByText(nt,it,a,_e);function j(){clearTimeout(s.timer),s.timer=-1}function rt(ot){s.keysSoFar=ot,j(),ot!==""&&(s.timer=+setTimeout(()=>{rt(""),j()},$))}return rt(tt),et}var getByTypeahead=Object.assign(getByTypeaheadImpl,{defaultOptions:{keysSoFar:"",timer:-1},isValidEvent:isValidTypeaheadEvent});function isValidTypeaheadEvent(i){return i.key.length===1&&!i.ctrlKey&&!i.metaKey}var visuallyHiddenStyle={border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"},fps=1e3/60;function waitForElement(i,o){const s=i();if(isHTMLElement$1(s)&&s.isConnected)return o(s),()=>{};{const a=setInterval(()=>{const _=i();isHTMLElement$1(_)&&_.isConnected&&(o(_),clearInterval(a))},fps);return()=>clearInterval(a)}}function waitForElements(i,o){const s=[];return i==null||i.forEach(a=>{const _=waitForElement(a,o);s.push(_)}),()=>{s.forEach(a=>a())}}function getErrorMessage(i,o){return`${i} returned \`undefined\`. Seems you forgot to wrap component within ${o}`}function createContext(i={}){const{name:o,strict:s=!0,hookName:a="useContext",providerName:_="Provider",errorMessage:$,defaultValue:_e}=i,tt=reactExports.createContext(_e);tt.displayName=o;function st(){var nt;const it=reactExports.useContext(tt);if(!it&&s){const et=new Error($??getErrorMessage(a,_));throw et.name="ContextError",(nt=Error.captureStackTrace)==null||nt.call(Error,et,st),et}return it}return[tt.Provider,st,tt]}const[LocaleContextProvider,useLocaleContext]=createContext({name:"LocaleContext",hookName:"useLocaleContext",providerName:"",strict:!1,defaultValue:{dir:"ltr",locale:"en-US"}});function composeRefs(...i){return o=>{const s=[];for(const a of i)if(typeof a=="function"){const _=a(o);typeof _=="function"&&s.push(_)}else a&&(a.current=o);if(s.length)return()=>{for(const a of s)a()}}}function toArray(i){return i?Array.isArray(i)?i:[i]:[]}var first=i=>i[0],last=i=>i[i.length-1],has=(i,o)=>i.indexOf(o)!==-1,add$1=(i,...o)=>i.concat(o),remove$1=(i,...o)=>i.filter(s=>!o.includes(s)),addOrRemove=(i,o)=>has(i,o)?remove$1(i,o):add$1(i,o);function nextIndex(i,o,s={}){const{step:a=1,loop:_=!0}=s,$=o+a,_e=i.length,tt=_e-1;return o===-1?a>0?0:tt:$<0?_?tt:0:$>=_e?_?0:o>_e?_e:o:$}function next(i,o,s={}){return i[nextIndex(i,o,s)]}function prevIndex(i,o,s={}){const{step:a=1,loop:_=!0}=s;return nextIndex(i,o,{step:-a,loop:_})}function prev(i,o,s={}){return i[prevIndex(i,o,s)]}var isArrayLike=i=>(i==null?void 0:i.constructor.name)==="Array",isArrayEqual=(i,o)=>{if(i.length!==o.length)return!1;for(let s=0;s{if(Object.is(i,o))return!0;if(i==null&&o!=null||i!=null&&o==null)return!1;if(typeof(i==null?void 0:i.isEqual)=="function"&&typeof(o==null?void 0:o.isEqual)=="function")return i.isEqual(o);if(typeof i=="function"&&typeof o=="function")return i.toString()===o.toString();if(isArrayLike(i)&&isArrayLike(o))return isArrayEqual(Array.from(i),Array.from(o));if(typeof i!="object"||typeof o!="object")return!1;const s=Object.keys(o??Object.create(null)),a=s.length;for(let _=0;_Array.isArray(i),isObjectLike=i=>i!=null&&typeof i=="object",isObject$2=i=>isObjectLike(i)&&!isArray(i),isString$2=i=>typeof i=="string",isFunction$1=i=>typeof i=="function",isNull=i=>i==null,hasProp=(i,o)=>Object.prototype.hasOwnProperty.call(i,o),fnToString=Function.prototype.toString;fnToString.call(Object);var runIfFn=(i,...o)=>(typeof i=="function"?i(...o):i)??void 0,identity$2=i=>i(),noop$4=()=>{},callAll=(...i)=>(...o)=>{i.forEach(function(s){s==null||s(...o)})},uuid=(()=>{let i=0;return()=>(i++,i.toString(36))})(),{floor:floor$1,round:round$1,min:min$1,max:max$1}=Math,isNaN$1=i=>Number.isNaN(i),nan=i=>isNaN$1(i)?0:i,wrap$2=(i,o)=>(i%o+o)%o,isValueAtMax=(i,o)=>nan(i)>=o,isValueAtMin=(i,o)=>nan(i)<=o,isValueWithinRange=(i,o,s)=>nan(i)>=o&&nan(i)<=s,clampValue=(i,o,s)=>min$1(max$1(nan(i),o),s),roundToDpr=(i,o)=>typeof o=="number"?floor$1(i*o+.5)/o:round$1(i),countDecimals=i=>{if(!Number.isFinite(i))return 0;let o=1,s=0;for(;Math.round(i*o)/o!==i;)o*=10,s+=1;return s},decimalOp=(i,o,s)=>{let a=o==="+"?i+s:i-s;if(i%1!==0||s%1!==0){const _=10**Math.max(countDecimals(i),countDecimals(s));i=Math.round(i*_),s=Math.round(s*_),a=o==="+"?i+s:i-s,a/=_}return a},incrementValue=(i,o)=>decimalOp(nan(i),"+",o),decrementValue=(i,o)=>decimalOp(nan(i),"-",o);function compact(i){if(!isPlainObject2(i)||i===void 0)return i;const o=Reflect.ownKeys(i).filter(a=>typeof a=="string"),s={};for(const a of o){const _=i[a];_!==void 0&&(s[a]=compact(_))}return s}var isPlainObject2=i=>i&&typeof i=="object"&&i.constructor===Object;function setRafTimeout(i,o){const s=performance.now();let a;function _($){a=requestAnimationFrame(_),$-s>=o&&i()}return a=requestAnimationFrame(_),()=>cancelAnimationFrame(a)}function warn$1(...i){i.length===1?i[0]:i[1],i.length===2&&i[0]}function ensure(i,o){if(i==null)throw new Error(o())}function ensureProps(i,o,s){let a=[];for(const _ of o)i[_]==null&&a.push(_);if(a.length>0)throw new Error(`[zag-js${` > ${s}`}] missing required props: ${a.join(", ")}`)}var clsx=(...i)=>i.map(o=>{var s;return(s=o==null?void 0:o.trim)==null?void 0:s.call(o)}).filter(Boolean).join(" "),CSS_REGEX=/((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g,serialize=i=>{const o={};let s;for(;s=CSS_REGEX.exec(i);)o[s[1]]=s[2];return o},css$1=(i,o)=>{if(isString$2(i)){if(isString$2(o))return`${i};${o}`;i=serialize(i)}else isString$2(o)&&(o=serialize(o));return Object.assign({},i??{},o??{})};function mergeProps(...i){let o={};for(let s of i){for(let a in o){if(a.startsWith("on")&&typeof o[a]=="function"&&typeof s[a]=="function"){o[a]=callAll(s[a],o[a]);continue}if(a==="className"||a==="class"){o[a]=clsx(o[a],s[a]);continue}if(a==="style"){o[a]=css$1(o[a],s[a]);continue}o[a]=s[a]!==void 0?s[a]:o[a]}for(let a in s)o[a]===void 0&&(o[a]=s[a])}return o}function memo$2(i,o,s){let a=[],_;return $=>{const _e=i($);return(_e.length!==a.length||_e.some((st,it)=>!isEqual(a[it],st)))&&(a=_e,_=o(..._e)),_}}function createGuards(){return{and:(...i)=>function(s){return i.every(a=>s.guard(a))},or:(...i)=>function(s){return i.some(a=>s.guard(a))},not:i=>function(s){return!s.guard(i)}}}function createMachine$1(i){return i}function setup(){return{guards:createGuards(),createMachine:i=>i,choose:i=>function({choose:s}){var a;return(a=s(i))==null?void 0:a.actions}}}var MachineStatus=(i=>(i.NotStarted="Not Started",i.Started="Started",i.Stopped="Stopped",i))(MachineStatus||{}),INIT_STATE="__init__";function createScope(i){const o=()=>{var tt;return((tt=i.getRootNode)==null?void 0:tt.call(i))??document},s=()=>getDocument(o()),a=()=>s().defaultView??window,_=()=>getActiveElement(o());return{...i,getRootNode:o,getDoc:s,getWin:a,getActiveElement:_,isActiveElement:tt=>tt===_(),getById:tt=>o().getElementById(tt)}}function getRef(i){var a,_;let o=(a=Object.getOwnPropertyDescriptor(i.props,"ref"))==null?void 0:a.get,s=o&&"isReactWarning"in o&&o.isReactWarning;return s?i.ref:(o=(_=Object.getOwnPropertyDescriptor(i,"ref"))==null?void 0:_.get,s=o&&"isReactWarning"in o&&o.isReactWarning,s?i.props.ref:i.props.ref||i.ref)}const withAsChild=i=>{const o=reactExports.memo(reactExports.forwardRef((s,a)=>{const{asChild:_,children:$,..._e}=s;if(!_)return reactExports.createElement(i,{..._e,ref:a},$);const tt=reactExports.Children.only($);if(!reactExports.isValidElement(tt))return null;const st=getRef(tt);return reactExports.cloneElement(tt,{...mergeProps(_e,tt.props),ref:a?composeRefs(a,st):st})}));return o.displayName=i.displayName||i.name,o},jsxFactory=()=>{const i=new Map;return new Proxy(withAsChild,{apply(o,s,a){return withAsChild(a[0])},get(o,s){const a=s;return i.has(a)||i.set(a,withAsChild(a)),i.get(a)}})},ark=jsxFactory(),createSplitProps=()=>(i,o)=>o.reduce((s,a)=>{const[_,$]=s,_e=a;return $[_e]!==void 0&&(_[_e]=$[_e]),delete $[_e],[_,$]},[{},{...i}]),splitPresenceProps=i=>createSplitProps()(i,["immediate","lazyMount","onExitComplete","present","skipAnimationOnMount","unmountOnExit"]);function createNormalizer(i){return new Proxy({},{get(o,s){return s==="style"?a=>i({style:a}).style:i}})}var createProps$1=()=>i=>Array.from(new Set(i));function connect$9(i,o){const{state:s,send:a,context:_}=i,$=s.matches("mounted","unmountSuspended");return{skip:!_.get("initial"),present:$,setNode(_e){_e&&a({type:"NODE.SET",node:_e})},unmount(){a({type:"UNMOUNT"})}}}var machine$9={props({props:i}){return{...i,present:!!i.present}},initialState({prop:i}){return i("present")?"mounted":"unmounted"},refs(){return{node:null,styles:null}},context({bindable:i}){return{unmountAnimationName:i(()=>({defaultValue:null})),prevAnimationName:i(()=>({defaultValue:null})),present:i(()=>({defaultValue:!1})),initial:i(()=>({sync:!0,defaultValue:!1}))}},exit:["clearInitial","cleanupNode"],watch({track:i,action:o,prop:s}){i([()=>s("present")],()=>{o(["setInitial","syncPresence"])})},on:{"NODE.SET":{actions:["setNode","setStyles"]}},states:{mounted:{on:{UNMOUNT:{target:"unmounted",actions:["clearPrevAnimationName","invokeOnExitComplete"]},"UNMOUNT.SUSPEND":{target:"unmountSuspended"}}},unmountSuspended:{effects:["trackAnimationEvents"],on:{MOUNT:{target:"mounted",actions:["setPrevAnimationName"]},UNMOUNT:{target:"unmounted",actions:["clearPrevAnimationName","invokeOnExitComplete"]}}},unmounted:{on:{MOUNT:{target:"mounted",actions:["setPrevAnimationName"]}}}},implementations:{actions:{setInitial:({context:i})=>{i.get("initial")||queueMicrotask(()=>{i.set("initial",!0)})},clearInitial:({context:i})=>{i.set("initial",!1)},cleanupNode:({refs:i})=>{i.set("node",null),i.set("styles",null)},invokeOnExitComplete:({prop:i})=>{var o;(o=i("onExitComplete"))==null||o()},setNode:({refs:i,event:o})=>{i.set("node",o.node)},setStyles:({refs:i,event:o})=>{i.set("styles",getComputedStyle$2(o.node))},syncPresence:({context:i,refs:o,send:s,prop:a})=>{const _=a("present");if(_)return s({type:"MOUNT",src:"presence.changed"});const $=o.get("node");if(!_&&($==null?void 0:$.ownerDocument.visibilityState)==="hidden")return s({type:"UNMOUNT",src:"visibilitychange"});raf$1(()=>{var tt,st;const _e=getAnimationName(o.get("styles"));i.set("unmountAnimationName",_e),_e==="none"||_e===i.get("prevAnimationName")||((tt=o.get("styles"))==null?void 0:tt.display)==="none"||((st=o.get("styles"))==null?void 0:st.animationDuration)==="0s"?s({type:"UNMOUNT",src:"presence.changed"}):s({type:"UNMOUNT.SUSPEND"})})},setPrevAnimationName:({context:i,refs:o})=>{raf$1(()=>{i.set("prevAnimationName",getAnimationName(o.get("styles")))})},clearPrevAnimationName:({context:i})=>{i.set("prevAnimationName",null)}},effects:{trackAnimationEvents:({context:i,refs:o,send:s})=>{const a=o.get("node");if(!a)return;const _=tt=>{var it,nt;(((nt=(it=tt.composedPath)==null?void 0:it.call(tt))==null?void 0:nt[0])??tt.target)===a&&i.set("prevAnimationName",getAnimationName(o.get("styles")))},$=tt=>{const st=getAnimationName(o.get("styles"));getEventTarget(tt)===a&&st===i.get("unmountAnimationName")&&s({type:"UNMOUNT",src:"animationend"})};a.addEventListener("animationstart",_),a.addEventListener("animationcancel",$),a.addEventListener("animationend",$);const _e=setStyle(a,{animationFillMode:"forwards"});return()=>{a.removeEventListener("animationstart",_),a.removeEventListener("animationcancel",$),a.removeEventListener("animationend",$),nextTick(()=>_e())}}}}};function getAnimationName(i){return(i==null?void 0:i.animationName)||"none"}createProps$1()(["onExitComplete","present","immediate"]);var useSafeLayoutEffect$1=typeof globalThis.document<"u"?reactExports.useLayoutEffect:reactExports.useEffect;function useBindable(i){const o=i().value??i().defaultValue,s=i().isEqual??Object.is,[a]=reactExports.useState(o),[_,$]=reactExports.useState(a),_e=i().value!==void 0,tt=reactExports.useRef(_);tt.current=_e?i().value:_;const st=reactExports.useRef(tt.current);useSafeLayoutEffect$1(()=>{st.current=tt.current},[_,i().value]);const it=et=>{var ot,at;const j=st.current,rt=isFunction$1(et)?et(j):et;i().debug&&console.log(`[bindable > ${i().debug}] setValue`,{next:rt,prev:j}),_e||$(rt),s(rt,j)||(at=(ot=i()).onChange)==null||at.call(ot,rt,j)};function nt(){return _e?i().value:_}return{initial:a,ref:tt,get:nt,set(et){(i().sync?reactDomExports.flushSync:identity$2)(()=>it(et))},invoke(et,j){var rt,ot;(ot=(rt=i()).onChange)==null||ot.call(rt,et,j)},hash(et){var j,rt;return((rt=(j=i()).hash)==null?void 0:rt.call(j,et))??String(et)}}}useBindable.cleanup=i=>{reactExports.useEffect(()=>i,[])};useBindable.ref=i=>{const o=reactExports.useRef(i);return{get:()=>o.current,set:s=>{o.current=s}}};function useRefs(i){const o=reactExports.useRef(i);return{get(s){return o.current[s]},set(s,a){o.current[s]=a}}}var useTrack=(i,o)=>{const s=reactExports.useRef(!1),a=reactExports.useRef(!1);reactExports.useEffect(()=>{if(s.current&&a.current)return o();a.current=!0},[...(i??[]).map(_=>typeof _=="function"?_():_)]),reactExports.useEffect(()=>(s.current=!0,()=>{s.current=!1}),[])};function useMachine(i,o={}){var wt,Ct,kt,It;const s=reactExports.useMemo(()=>{const{id:Pt,ids:St,getRootNode:Rt}=o;return createScope({id:Pt,ids:St,getRootNode:Rt})},[o]),a=(...Pt)=>{i.debug&&console.log(...Pt)},_=((wt=i.props)==null?void 0:wt.call(i,{props:compact(o),scope:s}))??o,$=useProp(_),_e=(Ct=i.context)==null?void 0:Ct.call(i,{prop:$,bindable:useBindable,scope:s,flush,getContext(){return st},getComputed(){return ht},getRefs(){return at}}),tt=useLiveRef(_e),st={get(Pt){var St;return(St=tt.current)==null?void 0:St[Pt].ref.current},set(Pt,St){var Rt;(Rt=tt.current)==null||Rt[Pt].set(St)},initial(Pt){var St;return(St=tt.current)==null?void 0:St[Pt].initial},hash(Pt){var Rt,At;const St=(Rt=tt.current)==null?void 0:Rt[Pt].get();return(At=tt.current)==null?void 0:At[Pt].hash(St)}},it=reactExports.useRef(new Map),nt=reactExports.useRef(null),et=reactExports.useRef(null),j=reactExports.useRef({type:""}),rt=()=>({...j.current,current(){return j.current},previous(){return et.current}}),ot=()=>({...bt,matches(...Pt){return Pt.includes(bt.ref.current)},hasTag(Pt){var St,Rt;return!!((Rt=(St=i.states[bt.ref.current])==null?void 0:St.tags)!=null&&Rt.includes(Pt))}}),at=useRefs(((kt=i.refs)==null?void 0:kt.call(i,{prop:$,context:st}))??{}),lt=()=>({state:ot(),context:st,event:rt(),prop:$,send:vt,action:ut,guard:ct,track:useTrack,refs:at,computed:ht,flush,scope:s,choose:ft}),ut=Pt=>{const St=isFunction$1(Pt)?Pt(lt()):Pt;if(!St)return;const Rt=St.map(At=>{var jt,Yt;const Mt=(Yt=(jt=i.implementations)==null?void 0:jt.actions)==null?void 0:Yt[At];return Mt||warn$1(`[zag-js] No implementation found for action "${JSON.stringify(At)}"`),Mt});for(const At of Rt)At==null||At(lt())},ct=Pt=>{var St,Rt;return isFunction$1(Pt)?Pt(lt()):(Rt=(St=i.implementations)==null?void 0:St.guards)==null?void 0:Rt[Pt](lt())},dt=Pt=>{const St=isFunction$1(Pt)?Pt(lt()):Pt;if(!St)return;const Rt=St.map(Mt=>{var Yt,Kt;const jt=(Kt=(Yt=i.implementations)==null?void 0:Yt.effects)==null?void 0:Kt[Mt];return jt||warn$1(`[zag-js] No implementation found for effect "${JSON.stringify(Mt)}"`),jt}),At=[];for(const Mt of Rt){const jt=Mt==null?void 0:Mt(lt());jt&&At.push(jt)}return()=>At.forEach(Mt=>Mt==null?void 0:Mt())},ft=Pt=>toArray(Pt).find(St=>{let Rt=!St.guard;return isString$2(St.guard)?Rt=!!ct(St.guard):isFunction$1(St.guard)&&(Rt=St.guard(lt())),Rt}),ht=Pt=>{ensure(i.computed,()=>"[zag-js] No computed object found on machine");const St=i.computed[Pt];return St({context:st,event:rt(),prop:$,refs:at,scope:s,computed:ht})},bt=useBindable(()=>({defaultValue:i.initialState({prop:$}),onChange(Pt,St){var At,Mt,jt,Yt;if(St){const Kt=it.current.get(St);Kt==null||Kt(),it.current.delete(St)}St&&ut((At=i.states[St])==null?void 0:At.exit),ut((Mt=nt.current)==null?void 0:Mt.actions);const Rt=dt((jt=i.states[Pt])==null?void 0:jt.effects);if(Rt&&it.current.set(Pt,Rt),St===INIT_STATE){ut(i.entry);const Kt=dt(i.effects);Kt&&it.current.set(INIT_STATE,Kt)}ut((Yt=i.states[Pt])==null?void 0:Yt.entry)}})),yt=reactExports.useRef(void 0),mt=reactExports.useRef(MachineStatus.NotStarted);useSafeLayoutEffect$1(()=>{queueMicrotask(()=>{const Rt=mt.current===MachineStatus.Started;mt.current=MachineStatus.Started,a(Rt?"rehydrating...":"initializing...");const At=yt.current??bt.initial;bt.invoke(At,Rt?bt.get():INIT_STATE)});const Pt=it.current,St=bt.ref.current;return()=>{a("unmounting..."),yt.current=St,mt.current=MachineStatus.Stopped,Pt.forEach(Rt=>Rt==null?void 0:Rt()),it.current=new Map,nt.current=null,queueMicrotask(()=>{ut(i.exit)})}},[]);const gt=()=>"ref"in bt?bt.ref.current:bt.get(),vt=Pt=>{queueMicrotask(()=>{var Yt,Kt;if(mt.current!==MachineStatus.Started)return;et.current=j.current,j.current=Pt,a("send",Pt);let St=gt();const Rt=((Yt=i.states[St].on)==null?void 0:Yt[Pt.type])??((Kt=i.on)==null?void 0:Kt[Pt.type]),At=ft(Rt);if(!At)return;nt.current=At;const Mt=At.target??St;a("transition",At);const jt=Mt!==St;jt?reactDomExports.flushSync(()=>bt.set(Mt)):At.reenter&&!jt?bt.invoke(St,St):ut(At.actions??[])})};return(It=i.watch)==null||It.call(i,lt()),{state:ot(),send:vt,context:st,prop:$,scope:s,refs:at,computed:ht,event:rt(),getStatus:()=>mt.current}}function useLiveRef(i){const o=reactExports.useRef(i);return o.current=i,o}function useProp(i){const o=useLiveRef(i);return function(a){return o.current[a]}}function flush(i){queueMicrotask(()=>{reactDomExports.flushSync(()=>i())})}var normalizeProps=createNormalizer(i=>i);function useEvent(i,o={}){const{sync:s=!1}=o,a=useLatestRef(i);return reactExports.useCallback((..._)=>{var $;return s?queueMicrotask(()=>{var _e;return(_e=a.current)==null?void 0:_e.call(a,..._)}):($=a.current)==null?void 0:$.call(a,..._)},[s,a])}function useLatestRef(i){const o=reactExports.useRef(i);return o.current=i,o}const usePresence=(i={})=>{const{lazyMount:o,unmountOnExit:s,present:a,skipAnimationOnMount:_=!1,...$}=i,_e=reactExports.useRef(!1),tt={...$,present:a,onExitComplete:useEvent(i.onExitComplete)},st=useMachine(machine$9,tt),it=connect$9(st);it.present&&(_e.current=!0);const nt=!it.present&&!_e.current&&o||s&&!it.present&&_e.current,et=()=>({"data-state":it.skip&&_?void 0:a?"open":"closed",hidden:!it.present});return{ref:it.setNode,getPresenceProps:et,present:it.present,unmounted:nt}},[PresenceProvider,usePresenceContext]=createContext({name:"PresenceContext",hookName:"usePresenceContext",providerName:""});function useSlotRecipe(i){const{key:o,recipe:s}=i,a=useChakraContext();return reactExports.useMemo(()=>{const _=s||(o!=null?a.getSlotRecipe(o):{});return a.sva(structuredClone(_))},[o,s,a])}const upperFirst=i=>i.charAt(0).toUpperCase()+i.slice(1),createSlotRecipeContext=i=>{const{key:o,recipe:s}=i,a=upperFirst(o||s.className||"Component"),[_,$]=createContext$1({name:`${a}StylesContext`,errorMessage:`use${a}Styles returned is 'undefined'. Seems you forgot to wrap the components in "<${a}.Root />" `}),[_e,tt]=createContext$1({name:`${a}ClassNameContext`,errorMessage:`use${a}ClassNames returned is 'undefined'. Seems you forgot to wrap the components in "<${a}.Root />" `,strict:!1}),[st,it]=createContext$1({strict:!1,name:`${a}PropsContext`,providerName:`${a}PropsContext`,defaultValue:{}});function nt(ot){const{unstyled:at,...lt}=ot,ut=useSlotRecipe({key:o,recipe:lt.recipe||s}),[ct,dt]=reactExports.useMemo(()=>ut.splitVariantProps(lt),[lt,ut]);return{styles:reactExports.useMemo(()=>at?EMPTY_SLOT_STYLES:ut(ct),[at,ct,ut]),classNames:ut.classNameMap,props:dt}}function et(ot,at={}){const{defaultProps:lt}=at,ut=ct=>{const dt=it(),ft=reactExports.useMemo(()=>mergeProps$1(lt,dt,ct),[dt,ct]),{styles:ht,classNames:bt,props:yt}=nt(ft);return jsxRuntimeExports.jsx(_,{value:ht,children:jsxRuntimeExports.jsx(_e,{value:bt,children:jsxRuntimeExports.jsx(ot,{...yt})})})};return ut.displayName=ot.displayName||ot.name,ut}return{StylesProvider:_,ClassNamesProvider:_e,PropsProvider:st,usePropsContext:it,useRecipeResult:nt,withProvider:(ot,at,lt)=>{const{defaultProps:ut,...ct}=lt??{},dt=chakra(ot,{},ct),ft=reactExports.forwardRef((ht,bt)=>{var It;const yt=it(),mt=reactExports.useMemo(()=>mergeProps$1(ut??{},yt,ht),[yt,ht]),{styles:gt,props:vt,classNames:wt}=nt(mt),Ct=wt[at],kt=jsxRuntimeExports.jsx(_,{value:gt,children:jsxRuntimeExports.jsx(_e,{value:wt,children:jsxRuntimeExports.jsx(dt,{ref:bt,...vt,css:[gt[at],mt.css],className:cx(mt.className,Ct)})})});return((It=lt==null?void 0:lt.wrapElement)==null?void 0:It.call(lt,kt,mt))??kt});return ft.displayName=ot.displayName||ot.name,ft},withContext:(ot,at,lt)=>{const ut=chakra(ot,{},lt),ct=reactExports.forwardRef((dt,ft)=>{const ht=$(),bt=tt(),yt=bt==null?void 0:bt[at];return jsxRuntimeExports.jsx(ut,{...dt,css:[at?ht[at]:void 0,dt.css],ref:ft,className:cx(dt.className,yt)})});return ct.displayName=ot.displayName||ot.name,ct},withRootProvider:et,useStyles:$,useClassNames:tt}},CheckIcon=i=>jsxRuntimeExports.jsx(chakra.svg,{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...i,children:jsxRuntimeExports.jsx("path",{d:"M20 6 9 17l-5-5"})}),ChevronUpIcon=i=>jsxRuntimeExports.jsx(chakra.svg,{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...i,children:jsxRuntimeExports.jsx("path",{d:"m18 15-6-6-6 6"})}),ChevronDownIcon=i=>jsxRuntimeExports.jsx(chakra.svg,{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...i,children:jsxRuntimeExports.jsx("path",{d:"m6 9 6 6 6-6"})}),CheckCircleIcon=i=>jsxRuntimeExports.jsx(chakra.svg,{stroke:"currentColor",fill:"currentColor",strokeWidth:"0",viewBox:"0 0 24 24",...i,children:jsxRuntimeExports.jsx("path",{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM11.0026 16L6.75999 11.7574L8.17421 10.3431L11.0026 13.1716L16.6595 7.51472L18.0737 8.92893L11.0026 16Z"})}),WarningIcon=i=>jsxRuntimeExports.jsx(chakra.svg,{stroke:"currentColor",fill:"currentColor",strokeWidth:"0",viewBox:"0 0 24 24",...i,children:jsxRuntimeExports.jsx("path",{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM11 15H13V17H11V15ZM11 7H13V13H11V7Z"})}),CloseIcon=i=>jsxRuntimeExports.jsx(chakra.svg,{viewBox:"0 0 24 24",fill:"currentColor",...i,children:jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.7071 6.70711C19.0976 6.31658 19.0976 5.68342 18.7071 5.29289C18.3166 4.90237 17.6834 4.90237 17.2929 5.29289L12 10.5858L6.70711 5.29289C6.31658 4.90237 5.68342 4.90237 5.29289 5.29289C4.90237 5.68342 4.90237 6.31658 5.29289 6.70711L10.5858 12L5.29289 17.2929C4.90237 17.6834 4.90237 18.3166 5.29289 18.7071C5.68342 19.0976 6.31658 19.0976 6.70711 18.7071L12 13.4142L17.2929 18.7071C17.6834 19.0976 18.3166 19.0976 18.7071 18.7071C19.0976 18.3166 19.0976 17.6834 18.7071 17.2929L13.4142 12L18.7071 6.70711Z"})}),CopyIcon=i=>jsxRuntimeExports.jsxs(chakra.svg,{stroke:"currentColor",fill:"none",strokeWidth:"2",viewBox:"0 0 24 24",strokeLinecap:"round",strokeLinejoin:"round",...i,children:[jsxRuntimeExports.jsx("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),jsxRuntimeExports.jsx("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]});function useCallbackRef(i,o=[]){const s=reactExports.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return reactExports.useInsertionEffect(()=>{s.current=i}),reactExports.useCallback((...a)=>{var _;return(_=s.current)==null?void 0:_.call(s,...a)},o)}function useDisclosure(i={}){const o=useCallbackRef(i.onOpen),s=useCallbackRef(i.onClose),[a,_]=reactExports.useState(i.defaultOpen||!1),$=i.open!==void 0?i.open:a,_e=i.open!==void 0,tt=reactExports.useCallback(()=>{_e||_(!1),s==null||s()},[_e,s]),st=reactExports.useCallback(()=>{_e||_(!0),o==null||o()},[_e,o]),it=reactExports.useCallback(()=>{$?tt():st()},[$,st,tt]);return{open:$,onOpen:st,onClose:tt,onToggle:it,setOpen:_}}var createAnatomy=(i,o=[])=>({parts:(...s)=>{if(isEmpty(o))return createAnatomy(i,s);throw new Error("createAnatomy().parts(...) should only be called once. Did you mean to use .extendWith(...) ?")},extendWith:(...s)=>createAnatomy(i,[...o,...s]),rename:s=>createAnatomy(s,o),keys:()=>o,build:()=>[...new Set(o)].reduce((s,a)=>Object.assign(s,{[a]:{selector:[`&[data-scope="${toKebabCase(i)}"][data-part="${toKebabCase(a)}"]`,`& [data-scope="${toKebabCase(i)}"][data-part="${toKebabCase(a)}"]`].join(", "),attrs:{"data-scope":toKebabCase(i),"data-part":toKebabCase(a)}}}),{})}),toKebabCase=i=>i.replace(/([A-Z])([A-Z])/g,"$1-$2").replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase(),isEmpty=i=>i.length===0,anatomy$n=createAnatomy("collapsible").parts("root","trigger","content","indicator");anatomy$n.build();createProps$1()(["dir","disabled","getRootNode","id","ids","onExitComplete","onOpenChange","defaultOpen","open"]);const[EnvironmentContextProvider,useEnvironmentContext]=createContext({name:"EnvironmentContext",hookName:"useEnvironmentContext",providerName:"",strict:!1,defaultValue:{getRootNode:()=>document,getDocument:()=>document,getWindow:()=>window}}),sides=["top","right","bottom","left"],min=Math.min,max=Math.max,round=Math.round,floor=Math.floor,createCoords=i=>({x:i,y:i}),oppositeSideMap={left:"right",right:"left",bottom:"top",top:"bottom"},oppositeAlignmentMap={start:"end",end:"start"};function clamp(i,o,s){return max(i,min(o,s))}function evaluate(i,o){return typeof i=="function"?i(o):i}function getSide(i){return i.split("-")[0]}function getAlignment(i){return i.split("-")[1]}function getOppositeAxis(i){return i==="x"?"y":"x"}function getAxisLength(i){return i==="y"?"height":"width"}function getSideAxis(i){return["top","bottom"].includes(getSide(i))?"y":"x"}function getAlignmentAxis(i){return getOppositeAxis(getSideAxis(i))}function getAlignmentSides(i,o,s){s===void 0&&(s=!1);const a=getAlignment(i),_=getAlignmentAxis(i),$=getAxisLength(_);let _e=_==="x"?a===(s?"end":"start")?"right":"left":a==="start"?"bottom":"top";return o.reference[$]>o.floating[$]&&(_e=getOppositePlacement(_e)),[_e,getOppositePlacement(_e)]}function getExpandedPlacements(i){const o=getOppositePlacement(i);return[getOppositeAlignmentPlacement(i),o,getOppositeAlignmentPlacement(o)]}function getOppositeAlignmentPlacement(i){return i.replace(/start|end/g,o=>oppositeAlignmentMap[o])}function getSideList(i,o,s){const a=["left","right"],_=["right","left"],$=["top","bottom"],_e=["bottom","top"];switch(i){case"top":case"bottom":return s?o?_:a:o?a:_;case"left":case"right":return o?$:_e;default:return[]}}function getOppositeAxisPlacements(i,o,s,a){const _=getAlignment(i);let $=getSideList(getSide(i),s==="start",a);return _&&($=$.map(_e=>_e+"-"+_),o&&($=$.concat($.map(getOppositeAlignmentPlacement)))),$}function getOppositePlacement(i){return i.replace(/left|right|bottom|top/g,o=>oppositeSideMap[o])}function expandPaddingObject(i){return{top:0,right:0,bottom:0,left:0,...i}}function getPaddingObject(i){return typeof i!="number"?expandPaddingObject(i):{top:i,right:i,bottom:i,left:i}}function rectToClientRect(i){const{x:o,y:s,width:a,height:_}=i;return{width:a,height:_,top:s,left:o,right:o+a,bottom:s+_,x:o,y:s}}function computeCoordsFromPlacement(i,o,s){let{reference:a,floating:_}=i;const $=getSideAxis(o),_e=getAlignmentAxis(o),tt=getAxisLength(_e),st=getSide(o),it=$==="y",nt=a.x+a.width/2-_.width/2,et=a.y+a.height/2-_.height/2,j=a[tt]/2-_[tt]/2;let rt;switch(st){case"top":rt={x:nt,y:a.y-_.height};break;case"bottom":rt={x:nt,y:a.y+a.height};break;case"right":rt={x:a.x+a.width,y:et};break;case"left":rt={x:a.x-_.width,y:et};break;default:rt={x:a.x,y:a.y}}switch(getAlignment(o)){case"start":rt[_e]-=j*(s&&it?-1:1);break;case"end":rt[_e]+=j*(s&&it?-1:1);break}return rt}const computePosition$1=async(i,o,s)=>{const{placement:a="bottom",strategy:_="absolute",middleware:$=[],platform:_e}=s,tt=$.filter(Boolean),st=await(_e.isRTL==null?void 0:_e.isRTL(o));let it=await _e.getElementRects({reference:i,floating:o,strategy:_}),{x:nt,y:et}=computeCoordsFromPlacement(it,a,st),j=a,rt={},ot=0;for(let at=0;at({name:"arrow",options:i,async fn(o){const{x:s,y:a,placement:_,rects:$,platform:_e,elements:tt,middlewareData:st}=o,{element:it,padding:nt=0}=evaluate(i,o)||{};if(it==null)return{};const et=getPaddingObject(nt),j={x:s,y:a},rt=getAlignmentAxis(_),ot=getAxisLength(rt),at=await _e.getDimensions(it),lt=rt==="y",ut=lt?"top":"left",ct=lt?"bottom":"right",dt=lt?"clientHeight":"clientWidth",ft=$.reference[ot]+$.reference[rt]-j[rt]-$.floating[ot],ht=j[rt]-$.reference[rt],bt=await(_e.getOffsetParent==null?void 0:_e.getOffsetParent(it));let yt=bt?bt[dt]:0;(!yt||!await(_e.isElement==null?void 0:_e.isElement(bt)))&&(yt=tt.floating[dt]||$.floating[ot]);const mt=ft/2-ht/2,gt=yt/2-at[ot]/2-1,vt=min(et[ut],gt),wt=min(et[ct],gt),Ct=vt,kt=yt-at[ot]-wt,It=yt/2-at[ot]/2+mt,Pt=clamp(Ct,It,kt),St=!st.arrow&&getAlignment(_)!=null&&It!==Pt&&$.reference[ot]/2-(ItIt<=0)){var wt,Ct;const It=(((wt=$.flip)==null?void 0:wt.index)||0)+1,Pt=yt[It];if(Pt)return{data:{index:It,overflows:vt},reset:{placement:Pt}};let St=(Ct=vt.filter(Rt=>Rt.overflows[0]<=0).sort((Rt,At)=>Rt.overflows[1]-At.overflows[1])[0])==null?void 0:Ct.placement;if(!St)switch(rt){case"bestFit":{var kt;const Rt=(kt=vt.filter(At=>{if(bt){const Mt=getSideAxis(At.placement);return Mt===ct||Mt==="y"}return!0}).map(At=>[At.placement,At.overflows.filter(Mt=>Mt>0).reduce((Mt,jt)=>Mt+jt,0)]).sort((At,Mt)=>At[1]-Mt[1])[0])==null?void 0:kt[0];Rt&&(St=Rt);break}case"initialPlacement":St=tt;break}if(_!==St)return{reset:{placement:St}}}return{}}}};function getSideOffsets(i,o){return{top:i.top-o.height,right:i.right-o.width,bottom:i.bottom-o.height,left:i.left-o.width}}function isAnySideFullyClipped(i){return sides.some(o=>i[o]>=0)}const hide$1=function(i){return i===void 0&&(i={}),{name:"hide",options:i,async fn(o){const{rects:s}=o,{strategy:a="referenceHidden",..._}=evaluate(i,o);switch(a){case"referenceHidden":{const $=await detectOverflow(o,{..._,elementContext:"reference"}),_e=getSideOffsets($,s.reference);return{data:{referenceHiddenOffsets:_e,referenceHidden:isAnySideFullyClipped(_e)}}}case"escaped":{const $=await detectOverflow(o,{..._,altBoundary:!0}),_e=getSideOffsets($,s.floating);return{data:{escapedOffsets:_e,escaped:isAnySideFullyClipped(_e)}}}default:return{}}}}};async function convertValueToCoords(i,o){const{placement:s,platform:a,elements:_}=i,$=await(a.isRTL==null?void 0:a.isRTL(_.floating)),_e=getSide(s),tt=getAlignment(s),st=getSideAxis(s)==="y",it=["left","top"].includes(_e)?-1:1,nt=$&&st?-1:1,et=evaluate(o,i);let{mainAxis:j,crossAxis:rt,alignmentAxis:ot}=typeof et=="number"?{mainAxis:et,crossAxis:0,alignmentAxis:null}:{mainAxis:et.mainAxis||0,crossAxis:et.crossAxis||0,alignmentAxis:et.alignmentAxis};return tt&&typeof ot=="number"&&(rt=tt==="end"?ot*-1:ot),st?{x:rt*nt,y:j*it}:{x:j*it,y:rt*nt}}const offset$1=function(i){return i===void 0&&(i=0),{name:"offset",options:i,async fn(o){var s,a;const{x:_,y:$,placement:_e,middlewareData:tt}=o,st=await convertValueToCoords(o,i);return _e===((s=tt.offset)==null?void 0:s.placement)&&(a=tt.arrow)!=null&&a.alignmentOffset?{}:{x:_+st.x,y:$+st.y,data:{...st,placement:_e}}}}},shift$1=function(i){return i===void 0&&(i={}),{name:"shift",options:i,async fn(o){const{x:s,y:a,placement:_}=o,{mainAxis:$=!0,crossAxis:_e=!1,limiter:tt={fn:lt=>{let{x:ut,y:ct}=lt;return{x:ut,y:ct}}},...st}=evaluate(i,o),it={x:s,y:a},nt=await detectOverflow(o,st),et=getSideAxis(getSide(_)),j=getOppositeAxis(et);let rt=it[j],ot=it[et];if($){const lt=j==="y"?"top":"left",ut=j==="y"?"bottom":"right",ct=rt+nt[lt],dt=rt-nt[ut];rt=clamp(ct,rt,dt)}if(_e){const lt=et==="y"?"top":"left",ut=et==="y"?"bottom":"right",ct=ot+nt[lt],dt=ot-nt[ut];ot=clamp(ct,ot,dt)}const at=tt.fn({...o,[j]:rt,[et]:ot});return{...at,data:{x:at.x-s,y:at.y-a,enabled:{[j]:$,[et]:_e}}}}}},limitShift$1=function(i){return i===void 0&&(i={}),{options:i,fn(o){const{x:s,y:a,placement:_,rects:$,middlewareData:_e}=o,{offset:tt=0,mainAxis:st=!0,crossAxis:it=!0}=evaluate(i,o),nt={x:s,y:a},et=getSideAxis(_),j=getOppositeAxis(et);let rt=nt[j],ot=nt[et];const at=evaluate(tt,o),lt=typeof at=="number"?{mainAxis:at,crossAxis:0}:{mainAxis:0,crossAxis:0,...at};if(st){const dt=j==="y"?"height":"width",ft=$.reference[j]-$.floating[dt]+lt.mainAxis,ht=$.reference[j]+$.reference[dt]-lt.mainAxis;rtht&&(rt=ht)}if(it){var ut,ct;const dt=j==="y"?"width":"height",ft=["top","left"].includes(getSide(_)),ht=$.reference[et]-$.floating[dt]+(ft&&((ut=_e.offset)==null?void 0:ut[et])||0)+(ft?0:lt.crossAxis),bt=$.reference[et]+$.reference[dt]+(ft?0:((ct=_e.offset)==null?void 0:ct[et])||0)-(ft?lt.crossAxis:0);otbt&&(ot=bt)}return{[j]:rt,[et]:ot}}}},size$1=function(i){return i===void 0&&(i={}),{name:"size",options:i,async fn(o){var s,a;const{placement:_,rects:$,platform:_e,elements:tt}=o,{apply:st=()=>{},...it}=evaluate(i,o),nt=await detectOverflow(o,it),et=getSide(_),j=getAlignment(_),rt=getSideAxis(_)==="y",{width:ot,height:at}=$.floating;let lt,ut;et==="top"||et==="bottom"?(lt=et,ut=j===(await(_e.isRTL==null?void 0:_e.isRTL(tt.floating))?"start":"end")?"left":"right"):(ut=et,lt=j==="end"?"top":"bottom");const ct=at-nt.top-nt.bottom,dt=ot-nt.left-nt.right,ft=min(at-nt[lt],ct),ht=min(ot-nt[ut],dt),bt=!o.middlewareData.shift;let yt=ft,mt=ht;if((s=o.middlewareData.shift)!=null&&s.enabled.x&&(mt=dt),(a=o.middlewareData.shift)!=null&&a.enabled.y&&(yt=ct),bt&&!j){const vt=max(nt.left,0),wt=max(nt.right,0),Ct=max(nt.top,0),kt=max(nt.bottom,0);rt?mt=ot-2*(vt!==0||wt!==0?vt+wt:max(nt.left,nt.right)):yt=at-2*(Ct!==0||kt!==0?Ct+kt:max(nt.top,nt.bottom))}await st({...o,availableWidth:mt,availableHeight:yt});const gt=await _e.getDimensions(tt.floating);return ot!==gt.width||at!==gt.height?{reset:{rects:!0}}:{}}}};function hasWindow(){return typeof window<"u"}function getNodeName(i){return isNode$1(i)?(i.nodeName||"").toLowerCase():"#document"}function getWindow(i){var o;return(i==null||(o=i.ownerDocument)==null?void 0:o.defaultView)||window}function getDocumentElement(i){var o;return(o=(isNode$1(i)?i.ownerDocument:i.document)||window.document)==null?void 0:o.documentElement}function isNode$1(i){return hasWindow()?i instanceof Node||i instanceof getWindow(i).Node:!1}function isElement$1(i){return hasWindow()?i instanceof Element||i instanceof getWindow(i).Element:!1}function isHTMLElement(i){return hasWindow()?i instanceof HTMLElement||i instanceof getWindow(i).HTMLElement:!1}function isShadowRoot(i){return!hasWindow()||typeof ShadowRoot>"u"?!1:i instanceof ShadowRoot||i instanceof getWindow(i).ShadowRoot}function isOverflowElement(i){const{overflow:o,overflowX:s,overflowY:a,display:_}=getComputedStyle$1(i);return/auto|scroll|overlay|hidden|clip/.test(o+a+s)&&!["inline","contents"].includes(_)}function isTableElement(i){return["table","td","th"].includes(getNodeName(i))}function isTopLayer(i){return[":popover-open",":modal"].some(o=>{try{return i.matches(o)}catch{return!1}})}function isContainingBlock(i){const o=isWebKit(),s=isElement$1(i)?getComputedStyle$1(i):i;return["transform","translate","scale","rotate","perspective"].some(a=>s[a]?s[a]!=="none":!1)||(s.containerType?s.containerType!=="normal":!1)||!o&&(s.backdropFilter?s.backdropFilter!=="none":!1)||!o&&(s.filter?s.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(a=>(s.willChange||"").includes(a))||["paint","layout","strict","content"].some(a=>(s.contain||"").includes(a))}function getContainingBlock(i){let o=getParentNode$1(i);for(;isHTMLElement(o)&&!isLastTraversableNode(o);){if(isContainingBlock(o))return o;if(isTopLayer(o))return null;o=getParentNode$1(o)}return null}function isWebKit(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function isLastTraversableNode(i){return["html","body","#document"].includes(getNodeName(i))}function getComputedStyle$1(i){return getWindow(i).getComputedStyle(i)}function getNodeScroll(i){return isElement$1(i)?{scrollLeft:i.scrollLeft,scrollTop:i.scrollTop}:{scrollLeft:i.scrollX,scrollTop:i.scrollY}}function getParentNode$1(i){if(getNodeName(i)==="html")return i;const o=i.assignedSlot||i.parentNode||isShadowRoot(i)&&i.host||getDocumentElement(i);return isShadowRoot(o)?o.host:o}function getNearestOverflowAncestor(i){const o=getParentNode$1(i);return isLastTraversableNode(o)?i.ownerDocument?i.ownerDocument.body:i.body:isHTMLElement(o)&&isOverflowElement(o)?o:getNearestOverflowAncestor(o)}function getOverflowAncestors(i,o,s){var a;o===void 0&&(o=[]),s===void 0&&(s=!0);const _=getNearestOverflowAncestor(i),$=_===((a=i.ownerDocument)==null?void 0:a.body),_e=getWindow(_);if($){const tt=getFrameElement(_e);return o.concat(_e,_e.visualViewport||[],isOverflowElement(_)?_:[],tt&&s?getOverflowAncestors(tt):[])}return o.concat(_,getOverflowAncestors(_,[],s))}function getFrameElement(i){return i.parent&&Object.getPrototypeOf(i.parent)?i.frameElement:null}function getCssDimensions(i){const o=getComputedStyle$1(i);let s=parseFloat(o.width)||0,a=parseFloat(o.height)||0;const _=isHTMLElement(i),$=_?i.offsetWidth:s,_e=_?i.offsetHeight:a,tt=round(s)!==$||round(a)!==_e;return tt&&(s=$,a=_e),{width:s,height:a,$:tt}}function unwrapElement(i){return isElement$1(i)?i:i.contextElement}function getScale(i){const o=unwrapElement(i);if(!isHTMLElement(o))return createCoords(1);const s=o.getBoundingClientRect(),{width:a,height:_,$}=getCssDimensions(o);let _e=($?round(s.width):s.width)/a,tt=($?round(s.height):s.height)/_;return(!_e||!Number.isFinite(_e))&&(_e=1),(!tt||!Number.isFinite(tt))&&(tt=1),{x:_e,y:tt}}const noOffsets=createCoords(0);function getVisualOffsets(i){const o=getWindow(i);return!isWebKit()||!o.visualViewport?noOffsets:{x:o.visualViewport.offsetLeft,y:o.visualViewport.offsetTop}}function shouldAddVisualOffsets(i,o,s){return o===void 0&&(o=!1),!s||o&&s!==getWindow(i)?!1:o}function getBoundingClientRect(i,o,s,a){o===void 0&&(o=!1),s===void 0&&(s=!1);const _=i.getBoundingClientRect(),$=unwrapElement(i);let _e=createCoords(1);o&&(a?isElement$1(a)&&(_e=getScale(a)):_e=getScale(i));const tt=shouldAddVisualOffsets($,s,a)?getVisualOffsets($):createCoords(0);let st=(_.left+tt.x)/_e.x,it=(_.top+tt.y)/_e.y,nt=_.width/_e.x,et=_.height/_e.y;if($){const j=getWindow($),rt=a&&isElement$1(a)?getWindow(a):a;let ot=j,at=getFrameElement(ot);for(;at&&a&&rt!==ot;){const lt=getScale(at),ut=at.getBoundingClientRect(),ct=getComputedStyle$1(at),dt=ut.left+(at.clientLeft+parseFloat(ct.paddingLeft))*lt.x,ft=ut.top+(at.clientTop+parseFloat(ct.paddingTop))*lt.y;st*=lt.x,it*=lt.y,nt*=lt.x,et*=lt.y,st+=dt,it+=ft,ot=getWindow(at),at=getFrameElement(ot)}}return rectToClientRect({width:nt,height:et,x:st,y:it})}function getWindowScrollBarX(i,o){const s=getNodeScroll(i).scrollLeft;return o?o.left+s:getBoundingClientRect(getDocumentElement(i)).left+s}function getHTMLOffset(i,o,s){s===void 0&&(s=!1);const a=i.getBoundingClientRect(),_=a.left+o.scrollLeft-(s?0:getWindowScrollBarX(i,a)),$=a.top+o.scrollTop;return{x:_,y:$}}function convertOffsetParentRelativeRectToViewportRelativeRect(i){let{elements:o,rect:s,offsetParent:a,strategy:_}=i;const $=_==="fixed",_e=getDocumentElement(a),tt=o?isTopLayer(o.floating):!1;if(a===_e||tt&&$)return s;let st={scrollLeft:0,scrollTop:0},it=createCoords(1);const nt=createCoords(0),et=isHTMLElement(a);if((et||!et&&!$)&&((getNodeName(a)!=="body"||isOverflowElement(_e))&&(st=getNodeScroll(a)),isHTMLElement(a))){const rt=getBoundingClientRect(a);it=getScale(a),nt.x=rt.x+a.clientLeft,nt.y=rt.y+a.clientTop}const j=_e&&!et&&!$?getHTMLOffset(_e,st,!0):createCoords(0);return{width:s.width*it.x,height:s.height*it.y,x:s.x*it.x-st.scrollLeft*it.x+nt.x+j.x,y:s.y*it.y-st.scrollTop*it.y+nt.y+j.y}}function getClientRects(i){return Array.from(i.getClientRects())}function getDocumentRect(i){const o=getDocumentElement(i),s=getNodeScroll(i),a=i.ownerDocument.body,_=max(o.scrollWidth,o.clientWidth,a.scrollWidth,a.clientWidth),$=max(o.scrollHeight,o.clientHeight,a.scrollHeight,a.clientHeight);let _e=-s.scrollLeft+getWindowScrollBarX(i);const tt=-s.scrollTop;return getComputedStyle$1(a).direction==="rtl"&&(_e+=max(o.clientWidth,a.clientWidth)-_),{width:_,height:$,x:_e,y:tt}}function getViewportRect(i,o){const s=getWindow(i),a=getDocumentElement(i),_=s.visualViewport;let $=a.clientWidth,_e=a.clientHeight,tt=0,st=0;if(_){$=_.width,_e=_.height;const it=isWebKit();(!it||it&&o==="fixed")&&(tt=_.offsetLeft,st=_.offsetTop)}return{width:$,height:_e,x:tt,y:st}}function getInnerBoundingClientRect(i,o){const s=getBoundingClientRect(i,!0,o==="fixed"),a=s.top+i.clientTop,_=s.left+i.clientLeft,$=isHTMLElement(i)?getScale(i):createCoords(1),_e=i.clientWidth*$.x,tt=i.clientHeight*$.y,st=_*$.x,it=a*$.y;return{width:_e,height:tt,x:st,y:it}}function getClientRectFromClippingAncestor(i,o,s){let a;if(o==="viewport")a=getViewportRect(i,s);else if(o==="document")a=getDocumentRect(getDocumentElement(i));else if(isElement$1(o))a=getInnerBoundingClientRect(o,s);else{const _=getVisualOffsets(i);a={x:o.x-_.x,y:o.y-_.y,width:o.width,height:o.height}}return rectToClientRect(a)}function hasFixedPositionAncestor(i,o){const s=getParentNode$1(i);return s===o||!isElement$1(s)||isLastTraversableNode(s)?!1:getComputedStyle$1(s).position==="fixed"||hasFixedPositionAncestor(s,o)}function getClippingElementAncestors(i,o){const s=o.get(i);if(s)return s;let a=getOverflowAncestors(i,[],!1).filter(tt=>isElement$1(tt)&&getNodeName(tt)!=="body"),_=null;const $=getComputedStyle$1(i).position==="fixed";let _e=$?getParentNode$1(i):i;for(;isElement$1(_e)&&!isLastTraversableNode(_e);){const tt=getComputedStyle$1(_e),st=isContainingBlock(_e);!st&&tt.position==="fixed"&&(_=null),($?!st&&!_:!st&&tt.position==="static"&&!!_&&["absolute","fixed"].includes(_.position)||isOverflowElement(_e)&&!st&&hasFixedPositionAncestor(i,_e))?a=a.filter(nt=>nt!==_e):_=tt,_e=getParentNode$1(_e)}return o.set(i,a),a}function getClippingRect(i){let{element:o,boundary:s,rootBoundary:a,strategy:_}=i;const _e=[...s==="clippingAncestors"?isTopLayer(o)?[]:getClippingElementAncestors(o,this._c):[].concat(s),a],tt=_e[0],st=_e.reduce((it,nt)=>{const et=getClientRectFromClippingAncestor(o,nt,_);return it.top=max(et.top,it.top),it.right=min(et.right,it.right),it.bottom=min(et.bottom,it.bottom),it.left=max(et.left,it.left),it},getClientRectFromClippingAncestor(o,tt,_));return{width:st.right-st.left,height:st.bottom-st.top,x:st.left,y:st.top}}function getDimensions(i){const{width:o,height:s}=getCssDimensions(i);return{width:o,height:s}}function getRectRelativeToOffsetParent(i,o,s){const a=isHTMLElement(o),_=getDocumentElement(o),$=s==="fixed",_e=getBoundingClientRect(i,!0,$,o);let tt={scrollLeft:0,scrollTop:0};const st=createCoords(0);if(a||!a&&!$)if((getNodeName(o)!=="body"||isOverflowElement(_))&&(tt=getNodeScroll(o)),a){const j=getBoundingClientRect(o,!0,$,o);st.x=j.x+o.clientLeft,st.y=j.y+o.clientTop}else _&&(st.x=getWindowScrollBarX(_));const it=_&&!a&&!$?getHTMLOffset(_,tt):createCoords(0),nt=_e.left+tt.scrollLeft-st.x-it.x,et=_e.top+tt.scrollTop-st.y-it.y;return{x:nt,y:et,width:_e.width,height:_e.height}}function isStaticPositioned(i){return getComputedStyle$1(i).position==="static"}function getTrueOffsetParent(i,o){if(!isHTMLElement(i)||getComputedStyle$1(i).position==="fixed")return null;if(o)return o(i);let s=i.offsetParent;return getDocumentElement(i)===s&&(s=s.ownerDocument.body),s}function getOffsetParent(i,o){const s=getWindow(i);if(isTopLayer(i))return s;if(!isHTMLElement(i)){let _=getParentNode$1(i);for(;_&&!isLastTraversableNode(_);){if(isElement$1(_)&&!isStaticPositioned(_))return _;_=getParentNode$1(_)}return s}let a=getTrueOffsetParent(i,o);for(;a&&isTableElement(a)&&isStaticPositioned(a);)a=getTrueOffsetParent(a,o);return a&&isLastTraversableNode(a)&&isStaticPositioned(a)&&!isContainingBlock(a)?s:a||getContainingBlock(i)||s}const getElementRects=async function(i){const o=this.getOffsetParent||getOffsetParent,s=this.getDimensions,a=await s(i.floating);return{reference:getRectRelativeToOffsetParent(i.reference,await o(i.floating),i.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function isRTL(i){return getComputedStyle$1(i).direction==="rtl"}const platform={convertOffsetParentRelativeRectToViewportRelativeRect,getDocumentElement,getClippingRect,getOffsetParent,getElementRects,getClientRects,getDimensions,getScale,isElement:isElement$1,isRTL};function rectsAreEqual(i,o){return i.x===o.x&&i.y===o.y&&i.width===o.width&&i.height===o.height}function observeMove(i,o){let s=null,a;const _=getDocumentElement(i);function $(){var tt;clearTimeout(a),(tt=s)==null||tt.disconnect(),s=null}function _e(tt,st){tt===void 0&&(tt=!1),st===void 0&&(st=1),$();const it=i.getBoundingClientRect(),{left:nt,top:et,width:j,height:rt}=it;if(tt||o(),!j||!rt)return;const ot=floor(et),at=floor(_.clientWidth-(nt+j)),lt=floor(_.clientHeight-(et+rt)),ut=floor(nt),dt={rootMargin:-ot+"px "+-at+"px "+-lt+"px "+-ut+"px",threshold:max(0,min(1,st))||1};let ft=!0;function ht(bt){const yt=bt[0].intersectionRatio;if(yt!==st){if(!ft)return _e();yt?_e(!1,yt):a=setTimeout(()=>{_e(!1,1e-7)},1e3)}yt===1&&!rectsAreEqual(it,i.getBoundingClientRect())&&_e(),ft=!1}try{s=new IntersectionObserver(ht,{...dt,root:_.ownerDocument})}catch{s=new IntersectionObserver(ht,dt)}s.observe(i)}return _e(!0),$}function autoUpdate(i,o,s,a){a===void 0&&(a={});const{ancestorScroll:_=!0,ancestorResize:$=!0,elementResize:_e=typeof ResizeObserver=="function",layoutShift:tt=typeof IntersectionObserver=="function",animationFrame:st=!1}=a,it=unwrapElement(i),nt=_||$?[...it?getOverflowAncestors(it):[],...getOverflowAncestors(o)]:[];nt.forEach(ut=>{_&&ut.addEventListener("scroll",s,{passive:!0}),$&&ut.addEventListener("resize",s)});const et=it&&tt?observeMove(it,s):null;let j=-1,rt=null;_e&&(rt=new ResizeObserver(ut=>{let[ct]=ut;ct&&ct.target===it&&rt&&(rt.unobserve(o),cancelAnimationFrame(j),j=requestAnimationFrame(()=>{var dt;(dt=rt)==null||dt.observe(o)})),s()}),it&&!st&&rt.observe(it),rt.observe(o));let ot,at=st?getBoundingClientRect(i):null;st&<();function lt(){const ut=getBoundingClientRect(i);at&&!rectsAreEqual(at,ut)&&s(),at=ut,ot=requestAnimationFrame(lt)}return s(),()=>{var ut;nt.forEach(ct=>{_&&ct.removeEventListener("scroll",s),$&&ct.removeEventListener("resize",s)}),et==null||et(),(ut=rt)==null||ut.disconnect(),rt=null,st&&cancelAnimationFrame(ot)}}const offset=offset$1,shift=shift$1,flip=flip$1,size=size$1,hide=hide$1,arrow=arrow$1,limitShift=limitShift$1,computePosition=(i,o,s)=>{const a=new Map,_={platform,...s},$={..._.platform,_c:a};return computePosition$1(i,o,{..._,platform:$})};function createDOMRect(i=0,o=0,s=0,a=0){if(typeof DOMRect=="function")return new DOMRect(i,o,s,a);const _={x:i,y:o,width:s,height:a,top:o,right:i+s,bottom:o+a,left:i};return{..._,toJSON:()=>_}}function getDOMRect(i){if(!i)return createDOMRect();const{x:o,y:s,width:a,height:_}=i;return createDOMRect(o,s,a,_)}function getAnchorElement(i,o){return{contextElement:isHTMLElement$1(i)?i:void 0,getBoundingClientRect:()=>{const s=i,a=o==null?void 0:o(s);return a||!s?getDOMRect(a):s.getBoundingClientRect()}}}var toVar=i=>({variable:i,reference:`var(${i})`}),cssVars={arrowSize:toVar("--arrow-size"),arrowSizeHalf:toVar("--arrow-size-half"),arrowBg:toVar("--arrow-background"),transformOrigin:toVar("--transform-origin"),arrowOffset:toVar("--arrow-offset")},getTransformOrigin=i=>({top:"bottom center","top-start":i?`${i.x}px bottom`:"left bottom","top-end":i?`${i.x}px bottom`:"right bottom",bottom:"top center","bottom-start":i?`${i.x}px top`:"top left","bottom-end":i?`${i.x}px top`:"top right",left:"right center","left-start":i?`right ${i.y}px`:"right top","left-end":i?`right ${i.y}px`:"right bottom",right:"left center","right-start":i?`left ${i.y}px`:"left top","right-end":i?`left ${i.y}px`:"left bottom"}),transformOriginMiddleware={name:"transformOrigin",fn({placement:i,elements:o,middlewareData:s}){const{arrow:a}=s,_=getTransformOrigin(a)[i],{floating:$}=o;return $.style.setProperty(cssVars.transformOrigin.variable,_),{data:{transformOrigin:_}}}},rectMiddleware={name:"rects",fn({rects:i}){return{data:i}}},shiftArrowMiddleware=i=>{if(i)return{name:"shiftArrow",fn({placement:o,middlewareData:s}){if(!s.arrow)return{};const{x:a,y:_}=s.arrow,$=o.split("-")[0];return Object.assign(i.style,{left:a!=null?`${a}px`:"",top:_!=null?`${_}px`:"",[$]:`calc(100% + ${cssVars.arrowOffset.reference})`}),{}}}};function getPlacementDetails(i){const[o,s]=i.split("-");return{side:o,align:s,hasAlign:s!=null}}function getPlacementSide(i){return i.split("-")[0]}var defaultOptions$3={strategy:"absolute",placement:"bottom",listeners:!0,gutter:8,flip:!0,slide:!0,overlap:!1,sameWidth:!1,fitViewport:!1,overflowPadding:8,arrowPadding:4};function roundByDpr(i,o){const s=i.devicePixelRatio||1;return Math.round(o*s)/s}function getBoundaryMiddleware(i){return runIfFn(i.boundary)}function getArrowMiddleware(i,o){if(i)return arrow({element:i,padding:o.arrowPadding})}function getOffsetMiddleware(i,o){if(!isNull(o.offset??o.gutter))return offset(({placement:s})=>{var it,nt;const a=((i==null?void 0:i.clientHeight)||0)/2,_=((it=o.offset)==null?void 0:it.mainAxis)??o.gutter,$=typeof _=="number"?_+a:_??a,{hasAlign:_e}=getPlacementDetails(s),tt=_e?void 0:o.shift,st=((nt=o.offset)==null?void 0:nt.crossAxis)??tt;return compact({crossAxis:st,mainAxis:$,alignmentAxis:o.shift})})}function getFlipMiddleware(i){if(i.flip)return flip({boundary:getBoundaryMiddleware(i),padding:i.overflowPadding,fallbackPlacements:i.flip===!0?void 0:i.flip})}function getShiftMiddleware(i){if(!(!i.slide&&!i.overlap))return shift({boundary:getBoundaryMiddleware(i),mainAxis:i.slide,crossAxis:i.overlap,padding:i.overflowPadding,limiter:limitShift()})}function getSizeMiddleware(i){return size({padding:i.overflowPadding,apply({elements:o,rects:s,availableHeight:a,availableWidth:_}){const $=o.floating,_e=Math.round(s.reference.width);_=Math.floor(_),a=Math.floor(a),$.style.setProperty("--reference-width",`${_e}px`),$.style.setProperty("--available-width",`${_}px`),$.style.setProperty("--available-height",`${a}px`)}})}function hideWhenDetachedMiddleware(i){var o;if(i.hideWhenDetached)return hide({strategy:"referenceHidden",boundary:((o=i.boundary)==null?void 0:o.call(i))??"clippingAncestors"})}function getAutoUpdateOptions(i){return i?i===!0?{ancestorResize:!0,ancestorScroll:!0,elementResize:!0,layoutShift:!0}:i:{}}function getPlacementImpl(i,o,s={}){const a=getAnchorElement(i,s.getAnchorRect);if(!o||!a)return;const _=Object.assign({},defaultOptions$3,s),$=o.querySelector("[data-part=arrow]"),_e=[getOffsetMiddleware($,_),getFlipMiddleware(_),getShiftMiddleware(_),getArrowMiddleware($,_),shiftArrowMiddleware($),transformOriginMiddleware,getSizeMiddleware(_),hideWhenDetachedMiddleware(_),rectMiddleware],{placement:tt,strategy:st,onComplete:it,onPositioned:nt}=_,et=async()=>{var ft;if(!a||!o)return;const at=await computePosition(a,o,{placement:tt,middleware:_e,strategy:st});it==null||it(at),nt==null||nt({placed:!0});const lt=getWindow$1(o),ut=roundByDpr(lt,at.x),ct=roundByDpr(lt,at.y);o.style.setProperty("--x",`${ut}px`),o.style.setProperty("--y",`${ct}px`),_.hideWhenDetached&&(((ft=at.middlewareData.hide)==null?void 0:ft.referenceHidden)?(o.style.setProperty("visibility","hidden"),o.style.setProperty("pointer-events","none")):(o.style.removeProperty("visibility"),o.style.removeProperty("pointer-events")));const dt=o.firstElementChild;if(dt){const ht=getComputedStyle$2(dt);o.style.setProperty("--z-index",ht.zIndex)}},j=async()=>{s.updatePosition?(await s.updatePosition({updatePosition:et}),nt==null||nt({placed:!0})):await et()},rt=getAutoUpdateOptions(_.listeners),ot=_.listeners?autoUpdate(a,o,j,rt):noop$4;return j(),()=>{ot==null||ot(),nt==null||nt({placed:!1})}}function getPlacement(i,o,s={}){const{defer:a,..._}=s,$=a?raf$1:tt=>tt(),_e=[];return _e.push($(()=>{const tt=typeof i=="function"?i():i,st=typeof o=="function"?o():o;_e.push(getPlacementImpl(tt,st,_))})),()=>{_e.forEach(tt=>tt==null?void 0:tt())}}var ARROW_FLOATING_STYLE={bottom:"rotate(45deg)",left:"rotate(135deg)",top:"rotate(225deg)",right:"rotate(315deg)"};function getPlacementStyles(i={}){const{placement:o,sameWidth:s,fitViewport:a,strategy:_="absolute"}=i;return{arrow:{position:"absolute",width:cssVars.arrowSize.reference,height:cssVars.arrowSize.reference,[cssVars.arrowSizeHalf.variable]:`calc(${cssVars.arrowSize.reference} / 2)`,[cssVars.arrowOffset.variable]:`calc(${cssVars.arrowSizeHalf.reference} * -1)`},arrowTip:{transform:o?ARROW_FLOATING_STYLE[o.split("-")[0]]:void 0,background:cssVars.arrowBg.reference,top:"0",left:"0",width:"100%",height:"100%",position:"absolute",zIndex:"inherit"},floating:{position:_,isolation:"isolate",minWidth:s?void 0:"max-content",width:s?"var(--reference-width)":void 0,maxWidth:a?"var(--available-width)":void 0,maxHeight:a?"var(--available-height)":void 0,pointerEvents:o?void 0:"none",top:"0px",left:"0px",transform:o?"translate3d(var(--x), var(--y), 0)":"translate3d(0, -100vh, 0)",zIndex:"var(--z-index)"}}}function getWindowFrames(i){const o={each(s){var a;for(let _=0;_<((a=i.frames)==null?void 0:a.length);_+=1){const $=i.frames[_];$&&s($)}},addEventListener(s,a,_){return o.each($=>{try{$.document.addEventListener(s,a,_)}catch{}}),()=>{try{o.removeEventListener(s,a,_)}catch{}}},removeEventListener(s,a,_){o.each($=>{try{$.document.removeEventListener(s,a,_)}catch{}})}};return o}function getParentWindow(i){const o=i.frameElement!=null?i.parent:null;return{addEventListener:(s,a,_)=>{try{o==null||o.addEventListener(s,a,_)}catch{}return()=>{try{o==null||o.removeEventListener(s,a,_)}catch{}}},removeEventListener:(s,a,_)=>{try{o==null||o.removeEventListener(s,a,_)}catch{}}}}var POINTER_OUTSIDE_EVENT="pointerdown.outside",FOCUS_OUTSIDE_EVENT="focus.outside";function isComposedPathFocusable(i){for(const o of i)if(isHTMLElement$1(o)&&isFocusable(o))return!0;return!1}var isPointerEvent=i=>"clientY"in i;function isEventPointWithin(i,o){if(!isPointerEvent(o)||!i)return!1;const s=i.getBoundingClientRect();return s.width===0||s.height===0?!1:s.top<=o.clientY&&o.clientY<=s.top+s.height&&s.left<=o.clientX&&o.clientX<=s.left+s.width}function isPointInRect(i,o){return i.y<=o.y&&o.y<=i.y+i.height&&i.x<=o.x&&o.x<=i.x+i.width}function isEventWithinScrollbar(i,o){if(!o||!isPointerEvent(i))return!1;const s=o.scrollHeight>o.clientHeight,a=s&&i.clientX>o.offsetLeft+o.clientWidth,_=o.scrollWidth>o.clientWidth,$=_&&i.clientY>o.offsetTop+o.clientHeight,_e={x:o.offsetLeft,y:o.offsetTop,width:o.clientWidth+(s?16:0),height:o.clientHeight+(_?16:0)},tt={x:i.clientX,y:i.clientY};return isPointInRect(_e,tt)?a||$:!1}function trackInteractOutsideImpl(i,o){const{exclude:s,onFocusOutside:a,onPointerDownOutside:_,onInteractOutside:$,defer:_e}=o;if(!i)return;const tt=getDocument(i),st=getWindow$1(i),it=getWindowFrames(st),nt=getParentWindow(st);function et(ct,dt){if(!isHTMLElement$1(dt)||!dt.isConnected||contains(i,dt)||isEventPointWithin(i,ct))return!1;const ft=tt.querySelector(`[aria-controls="${i.id}"]`);if(ft){const bt=getNearestOverflowAncestor$1(ft);if(isEventWithinScrollbar(ct,bt))return!1}const ht=getNearestOverflowAncestor$1(i);return isEventWithinScrollbar(ct,ht)?!1:!(s!=null&&s(dt))}const j=new Set,rt=isShadowRoot$1(i==null?void 0:i.getRootNode());function ot(ct){function dt(ft){var mt;const ht=_e&&!isTouchDevice()?raf$1:gt=>gt(),bt=ft??ct,yt=((mt=bt==null?void 0:bt.composedPath)==null?void 0:mt.call(bt))??[bt==null?void 0:bt.target];ht(()=>{const gt=rt?yt[0]:getEventTarget(ct);if(!(!i||!et(ct,gt))){if(_||$){const vt=callAll(_,$);i.addEventListener(POINTER_OUTSIDE_EVENT,vt,{once:!0})}fireCustomEvent(i,POINTER_OUTSIDE_EVENT,{bubbles:!1,cancelable:!0,detail:{originalEvent:bt,contextmenu:isContextMenuEvent(bt),focusable:isComposedPathFocusable(yt),target:gt}})}})}ct.pointerType==="touch"?(j.forEach(ft=>ft()),j.add(addDomEvent(tt,"click",dt,{once:!0})),j.add(nt.addEventListener("click",dt,{once:!0})),j.add(it.addEventListener("click",dt,{once:!0}))):dt()}const at=new Set,lt=setTimeout(()=>{at.add(addDomEvent(tt,"pointerdown",ot,!0)),at.add(nt.addEventListener("pointerdown",ot,!0)),at.add(it.addEventListener("pointerdown",ot,!0))},0);function ut(ct){(_e?raf$1:ft=>ft())(()=>{const ft=getEventTarget(ct);if(!(!i||!et(ct,ft))){if(a||$){const ht=callAll(a,$);i.addEventListener(FOCUS_OUTSIDE_EVENT,ht,{once:!0})}fireCustomEvent(i,FOCUS_OUTSIDE_EVENT,{bubbles:!1,cancelable:!0,detail:{originalEvent:ct,contextmenu:!1,focusable:isFocusable(ft),target:ft}})}})}return isTouchDevice()||(at.add(addDomEvent(tt,"focusin",ut,!0)),at.add(nt.addEventListener("focusin",ut,!0)),at.add(it.addEventListener("focusin",ut,!0))),()=>{clearTimeout(lt),j.forEach(ct=>ct()),at.forEach(ct=>ct())}}function trackInteractOutside(i,o){const{defer:s}=o,a=s?raf$1:$=>$(),_=[];return _.push(a(()=>{const $=typeof i=="function"?i():i;_.push(trackInteractOutsideImpl($,o))})),()=>{_.forEach($=>$==null?void 0:$())}}function fireCustomEvent(i,o,s){const a=i.ownerDocument.defaultView||window,_=new a.CustomEvent(o,s);return i.dispatchEvent(_)}function trackEscapeKeydown(i,o){const s=a=>{a.key==="Escape"&&(a.isComposing||o==null||o(a))};return addDomEvent(getDocument(i),"keydown",s,{capture:!0})}var layerStack={layers:[],branches:[],count(){return this.layers.length},pointerBlockingLayers(){return this.layers.filter(i=>i.pointerBlocking)},topMostPointerBlockingLayer(){return[...this.pointerBlockingLayers()].slice(-1)[0]},hasPointerBlockingLayer(){return this.pointerBlockingLayers().length>0},isBelowPointerBlockingLayer(i){var a;const o=this.indexOf(i),s=this.topMostPointerBlockingLayer()?this.indexOf((a=this.topMostPointerBlockingLayer())==null?void 0:a.node):-1;return ocontains(s.node,o))},isInBranch(i){return Array.from(this.branches).some(o=>contains(o,i))},add(i){const o=this.layers.push(i);i.node.style.setProperty("--layer-index",`${o}`)},addBranch(i){this.branches.push(i)},remove(i){const o=this.indexOf(i);o<0||(oa.dismiss()),this.layers.splice(o,1),i.style.removeProperty("--layer-index"))},removeBranch(i){const o=this.branches.indexOf(i);o>=0&&this.branches.splice(o,1)},indexOf(i){return this.layers.findIndex(o=>o.node===i)},dismiss(i){var o;(o=this.layers[this.indexOf(i)])==null||o.dismiss()},clear(){this.remove(this.layers[0].node)}},originalBodyPointerEvents;function assignPointerEventToLayers(){layerStack.layers.forEach(({node:i})=>{i.style.pointerEvents=layerStack.isBelowPointerBlockingLayer(i)?"none":"auto"})}function clearPointerEvent(i){i.style.pointerEvents=""}function disablePointerEventsOutside(i,o){const s=getDocument(i),a=[];if(layerStack.hasPointerBlockingLayer()&&!s.body.hasAttribute("data-inert")&&(originalBodyPointerEvents=document.body.style.pointerEvents,queueMicrotask(()=>{s.body.style.pointerEvents="none",s.body.setAttribute("data-inert","")})),o){const _=waitForElements(o,$=>{a.push(setStyle($,{pointerEvents:"auto"}))});a.push(_)}return()=>{layerStack.hasPointerBlockingLayer()||(queueMicrotask(()=>{s.body.style.pointerEvents=originalBodyPointerEvents,s.body.removeAttribute("data-inert"),s.body.style.length===0&&s.body.removeAttribute("style")}),a.forEach(_=>_()))}}function trackDismissableElementImpl(i,o){const{warnOnMissingNode:s=!0}=o;if(s&&!i){warn$1("[@zag-js/dismissable] node is `null` or `undefined`");return}if(!i)return;const{onDismiss:a,pointerBlocking:_,exclude:$,debug:_e}=o,tt={dismiss:a,node:i,pointerBlocking:_};layerStack.add(tt),assignPointerEventToLayers();function st(rt){var at,lt;const ot=getEventTarget(rt.detail.originalEvent);layerStack.isBelowPointerBlockingLayer(i)||layerStack.isInBranch(ot)||((at=o.onPointerDownOutside)==null||at.call(o,rt),(lt=o.onInteractOutside)==null||lt.call(o,rt),!rt.defaultPrevented&&(_e&&console.log("onPointerDownOutside:",rt.detail.originalEvent),a==null||a()))}function it(rt){var at,lt;const ot=getEventTarget(rt.detail.originalEvent);layerStack.isInBranch(ot)||((at=o.onFocusOutside)==null||at.call(o,rt),(lt=o.onInteractOutside)==null||lt.call(o,rt),!rt.defaultPrevented&&(_e&&console.log("onFocusOutside:",rt.detail.originalEvent),a==null||a()))}function nt(rt){var ot;layerStack.isTopMost(i)&&((ot=o.onEscapeKeyDown)==null||ot.call(o,rt),!rt.defaultPrevented&&a&&(rt.preventDefault(),a()))}function et(rt){var ut;if(!i)return!1;const ot=typeof $=="function"?$():$,at=Array.isArray(ot)?ot:[ot],lt=(ut=o.persistentElements)==null?void 0:ut.map(ct=>ct()).filter(isHTMLElement$1);return lt&&at.push(...lt),at.some(ct=>contains(ct,rt))||layerStack.isInNestedLayer(i,rt)}const j=[_?disablePointerEventsOutside(i,o.persistentElements):void 0,trackEscapeKeydown(i,nt),trackInteractOutside(i,{exclude:et,onFocusOutside:it,onPointerDownOutside:st,defer:o.defer})];return()=>{layerStack.remove(i),assignPointerEventToLayers(),clearPointerEvent(i),j.forEach(rt=>rt==null?void 0:rt())}}function trackDismissableElement(i,o){const{defer:s}=o,a=s?raf$1:$=>$(),_=[];return _.push(a(()=>{const $=isFunction$1(i)?i():i;_.push(trackDismissableElementImpl($,o))})),()=>{_.forEach($=>$==null?void 0:$())}}function trackDismissableBranch(i,o={}){const{defer:s}=o,a=s?raf$1:$=>$(),_=[];return _.push(a(()=>{const $=isFunction$1(i)?i():i;if(!$){warn$1("[@zag-js/dismissable] branch node is `null` or `undefined`");return}layerStack.addBranch($),_.push(()=>{layerStack.removeBranch($)})})),()=>{_.forEach($=>$==null?void 0:$())}}var anatomy$m=createAnatomy("color-picker",["root","label","control","trigger","positioner","content","area","areaThumb","valueText","areaBackground","channelSlider","channelSliderLabel","channelSliderTrack","channelSliderThumb","channelSliderValueText","channelInput","transparencyGrid","swatchGroup","swatchTrigger","swatchIndicator","swatch","eyeDropperTrigger","formatTrigger","formatSelect"]);anatomy$m.build();createProps$1()(["closeOnSelect","dir","disabled","format","defaultFormat","getRootNode","id","ids","initialFocusEl","name","positioning","onFocusOutside","onFormatChange","onInteractOutside","onOpenChange","onPointerDownOutside","onValueChange","onValueChangeEnd","defaultOpen","open","positioning","required","readOnly","value","defaultValue","invalid","openAutoFocus"]);createProps$1()(["xChannel","yChannel"]);createProps$1()(["channel","orientation"]);createProps$1()(["value","disabled"]);createProps$1()(["value","respectAlpha"]);createProps$1()(["size"]);const[RenderStrategyPropsProvider,useRenderStrategyPropsContext]=createContext({name:"RenderStrategyContext",hookName:"useRenderStrategyContext",providerName:""}),splitRenderStrategyProps=i=>createSplitProps()(i,["lazyMount","unmountOnExit"]);var anatomy$l=createAnatomy("accordion").parts("root","item","itemTrigger","itemContent","itemIndicator");anatomy$l.build();createProps$1()(["collapsible","dir","disabled","getRootNode","id","ids","multiple","onFocusChange","onValueChange","orientation","value","defaultValue"]);createProps$1()(["value","disabled"]);var anatomy$k=createAnatomy("avatar").parts("root","image","fallback");anatomy$k.build();createProps$1()(["dir","id","ids","onStatusChange","getRootNode"]);function isValidKey(i){return!(i.metaKey||!isMac()&&i.altKey||i.ctrlKey||i.key==="Control"||i.key==="Shift"||i.key==="Meta")}var nonTextInputTypes=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function isKeyboardFocusEvent(i,o,s){const a=s?getEventTarget(s):null,_=getWindow$1(a);return i=i||a instanceof _.HTMLInputElement&&!nonTextInputTypes.has(a==null?void 0:a.type)||a instanceof _.HTMLTextAreaElement||a instanceof _.HTMLElement&&a.isContentEditable,!(i&&o==="keyboard"&&s instanceof _.KeyboardEvent&&!Reflect.has(FOCUS_VISIBLE_INPUT_KEYS,s.key))}var currentModality=null,changeHandlers=new Set,listenerMap=new Map,hasEventBeforeFocus=!1,hasBlurredWindowRecently=!1,FOCUS_VISIBLE_INPUT_KEYS={Tab:!0,Escape:!0};function triggerChangeHandlers(i,o){for(let s of changeHandlers)s(i,o)}function handleKeyboardEvent(i){hasEventBeforeFocus=!0,isValidKey(i)&&(currentModality="keyboard",triggerChangeHandlers("keyboard",i))}function handlePointerEvent(i){currentModality="pointer",(i.type==="mousedown"||i.type==="pointerdown")&&(hasEventBeforeFocus=!0,triggerChangeHandlers("pointer",i))}function handleClickEvent(i){isVirtualClick(i)&&(hasEventBeforeFocus=!0,currentModality="virtual")}function handleFocusEvent(i){const o=getEventTarget(i);o===getWindow$1(o)||o===getDocument(o)||(!hasEventBeforeFocus&&!hasBlurredWindowRecently&&(currentModality="virtual",triggerChangeHandlers("virtual",i)),hasEventBeforeFocus=!1,hasBlurredWindowRecently=!1)}function handleWindowBlur(){hasEventBeforeFocus=!1,hasBlurredWindowRecently=!0}function setupGlobalFocusEvents(i){if(typeof window>"u"||listenerMap.get(getWindow$1(i)))return;const o=getWindow$1(i),s=getDocument(i);let a=o.HTMLElement.prototype.focus;o.HTMLElement.prototype.focus=function(){currentModality="virtual",triggerChangeHandlers("virtual",null),hasEventBeforeFocus=!0,a.apply(this,arguments)},s.addEventListener("keydown",handleKeyboardEvent,!0),s.addEventListener("keyup",handleKeyboardEvent,!0),s.addEventListener("click",handleClickEvent,!0),o.addEventListener("focus",handleFocusEvent,!0),o.addEventListener("blur",handleWindowBlur,!1),typeof o.PointerEvent<"u"?(s.addEventListener("pointerdown",handlePointerEvent,!0),s.addEventListener("pointermove",handlePointerEvent,!0),s.addEventListener("pointerup",handlePointerEvent,!0)):(s.addEventListener("mousedown",handlePointerEvent,!0),s.addEventListener("mousemove",handlePointerEvent,!0),s.addEventListener("mouseup",handlePointerEvent,!0)),o.addEventListener("beforeunload",()=>{tearDownWindowFocusTracking(i)},{once:!0}),listenerMap.set(o,{focus:a})}var tearDownWindowFocusTracking=(i,o)=>{const s=getWindow$1(i),a=getDocument(i);listenerMap.has(s)&&(s.HTMLElement.prototype.focus=listenerMap.get(s).focus,a.removeEventListener("keydown",handleKeyboardEvent,!0),a.removeEventListener("keyup",handleKeyboardEvent,!0),a.removeEventListener("click",handleClickEvent,!0),s.removeEventListener("focus",handleFocusEvent,!0),s.removeEventListener("blur",handleWindowBlur,!1),typeof s.PointerEvent<"u"?(a.removeEventListener("pointerdown",handlePointerEvent,!0),a.removeEventListener("pointermove",handlePointerEvent,!0),a.removeEventListener("pointerup",handlePointerEvent,!0)):(a.removeEventListener("mousedown",handlePointerEvent,!0),a.removeEventListener("mousemove",handlePointerEvent,!0),a.removeEventListener("mouseup",handlePointerEvent,!0)),listenerMap.delete(s))};function isFocusVisible(){return currentModality==="keyboard"}function trackFocusVisible(i={}){const{isTextInput:o,autoFocus:s,onChange:a,root:_}=i;setupGlobalFocusEvents(_),a==null||a({isFocusVisible:s||isFocusVisible(),modality:currentModality});const $=(_e,tt)=>{isKeyboardFocusEvent(!!o,_e,tt)&&(a==null||a({isFocusVisible:isFocusVisible(),modality:_e}))};return changeHandlers.add($),()=>{changeHandlers.delete($)}}var anatomy$j=createAnatomy("checkbox").parts("root","label","control","indicator");anatomy$j.build();createProps$1()(["defaultChecked","checked","dir","disabled","form","getRootNode","id","ids","invalid","name","onCheckedChange","readOnly","required","value"]);const checkboxAnatomy=anatomy$j.extendWith("group"),[FieldProvider,useFieldContext]=createContext({name:"FieldContext",hookName:"useFieldContext",providerName:"",strict:!1}),[ClipboardProvider,useClipboardContext]=createContext({name:"ClipboardContext",hookName:"useClipboardContext",providerName:""}),ClipboardControl=reactExports.forwardRef((i,o)=>{const s=useClipboardContext(),a=mergeProps(s.getControlProps(),i);return jsxRuntimeExports.jsx(ark.div,{...a,ref:o})});ClipboardControl.displayName="ClipboardControl";const ClipboardIndicator$1=reactExports.forwardRef((i,o)=>{const{children:s,copied:a,..._}=i,$=useClipboardContext(),_e=mergeProps($.getIndicatorProps({copied:$.copied}),_);return jsxRuntimeExports.jsx(ark.div,{..._e,ref:o,children:$.copied?a:s})});ClipboardIndicator$1.displayName="ClipboardIndicator";const ClipboardInput$1=reactExports.forwardRef((i,o)=>{const s=useClipboardContext(),a=mergeProps(s.getInputProps(),i);return jsxRuntimeExports.jsx(ark.input,{...a,ref:o})});ClipboardInput$1.displayName="ClipboardInput";const ClipboardLabel$1=reactExports.forwardRef((i,o)=>{const s=useClipboardContext(),a=mergeProps(s.getLabelProps(),i);return jsxRuntimeExports.jsx(ark.label,{...a,ref:o})});ClipboardLabel$1.displayName="ClipboardLabel";var anatomy$i=createAnatomy("clipboard").parts("root","control","trigger","indicator","input","label"),parts$9=anatomy$i.build(),getRootId$5=i=>{var o;return((o=i.ids)==null?void 0:o.root)??`clip:${i.id}`},getInputId$1=i=>{var o;return((o=i.ids)==null?void 0:o.input)??`clip:${i.id}:input`},getLabelId$3=i=>{var o;return((o=i.ids)==null?void 0:o.label)??`clip:${i.id}:label`},getInputEl$1=i=>i.getById(getInputId$1(i)),writeToClipboard=(i,o)=>copyText(i.getDoc(),o);function createNode(i,o){const s=i.createElement("pre");return Object.assign(s.style,{width:"1px",height:"1px",position:"fixed",top:"5px"}),s.textContent=o,s}function copyNode(i){const s=getWindow$1(i).getSelection();if(s==null)return Promise.reject(new Error);s.removeAllRanges();const a=i.ownerDocument,_=a.createRange();return _.selectNodeContents(i),s.addRange(_),a.execCommand("copy"),s.removeAllRanges(),Promise.resolve()}function copyText(i,o){var _;const s=i.defaultView||window;if(((_=s.navigator.clipboard)==null?void 0:_.writeText)!==void 0)return s.navigator.clipboard.writeText(o);if(!i.body)return Promise.reject(new Error);const a=createNode(i,o);return i.body.appendChild(a),copyNode(a),i.body.removeChild(a),Promise.resolve()}function connect$8(i,o){const{state:s,send:a,context:_,scope:$}=i,_e=s.matches("copied");return{copied:_e,value:_.get("value"),setValue(tt){a({type:"VALUE.SET",value:tt})},copy(){a({type:"COPY"})},getRootProps(){return o.element({...parts$9.root.attrs,"data-copied":dataAttr$1(_e),id:getRootId$5($)})},getLabelProps(){return o.label({...parts$9.label.attrs,htmlFor:getInputId$1($),"data-copied":dataAttr$1(_e),id:getLabelId$3($)})},getControlProps(){return o.element({...parts$9.control.attrs,"data-copied":dataAttr$1(_e)})},getInputProps(){return o.input({...parts$9.input.attrs,defaultValue:_.get("value"),"data-copied":dataAttr$1(_e),readOnly:!0,"data-readonly":"true",id:getInputId$1($),onFocus(tt){tt.currentTarget.select()},onCopy(){a({type:"INPUT.COPY"})}})},getTriggerProps(){return o.button({...parts$9.trigger.attrs,type:"button","aria-label":_e?"Copied to clipboard":"Copy to clipboard","data-copied":dataAttr$1(_e),onClick(){a({type:"COPY"})}})},getIndicatorProps(tt){return o.element({...parts$9.indicator.attrs,hidden:tt.copied!==_e})}}}var machine$8={props({props:i}){return{timeout:3e3,defaultValue:"",...i}},initialState(){return"idle"},context({prop:i,bindable:o}){return{value:o(()=>({defaultValue:i("defaultValue"),value:i("value"),onChange(s){var a;(a=i("onValueChange"))==null||a({value:s})}}))}},watch({track:i,context:o,action:s}){i([()=>o.get("value")],()=>{s(["syncInputElement"])})},on:{"VALUE.SET":{actions:["setValue"]},COPY:{target:"copied",actions:["copyToClipboard","invokeOnCopy"]}},states:{idle:{on:{"INPUT.COPY":{target:"copied",actions:["invokeOnCopy"]}}},copied:{effects:["waitForTimeout"],on:{"COPY.DONE":{target:"idle"},COPY:{target:"copied",actions:["copyToClipboard","invokeOnCopy"]},"INPUT.COPY":{actions:["invokeOnCopy"]}}}},implementations:{effects:{waitForTimeout({prop:i,send:o}){return setRafTimeout(()=>{o({type:"COPY.DONE"})},i("timeout"))}},actions:{setValue({context:i,event:o}){i.set("value",o.value)},copyToClipboard({context:i,scope:o}){writeToClipboard(o,i.get("value"))},invokeOnCopy({prop:i}){var o;(o=i("onStatusChange"))==null||o({copied:!0})},syncInputElement({context:i,scope:o}){const s=getInputEl$1(o);s&&setElementValue(s,i.get("value"))}}}};createProps$1()(["getRootNode","id","ids","value","defaultValue","timeout","onStatusChange","onValueChange"]);createProps$1()(["copied"]);const useClipboard=i=>{const o=reactExports.useId(),{getRootNode:s}=useEnvironmentContext(),a={id:o,getRootNode:s,...i},_=useMachine(machine$8,a);return connect$8(_,normalizeProps)},ClipboardRoot$2=reactExports.forwardRef((i,o)=>{const[s,a]=createSplitProps()(i,["defaultValue","id","ids","onStatusChange","onValueChange","timeout","value"]),_=useClipboard(s),$=mergeProps(_.getRootProps(),a);return jsxRuntimeExports.jsx(ClipboardProvider,{value:_,children:jsxRuntimeExports.jsx(ark.div,{ref:o,...$})})});ClipboardRoot$2.displayName="ClipboardRoot";const ClipboardRootProvider=reactExports.forwardRef((i,o)=>{const[{value:s},a]=createSplitProps()(i,["value"]),_=mergeProps(s.getRootProps(),a);return jsxRuntimeExports.jsx(ClipboardProvider,{value:s,children:jsxRuntimeExports.jsx(ark.div,{ref:o,..._})})});ClipboardRootProvider.displayName="ClipboardRootProvider";const ClipboardTrigger$1=reactExports.forwardRef((i,o)=>{const s=useClipboardContext(),a=mergeProps(s.getTriggerProps(),i);return jsxRuntimeExports.jsx(ark.button,{...a,ref:o})});ClipboardTrigger$1.displayName="ClipboardTrigger";const ClipboardValueText=reactExports.forwardRef((i,o)=>{const s=useClipboardContext();return jsxRuntimeExports.jsx(ark.span,{...i,ref:o,children:i.children||s.value})});ClipboardValueText.displayName="ClipboardValueText";const colorPickerAnatomy$1=anatomy$m.extendWith("view");var __defProp$1=Object.defineProperty,__defNormalProp$1=(i,o,s)=>o in i?__defProp$1(i,o,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[o]=s,__publicField$1=(i,o,s)=>__defNormalProp$1(i,typeof o!="symbol"?o+"":o,s),fallback$1={itemToValue(i){return typeof i=="string"?i:isObject$2(i)&&hasProp(i,"value")?i.value:""},itemToString(i){return typeof i=="string"?i:isObject$2(i)&&hasProp(i,"label")?i.label:fallback$1.itemToValue(i)},isItemDisabled(i){return isObject$2(i)&&hasProp(i,"disabled")?!!i.disabled:!1}},ListCollection=class ws{constructor(o){this.options=o,__publicField$1(this,"items"),__publicField$1(this,"copy",s=>new ws({...this.options,items:s??[...this.items]})),__publicField$1(this,"isEqual",s=>isEqual(this.items,s.items)),__publicField$1(this,"setItems",s=>this.copy(s)),__publicField$1(this,"getValues",(s=this.items)=>Array.from(s).map(a=>this.getItemValue(a)).filter(Boolean)),__publicField$1(this,"find",s=>{if(s==null)return null;const a=this.items.findIndex(_=>this.getItemValue(_)===s);return a!=null?this.items[a]:null}),__publicField$1(this,"findMany",s=>Array.from(s).map(a=>this.find(a)).filter(a=>a!=null)),__publicField$1(this,"at",s=>this.items[s]??null),__publicField$1(this,"sortFn",(s,a)=>{const _=this.indexOf(s),$=this.indexOf(a);return(_??0)-($??0)}),__publicField$1(this,"sort",s=>[...s].sort(this.sortFn.bind(this))),__publicField$1(this,"getItemValue",s=>{var a,_;return s==null?null:((_=(a=this.options).itemToValue)==null?void 0:_.call(a,s))??fallback$1.itemToValue(s)}),__publicField$1(this,"getItemDisabled",s=>{var a,_;return s==null?!1:((_=(a=this.options).isItemDisabled)==null?void 0:_.call(a,s))??fallback$1.isItemDisabled(s)}),__publicField$1(this,"stringifyItem",s=>{var a,_;return s==null?null:((_=(a=this.options).itemToString)==null?void 0:_.call(a,s))??fallback$1.itemToString(s)}),__publicField$1(this,"stringify",s=>s==null?null:this.stringifyItem(this.find(s))),__publicField$1(this,"stringifyItems",(s,a=", ")=>Array.from(s).map(_=>this.stringifyItem(_)).filter(Boolean).join(a)),__publicField$1(this,"stringifyMany",(s,a)=>this.stringifyItems(this.findMany(s),a)),__publicField$1(this,"has",s=>this.indexOf(s)!==-1),__publicField$1(this,"hasItem",s=>s==null?!1:this.has(this.getItemValue(s))),__publicField$1(this,"getNextValue",(s,a=1,_=!1)=>{let $=this.indexOf(s);if($===-1)return null;for($=_?Math.min($+a,this.size-1):$+a;$<=this.size&&this.getItemDisabled(this.at($));)$++;return this.getItemValue(this.at($))}),__publicField$1(this,"getPreviousValue",(s,a=1,_=!1)=>{let $=this.indexOf(s);if($===-1)return null;for($=_?Math.max($-a,0):$-a;$>=0&&this.getItemDisabled(this.at($));)$--;return this.getItemValue(this.at($))}),__publicField$1(this,"indexOf",s=>s==null?-1:this.items.findIndex(a=>this.getItemValue(a)===s)),__publicField$1(this,"getByText",(s,a)=>{let _=a!=null?wrap$1(this.items,this.indexOf(a)):this.items;return s.length===1&&(_=_.filter(_e=>this.getItemValue(_e)!==a)),_.find(_e=>match$1(this.stringifyItem(_e),s))}),__publicField$1(this,"search",(s,a)=>{const{state:_,currentValue:$,timeout:_e=350}=a,tt=_.keysSoFar+s,it=tt.length>1&&Array.from(tt).every(ot=>ot===tt[0])?tt[0]:tt,nt=this.getByText(it,$),et=this.getItemValue(nt);function j(){clearTimeout(_.timer),_.timer=-1}function rt(ot){_.keysSoFar=ot,j(),ot!==""&&(_.timer=+setTimeout(()=>{rt(""),j()},_e))}return rt(tt),et}),__publicField$1(this,"update",(s,a)=>{let _=this.items.findIndex($=>this.getItemValue($)===s);return _===-1?this:this.copy([...this.items.slice(0,_),a,...this.items.slice(_+1)])}),__publicField$1(this,"insert",(s,...a)=>this.copy(insert(this.items,s,...a))),__publicField$1(this,"insertBefore",(s,...a)=>{let _=this.indexOf(s);if(_===-1)if(this.items.length===0)_=0;else return this;return this.copy(insert(this.items,_,...a))}),__publicField$1(this,"insertAfter",(s,...a)=>{let _=this.indexOf(s);if(_===-1)if(this.items.length===0)_=0;else return this;return this.copy(insert(this.items,_+1,...a))}),__publicField$1(this,"prepend",(...s)=>this.copy(insert(this.items,0,...s))),__publicField$1(this,"append",(...s)=>this.copy(insert(this.items,this.items.length,...s))),__publicField$1(this,"remove",(...s)=>{const a=s.map(_=>typeof _=="string"?_:this.getItemValue(_));return this.copy(this.items.filter(_=>{const $=this.getItemValue(_);return $==null?!1:!a.includes($)}))}),__publicField$1(this,"move",(s,a)=>{const _=this.indexOf(s);return _===-1?this:this.copy(move(this.items,[_],a))}),__publicField$1(this,"reorder",(s,a)=>this.copy(move(this.items,[s],a))),__publicField$1(this,"compareValue",(s,a)=>{const _=this.indexOf(s),$=this.indexOf(a);return _<$?-1:_>$?1:0}),__publicField$1(this,"range",(s,a)=>{let _=[],$=s;for(;$!=null;){if(this.find($)&&_.push($),$===a)return _;$=this.getNextValue($)}return[]}),__publicField$1(this,"getValueRange",(s,a)=>s&&a?this.compareValue(s,a)<=0?this.range(s,a):this.range(a,s):[]),__publicField$1(this,"toString",()=>{let s="";for(const a of this.items){const _=this.getItemValue(a),$=this.stringifyItem(a),_e=this.getItemDisabled(a),tt=[_,$,_e].filter(Boolean).join(":");s+=tt+","}return s}),__publicField$1(this,"toJSON",()=>({size:this.size,first:this.firstValue,last:this.lastValue})),this.items=[...o.items]}get size(){return this.items.length}get firstValue(){let o=0;for(;this.getItemDisabled(this.at(o));)o++;return this.getItemValue(this.at(o))}get lastValue(){let o=this.size-1;for(;this.getItemDisabled(this.at(o));)o--;return this.getItemValue(this.at(o))}*[Symbol.iterator](){yield*this.items}},match$1=(i,o)=>!!(i!=null&&i.toLowerCase().startsWith(o.toLowerCase())),wrap$1=(i,o)=>i.map((s,a)=>i[(Math.max(o,0)+a)%i.length]);function insert(i,o,...s){return[...i.slice(0,o),...s,...i.slice(o)]}function move(i,o,s){o=[...o].sort((_,$)=>_-$);const a=o.map(_=>i[_]);for(let _=o.length-1;_>=0;_--)i=[...i.slice(0,o[_]),...i.slice(o[_]+1)];return s=Math.max(0,s-o.filter(_=>_new ListCollection(i);var counterMap=new WeakMap,uncontrolledNodes=new WeakMap,markerMap={},lockCount=0,unwrapHost=i=>i&&(i.host||unwrapHost(i.parentNode)),correctTargets=(i,o)=>o.map(s=>{if(i.contains(s))return s;const a=unwrapHost(s);return a&&i.contains(a)?a:(console.error("[zag-js > ariaHidden] target",s,"in not contained inside",i,". Doing nothing"),null)}).filter(s=>!!s),isIgnoredNode=i=>i.localName==="next-route-announcer"||i.localName==="script"||i.hasAttribute("aria-live")?!0:i.matches("[data-live-announcer]"),walkTreeOutside=(i,o)=>{const{parentNode:s,markerName:a,controlAttribute:_}=o,$=correctTargets(s,Array.isArray(i)?i:[i]);markerMap[a]||(markerMap[a]=new WeakMap);const _e=markerMap[a],tt=[],st=new Set,it=new Set($),nt=j=>{!j||st.has(j)||(st.add(j),nt(j.parentNode))};$.forEach(nt);const et=j=>{!j||it.has(j)||Array.prototype.forEach.call(j.children,rt=>{if(st.has(rt))et(rt);else try{if(isIgnoredNode(rt))return;const at=rt.getAttribute(_)==="true",lt=(counterMap.get(rt)||0)+1,ut=(_e.get(rt)||0)+1;counterMap.set(rt,lt),_e.set(rt,ut),tt.push(rt),lt===1&&at&&uncontrolledNodes.set(rt,!0),ut===1&&rt.setAttribute(a,""),at||rt.setAttribute(_,"true")}catch(ot){console.error("[zag-js > ariaHidden] cannot operate on ",rt,ot)}})};return et(s),st.clear(),lockCount++,()=>{tt.forEach(j=>{const rt=counterMap.get(j)-1,ot=_e.get(j)-1;counterMap.set(j,rt),_e.set(j,ot),rt||(uncontrolledNodes.has(j)||j.removeAttribute(_),uncontrolledNodes.delete(j)),ot||j.removeAttribute(a)}),lockCount--,lockCount||(counterMap=new WeakMap,counterMap=new WeakMap,uncontrolledNodes=new WeakMap,markerMap={})}},getParentNode=i=>(Array.isArray(i)?i[0]:i).ownerDocument.body,hideOthers=(i,o=getParentNode(i),s="data-aria-hidden")=>{if(o)return walkTreeOutside(i,{parentNode:o,markerName:s,controlAttribute:"aria-hidden"})},raf=i=>{const o=requestAnimationFrame(()=>i());return()=>cancelAnimationFrame(o)};function ariaHidden(i,o={}){const{defer:s=!0}=o,a=s?raf:$=>$(),_=[];return _.push(a(()=>{const _e=(typeof i=="function"?i():i).filter(Boolean);_e.length!==0&&_.push(hideOthers(_e))})),()=>{_.forEach($=>$==null?void 0:$())}}const[DialogProvider,useDialogContext]=createContext({name:"DialogContext",hookName:"useDialogContext",providerName:""}),DialogBackdrop=reactExports.forwardRef((i,o)=>{const s=useDialogContext(),a=useRenderStrategyPropsContext(),_=usePresence({...a,present:s.open}),$=mergeProps(s.getBackdropProps(),_.getPresenceProps(),i);return _.unmounted?null:jsxRuntimeExports.jsx(ark.div,{...$,ref:composeRefs(_.ref,o)})});DialogBackdrop.displayName="DialogBackdrop";const DialogCloseTrigger=reactExports.forwardRef((i,o)=>{const s=useDialogContext(),a=mergeProps(s.getCloseTriggerProps(),i);return jsxRuntimeExports.jsx(ark.button,{...a,ref:o})});DialogCloseTrigger.displayName="DialogCloseTrigger";const DialogContent=reactExports.forwardRef((i,o)=>{const s=useDialogContext(),a=usePresenceContext(),_=mergeProps(s.getContentProps(),a.getPresenceProps(),i);return a.unmounted?null:jsxRuntimeExports.jsx(ark.div,{..._,ref:composeRefs(a.ref,o)})});DialogContent.displayName="DialogContent";const DialogDescription=reactExports.forwardRef((i,o)=>{const s=useDialogContext(),a=mergeProps(s.getDescriptionProps(),i);return jsxRuntimeExports.jsx(ark.div,{...a,ref:o})});DialogDescription.displayName="DialogDescription";const DialogPositioner=reactExports.forwardRef((i,o)=>{const s=useDialogContext(),a=mergeProps(s.getPositionerProps(),i);return usePresenceContext().unmounted?null:jsxRuntimeExports.jsx(ark.div,{...a,ref:o})});DialogPositioner.displayName="DialogPositioner";var __defProp=Object.defineProperty,__defNormalProp=(i,o,s)=>o in i?__defProp(i,o,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[o]=s,__publicField=(i,o,s)=>__defNormalProp(i,typeof o!="symbol"?o+"":o,s),activeFocusTraps={activateTrap(i,o){if(i.length>0){const a=i[i.length-1];a!==o&&a.pause()}const s=i.indexOf(o);s===-1||i.splice(s,1),i.push(o)},deactivateTrap(i,o){const s=i.indexOf(o);s!==-1&&i.splice(s,1),i.length>0&&i[i.length-1].unpause()}},sharedTrapStack=[],FocusTrap=class{constructor(i,o){__publicField(this,"trapStack"),__publicField(this,"config"),__publicField(this,"doc"),__publicField(this,"state",{containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0}),__publicField(this,"listenerCleanups",[]),__publicField(this,"handleFocus",a=>{const _=getEventTarget(a),$=this.findContainerIndex(_,a)>=0;if($||isDocument(_))$&&(this.state.mostRecentlyFocusedNode=_);else{a.stopImmediatePropagation();let _e,tt=!0;if(this.state.mostRecentlyFocusedNode)if(getTabIndex(this.state.mostRecentlyFocusedNode)>0){const st=this.findContainerIndex(this.state.mostRecentlyFocusedNode),{tabbableNodes:it}=this.state.containerGroups[st];if(it.length>0){const nt=it.findIndex(et=>et===this.state.mostRecentlyFocusedNode);nt>=0&&(this.config.isKeyForward(this.state.recentNavEvent)?nt+1=0&&(_e=it[nt-1],tt=!1))}}else this.state.containerGroups.some(st=>st.tabbableNodes.some(it=>getTabIndex(it)>0))||(tt=!1);else tt=!1;tt&&(_e=this.findNextNavNode({target:this.state.mostRecentlyFocusedNode,isBackward:this.config.isKeyBackward(this.state.recentNavEvent)})),_e?this.tryFocus(_e):this.tryFocus(this.state.mostRecentlyFocusedNode||this.getInitialFocusNode())}this.state.recentNavEvent=void 0}),__publicField(this,"handlePointerDown",a=>{const _=getEventTarget(a);if(!(this.findContainerIndex(_,a)>=0)){if(valueOrHandler(this.config.clickOutsideDeactivates,a)){this.deactivate({returnFocus:this.config.returnFocusOnDeactivate});return}valueOrHandler(this.config.allowOutsideClick,a)||a.preventDefault()}}),__publicField(this,"handleClick",a=>{const _=getEventTarget(a);this.findContainerIndex(_,a)>=0||valueOrHandler(this.config.clickOutsideDeactivates,a)||valueOrHandler(this.config.allowOutsideClick,a)||(a.preventDefault(),a.stopImmediatePropagation())}),__publicField(this,"handleTabKey",a=>{if(this.config.isKeyForward(a)||this.config.isKeyBackward(a)){this.state.recentNavEvent=a;const _=this.config.isKeyBackward(a),$=this.findNextNavNode({event:a,isBackward:_});if(!$)return;isTabEvent(a)&&a.preventDefault(),this.tryFocus($)}}),__publicField(this,"handleEscapeKey",a=>{isEscapeEvent(a)&&valueOrHandler(this.config.escapeDeactivates,a)!==!1&&(a.preventDefault(),this.deactivate())}),__publicField(this,"_mutationObserver"),__publicField(this,"setupMutationObserver",()=>{const a=this.doc.defaultView||window;this._mutationObserver=new a.MutationObserver(_=>{_.some(_e=>Array.from(_e.removedNodes).some(st=>st===this.state.mostRecentlyFocusedNode))&&this.tryFocus(this.getInitialFocusNode())})}),__publicField(this,"updateObservedNodes",()=>{var a;(a=this._mutationObserver)==null||a.disconnect(),this.state.active&&!this.state.paused&&this.state.containers.map(_=>{var $;($=this._mutationObserver)==null||$.observe(_,{subtree:!0,childList:!0})})}),__publicField(this,"getInitialFocusNode",()=>{let a=this.getNodeForOption("initialFocus",{hasFallback:!0});if(a===!1)return!1;if(a===void 0||a&&!isFocusable(a))if(this.findContainerIndex(this.doc.activeElement)>=0)a=this.doc.activeElement;else{const _=this.state.tabbableGroups[0];a=_&&_.firstTabbableNode||this.getNodeForOption("fallbackFocus")}else a===null&&(a=this.getNodeForOption("fallbackFocus"));if(!a)throw new Error("Your focus-trap needs to have at least one focusable element");return a.isConnected||(a=this.getNodeForOption("fallbackFocus")),a}),__publicField(this,"tryFocus",a=>{if(a!==!1&&a!==getActiveElement(this.doc)){if(!a||!a.focus){this.tryFocus(this.getInitialFocusNode());return}a.focus({preventScroll:!!this.config.preventScroll}),this.state.mostRecentlyFocusedNode=a,isSelectableInput(a)&&a.select()}}),__publicField(this,"deactivate",a=>{if(!this.state.active)return this;const _={onDeactivate:this.config.onDeactivate,onPostDeactivate:this.config.onPostDeactivate,checkCanReturnFocus:this.config.checkCanReturnFocus,...a};clearTimeout(this.state.delayInitialFocusTimer),this.state.delayInitialFocusTimer=void 0,this.removeListeners(),this.state.active=!1,this.state.paused=!1,this.updateObservedNodes(),activeFocusTraps.deactivateTrap(this.trapStack,this);const $=this.getOption(_,"onDeactivate"),_e=this.getOption(_,"onPostDeactivate"),tt=this.getOption(_,"checkCanReturnFocus"),st=this.getOption(_,"returnFocus","returnFocusOnDeactivate");$==null||$();const it=()=>{delay(()=>{if(st){const nt=this.getReturnFocusNode(this.state.nodeFocusedBeforeActivation);this.tryFocus(nt)}_e==null||_e()})};if(st&&tt){const nt=this.getReturnFocusNode(this.state.nodeFocusedBeforeActivation);return tt(nt).then(it,it),this}return it(),this}),__publicField(this,"pause",a=>{if(this.state.paused||!this.state.active)return this;const _=this.getOption(a,"onPause"),$=this.getOption(a,"onPostPause");return this.state.paused=!0,_==null||_(),this.removeListeners(),this.updateObservedNodes(),$==null||$(),this}),__publicField(this,"unpause",a=>{if(!this.state.paused||!this.state.active)return this;const _=this.getOption(a,"onUnpause"),$=this.getOption(a,"onPostUnpause");return this.state.paused=!1,_==null||_(),this.updateTabbableNodes(),this.addListeners(),this.updateObservedNodes(),$==null||$(),this}),__publicField(this,"updateContainerElements",a=>(this.state.containers=Array.isArray(a)?a.filter(Boolean):[a].filter(Boolean),this.state.active&&this.updateTabbableNodes(),this.updateObservedNodes(),this)),__publicField(this,"getReturnFocusNode",a=>{const _=this.getNodeForOption("setReturnFocus",{params:[a]});return _||(_===!1?!1:a)}),__publicField(this,"getOption",(a,_,$)=>a&&a[_]!==void 0?a[_]:this.config[$||_]),__publicField(this,"getNodeForOption",(a,{hasFallback:_=!1,params:$=[]}={})=>{let _e=this.config[a];if(typeof _e=="function"&&(_e=_e(...$)),_e===!0&&(_e=void 0),!_e){if(_e===void 0||_e===!1)return _e;throw new Error(`\`${a}\` was specified but was not a node, or did not return a node`)}let tt=_e;if(typeof _e=="string"){try{tt=this.doc.querySelector(_e)}catch(st){throw new Error(`\`${a}\` appears to be an invalid selector; error="${st.message}"`)}if(!tt&&!_)throw new Error(`\`${a}\` as selector refers to no known node`)}return tt}),__publicField(this,"findNextNavNode",a=>{const{event:_,isBackward:$=!1}=a,_e=a.target||getEventTarget(_);this.updateTabbableNodes();let tt=null;if(this.state.tabbableGroups.length>0){const st=this.findContainerIndex(_e,_),it=st>=0?this.state.containerGroups[st]:void 0;if(st<0)$?tt=this.state.tabbableGroups[this.state.tabbableGroups.length-1].lastTabbableNode:tt=this.state.tabbableGroups[0].firstTabbableNode;else if($){let nt=this.state.tabbableGroups.findIndex(({firstTabbableNode:et})=>_e===et);if(nt<0&&((it==null?void 0:it.container)===_e||isFocusable(_e)&&!isTabbable(_e)&&!(it!=null&&it.nextTabbableNode(_e,!1)))&&(nt=st),nt>=0){const et=nt===0?this.state.tabbableGroups.length-1:nt-1,j=this.state.tabbableGroups[et];tt=getTabIndex(_e)>=0?j.lastTabbableNode:j.lastDomTabbableNode}else isTabEvent(_)||(tt=it==null?void 0:it.nextTabbableNode(_e,!1))}else{let nt=this.state.tabbableGroups.findIndex(({lastTabbableNode:et})=>_e===et);if(nt<0&&((it==null?void 0:it.container)===_e||isFocusable(_e)&&!isTabbable(_e)&&!(it!=null&&it.nextTabbableNode(_e)))&&(nt=st),nt>=0){const et=nt===this.state.tabbableGroups.length-1?0:nt+1,j=this.state.tabbableGroups[et];tt=getTabIndex(_e)>=0?j.firstTabbableNode:j.firstDomTabbableNode}else isTabEvent(_)||(tt=it==null?void 0:it.nextTabbableNode(_e))}}else tt=this.getNodeForOption("fallbackFocus");return tt}),this.trapStack=o.trapStack||sharedTrapStack;const s={returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward(a){return isTabEvent(a)&&!a.shiftKey},isKeyBackward(a){return isTabEvent(a)&&a.shiftKey},...o};this.doc=s.document||getDocument(Array.isArray(i)?i[0]:i),this.config=s,this.updateContainerElements(i),this.setupMutationObserver()}get active(){return this.state.active}get paused(){return this.state.paused}findContainerIndex(i,o){const s=typeof(o==null?void 0:o.composedPath)=="function"?o.composedPath():void 0;return this.state.containerGroups.findIndex(({container:a,tabbableNodes:_})=>a.contains(i)||(s==null?void 0:s.includes(a))||_.find($=>$===i))}updateTabbableNodes(){if(this.state.containerGroups=this.state.containers.map(i=>{const o=getTabbables(i),s=getFocusables(i),a=o.length>0?o[0]:void 0,_=o.length>0?o[o.length-1]:void 0,$=s.find(it=>isTabbable(it)),_e=s.slice().reverse().find(it=>isTabbable(it)),tt=!!o.find(it=>getTabIndex(it)>0);function st(it,nt=!0){const et=o.indexOf(it);return et<0?nt?s.slice(s.indexOf(it)+1).find(j=>isTabbable(j)):s.slice(0,s.indexOf(it)).reverse().find(j=>isTabbable(j)):o[et+(nt?1:-1)]}return{container:i,tabbableNodes:o,focusableNodes:s,posTabIndexesFound:tt,firstTabbableNode:a,lastTabbableNode:_,firstDomTabbableNode:$,lastDomTabbableNode:_e,nextTabbableNode:st}}),this.state.tabbableGroups=this.state.containerGroups.filter(i=>i.tabbableNodes.length>0),this.state.tabbableGroups.length<=0&&!this.getNodeForOption("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(this.state.containerGroups.find(i=>i.posTabIndexesFound)&&this.state.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")}addListeners(){if(this.state.active)return activeFocusTraps.activateTrap(this.trapStack,this),this.state.delayInitialFocusTimer=this.config.delayInitialFocus?delay(()=>{this.tryFocus(this.getInitialFocusNode())}):this.tryFocus(this.getInitialFocusNode()),this.listenerCleanups.push(addDomEvent(this.doc,"focusin",this.handleFocus,!0),addDomEvent(this.doc,"mousedown",this.handlePointerDown,{capture:!0,passive:!1}),addDomEvent(this.doc,"touchstart",this.handlePointerDown,{capture:!0,passive:!1}),addDomEvent(this.doc,"click",this.handleClick,{capture:!0,passive:!1}),addDomEvent(this.doc,"keydown",this.handleTabKey,{capture:!0,passive:!1}),addDomEvent(this.doc,"keydown",this.handleEscapeKey)),this}removeListeners(){if(this.state.active)return this.listenerCleanups.forEach(i=>i()),this.listenerCleanups=[],this}activate(i){if(this.state.active)return this;const o=this.getOption(i,"onActivate"),s=this.getOption(i,"onPostActivate"),a=this.getOption(i,"checkCanFocusTrap");a||this.updateTabbableNodes(),this.state.active=!0,this.state.paused=!1,this.state.nodeFocusedBeforeActivation=this.doc.activeElement||null,o==null||o();const _=()=>{a&&this.updateTabbableNodes(),this.addListeners(),this.updateObservedNodes(),s==null||s()};return a?(a(this.state.containers.concat()).then(_,_),this):(_(),this)}},isTabEvent=i=>i.key==="Tab",valueOrHandler=(i,...o)=>typeof i=="function"?i(...o):i,isEscapeEvent=i=>!i.isComposing&&i.key==="Escape",delay=i=>setTimeout(i,0),isSelectableInput=i=>i.localName==="input"&&"select"in i&&typeof i.select=="function";function trapFocus(i,o={}){let s;const a=raf$1(()=>{const _=typeof i=="function"?i():i;if(_){s=new FocusTrap(_,{escapeDeactivates:!1,allowOutsideClick:!0,preventScroll:!0,returnFocusOnDeactivate:!0,delayInitialFocus:!1,fallbackFocus:_,...o,document:getDocument(_)});try{s.activate()}catch{}}});return function(){s==null||s.deactivate(),a()}}var LOCK_CLASSNAME="data-scroll-lock";function getPaddingProperty(i){const o=i.getBoundingClientRect().left;return Math.round(o)+i.scrollLeft?"paddingLeft":"paddingRight"}function preventBodyScroll(i){const o=i??document,s=o.defaultView??window,{documentElement:a,body:_}=o;if(_.hasAttribute(LOCK_CLASSNAME))return;_.setAttribute(LOCK_CLASSNAME,"");const _e=s.innerWidth-a.clientWidth,tt=()=>setStyleProperty(a,"--scrollbar-width",`${_e}px`),st=getPaddingProperty(a),it=()=>setStyle(_,{overflow:"hidden",[st]:`${_e}px`}),nt=()=>{const{scrollX:j,scrollY:rt,visualViewport:ot}=s,at=(ot==null?void 0:ot.offsetLeft)??0,lt=(ot==null?void 0:ot.offsetTop)??0,ut=setStyle(_,{position:"fixed",overflow:"hidden",top:`${-(rt-Math.floor(lt))}px`,left:`${-(j-Math.floor(at))}px`,right:"0",[st]:`${_e}px`});return()=>{ut==null||ut(),s.scrollTo({left:j,top:rt,behavior:"instant"})}},et=[tt(),isIos()?nt():it()];return()=>{et.forEach(j=>j==null?void 0:j()),_.removeAttribute(LOCK_CLASSNAME)}}var anatomy$h=createAnatomy("dialog").parts("trigger","backdrop","positioner","content","title","description","closeTrigger"),parts$8=anatomy$h.build(),getPositionerId$3=i=>{var o;return((o=i.ids)==null?void 0:o.positioner)??`dialog:${i.id}:positioner`},getBackdropId=i=>{var o;return((o=i.ids)==null?void 0:o.backdrop)??`dialog:${i.id}:backdrop`},getContentId$4=i=>{var o;return((o=i.ids)==null?void 0:o.content)??`dialog:${i.id}:content`},getTriggerId$4=i=>{var o;return((o=i.ids)==null?void 0:o.trigger)??`dialog:${i.id}:trigger`},getTitleId$1=i=>{var o;return((o=i.ids)==null?void 0:o.title)??`dialog:${i.id}:title`},getDescriptionId$1=i=>{var o;return((o=i.ids)==null?void 0:o.description)??`dialog:${i.id}:description`},getCloseTriggerId$1=i=>{var o;return((o=i.ids)==null?void 0:o.closeTrigger)??`dialog:${i.id}:close`},getContentEl$3=i=>i.getById(getContentId$4(i)),getPositionerEl$3=i=>i.getById(getPositionerId$3(i)),getBackdropEl=i=>i.getById(getBackdropId(i)),getTriggerEl$4=i=>i.getById(getTriggerId$4(i)),getTitleEl=i=>i.getById(getTitleId$1(i)),getDescriptionEl=i=>i.getById(getDescriptionId$1(i)),getCloseTriggerEl=i=>i.getById(getCloseTriggerId$1(i));function connect$7(i,o){const{state:s,send:a,context:_,prop:$,scope:_e}=i,tt=$("aria-label"),st=s.matches("open");return{open:st,setOpen(it){s.matches("open")!==it&&a({type:it?"OPEN":"CLOSE"})},getTriggerProps(){return o.button({...parts$8.trigger.attrs,dir:$("dir"),id:getTriggerId$4(_e),"aria-haspopup":"dialog",type:"button","aria-expanded":st,"data-state":st?"open":"closed","aria-controls":getContentId$4(_e),onClick(it){it.defaultPrevented||a({type:"TOGGLE"})}})},getBackdropProps(){return o.element({...parts$8.backdrop.attrs,dir:$("dir"),hidden:!st,id:getBackdropId(_e),"data-state":st?"open":"closed"})},getPositionerProps(){return o.element({...parts$8.positioner.attrs,dir:$("dir"),id:getPositionerId$3(_e),style:{pointerEvents:st?void 0:"none"}})},getContentProps(){const it=_.get("rendered");return o.element({...parts$8.content.attrs,dir:$("dir"),role:$("role"),hidden:!st,id:getContentId$4(_e),tabIndex:-1,"data-state":st?"open":"closed","aria-modal":!0,"aria-label":tt||void 0,"aria-labelledby":tt||!it.title?void 0:getTitleId$1(_e),"aria-describedby":it.description?getDescriptionId$1(_e):void 0})},getTitleProps(){return o.element({...parts$8.title.attrs,dir:$("dir"),id:getTitleId$1(_e)})},getDescriptionProps(){return o.element({...parts$8.description.attrs,dir:$("dir"),id:getDescriptionId$1(_e)})},getCloseTriggerProps(){return o.button({...parts$8.closeTrigger.attrs,dir:$("dir"),id:getCloseTriggerId$1(_e),type:"button",onClick(it){it.defaultPrevented||(it.stopPropagation(),a({type:"CLOSE"}))}})}}}var machine$7={props({props:i,scope:o}){const s=i.role==="alertdialog";return{role:"dialog",modal:!0,trapFocus:!0,preventScroll:!0,closeOnInteractOutside:!s,closeOnEscape:!0,restoreFocus:!0,initialFocusEl:s?()=>getCloseTriggerEl(o):void 0,...i}},initialState({prop:i}){return i("open")||i("defaultOpen")?"open":"closed"},context({bindable:i}){return{rendered:i(()=>({defaultValue:{title:!0,description:!0}}))}},watch({track:i,action:o,prop:s}){i([()=>s("open")],()=>{o(["toggleVisibility"])})},states:{open:{entry:["checkRenderedElements","syncZIndex"],effects:["trackDismissableElement","trapFocus","preventScroll","hideContentBelow"],on:{"CONTROLLED.CLOSE":{target:"closed"},CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}],TOGGLE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}]}},closed:{on:{"CONTROLLED.OPEN":{target:"open"},OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen"]}],TOGGLE:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen"]}]}}},implementations:{guards:{isOpenControlled:({prop:i})=>i("open")!=null},effects:{trackDismissableElement({scope:i,send:o,prop:s}){return trackDismissableElement(()=>getContentEl$3(i),{defer:!0,pointerBlocking:s("modal"),exclude:[getTriggerEl$4(i)],onInteractOutside(_){var $;($=s("onInteractOutside"))==null||$(_),s("closeOnInteractOutside")||_.preventDefault()},persistentElements:s("persistentElements"),onFocusOutside:s("onFocusOutside"),onPointerDownOutside:s("onPointerDownOutside"),onEscapeKeyDown(_){var $;($=s("onEscapeKeyDown"))==null||$(_),s("closeOnEscape")||_.preventDefault()},onDismiss(){o({type:"CLOSE",src:"interact-outside"})}})},preventScroll({scope:i,prop:o}){if(o("preventScroll"))return preventBodyScroll(i.getDoc())},trapFocus({scope:i,prop:o}){return!o("trapFocus")||!o("modal")?void 0:trapFocus(()=>getContentEl$3(i),{preventScroll:!0,returnFocusOnDeactivate:!!o("restoreFocus"),initialFocus:o("initialFocusEl"),setReturnFocus:a=>{var _;return((_=o("finalFocusEl"))==null?void 0:_())??a}})},hideContentBelow({scope:i,prop:o}){return o("modal")?ariaHidden(()=>[getContentEl$3(i)],{defer:!0}):void 0}},actions:{checkRenderedElements({context:i,scope:o}){raf$1(()=>{i.set("rendered",{title:!!getTitleEl(o),description:!!getDescriptionEl(o)})})},syncZIndex({scope:i}){raf$1(()=>{const o=getContentEl$3(i);if(!o)return;const s=getComputedStyle$2(o);[getPositionerEl$3(i),getBackdropEl(i)].forEach(_=>{_==null||_.style.setProperty("--z-index",s.zIndex)})})},invokeOnClose({prop:i}){var o;(o=i("onOpenChange"))==null||o({open:!1})},invokeOnOpen({prop:i}){var o;(o=i("onOpenChange"))==null||o({open:!0})},toggleVisibility({prop:i,send:o,event:s}){o({type:i("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:s})}}}};createProps$1()(["aria-label","closeOnEscape","closeOnInteractOutside","dir","finalFocusEl","getRootNode","getRootNode","id","id","ids","initialFocusEl","modal","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenChange","onPointerDownOutside","defaultOpen","open","persistentElements","preventScroll","restoreFocus","role","trapFocus"]);const useDialog=i=>{const o=reactExports.useId(),{getRootNode:s}=useEnvironmentContext(),{dir:a}=useLocaleContext(),_={id:o,getRootNode:s,dir:a,...i},$=useMachine(machine$7,_);return connect$7($,normalizeProps)},DialogRoot=i=>{const[o,{children:s,...a}]=splitPresenceProps(i),[_]=splitRenderStrategyProps(o),$=useDialog(a),_e=usePresence(mergeProps({present:$.open},o));return jsxRuntimeExports.jsx(DialogProvider,{value:$,children:jsxRuntimeExports.jsx(RenderStrategyPropsProvider,{value:_,children:jsxRuntimeExports.jsx(PresenceProvider,{value:_e,children:s})})})},DialogRootProvider=i=>{const[o,{value:s,children:a}]=splitPresenceProps(i),[_]=splitRenderStrategyProps(o),$=usePresence(mergeProps({present:s.open},o));return jsxRuntimeExports.jsx(DialogProvider,{value:s,children:jsxRuntimeExports.jsx(RenderStrategyPropsProvider,{value:_,children:jsxRuntimeExports.jsx(PresenceProvider,{value:$,children:a})})})},DialogTitle=reactExports.forwardRef((i,o)=>{const s=useDialogContext(),a=mergeProps(s.getTitleProps(),i);return jsxRuntimeExports.jsx(ark.h2,{...a,ref:o})});DialogTitle.displayName="DialogTitle";const DialogTrigger=reactExports.forwardRef((i,o)=>{const s=useDialogContext(),a=usePresenceContext(),_=mergeProps({...s.getTriggerProps(),"aria-controls":a.unmounted?void 0:s.getTriggerProps()["aria-controls"]},i);return jsxRuntimeExports.jsx(ark.button,{..._,ref:o})});DialogTrigger.displayName="DialogTrigger";var anatomy$g=createAnatomy("editable").parts("root","area","label","preview","input","editTrigger","submitTrigger","cancelTrigger","control");anatomy$g.build();createProps$1()(["activationMode","autoResize","dir","disabled","finalFocusEl","form","getRootNode","id","ids","invalid","maxLength","name","onEditChange","onFocusOutside","onInteractOutside","onPointerDownOutside","onValueChange","onValueCommit","onValueRevert","placeholder","readOnly","required","selectOnFocus","edit","defaultEdit","submitMode","translations","defaultValue","value"]);const FieldErrorText$1=reactExports.forwardRef((i,o)=>{const s=useFieldContext(),a=mergeProps(s.getErrorTextProps(),i);return s!=null&&s.invalid?jsxRuntimeExports.jsx(ark.span,{...a,ref:o}):null});FieldErrorText$1.displayName="FieldErrorText";const FieldHelperText$1=reactExports.forwardRef((i,o)=>{const s=useFieldContext(),a=mergeProps(s==null?void 0:s.getHelperTextProps(),i);return jsxRuntimeExports.jsx(ark.span,{...a,ref:o})});FieldHelperText$1.displayName="FieldHelperText";const FieldInput=reactExports.forwardRef((i,o)=>{const s=useFieldContext(),a=mergeProps(s==null?void 0:s.getInputProps(),i);return jsxRuntimeExports.jsx(ark.input,{...a,ref:o})});FieldInput.displayName="FieldInput";const FieldLabel$1=reactExports.forwardRef((i,o)=>{const s=useFieldContext(),a=mergeProps(s==null?void 0:s.getLabelProps(),i);return jsxRuntimeExports.jsx(ark.label,{...a,ref:o})});FieldLabel$1.displayName="FieldLabel";const useSafeLayoutEffect=typeof window<"u"?reactExports.useLayoutEffect:reactExports.useEffect,[FieldsetProvider,useFieldsetContext]=createContext({name:"FieldsetContext",hookName:"useFieldsetContext",providerName:"",strict:!1}),fieldAnatomy$1=createAnatomy("field").parts("root","errorText","helperText","input","label","select","textarea","requiredIndicator"),parts$7=fieldAnatomy$1.build(),useField=(i={})=>{const o=useFieldsetContext(),{ids:s,disabled:a=!!(o!=null&&o.disabled),invalid:_=!1,readOnly:$=!1,required:_e=!1}=i,[tt,st]=reactExports.useState(!1),[it,nt]=reactExports.useState(!1),et=i.id??reactExports.useId(),j=reactExports.useRef(null),rt=(s==null?void 0:s.control)??`field::${et}`,ot=(s==null?void 0:s.errorText)??`field::${et}::error-text`,at=(s==null?void 0:s.helperText)??`field::${et}::helper-text`,lt=(s==null?void 0:s.label)??`field::${et}::label`;useSafeLayoutEffect(()=>{const wt=j.current;if(!wt)return;const Ct=getWindow$1(wt),kt=Ct.document,It=()=>{st(!!kt.getElementById(ot)),nt(!!kt.getElementById(at))};It();const Pt=new Ct.MutationObserver(It);return Pt.observe(wt,{childList:!0,subtree:!0}),()=>Pt.disconnect()},[ot,at]);const ut=reactExports.useMemo(()=>{const wt=[];return tt&&_&&wt.push(ot),it&&wt.push(at),wt.join(" ")||void 0},[_,ot,at,tt,it]),ct=reactExports.useMemo(()=>()=>({...parts$7.root.attrs,id:rt,ref:j,role:"group","data-disabled":dataAttr$1(a),"data-invalid":dataAttr$1(_),"data-readonly":dataAttr$1($)}),[a,_,$,rt]),dt=reactExports.useMemo(()=>()=>({...parts$7.label.attrs,id:lt,"data-disabled":dataAttr$1(a),"data-invalid":dataAttr$1(_),"data-readonly":dataAttr$1($),htmlFor:et}),[a,_,$,et,lt]),ft=reactExports.useMemo(()=>()=>({"aria-describedby":ut,"aria-invalid":ariaAttr(_),"data-invalid":dataAttr$1(_),"data-required":dataAttr$1(_e),"data-readonly":dataAttr$1($),id:et,required:_e,disabled:a,readOnly:$}),[ut,_,_e,$,et,a]),ht=reactExports.useMemo(()=>()=>({...ft(),...parts$7.input.attrs}),[ft]),bt=reactExports.useMemo(()=>()=>({...ft(),...parts$7.textarea.attrs}),[ft]),yt=reactExports.useMemo(()=>()=>({...ft(),...parts$7.select.attrs}),[ft]),mt=reactExports.useMemo(()=>()=>({id:at,...parts$7.helperText.attrs,"data-disabled":dataAttr$1(a)}),[a,at]),gt=reactExports.useMemo(()=>()=>({id:ot,...parts$7.errorText.attrs,"aria-live":"polite"}),[ot]),vt=reactExports.useMemo(()=>()=>({"aria-hidden":!0,...parts$7.requiredIndicator.attrs}),[]);return{ariaDescribedby:ut,ids:{root:rt,control:et,label:lt,errorText:ot,helperText:at},refs:{rootRef:j},disabled:a,invalid:_,readOnly:$,required:_e,getLabelProps:dt,getRootProps:ct,getInputProps:ht,getTextareaProps:bt,getSelectProps:yt,getHelperTextProps:mt,getErrorTextProps:gt,getRequiredIndicatorProps:vt}},FieldRoot$1=reactExports.forwardRef((i,o)=>{const[s,a]=createSplitProps()(i,["id","ids","disabled","invalid","readOnly","required"]),_=useField(s),$=mergeProps(_.getRootProps(),a);return jsxRuntimeExports.jsx(FieldProvider,{value:_,children:jsxRuntimeExports.jsx(ark.div,{...$,ref:composeRefs(o,_.refs.rootRef)})})});FieldRoot$1.displayName="FieldRoot";var autoresizeTextarea=i=>{var it,nt;if(!i)return;const o=getComputedStyle$2(i),s=getWindow$1(i),a=getDocument(i),_=()=>{requestAnimationFrame(()=>{i.style.height="auto";let et;o.boxSizing==="content-box"?et=i.scrollHeight-(parseFloat(o.paddingTop)+parseFloat(o.paddingBottom)):et=i.scrollHeight+parseFloat(o.borderTopWidth)+parseFloat(o.borderBottomWidth),o.maxHeight!=="none"&&et>parseFloat(o.maxHeight)?(o.overflowY==="hidden"&&(i.style.overflowY="scroll"),et=parseFloat(o.maxHeight)):o.overflowY!=="hidden"&&(i.style.overflowY="hidden"),i.style.height=`${et}px`})};i.addEventListener("input",_),(it=i.form)==null||it.addEventListener("reset",_);const $=Object.getPrototypeOf(i),_e=Object.getOwnPropertyDescriptor($,"value");Object.defineProperty(i,"value",{..._e,set(){var et;(et=_e==null?void 0:_e.set)==null||et.apply(this,arguments),_()}});const tt=new s.ResizeObserver(()=>{requestAnimationFrame(()=>_())});tt.observe(i);const st=new s.MutationObserver(()=>_());return st.observe(i,{attributes:!0,attributeFilter:["rows","placeholder"]}),(nt=a.fonts)==null||nt.addEventListener("loadingdone",_),()=>{var et,j;i.removeEventListener("input",_),(et=i.form)==null||et.removeEventListener("reset",_),(j=a.fonts)==null||j.removeEventListener("loadingdone",_),tt.disconnect(),st.disconnect()}};const FieldTextarea=reactExports.forwardRef((i,o)=>{const{autoresize:s,...a}=i,_=reactExports.useRef(null),$=useFieldContext(),_e=mergeProps($==null?void 0:$.getTextareaProps(),{style:{resize:s?"none":void 0}},a);return reactExports.useEffect(()=>{if(s)return autoresizeTextarea(_.current)},[s]),jsxRuntimeExports.jsx(ark.textarea,{..._e,ref:composeRefs(o,_)})});FieldTextarea.displayName="FieldTextarea";const fieldsetAnatomy$1=createAnatomy("fieldset").parts("root","errorText","helperText","legend");fieldsetAnatomy$1.build();var anatomy$f=createAnatomy("file-upload").parts("root","dropzone","item","itemDeleteTrigger","itemGroup","itemName","itemPreview","itemPreviewImage","itemSizeText","label","trigger","clearTrigger");anatomy$f.build();createProps$1()(["accept","allowDrop","capture","dir","directory","disabled","getRootNode","id","ids","locale","maxFiles","maxFileSize","minFileSize","name","invalid","onFileAccept","onFileReject","onFileChange","preventDocumentDrop","required","translations","validate"]);createProps$1()(["file"]);var anatomy$e=createAnatomy("hoverCard").parts("arrow","arrowTip","trigger","positioner","content");anatomy$e.build();createProps$1()(["closeDelay","dir","getRootNode","id","ids","onOpenChange","defaultOpen","open","openDelay","positioning","onInteractOutside","onPointerDownOutside","onFocusOutside"]);const[MenuProvider,useMenuContext]=createContext({name:"MenuContext",hookName:"useMenuContext",providerName:"",strict:!1}),MenuArrow=reactExports.forwardRef((i,o)=>{const s=useMenuContext(),a=mergeProps(s.getArrowProps(),i);return jsxRuntimeExports.jsx(ark.div,{...a,ref:o})});MenuArrow.displayName="MenuArrow";const MenuArrowTip$1=reactExports.forwardRef((i,o)=>{const s=useMenuContext(),a=mergeProps(s.getArrowTipProps(),i);return jsxRuntimeExports.jsx(ark.div,{...a,ref:o})});MenuArrowTip$1.displayName="MenuArrowTip";const[MenuItemProvider,useMenuItemContext]=createContext({name:"MenuItemContext",hookName:"useMenuItemContext",providerName:""}),[MenuOptionItemPropsProvider,useMenuOptionItemPropsContext]=createContext({name:"MenuOptionItemPropsContext",hookName:"useMenuOptionItemPropsContext",providerName:""}),MenuCheckboxItem=reactExports.forwardRef((i,o)=>{const[s,a]=createSplitProps()(i,["checked","closeOnSelect","disabled","onCheckedChange","value","valueText"]),_={...s,type:"checkbox"},$=useMenuContext(),_e=mergeProps($.getOptionItemProps(_),a),tt=$.getOptionItemState(_);return jsxRuntimeExports.jsx(MenuOptionItemPropsProvider,{value:_,children:jsxRuntimeExports.jsx(MenuItemProvider,{value:tt,children:jsxRuntimeExports.jsx(ark.div,{..._e,ref:o})})})});MenuCheckboxItem.displayName="MenuCheckboxItem";const MenuContent$1=reactExports.forwardRef((i,o)=>{const s=useMenuContext(),a=usePresenceContext(),_=mergeProps(s.getContentProps(),a.getPresenceProps(),i);return a.unmounted?null:jsxRuntimeExports.jsx(ark.div,{..._,ref:composeRefs(a.ref,o)})});MenuContent$1.displayName="MenuContent";const MenuContextTrigger=reactExports.forwardRef((i,o)=>{const s=useMenuContext(),a=mergeProps(s.getContextTriggerProps(),i);return jsxRuntimeExports.jsx(ark.button,{...a,ref:o})});MenuContextTrigger.displayName="MenuContextTrigger";const MenuIndicator=reactExports.forwardRef((i,o)=>{const s=useMenuContext(),a=mergeProps(s.getIndicatorProps(),i);return jsxRuntimeExports.jsx(ark.div,{...a,ref:o})});MenuIndicator.displayName="MenuIndicator";const MenuItem=reactExports.forwardRef((i,o)=>{const[s,a]=createSplitProps()(i,["closeOnSelect","disabled","value","valueText","onSelect"]),_=useMenuContext(),$=mergeProps(_.getItemProps(s),a),_e=_.getItemState(s);return reactExports.useEffect(()=>_.addItemListener({id:_e.id,onSelect:s.onSelect}),[_e.id,s.onSelect]),jsxRuntimeExports.jsx(MenuItemProvider,{value:_e,children:jsxRuntimeExports.jsx(ark.div,{...$,ref:o})})});MenuItem.displayName="MenuItem";const[MenuItemGroupProvider,useMenuItemGroupContext]=createContext({name:"MenuItemGroupContext",hookName:"useMenuItemGroupContext",providerName:""}),MenuItemGroup=reactExports.forwardRef((i,o)=>{const[s,a]=createSplitProps()(i,["id"]),_=useMenuContext(),_e={id:reactExports.useId(),...s},tt=mergeProps(_.getItemGroupProps(_e),a);return jsxRuntimeExports.jsx(MenuItemGroupProvider,{value:_e,children:jsxRuntimeExports.jsx(ark.div,{...tt,ref:o})})});MenuItemGroup.displayName="MenuItemGroup";const MenuItemGroupLabel=reactExports.forwardRef((i,o)=>{const s=useMenuContext(),a=useMenuItemGroupContext(),_=mergeProps(s.getItemGroupLabelProps({htmlFor:a.id}),i);return jsxRuntimeExports.jsx(ark.div,{..._,ref:o})});MenuItemGroupLabel.displayName="MenuItemGroupLabel";const MenuItemIndicator$1=reactExports.forwardRef((i,o)=>{const s=useMenuContext(),a=useMenuOptionItemPropsContext(),_=mergeProps(s.getItemIndicatorProps(a),i);return jsxRuntimeExports.jsx(ark.div,{..._,ref:o})});MenuItemIndicator$1.displayName="MenuItemIndicator";const MenuItemText=reactExports.forwardRef((i,o)=>{const s=useMenuContext(),a=useMenuOptionItemPropsContext(),_=mergeProps(s.getItemTextProps(a),i);return jsxRuntimeExports.jsx(ark.div,{..._,ref:o})});MenuItemText.displayName="MenuItemText";const MenuPositioner$1=reactExports.forwardRef((i,o)=>{const s=useMenuContext(),a=mergeProps(s.getPositionerProps(),i);return usePresenceContext().unmounted?null:jsxRuntimeExports.jsx(ark.div,{...a,ref:o})});MenuPositioner$1.displayName="MenuPositioner";const MenuRadioItem$1=reactExports.forwardRef((i,o)=>{const[s,a]=createSplitProps()(i,["closeOnSelect","disabled","value","valueText"]),_=useMenuContext(),$=useMenuItemGroupContext(),_e={...s,checked:$.value===s.value,type:"radio",onCheckedChange:()=>{var it;return(it=$.onValueChange)==null?void 0:it.call($,{value:s.value})}},tt=mergeProps(_.getOptionItemProps(_e),a),st=_.getOptionItemState(_e);return jsxRuntimeExports.jsx(MenuOptionItemPropsProvider,{value:_e,children:jsxRuntimeExports.jsx(MenuItemProvider,{value:st,children:jsxRuntimeExports.jsx(ark.div,{...tt,ref:o})})})});MenuRadioItem$1.displayName="MenuRadioItem";const MenuRadioItemGroup$1=reactExports.forwardRef((i,o)=>{const[s,a]=createSplitProps()(i,["id","onValueChange","value"]),_=useMenuContext(),_e={id:reactExports.useId(),...s},tt=mergeProps(_.getItemGroupProps({id:_e.id}),a);return jsxRuntimeExports.jsx(MenuItemGroupProvider,{value:_e,children:jsxRuntimeExports.jsx(ark.div,{...tt,ref:o})})});MenuRadioItemGroup$1.displayName="MenuRadioItemGroup";const useEffectOnce=i=>{const o=reactExports.useRef(i),s=reactExports.useRef(!1);reactExports.useEffect(()=>{o.current=i}),reactExports.useEffect(()=>{s.current!==!0&&(s.current=!0,o.current())},[])};var createPoint=(i,o)=>({x:i,y:o});function createRect(i){const{x:o,y:s,width:a,height:_}=i,$=o+a/2,_e=s+_/2;return{x:o,y:s,width:a,height:_,minX:o,minY:s,maxX:o+a,maxY:s+_,midX:$,midY:_e,center:createPoint($,_e)}}function getRectCorners(i){const o=createPoint(i.minX,i.minY),s=createPoint(i.maxX,i.minY),a=createPoint(i.maxX,i.maxY),_=createPoint(i.minX,i.maxY);return{top:o,right:s,bottom:a,left:_}}function getElementPolygon(i,o){const s=createRect(i),{top:a,right:_,left:$,bottom:_e}=getRectCorners(s),[tt]=o.split("-");return{top:[$,a,_,_e],right:[a,_,_e,$],bottom:[a,$,_e,_],left:[_,a,$,_e]}[tt]}function isPointInPolygon(i,o){const{x:s,y:a}=o;let _=!1;for(let $=0,_e=i.length-1;$a!=nt>a&&s<(it-tt)*(a-st)/(nt-st)+tt&&(_=!_)}return _}var anatomy$d=createAnatomy("menu").parts("arrow","arrowTip","content","contextTrigger","indicator","item","itemGroup","itemGroupLabel","itemIndicator","itemText","positioner","separator","trigger","triggerItem"),parts$6=anatomy$d.build(),getTriggerId$3=i=>{var o;return((o=i.ids)==null?void 0:o.trigger)??`menu:${i.id}:trigger`},getContextTriggerId=i=>{var o;return((o=i.ids)==null?void 0:o.contextTrigger)??`menu:${i.id}:ctx-trigger`},getContentId$3=i=>{var o;return((o=i.ids)==null?void 0:o.content)??`menu:${i.id}:content`},getArrowId$1=i=>{var o;return((o=i.ids)==null?void 0:o.arrow)??`menu:${i.id}:arrow`},getPositionerId$2=i=>{var o;return((o=i.ids)==null?void 0:o.positioner)??`menu:${i.id}:popper`},getGroupId=(i,o)=>{var s,a;return((a=(s=i.ids)==null?void 0:s.group)==null?void 0:a.call(s,o))??`menu:${i.id}:group:${o}`},getItemId$1=(i,o)=>`${i.id}/${o}`,getItemValue=i=>(i==null?void 0:i.dataset.value)??null,getGroupLabelId=(i,o)=>{var s,a;return((a=(s=i.ids)==null?void 0:s.groupLabel)==null?void 0:a.call(s,o))??`menu:${i.id}:group-label:${o}`},getContentEl$2=i=>i.getById(getContentId$3(i)),getPositionerEl$2=i=>i.getById(getPositionerId$2(i)),getTriggerEl$3=i=>i.getById(getTriggerId$3(i)),getItemEl$1=(i,o)=>o?i.getById(getItemId$1(i,o)):null,getContextTriggerEl=i=>i.getById(getContextTriggerId(i)),getElements$1=i=>{const s=`[role^="menuitem"][data-ownedby=${CSS.escape(getContentId$3(i))}]:not([data-disabled])`;return queryAll(getContentEl$2(i),s)},getFirstEl=i=>first(getElements$1(i)),getLastEl=i=>last(getElements$1(i)),isMatch=(i,o)=>o?i.id===o||i.dataset.value===o:!1,getNextEl=(i,o)=>{const s=getElements$1(i),a=s.findIndex(_=>isMatch(_,o.value));return next(s,a,{loop:o.loop??o.loopFocus})},getPrevEl=(i,o)=>{const s=getElements$1(i),a=s.findIndex(_=>isMatch(_,o.value));return prev(s,a,{loop:o.loop??o.loopFocus})},getElemByKey=(i,o)=>{const s=getElements$1(i),a=s.find(_=>isMatch(_,o.value));return getByTypeahead(s,{state:o.typeaheadState,key:o.key,activeId:(a==null?void 0:a.id)??null})},isTargetDisabled=i=>isHTMLElement$1(i)&&(i.dataset.disabled===""||i.hasAttribute("disabled")),isTriggerItem=i=>{var o;return!!((o=i==null?void 0:i.getAttribute("role"))!=null&&o.startsWith("menuitem"))&&!!(i!=null&&i.hasAttribute("aria-controls"))},itemSelectEvent="menu:select";function dispatchSelectionEvent(i,o){if(!i)return;const s=getWindow$1(i),a=new s.CustomEvent(itemSelectEvent,{detail:{value:o}});i.dispatchEvent(a)}function connect$6(i,o){const{context:s,send:a,state:_,computed:$,prop:_e,scope:tt}=i,st=_.hasTag("open"),it=$("isSubmenu"),nt=$("isTypingAhead"),et=_e("composite"),j=s.get("currentPlacement"),rt=s.get("anchorPoint"),ot=s.get("highlightedValue"),at=getPlacementStyles({..._e("positioning"),placement:rt?"bottom":j});function lt(ft){return{id:getItemId$1(tt,ft.value),disabled:!!ft.disabled,highlighted:ot===ft.value}}function ut(ft){const ht=ft.valueText??ft.value;return{...ft,id:ft.value,valueText:ht}}function ct(ft){return{...lt(ut(ft)),checked:!!ft.checked}}function dt(ft){const{closeOnSelect:ht,valueText:bt,value:yt}=ft,mt=lt(ft),gt=getItemId$1(tt,yt);return o.element({...parts$6.item.attrs,id:gt,role:"menuitem","aria-disabled":ariaAttr(mt.disabled),"data-disabled":dataAttr$1(mt.disabled),"data-ownedby":getContentId$3(tt),"data-highlighted":dataAttr$1(mt.highlighted),"data-value":yt,"data-valuetext":bt,onDragStart(vt){vt.currentTarget.matches("a[href]")&&vt.preventDefault()},onPointerMove(vt){if(mt.disabled||vt.pointerType!=="mouse")return;const wt=vt.currentTarget;mt.highlighted||a({type:"ITEM_POINTERMOVE",id:gt,target:wt,closeOnSelect:ht})},onPointerLeave(vt){var kt;if(mt.disabled||vt.pointerType!=="mouse"||!((kt=i.event.previous())==null?void 0:kt.type.includes("POINTER")))return;const Ct=vt.currentTarget;a({type:"ITEM_POINTERLEAVE",id:gt,target:Ct,closeOnSelect:ht})},onPointerDown(vt){if(mt.disabled)return;const wt=vt.currentTarget;a({type:"ITEM_POINTERDOWN",target:wt,id:gt,closeOnSelect:ht})},onClick(vt){if(isDownloadingEvent(vt)||isOpeningInNewTab(vt)||mt.disabled)return;const wt=vt.currentTarget;a({type:"ITEM_CLICK",target:wt,id:gt,closeOnSelect:ht})}})}return{highlightedValue:ot,open:st,setOpen(ft){_.hasTag("open")!==ft&&a({type:ft?"OPEN":"CLOSE"})},setHighlightedValue(ft){a({type:"HIGHLIGHTED.SET",value:ft})},setParent(ft){a({type:"PARENT.SET",value:ft,id:ft.prop("id")})},setChild(ft){a({type:"CHILD.SET",value:ft,id:ft.prop("id")})},reposition(ft={}){a({type:"POSITIONING.SET",options:ft})},addItemListener(ft){const ht=tt.getById(ft.id);if(!ht)return;const bt=()=>{var yt;return(yt=ft.onSelect)==null?void 0:yt.call(ft)};return ht.addEventListener(itemSelectEvent,bt),()=>ht.removeEventListener(itemSelectEvent,bt)},getContextTriggerProps(){return o.element({...parts$6.contextTrigger.attrs,dir:_e("dir"),id:getContextTriggerId(tt),onPointerDown(ft){if(ft.pointerType==="mouse")return;const ht=getEventPoint(ft);a({type:"CONTEXT_MENU_START",point:ht})},onPointerCancel(ft){ft.pointerType!=="mouse"&&a({type:"CONTEXT_MENU_CANCEL"})},onPointerMove(ft){ft.pointerType!=="mouse"&&a({type:"CONTEXT_MENU_CANCEL"})},onPointerUp(ft){ft.pointerType!=="mouse"&&a({type:"CONTEXT_MENU_CANCEL"})},onContextMenu(ft){const ht=getEventPoint(ft);a({type:"CONTEXT_MENU",point:ht}),ft.preventDefault()},style:{WebkitTouchCallout:"none",WebkitUserSelect:"none",userSelect:"none"}})},getTriggerItemProps(ft){const ht=ft.getTriggerProps();return mergeProps(dt({value:ht.id}),ht)},getTriggerProps(){return o.button({...it?parts$6.triggerItem.attrs:parts$6.trigger.attrs,"data-placement":s.get("currentPlacement"),type:"button",dir:_e("dir"),id:getTriggerId$3(tt),"data-uid":_e("id"),"aria-haspopup":et?"menu":"dialog","aria-controls":getContentId$3(tt),"aria-expanded":st||void 0,"data-state":st?"open":"closed",onPointerMove(ft){if(ft.pointerType!=="mouse"||isTargetDisabled(ft.currentTarget)||!it)return;const bt=getEventPoint(ft);a({type:"TRIGGER_POINTERMOVE",target:ft.currentTarget,point:bt})},onPointerLeave(ft){if(isTargetDisabled(ft.currentTarget)||ft.pointerType!=="mouse"||!it)return;const ht=getEventPoint(ft);a({type:"TRIGGER_POINTERLEAVE",target:ft.currentTarget,point:ht})},onPointerDown(ft){isTargetDisabled(ft.currentTarget)||isContextMenuEvent(ft)||ft.preventDefault()},onClick(ft){ft.defaultPrevented||isTargetDisabled(ft.currentTarget)||a({type:"TRIGGER_CLICK",target:ft.currentTarget})},onBlur(){a({type:"TRIGGER_BLUR"})},onFocus(){a({type:"TRIGGER_FOCUS"})},onKeyDown(ft){if(ft.defaultPrevented)return;const ht={ArrowDown(){a({type:"ARROW_DOWN"})},ArrowUp(){a({type:"ARROW_UP"})},Enter(){a({type:"ARROW_DOWN",src:"enter"})},Space(){a({type:"ARROW_DOWN",src:"space"})}},bt=getEventKey(ft,{orientation:"vertical",dir:_e("dir")}),yt=ht[bt];yt&&(ft.preventDefault(),yt(ft))}})},getIndicatorProps(){return o.element({...parts$6.indicator.attrs,dir:_e("dir"),"data-state":st?"open":"closed"})},getPositionerProps(){return o.element({...parts$6.positioner.attrs,dir:_e("dir"),id:getPositionerId$2(tt),style:at.floating})},getArrowProps(){return o.element({id:getArrowId$1(tt),...parts$6.arrow.attrs,dir:_e("dir"),style:at.arrow})},getArrowTipProps(){return o.element({...parts$6.arrowTip.attrs,dir:_e("dir"),style:at.arrowTip})},getContentProps(){return o.element({...parts$6.content.attrs,id:getContentId$3(tt),"aria-label":_e("aria-label"),hidden:!st,"data-state":st?"open":"closed",role:et?"menu":"dialog",tabIndex:0,dir:_e("dir"),"aria-activedescendant":$("highlightedId")||void 0,"aria-labelledby":getTriggerId$3(tt),"data-placement":j,onPointerEnter(ft){ft.pointerType==="mouse"&&a({type:"MENU_POINTERENTER"})},onKeyDown(ft){if(ft.defaultPrevented||!isSelfTarget(ft))return;const ht=getEventTarget(ft);if(!((ht==null?void 0:ht.closest("[role=menu]"))===ft.currentTarget||ht===ft.currentTarget))return;if(ft.key==="Tab"&&!isValidTabEvent(ft)){ft.preventDefault();return}const yt=getItemEl$1(tt,ot),mt={ArrowDown(){a({type:"ARROW_DOWN"})},ArrowUp(){a({type:"ARROW_UP"})},ArrowLeft(){a({type:"ARROW_LEFT"})},ArrowRight(){a({type:"ARROW_RIGHT"})},Enter(){var wt;a({type:"ENTER"}),isAnchorElement(yt)&&((wt=_e("navigate"))==null||wt({value:ot,node:yt}))},Space(wt){var Ct;nt?a({type:"TYPEAHEAD",key:wt.key}):(Ct=mt.Enter)==null||Ct.call(mt,wt)},Home(){a({type:"HOME"})},End(){a({type:"END"})}},gt=getEventKey(ft,{dir:_e("dir")}),vt=mt[gt];if(vt){vt(ft),ft.stopPropagation(),ft.preventDefault();return}_e("typeahead")&&isPrintableKey(ft)&&(isModifierKey(ft)||isEditableElement(ht)||(a({type:"TYPEAHEAD",key:ft.key}),ft.preventDefault()))}})},getSeparatorProps(){return o.element({...parts$6.separator.attrs,role:"separator",dir:_e("dir"),"aria-orientation":"horizontal"})},getItemState:lt,getItemProps:dt,getOptionItemState:ct,getOptionItemProps(ft){const{type:ht,disabled:bt,onCheckedChange:yt,closeOnSelect:mt}=ft,gt=ut(ft),vt=ct(ft);return{...dt(gt),...o.element({"data-type":ht,...parts$6.item.attrs,dir:_e("dir"),"data-value":gt.value,role:`menuitem${ht}`,"aria-checked":!!vt.checked,"data-state":vt.checked?"checked":"unchecked",onClick(wt){if(bt||isDownloadingEvent(wt)||isOpeningInNewTab(wt))return;const Ct=wt.currentTarget;a({type:"ITEM_CLICK",target:Ct,option:gt,closeOnSelect:mt}),yt==null||yt(!vt.checked)}})}},getItemIndicatorProps(ft){const ht=ct(ft);return o.element({...parts$6.itemIndicator.attrs,dir:_e("dir"),"data-disabled":dataAttr$1(ht.disabled),"data-highlighted":dataAttr$1(ht.highlighted),"data-state":ht.checked?"checked":"unchecked",hidden:!ht.checked})},getItemTextProps(ft){const ht=ct(ft);return o.element({...parts$6.itemText.attrs,dir:_e("dir"),"data-disabled":dataAttr$1(ht.disabled),"data-highlighted":dataAttr$1(ht.highlighted),"data-state":ht.checked?"checked":"unchecked"})},getItemGroupLabelProps(ft){return o.element({...parts$6.itemGroupLabel.attrs,id:getGroupLabelId(tt,ft.htmlFor),dir:_e("dir")})},getItemGroupProps(ft){return o.element({id:getGroupId(tt,ft.id),...parts$6.itemGroup.attrs,dir:_e("dir"),"aria-labelledby":getGroupLabelId(tt,ft.id),role:"group"})}}}var{not:not$6,and:and$3,or:or$1}=createGuards(),machine$6={props({props:i}){return{closeOnSelect:!0,typeahead:!0,composite:!0,loopFocus:!1,navigate(o){clickIfLink(o.node)},...i,positioning:{placement:"bottom-start",gutter:8,...i.positioning}}},initialState({prop:i}){return i("open")||i("defaultOpen")?"open":"idle"},context({bindable:i,prop:o}){return{suspendPointer:i(()=>({defaultValue:!1})),highlightedValue:i(()=>({defaultValue:o("defaultHighlightedValue")||null,value:o("highlightedValue"),onChange(s){var a;(a=o("onHighlightChange"))==null||a({highlightedValue:s})}})),lastHighlightedValue:i(()=>({defaultValue:null})),currentPlacement:i(()=>({defaultValue:void 0})),intentPolygon:i(()=>({defaultValue:null})),anchorPoint:i(()=>({defaultValue:null,hash(s){return`x: ${s==null?void 0:s.x}, y: ${s==null?void 0:s.y}`}}))}},refs(){return{parent:null,children:{},typeaheadState:{...getByTypeahead.defaultOptions},positioningOverride:{}}},computed:{isSubmenu:({refs:i})=>i.get("parent")!=null,isRtl:({prop:i})=>i("dir")==="rtl",isTypingAhead:({refs:i})=>i.get("typeaheadState").keysSoFar!=="",highlightedId:({context:i,scope:o,refs:s})=>resolveItemId(s.get("children"),i.get("highlightedValue"),o)},watch({track:i,action:o,context:s,computed:a,prop:_}){i([()=>a("isSubmenu")],()=>{o(["setSubmenuPlacement"])}),i([()=>s.hash("anchorPoint")],()=>{o(["reposition"])}),i([()=>_("open")],()=>{o(["toggleVisibility"])})},on:{"PARENT.SET":{actions:["setParentMenu"]},"CHILD.SET":{actions:["setChildMenu"]},OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen"]}],OPEN_AUTOFOCUS:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["highlightFirstItem","invokeOnOpen"]}],CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}],"HIGHLIGHTED.RESTORE":{actions:["restoreHighlightedItem"]},"HIGHLIGHTED.SET":{actions:["setHighlightedItem"]}},states:{idle:{tags:["closed"],on:{"CONTROLLED.OPEN":{target:"open"},"CONTROLLED.CLOSE":{target:"closed"},CONTEXT_MENU_START:{target:"opening:contextmenu",actions:["setAnchorPoint"]},CONTEXT_MENU:[{guard:"isOpenControlled",actions:["setAnchorPoint","invokeOnOpen"]},{target:"open",actions:["setAnchorPoint","invokeOnOpen"]}],TRIGGER_CLICK:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen"]}],TRIGGER_FOCUS:{guard:not$6("isSubmenu"),target:"closed"},TRIGGER_POINTERMOVE:{guard:"isSubmenu",target:"opening"}}},"opening:contextmenu":{tags:["closed"],effects:["waitForLongPress"],on:{"CONTROLLED.OPEN":{target:"open"},"CONTROLLED.CLOSE":{target:"closed"},CONTEXT_MENU_CANCEL:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}],"LONG_PRESS.OPEN":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen"]}]}},opening:{tags:["closed"],effects:["waitForOpenDelay"],on:{"CONTROLLED.OPEN":{target:"open"},"CONTROLLED.CLOSE":{target:"closed"},BLUR:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}],TRIGGER_POINTERLEAVE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}],"DELAY.OPEN":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen"]}]}},closing:{tags:["open"],effects:["trackPointerMove","trackInteractOutside","waitForCloseDelay"],on:{"CONTROLLED.OPEN":{target:"open"},"CONTROLLED.CLOSE":{target:"closed",actions:["focusParentMenu","restoreParentHighlightedItem"]},MENU_POINTERENTER:{target:"open",actions:["clearIntentPolygon"]},POINTER_MOVED_AWAY_FROM_SUBMENU:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["focusParentMenu","restoreParentHighlightedItem"]}],"DELAY.CLOSE":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["focusParentMenu","restoreParentHighlightedItem","invokeOnClose"]}]}},closed:{tags:["closed"],entry:["clearHighlightedItem","focusTrigger","resumePointer"],on:{"CONTROLLED.OPEN":[{guard:or$1("isOpenAutoFocusEvent","isArrowDownEvent"),target:"open",actions:["highlightFirstItem"]},{guard:"isArrowUpEvent",target:"open",actions:["highlightLastItem"]},{target:"open"}],CONTEXT_MENU_START:{target:"opening:contextmenu",actions:["setAnchorPoint"]},CONTEXT_MENU:[{guard:"isOpenControlled",actions:["setAnchorPoint","invokeOnOpen"]},{target:"open",actions:["setAnchorPoint","invokeOnOpen"]}],TRIGGER_CLICK:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen"]}],TRIGGER_POINTERMOVE:{guard:"isTriggerItem",target:"opening"},TRIGGER_BLUR:{target:"idle"},ARROW_DOWN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["highlightFirstItem","invokeOnOpen"]}],ARROW_UP:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["highlightLastItem","invokeOnOpen"]}]}},open:{tags:["open"],effects:["trackInteractOutside","trackPositioning","scrollToHighlightedItem"],entry:["focusMenu","resumePointer"],on:{"CONTROLLED.CLOSE":[{target:"closed",guard:"isArrowLeftEvent",actions:["focusParentMenu"]},{target:"closed"}],TRIGGER_CLICK:[{guard:and$3(not$6("isTriggerItem"),"isOpenControlled"),actions:["invokeOnClose"]},{guard:not$6("isTriggerItem"),target:"closed",actions:["invokeOnClose"]}],CONTEXT_MENU:{actions:["setAnchorPoint","focusMenu"]},ARROW_UP:{actions:["highlightPrevItem","focusMenu"]},ARROW_DOWN:{actions:["highlightNextItem","focusMenu"]},ARROW_LEFT:[{guard:and$3("isSubmenu","isOpenControlled"),actions:["invokeOnClose"]},{guard:"isSubmenu",target:"closed",actions:["focusParentMenu","invokeOnClose"]}],HOME:{actions:["highlightFirstItem","focusMenu"]},END:{actions:["highlightLastItem","focusMenu"]},ARROW_RIGHT:{guard:"isTriggerItemHighlighted",actions:["openSubmenu"]},ENTER:[{guard:"isTriggerItemHighlighted",actions:["openSubmenu"]},{actions:["clickHighlightedItem"]}],ITEM_POINTERMOVE:[{guard:not$6("isPointerSuspended"),actions:["setHighlightedItem","focusMenu"]},{actions:["setLastHighlightedItem"]}],ITEM_POINTERLEAVE:{guard:and$3(not$6("isPointerSuspended"),not$6("isTriggerItem")),actions:["clearHighlightedItem"]},ITEM_CLICK:[{guard:and$3(not$6("isTriggerItemHighlighted"),not$6("isHighlightedItemEditable"),"closeOnSelect","isOpenControlled"),actions:["invokeOnSelect","setOptionState","closeRootMenu","invokeOnClose"]},{guard:and$3(not$6("isTriggerItemHighlighted"),not$6("isHighlightedItemEditable"),"closeOnSelect"),target:"closed",actions:["invokeOnSelect","setOptionState","closeRootMenu","invokeOnClose"]},{guard:and$3(not$6("isTriggerItemHighlighted"),not$6("isHighlightedItemEditable")),actions:["invokeOnSelect","setOptionState"]},{actions:["setHighlightedItem"]}],TRIGGER_POINTERMOVE:{guard:"isTriggerItem",actions:["setIntentPolygon"]},TRIGGER_POINTERLEAVE:{target:"closing"},ITEM_POINTERDOWN:{actions:["setHighlightedItem"]},TYPEAHEAD:{actions:["highlightMatchedItem"]},FOCUS_MENU:{actions:["focusMenu"]},"POSITIONING.SET":{actions:["reposition"]}}}},implementations:{guards:{closeOnSelect:({prop:i,event:o})=>!!((o==null?void 0:o.closeOnSelect)??i("closeOnSelect")),isTriggerItem:({event:i})=>isTriggerItem(i.target),isTriggerItemHighlighted:({event:i,scope:o,computed:s})=>{const a=i.target??o.getById(s("highlightedId"));return!!(a!=null&&a.hasAttribute("aria-controls"))},isSubmenu:({computed:i})=>i("isSubmenu"),isPointerSuspended:({context:i})=>i.get("suspendPointer"),isHighlightedItemEditable:({scope:i,computed:o})=>isEditableElement(i.getById(o("highlightedId"))),isOpenControlled:({prop:i})=>i("open")!==void 0,isArrowLeftEvent:({event:i})=>{var o;return((o=i.previousEvent)==null?void 0:o.type)==="ARROW_LEFT"},isArrowUpEvent:({event:i})=>{var o;return((o=i.previousEvent)==null?void 0:o.type)==="ARROW_UP"},isArrowDownEvent:({event:i})=>{var o;return((o=i.previousEvent)==null?void 0:o.type)==="ARROW_DOWN"},isOpenAutoFocusEvent:({event:i})=>{var o;return((o=i.previousEvent)==null?void 0:o.type)==="OPEN_AUTOFOCUS"}},effects:{waitForOpenDelay({send:i}){const o=setTimeout(()=>{i({type:"DELAY.OPEN"})},100);return()=>clearTimeout(o)},waitForCloseDelay({send:i}){const o=setTimeout(()=>{i({type:"DELAY.CLOSE"})},300);return()=>clearTimeout(o)},waitForLongPress({send:i}){const o=setTimeout(()=>{i({type:"LONG_PRESS.OPEN"})},700);return()=>clearTimeout(o)},trackPositioning({context:i,prop:o,scope:s,refs:a}){if(getContextTriggerEl(s))return;const _={...o("positioning"),...a.get("positioningOverride")};i.set("currentPlacement",_.placement);const $=()=>getPositionerEl$2(s);return getPlacement(getTriggerEl$3(s),$,{..._,defer:!0,onComplete(_e){i.set("currentPlacement",_e.placement)}})},trackInteractOutside({refs:i,scope:o,prop:s,computed:a,send:_}){const $=()=>getContentEl$2(o);let _e=!0;return trackDismissableElement($,{defer:!0,exclude:[getTriggerEl$3(o)],onInteractOutside:s("onInteractOutside"),onFocusOutside:s("onFocusOutside"),onEscapeKeyDown(tt){var st;(st=s("onEscapeKeyDown"))==null||st(tt),a("isSubmenu")&&tt.preventDefault(),closeRootMenu({parent:i.get("parent")})},onPointerDownOutside(tt){var nt;const st=getEventTarget(tt.detail.originalEvent);if(contains(getContextTriggerEl(o),st)&&tt.detail.contextmenu){tt.preventDefault();return}_e=!tt.detail.focusable,(nt=s("onPointerDownOutside"))==null||nt(tt)},onDismiss(){_({type:"CLOSE",src:"interact-outside",restoreFocus:_e})}})},trackPointerMove({context:i,scope:o,send:s,refs:a,flush:_}){const $=a.get("parent");_(()=>{$.context.set("suspendPointer",!0)});const _e=o.getDoc();return addDomEvent(_e,"pointermove",tt=>{isWithinPolygon(i.get("intentPolygon"),{x:tt.clientX,y:tt.clientY})||(s({type:"POINTER_MOVED_AWAY_FROM_SUBMENU"}),$.context.set("suspendPointer",!1))})},scrollToHighlightedItem({event:i,scope:o,computed:s}){const a=()=>{if(i.type.startsWith("ITEM_POINTER"))return;const $=o.getById(s("highlightedId")),_e=getContentEl$2(o);scrollIntoView($,{rootEl:_e,block:"nearest"})};return raf$1(()=>a()),observeAttributes(()=>getContentEl$2(o),{defer:!0,attributes:["aria-activedescendant"],callback:a})}},actions:{setAnchorPoint({context:i,event:o}){i.set("anchorPoint",o.point)},setSubmenuPlacement({computed:i,refs:o}){if(!i("isSubmenu"))return;const s=i("isRtl")?"left-start":"right-start";o.set("positioningOverride",{placement:s,gutter:0})},reposition({context:i,scope:o,prop:s,event:a,refs:_}){const $=()=>getPositionerEl$2(o),_e=i.get("anchorPoint"),tt=_e?()=>({width:0,height:0,..._e}):void 0,st={...s("positioning"),..._.get("positioningOverride")};getPlacement(getTriggerEl$3(o),$,{...st,defer:!0,getAnchorRect:tt,...a.options??{},listeners:!1,onComplete(it){i.set("currentPlacement",it.placement)}})},setOptionState({event:i}){if(!i.option)return;const{checked:o,onCheckedChange:s,type:a}=i.option;a==="radio"?s==null||s(!0):a==="checkbox"&&(s==null||s(!o))},clickHighlightedItem({scope:i,computed:o}){const s=i.getById(o("highlightedId"));!s||s.dataset.disabled||queueMicrotask(()=>s.click())},setIntentPolygon({context:i,scope:o,event:s}){const a=getContentEl$2(o),_=i.get("currentPlacement");if(!a||!_)return;const $=a.getBoundingClientRect(),_e=getElementPolygon($,_);if(!_e)return;const st=getPlacementSide(_)==="right"?-5:5;i.set("intentPolygon",[{...s.point,x:s.point.x+st},..._e])},clearIntentPolygon({context:i}){i.set("intentPolygon",null)},resumePointer({refs:i,flush:o}){const s=i.get("parent");s&&o(()=>{s.context.set("suspendPointer",!1)})},setHighlightedItem({context:i,event:o}){const s=o.value||getItemValue(o.target);i.set("highlightedValue",s)},clearHighlightedItem({context:i}){i.set("highlightedValue",null)},focusMenu({scope:i}){raf$1(()=>{const o=getContentEl$2(i),s=getInitialFocus({root:o,enabled:!contains(o,i.getActiveElement()),filter(a){var _;return!((_=a.role)!=null&&_.startsWith("menuitem"))}});s==null||s.focus({preventScroll:!0})})},highlightFirstItem({context:i,scope:o}){(getContentEl$2(o)?queueMicrotask:raf$1)(()=>{const a=getFirstEl(o);a&&i.set("highlightedValue",getItemValue(a))})},highlightLastItem({context:i,scope:o}){(getContentEl$2(o)?queueMicrotask:raf$1)(()=>{const a=getLastEl(o);a&&i.set("highlightedValue",getItemValue(a))})},highlightNextItem({context:i,scope:o,event:s,prop:a}){const _=getNextEl(o,{loop:s.loop,value:i.get("highlightedValue"),loopFocus:a("loopFocus")});i.set("highlightedValue",getItemValue(_))},highlightPrevItem({context:i,scope:o,event:s,prop:a}){const _=getPrevEl(o,{loop:s.loop,value:i.get("highlightedValue"),loopFocus:a("loopFocus")});i.set("highlightedValue",getItemValue(_))},invokeOnSelect({context:i,prop:o,scope:s}){var $;const a=i.get("highlightedValue");if(a==null)return;const _=getItemEl$1(s,a);dispatchSelectionEvent(_,a),($=o("onSelect"))==null||$({value:a})},focusTrigger({scope:i,context:o,event:s,computed:a}){a("isSubmenu")||o.get("anchorPoint")||s.restoreFocus===!1||queueMicrotask(()=>{var _;return(_=getTriggerEl$3(i))==null?void 0:_.focus({preventScroll:!0})})},highlightMatchedItem({scope:i,context:o,event:s,refs:a}){const _=getElemByKey(i,{key:s.key,value:o.get("highlightedValue"),typeaheadState:a.get("typeaheadState")});_&&o.set("highlightedValue",getItemValue(_))},setParentMenu({refs:i,event:o}){i.set("parent",o.value)},setChildMenu({refs:i,event:o}){const s=i.get("children");s[o.id]=o.value,i.set("children",s)},closeRootMenu({refs:i}){closeRootMenu({parent:i.get("parent")})},openSubmenu({refs:i,scope:o,computed:s}){const a=o.getById(s("highlightedId")),_=a==null?void 0:a.getAttribute("data-uid"),$=i.get("children"),_e=_?$[_]:null;_e==null||_e.send({type:"OPEN_AUTOFOCUS"})},focusParentMenu({refs:i}){var o;(o=i.get("parent"))==null||o.send({type:"FOCUS_MENU"})},setLastHighlightedItem({context:i,event:o}){i.set("lastHighlightedValue",getItemValue(o.target))},restoreHighlightedItem({context:i}){i.get("lastHighlightedValue")&&(i.set("highlightedValue",i.get("lastHighlightedValue")),i.set("lastHighlightedValue",null))},restoreParentHighlightedItem({refs:i}){var o;(o=i.get("parent"))==null||o.send({type:"HIGHLIGHTED.RESTORE"})},invokeOnOpen({prop:i}){var o;(o=i("onOpenChange"))==null||o({open:!0})},invokeOnClose({prop:i}){var o;(o=i("onOpenChange"))==null||o({open:!1})},toggleVisibility({prop:i,event:o,send:s}){s({type:i("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:o})}}}};function closeRootMenu(i){let o=i.parent;for(;o&&o.computed("isSubmenu");)o=o.refs.get("parent");o==null||o.send({type:"CLOSE"})}function isWithinPolygon(i,o){return i?isPointInPolygon(i,o):!1}function resolveItemId(i,o,s){const a=Object.keys(i).length>0;if(!o)return null;if(!a)return getItemId$1(s,o);for(const _ in i){const $=i[_],_e=getTriggerId$3($.scope);if(_e===o)return _e}return getItemId$1(s,o)}createProps$1()(["anchorPoint","aria-label","closeOnSelect","composite","defaultHighlightedValue","defaultOpen","dir","getRootNode","highlightedValue","id","ids","loopFocus","navigate","onEscapeKeyDown","onFocusOutside","onHighlightChange","onInteractOutside","onOpenChange","onPointerDownOutside","onSelect","open","positioning","typeahead"]);createProps$1()(["closeOnSelect","disabled","value","valueText"]);createProps$1()(["htmlFor"]);createProps$1()(["id"]);createProps$1()(["checked","closeOnSelect","disabled","onCheckedChange","type","value","valueText"]);const useMenu=i=>{const o=reactExports.useId(),{getRootNode:s}=useEnvironmentContext(),{dir:a}=useLocaleContext(),_={id:o,dir:a,getRootNode:s,...i},$=useMachine(machine$6,_);return{api:connect$6($,normalizeProps),service:$}},[MenuMachineProvider,useMenuMachineContext]=createContext({name:"MenuMachineContext",hookName:"useMenuMachineContext",providerName:"",strict:!1}),[MenuTriggerItemProvider,useMenuTriggerItemContext]=createContext({name:"MenuMachineContext",hookName:"useMenuMachineContext",providerName:"",strict:!1}),MenuRoot$1=i=>{const[o,s]=splitPresenceProps(i),[a,_]=createSplitProps()(s,["anchorPoint","aria-label","closeOnSelect","composite","defaultHighlightedValue","defaultOpen","highlightedValue","id","ids","loopFocus","navigate","onEscapeKeyDown","onFocusOutside","onHighlightChange","onInteractOutside","onOpenChange","onPointerDownOutside","onSelect","open","positioning","typeahead"]),$=useMenuContext(),_e=useMenuMachineContext(),{api:tt,service:st}=useMenu(a),it=usePresence(mergeProps({present:tt.open},o));useEffectOnce(()=>{_e&&$&&($.setChild(st),tt.setParent(_e))});const nt=reactExports.useCallback(()=>$==null?void 0:$.getTriggerItemProps(tt),[tt,$]);return jsxRuntimeExports.jsx(MenuTriggerItemProvider,{value:nt,children:jsxRuntimeExports.jsx(MenuMachineProvider,{value:st,children:jsxRuntimeExports.jsx(MenuProvider,{value:tt,children:jsxRuntimeExports.jsx(PresenceProvider,{value:it,..._})})})})},MenuRootProvider=i=>{const o=useMenuContext(),s=useMenuMachineContext(),[a,{value:_,children:$}]=splitPresenceProps(i),{api:_e,service:tt}=_,st=usePresence(mergeProps({present:_e.open},a));useEffectOnce(()=>{s&&o&&(o.setChild(tt),_e.setParent(s))});const it=reactExports.useCallback(()=>o==null?void 0:o.getTriggerItemProps(_e),[_e,o]);return jsxRuntimeExports.jsx(MenuTriggerItemProvider,{value:it,children:jsxRuntimeExports.jsx(MenuMachineProvider,{value:tt,children:jsxRuntimeExports.jsx(MenuProvider,{value:_e,children:jsxRuntimeExports.jsx(PresenceProvider,{value:st,children:$})})})})},MenuSeparator=reactExports.forwardRef((i,o)=>{const s=useMenuContext(),a=mergeProps(s.getSeparatorProps(),i);return jsxRuntimeExports.jsx(ark.hr,{...a,ref:o})});MenuSeparator.displayName="MenuSeparator";const MenuTrigger$1=reactExports.forwardRef((i,o)=>{const s=useMenuContext(),a=usePresenceContext(),_=mergeProps({...s.getTriggerProps(),"aria-controls":a.unmounted?void 0:s.getTriggerProps()["aria-controls"]},i);return jsxRuntimeExports.jsx(ark.button,{..._,ref:o})});MenuTrigger$1.displayName="MenuTrigger";const MenuTriggerItem=reactExports.forwardRef((i,o)=>{const s=useMenuTriggerItemContext(),a=mergeProps((s==null?void 0:s())??{},i);return jsxRuntimeExports.jsx(ark.div,{...a,ref:o})});MenuTriggerItem.displayName="MenuTriggerItem";const[NumberInputProvider,useNumberInputContext]=createContext({name:"NumberInputContext",hookName:"useNumberInputContext",providerName:""}),NumberInputControl$1=reactExports.forwardRef((i,o)=>{const s=useNumberInputContext(),a=mergeProps(s.getControlProps(),i);return jsxRuntimeExports.jsx(ark.div,{...a,ref:o})});NumberInputControl$1.displayName="NumberInputControl";const NumberInputDecrementTrigger$1=reactExports.forwardRef((i,o)=>{const s=useNumberInputContext(),a=mergeProps(s.getDecrementTriggerProps(),i);return jsxRuntimeExports.jsx(ark.button,{...a,ref:o})});NumberInputDecrementTrigger$1.displayName="NumberInputDecrementTrigger";const NumberInputIncrementTrigger$1=reactExports.forwardRef((i,o)=>{const s=useNumberInputContext(),a=mergeProps(s.getIncrementTriggerProps(),i);return jsxRuntimeExports.jsx(ark.button,{...a,ref:o})});NumberInputIncrementTrigger$1.displayName="NumberInputIncrementTrigger";const NumberInputInput$1=reactExports.forwardRef((i,o)=>{const s=useNumberInputContext(),a=mergeProps(s.getInputProps(),i),_=useFieldContext();return jsxRuntimeExports.jsx(ark.input,{"aria-describedby":_==null?void 0:_.ariaDescribedby,...a,ref:o})});NumberInputInput$1.displayName="NumberInputInput";const NumberInputLabel=reactExports.forwardRef((i,o)=>{const s=useNumberInputContext(),a=mergeProps(s.getLabelProps(),i);return jsxRuntimeExports.jsx(ark.label,{...a,ref:o})});NumberInputLabel.displayName="NumberInputLabel";let $488c6ddbf4ef74c2$var$formatterCache=new Map,$488c6ddbf4ef74c2$var$supportsSignDisplay=!1;try{$488c6ddbf4ef74c2$var$supportsSignDisplay=new Intl.NumberFormat("de-DE",{signDisplay:"exceptZero"}).resolvedOptions().signDisplay==="exceptZero"}catch{}let $488c6ddbf4ef74c2$var$supportsUnit=!1;try{$488c6ddbf4ef74c2$var$supportsUnit=new Intl.NumberFormat("de-DE",{style:"unit",unit:"degree"}).resolvedOptions().style==="unit"}catch{}const $488c6ddbf4ef74c2$var$UNITS={degree:{narrow:{default:"°","ja-JP":" 度","zh-TW":"度","sl-SI":" °"}}};class $488c6ddbf4ef74c2$export$cc77c4ff7e8673c5{format(o){let s="";if(!$488c6ddbf4ef74c2$var$supportsSignDisplay&&this.options.signDisplay!=null?s=$488c6ddbf4ef74c2$export$711b50b3c525e0f2(this.numberFormatter,this.options.signDisplay,o):s=this.numberFormatter.format(o),this.options.style==="unit"&&!$488c6ddbf4ef74c2$var$supportsUnit){var a;let{unit:_,unitDisplay:$="short",locale:_e}=this.resolvedOptions();if(!_)return s;let tt=(a=$488c6ddbf4ef74c2$var$UNITS[_])===null||a===void 0?void 0:a[$];s+=tt[_e]||tt.default}return s}formatToParts(o){return this.numberFormatter.formatToParts(o)}formatRange(o,s){if(typeof this.numberFormatter.formatRange=="function")return this.numberFormatter.formatRange(o,s);if(s= start date");return`${this.format(o)} – ${this.format(s)}`}formatRangeToParts(o,s){if(typeof this.numberFormatter.formatRangeToParts=="function")return this.numberFormatter.formatRangeToParts(o,s);if(s= start date");let a=this.numberFormatter.formatToParts(o),_=this.numberFormatter.formatToParts(s);return[...a.map($=>({...$,source:"startRange"})),{type:"literal",value:" – ",source:"shared"},..._.map($=>({...$,source:"endRange"}))]}resolvedOptions(){let o=this.numberFormatter.resolvedOptions();return!$488c6ddbf4ef74c2$var$supportsSignDisplay&&this.options.signDisplay!=null&&(o={...o,signDisplay:this.options.signDisplay}),!$488c6ddbf4ef74c2$var$supportsUnit&&this.options.style==="unit"&&(o={...o,style:"unit",unit:this.options.unit,unitDisplay:this.options.unitDisplay}),o}constructor(o,s={}){this.numberFormatter=$488c6ddbf4ef74c2$var$getCachedNumberFormatter(o,s),this.options=s}}function $488c6ddbf4ef74c2$var$getCachedNumberFormatter(i,o={}){let{numberingSystem:s}=o;if(s&&i.includes("-nu-")&&(i.includes("-u-")||(i+="-u-"),i+=`-nu-${s}`),o.style==="unit"&&!$488c6ddbf4ef74c2$var$supportsUnit){var a;let{unit:_e,unitDisplay:tt="short"}=o;if(!_e)throw new Error('unit option must be provided with style: "unit"');if(!(!((a=$488c6ddbf4ef74c2$var$UNITS[_e])===null||a===void 0)&&a[tt]))throw new Error(`Unsupported unit ${_e} with unitDisplay = ${tt}`);o={...o,style:"decimal"}}let _=i+(o?Object.entries(o).sort((_e,tt)=>_e[0]0||Object.is(s,0):o==="exceptZero"&&(Object.is(s,-0)||Object.is(s,0)?s=Math.abs(s):a=s>0),a){let _=i.format(-s),$=i.format(s),_e=_.replace($,"").replace(/\u200e|\u061C/,"");return[..._e].length!==1&&console.warn("@react-aria/i18n polyfill for NumberFormat signDisplay: Unsupported case"),_.replace($,"!!!").replace(_e,"+").replace("!!!",$)}else return i.format(s)}}const $6c7bd7858deea686$var$CURRENCY_SIGN_REGEX=new RegExp("^.*\\(.*\\).*$"),$6c7bd7858deea686$var$NUMBERING_SYSTEMS=["latn","arab","hanidec","deva","beng"];class $6c7bd7858deea686$export$cd11ab140839f11d{parse(o){return $6c7bd7858deea686$var$getNumberParserImpl(this.locale,this.options,o).parse(o)}isValidPartialNumber(o,s,a){return $6c7bd7858deea686$var$getNumberParserImpl(this.locale,this.options,o).isValidPartialNumber(o,s,a)}getNumberingSystem(o){return $6c7bd7858deea686$var$getNumberParserImpl(this.locale,this.options,o).options.numberingSystem}constructor(o,s={}){this.locale=o,this.options=s}}const $6c7bd7858deea686$var$numberParserCache=new Map;function $6c7bd7858deea686$var$getNumberParserImpl(i,o,s){let a=$6c7bd7858deea686$var$getCachedNumberParser(i,o);if(!i.includes("-nu-")&&!a.isValidPartialNumber(s)){for(let _ of $6c7bd7858deea686$var$NUMBERING_SYSTEMS)if(_!==a.options.numberingSystem){let $=$6c7bd7858deea686$var$getCachedNumberParser(i+(i.includes("-u-")?"-nu-":"-u-nu-")+_,o);if($.isValidPartialNumber(s))return $}}return a}function $6c7bd7858deea686$var$getCachedNumberParser(i,o){let s=i+(o?Object.entries(o).sort((_,$)=>_[0]<$[0]?-1:1).join():""),a=$6c7bd7858deea686$var$numberParserCache.get(s);return a||(a=new $6c7bd7858deea686$var$NumberParserImpl(i,o),$6c7bd7858deea686$var$numberParserCache.set(s,a)),a}class $6c7bd7858deea686$var$NumberParserImpl{parse(o){let s=this.sanitize(o);if(this.symbols.group&&(s=$6c7bd7858deea686$var$replaceAll(s,this.symbols.group,"")),this.symbols.decimal&&(s=s.replace(this.symbols.decimal,".")),this.symbols.minusSign&&(s=s.replace(this.symbols.minusSign,"-")),s=s.replace(this.symbols.numeral,this.symbols.index),this.options.style==="percent"){let _e=s.indexOf("-");s=s.replace("-","");let tt=s.indexOf(".");tt===-1&&(tt=s.length),s=s.replace(".",""),tt-2===0?s=`0.${s}`:tt-2===-1?s=`0.0${s}`:tt-2===-2?s="0.00":s=`${s.slice(0,tt-2)}.${s.slice(tt-2)}`,_e>-1&&(s=`-${s}`)}let a=s?+s:NaN;if(isNaN(a))return NaN;if(this.options.style==="percent"){var _,$;let _e={...this.options,style:"decimal",minimumFractionDigits:Math.min(((_=this.options.minimumFractionDigits)!==null&&_!==void 0?_:0)+2,20),maximumFractionDigits:Math.min((($=this.options.maximumFractionDigits)!==null&&$!==void 0?$:0)+2,20)};return new $6c7bd7858deea686$export$cd11ab140839f11d(this.locale,_e).parse(new $488c6ddbf4ef74c2$export$cc77c4ff7e8673c5(this.locale,_e).format(a))}return this.options.currencySign==="accounting"&&$6c7bd7858deea686$var$CURRENCY_SIGN_REGEX.test(o)&&(a=-1*a),a}sanitize(o){return o=o.replace(this.symbols.literals,""),this.symbols.minusSign&&(o=o.replace("-",this.symbols.minusSign)),this.options.numberingSystem==="arab"&&(this.symbols.decimal&&(o=o.replace(",",this.symbols.decimal),o=o.replace("،",this.symbols.decimal)),this.symbols.group&&(o=$6c7bd7858deea686$var$replaceAll(o,".",this.symbols.group))),this.options.locale==="fr-FR"&&(o=$6c7bd7858deea686$var$replaceAll(o,"."," ")),o}isValidPartialNumber(o,s=-1/0,a=1/0){return o=this.sanitize(o),this.symbols.minusSign&&o.startsWith(this.symbols.minusSign)&&s<0?o=o.slice(this.symbols.minusSign.length):this.symbols.plusSign&&o.startsWith(this.symbols.plusSign)&&a>0&&(o=o.slice(this.symbols.plusSign.length)),this.symbols.group&&o.startsWith(this.symbols.group)||this.symbols.decimal&&o.indexOf(this.symbols.decimal)>-1&&this.options.maximumFractionDigits===0?!1:(this.symbols.group&&(o=$6c7bd7858deea686$var$replaceAll(o,this.symbols.group,"")),o=o.replace(this.symbols.numeral,""),this.symbols.decimal&&(o=o.replace(this.symbols.decimal,"")),o.length===0)}constructor(o,s={}){this.locale=o,this.formatter=new Intl.NumberFormat(o,s),this.options=this.formatter.resolvedOptions(),this.symbols=$6c7bd7858deea686$var$getSymbols(o,this.formatter,this.options,s);var a,_;this.options.style==="percent"&&(((a=this.options.minimumFractionDigits)!==null&&a!==void 0?a:0)>18||((_=this.options.maximumFractionDigits)!==null&&_!==void 0?_:0)>18)&&console.warn("NumberParser cannot handle percentages with greater than 18 decimal places, please reduce the number in your options.")}}const $6c7bd7858deea686$var$nonLiteralParts=new Set(["decimal","fraction","integer","minusSign","plusSign","group"]),$6c7bd7858deea686$var$pluralNumbers=[0,4,2,1,11,20,3,7,100,21,.1,1.1];function $6c7bd7858deea686$var$getSymbols(i,o,s,a){var _,$,_e,tt;let st=new Intl.NumberFormat(i,{...s,minimumSignificantDigits:1,maximumSignificantDigits:21,roundingIncrement:1,roundingPriority:"auto",roundingMode:"halfExpand"}),it=st.formatToParts(-10000.111),nt=st.formatToParts(10000.111),et=$6c7bd7858deea686$var$pluralNumbers.map(vt=>st.formatToParts(vt));var j;let rt=(j=(_=it.find(vt=>vt.type==="minusSign"))===null||_===void 0?void 0:_.value)!==null&&j!==void 0?j:"-",ot=($=nt.find(vt=>vt.type==="plusSign"))===null||$===void 0?void 0:$.value;!ot&&((a==null?void 0:a.signDisplay)==="exceptZero"||(a==null?void 0:a.signDisplay)==="always")&&(ot="+");let lt=(_e=new Intl.NumberFormat(i,{...s,minimumFractionDigits:2,maximumFractionDigits:2}).formatToParts(.001).find(vt=>vt.type==="decimal"))===null||_e===void 0?void 0:_e.value,ut=(tt=it.find(vt=>vt.type==="group"))===null||tt===void 0?void 0:tt.value,ct=it.filter(vt=>!$6c7bd7858deea686$var$nonLiteralParts.has(vt.type)).map(vt=>$6c7bd7858deea686$var$escapeRegex(vt.value)),dt=et.flatMap(vt=>vt.filter(wt=>!$6c7bd7858deea686$var$nonLiteralParts.has(wt.type)).map(wt=>$6c7bd7858deea686$var$escapeRegex(wt.value))),ft=[...new Set([...ct,...dt])].sort((vt,wt)=>wt.length-vt.length),ht=ft.length===0?new RegExp("[\\p{White_Space}]","gu"):new RegExp(`${ft.join("|")}|[\\p{White_Space}]`,"gu"),bt=[...new Intl.NumberFormat(s.locale,{useGrouping:!1}).format(9876543210)].reverse(),yt=new Map(bt.map((vt,wt)=>[vt,wt])),mt=new RegExp(`[${bt.join("")}]`,"g");return{minusSign:rt,plusSign:ot,decimal:lt,group:ut,literals:ht,numeral:mt,index:vt=>String(yt.get(vt))}}function $6c7bd7858deea686$var$replaceAll(i,o,s){return i.replaceAll?i.replaceAll(o,s):i.split(o).join(s)}function $6c7bd7858deea686$var$escapeRegex(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var anatomy$c=createAnatomy("numberInput").parts("root","label","input","control","valueText","incrementTrigger","decrementTrigger","scrubber"),parts$5=anatomy$c.build(),getRootId$4=i=>{var o;return((o=i.ids)==null?void 0:o.root)??`number-input:${i.id}`},getInputId=i=>{var o;return((o=i.ids)==null?void 0:o.input)??`number-input:${i.id}:input`},getIncrementTriggerId=i=>{var o;return((o=i.ids)==null?void 0:o.incrementTrigger)??`number-input:${i.id}:inc`},getDecrementTriggerId=i=>{var o;return((o=i.ids)==null?void 0:o.decrementTrigger)??`number-input:${i.id}:dec`},getScrubberId=i=>{var o;return((o=i.ids)==null?void 0:o.scrubber)??`number-input:${i.id}:scrubber`},getCursorId=i=>`number-input:${i.id}:cursor`,getLabelId$2=i=>{var o;return((o=i.ids)==null?void 0:o.label)??`number-input:${i.id}:label`},getInputEl=i=>i.getById(getInputId(i)),getIncrementTriggerEl=i=>i.getById(getIncrementTriggerId(i)),getDecrementTriggerEl=i=>i.getById(getDecrementTriggerId(i)),getCursorEl=i=>i.getDoc().getElementById(getCursorId(i)),getPressedTriggerEl=(i,o)=>{let s=null;return o==="increment"&&(s=getIncrementTriggerEl(i)),o==="decrement"&&(s=getDecrementTriggerEl(i)),s},setupVirtualCursor=(i,o)=>{if(!isSafari())return createVirtualCursor(i,o),()=>{var s;(s=getCursorEl(i))==null||s.remove()}},preventTextSelection=i=>{const o=i.getDoc(),s=o.documentElement,a=o.body;return a.style.pointerEvents="none",s.style.userSelect="none",s.style.cursor="ew-resize",()=>{a.style.pointerEvents="",s.style.userSelect="",s.style.cursor="",s.style.length||s.removeAttribute("style"),a.style.length||a.removeAttribute("style")}},getMousemoveValue=(i,o)=>{const{point:s,isRtl:a,event:_}=o,$=i.getWin(),_e=roundToDpr(_.movementX,$.devicePixelRatio),tt=roundToDpr(_.movementY,$.devicePixelRatio);let st=_e>0?"increment":_e<0?"decrement":null;a&&st==="increment"&&(st="decrement"),a&&st==="decrement"&&(st="increment");const it={x:s.x+_e,y:s.y+tt},nt=$.innerWidth,et=roundToDpr(7.5,$.devicePixelRatio);return it.x=wrap$2(it.x+et,nt)-et,{hint:st,point:it}},createVirtualCursor=(i,o)=>{const s=i.getDoc(),a=s.createElement("div");a.className="scrubber--cursor",a.id=getCursorId(i),Object.assign(a.style,{width:"15px",height:"15px",position:"fixed",pointerEvents:"none",left:"0px",top:"0px",zIndex:MAX_Z_INDEX,transform:o?`translate3d(${o.x}px, ${o.y}px, 0px)`:void 0,willChange:"transform"}),a.innerHTML=` + + + + + + `,s.body.appendChild(a)};function connect$5(i,o){const{state:s,send:a,prop:_,scope:$,computed:_e}=i,tt=s.hasTag("focus"),st=_e("isDisabled"),it=_("readOnly"),nt=_e("isValueEmpty"),et=_e("isOutOfRange")||!!_("invalid"),j=st||!_e("canIncrement")||it,rt=st||!_e("canDecrement")||it,ot=_("translations");return{focused:tt,invalid:et,empty:nt,value:_e("formattedValue"),valueAsNumber:_e("valueAsNumber"),setValue(at){a({type:"VALUE.SET",value:at})},clearValue(){a({type:"VALUE.CLEAR"})},increment(){a({type:"VALUE.INCREMENT"})},decrement(){a({type:"VALUE.DECREMENT"})},setToMax(){a({type:"VALUE.SET",value:_("max")})},setToMin(){a({type:"VALUE.SET",value:_("min")})},focus(){var at;(at=getInputEl($))==null||at.focus()},getRootProps(){return o.element({id:getRootId$4($),...parts$5.root.attrs,dir:_("dir"),"data-disabled":dataAttr$1(st),"data-focus":dataAttr$1(tt),"data-invalid":dataAttr$1(et)})},getLabelProps(){return o.label({...parts$5.label.attrs,dir:_("dir"),"data-disabled":dataAttr$1(st),"data-focus":dataAttr$1(tt),"data-invalid":dataAttr$1(et),id:getLabelId$2($),htmlFor:getInputId($)})},getControlProps(){return o.element({...parts$5.control.attrs,dir:_("dir"),role:"group","aria-disabled":st,"data-focus":dataAttr$1(tt),"data-disabled":dataAttr$1(st),"data-invalid":dataAttr$1(et),"aria-invalid":ariaAttr(et)})},getValueTextProps(){return o.element({...parts$5.valueText.attrs,dir:_("dir"),"data-disabled":dataAttr$1(st),"data-invalid":dataAttr$1(et),"data-focus":dataAttr$1(tt)})},getInputProps(){return o.input({...parts$5.input.attrs,dir:_("dir"),name:_("name"),form:_("form"),id:getInputId($),role:"spinbutton",defaultValue:_e("formattedValue"),pattern:_("pattern"),inputMode:_("inputMode"),"aria-invalid":ariaAttr(et),"data-invalid":dataAttr$1(et),disabled:st,"data-disabled":dataAttr$1(st),readOnly:it,required:_("required"),autoComplete:"off",autoCorrect:"off",spellCheck:"false",type:"text","aria-roledescription":"numberfield","aria-valuemin":_("min"),"aria-valuemax":_("max"),"aria-valuenow":Number.isNaN(_e("valueAsNumber"))?void 0:_e("valueAsNumber"),"aria-valuetext":_e("valueText"),onFocus(){a({type:"INPUT.FOCUS"})},onBlur(){a({type:"INPUT.BLUR"})},onInput(at){a({type:"INPUT.CHANGE",target:at.currentTarget,hint:"set"})},onBeforeInput(at){try{const{selectionStart:lt,selectionEnd:ut,value:ct}=at.currentTarget,dt=ct.slice(0,lt)+(at.data??"")+ct.slice(ut);_e("parser").isValidPartialNumber(dt)||at.preventDefault()}catch{}},onKeyDown(at){if(at.defaultPrevented||it||isComposingEvent(at))return;const lt=getEventStep(at)*_("step"),ct={ArrowUp(){a({type:"INPUT.ARROW_UP",step:lt}),at.preventDefault()},ArrowDown(){a({type:"INPUT.ARROW_DOWN",step:lt}),at.preventDefault()},Home(){isModifierKey(at)||(a({type:"INPUT.HOME"}),at.preventDefault())},End(){isModifierKey(at)||(a({type:"INPUT.END"}),at.preventDefault())},Enter(){a({type:"INPUT.ENTER"})}}[at.key];ct==null||ct(at)}})},getDecrementTriggerProps(){return o.button({...parts$5.decrementTrigger.attrs,dir:_("dir"),id:getDecrementTriggerId($),disabled:rt,"data-disabled":dataAttr$1(rt),"aria-label":ot.decrementLabel,type:"button",tabIndex:-1,"aria-controls":getInputId($),onPointerDown(at){var lt;rt||!isLeftClick(at)||(a({type:"TRIGGER.PRESS_DOWN",hint:"decrement",pointerType:at.pointerType}),at.pointerType==="mouse"&&at.preventDefault(),at.pointerType==="touch"&&((lt=at.currentTarget)==null||lt.focus({preventScroll:!0})))},onPointerUp(at){a({type:"TRIGGER.PRESS_UP",hint:"decrement",pointerType:at.pointerType})},onPointerLeave(){rt||a({type:"TRIGGER.PRESS_UP",hint:"decrement"})}})},getIncrementTriggerProps(){return o.button({...parts$5.incrementTrigger.attrs,dir:_("dir"),id:getIncrementTriggerId($),disabled:j,"data-disabled":dataAttr$1(j),"aria-label":ot.incrementLabel,type:"button",tabIndex:-1,"aria-controls":getInputId($),onPointerDown(at){var lt;j||!isLeftClick(at)||(a({type:"TRIGGER.PRESS_DOWN",hint:"increment",pointerType:at.pointerType}),at.pointerType==="mouse"&&at.preventDefault(),at.pointerType==="touch"&&((lt=at.currentTarget)==null||lt.focus({preventScroll:!0})))},onPointerUp(at){a({type:"TRIGGER.PRESS_UP",hint:"increment",pointerType:at.pointerType})},onPointerLeave(at){a({type:"TRIGGER.PRESS_UP",hint:"increment",pointerType:at.pointerType})}})},getScrubberProps(){return o.element({...parts$5.scrubber.attrs,dir:_("dir"),"data-disabled":dataAttr$1(st),id:getScrubberId($),role:"presentation",onMouseDown(at){if(st)return;const lt=getEventPoint(at),ct=getWindow$1(at.currentTarget).devicePixelRatio;lt.x=lt.x-roundToDpr(7.5,ct),lt.y=lt.y-roundToDpr(7.5,ct),a({type:"SCRUBBER.PRESS_DOWN",point:lt}),at.preventDefault()},style:{cursor:st?void 0:"ew-resize"}})}}}function recordCursor(i){if(!(!i||i.ownerDocument.activeElement!==i))try{const{selectionStart:o,selectionEnd:s,value:a}=i,_=a.substring(0,o),$=a.substring(s);return{start:o,end:s,value:a,beforeTxt:_,afterTxt:$}}catch{}}function restoreCursor(i,o){if(!(!i||i.ownerDocument.activeElement!==i)){if(!o){i.setSelectionRange(i.value.length,i.value.length);return}try{const{value:s}=i,{beforeTxt:a="",afterTxt:_="",start:$}=o;let _e=s.length;if(s.endsWith(_))_e=s.length-_.length;else if(s.startsWith(a))_e=a.length;else if($!=null){const tt=a[$-1],st=s.indexOf(tt,$-1);st!==-1&&(_e=st+1)}i.setSelectionRange(_e,_e)}catch{}}}var createFormatter=(i,o={})=>new Intl.NumberFormat(i,o),createParser=(i,o={})=>new $6c7bd7858deea686$export$cd11ab140839f11d(i,o),parseValue=(i,o)=>{const{prop:s,computed:a}=o;return s("formatOptions")?a("parser").parse(String(i)):parseFloat(i)},formatValue=(i,o)=>{const{prop:s,computed:a}=o;return Number.isNaN(i)?"":s("formatOptions")?a("formatter").format(i):i.toString()},getDefaultStep=(i,o)=>{let s=i!==void 0&&!Number.isNaN(i)?i:1;return(o==null?void 0:o.style)==="percent"&&(i===void 0||Number.isNaN(i))&&(s=.01),s},{choose,guards,createMachine}=setup(),{not:not$5,and:and$2}=guards,machine$5=createMachine({props({props:i}){const o=getDefaultStep(i.step,i.formatOptions);return{dir:"ltr",locale:"en-US",focusInputOnChange:!0,clampValueOnBlur:!i.allowOverflow,allowOverflow:!1,inputMode:"decimal",pattern:"[0-9]*(.[0-9]+)?",defaultValue:"",step:o,min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,spinOnPress:!0,...i,translations:{incrementLabel:"increment value",decrementLabel:"decrease value",...i.translations}}},initialState(){return"idle"},context({prop:i,bindable:o,getComputed:s}){return{value:o(()=>({defaultValue:i("defaultValue"),value:i("value"),onChange(a){var _e;const _=s(),$=parseValue(a,{computed:_,prop:i});(_e=i("onValueChange"))==null||_e({value:a,valueAsNumber:$})}})),hint:o(()=>({defaultValue:null})),scrubberCursorPoint:o(()=>({defaultValue:null,hash(a){return a?`x:${a.x}, y:${a.y}`:""}})),fieldsetDisabled:o(()=>({defaultValue:!1}))}},computed:{isRtl:({prop:i})=>i("dir")==="rtl",valueAsNumber:({context:i,computed:o,prop:s})=>parseValue(i.get("value"),{computed:o,prop:s}),formattedValue:({computed:i,prop:o})=>formatValue(i("valueAsNumber"),{computed:i,prop:o}),isAtMin:({computed:i,prop:o})=>isValueAtMin(i("valueAsNumber"),o("min")),isAtMax:({computed:i,prop:o})=>isValueAtMax(i("valueAsNumber"),o("max")),isOutOfRange:({computed:i,prop:o})=>!isValueWithinRange(i("valueAsNumber"),o("min"),o("max")),isValueEmpty:({context:i})=>i.get("value")==="",isDisabled:({prop:i,context:o})=>!!i("disabled")||o.get("fieldsetDisabled"),canIncrement:({prop:i,computed:o})=>i("allowOverflow")||!o("isAtMax"),canDecrement:({prop:i,computed:o})=>i("allowOverflow")||!o("isAtMin"),valueText:({prop:i,context:o})=>{var s,a;return(a=(s=i("translations")).valueText)==null?void 0:a.call(s,o.get("value"))},formatter:memo$2(({prop:i})=>[i("locale"),i("formatOptions")],(i,o)=>createFormatter(i,o)),parser:memo$2(({prop:i})=>[i("locale"),i("formatOptions")],(i,o)=>createParser(i,o))},watch({track:i,action:o,context:s,computed:a,prop:_}){i([()=>s.get("value"),()=>_("locale")],()=>{o(["syncInputElement"])}),i([()=>a("isOutOfRange")],()=>{o(["invokeOnInvalid"])}),i([()=>s.hash("scrubberCursorPoint")],()=>{o(["setVirtualCursorPosition"])})},effects:["trackFormControl"],on:{"VALUE.SET":{actions:["setRawValue"]},"VALUE.CLEAR":{actions:["clearValue"]},"VALUE.INCREMENT":{actions:["increment"]},"VALUE.DECREMENT":{actions:["decrement"]}},states:{idle:{on:{"TRIGGER.PRESS_DOWN":[{guard:"isTouchPointer",target:"before:spin",actions:["setHint"]},{target:"before:spin",actions:["focusInput","invokeOnFocus","setHint"]}],"SCRUBBER.PRESS_DOWN":{target:"scrubbing",actions:["focusInput","invokeOnFocus","setHint","setCursorPoint"]},"INPUT.FOCUS":{target:"focused",actions:["focusInput","invokeOnFocus"]}}},focused:{tags:["focus"],effects:["attachWheelListener"],on:{"TRIGGER.PRESS_DOWN":[{guard:"isTouchPointer",target:"before:spin",actions:["setHint"]},{target:"before:spin",actions:["focusInput","setHint"]}],"SCRUBBER.PRESS_DOWN":{target:"scrubbing",actions:["focusInput","setHint","setCursorPoint"]},"INPUT.ARROW_UP":{actions:["increment"]},"INPUT.ARROW_DOWN":{actions:["decrement"]},"INPUT.HOME":{actions:["decrementToMin"]},"INPUT.END":{actions:["incrementToMax"]},"INPUT.CHANGE":{actions:["setValue","setHint"]},"INPUT.BLUR":[{guard:and$2("clampValueOnBlur",not$5("isInRange")),target:"idle",actions:["setClampedValue","clearHint","invokeOnBlur"]},{guard:not$5("isInRange"),target:"idle",actions:["setFormattedValue","clearHint","invokeOnBlur","invokeOnInvalid"]},{target:"idle",actions:["setFormattedValue","clearHint","invokeOnBlur"]}],"INPUT.ENTER":{actions:["setFormattedValue","clearHint","invokeOnBlur"]}}},"before:spin":{tags:["focus"],effects:["trackButtonDisabled","waitForChangeDelay"],entry:choose([{guard:"isIncrementHint",actions:["increment"]},{guard:"isDecrementHint",actions:["decrement"]}]),on:{CHANGE_DELAY:{target:"spinning",guard:and$2("isInRange","spinOnPress")},"TRIGGER.PRESS_UP":[{guard:"isTouchPointer",target:"focused",actions:["clearHint"]},{target:"focused",actions:["focusInput","clearHint"]}]}},spinning:{tags:["focus"],effects:["trackButtonDisabled","spinValue"],on:{SPIN:[{guard:"isIncrementHint",actions:["increment"]},{guard:"isDecrementHint",actions:["decrement"]}],"TRIGGER.PRESS_UP":{target:"focused",actions:["focusInput","clearHint"]}}},scrubbing:{tags:["focus"],effects:["activatePointerLock","trackMousemove","setupVirtualCursor","preventTextSelection"],on:{"SCRUBBER.POINTER_UP":{target:"focused",actions:["focusInput","clearCursorPoint"]},"SCRUBBER.POINTER_MOVE":[{guard:"isIncrementHint",actions:["increment","setCursorPoint"]},{guard:"isDecrementHint",actions:["decrement","setCursorPoint"]}]}}},implementations:{guards:{clampValueOnBlur:({prop:i})=>i("clampValueOnBlur"),spinOnPress:({prop:i})=>!!i("spinOnPress"),isInRange:({computed:i})=>!i("isOutOfRange"),isDecrementHint:({context:i,event:o})=>(o.hint??i.get("hint"))==="decrement",isIncrementHint:({context:i,event:o})=>(o.hint??i.get("hint"))==="increment",isTouchPointer:({event:i})=>i.pointerType==="touch"},effects:{waitForChangeDelay({send:i}){const o=setTimeout(()=>{i({type:"CHANGE_DELAY"})},300);return()=>clearTimeout(o)},spinValue({send:i}){const o=setInterval(()=>{i({type:"SPIN"})},50);return()=>clearInterval(o)},trackFormControl({context:i,scope:o}){const s=getInputEl(o);return trackFormControl(s,{onFieldsetDisabledChange(a){i.set("fieldsetDisabled",a)},onFormReset(){i.set("value",i.initial("value"))}})},setupVirtualCursor({context:i,scope:o}){const s=i.get("scrubberCursorPoint");return setupVirtualCursor(o,s)},preventTextSelection({scope:i}){return preventTextSelection(i)},trackButtonDisabled({context:i,scope:o,send:s}){const a=i.get("hint"),_=getPressedTriggerEl(o,a);return observeAttributes(_,{attributes:["disabled"],callback(){s({type:"TRIGGER.PRESS_UP",src:"attr"})}})},attachWheelListener({scope:i,send:o,prop:s}){const a=getInputEl(i);if(!a||!i.isActiveElement(a)||!s("allowMouseWheel"))return;function _($){$.preventDefault();const _e=Math.sign($.deltaY)*-1;_e===1?o({type:"VALUE.INCREMENT"}):_e===-1&&o({type:"VALUE.DECREMENT"})}return addDomEvent(a,"wheel",_,{passive:!1})},activatePointerLock({scope:i}){if(!isSafari())return requestPointerLock(i.getDoc())},trackMousemove({scope:i,send:o,context:s,computed:a}){const _=i.getDoc();function $(tt){const st=s.get("scrubberCursorPoint"),it=a("isRtl"),nt=getMousemoveValue(i,{point:st,isRtl:it,event:tt});nt.hint&&o({type:"SCRUBBER.POINTER_MOVE",hint:nt.hint,point:nt.point})}function _e(){o({type:"SCRUBBER.POINTER_UP"})}return callAll(addDomEvent(_,"mousemove",$,!1),addDomEvent(_,"mouseup",_e,!1))}},actions:{focusInput({scope:i,prop:o}){if(!o("focusInputOnChange"))return;const s=getInputEl(i);i.isActiveElement(s)||raf$1(()=>s==null?void 0:s.focus({preventScroll:!0}))},increment({context:i,event:o,prop:s,computed:a}){let _=incrementValue(a("valueAsNumber"),o.step??s("step"));s("allowOverflow")||(_=clampValue(_,s("min"),s("max"))),i.set("value",formatValue(_,{computed:a,prop:s}))},decrement({context:i,event:o,prop:s,computed:a}){let _=decrementValue(a("valueAsNumber"),o.step??s("step"));s("allowOverflow")||(_=clampValue(_,s("min"),s("max"))),i.set("value",formatValue(_,{computed:a,prop:s}))},setClampedValue({context:i,prop:o,computed:s}){const a=clampValue(s("valueAsNumber"),o("min"),o("max"));i.set("value",formatValue(a,{computed:s,prop:o}))},setRawValue({context:i,event:o,prop:s,computed:a}){let _=parseValue(o.value,{computed:a,prop:s});s("allowOverflow")||(_=clampValue(_,s("min"),s("max"))),i.set("value",formatValue(_,{computed:a,prop:s}))},setValue({context:i,event:o}){var a;const s=((a=o.target)==null?void 0:a.value)??o.value;i.set("value",s)},clearValue({context:i}){i.set("value","")},incrementToMax({context:i,prop:o,computed:s}){const a=formatValue(o("max"),{computed:s,prop:o});i.set("value",a)},decrementToMin({context:i,prop:o,computed:s}){const a=formatValue(o("min"),{computed:s,prop:o});i.set("value",a)},setHint({context:i,event:o}){i.set("hint",o.hint)},clearHint({context:i}){i.set("hint",null)},invokeOnFocus({computed:i,prop:o}){var s;(s=o("onFocusChange"))==null||s({focused:!0,value:i("formattedValue"),valueAsNumber:i("valueAsNumber")})},invokeOnBlur({computed:i,prop:o}){var s;(s=o("onFocusChange"))==null||s({focused:!1,value:i("formattedValue"),valueAsNumber:i("valueAsNumber")})},invokeOnInvalid({computed:i,prop:o,event:s}){var _;if(s.type==="INPUT.CHANGE")return;const a=i("valueAsNumber")>o("max")?"rangeOverflow":"rangeUnderflow";(_=o("onValueInvalid"))==null||_({reason:a,value:i("formattedValue"),valueAsNumber:i("valueAsNumber")})},syncInputElement({context:i,event:o,computed:s,scope:a}){const _=o.type.endsWith("CHANGE")?i.get("value"):s("formattedValue"),$=getInputEl(a),_e=recordCursor($);raf$1(()=>{setElementValue($,_),restoreCursor($,_e)})},setFormattedValue({context:i,computed:o}){i.set("value",o("formattedValue"))},setCursorPoint({context:i,event:o}){i.set("scrubberCursorPoint",o.point)},clearCursorPoint({context:i}){i.set("scrubberCursorPoint",null)},setVirtualCursorPosition({context:i,scope:o}){const s=getCursorEl(o),a=i.get("scrubberCursorPoint");!s||!a||(s.style.transform=`translate3d(${a.x}px, ${a.y}px, 0px)`)}}}});createProps$1()(["allowMouseWheel","allowOverflow","clampValueOnBlur","dir","disabled","focusInputOnChange","form","formatOptions","getRootNode","id","ids","inputMode","invalid","locale","max","min","name","onFocusChange","onValueChange","onValueInvalid","pattern","required","readOnly","spinOnPress","step","translations","value","defaultValue"]);const useNumberInput=i=>{const o=reactExports.useId(),{getRootNode:s}=useEnvironmentContext(),{dir:a,locale:_}=useLocaleContext(),$=useFieldContext(),_e={id:o,ids:{label:$==null?void 0:$.ids.label,input:$==null?void 0:$.ids.control},disabled:$==null?void 0:$.disabled,readOnly:$==null?void 0:$.readOnly,required:$==null?void 0:$.required,invalid:$==null?void 0:$.invalid,dir:a,locale:_,getRootNode:s,...i},tt=useMachine(machine$5,_e);return connect$5(tt,normalizeProps)},NumberInputRoot$1=reactExports.forwardRef((i,o)=>{const[s,a]=createSplitProps()(i,["allowMouseWheel","allowOverflow","clampValueOnBlur","defaultValue","disabled","focusInputOnChange","form","formatOptions","id","ids","inputMode","invalid","locale","max","min","name","onFocusChange","onValueChange","onValueInvalid","pattern","readOnly","required","spinOnPress","step","translations","value"]),_=useNumberInput(s),$=mergeProps(_.getRootProps(),a);return jsxRuntimeExports.jsx(NumberInputProvider,{value:_,children:jsxRuntimeExports.jsx(ark.div,{...$,ref:o})})});NumberInputRoot$1.displayName="NumberInputRoot";const NumberInputRootProvider=reactExports.forwardRef((i,o)=>{const[{value:s},a]=createSplitProps()(i,["value"]),_=mergeProps(s.getRootProps(),a);return jsxRuntimeExports.jsx(NumberInputProvider,{value:s,children:jsxRuntimeExports.jsx(ark.div,{..._,ref:o})})});NumberInputRootProvider.displayName="NumberInputRootProvider";const NumberInputScrubber=reactExports.forwardRef((i,o)=>{const s=useNumberInputContext(),a=mergeProps(s.getScrubberProps(),i);return jsxRuntimeExports.jsx(ark.div,{...a,ref:o})});NumberInputScrubber.displayName="NumberInputScrubber";const NumberInputValueText=reactExports.forwardRef((i,o)=>{const{children:s,...a}=i,_=useNumberInputContext(),$=mergeProps(_.getValueTextProps(),a);return jsxRuntimeExports.jsx(ark.span,{...$,ref:o,children:s||_.value})});NumberInputValueText.displayName="NumberInputValueText";var anatomy$b=createAnatomy("pinInput").parts("root","label","input","control");anatomy$b.build();createProps$1()(["autoFocus","blurOnComplete","count","defaultValue","dir","disabled","form","getRootNode","id","ids","invalid","mask","name","onValueChange","onValueComplete","onValueInvalid","otp","pattern","placeholder","readOnly","required","selectOnFocus","translations","type","value"]);var anatomy$a=createAnatomy("popover").parts("arrow","arrowTip","anchor","trigger","indicator","positioner","content","title","description","closeTrigger");anatomy$a.build();createProps$1()(["autoFocus","closeOnEscape","closeOnInteractOutside","dir","getRootNode","id","ids","initialFocusEl","modal","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenChange","onPointerDownOutside","defaultOpen","open","persistentElements","portalled","positioning"]);const Portal=i=>{var st;const{children:o,disabled:s}=i,[a,_]=reactExports.useState((st=i.container)==null?void 0:st.current),$=reactExports.useSyncExternalStore(subscribe$1,()=>!1,()=>!0),{getRootNode:_e}=useEnvironmentContext();if(reactExports.useEffect(()=>{_(()=>{var it;return(it=i.container)==null?void 0:it.current})},[i.container]),$||s)return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:o});const tt=a??getPortalNode(_e);return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:reactExports.Children.map(o,it=>reactDomExports.createPortal(it,tt))})},getPortalNode=i=>{const o=i==null?void 0:i(),s=o.getRootNode();return isShadowRoot$1(s)?s:getDocument(o).body},subscribe$1=()=>()=>{};var anatomy$9=createAnatomy("progress").parts("root","label","track","range","valueText","view","circle","circleTrack","circleRange");anatomy$9.build();createProps$1()(["dir","getRootNode","id","ids","max","min","orientation","translations","value","onValueChange","defaultValue","formatOptions","locale"]);var anatomy$8=createAnatomy("qr-code").parts("root","frame","pattern","overlay","downloadTrigger");anatomy$8.build();createProps$1()(["ids","defaultValue","value","id","encoding","dir","getRootNode","onValueChange","pixelSize"]);var anatomy$7=createAnatomy("radio-group").parts("root","label","item","itemText","itemControl","indicator");anatomy$7.build();createProps$1()(["dir","disabled","form","getRootNode","id","ids","name","onValueChange","orientation","readOnly","value","defaultValue"]);createProps$1()(["value","disabled","invalid"]);var anatomy$6=createAnatomy("rating-group").parts("root","label","item","control");anatomy$6.build();createProps$1()(["allowHalf","autoFocus","count","dir","disabled","form","getRootNode","id","ids","name","onHoverChange","onValueChange","required","readOnly","translations","value","defaultValue"]);createProps$1()(["index"]);const segmentGroupAnatomy=anatomy$7.rename("segment-group");segmentGroupAnatomy.build();const[SelectProvider,useSelectContext]=createContext({name:"SelectContext",hookName:"useSelectContext",providerName:""}),SelectClearTrigger$2=reactExports.forwardRef((i,o)=>{const s=useSelectContext(),a=mergeProps(s.getClearTriggerProps(),i);return jsxRuntimeExports.jsx(ark.button,{...a,ref:o})});SelectClearTrigger$2.displayName="SelectClearTrigger";const SelectContent$2=reactExports.forwardRef((i,o)=>{const s=useSelectContext(),a=usePresenceContext(),_=mergeProps(s.getContentProps(),a.getPresenceProps(),i);return a.unmounted?null:jsxRuntimeExports.jsx(ark.div,{..._,ref:composeRefs(a.ref,o)})});SelectContent$2.displayName="SelectContent";const SelectContext$1=i=>i.children(useSelectContext()),SelectControl$1=reactExports.forwardRef((i,o)=>{const s=useSelectContext(),a=mergeProps(s.getControlProps(),i);return jsxRuntimeExports.jsx(ark.div,{...a,ref:o})});SelectControl$1.displayName="SelectControl";const SelectHiddenSelect$1=reactExports.forwardRef((i,o)=>{const s=useSelectContext(),a=mergeProps(s.getHiddenSelectProps(),i),_=s.value.length===0,$=useFieldContext();return jsxRuntimeExports.jsxs(ark.select,{"aria-describedby":$==null?void 0:$.ariaDescribedby,...a,ref:o,children:[_&&jsxRuntimeExports.jsx("option",{value:""}),s.collection.items.map((_e,tt)=>jsxRuntimeExports.jsx("option",{value:s.collection.getItemValue(_e)??"",disabled:s.collection.getItemDisabled(_e),children:s.collection.stringifyItem(_e)},tt))]})});SelectHiddenSelect$1.displayName="SelectHiddenSelect";const SelectIndicator$1=reactExports.forwardRef((i,o)=>{const s=useSelectContext(),a=mergeProps(s.getIndicatorProps(),i);return jsxRuntimeExports.jsx(ark.div,{...a,ref:o})});SelectIndicator$1.displayName="SelectIndicator";const[SelectItemProvider,useSelectItemContext]=createContext({name:"SelectItemContext",hookName:"useSelectItemContext",providerName:""}),[SelectItemPropsProvider,useSelectItemPropsContext]=createContext({name:"SelectItemPropsContext",hookName:"useSelectItemPropsContext",providerName:""}),SelectItem$2=reactExports.forwardRef((i,o)=>{const[s,a]=createSplitProps()(i,["item","persistFocus"]),_=useSelectContext(),$=mergeProps(_.getItemProps(s),a),_e=_.getItemState(s);return jsxRuntimeExports.jsx(SelectItemPropsProvider,{value:s,children:jsxRuntimeExports.jsx(SelectItemProvider,{value:_e,children:jsxRuntimeExports.jsx(ark.div,{...$,ref:o})})})});SelectItem$2.displayName="SelectItem";const[SelectItemGroupPropsProvider,useSelectItemGroupPropsContext]=createContext({name:"SelectItemGroupPropsContext",hookName:"useSelectItemGroupPropsContext",providerName:""}),SelectItemGroup$1=reactExports.forwardRef((i,o)=>{const s=reactExports.useId(),[a,_]=createSplitProps()(i,["id"]),$={id:s,...a},_e=useSelectContext(),tt=mergeProps(_e.getItemGroupProps($),_);return jsxRuntimeExports.jsx(SelectItemGroupPropsProvider,{value:$,children:jsxRuntimeExports.jsx(ark.div,{...tt,ref:o})})});SelectItemGroup$1.displayName="SelectItemGroup";const SelectItemGroupLabel$1=reactExports.forwardRef((i,o)=>{const s=useSelectContext(),a=useSelectItemGroupPropsContext(),_=mergeProps(s.getItemGroupLabelProps({htmlFor:a.id}),i);return jsxRuntimeExports.jsx(ark.div,{..._,ref:o})});SelectItemGroupLabel$1.displayName="SelectItemGroupLabel";const SelectItemIndicator$1=reactExports.forwardRef((i,o)=>{const s=useSelectContext(),a=useSelectItemPropsContext(),_=mergeProps(s.getItemIndicatorProps(a),i);return jsxRuntimeExports.jsx(ark.div,{..._,ref:o})});SelectItemIndicator$1.displayName="SelectItemIndicator";const SelectItemText=reactExports.forwardRef((i,o)=>{const s=useSelectContext(),a=useSelectItemPropsContext(),_=mergeProps(s.getItemTextProps(a),i);return jsxRuntimeExports.jsx(ark.span,{..._,ref:o})});SelectItemText.displayName="SelectItemText";const SelectLabel=reactExports.forwardRef((i,o)=>{const s=useSelectContext(),a=mergeProps(s.getLabelProps(),i);return jsxRuntimeExports.jsx(ark.label,{...a,ref:o})});SelectLabel.displayName="SelectLabel";const SelectPositioner$1=reactExports.forwardRef((i,o)=>{const s=useSelectContext(),a=mergeProps(s.getPositionerProps(),i);return usePresenceContext().unmounted?null:jsxRuntimeExports.jsx(ark.div,{...a,ref:o})});SelectPositioner$1.displayName="SelectPositioner";var anatomy$5=createAnatomy("select").parts("label","positioner","trigger","indicator","clearTrigger","item","itemText","itemIndicator","itemGroup","itemGroupLabel","list","content","root","control","valueText"),parts$4=anatomy$5.build(),collection=i=>new ListCollection(i);collection.empty=()=>new ListCollection({items:[]});var getRootId$3=i=>{var o;return((o=i.ids)==null?void 0:o.root)??`select:${i.id}`},getContentId$2=i=>{var o;return((o=i.ids)==null?void 0:o.content)??`select:${i.id}:content`},getTriggerId$2=i=>{var o;return((o=i.ids)==null?void 0:o.trigger)??`select:${i.id}:trigger`},getClearTriggerId=i=>{var o;return((o=i.ids)==null?void 0:o.clearTrigger)??`select:${i.id}:clear-trigger`},getLabelId$1=i=>{var o;return((o=i.ids)==null?void 0:o.label)??`select:${i.id}:label`},getControlId$1=i=>{var o;return((o=i.ids)==null?void 0:o.control)??`select:${i.id}:control`},getItemId=(i,o)=>{var s,a;return((a=(s=i.ids)==null?void 0:s.item)==null?void 0:a.call(s,o))??`select:${i.id}:option:${o}`},getHiddenSelectId=i=>{var o;return((o=i.ids)==null?void 0:o.hiddenSelect)??`select:${i.id}:select`},getPositionerId$1=i=>{var o;return((o=i.ids)==null?void 0:o.positioner)??`select:${i.id}:positioner`},getItemGroupId=(i,o)=>{var s,a;return((a=(s=i.ids)==null?void 0:s.itemGroup)==null?void 0:a.call(s,o))??`select:${i.id}:optgroup:${o}`},getItemGroupLabelId=(i,o)=>{var s,a;return((a=(s=i.ids)==null?void 0:s.itemGroupLabel)==null?void 0:a.call(s,o))??`select:${i.id}:optgroup-label:${o}`},getHiddenSelectEl=i=>i.getById(getHiddenSelectId(i)),getContentEl$1=i=>i.getById(getContentId$2(i)),getTriggerEl$2=i=>i.getById(getTriggerId$2(i)),getClearTriggerEl=i=>i.getById(getClearTriggerId(i)),getPositionerEl$1=i=>i.getById(getPositionerId$1(i)),getItemEl=(i,o)=>i.getById(getItemId(i,o));function connect$4(i,o){const{context:s,prop:a,scope:_,state:$,computed:_e,send:tt}=i,st=a("disabled")||s.get("fieldsetDisabled"),it=a("invalid"),nt=a("readOnly"),et=a("composite"),j=a("collection"),rt=$.hasTag("open"),ot=$.matches("focused"),at=s.get("highlightedValue"),lt=s.get("highlightedItem"),ut=s.get("selectedItems"),ct=s.get("currentPlacement"),dt=_e("isTypingAhead"),ft=_e("isInteractive"),ht=at?getItemId(_,at):void 0;function bt(mt){const gt=j.getItemDisabled(mt.item),vt=j.getItemValue(mt.item);return ensure(vt,()=>`[zag-js] No value found for item ${JSON.stringify(mt.item)}`),{value:vt,disabled:!!(st||gt),highlighted:at===vt,selected:s.get("value").includes(vt)}}const yt=getPlacementStyles({...a("positioning"),placement:ct});return{open:rt,focused:ot,empty:s.get("value").length===0,highlightedItem:lt,highlightedValue:at,selectedItems:ut,hasSelectedItems:_e("hasSelectedItems"),value:s.get("value"),valueAsString:s.get("valueAsString"),collection:j,multiple:!!a("multiple"),disabled:!!st,reposition(mt={}){tt({type:"POSITIONING.SET",options:mt})},focus(){var mt;(mt=getTriggerEl$2(_))==null||mt.focus({preventScroll:!0})},setOpen(mt){$.hasTag("open")!==mt&&tt({type:mt?"OPEN":"CLOSE"})},selectValue(mt){tt({type:"ITEM.SELECT",value:mt})},setValue(mt){tt({type:"VALUE.SET",value:mt})},selectAll(){tt({type:"VALUE.SET",value:j.getValues()})},highlightValue(mt){tt({type:"HIGHLIGHTED_VALUE.SET",value:mt})},clearValue(mt){tt(mt?{type:"ITEM.CLEAR",value:mt}:{type:"VALUE.CLEAR"})},getItemState:bt,getRootProps(){return o.element({...parts$4.root.attrs,dir:a("dir"),id:getRootId$3(_),"data-invalid":dataAttr$1(it),"data-readonly":dataAttr$1(nt)})},getLabelProps(){return o.label({dir:a("dir"),id:getLabelId$1(_),...parts$4.label.attrs,"data-disabled":dataAttr$1(st),"data-invalid":dataAttr$1(it),"data-readonly":dataAttr$1(nt),htmlFor:getHiddenSelectId(_),onClick(mt){var gt;mt.defaultPrevented||st||(gt=getTriggerEl$2(_))==null||gt.focus({preventScroll:!0})}})},getControlProps(){return o.element({...parts$4.control.attrs,dir:a("dir"),id:getControlId$1(_),"data-state":rt?"open":"closed","data-focus":dataAttr$1(ot),"data-disabled":dataAttr$1(st),"data-invalid":dataAttr$1(it)})},getValueTextProps(){return o.element({...parts$4.valueText.attrs,dir:a("dir"),"data-disabled":dataAttr$1(st),"data-invalid":dataAttr$1(it),"data-focus":dataAttr$1(ot)})},getTriggerProps(){return o.button({id:getTriggerId$2(_),disabled:st,dir:a("dir"),type:"button",role:"combobox","aria-controls":getContentId$2(_),"aria-expanded":rt,"aria-haspopup":"listbox","data-state":rt?"open":"closed","aria-invalid":it,"aria-labelledby":getLabelId$1(_),...parts$4.trigger.attrs,"data-disabled":dataAttr$1(st),"data-invalid":dataAttr$1(it),"data-readonly":dataAttr$1(nt),"data-placement":ct,"data-placeholder-shown":dataAttr$1(!_e("hasSelectedItems")),onClick(mt){ft&&(mt.defaultPrevented||tt({type:"TRIGGER.CLICK"}))},onFocus(){tt({type:"TRIGGER.FOCUS"})},onBlur(){tt({type:"TRIGGER.BLUR"})},onKeyDown(mt){if(mt.defaultPrevented||!ft)return;const vt={ArrowUp(){tt({type:"TRIGGER.ARROW_UP"})},ArrowDown(wt){tt({type:wt.altKey?"OPEN":"TRIGGER.ARROW_DOWN"})},ArrowLeft(){tt({type:"TRIGGER.ARROW_LEFT"})},ArrowRight(){tt({type:"TRIGGER.ARROW_RIGHT"})},Home(){tt({type:"TRIGGER.HOME"})},End(){tt({type:"TRIGGER.END"})},Enter(){tt({type:"TRIGGER.ENTER"})},Space(wt){tt(dt?{type:"TRIGGER.TYPEAHEAD",key:wt.key}:{type:"TRIGGER.ENTER"})}}[getEventKey(mt,{dir:a("dir"),orientation:"vertical"})];if(vt){vt(mt),mt.preventDefault();return}getByTypeahead.isValidEvent(mt)&&(tt({type:"TRIGGER.TYPEAHEAD",key:mt.key}),mt.preventDefault())}})},getIndicatorProps(){return o.element({...parts$4.indicator.attrs,dir:a("dir"),"aria-hidden":!0,"data-state":rt?"open":"closed","data-disabled":dataAttr$1(st),"data-invalid":dataAttr$1(it),"data-readonly":dataAttr$1(nt)})},getItemProps(mt){const gt=bt(mt);return o.element({id:getItemId(_,gt.value),role:"option",...parts$4.item.attrs,dir:a("dir"),"data-value":gt.value,"aria-selected":gt.selected,"data-state":gt.selected?"checked":"unchecked","data-highlighted":dataAttr$1(gt.highlighted),"data-disabled":dataAttr$1(gt.disabled),"aria-disabled":ariaAttr(gt.disabled),onPointerMove(vt){gt.disabled||vt.pointerType!=="mouse"||gt.value!==at&&tt({type:"ITEM.POINTER_MOVE",value:gt.value})},onClick(vt){vt.defaultPrevented||gt.disabled||tt({type:"ITEM.CLICK",src:"pointerup",value:gt.value})},onPointerLeave(vt){var Ct;gt.disabled||mt.persistFocus||vt.pointerType!=="mouse"||!((Ct=i.event.previous())!=null&&Ct.type.includes("POINTER"))||tt({type:"ITEM.POINTER_LEAVE"})}})},getItemTextProps(mt){const gt=bt(mt);return o.element({...parts$4.itemText.attrs,"data-state":gt.selected?"checked":"unchecked","data-disabled":dataAttr$1(gt.disabled),"data-highlighted":dataAttr$1(gt.highlighted)})},getItemIndicatorProps(mt){const gt=bt(mt);return o.element({"aria-hidden":!0,...parts$4.itemIndicator.attrs,"data-state":gt.selected?"checked":"unchecked",hidden:!gt.selected})},getItemGroupLabelProps(mt){const{htmlFor:gt}=mt;return o.element({...parts$4.itemGroupLabel.attrs,id:getItemGroupLabelId(_,gt),dir:a("dir"),role:"presentation"})},getItemGroupProps(mt){const{id:gt}=mt;return o.element({...parts$4.itemGroup.attrs,"data-disabled":dataAttr$1(st),id:getItemGroupId(_,gt),"aria-labelledby":getItemGroupLabelId(_,gt),role:"group",dir:a("dir")})},getClearTriggerProps(){return o.button({...parts$4.clearTrigger.attrs,id:getClearTriggerId(_),type:"button","aria-label":"Clear value","data-invalid":dataAttr$1(it),disabled:st,hidden:!_e("hasSelectedItems"),dir:a("dir"),onClick(mt){mt.defaultPrevented||tt({type:"CLEAR.CLICK"})}})},getHiddenSelectProps(){const mt=s.get("value"),gt=a("multiple")?mt:mt==null?void 0:mt[0];return o.select({name:a("name"),form:a("form"),disabled:st,multiple:a("multiple"),required:a("required"),"aria-hidden":!0,id:getHiddenSelectId(_),defaultValue:gt,style:visuallyHiddenStyle,tabIndex:-1,onFocus(){var vt;(vt=getTriggerEl$2(_))==null||vt.focus({preventScroll:!0})},"aria-labelledby":getLabelId$1(_)})},getPositionerProps(){return o.element({...parts$4.positioner.attrs,dir:a("dir"),id:getPositionerId$1(_),style:yt.floating})},getContentProps(){return o.element({hidden:!rt,dir:a("dir"),id:getContentId$2(_),role:et?"listbox":"dialog",...parts$4.content.attrs,"data-state":rt?"open":"closed","data-placement":ct,"data-activedescendant":ht,"aria-activedescendant":et?ht:void 0,"aria-multiselectable":a("multiple")&&et?!0:void 0,"aria-labelledby":getLabelId$1(_),tabIndex:0,onKeyDown(mt){if(!ft||!isSelfTarget(mt))return;if(mt.key==="Tab"&&!isValidTabEvent(mt)){mt.preventDefault();return}const gt={ArrowUp(){tt({type:"CONTENT.ARROW_UP"})},ArrowDown(){tt({type:"CONTENT.ARROW_DOWN"})},Home(){tt({type:"CONTENT.HOME"})},End(){tt({type:"CONTENT.END"})},Enter(){tt({type:"ITEM.CLICK",src:"keydown.enter"})},Space(Ct){var kt;dt?tt({type:"CONTENT.TYPEAHEAD",key:Ct.key}):(kt=gt.Enter)==null||kt.call(gt,Ct)}},vt=gt[getEventKey(mt)];if(vt){vt(mt),mt.preventDefault();return}const wt=getEventTarget(mt);isEditableElement(wt)||getByTypeahead.isValidEvent(mt)&&(tt({type:"CONTENT.TYPEAHEAD",key:mt.key}),mt.preventDefault())}})},getListProps(){return o.element({...parts$4.list.attrs,tabIndex:0,role:et?void 0:"listbox","aria-labelledby":getTriggerId$2(_),"aria-activedescendant":et?void 0:ht,"aria-multiselectable":!et&&a("multiple")?!0:void 0})}}}var{and:and$1,not:not$4,or}=createGuards(),machine$4={props({props:i}){return{loopFocus:!1,closeOnSelect:!i.multiple,composite:!0,defaultValue:[],...i,collection:i.collection??collection.empty(),positioning:{placement:"bottom-start",gutter:8,...i.positioning}}},context({prop:i,bindable:o}){return{value:o(()=>({defaultValue:i("defaultValue"),value:i("value"),isEqual,onChange(s){var _;const a=i("collection").findMany(s);return(_=i("onValueChange"))==null?void 0:_({value:s,items:a})}})),highlightedValue:o(()=>({defaultValue:i("defaultHighlightedValue")||null,value:i("highlightedValue"),onChange(s){var a;(a=i("onHighlightChange"))==null||a({highlightedValue:s,highlightedItem:i("collection").find(s),highlightedIndex:i("collection").indexOf(s)})}})),currentPlacement:o(()=>({defaultValue:void 0})),fieldsetDisabled:o(()=>({defaultValue:!1})),highlightedItem:o(()=>({defaultValue:null})),selectedItems:o(()=>{const s=i("value")??i("defaultValue")??[];return{defaultValue:i("collection").findMany(s)}}),valueAsString:o(()=>{const s=i("value")??i("defaultValue")??[];return{defaultValue:i("collection").stringifyMany(s)}})}},refs(){return{typeahead:{...getByTypeahead.defaultOptions}}},computed:{hasSelectedItems:({context:i})=>i.get("value").length>0,isTypingAhead:({refs:i})=>i.get("typeahead").keysSoFar!=="",isDisabled:({prop:i,context:o})=>!!i("disabled")||!!o.get("fieldsetDisabled"),isInteractive:({prop:i})=>!(i("disabled")||i("readOnly"))},initialState({prop:i}){return i("open")||i("defaultOpen")?"open":"idle"},entry:["syncSelectElement"],watch({context:i,prop:o,track:s,action:a}){s([()=>i.get("value").toString()],()=>{a(["syncSelectedItems","syncSelectElement","dispatchChangeEvent"])}),s([()=>o("open")],()=>{a(["toggleVisibility"])}),s([()=>i.get("highlightedValue")],()=>{a(["syncHighlightedItem"])}),s([()=>o("collection").toString()],()=>{a(["syncCollection"])})},on:{"HIGHLIGHTED_VALUE.SET":{actions:["setHighlightedItem"]},"ITEM.SELECT":{actions:["selectItem"]},"ITEM.CLEAR":{actions:["clearItem"]},"VALUE.SET":{actions:["setSelectedItems"]},"VALUE.CLEAR":{actions:["clearSelectedItems"]},"CLEAR.CLICK":{actions:["clearSelectedItems","focusTriggerEl"]}},effects:["trackFormControlState"],states:{idle:{tags:["closed"],on:{"CONTROLLED.OPEN":[{guard:"isTriggerClickEvent",target:"open",actions:["setInitialFocus","highlightFirstSelectedItem"]},{target:"open",actions:["setInitialFocus"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen","setInitialFocus","highlightFirstSelectedItem"]}],"TRIGGER.FOCUS":{target:"focused"},OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen"]}]}},focused:{tags:["closed"],on:{"CONTROLLED.OPEN":[{guard:"isTriggerClickEvent",target:"open",actions:["setInitialFocus","highlightFirstSelectedItem"]},{guard:"isTriggerArrowUpEvent",target:"open",actions:["setInitialFocus","highlightComputedLastItem"]},{guard:or("isTriggerArrowDownEvent","isTriggerEnterEvent"),target:"open",actions:["setInitialFocus","highlightComputedFirstItem"]},{target:"open",actions:["setInitialFocus"]}],OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen"]}],"TRIGGER.BLUR":{target:"idle"},"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen","highlightFirstSelectedItem"]}],"TRIGGER.ENTER":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen","highlightComputedFirstItem"]}],"TRIGGER.ARROW_UP":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen","highlightComputedLastItem"]}],"TRIGGER.ARROW_DOWN":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen","highlightComputedFirstItem"]}],"TRIGGER.ARROW_LEFT":[{guard:and$1(not$4("multiple"),"hasSelectedItems"),actions:["selectPreviousItem"]},{guard:not$4("multiple"),actions:["selectLastItem"]}],"TRIGGER.ARROW_RIGHT":[{guard:and$1(not$4("multiple"),"hasSelectedItems"),actions:["selectNextItem"]},{guard:not$4("multiple"),actions:["selectFirstItem"]}],"TRIGGER.HOME":{guard:not$4("multiple"),actions:["selectFirstItem"]},"TRIGGER.END":{guard:not$4("multiple"),actions:["selectLastItem"]},"TRIGGER.TYPEAHEAD":{guard:not$4("multiple"),actions:["selectMatchingItem"]}}},open:{tags:["open"],exit:["scrollContentToTop"],effects:["trackDismissableElement","computePlacement","scrollToHighlightedItem"],on:{"CONTROLLED.CLOSE":{target:"focused",actions:["focusTriggerEl","clearHighlightedItem"]},CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose","focusTriggerEl","clearHighlightedItem"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose","clearHighlightedItem"]}],"ITEM.CLICK":[{guard:and$1("closeOnSelect","isOpenControlled"),actions:["selectHighlightedItem","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["selectHighlightedItem","invokeOnClose","focusTriggerEl","clearHighlightedItem"]},{actions:["selectHighlightedItem"]}],"CONTENT.HOME":{actions:["highlightFirstItem"]},"CONTENT.END":{actions:["highlightLastItem"]},"CONTENT.ARROW_DOWN":[{guard:and$1("hasHighlightedItem","loop","isLastItemHighlighted"),actions:["highlightFirstItem"]},{guard:"hasHighlightedItem",actions:["highlightNextItem"]},{actions:["highlightFirstItem"]}],"CONTENT.ARROW_UP":[{guard:and$1("hasHighlightedItem","loop","isFirstItemHighlighted"),actions:["highlightLastItem"]},{guard:"hasHighlightedItem",actions:["highlightPreviousItem"]},{actions:["highlightLastItem"]}],"CONTENT.TYPEAHEAD":{actions:["highlightMatchingItem"]},"ITEM.POINTER_MOVE":{actions:["highlightItem"]},"ITEM.POINTER_LEAVE":{actions:["clearHighlightedItem"]},"POSITIONING.SET":{actions:["reposition"]}}}},implementations:{guards:{loop:({prop:i})=>!!i("loopFocus"),multiple:({prop:i})=>!!i("multiple"),hasSelectedItems:({computed:i})=>!!i("hasSelectedItems"),hasHighlightedItem:({context:i})=>i.get("highlightedValue")!=null,isFirstItemHighlighted:({context:i,prop:o})=>i.get("highlightedValue")===o("collection").firstValue,isLastItemHighlighted:({context:i,prop:o})=>i.get("highlightedValue")===o("collection").lastValue,closeOnSelect:({prop:i,event:o})=>!!(o.closeOnSelect??i("closeOnSelect")),isOpenControlled:({prop:i})=>i("open")!==void 0,isTriggerClickEvent:({event:i})=>{var o;return((o=i.previousEvent)==null?void 0:o.type)==="TRIGGER.CLICK"},isTriggerEnterEvent:({event:i})=>{var o;return((o=i.previousEvent)==null?void 0:o.type)==="TRIGGER.ENTER"},isTriggerArrowUpEvent:({event:i})=>{var o;return((o=i.previousEvent)==null?void 0:o.type)==="TRIGGER.ARROW_UP"},isTriggerArrowDownEvent:({event:i})=>{var o;return((o=i.previousEvent)==null?void 0:o.type)==="TRIGGER.ARROW_DOWN"}},effects:{trackFormControlState({context:i,scope:o}){return trackFormControl(getHiddenSelectEl(o),{onFieldsetDisabledChange(s){i.set("fieldsetDisabled",s)},onFormReset(){const s=i.initial("value");i.set("value",s)}})},trackDismissableElement({scope:i,send:o,prop:s}){const a=()=>getContentEl$1(i);let _=!0;return trackDismissableElement(a,{defer:!0,exclude:[getTriggerEl$2(i),getClearTriggerEl(i)],onFocusOutside:s("onFocusOutside"),onPointerDownOutside:s("onPointerDownOutside"),onInteractOutside($){var _e;(_e=s("onInteractOutside"))==null||_e($),_=!($.detail.focusable||$.detail.contextmenu)},onDismiss(){o({type:"CLOSE",src:"interact-outside",restoreFocus:_})}})},computePlacement({context:i,prop:o,scope:s}){const a=o("positioning");return i.set("currentPlacement",a.placement),getPlacement(()=>getTriggerEl$2(s),()=>getPositionerEl$1(s),{defer:!0,...a,onComplete(_e){i.set("currentPlacement",_e.placement)}})},scrollToHighlightedItem({context:i,prop:o,scope:s,event:a}){const _=_e=>{const tt=i.get("highlightedValue");if(tt==null||a.current().type.includes("POINTER"))return;const st=getItemEl(s,tt),it=getContentEl$1(s),nt=o("scrollToIndexFn");if(nt){const et=o("collection").indexOf(tt);nt==null||nt({index:et,immediate:_e});return}scrollIntoView(st,{rootEl:it,block:"nearest"})};return raf$1(()=>_(!0)),observeAttributes(()=>getContentEl$1(s),{defer:!0,attributes:["data-activedescendant"],callback(){_(!1)}})}},actions:{reposition({context:i,prop:o,scope:s,event:a}){const _=()=>getPositionerEl$1(s);getPlacement(getTriggerEl$2(s),_,{...o("positioning"),...a.options,defer:!0,listeners:!1,onComplete($){i.set("currentPlacement",$.placement)}})},toggleVisibility({send:i,prop:o,event:s}){i({type:o("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:s})},highlightPreviousItem({context:i,prop:o}){const s=i.get("highlightedValue");if(s==null)return;const a=o("collection").getPreviousValue(s,1,o("loopFocus"));i.set("highlightedValue",a)},highlightNextItem({context:i,prop:o}){const s=i.get("highlightedValue");if(s==null)return;const a=o("collection").getNextValue(s,1,o("loopFocus"));i.set("highlightedValue",a)},highlightFirstItem({context:i,prop:o}){const s=o("collection").firstValue;i.set("highlightedValue",s)},highlightLastItem({context:i,prop:o}){const s=o("collection").lastValue;i.set("highlightedValue",s)},setInitialFocus({scope:i}){raf$1(()=>{const o=getInitialFocus({root:getContentEl$1(i)});o==null||o.focus({preventScroll:!0})})},focusTriggerEl({event:i,scope:o}){var a;const s=i.restoreFocus??((a=i.previousEvent)==null?void 0:a.restoreFocus);s!=null&&!s||raf$1(()=>{const _=getTriggerEl$2(o);_==null||_.focus({preventScroll:!0})})},selectHighlightedItem({context:i,prop:o,event:s}){let a=s.value??i.get("highlightedValue");if(a==null)return;a=o("deselectable")&&!o("multiple")&&i.get("value").includes(a)?null:a,i.set("value",$=>a==null?[]:o("multiple")?addOrRemove($,a):[a])},highlightComputedFirstItem({context:i,prop:o,computed:s}){const a=o("collection"),_=s("hasSelectedItems")?a.sort(i.get("value"))[0]:a.firstValue;i.set("highlightedValue",_)},highlightComputedLastItem({context:i,prop:o,computed:s}){const a=o("collection"),_=s("hasSelectedItems")?a.sort(i.get("value"))[0]:a.lastValue;i.set("highlightedValue",_)},highlightFirstSelectedItem({context:i,prop:o,computed:s}){if(!s("hasSelectedItems"))return;const a=o("collection").sort(i.get("value"))[0];i.set("highlightedValue",a)},highlightItem({context:i,event:o}){i.set("highlightedValue",o.value)},highlightMatchingItem({context:i,prop:o,event:s,refs:a}){const _=o("collection").search(s.key,{state:a.get("typeahead"),currentValue:i.get("highlightedValue")});_!=null&&i.set("highlightedValue",_)},setHighlightedItem({context:i,event:o}){i.set("highlightedValue",o.value)},clearHighlightedItem({context:i}){i.set("highlightedValue",null)},selectItem({context:i,prop:o,event:s}){const _=o("deselectable")&&!o("multiple")&&i.get("value").includes(s.value)?null:s.value;i.set("value",$=>_==null?[]:o("multiple")?addOrRemove($,_):[_])},clearItem({context:i,event:o}){i.set("value",s=>s.filter(a=>a!==o.value))},setSelectedItems({context:i,event:o}){i.set("value",o.value)},clearSelectedItems({context:i}){i.set("value",[])},selectPreviousItem({context:i,prop:o}){const[s]=i.get("value"),a=o("collection").getPreviousValue(s);a&&i.set("value",[a])},selectNextItem({context:i,prop:o}){const[s]=i.get("value"),a=o("collection").getNextValue(s);a&&i.set("value",[a])},selectFirstItem({context:i,prop:o}){const s=o("collection").firstValue;s&&i.set("value",[s])},selectLastItem({context:i,prop:o}){const s=o("collection").lastValue;s&&i.set("value",[s])},selectMatchingItem({context:i,prop:o,event:s,refs:a}){const _=o("collection").search(s.key,{state:a.get("typeahead"),currentValue:i.get("value")[0]});_!=null&&i.set("value",[_])},scrollContentToTop({prop:i,scope:o}){var s,a;i("scrollToIndexFn")?(s=i("scrollToIndexFn"))==null||s({index:0,immediate:!0}):(a=getContentEl$1(o))==null||a.scrollTo(0,0)},invokeOnOpen({prop:i}){var o;(o=i("onOpenChange"))==null||o({open:!0})},invokeOnClose({prop:i}){var o;(o=i("onOpenChange"))==null||o({open:!1})},syncSelectElement({context:i,prop:o,scope:s}){const a=getHiddenSelectEl(s);if(a){if(i.get("value").length===0&&!o("multiple")){a.selectedIndex=-1;return}for(const _ of a.options)_.selected=i.get("value").includes(_.value)}},syncCollection({context:i,prop:o}){const s=o("collection"),a=s.find(i.get("highlightedValue"));a&&i.set("highlightedItem",a);const _=s.findMany(i.get("value"));i.set("selectedItems",_);const $=s.stringifyItems(_);i.set("valueAsString",$)},syncSelectedItems({context:i,prop:o}){const s=o("collection"),a=i.get("selectedItems"),$=i.get("value").map(_e=>a.find(st=>s.getItemValue(st)===_e)||s.find(_e));i.set("selectedItems",$),i.set("valueAsString",s.stringifyItems($))},syncHighlightedItem({context:i,prop:o}){const s=o("collection"),a=i.get("highlightedValue"),_=a?s.find(a):null;i.set("highlightedItem",_)},dispatchChangeEvent({scope:i}){queueMicrotask(()=>{const o=getHiddenSelectEl(i);if(!o)return;const s=i.getWin(),a=new s.Event("change",{bubbles:!0,composed:!0});o.dispatchEvent(a)})}}}};createProps$1()(["closeOnSelect","collection","dir","disabled","deselectable","form","getRootNode","highlightedValue","id","ids","invalid","loopFocus","multiple","name","onFocusOutside","onHighlightChange","onInteractOutside","onOpenChange","onPointerDownOutside","onValueChange","defaultOpen","open","composite","positioning","required","readOnly","scrollToIndexFn","value","defaultValue","defaultHighlightedValue"]);createProps$1()(["item","persistFocus"]);createProps$1()(["id"]);createProps$1()(["htmlFor"]);const useSelect=i=>{const o=reactExports.useId(),{dir:s}=useLocaleContext(),{getRootNode:a}=useEnvironmentContext(),_=useFieldContext(),$={id:o,ids:{label:_==null?void 0:_.ids.label,hiddenSelect:_==null?void 0:_.ids.control},disabled:_==null?void 0:_.disabled,readOnly:_==null?void 0:_.readOnly,invalid:_==null?void 0:_.invalid,required:_==null?void 0:_.required,dir:s,getRootNode:a,...i},_e=useMachine(machine$4,$);return connect$4(_e,normalizeProps)},SelectImpl$1=(i,o)=>{const[s,a]=splitPresenceProps(i),[_,$]=createSplitProps()(a,["closeOnSelect","collection","composite","defaultHighlightedValue","defaultOpen","defaultValue","deselectable","disabled","form","highlightedValue","id","ids","invalid","loopFocus","multiple","name","onFocusOutside","onHighlightChange","onInteractOutside","onOpenChange","onPointerDownOutside","onValueChange","open","positioning","readOnly","required","scrollToIndexFn","value"]),_e=useSelect(_),tt=usePresence(mergeProps({present:_e.open},s)),st=mergeProps(_e.getRootProps(),$);return jsxRuntimeExports.jsx(SelectProvider,{value:_e,children:jsxRuntimeExports.jsx(PresenceProvider,{value:tt,children:jsxRuntimeExports.jsx(ark.div,{...st,ref:o})})})},SelectRoot$2=reactExports.forwardRef(SelectImpl$1),SelectImpl=(i,o)=>{const[s,a]=splitPresenceProps(i),[{value:_},$]=createSplitProps()(a,["value"]),_e=usePresence(mergeProps({present:_.open},s)),tt=mergeProps(_.getRootProps(),$);return jsxRuntimeExports.jsx(SelectProvider,{value:_,children:jsxRuntimeExports.jsx(PresenceProvider,{value:_e,children:jsxRuntimeExports.jsx(ark.div,{...tt,ref:o})})})},SelectRootProvider=reactExports.forwardRef(SelectImpl),SelectTrigger$2=reactExports.forwardRef((i,o)=>{const s=useSelectContext(),a=mergeProps(s.getTriggerProps(),i);return jsxRuntimeExports.jsx(ark.button,{...a,ref:o})});SelectTrigger$2.displayName="SelectTrigger";const SelectValueText$2=reactExports.forwardRef((i,o)=>{const{children:s,placeholder:a,..._}=i,$=useSelectContext(),_e=mergeProps($.getValueTextProps(),_);return jsxRuntimeExports.jsx(ark.span,{..._e,ref:o,children:s||$.valueAsString||a})});SelectValueText$2.displayName="SelectValueText";var anatomy$4=createAnatomy("slider").parts("root","label","thumb","valueText","track","range","control","markerGroup","marker","draggingIndicator");anatomy$4.build();createProps$1()(["aria-label","aria-labelledby","dir","disabled","form","getAriaValueText","getRootNode","id","ids","invalid","max","min","minStepsBetweenThumbs","name","onFocusChange","onValueChange","onValueChangeEnd","orientation","origin","readOnly","step","thumbAlignment","thumbAlignment","thumbSize","value","defaultValue"]);createProps$1()(["index","name"]);const[SwitchProvider,useSwitchContext]=createContext({name:"SwitchContext",hookName:"useSwitchContext",providerName:""}),SwitchControl$1=reactExports.forwardRef((i,o)=>{const s=useSwitchContext(),a=mergeProps(s.getControlProps(),i);return jsxRuntimeExports.jsx(ark.span,{...a,ref:o})});SwitchControl$1.displayName="SwitchControl";const SwitchHiddenInput$1=reactExports.forwardRef((i,o)=>{const s=useSwitchContext(),a=mergeProps(s.getHiddenInputProps(),i),_=useFieldContext();return jsxRuntimeExports.jsx(ark.input,{"aria-describedby":_==null?void 0:_.ariaDescribedby,...a,ref:o})});SwitchHiddenInput$1.displayName="SwitchHiddenInput";const SwitchLabel$1=reactExports.forwardRef((i,o)=>{const s=useSwitchContext(),a=mergeProps(s.getLabelProps(),i);return jsxRuntimeExports.jsx(ark.span,{...a,ref:o})});SwitchLabel$1.displayName="SwitchLabel";var anatomy$3=createAnatomy("switch").parts("root","label","control","thumb"),parts$3=anatomy$3.build(),getRootId$2=i=>{var o;return((o=i.ids)==null?void 0:o.root)??`switch:${i.id}`},getLabelId=i=>{var o;return((o=i.ids)==null?void 0:o.label)??`switch:${i.id}:label`},getThumbId=i=>{var o;return((o=i.ids)==null?void 0:o.thumb)??`switch:${i.id}:thumb`},getControlId=i=>{var o;return((o=i.ids)==null?void 0:o.control)??`switch:${i.id}:control`},getHiddenInputId=i=>{var o;return((o=i.ids)==null?void 0:o.hiddenInput)??`switch:${i.id}:input`},getRootEl$1=i=>i.getById(getRootId$2(i)),getHiddenInputEl=i=>i.getById(getHiddenInputId(i));function connect$3(i,o){const{context:s,send:a,prop:_,scope:$}=i,_e=_("disabled"),tt=_("readOnly"),st=!!s.get("checked"),it=!_e&&s.get("focused"),nt=!_e&&s.get("focusVisible"),et={"data-active":dataAttr$1(s.get("active")),"data-focus":dataAttr$1(it),"data-focus-visible":dataAttr$1(nt),"data-readonly":dataAttr$1(tt),"data-hover":dataAttr$1(s.get("hovered")),"data-disabled":dataAttr$1(_e),"data-state":st?"checked":"unchecked","data-invalid":dataAttr$1(_("invalid"))};return{checked:st,disabled:_e,focused:it,setChecked(j){a({type:"CHECKED.SET",checked:j,isTrusted:!1})},toggleChecked(){a({type:"CHECKED.TOGGLE",checked:st,isTrusted:!1})},getRootProps(){return o.label({...parts$3.root.attrs,...et,dir:_("dir"),id:getRootId$2($),htmlFor:getHiddenInputId($),onPointerMove(){_e||a({type:"CONTEXT.SET",context:{hovered:!0}})},onPointerLeave(){_e||a({type:"CONTEXT.SET",context:{hovered:!1}})},onClick(j){var ot;if(_e)return;getEventTarget(j)===getHiddenInputEl($)&&j.stopPropagation(),isSafari()&&((ot=getHiddenInputEl($))==null||ot.focus())}})},getLabelProps(){return o.element({...parts$3.label.attrs,...et,dir:_("dir"),id:getLabelId($)})},getThumbProps(){return o.element({...parts$3.thumb.attrs,...et,dir:_("dir"),id:getThumbId($),"aria-hidden":!0})},getControlProps(){return o.element({...parts$3.control.attrs,...et,dir:_("dir"),id:getControlId($),"aria-hidden":!0})},getHiddenInputProps(){return o.input({id:getHiddenInputId($),type:"checkbox",required:_("required"),defaultChecked:st,disabled:_e,"aria-labelledby":getLabelId($),"aria-invalid":_("invalid"),name:_("name"),form:_("form"),value:_("value"),style:visuallyHiddenStyle,onFocus(){const j=isFocusVisible();a({type:"CONTEXT.SET",context:{focused:!0,focusVisible:j}})},onBlur(){a({type:"CONTEXT.SET",context:{focused:!1,focusVisible:!1}})},onClick(j){if(tt){j.preventDefault();return}const rt=j.currentTarget.checked;a({type:"CHECKED.SET",checked:rt,isTrusted:!0})}})}}}var{not:not$3}=createGuards(),machine$3={props({props:i}){return{defaultChecked:!1,label:"switch",value:"on",...i}},initialState(){return"ready"},context({prop:i,bindable:o}){return{checked:o(()=>({defaultValue:i("defaultChecked"),value:i("checked"),onChange(s){var a;(a=i("onCheckedChange"))==null||a({checked:s})}})),fieldsetDisabled:o(()=>({defaultValue:!1})),focusVisible:o(()=>({defaultValue:!1})),active:o(()=>({defaultValue:!1})),focused:o(()=>({defaultValue:!1})),hovered:o(()=>({defaultValue:!1}))}},computed:{isDisabled:({context:i,prop:o})=>o("disabled")||i.get("fieldsetDisabled")},watch({track:i,prop:o,context:s,action:a}){i([()=>o("disabled")],()=>{a(["removeFocusIfNeeded"])}),i([()=>s.get("checked")],()=>{a(["syncInputElement"])})},effects:["trackFormControlState","trackPressEvent","trackFocusVisible"],on:{"CHECKED.TOGGLE":[{guard:not$3("isTrusted"),actions:["toggleChecked","dispatchChangeEvent"]},{actions:["toggleChecked"]}],"CHECKED.SET":[{guard:not$3("isTrusted"),actions:["setChecked","dispatchChangeEvent"]},{actions:["setChecked"]}],"CONTEXT.SET":{actions:["setContext"]}},states:{ready:{}},implementations:{guards:{isTrusted:({event:i})=>!!i.isTrusted},effects:{trackPressEvent({computed:i,scope:o,context:s}){if(!i("isDisabled"))return trackPress({pointerNode:getRootEl$1(o),keyboardNode:getHiddenInputEl(o),isValidKey:a=>a.key===" ",onPress:()=>s.set("active",!1),onPressStart:()=>s.set("active",!0),onPressEnd:()=>s.set("active",!1)})},trackFocusVisible({computed:i,scope:o}){if(!i("isDisabled"))return trackFocusVisible({root:o.getRootNode()})},trackFormControlState({context:i,send:o,scope:s}){return trackFormControl(getHiddenInputEl(s),{onFieldsetDisabledChange(a){i.set("fieldsetDisabled",a)},onFormReset(){const a=i.initial("checked");o({type:"CHECKED.SET",checked:!!a,src:"form-reset"})}})}},actions:{setContext({context:i,event:o}){for(const s in o.context)i.set(s,o.context[s])},syncInputElement({context:i,scope:o}){const s=getHiddenInputEl(o);s&&setElementChecked(s,!!i.get("checked"))},removeFocusIfNeeded({context:i,prop:o}){o("disabled")&&i.set("focused",!1)},setChecked({context:i,event:o}){i.set("checked",o.checked)},toggleChecked({context:i}){i.set("checked",!i.get("checked"))},dispatchChangeEvent({context:i,scope:o}){const s=getHiddenInputEl(o);dispatchInputCheckedEvent(s,{checked:i.get("checked")})}}}};createProps$1()(["checked","defaultChecked","dir","disabled","form","getRootNode","id","ids","invalid","label","name","onCheckedChange","readOnly","required","value"]);const useSwitch=i=>{const o=reactExports.useId(),{getRootNode:s}=useEnvironmentContext(),{dir:a}=useLocaleContext(),_=useFieldContext(),$={id:o,ids:{label:_==null?void 0:_.ids.label,hiddenInput:_==null?void 0:_.ids.control},dir:a,disabled:_==null?void 0:_.disabled,readOnly:_==null?void 0:_.readOnly,invalid:_==null?void 0:_.invalid,required:_==null?void 0:_.required,getRootNode:s,...i},_e=useMachine(machine$3,$);return connect$3(_e,normalizeProps)},SwitchRoot$1=reactExports.forwardRef((i,o)=>{const[s,a]=createSplitProps()(i,["checked","defaultChecked","disabled","form","id","ids","invalid","label","name","onCheckedChange","readOnly","required","value"]),_=useSwitch(s),$=mergeProps(_.getRootProps(),a);return jsxRuntimeExports.jsx(SwitchProvider,{value:_,children:jsxRuntimeExports.jsx(ark.label,{...$,ref:o})})});SwitchRoot$1.displayName="SwitchRoot";const SwitchRootProvider=reactExports.forwardRef((i,o)=>{const[{value:s},a]=createSplitProps()(i,["value"]),_=mergeProps(s.getRootProps(),a);return jsxRuntimeExports.jsx(SwitchProvider,{value:s,children:jsxRuntimeExports.jsx(ark.label,{..._,ref:o})})});SwitchRootProvider.displayName="SwitchRootProvider";const SwitchThumb$1=reactExports.forwardRef((i,o)=>{const s=useSwitchContext(),a=mergeProps(s.getThumbProps(),i);return jsxRuntimeExports.jsx(ark.span,{...a,ref:o})});SwitchThumb$1.displayName="SwitchThumb";function useDebounce(i,o){const[s,a]=reactExports.useState(i);return reactExports.useEffect(()=>{const _=setTimeout(()=>{a(i)},o);return()=>{clearTimeout(_)}},[i,o]),s}const[TabsProvider,useTabsContext]=createContext({name:"TabsContext",hookName:"useTabsContext",providerName:""}),TabContent=reactExports.forwardRef((i,o)=>{const[s,a]=createSplitProps()(i,["value"]),_=useTabsContext(),$=useRenderStrategyPropsContext(),_e=usePresence({...$,present:useDebounce(_.value===i.value,0),immediate:!0}),tt=mergeProps(_.getContentProps(s),_e.getPresenceProps(),a);return jsxRuntimeExports.jsx(PresenceProvider,{value:_e,children:_e.unmounted?null:jsxRuntimeExports.jsx(ark.div,{...tt,ref:composeRefs(_e.ref,o)})})});TabContent.displayName="TabContent";const TabIndicator=reactExports.forwardRef((i,o)=>{const s=useTabsContext(),a=mergeProps(s.getIndicatorProps(),i);return jsxRuntimeExports.jsx(ark.div,{...a,ref:o})});TabIndicator.displayName="TabIndicator";const TabList=reactExports.forwardRef((i,o)=>{const s=useTabsContext(),a=mergeProps(s.getListProps(),i);return jsxRuntimeExports.jsx(ark.div,{...a,ref:o})});TabList.displayName="TabList";const TabTrigger=reactExports.forwardRef((i,o)=>{const[s,a]=createSplitProps()(i,["disabled","value"]),_=useTabsContext(),$=mergeProps(_.getTriggerProps(s),a);return jsxRuntimeExports.jsx(ark.button,{...$,ref:o})});TabTrigger.displayName="TabTrigger";var anatomy$2=createAnatomy("tabs").parts("root","list","trigger","content","indicator"),parts$2=anatomy$2.build(),getRootId$1=i=>{var o;return((o=i.ids)==null?void 0:o.root)??`tabs:${i.id}`},getListId=i=>{var o;return((o=i.ids)==null?void 0:o.list)??`tabs:${i.id}:list`},getContentId$1=(i,o)=>{var s;return((s=i.ids)==null?void 0:s.content)??`tabs:${i.id}:content-${o}`},getTriggerId$1=(i,o)=>{var s;return((s=i.ids)==null?void 0:s.trigger)??`tabs:${i.id}:trigger-${o}`},getIndicatorId=i=>{var o;return((o=i.ids)==null?void 0:o.indicator)??`tabs:${i.id}:indicator`},getListEl=i=>i.getById(getListId(i)),getContentEl=(i,o)=>i.getById(getContentId$1(i,o)),getTriggerEl$1=(i,o)=>i.getById(getTriggerId$1(i,o)),getIndicatorEl=i=>i.getById(getIndicatorId(i)),getElements=i=>{const s=`[role=tab][data-ownedby='${CSS.escape(getListId(i))}']:not([disabled])`;return queryAll(getListEl(i),s)},getFirstTriggerEl=i=>first(getElements(i)),getLastTriggerEl=i=>last(getElements(i)),getNextTriggerEl=(i,o)=>nextById(getElements(i),getTriggerId$1(i,o.value),o.loopFocus),getPrevTriggerEl=(i,o)=>prevById(getElements(i),getTriggerId$1(i,o.value),o.loopFocus),getOffsetRect=i=>({left:(i==null?void 0:i.offsetLeft)??0,top:(i==null?void 0:i.offsetTop)??0,width:(i==null?void 0:i.offsetWidth)??0,height:(i==null?void 0:i.offsetHeight)??0}),getRectById=(i,o)=>{const s=itemById(getElements(i),getTriggerId$1(i,o));return resolveRect(getOffsetRect(s))},resolveRect=i=>({width:`${i.width}px`,height:`${i.height}px`,left:`${i.left}px`,top:`${i.top}px`});function connect$2(i,o){const{state:s,send:a,context:_,prop:$,scope:_e}=i,tt=$("translations"),st=s.matches("focused"),it=$("orientation")==="vertical",nt=$("orientation")==="horizontal",et=$("composite");function j(rt){return{selected:_.get("value")===rt.value,focused:_.get("focusedValue")===rt.value,disabled:!!rt.disabled}}return{value:_.get("value"),focusedValue:_.get("focusedValue"),setValue(rt){a({type:"SET_VALUE",value:rt})},clearValue(){a({type:"CLEAR_VALUE"})},setIndicatorRect(rt){const ot=getTriggerId$1(_e,rt);a({type:"SET_INDICATOR_RECT",id:ot})},syncTabIndex(){a({type:"SYNC_TAB_INDEX"})},selectNext(rt){a({type:"TAB_FOCUS",value:rt,src:"selectNext"}),a({type:"ARROW_NEXT",src:"selectNext"})},selectPrev(rt){a({type:"TAB_FOCUS",value:rt,src:"selectPrev"}),a({type:"ARROW_PREV",src:"selectPrev"})},focus(){var ot;const rt=_.get("value");rt&&((ot=getTriggerEl$1(_e,rt))==null||ot.focus())},getRootProps(){return o.element({...parts$2.root.attrs,id:getRootId$1(_e),"data-orientation":$("orientation"),"data-focus":dataAttr$1(st),dir:$("dir")})},getListProps(){return o.element({...parts$2.list.attrs,id:getListId(_e),role:"tablist",dir:$("dir"),"data-focus":dataAttr$1(st),"aria-orientation":$("orientation"),"data-orientation":$("orientation"),"aria-label":tt==null?void 0:tt.listLabel,onKeyDown(rt){if(rt.defaultPrevented||!isSelfTarget(rt)||isComposingEvent(rt))return;const ot={ArrowDown(){nt||a({type:"ARROW_NEXT",key:"ArrowDown"})},ArrowUp(){nt||a({type:"ARROW_PREV",key:"ArrowUp"})},ArrowLeft(){it||a({type:"ARROW_PREV",key:"ArrowLeft"})},ArrowRight(){it||a({type:"ARROW_NEXT",key:"ArrowRight"})},Home(){a({type:"HOME"})},End(){a({type:"END"})},Enter(){a({type:"ENTER"})}};let at=getEventKey(rt,{dir:$("dir"),orientation:$("orientation")});const lt=ot[at];lt&&(rt.preventDefault(),lt(rt))}})},getTriggerState:j,getTriggerProps(rt){const{value:ot,disabled:at}=rt,lt=j(rt);return o.button({...parts$2.trigger.attrs,role:"tab",type:"button",disabled:at,dir:$("dir"),"data-orientation":$("orientation"),"data-disabled":dataAttr$1(at),"aria-disabled":at,"data-value":ot,"aria-selected":lt.selected,"data-selected":dataAttr$1(lt.selected),"data-focus":dataAttr$1(lt.focused),"aria-controls":lt.selected?getContentId$1(_e,ot):void 0,"data-ownedby":getListId(_e),"data-ssr":dataAttr$1(_.get("ssr")),id:getTriggerId$1(_e,ot),tabIndex:lt.selected&&et?0:-1,onFocus(){a({type:"TAB_FOCUS",value:ot})},onBlur(ut){const ct=ut.relatedTarget;(ct==null?void 0:ct.getAttribute("role"))!=="tab"&&a({type:"TAB_BLUR"})},onClick(ut){ut.defaultPrevented||at||(isSafari()&&ut.currentTarget.focus(),a({type:"TAB_CLICK",value:ot}))}})},getContentProps(rt){const{value:ot}=rt,at=_.get("value")===ot;return o.element({...parts$2.content.attrs,dir:$("dir"),id:getContentId$1(_e,ot),tabIndex:et?0:-1,"aria-labelledby":getTriggerId$1(_e,ot),role:"tabpanel","data-ownedby":getListId(_e),"data-selected":dataAttr$1(at),"data-orientation":$("orientation"),hidden:!at})},getIndicatorProps(){const rt=_.get("indicatorRect"),ot=_.get("indicatorTransition");return o.element({id:getIndicatorId(_e),...parts$2.indicator.attrs,dir:$("dir"),"data-orientation":$("orientation"),style:{"--transition-property":"left, right, top, bottom, width, height","--left":rt.left,"--top":rt.top,"--width":rt.width,"--height":rt.height,position:"absolute",willChange:"var(--transition-property)",transitionProperty:"var(--transition-property)",transitionDuration:ot?"var(--transition-duration, 150ms)":"0ms",transitionTimingFunction:"var(--transition-timing-function)",[nt?"left":"top"]:nt?"var(--left)":"var(--top)"}})}}}var{not:not$2}=createGuards(),machine$2={props({props:i}){return{dir:"ltr",orientation:"horizontal",activationMode:"automatic",loopFocus:!0,composite:!0,navigate(o){clickIfLink(o.node)},defaultValue:null,...i}},initialState(){return"idle"},context({prop:i,bindable:o}){return{value:o(()=>({defaultValue:i("defaultValue"),value:i("value"),onChange(s){var a;(a=i("onValueChange"))==null||a({value:s})}})),focusedValue:o(()=>({defaultValue:i("value")||i("defaultValue"),sync:!0,onChange(s){var a;(a=i("onFocusChange"))==null||a({focusedValue:s})}})),ssr:o(()=>({defaultValue:!0})),indicatorTransition:o(()=>({defaultValue:!1})),indicatorRect:o(()=>({defaultValue:{left:"0px",top:"0px",width:"0px",height:"0px"}}))}},watch({context:i,prop:o,track:s,action:a}){s([()=>i.get("value")],()=>{a(["allowIndicatorTransition","syncIndicatorRect","syncTabIndex","navigateIfNeeded"])}),s([()=>o("dir"),()=>o("orientation")],()=>{a(["syncIndicatorRect"])})},on:{SET_VALUE:{actions:["setValue"]},CLEAR_VALUE:{actions:["clearValue"]},SET_INDICATOR_RECT:{actions:["setIndicatorRect"]},SYNC_TAB_INDEX:{actions:["syncTabIndex"]}},entry:["syncIndicatorRect","syncTabIndex","syncSsr"],exit:["cleanupObserver"],states:{idle:{on:{TAB_FOCUS:{target:"focused",actions:["setFocusedValue"]},TAB_CLICK:{target:"focused",actions:["setFocusedValue","setValue"]}}},focused:{on:{TAB_CLICK:{target:"focused",actions:["setFocusedValue","setValue"]},ARROW_PREV:[{guard:"selectOnFocus",actions:["focusPrevTab","selectFocusedTab"]},{actions:["focusPrevTab"]}],ARROW_NEXT:[{guard:"selectOnFocus",actions:["focusNextTab","selectFocusedTab"]},{actions:["focusNextTab"]}],HOME:[{guard:"selectOnFocus",actions:["focusFirstTab","selectFocusedTab"]},{actions:["focusFirstTab"]}],END:[{guard:"selectOnFocus",actions:["focusLastTab","selectFocusedTab"]},{actions:["focusLastTab"]}],ENTER:{guard:not$2("selectOnFocus"),actions:["selectFocusedTab"]},TAB_FOCUS:{actions:["setFocusedValue"]},TAB_BLUR:{target:"idle",actions:["clearFocusedValue"]}}}},implementations:{guards:{selectOnFocus:({prop:i})=>i("activationMode")==="automatic"},actions:{selectFocusedTab({context:i,prop:o}){raf$1(()=>{const s=i.get("focusedValue");if(!s)return;const _=o("deselectable")&&i.get("value")===s?null:s;i.set("value",_)})},setFocusedValue({context:i,event:o,flush:s}){o.value!=null&&s(()=>{i.set("focusedValue",o.value)})},clearFocusedValue({context:i}){i.set("focusedValue",null)},setValue({context:i,event:o,prop:s}){const a=s("deselectable")&&i.get("value")===i.get("focusedValue");i.set("value",a?null:o.value)},clearValue({context:i}){i.set("value",null)},focusFirstTab({scope:i}){raf$1(()=>{var o;(o=getFirstTriggerEl(i))==null||o.focus()})},focusLastTab({scope:i}){raf$1(()=>{var o;(o=getLastTriggerEl(i))==null||o.focus()})},focusNextTab({context:i,prop:o,scope:s,event:a}){const _=a.value??i.get("focusedValue");if(!_)return;const $=getNextTriggerEl(s,{value:_,loopFocus:o("loopFocus")});raf$1(()=>{o("composite")?$==null||$.focus():($==null?void 0:$.dataset.value)!=null&&i.set("focusedValue",$.dataset.value)})},focusPrevTab({context:i,prop:o,scope:s,event:a}){const _=a.value??i.get("focusedValue");if(!_)return;const $=getPrevTriggerEl(s,{value:_,loopFocus:o("loopFocus")});raf$1(()=>{o("composite")?$==null||$.focus():($==null?void 0:$.dataset.value)!=null&&i.set("focusedValue",$.dataset.value)})},syncTabIndex({context:i,scope:o}){raf$1(()=>{const s=i.get("value");if(!s)return;const a=getContentEl(o,s);if(!a)return;getFocusables(a).length>0?a.removeAttribute("tabindex"):a.setAttribute("tabindex","0")})},cleanupObserver({refs:i}){const o=i.get("indicatorCleanup");o&&o()},allowIndicatorTransition({context:i}){i.set("indicatorTransition",!0)},setIndicatorRect({context:i,event:o,scope:s}){const a=o.id??i.get("value");if(!getIndicatorEl(s))return;if(!a){i.set("indicatorTransition",!1);return}getTriggerEl$1(s,a)&&(i.set("indicatorRect",getRectById(s,a)),nextTick(()=>{i.set("indicatorTransition",!1)}))},syncSsr({context:i}){i.set("ssr",!1)},syncIndicatorRect({context:i,refs:o,scope:s}){const a=o.get("indicatorCleanup");a&&a();const _=i.get("value");if(!_){i.set("indicatorTransition",!1);return}const $=getTriggerEl$1(s,_),_e=getIndicatorEl(s);if(!$||!_e)return;const tt=trackElementRect([$],{measure(st){return getOffsetRect(st)},onEntry({rects:st}){const[it]=st;i.set("indicatorRect",resolveRect(it))}});o.set("indicatorCleanup",tt)},navigateIfNeeded({context:i,prop:o,scope:s}){var $;const a=i.get("value");if(!a)return;const _=getTriggerEl$1(s,a);isAnchorElement(_)&&(($=o("navigate"))==null||$({value:a,node:_}))}}}};createProps$1()(["activationMode","composite","deselectable","dir","getRootNode","id","ids","loopFocus","navigate","onFocusChange","onValueChange","orientation","translations","value","defaultValue"]);createProps$1()(["disabled","value"]);createProps$1()(["value"]);const useTabs=i=>{const o=reactExports.useId(),{getRootNode:s}=useEnvironmentContext(),{dir:a}=useLocaleContext(),_={id:o,dir:a,getRootNode:s,...i},$=useMachine(machine$2,_);return connect$2($,normalizeProps)},TabsRoot$1=reactExports.forwardRef((i,o)=>{const[s,a]=splitRenderStrategyProps(i),[_,$]=createSplitProps()(a,["activationMode","composite","defaultValue","deselectable","id","ids","loopFocus","navigate","onFocusChange","onValueChange","orientation","translations","value"]),_e=useTabs(_),tt=mergeProps(_e.getRootProps(),$);return jsxRuntimeExports.jsx(TabsProvider,{value:_e,children:jsxRuntimeExports.jsx(RenderStrategyPropsProvider,{value:s,children:jsxRuntimeExports.jsx(ark.div,{...tt,ref:o})})})});TabsRoot$1.displayName="TabsRoot";const TabsRootProvider=reactExports.forwardRef((i,o)=>{const[s,a]=splitRenderStrategyProps(i),[{value:_},$]=createSplitProps()(a,["value"]),_e=mergeProps(_.getRootProps(),$);return jsxRuntimeExports.jsx(TabsProvider,{value:_,children:jsxRuntimeExports.jsx(RenderStrategyPropsProvider,{value:s,children:jsxRuntimeExports.jsx(ark.div,{..._e,ref:o})})})});TabsRootProvider.displayName="TabsRootProvider";var anatomy$1=createAnatomy("toast").parts("group","root","title","description","actionTrigger","closeTrigger"),parts$1=anatomy$1.build(),getRegionId=i=>`toast-group:${i}`,getRegionEl=(i,o)=>i.getById(`toast-group:${o}`),getRootId=i=>`toast:${i.id}`,getRootEl=i=>i.getById(getRootId(i)),getTitleId=i=>`toast:${i.id}:title`,getDescriptionId=i=>`toast:${i.id}:description`,getCloseTriggerId=i=>`toast${i.id}:close`,defaultTimeouts={info:5e3,error:5e3,success:2e3,loading:1/0,DEFAULT:5e3};function getToastDuration(i,o){return i??defaultTimeouts[o]??defaultTimeouts.DEFAULT}var getOffsets=i=>typeof i=="string"?{left:i,right:i,bottom:i,top:i}:i;function getGroupPlacementStyle(i,o){var at;const{prop:s,computed:a,context:_}=i,{offsets:$,gap:_e}=s("store").attrs,tt=_.get("heights"),st=getOffsets($),it=s("dir")==="rtl",nt=o.replace("-start",it?"-right":"-left").replace("-end",it?"-left":"-right"),et=nt.includes("right"),j=nt.includes("left"),rt={position:"fixed",pointerEvents:a("count")>0?void 0:"none",display:"flex",flexDirection:"column","--gap":`${_e}px`,"--first-height":`${((at=tt[0])==null?void 0:at.height)||0}px`,zIndex:MAX_Z_INDEX};let ot="center";if(et&&(ot="flex-end"),j&&(ot="flex-start"),rt.alignItems=ot,nt.includes("top")){const lt=st.top;rt.top=`max(env(safe-area-inset-top, 0px), ${lt})`}if(nt.includes("bottom")){const lt=st.bottom;rt.bottom=`max(env(safe-area-inset-bottom, 0px), ${lt})`}if(!nt.includes("left")){const lt=st.right;rt.insetInlineEnd=`calc(env(safe-area-inset-right, 0px) + ${lt})`}if(!nt.includes("right")){const lt=st.left;rt.insetInlineStart=`calc(env(safe-area-inset-left, 0px) + ${lt})`}return rt}function getPlacementStyle(i,o){const{prop:s,context:a,computed:_}=i,$=s("parent"),_e=$.computed("placement"),{gap:tt}=$.prop("store").attrs,[st]=_e.split("-"),it=a.get("mounted"),nt=a.get("remainingTime"),et=_("height"),j=_("frontmost"),rt=!j,ot=!s("stacked"),at=s("stacked"),ut=s("type")==="loading"?Number.MAX_SAFE_INTEGER:nt,ct=_("heightIndex")*tt+_("heightBefore"),dt={position:"absolute",pointerEvents:"auto","--opacity":"0","--remove-delay":`${s("removeDelay")}ms`,"--duration":`${ut}ms`,"--initial-height":`${et}px`,"--offset":`${ct}px`,"--index":s("index"),"--z-index":_("zIndex"),"--lift-amount":"calc(var(--lift) * var(--gap))","--y":"100%","--x":"0"},ft=ht=>Object.assign(dt,ht);return st==="top"?ft({top:"0","--sign":"-1","--y":"-100%","--lift":"1"}):st==="bottom"&&ft({bottom:"0","--sign":"1","--y":"100%","--lift":"-1"}),it&&(ft({"--y":"0","--opacity":"1"}),at&&ft({"--y":"calc(var(--lift) * var(--offset))","--height":"var(--initial-height)"})),o||ft({"--opacity":"0",pointerEvents:"none"}),rt&&ot&&(ft({"--base-scale":"var(--index) * 0.05 + 1","--y":"calc(var(--lift-amount) * var(--index))","--scale":"calc(-1 * var(--base-scale))","--height":"var(--first-height)"}),o||ft({"--y":"calc(var(--sign) * 40%)"})),rt&&at&&!o&&ft({"--y":"calc(var(--lift) * var(--offset) + var(--lift) * -100%)"}),j&&!o&&ft({"--y":"calc(var(--lift) * -100%)"}),dt}function getGhostBeforeStyle(i,o){const{computed:s}=i,a={position:"absolute",inset:"0",scale:"1 2",pointerEvents:o?"none":"auto"},_=$=>Object.assign(a,$);return s("frontmost")&&!o&&_({height:"calc(var(--initial-height) + 80%)"}),a}function getGhostAfterStyle(){return{position:"absolute",left:"0",height:"calc(var(--gap) + 2px)",bottom:"100%",width:"100%"}}function groupConnect(i,o){const{context:s,prop:a,send:_,refs:$,computed:_e}=i;return{getCount(){return s.get("toasts").length},getToasts(){return s.get("toasts")},getGroupProps(tt={}){const{label:st="Notifications"}=tt,{hotkey:it}=a("store").attrs,nt=it.join("+").replace(/Key/g,"").replace(/Digit/g,""),et=_e("placement"),[j,rt="center"]=et.split("-");return o.element({...parts$1.group.attrs,dir:a("dir"),tabIndex:-1,"aria-label":`${et} ${st} ${nt}`,id:getRegionId(et),"data-placement":et,"data-side":j,"data-align":rt,"aria-live":"polite",role:"region",style:getGroupPlacementStyle(i,et),onMouseMove(){_({type:"REGION.POINTER_ENTER",placement:et})},onMouseLeave(){_({type:"REGION.POINTER_LEAVE",placement:et})},onFocus(ot){_({type:"REGION.FOCUS",target:ot.relatedTarget})},onBlur(ot){$.get("isFocusWithin")&&!contains(ot.currentTarget,ot.relatedTarget)&&queueMicrotask(()=>_({type:"REGION.BLUR"}))}})},subscribe(tt){return a("store").subscribe(()=>tt(s.get("toasts")))}}}var groupMachine={props({props:i}){return{dir:"ltr",id:uuid(),...i,store:i.store}},initialState({prop:i}){return i("store").attrs.overlap?"overlap":"stack"},refs(){return{lastFocusedEl:null,isFocusWithin:!1,dismissableCleanup:void 0}},context({bindable:i}){return{toasts:i(()=>({defaultValue:[],sync:!0,hash:o=>o.map(s=>s.id).join(",")})),heights:i(()=>({defaultValue:[],sync:!0}))}},computed:{count:({context:i})=>i.get("toasts").length,overlap:({prop:i})=>i("store").attrs.overlap,placement:({prop:i})=>i("store").attrs.placement},effects:["subscribeToStore","trackDocumentVisibility","trackHotKeyPress"],watch({track:i,context:o,action:s}){i([()=>o.hash("toasts")],()=>{queueMicrotask(()=>{s(["collapsedIfEmpty","setDismissableBranch"])})})},exit:["clearDismissableBranch","clearLastFocusedEl"],on:{"DOC.HOTKEY":{actions:["focusRegionEl"]},"REGION.BLUR":[{guard:"isOverlapping",target:"overlap",actions:["collapseToasts","resumeToasts","restoreLastFocusedEl"]},{target:"stack",actions:["resumeToasts","restoreLastFocusedEl"]}],"TOAST.REMOVE":{actions:["removeToast","removeHeight"]},"TOAST.PAUSE":{actions:["pauseToasts"]}},states:{stack:{on:{"REGION.POINTER_LEAVE":[{guard:"isOverlapping",target:"overlap",actions:["resumeToasts","collapseToasts"]},{actions:["resumeToasts"]}],"REGION.OVERLAP":{target:"overlap",actions:["collapseToasts"]},"REGION.FOCUS":{actions:["setLastFocusedEl","pauseToasts"]},"REGION.POINTER_ENTER":{actions:["pauseToasts"]}}},overlap:{on:{"REGION.STACK":{target:"stack",actions:["expandToasts"]},"REGION.POINTER_ENTER":{target:"stack",actions:["pauseToasts","expandToasts"]},"REGION.FOCUS":{target:"stack",actions:["setLastFocusedEl","pauseToasts","expandToasts"]}}}},implementations:{guards:{isOverlapping:({computed:i})=>i("overlap")},effects:{subscribeToStore({context:i,prop:o}){return o("store").subscribe(s=>{if(s.dismiss){i.set("toasts",a=>a.filter(_=>_.id!==s.id));return}i.set("toasts",a=>{const _=a.findIndex($=>$.id===s.id);return _!==-1?[...a.slice(0,_),{...a[_],...s},...a.slice(_+1)]:[s,...a]})})},trackHotKeyPress({prop:i,send:o}){return addDomEvent(document,"keydown",a=>{const{hotkey:_}=i("store").attrs;_.every(_e=>a[_e]||a.code===_e)&&o({type:"DOC.HOTKEY"})},{capture:!0})},trackDocumentVisibility({prop:i,send:o,scope:s}){const{pauseOnPageIdle:a}=i("store").attrs;if(!a)return;const _=s.getDoc();return addDomEvent(_,"visibilitychange",()=>{const $=_.visibilityState==="hidden";o({type:$?"PAUSE_ALL":"RESUME_ALL"})})}},actions:{setDismissableBranch({refs:i,context:o,computed:s,scope:a}){var it;const _=o.get("toasts"),$=s("placement"),_e=_.length>0;if(!_e){(it=i.get("dismissableCleanup"))==null||it();return}if(_e&&i.get("dismissableCleanup"))return;const st=trackDismissableBranch(()=>getRegionEl(a,$),{defer:!0});i.set("dismissableCleanup",st)},clearDismissableBranch({refs:i}){var o;(o=i.get("dismissableCleanup"))==null||o()},focusRegionEl({scope:i,computed:o}){queueMicrotask(()=>{var s;(s=getRegionEl(i,o("placement")))==null||s.focus()})},pauseToasts({prop:i}){i("store").pause()},resumeToasts({prop:i}){i("store").resume()},expandToasts({prop:i}){i("store").expand()},collapseToasts({prop:i}){i("store").collapse()},removeToast({prop:i,event:o}){i("store").remove(o.id)},removeHeight({event:i,context:o}){(i==null?void 0:i.id)!=null&&queueMicrotask(()=>{o.set("heights",s=>s.filter(a=>a.id!==i.id))})},collapsedIfEmpty({send:i,computed:o}){!o("overlap")||o("count")>1||i({type:"REGION.OVERLAP"})},setLastFocusedEl({refs:i,event:o}){i.get("isFocusWithin")||!o.target||(i.set("isFocusWithin",!0),i.set("lastFocusedEl",o.target))},restoreLastFocusedEl({refs:i}){var o;i.get("lastFocusedEl")&&((o=i.get("lastFocusedEl"))==null||o.focus({preventScroll:!0}),i.set("lastFocusedEl",null),i.set("isFocusWithin",!1))},clearLastFocusedEl({refs:i}){var o;i.get("lastFocusedEl")&&((o=i.get("lastFocusedEl"))==null||o.focus({preventScroll:!0}),i.set("lastFocusedEl",null),i.set("isFocusWithin",!1))}}}};function connect$1(i,o){const{state:s,send:a,prop:_,scope:$,context:_e,computed:tt}=i,st=s.hasTag("visible"),it=s.hasTag("paused"),nt=_e.get("mounted"),et=tt("frontmost"),j=_("parent").computed("placement"),rt=_("type"),ot=_("stacked"),at=_("title"),lt=_("description"),ut=_("action"),[ct,dt="center"]=j.split("-");return{type:rt,title:at,description:lt,placement:j,visible:st,paused:it,closable:!!_("closable"),pause(){a({type:"PAUSE"})},resume(){a({type:"RESUME"})},dismiss(){a({type:"DISMISS",src:"programmatic"})},getRootProps(){return o.element({...parts$1.root.attrs,dir:_("dir"),id:getRootId($),"data-state":st?"open":"closed","data-type":rt,"data-placement":j,"data-align":dt,"data-side":ct,"data-mounted":dataAttr$1(nt),"data-paused":dataAttr$1(it),"data-first":dataAttr$1(et),"data-sibling":dataAttr$1(!et),"data-stack":dataAttr$1(ot),"data-overlap":dataAttr$1(!ot),role:"status","aria-atomic":"true","aria-describedby":lt?getDescriptionId($):void 0,"aria-labelledby":at?getTitleId($):void 0,tabIndex:0,style:getPlacementStyle(i,st),onKeyDown(ft){ft.defaultPrevented||ft.key=="Escape"&&(a({type:"DISMISS",src:"keyboard"}),ft.preventDefault())}})},getGhostBeforeProps(){return o.element({"data-ghost":"before",style:getGhostBeforeStyle(i,st)})},getGhostAfterProps(){return o.element({"data-ghost":"after",style:getGhostAfterStyle()})},getTitleProps(){return o.element({...parts$1.title.attrs,id:getTitleId($)})},getDescriptionProps(){return o.element({...parts$1.description.attrs,id:getDescriptionId($)})},getActionTriggerProps(){return o.button({...parts$1.actionTrigger.attrs,type:"button",onClick(ft){var ht;ft.defaultPrevented||((ht=ut==null?void 0:ut.onClick)==null||ht.call(ut),a({type:"DISMISS",src:"user"}))}})},getCloseTriggerProps(){return o.button({id:getCloseTriggerId($),...parts$1.closeTrigger.attrs,type:"button","aria-label":"Dismiss notification",onClick(ft){ft.defaultPrevented||a({type:"DISMISS",src:"user"})}})}}}var{not:not$1}=createGuards(),machine$1={props({props:i}){return ensureProps(i,["id","type","parent","removeDelay"],"toast"),{closable:!0,...i,duration:getToastDuration(i.duration,i.type)}},initialState({prop:i}){return i("type")==="loading"||i("duration")===1/0?"visible:persist":"visible"},context({prop:i,bindable:o}){return{remainingTime:o(()=>({defaultValue:getToastDuration(i("duration"),i("type"))})),createdAt:o(()=>({defaultValue:Date.now()})),mounted:o(()=>({defaultValue:!1})),initialHeight:o(()=>({defaultValue:0}))}},refs(){return{closeTimerStartTime:Date.now(),lastCloseStartTimerStartTime:0}},computed:{zIndex:({prop:i})=>{const o=i("parent").context.get("toasts"),s=o.findIndex(a=>a.id===i("id"));return o.length-s},height:({prop:i})=>{const s=i("parent").context.get("heights").find(a=>a.id===i("id"));return(s==null?void 0:s.height)??0},heightIndex:({prop:i})=>i("parent").context.get("heights").findIndex(s=>s.id===i("id")),frontmost:({prop:i})=>i("index")===0,heightBefore:({prop:i})=>{const o=i("parent").context.get("heights"),s=o.findIndex(a=>a.id===i("id"));return o.reduce((a,_,$)=>$>=s?a:a+_.height,0)},shouldPersist:({prop:i})=>i("type")==="loading"||i("duration")===1/0},watch({track:i,prop:o,send:s}){i([()=>o("message")],()=>{const a=o("message");a&&s({type:a,src:"programmatic"})}),i([()=>o("type"),()=>o("duration")],()=>{s({type:"UPDATE"})})},on:{UPDATE:[{guard:"shouldPersist",target:"visible:persist",actions:["resetCloseTimer"]},{target:"visible:updating",actions:["resetCloseTimer"]}],MEASURE:{actions:["measureHeight"]}},entry:["setMounted","measureHeight","invokeOnVisible"],effects:["trackHeight"],states:{"visible:updating":{tags:["visible","updating"],effects:["waitForNextTick"],on:{SHOW:{target:"visible"}}},"visible:persist":{tags:["visible","paused"],on:{RESUME:{guard:not$1("isLoadingType"),target:"visible",actions:["setCloseTimer"]},DISMISS:{target:"dismissing"}}},visible:{tags:["visible"],effects:["waitForDuration"],on:{DISMISS:{target:"dismissing"},PAUSE:{target:"visible:persist",actions:["syncRemainingTime"]}}},dismissing:{entry:["invokeOnDismiss"],effects:["waitForRemoveDelay"],on:{REMOVE:{target:"unmounted",actions:["notifyParentToRemove"]}}},unmounted:{entry:["invokeOnUnmount"]}},implementations:{effects:{waitForRemoveDelay({prop:i,send:o}){return setRafTimeout(()=>{o({type:"REMOVE",src:"timer"})},i("removeDelay"))},waitForDuration({send:i,context:o,computed:s}){if(!s("shouldPersist"))return setRafTimeout(()=>{i({type:"DISMISS",src:"timer"})},o.get("remainingTime"))},waitForNextTick({send:i}){return setRafTimeout(()=>{i({type:"SHOW",src:"timer"})},0)},trackHeight({scope:i,prop:o}){let s;return raf$1(()=>{const a=getRootEl(i);if(!a)return;const _=()=>{const tt=a.style.height;a.style.height="auto";const st=a.getBoundingClientRect().height;a.style.height=tt;const it={id:o("id"),height:st};setHeight(o("parent"),it)},$=i.getWin(),_e=new $.MutationObserver(_);_e.observe(a,{childList:!0,subtree:!0,characterData:!0}),s=()=>_e.disconnect()}),()=>s==null?void 0:s()}},guards:{isLoadingType:({prop:i})=>i("type")==="loading",shouldPersist:({computed:i})=>i("shouldPersist")},actions:{setMounted({context:i}){raf$1(()=>{i.set("mounted",!0)})},measureHeight({scope:i,prop:o,context:s}){queueMicrotask(()=>{const a=getRootEl(i);if(!a)return;const _=a.style.height;a.style.height="auto";const $=a.getBoundingClientRect().height;a.style.height=_,s.set("initialHeight",$);const _e={id:o("id"),height:$};setHeight(o("parent"),_e)})},setCloseTimer({refs:i}){i.set("closeTimerStartTime",Date.now())},resetCloseTimer({context:i,refs:o,prop:s}){o.set("closeTimerStartTime",Date.now()),i.set("remainingTime",getToastDuration(s("duration"),s("type")))},syncRemainingTime({context:i,refs:o}){i.set("remainingTime",s=>{const a=o.get("closeTimerStartTime"),_=Date.now()-a;return o.set("lastCloseStartTimerStartTime",Date.now()),s-_})},notifyParentToRemove({prop:i}){i("parent").send({type:"TOAST.REMOVE",id:i("id")})},invokeOnDismiss({prop:i,event:o}){var s;(s=i("onStatusChange"))==null||s({status:"dismissing",src:o.src})},invokeOnUnmount({prop:i}){var o;(o=i("onStatusChange"))==null||o({status:"unmounted"})},invokeOnVisible({prop:i}){var o;(o=i("onStatusChange"))==null||o({status:"visible"})}}}};function setHeight(i,o){const{id:s,height:a}=o;i.context.set("heights",_=>_.find(_e=>_e.id===s)?_.map(_e=>_e.id===s?{..._e,height:a}:_e):[{id:s,height:a},..._])}var withDefaults=(i,o)=>({...o,...compact(i)});function createToastStore(i){const o=withDefaults(i,{placement:"bottom",overlap:!1,max:24,gap:16,offsets:"1rem",hotkey:["altKey","KeyT"],removeDelay:200,pauseOnPageIdle:!0});let s=[],a=[],_=new Set;const $=vt=>(s.push(vt),()=>{const wt=s.indexOf(vt);s.splice(wt,1)}),_e=vt=>(s.forEach(wt=>wt(vt)),vt),tt=vt=>{a.length>=o.max||(_e(vt),a.unshift(vt))},st=vt=>{const wt=vt.id??`toast:${uuid()}`,Ct=a.find(kt=>kt.id===wt);return _.has(wt)&&_.delete(wt),Ct?a=a.map(kt=>kt.id===wt?_e({...kt,...vt,id:wt}):kt):tt({id:wt,duration:o.duration,removeDelay:o.removeDelay,type:"info",...vt,stacked:!o.overlap,gap:o.gap}),wt},it=vt=>(_.add(vt),vt?(s.forEach(wt=>wt({id:vt,dismiss:!0})),a=a.filter(wt=>wt.id!==vt)):(a.forEach(wt=>{s.forEach(Ct=>Ct({id:wt.id,dismiss:!0}))}),a=[]),vt);return{attrs:o,subscribe:$,create:st,update:(vt,wt)=>st({id:vt,...wt}),remove:it,dismiss:vt=>{vt!=null?a=a.map(wt=>wt.id===vt?_e({...wt,message:"DISMISS"}):wt):a=a.map(wt=>_e({...wt,message:"DISMISS"}))},error:vt=>st({...vt,type:"error"}),success:vt=>st({...vt,type:"success"}),info:vt=>st({...vt,type:"info"}),warning:vt=>st({...vt,type:"warning"}),loading:vt=>st({...vt,type:"loading"}),getVisibleToasts:()=>a.filter(vt=>!_.has(vt.id)),getCount:()=>a.length,promise:(vt,wt,Ct={})=>{if(!wt)return;let kt;wt.loading!==void 0&&(kt=st({...Ct,...wt.loading,promise:vt,type:"loading"}));let It=kt!==void 0,Pt;const St=runIfFn(vt).then(async At=>{if(Pt=["resolve",At],isHttpResponse(At)&&!At.ok){It=!1;const Mt=runIfFn(wt.error,`HTTP Error! status: ${At.status}`);st({...Ct,...Mt,id:kt,type:"error"})}else if(wt.success!==void 0){It=!1;const Mt=runIfFn(wt.success,At);st({...Ct,...Mt,id:kt,type:"success"})}}).catch(async At=>{if(Pt=["reject",At],wt.error!==void 0){It=!1;const Mt=runIfFn(wt.error,At);st({...Ct,...Mt,id:kt,type:"error"})}}).finally(()=>{var At;It&&(it(kt),kt=void 0),(At=wt.finally)==null||At.call(wt)});return{id:kt,unwrap:()=>new Promise((At,Mt)=>St.then(()=>Pt[0]==="reject"?Mt(Pt[1]):At(Pt[1])).catch(Mt))}},pause:vt=>{vt!=null?a=a.map(wt=>wt.id===vt?_e({...wt,message:"PAUSE"}):wt):a=a.map(wt=>_e({...wt,message:"PAUSE"}))},resume:vt=>{vt!=null?a=a.map(wt=>wt.id===vt?_e({...wt,message:"RESUME"}):wt):a=a.map(wt=>_e({...wt,message:"RESUME"}))},isVisible:vt=>!_.has(vt)&&!!a.find(wt=>wt.id===vt),isDismissed:vt=>_.has(vt),expand:()=>{a=a.map(vt=>_e({...vt,stacked:!0}))},collapse:()=>{a=a.map(vt=>_e({...vt,stacked:!1}))}}}var isHttpResponse=i=>i&&typeof i=="object"&&"ok"in i&&typeof i.ok=="boolean"&&"status"in i&&typeof i.status=="number",group$2={connect:groupConnect,machine:groupMachine};const createToaster=i=>createToastStore(i),[ToastProvider,useToastContext]=createContext({name:"ToastContext",hookName:"useToastContext",providerName:""}),ToastActionTrigger$1=reactExports.forwardRef((i,o)=>{const s=useToastContext(),a=mergeProps(s.getActionTriggerProps(),i);return jsxRuntimeExports.jsx(ark.button,{...a,ref:o})});ToastActionTrigger$1.displayName="ToastActionTrigger";const ToastCloseTrigger$1=reactExports.forwardRef((i,o)=>{const s=useToastContext(),a=mergeProps(s.getCloseTriggerProps(),i);return jsxRuntimeExports.jsx(ark.button,{...a,ref:o})});ToastCloseTrigger$1.displayName="ToastCloseTrigger";const ToastDescription$1=reactExports.forwardRef((i,o)=>{const s=useToastContext(),a=mergeProps(s.getDescriptionProps(),i);return jsxRuntimeExports.jsx(ark.div,{...a,ref:o})});ToastDescription$1.displayName="ToastDescription";const ToastRoot$1=reactExports.forwardRef((i,o)=>{const s=useToastContext(),a=mergeProps(s.getRootProps(),i);return jsxRuntimeExports.jsxs("div",{...a,ref:o,children:[jsxRuntimeExports.jsx("div",{...s.getGhostBeforeProps()}),i.children,jsxRuntimeExports.jsx("div",{...s.getGhostAfterProps()})]})});ToastRoot$1.displayName="ToastRoot";const ToastTitle$1=reactExports.forwardRef((i,o)=>{const s=useToastContext(),a=mergeProps(s.getTitleProps(),i);return jsxRuntimeExports.jsx(ark.div,{...a,ref:o})});ToastTitle$1.displayName="ToastTitle";const Toaster$2=reactExports.forwardRef((i,o)=>{const{toaster:s,children:a,..._}=i,$=useLocaleContext(),_e=useEnvironmentContext(),tt=useMachine(group$2.machine,{store:s,id:reactExports.useId(),dir:$==null?void 0:$.dir,getRootNode:_e==null?void 0:_e.getRootNode}),st=group$2.connect(tt,normalizeProps),it=mergeProps(st.getGroupProps(),_);return jsxRuntimeExports.jsx(ark.div,{...it,ref:o,children:st.getToasts().map((nt,et)=>jsxRuntimeExports.jsx(ToastActor,{value:nt,parent:tt,index:et,children:j=>a(j)},nt.id))})});Toaster$2.displayName="Toaster";const ToastActor=i=>{const o={...i.value,parent:i.parent,index:i.index},s=useMachine(machine$1,{...o}),a=connect$1(s,normalizeProps);return jsxRuntimeExports.jsx(ToastProvider,{value:a,children:i.children(i.value)})};ToastActor.displayName="ToastActor";const[TooltipProvider,useTooltipContext]=createContext({name:"TooltipContext",hookName:"useTooltipContext",providerName:""}),TooltipArrow$1=reactExports.forwardRef((i,o)=>{const s=useTooltipContext(),a=mergeProps(s.getArrowProps(),i);return jsxRuntimeExports.jsx(ark.div,{...a,ref:o})});TooltipArrow$1.displayName="TooltipArrow";const TooltipArrowTip$1=reactExports.forwardRef((i,o)=>{const s=useTooltipContext(),a=mergeProps(s.getArrowTipProps(),i);return jsxRuntimeExports.jsx(ark.div,{...a,ref:o})});TooltipArrowTip$1.displayName="TooltipArrowTip";const TooltipContent$1=reactExports.forwardRef((i,o)=>{const s=useTooltipContext(),a=usePresenceContext(),_=mergeProps(s.getContentProps(),a.getPresenceProps(),i);return a.unmounted?null:jsxRuntimeExports.jsx(ark.div,{..._,ref:composeRefs(a.ref,o)})});TooltipContent$1.displayName="TooltipContent";const TooltipPositioner$1=reactExports.forwardRef((i,o)=>{const s=useTooltipContext(),a=mergeProps(s.getPositionerProps(),i);return usePresenceContext().unmounted?null:jsxRuntimeExports.jsx(ark.div,{...a,ref:o})});TooltipPositioner$1.displayName="TooltipPositioner";const GET_ORIGINAL_SYMBOL=Symbol(),getProto=Object.getPrototypeOf,objectsToTrack=new WeakMap,isObjectToTrack=i=>i&&(objectsToTrack.has(i)?objectsToTrack.get(i):getProto(i)===Object.prototype||getProto(i)===Array.prototype),getUntracked=i=>isObjectToTrack(i)&&i[GET_ORIGINAL_SYMBOL]||null,markToTrack=(i,o=!0)=>{objectsToTrack.set(i,o)};function glob(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global}function globalRef(i,o){const s=glob();return s?(s[i]||(s[i]=o()),s[i]):o()}var refSet=globalRef("__zag__refSet",()=>new WeakSet),isReactElement=i=>typeof i=="object"&&i!==null&&"$$typeof"in i&&"props"in i,isVueElement=i=>typeof i=="object"&&i!==null&&"__v_isVNode"in i,isDOMElement=i=>typeof i=="object"&&i!==null&&"nodeType"in i&&typeof i.nodeName=="string",isElement=i=>isReactElement(i)||isVueElement(i)||isDOMElement(i),isObject$1=i=>i!==null&&typeof i=="object",canProxy=i=>isObject$1(i)&&!refSet.has(i)&&(Array.isArray(i)||!(Symbol.iterator in i))&&!isElement(i)&&!(i instanceof WeakMap)&&!(i instanceof WeakSet)&&!(i instanceof Error)&&!(i instanceof Number)&&!(i instanceof Date)&&!(i instanceof String)&&!(i instanceof RegExp)&&!(i instanceof ArrayBuffer)&&!(i instanceof Promise),proxyStateMap=globalRef("__zag__proxyStateMap",()=>new WeakMap),buildProxyFunction=(i=Object.is,o=(tt,st)=>new Proxy(tt,st),s=new WeakMap,a=(tt,st)=>{const it=s.get(tt);if((it==null?void 0:it[0])===st)return it[1];const nt=Array.isArray(tt)?[]:Object.create(Object.getPrototypeOf(tt));return markToTrack(nt,!0),s.set(tt,[st,nt]),Reflect.ownKeys(tt).forEach(et=>{const j=Reflect.get(tt,et);refSet.has(j)?(markToTrack(j,!1),nt[et]=j):proxyStateMap.has(j)?nt[et]=snapshot(j):nt[et]=j}),Object.freeze(nt)},_=new WeakMap,$=[1,1],_e=tt=>{if(!isObject$1(tt))throw new Error("object required");const st=_.get(tt);if(st)return st;let it=$[0];const nt=new Set,et=(yt,mt=++$[0])=>{it!==mt&&(it=mt,nt.forEach(gt=>gt(yt,mt)))};let j=$[1];const rt=(yt=++$[1])=>(j!==yt&&!nt.size&&(j=yt,at.forEach(([mt])=>{const gt=mt[1](yt);gt>it&&(it=gt)})),it),ot=yt=>(mt,gt)=>{const vt=[...mt];vt[1]=[yt,...vt[1]],et(vt,gt)},at=new Map,lt=(yt,mt)=>{if(nt.size){const gt=mt[3](ot(yt));at.set(yt,[mt,gt])}else at.set(yt,[mt])},ut=yt=>{var gt;const mt=at.get(yt);mt&&(at.delete(yt),(gt=mt[1])==null||gt.call(mt))},ct=yt=>(nt.add(yt),nt.size===1&&at.forEach(([gt,vt],wt)=>{const Ct=gt[3](ot(wt));at.set(wt,[gt,Ct])}),()=>{nt.delete(yt),nt.size===0&&at.forEach(([gt,vt],wt)=>{vt&&(vt(),at.set(wt,[gt]))})}),dt=Array.isArray(tt)?[]:Object.create(Object.getPrototypeOf(tt)),ht=o(dt,{deleteProperty(yt,mt){const gt=Reflect.get(yt,mt);ut(mt);const vt=Reflect.deleteProperty(yt,mt);return vt&&et(["delete",[mt],gt]),vt},set(yt,mt,gt,vt){var It;const wt=Reflect.has(yt,mt),Ct=Reflect.get(yt,mt,vt);if(wt&&(i(Ct,gt)||_.has(gt)&&i(Ct,_.get(gt))))return!0;ut(mt),isObject$1(gt)&&(gt=getUntracked(gt)||gt);let kt=gt;if(!((It=Object.getOwnPropertyDescriptor(yt,mt))!=null&&It.set)){!proxyStateMap.has(gt)&&canProxy(gt)&&(kt=proxy(gt));const Pt=!refSet.has(kt)&&proxyStateMap.get(kt);Pt&<(mt,Pt)}return Reflect.set(yt,mt,kt,vt),et(["set",[mt],gt,Ct]),!0}});_.set(tt,ht);const bt=[dt,rt,a,ct];return proxyStateMap.set(ht,bt),Reflect.ownKeys(tt).forEach(yt=>{const mt=Object.getOwnPropertyDescriptor(tt,yt);mt.get||mt.set?Object.defineProperty(dt,yt,mt):ht[yt]=tt[yt]}),ht})=>[_e,proxyStateMap,refSet,i,o,canProxy,s,a,_,$],[proxyFunction]=buildProxyFunction();function proxy(i={}){return proxyFunction(i)}function subscribe(i,o,s){const a=proxyStateMap.get(i);let _;const $=[],_e=a[3];let tt=!1;const it=_e(nt=>{$.push(nt),_||(_=Promise.resolve().then(()=>{_=void 0,tt&&o($.splice(0))}))});return tt=!0,()=>{tt=!1,it()}}function snapshot(i){const o=proxyStateMap.get(i),[s,a,_]=o;return _(s,a())}var anatomy=createAnatomy("tooltip").parts("trigger","arrow","arrowTip","positioner","content"),parts=anatomy.build(),getTriggerId=i=>{var o;return((o=i.ids)==null?void 0:o.trigger)??`tooltip:${i.id}:trigger`},getContentId=i=>{var o;return((o=i.ids)==null?void 0:o.content)??`tooltip:${i.id}:content`},getArrowId=i=>{var o;return((o=i.ids)==null?void 0:o.arrow)??`tooltip:${i.id}:arrow`},getPositionerId=i=>{var o;return((o=i.ids)==null?void 0:o.positioner)??`tooltip:${i.id}:popper`},getTriggerEl=i=>i.getById(getTriggerId(i)),getPositionerEl=i=>i.getById(getPositionerId(i)),store=proxy({id:null});function connect(i,o){const{state:s,context:a,send:_,scope:$,prop:_e,event:tt}=i,st=_e("id"),it=!!_e("aria-label"),nt=s.matches("open","closing"),et=getTriggerId($),j=getContentId($),rt=_e("disabled"),ot=getPlacementStyles({..._e("positioning"),placement:a.get("currentPlacement")});return{open:nt,setOpen(at){s.matches("open","closing")!==at&&_({type:at?"open":"close"})},reposition(at={}){_({type:"positioning.set",options:at})},getTriggerProps(){return o.button({...parts.trigger.attrs,id:et,dir:_e("dir"),"data-expanded":dataAttr$1(nt),"data-state":nt?"open":"closed","aria-describedby":nt?j:void 0,onClick(at){at.defaultPrevented||rt||_e("closeOnClick")&&_({type:"close",src:"trigger.click"})},onFocus(at){queueMicrotask(()=>{at.defaultPrevented||rt||tt.src!=="trigger.pointerdown"&&isFocusVisible()&&_({type:"open",src:"trigger.focus"})})},onBlur(at){at.defaultPrevented||rt||st===store.id&&_({type:"close",src:"trigger.blur"})},onPointerDown(at){at.defaultPrevented||rt||_e("closeOnPointerDown")&&st===store.id&&_({type:"close",src:"trigger.pointerdown"})},onPointerMove(at){at.defaultPrevented||rt||at.pointerType!=="touch"&&_({type:"pointer.move"})},onPointerLeave(){rt||_({type:"pointer.leave"})},onPointerCancel(){rt||_({type:"pointer.leave"})}})},getArrowProps(){return o.element({id:getArrowId($),...parts.arrow.attrs,dir:_e("dir"),style:ot.arrow})},getArrowTipProps(){return o.element({...parts.arrowTip.attrs,dir:_e("dir"),style:ot.arrowTip})},getPositionerProps(){return o.element({id:getPositionerId($),...parts.positioner.attrs,dir:_e("dir"),style:ot.floating})},getContentProps(){return o.element({...parts.content.attrs,dir:_e("dir"),hidden:!nt,"data-state":nt?"open":"closed",role:it?void 0:"tooltip",id:it?void 0:j,"data-placement":a.get("currentPlacement"),onPointerEnter(){_({type:"content.pointer.move"})},onPointerLeave(){_({type:"content.pointer.leave"})},style:{pointerEvents:_e("interactive")?"auto":"none"}})}}}var{and,not}=createGuards(),machine={initialState:({prop:i})=>i("open")||i("defaultOpen")?"open":"closed",props({props:i}){return{id:"x",openDelay:1e3,closeDelay:500,closeOnPointerDown:!0,closeOnEscape:!0,interactive:!1,closeOnScroll:!0,closeOnClick:!0,disabled:!1,...i,positioning:{placement:"bottom",...i.positioning}}},effects:["trackFocusVisible","trackStore"],context:({bindable:i})=>({currentPlacement:i(()=>({defaultValue:void 0})),hasPointerMoveOpened:i(()=>({defaultValue:!1}))}),watch({track:i,action:o,prop:s}){i([()=>s("disabled")],()=>{o(["closeIfDisabled"])}),i([()=>s("open")],()=>{o(["toggleVisibility"])})},states:{closed:{entry:["clearGlobalId"],on:{"controlled.open":{target:"open"},open:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen"]}],"pointer.leave":{actions:["clearPointerMoveOpened"]},"pointer.move":[{guard:and("noVisibleTooltip",not("hasPointerMoveOpened")),target:"opening"},{guard:not("hasPointerMoveOpened"),target:"open",actions:["setPointerMoveOpened","invokeOnOpen"]}]}},opening:{effects:["trackScroll","trackPointerlockChange","waitForOpenDelay"],on:{"after.openDelay":[{guard:"isOpenControlled",actions:["setPointerMoveOpened","invokeOnOpen"]},{target:"open",actions:["setPointerMoveOpened","invokeOnOpen"]}],"controlled.open":{target:"open"},"controlled.close":{target:"closed"},open:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen"]}],"pointer.leave":[{guard:"isOpenControlled",actions:["clearPointerMoveOpened","invokeOnClose","toggleVisibility"]},{target:"closed",actions:["clearPointerMoveOpened","invokeOnClose"]}],close:[{guard:"isOpenControlled",actions:["invokeOnClose","toggleVisibility"]},{target:"closed",actions:["invokeOnClose"]}]}},open:{effects:["trackEscapeKey","trackScroll","trackPointerlockChange","trackPositioning"],entry:["setGlobalId"],on:{"controlled.close":{target:"closed"},close:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}],"pointer.leave":[{guard:"isVisible",target:"closing",actions:["clearPointerMoveOpened"]},{guard:"isOpenControlled",actions:["clearPointerMoveOpened","invokeOnClose"]},{target:"closed",actions:["clearPointerMoveOpened","invokeOnClose"]}],"content.pointer.leave":{guard:"isInteractive",target:"closing"},"positioning.set":{actions:["reposition"]}}},closing:{effects:["trackPositioning","waitForCloseDelay"],on:{"after.closeDelay":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}],"controlled.close":{target:"closed"},"controlled.open":{target:"open"},close:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose"]}],"pointer.move":[{guard:"isOpenControlled",actions:["setPointerMoveOpened","invokeOnOpen","toggleVisibility"]},{target:"open",actions:["setPointerMoveOpened","invokeOnOpen"]}],"content.pointer.move":{guard:"isInteractive",target:"open"},"positioning.set":{actions:["reposition"]}}}},implementations:{guards:{noVisibleTooltip:()=>store.id===null,isVisible:({prop:i})=>i("id")===store.id,isInteractive:({prop:i})=>!!i("interactive"),hasPointerMoveOpened:({context:i})=>i.get("hasPointerMoveOpened"),isOpenControlled:({prop:i})=>i("open")!==void 0},actions:{setGlobalId:({prop:i})=>{store.id=i("id")},clearGlobalId:({prop:i})=>{i("id")===store.id&&(store.id=null)},invokeOnOpen:({prop:i})=>{var o;(o=i("onOpenChange"))==null||o({open:!0})},invokeOnClose:({prop:i})=>{var o;(o=i("onOpenChange"))==null||o({open:!1})},closeIfDisabled:({prop:i,send:o})=>{i("disabled")&&o({type:"close",src:"disabled.change"})},reposition:({context:i,event:o,prop:s,scope:a})=>{if(o.type!=="positioning.set")return;const _=()=>getPositionerEl(a);return getPlacement(getTriggerEl(a),_,{...s("positioning"),...o.options,defer:!0,listeners:!1,onComplete($){i.set("currentPlacement",$.placement)}})},toggleVisibility:({prop:i,event:o,send:s})=>{queueMicrotask(()=>{s({type:i("open")?"controlled.open":"controlled.close",previousEvent:o})})},setPointerMoveOpened:({context:i})=>{i.set("hasPointerMoveOpened",!0)},clearPointerMoveOpened:({context:i})=>{i.set("hasPointerMoveOpened",!1)}},effects:{trackFocusVisible:({scope:i})=>{var o;return trackFocusVisible({root:(o=i.getRootNode)==null?void 0:o.call(i)})},trackPositioning:({context:i,prop:o,scope:s})=>{i.get("currentPlacement")||i.set("currentPlacement",o("positioning").placement);const a=()=>getPositionerEl(s);return getPlacement(getTriggerEl(s),a,{...o("positioning"),defer:!0,onComplete(_){i.set("currentPlacement",_.placement)}})},trackPointerlockChange:({send:i,scope:o})=>{const s=o.getDoc();return addDomEvent(s,"pointerlockchange",()=>i({type:"close",src:"pointerlock:change"}),!1)},trackScroll:({send:i,prop:o,scope:s})=>{if(!o("closeOnScroll"))return;const a=getTriggerEl(s);if(!a)return;const $=getOverflowAncestors$1(a).map(_e=>addDomEvent(_e,"scroll",()=>{i({type:"close",src:"scroll"})},{passive:!0,capture:!0}));return()=>{$.forEach(_e=>_e==null?void 0:_e())}},trackStore:({prop:i,send:o})=>{let s;return queueMicrotask(()=>{s=subscribe(store,()=>{store.id!==i("id")&&o({type:"close",src:"id.change"})})}),()=>s==null?void 0:s()},trackEscapeKey:({send:i,prop:o})=>o("closeOnEscape")?addDomEvent(document,"keydown",a=>{isComposingEvent(a)||a.key==="Escape"&&(a.stopPropagation(),i({type:"close",src:"keydown.escape"}))},!0):void 0,waitForOpenDelay:({send:i,prop:o})=>{const s=setTimeout(()=>{i({type:"after.openDelay"})},o("openDelay"));return()=>clearTimeout(s)},waitForCloseDelay:({send:i,prop:o})=>{const s=setTimeout(()=>{i({type:"after.closeDelay"})},o("closeDelay"));return()=>clearTimeout(s)}}}};createProps$1()(["aria-label","closeDelay","closeOnEscape","closeOnPointerDown","closeOnScroll","closeOnClick","dir","disabled","getRootNode","id","ids","interactive","onOpenChange","defaultOpen","open","openDelay","positioning"]);const useTooltip=i=>{const o=reactExports.useId(),{getRootNode:s}=useEnvironmentContext(),{dir:a}=useLocaleContext(),_={id:o,dir:a,getRootNode:s,...i},$=useMachine(machine,_);return connect($,normalizeProps)},TooltipRoot$1=i=>{const[o,{children:s,...a}]=splitPresenceProps(i),_=useTooltip(a),$=usePresence(mergeProps({present:_.open},o));return jsxRuntimeExports.jsx(TooltipProvider,{value:_,children:jsxRuntimeExports.jsx(PresenceProvider,{value:$,children:s})})},TooltipRootProvider=i=>{const[o,{value:s,children:a}]=splitPresenceProps(i),_=usePresence(mergeProps({present:s.open},o));return jsxRuntimeExports.jsx(TooltipProvider,{value:s,children:jsxRuntimeExports.jsx(PresenceProvider,{value:_,children:a})})},TooltipTrigger$1=reactExports.forwardRef((i,o)=>{const s=useTooltipContext(),a=mergeProps(s.getTriggerProps(),i);return jsxRuntimeExports.jsx(ark.button,{...a,ref:o})});TooltipTrigger$1.displayName="TooltipTrigger";function omit(i,o=[]){const s=Object.assign({},i);for(const a of o)a in s&&delete s[a];return s}const colorMix=(i,o)=>{var st;if(!i||typeof i!="string")return{invalid:!0,value:i};const[s,a]=i.split("/");if(!s||!a||s==="currentBg")return{invalid:!0,value:s};const _=o(`colors.${s}`),$=(st=o.raw(`opacity.${a}`))==null?void 0:st.value;if(!$&&isNaN(Number(a)))return{invalid:!0,value:s};const _e=$?Number($)*100+"%":`${a}%`,tt=_??s;return{invalid:!1,color:tt,value:`color-mix(in srgb, ${tt} ${_e}, transparent)`}},createColorMixTransform=i=>(o,s)=>{const a=s.utils.colorMix(o);if(a.invalid)return{[i]:o};const _="--mix-"+i;return{[_]:a.value,[i]:`var(${_}, ${a.color})`}};function clone(i){if(i===null||typeof i!="object")return i;if(Array.isArray(i))return i.map(s=>clone(s));const o=Object.create(Object.getPrototypeOf(i));for(const s of Object.keys(i))o[s]=clone(i[s]);return o}function merge(i,o){if(o==null)return i;for(const s of Object.keys(o))if(!(o[s]===void 0||s==="__proto__"))if(!isObject$4(i[s])&&isObject$4(o[s]))Object.assign(i,{[s]:o[s]});else if(i[s]&&isObject$4(o[s]))merge(i[s],o[s]);else if(Array.isArray(o[s])&&Array.isArray(i[s])){let a=0;for(;ai,defineRecipe=i=>i,defineSlotRecipe=i=>i,defineKeyframes=i=>i,defineGlobalStyles=i=>i,defineStyle=i=>i,defineTextStyles=i=>i,defineAnimationStyles=i=>i,defineLayerStyles=i=>i;function createProxy(){const i=o=>o;return new Proxy(i,{get(){return i}})}const defineTokens=createProxy(),defineSemanticTokens=createProxy(),defineConfig=i=>i,mergeConfigs=(...i)=>mergeWith({},...i.map(clone)),escRegex=/[^a-zA-Z0-9_\u0081-\uffff-]/g;function esc$1(i){return`${i}`.replace(escRegex,o=>`\\${o}`)}const dashCaseRegex=/[A-Z]/g;function dashCase(i){return i.replace(dashCaseRegex,o=>`-${o.toLowerCase()}`)}function cssVar(i,o={}){const{fallback:s="",prefix:a=""}=o,_=dashCase(["-",a,esc$1(i)].filter(Boolean).join("-"));return{var:_,ref:`var(${_}${s?`, ${s}`:""})`}}const isCssVar=i=>/^var\(--.+\)$/.test(i),wrap=(i,o)=>o!=null?`${i}(${o})`:o,deg=i=>{if(isCssVar(i)||i==null)return i;const o=typeof i=="string"&&!i.endsWith("deg");return typeof i=="number"||o?`${i}deg`:i},createFocusRing=i=>({values:["outside","inside","mixed","none"],transform(o,{token:s}){const a=s("colors.colorPalette.focusRing");return{inside:{"--focus-ring-color":a,[i]:{outlineOffset:"0px",outlineWidth:"var(--focus-ring-width, 1px)",outlineColor:"var(--focus-ring-color)",outlineStyle:"var(--focus-ring-style, solid)",borderColor:"var(--focus-ring-color)"}},outside:{"--focus-ring-color":a,[i]:{outlineWidth:"var(--focus-ring-width, 2px)",outlineOffset:"var(--focus-ring-offset, 2px)",outlineStyle:"var(--focus-ring-style, solid)",outlineColor:"var(--focus-ring-color)"}},mixed:{"--focus-ring-color":a,[i]:{outlineWidth:"var(--focus-ring-width, 3px)",outlineStyle:"var(--focus-ring-style, solid)",outlineColor:"color-mix(in srgb, var(--focus-ring-color), transparent 60%)",borderColor:"var(--focus-ring-color)"}},none:{"--focus-ring-color":a,[i]:{outline:"none"}}}[o]??{}}}),divideColor=createColorMixTransform("borderColor"),createTransition=i=>({transition:i,transitionTimingFunction:"cubic-bezier(0.4, 0, 0.2, 1)",transitionDuration:"150ms"}),defaultConditions=defineConditions({hover:["@media (hover: hover)","&:is(:hover, [data-hover]):not(:disabled, [data-disabled])"],active:"&:is(:active, [data-active]):not(:disabled, [data-disabled], [data-state=open])",focus:"&:is(:focus, [data-focus])",focusWithin:"&:is(:focus-within, [data-focus-within])",focusVisible:"&:is(:focus-visible, [data-focus-visible])",disabled:"&:is(:disabled, [disabled], [data-disabled], [aria-disabled=true])",visited:"&:visited",target:"&:target",readOnly:"&:is([data-readonly], [aria-readonly=true], [readonly])",readWrite:"&:read-write",empty:"&:is(:empty, [data-empty])",checked:"&:is(:checked, [data-checked], [aria-checked=true], [data-state=checked])",enabled:"&:enabled",expanded:"&:is([aria-expanded=true], [data-expanded], [data-state=expanded])",highlighted:"&[data-highlighted]",complete:"&[data-complete]",incomplete:"&[data-incomplete]",dragging:"&[data-dragging]",before:"&::before",after:"&::after",firstLetter:"&::first-letter",firstLine:"&::first-line",marker:"&::marker",selection:"&::selection",file:"&::file-selector-button",backdrop:"&::backdrop",first:"&:first-of-type",last:"&:last-of-type",notFirst:"&:not(:first-of-type)",notLast:"&:not(:last-of-type)",only:"&:only-child",even:"&:nth-of-type(even)",odd:"&:nth-of-type(odd)",peerFocus:".peer:is(:focus, [data-focus]) ~ &",peerHover:".peer:is(:hover, [data-hover]):not(:disabled, [data-disabled]) ~ &",peerActive:".peer:is(:active, [data-active]):not(:disabled, [data-disabled]) ~ &",peerFocusWithin:".peer:focus-within ~ &",peerFocusVisible:".peer:is(:focus-visible, [data-focus-visible]) ~ &",peerDisabled:".peer:is(:disabled, [disabled], [data-disabled]) ~ &",peerChecked:".peer:is(:checked, [data-checked], [aria-checked=true], [data-state=checked]) ~ &",peerInvalid:".peer:is(:invalid, [data-invalid], [aria-invalid=true]) ~ &",peerExpanded:".peer:is([aria-expanded=true], [data-expanded], [data-state=expanded]) ~ &",peerPlaceholderShown:".peer:placeholder-shown ~ &",groupFocus:".group:is(:focus, [data-focus]) &",groupHover:".group:is(:hover, [data-hover]):not(:disabled, [data-disabled]) &",groupActive:".group:is(:active, [data-active]):not(:disabled, [data-disabled]) &",groupFocusWithin:".group:focus-within &",groupFocusVisible:".group:is(:focus-visible, [data-focus-visible]) &",groupDisabled:".group:is(:disabled, [disabled], [data-disabled]) &",groupChecked:".group:is(:checked, [data-checked], [aria-checked=true], [data-state=checked]) &",groupExpanded:".group:is([aria-expanded=true], [data-expanded], [data-state=expanded]) &",groupInvalid:".group:invalid &",indeterminate:"&:is(:indeterminate, [data-indeterminate], [aria-checked=mixed], [data-state=indeterminate])",required:"&:is([data-required], [aria-required=true])",valid:"&:is([data-valid], [data-state=valid])",invalid:"&:is([data-invalid], [aria-invalid=true], [data-state=invalid])",autofill:"&:autofill",inRange:"&:is(:in-range, [data-in-range])",outOfRange:"&:is(:out-of-range, [data-outside-range])",placeholder:"&::placeholder, &[data-placeholder]",placeholderShown:"&:is(:placeholder-shown, [data-placeholder-shown])",pressed:"&:is([aria-pressed=true], [data-pressed])",selected:"&:is([aria-selected=true], [data-selected])",grabbed:"&:is([aria-grabbed=true], [data-grabbed])",underValue:"&[data-state=under-value]",overValue:"&[data-state=over-value]",atValue:"&[data-state=at-value]",default:"&:default",optional:"&:optional",open:"&:is([open], [data-open], [data-state=open])",closed:"&:is([closed], [data-closed], [data-state=closed])",fullscreen:"&is(:fullscreen, [data-fullscreen])",loading:"&:is([data-loading], [aria-busy=true])",hidden:"&:is([hidden], [data-hidden])",current:"&[data-current]",currentPage:"&[aria-current=page]",currentStep:"&[aria-current=step]",today:"&[data-today]",unavailable:"&[data-unavailable]",rangeStart:"&[data-range-start]",rangeEnd:"&[data-range-end]",now:"&[data-now]",topmost:"&[data-topmost]",motionReduce:"@media (prefers-reduced-motion: reduce)",motionSafe:"@media (prefers-reduced-motion: no-preference)",print:"@media print",landscape:"@media (orientation: landscape)",portrait:"@media (orientation: portrait)",dark:".dark &, .dark .chakra-theme:not(.light) &",light:":root &, .light &",osDark:"@media (prefers-color-scheme: dark)",osLight:"@media (prefers-color-scheme: light)",highContrast:"@media (forced-colors: active)",lessContrast:"@media (prefers-contrast: less)",moreContrast:"@media (prefers-contrast: more)",ltr:"[dir=ltr] &",rtl:"[dir=rtl] &",scrollbar:"&::-webkit-scrollbar",scrollbarThumb:"&::-webkit-scrollbar-thumb",scrollbarTrack:"&::-webkit-scrollbar-track",horizontal:"&[data-orientation=horizontal]",vertical:"&[data-orientation=vertical]",icon:"& :where(svg)",starting:"@starting-style"}),currentBgVar=cssVar("bg-currentcolor"),isCurrentBgVar=i=>i===currentBgVar.ref||i==="currentBg",colorValues=i=>({...i("colors"),currentBg:currentBgVar}),defaultBaseConfig=defineConfig({conditions:defaultConditions,utilities:{background:{values:colorValues,shorthand:["bg"],transform(i,o){if(isCurrentBgVar(o.raw))return{background:currentBgVar.ref};const s=createColorMixTransform("background")(i,o);return{...s,[currentBgVar.var]:s==null?void 0:s.background}}},backgroundColor:{values:colorValues,shorthand:["bgColor"],transform(i,o){if(isCurrentBgVar(o.raw))return{backgroundColor:currentBgVar.ref};const s=createColorMixTransform("backgroundColor")(i,o);return{...s,[currentBgVar.var]:s==null?void 0:s.backgroundColor}}},backgroundSize:{shorthand:["bgSize"]},backgroundPosition:{shorthand:["bgPos"]},backgroundRepeat:{shorthand:["bgRepeat"]},backgroundAttachment:{shorthand:["bgAttachment"]},backgroundClip:{shorthand:["bgClip"],values:["text"],transform(i){return i==="text"?{color:"transparent",backgroundClip:"text"}:{backgroundClip:i}}},backgroundGradient:{shorthand:["bgGradient"],values(i){return{...i("gradients"),"to-t":"linear-gradient(to top, var(--gradient))","to-tr":"linear-gradient(to top right, var(--gradient))","to-r":"linear-gradient(to right, var(--gradient))","to-br":"linear-gradient(to bottom right, var(--gradient))","to-b":"linear-gradient(to bottom, var(--gradient))","to-bl":"linear-gradient(to bottom left, var(--gradient))","to-l":"linear-gradient(to left, var(--gradient))","to-tl":"linear-gradient(to top left, var(--gradient))"}},transform(i){return{"--gradient-stops":"var(--gradient-from), var(--gradient-to)","--gradient":"var(--gradient-via-stops, var(--gradient-stops))",backgroundImage:i}}},gradientFrom:{values:colorValues,transform:createColorMixTransform("--gradient-from")},gradientTo:{values:colorValues,transform:createColorMixTransform("--gradient-to")},gradientVia:{values:colorValues,transform(i,o){return{...createColorMixTransform("--gradient-via")(i,o),"--gradient-via-stops":"var(--gradient-from), var(--gradient-via), var(--gradient-to)"}}},backgroundImage:{values(i){return{...i("gradients"),...i("assets")}},shorthand:["bgImg","bgImage"]},border:{values:"borders"},borderTop:{values:"borders"},borderLeft:{values:"borders"},borderBlockStart:{values:"borders"},borderRight:{values:"borders"},borderBottom:{values:"borders"},borderBlockEnd:{values:"borders"},borderInlineStart:{values:"borders",shorthand:["borderStart"]},borderInlineEnd:{values:"borders",shorthand:["borderEnd"]},borderInline:{values:"borders",shorthand:["borderX"]},borderBlock:{values:"borders",shorthand:["borderY"]},borderColor:{values:colorValues,transform:createColorMixTransform("borderColor")},borderTopColor:{values:colorValues,transform:createColorMixTransform("borderTopColor")},borderBlockStartColor:{values:colorValues,transform:createColorMixTransform("borderBlockStartColor")},borderBottomColor:{values:colorValues,transform:createColorMixTransform("borderBottomColor")},borderBlockEndColor:{values:colorValues,transform:createColorMixTransform("borderBlockEndColor")},borderLeftColor:{values:colorValues,transform:createColorMixTransform("borderLeftColor")},borderInlineStartColor:{values:colorValues,shorthand:["borderStartColor"],transform:createColorMixTransform("borderInlineStartColor")},borderRightColor:{values:colorValues,transform:createColorMixTransform("borderRightColor")},borderInlineEndColor:{values:colorValues,shorthand:["borderEndColor"],transform:createColorMixTransform("borderInlineEndColor")},borderStyle:{values:"borderStyles"},borderTopStyle:{values:"borderStyles"},borderBlockStartStyle:{values:"borderStyles"},borderBottomStyle:{values:"borderStyles"},borderBlockEndStyle:{values:"borderStyles"},borderInlineStartStyle:{values:"borderStyles",shorthand:["borderStartStyle"]},borderInlineEndStyle:{values:"borderStyles",shorthand:["borderEndStyle"]},borderLeftStyle:{values:"borderStyles"},borderRightStyle:{values:"borderStyles"},borderRadius:{values:"radii",shorthand:["rounded"]},borderTopLeftRadius:{values:"radii",shorthand:["roundedTopLeft"]},borderStartStartRadius:{values:"radii",shorthand:["roundedStartStart","borderTopStartRadius"]},borderEndStartRadius:{values:"radii",shorthand:["roundedEndStart","borderBottomStartRadius"]},borderTopRightRadius:{values:"radii",shorthand:["roundedTopRight"]},borderStartEndRadius:{values:"radii",shorthand:["roundedStartEnd","borderTopEndRadius"]},borderEndEndRadius:{values:"radii",shorthand:["roundedEndEnd","borderBottomEndRadius"]},borderBottomLeftRadius:{values:"radii",shorthand:["roundedBottomLeft"]},borderBottomRightRadius:{values:"radii",shorthand:["roundedBottomRight"]},borderInlineStartRadius:{values:"radii",property:"borderRadius",shorthand:["roundedStart","borderStartRadius"],transform:i=>({borderStartStartRadius:i,borderEndStartRadius:i})},borderInlineEndRadius:{values:"radii",property:"borderRadius",shorthand:["roundedEnd","borderEndRadius"],transform:i=>({borderStartEndRadius:i,borderEndEndRadius:i})},borderTopRadius:{values:"radii",property:"borderRadius",shorthand:["roundedTop"],transform:i=>({borderTopLeftRadius:i,borderTopRightRadius:i})},borderBottomRadius:{values:"radii",property:"borderRadius",shorthand:["roundedBottom"],transform:i=>({borderBottomLeftRadius:i,borderBottomRightRadius:i})},borderLeftRadius:{values:"radii",property:"borderRadius",shorthand:["roundedLeft"],transform:i=>({borderTopLeftRadius:i,borderBottomLeftRadius:i})},borderRightRadius:{values:"radii",property:"borderRadius",shorthand:["roundedRight"],transform:i=>({borderTopRightRadius:i,borderBottomRightRadius:i})},borderWidth:{values:"borderWidths"},borderBlockStartWidth:{values:"borderWidths"},borderTopWidth:{values:"borderWidths"},borderBottomWidth:{values:"borderWidths"},borderBlockEndWidth:{values:"borderWidths"},borderRightWidth:{values:"borderWidths"},borderInlineWidth:{values:"borderWidths",shorthand:["borderXWidth"]},borderInlineStartWidth:{values:"borderWidths",shorthand:["borderStartWidth"]},borderInlineEndWidth:{values:"borderWidths",shorthand:["borderEndWidth"]},borderLeftWidth:{values:"borderWidths"},borderBlockWidth:{values:"borderWidths",shorthand:["borderYWidth"]},color:{values:colorValues,transform:createColorMixTransform("color")},fill:{values:colorValues,transform:createColorMixTransform("fill")},stroke:{values:colorValues,transform:createColorMixTransform("stroke")},accentColor:{values:colorValues,transform:createColorMixTransform("accentColor")},divideX:{values:{type:"string"},transform(i){return{"& > :not(style, [hidden]) ~ :not(style, [hidden])":{borderInlineStartWidth:i,borderInlineEndWidth:"0px"}}}},divideY:{values:{type:"string"},transform(i){return{"& > :not(style, [hidden]) ~ :not(style, [hidden])":{borderTopWidth:i,borderBottomWidth:"0px"}}}},divideColor:{values:colorValues,transform(i,o){return{"& > :not(style, [hidden]) ~ :not(style, [hidden])":divideColor(i,o)}}},divideStyle:{property:"borderStyle",transform(i){return{"& > :not(style, [hidden]) ~ :not(style, [hidden])":{borderStyle:i}}}},boxShadow:{values:"shadows",shorthand:["shadow"]},boxShadowColor:{values:colorValues,transform:createColorMixTransform("--shadow-color"),shorthand:["shadowColor"]},mixBlendMode:{shorthand:["blendMode"]},backgroundBlendMode:{shorthand:["bgBlendMode"]},opacity:{values:"opacity"},filter:{transform(i){return i!=="auto"?{filter:i}:{filter:"var(--blur) var(--brightness) var(--contrast) var(--grayscale) var(--hue-rotate) var(--invert) var(--saturate) var(--sepia) var(--drop-shadow)"}}},blur:{values:"blurs",transform:i=>({"--blur":wrap("blur",i)})},brightness:{transform:i=>({"--brightness":wrap("brightness",i)})},contrast:{transform:i=>({"--contrast":wrap("contrast",i)})},grayscale:{transform:i=>({"--grayscale":wrap("grayscale",i)})},hueRotate:{transform:i=>({"--hue-rotate":wrap("hue-rotate",deg(i))})},invert:{transform:i=>({"--invert":wrap("invert",i)})},saturate:{transform:i=>({"--saturate":wrap("saturate",i)})},sepia:{transform:i=>({"--sepia":wrap("sepia",i)})},dropShadow:{transform:i=>({"--drop-shadow":wrap("drop-shadow",i)})},backdropFilter:{transform(i){return i!=="auto"?{backdropFilter:i}:{backdropFilter:"var(--backdrop-blur) var(--backdrop-brightness) var(--backdrop-contrast) var(--backdrop-grayscale) var(--backdrop-hue-rotate) var(--backdrop-invert) var(--backdrop-opacity) var(--backdrop-saturate) var(--backdrop-sepia)"}}},backdropBlur:{values:"blurs",transform:i=>({"--backdrop-blur":wrap("blur",i)})},backdropBrightness:{transform:i=>({"--backdrop-brightness":wrap("brightness",i)})},backdropContrast:{transform:i=>({"--backdrop-contrast":wrap("contrast",i)})},backdropGrayscale:{transform:i=>({"--backdrop-grayscale":wrap("grayscale",i)})},backdropHueRotate:{transform:i=>({"--backdrop-hue-rotate":wrap("hue-rotate",deg(i))})},backdropInvert:{transform:i=>({"--backdrop-invert":wrap("invert",i)})},backdropOpacity:{transform:i=>({"--backdrop-opacity":wrap("opacity",i)})},backdropSaturate:{transform:i=>({"--backdrop-saturate":wrap("saturate",i)})},backdropSepia:{transform:i=>({"--backdrop-sepia":wrap("sepia",i)})},flexBasis:{values:"sizes"},gap:{values:"spacing"},rowGap:{values:"spacing",shorthand:["gapY"]},columnGap:{values:"spacing",shorthand:["gapX"]},flexDirection:{shorthand:["flexDir"]},gridGap:{values:"spacing"},gridColumnGap:{values:"spacing"},gridRowGap:{values:"spacing"},outlineColor:{values:colorValues,transform:createColorMixTransform("outlineColor")},focusRing:createFocusRing("&:is(:focus, [data-focus])"),focusVisibleRing:createFocusRing("&:is(:focus-visible, [data-focus-visible])"),focusRingColor:{values:colorValues,transform:createColorMixTransform("--focus-ring-color")},focusRingOffset:{values:"spacing",transform:i=>({"--focus-ring-offset":i})},focusRingWidth:{values:"borderWidths",property:"outlineWidth",transform:i=>({"--focus-ring-width":i})},focusRingStyle:{values:"borderStyles",property:"outlineStyle",transform:i=>({"--focus-ring-style":i})},aspectRatio:{values:"aspectRatios"},width:{values:"sizes",shorthand:["w"]},inlineSize:{values:"sizes"},height:{values:"sizes",shorthand:["h"]},blockSize:{values:"sizes"},boxSize:{values:"sizes",property:"width",transform:i=>({width:i,height:i})},minWidth:{values:"sizes",shorthand:["minW"]},minInlineSize:{values:"sizes"},minHeight:{values:"sizes",shorthand:["minH"]},minBlockSize:{values:"sizes"},maxWidth:{values:"sizes",shorthand:["maxW"]},maxInlineSize:{values:"sizes"},maxHeight:{values:"sizes",shorthand:["maxH"]},maxBlockSize:{values:"sizes"},hideFrom:{values:"breakpoints",transform:(i,{raw:o,token:s})=>({[s.raw(`breakpoints.${o}`)?`@breakpoint ${o}`:`@media screen and (min-width: ${i})`]:{display:"none"}})},hideBelow:{values:"breakpoints",transform(i,{raw:o,token:s}){return{[s.raw(`breakpoints.${o}`)?`@breakpoint ${o}Down`:`@media screen and (max-width: ${i})`]:{display:"none"}}}},overscrollBehavior:{shorthand:["overscroll"]},overscrollBehaviorX:{shorthand:["overscrollX"]},overscrollBehaviorY:{shorthand:["overscrollY"]},scrollbar:{values:["visible","hidden"],transform(i){switch(i){case"visible":return{msOverflowStyle:"auto",scrollbarWidth:"auto","&::-webkit-scrollbar":{display:"block"}};case"hidden":return{msOverflowStyle:"none",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"}};default:return{}}}},scrollbarColor:{values:colorValues,transform:createColorMixTransform("scrollbarColor")},scrollbarGutter:{values:"spacing"},scrollbarWidth:{values:"sizes"},scrollMargin:{values:"spacing"},scrollMarginTop:{values:"spacing"},scrollMarginBottom:{values:"spacing"},scrollMarginLeft:{values:"spacing"},scrollMarginRight:{values:"spacing"},scrollMarginX:{values:"spacing",transform:i=>({scrollMarginLeft:i,scrollMarginRight:i})},scrollMarginY:{values:"spacing",transform:i=>({scrollMarginTop:i,scrollMarginBottom:i})},scrollPadding:{values:"spacing"},scrollPaddingTop:{values:"spacing"},scrollPaddingBottom:{values:"spacing"},scrollPaddingLeft:{values:"spacing"},scrollPaddingRight:{values:"spacing"},scrollPaddingInline:{values:"spacing",shorthand:["scrollPaddingX"]},scrollPaddingBlock:{values:"spacing",shorthand:["scrollPaddingY"]},scrollSnapType:{values:{none:"none",x:"x var(--scroll-snap-strictness)",y:"y var(--scroll-snap-strictness)",both:"both var(--scroll-snap-strictness)"}},scrollSnapStrictness:{values:["mandatory","proximity"],transform:i=>({"--scroll-snap-strictness":i})},scrollSnapMargin:{values:"spacing"},scrollSnapMarginTop:{values:"spacing"},scrollSnapMarginBottom:{values:"spacing"},scrollSnapMarginLeft:{values:"spacing"},scrollSnapMarginRight:{values:"spacing"},listStylePosition:{shorthand:["listStylePos"]},listStyleImage:{values:"assets",shorthand:["listStyleImg"]},position:{shorthand:["pos"]},zIndex:{values:"zIndex"},inset:{values:"spacing"},insetInline:{values:"spacing",shorthand:["insetX"]},insetBlock:{values:"spacing",shorthand:["insetY"]},top:{values:"spacing"},insetBlockStart:{values:"spacing"},bottom:{values:"spacing"},insetBlockEnd:{values:"spacing"},left:{values:"spacing"},right:{values:"spacing"},insetInlineStart:{values:"spacing",shorthand:["insetStart"]},insetInlineEnd:{values:"spacing",shorthand:["insetEnd"]},ring:{transform(i){return{"--ring-offset-shadow":"var(--ring-inset) 0 0 0 var(--ring-offset-width) var(--ring-offset-color)","--ring-shadow":"var(--ring-inset) 0 0 0 calc(var(--ring-width) + var(--ring-offset-width)) var(--ring-color)","--ring-width":i,boxShadow:"var(--ring-offset-shadow), var(--ring-shadow), var(--shadow, 0 0 #0000)"}}},ringColor:{values:colorValues,transform:createColorMixTransform("--ring-color")},ringOffset:{transform:i=>({"--ring-offset-width":i})},ringOffsetColor:{values:colorValues,transform:createColorMixTransform("--ring-offset-color")},ringInset:{transform:i=>({"--ring-inset":i})},margin:{values:"spacing",shorthand:["m"]},marginTop:{values:"spacing",shorthand:["mt"]},marginBlockStart:{values:"spacing"},marginRight:{values:"spacing",shorthand:["mr"]},marginBottom:{values:"spacing",shorthand:["mb"]},marginBlockEnd:{values:"spacing"},marginLeft:{values:"spacing",shorthand:["ml"]},marginInlineStart:{values:"spacing",shorthand:["ms","marginStart"]},marginInlineEnd:{values:"spacing",shorthand:["me","marginEnd"]},marginInline:{values:"spacing",shorthand:["mx","marginX"]},marginBlock:{values:"spacing",shorthand:["my","marginY"]},padding:{values:"spacing",shorthand:["p"]},paddingTop:{values:"spacing",shorthand:["pt"]},paddingRight:{values:"spacing",shorthand:["pr"]},paddingBottom:{values:"spacing",shorthand:["pb"]},paddingBlockStart:{values:"spacing"},paddingBlockEnd:{values:"spacing"},paddingLeft:{values:"spacing",shorthand:["pl"]},paddingInlineStart:{values:"spacing",shorthand:["ps","paddingStart"]},paddingInlineEnd:{values:"spacing",shorthand:["pe","paddingEnd"]},paddingInline:{values:"spacing",shorthand:["px","paddingX"]},paddingBlock:{values:"spacing",shorthand:["py","paddingY"]},textDecoration:{shorthand:["textDecor"]},textDecorationColor:{values:colorValues,transform:createColorMixTransform("textDecorationColor")},textShadow:{values:"shadows"},transform:{transform:i=>{let o=i;return i==="auto"&&(o="translateX(var(--translate-x, 0)) translateY(var(--translate-y, 0)) rotate(var(--rotate, 0)) scaleX(var(--scale-x, 1)) scaleY(var(--scale-y, 1)) skewX(var(--skew-x, 0)) skewY(var(--skew-y, 0))"),i==="auto-gpu"&&(o="translate3d(var(--translate-x, 0), var(--translate-y, 0), 0) rotate(var(--rotate, 0)) scaleX(var(--scale-x, 1)) scaleY(var(--scale-y, 1)) skewX(var(--skew-x, 0)) skewY(var(--skew-y, 0))"),{transform:o}}},skewX:{transform:i=>({"--skew-x":deg(i)})},skewY:{transform:i=>({"--skew-y":deg(i)})},scaleX:{transform:i=>({"--scale-x":i})},scaleY:{transform:i=>({"--scale-y":i})},scale:{transform(i){return i!=="auto"?{scale:i}:{scale:"var(--scale-x, 1) var(--scale-y, 1)"}}},spaceXReverse:{values:{type:"boolean"},transform(i){return{"& > :not(style, [hidden]) ~ :not(style, [hidden])":{"--space-x-reverse":i?"1":void 0}}}},spaceX:{property:"marginInlineStart",values:"spacing",transform:i=>({"& > :not(style, [hidden]) ~ :not(style, [hidden])":{"--space-x-reverse":"0",marginInlineStart:`calc(${i} * calc(1 - var(--space-x-reverse)))`,marginInlineEnd:`calc(${i} * var(--space-x-reverse))`}})},spaceYReverse:{values:{type:"boolean"},transform(i){return{"& > :not(style, [hidden]) ~ :not(style, [hidden])":{"--space-y-reverse":i?"1":void 0}}}},spaceY:{property:"marginTop",values:"spacing",transform:i=>({"& > :not(style, [hidden]) ~ :not(style, [hidden])":{"--space-y-reverse":"0",marginTop:`calc(${i} * calc(1 - var(--space-y-reverse)))`,marginBottom:`calc(${i} * var(--space-y-reverse))`}})},rotate:{transform(i){return i!=="auto"?{rotate:deg(i)}:{rotate:"var(--rotate-x, 0) var(--rotate-y, 0) var(--rotate-z, 0)"}}},rotateX:{transform(i){return{"--rotate-x":deg(i)}}},rotateY:{transform(i){return{"--rotate-y":deg(i)}}},translate:{transform(i){return i!=="auto"?{translate:i}:{translate:"var(--translate-x) var(--translate-y)"}}},translateX:{values:"spacing",transform:i=>({"--translate-x":i})},translateY:{values:"spacing",transform:i=>({"--translate-y":i})},transition:{values:["all","common","colors","opacity","position","backgrounds","size","shadow","transform"],transform(i){switch(i){case"all":return createTransition("all");case"position":return createTransition("left, right, top, bottom, inset-inline, inset-block");case"colors":return createTransition("color, background-color, border-color, text-decoration-color, fill, stroke");case"opacity":return createTransition("opacity");case"shadow":return createTransition("box-shadow");case"transform":return createTransition("transform");case"size":return createTransition("width, height");case"backgrounds":return createTransition("background, background-color, background-image, background-position");case"common":return createTransition("color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter");default:return{transition:i}}}},transitionDuration:{values:"durations"},transitionProperty:{values:{common:"background-color, border-color, color, fill, stroke, opacity, box-shadow, translate, transform",colors:"background-color, border-color, color, fill, stroke",size:"width, height",position:"left, right, top, bottom, inset-inline, inset-block",background:"background, background-color, background-image, background-position"}},transitionTimingFunction:{values:"easings"},animation:{values:"animations"},animationDuration:{values:"durations"},animationDelay:{values:"durations"},animationTimingFunction:{values:"easings"},fontFamily:{values:"fonts"},fontSize:{values:"fontSizes"},fontWeight:{values:"fontWeights"},lineHeight:{values:"lineHeights"},letterSpacing:{values:"letterSpacings"},textIndent:{values:"spacing"},truncate:{values:{type:"boolean"},transform(i){return i===!0?{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}:{}}},lineClamp:{transform(i){return i==="none"?{WebkitLineClamp:"unset"}:{overflow:"hidden",display:"-webkit-box",WebkitLineClamp:i,WebkitBoxOrient:"vertical",textWrap:"wrap"}}},srOnly:{values:{type:"boolean"},transform(i){return srMapping[i]||{}}},debug:{values:{type:"boolean"},transform(i){return i?{outline:"1px solid blue !important","& > *":{outline:"1px solid red !important"}}:{}}},caretColor:{values:colorValues,transform:createColorMixTransform("caretColor")},cursor:{values:"cursor"}}}),srMapping={true:{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"},false:{position:"static",width:"auto",height:"auto",padding:"0",margin:"0",overflow:"visible",clip:"auto",whiteSpace:"normal"}};var userGeneratedStr="",userGenerated=userGeneratedStr.split(","),cssPropertiesStr="WebkitAppearance,WebkitBorderBefore,WebkitBorderBeforeColor,WebkitBorderBeforeStyle,WebkitBorderBeforeWidth,WebkitBoxReflect,WebkitLineClamp,WebkitMask,WebkitMaskAttachment,WebkitMaskClip,WebkitMaskComposite,WebkitMaskImage,WebkitMaskOrigin,WebkitMaskPosition,WebkitMaskPositionX,WebkitMaskPositionY,WebkitMaskRepeat,WebkitMaskRepeatX,WebkitMaskRepeatY,WebkitMaskSize,WebkitOverflowScrolling,WebkitTapHighlightColor,WebkitTextFillColor,WebkitTextStroke,WebkitTextStrokeColor,WebkitTextStrokeWidth,WebkitTouchCallout,WebkitUserModify,accentColor,alignContent,alignItems,alignSelf,alignTracks,all,animation,animationComposition,animationDelay,animationDirection,animationDuration,animationFillMode,animationIterationCount,animationName,animationPlayState,animationRange,animationRangeEnd,animationRangeStart,animationTimingFunction,animationTimeline,appearance,aspectRatio,azimuth,backdropFilter,backfaceVisibility,background,backgroundAttachment,backgroundBlendMode,backgroundClip,backgroundColor,backgroundImage,backgroundOrigin,backgroundPosition,backgroundPositionX,backgroundPositionY,backgroundRepeat,backgroundSize,blockSize,border,borderBlock,borderBlockColor,borderBlockStyle,borderBlockWidth,borderBlockEnd,borderBlockEndColor,borderBlockEndStyle,borderBlockEndWidth,borderBlockStart,borderBlockStartColor,borderBlockStartStyle,borderBlockStartWidth,borderBottom,borderBottomColor,borderBottomLeftRadius,borderBottomRightRadius,borderBottomStyle,borderBottomWidth,borderCollapse,borderColor,borderEndEndRadius,borderEndStartRadius,borderImage,borderImageOutset,borderImageRepeat,borderImageSlice,borderImageSource,borderImageWidth,borderInline,borderInlineEnd,borderInlineColor,borderInlineStyle,borderInlineWidth,borderInlineEndColor,borderInlineEndStyle,borderInlineEndWidth,borderInlineStart,borderInlineStartColor,borderInlineStartStyle,borderInlineStartWidth,borderLeft,borderLeftColor,borderLeftStyle,borderLeftWidth,borderRadius,borderRight,borderRightColor,borderRightStyle,borderRightWidth,borderSpacing,borderStartEndRadius,borderStartStartRadius,borderStyle,borderTop,borderTopColor,borderTopLeftRadius,borderTopRightRadius,borderTopStyle,borderTopWidth,borderWidth,bottom,boxAlign,boxDecorationBreak,boxDirection,boxFlex,boxFlexGroup,boxLines,boxOrdinalGroup,boxOrient,boxPack,boxShadow,boxSizing,breakAfter,breakBefore,breakInside,captionSide,caret,caretColor,caretShape,clear,clip,clipPath,color,colorScheme,columnCount,columnFill,columnGap,columnRule,columnRuleColor,columnRuleStyle,columnRuleWidth,columnSpan,columnWidth,columns,contain,containIntrinsicSize,containIntrinsicBlockSize,containIntrinsicHeight,containIntrinsicInlineSize,containIntrinsicWidth,container,containerName,containerType,content,contentVisibility,counterIncrement,counterReset,counterSet,cursor,direction,display,emptyCells,filter,flex,flexBasis,flexDirection,flexFlow,flexGrow,flexShrink,flexWrap,float,font,fontFamily,fontFeatureSettings,fontKerning,fontLanguageOverride,fontOpticalSizing,fontPalette,fontVariationSettings,fontSize,fontSizeAdjust,fontSmooth,fontStretch,fontStyle,fontSynthesis,fontSynthesisPosition,fontSynthesisSmallCaps,fontSynthesisStyle,fontSynthesisWeight,fontVariant,fontVariantAlternates,fontVariantCaps,fontVariantEastAsian,fontVariantEmoji,fontVariantLigatures,fontVariantNumeric,fontVariantPosition,fontWeight,forcedColorAdjust,gap,grid,gridArea,gridAutoColumns,gridAutoFlow,gridAutoRows,gridColumn,gridColumnEnd,gridColumnGap,gridColumnStart,gridGap,gridRow,gridRowEnd,gridRowGap,gridRowStart,gridTemplate,gridTemplateAreas,gridTemplateColumns,gridTemplateRows,hangingPunctuation,height,hyphenateCharacter,hyphenateLimitChars,hyphens,imageOrientation,imageRendering,imageResolution,imeMode,initialLetter,initialLetterAlign,inlineSize,inputSecurity,inset,insetBlock,insetBlockEnd,insetBlockStart,insetInline,insetInlineEnd,insetInlineStart,isolation,justifyContent,justifyItems,justifySelf,justifyTracks,left,letterSpacing,lineBreak,lineClamp,lineHeight,lineHeightStep,listStyle,listStyleImage,listStylePosition,listStyleType,margin,marginBlock,marginBlockEnd,marginBlockStart,marginBottom,marginInline,marginInlineEnd,marginInlineStart,marginLeft,marginRight,marginTop,marginTrim,mask,maskBorder,maskBorderMode,maskBorderOutset,maskBorderRepeat,maskBorderSlice,maskBorderSource,maskBorderWidth,maskClip,maskComposite,maskImage,maskMode,maskOrigin,maskPosition,maskRepeat,maskSize,maskType,masonryAutoFlow,mathDepth,mathShift,mathStyle,maxBlockSize,maxHeight,maxInlineSize,maxLines,maxWidth,minBlockSize,minHeight,minInlineSize,minWidth,mixBlendMode,objectFit,objectPosition,offset,offsetAnchor,offsetDistance,offsetPath,offsetPosition,offsetRotate,opacity,order,orphans,outline,outlineColor,outlineOffset,outlineStyle,outlineWidth,overflow,overflowAnchor,overflowBlock,overflowClipBox,overflowClipMargin,overflowInline,overflowWrap,overflowX,overflowY,overlay,overscrollBehavior,overscrollBehaviorBlock,overscrollBehaviorInline,overscrollBehaviorX,overscrollBehaviorY,padding,paddingBlock,paddingBlockEnd,paddingBlockStart,paddingBottom,paddingInline,paddingInlineEnd,paddingInlineStart,paddingLeft,paddingRight,paddingTop,page,pageBreakAfter,pageBreakBefore,pageBreakInside,paintOrder,perspective,perspectiveOrigin,placeContent,placeItems,placeSelf,pointerEvents,position,printColorAdjust,quotes,resize,right,rotate,rowGap,rubyAlign,rubyMerge,rubyPosition,scale,scrollbarColor,scrollbarGutter,scrollbarWidth,scrollBehavior,scrollMargin,scrollMarginBlock,scrollMarginBlockStart,scrollMarginBlockEnd,scrollMarginBottom,scrollMarginInline,scrollMarginInlineStart,scrollMarginInlineEnd,scrollMarginLeft,scrollMarginRight,scrollMarginTop,scrollPadding,scrollPaddingBlock,scrollPaddingBlockStart,scrollPaddingBlockEnd,scrollPaddingBottom,scrollPaddingInline,scrollPaddingInlineStart,scrollPaddingInlineEnd,scrollPaddingLeft,scrollPaddingRight,scrollPaddingTop,scrollSnapAlign,scrollSnapCoordinate,scrollSnapDestination,scrollSnapPointsX,scrollSnapPointsY,scrollSnapStop,scrollSnapType,scrollSnapTypeX,scrollSnapTypeY,scrollTimeline,scrollTimelineAxis,scrollTimelineName,shapeImageThreshold,shapeMargin,shapeOutside,tabSize,tableLayout,textAlign,textAlignLast,textCombineUpright,textDecoration,textDecorationColor,textDecorationLine,textDecorationSkip,textDecorationSkipInk,textDecorationStyle,textDecorationThickness,textEmphasis,textEmphasisColor,textEmphasisPosition,textEmphasisStyle,textIndent,textJustify,textOrientation,textOverflow,textRendering,textShadow,textSizeAdjust,textTransform,textUnderlineOffset,textUnderlinePosition,textWrap,timelineScope,top,touchAction,transform,transformBox,transformOrigin,transformStyle,transition,transitionBehavior,transitionDelay,transitionDuration,transitionProperty,transitionTimingFunction,translate,unicodeBidi,userSelect,verticalAlign,viewTimeline,viewTimelineAxis,viewTimelineInset,viewTimelineName,viewTransitionName,visibility,whiteSpace,whiteSpaceCollapse,widows,width,willChange,wordBreak,wordSpacing,wordWrap,writingMode,zIndex,zoom,alignmentBaseline,baselineShift,clipRule,colorInterpolation,colorRendering,dominantBaseline,fill,fillOpacity,fillRule,floodColor,floodOpacity,glyphOrientationVertical,lightingColor,marker,markerEnd,markerMid,markerStart,shapeRendering,stopColor,stopOpacity,stroke,strokeDasharray,strokeDashoffset,strokeLinecap,strokeLinejoin,strokeMiterlimit,strokeOpacity,strokeWidth,textAnchor,vectorEffect",allCssProperties=cssPropertiesStr.split(",").concat(userGenerated),properties=new Map(allCssProperties.map(i=>[i,!0]));function memo$1(i){const o=Object.create(null);return s=>(o[s]===void 0&&(o[s]=i(s)),o[s])}var cssPropertySelectorRegex=/&|@/,isCssProperty=memo$1(i=>properties.has(i)||i.startsWith("--")||cssPropertySelectorRegex.test(i));const isNotNullish=i=>i!=null;function walkObject(i,o,s={}){const{stop:a,getKey:_}=s;function $(_e,tt=[]){if(isObject$4(_e)||Array.isArray(_e)){const st={};for(const[it,nt]of Object.entries(_e)){const et=(_==null?void 0:_(it,nt))??it,j=[...tt,et];if(a!=null&&a(_e,j))return o(_e,tt);const rt=$(nt,j);isNotNullish(rt)&&(st[et]=rt)}return st}return o(_e,tt)}return $(i)}function mapObject(i,o){return Array.isArray(i)?i.map(s=>o(s)):isObject$4(i)?walkObject(i,s=>o(s)):i!=null?o(i):i}function flatten(i,o){const s={};return walkObject(i,(a,_)=>{a&&(s[_.join(".")]=a.value)},{stop:o}),s}var fastSafeStringify=stringify;stringify.default=stringify;stringify.stable=deterministicStringify;stringify.stableStringify=deterministicStringify;var LIMIT_REPLACE_NODE="[...]",CIRCULAR_REPLACE_NODE="[Circular]",arr=[],replacerStack=[];function defaultOptions$2(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function stringify(i,o,s,a){typeof a>"u"&&(a=defaultOptions$2()),decirc(i,"",0,[],void 0,0,a);var _;try{replacerStack.length===0?_=JSON.stringify(i,o,s):_=JSON.stringify(i,replaceGetterValues(o),s)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;arr.length!==0;){var $=arr.pop();$.length===4?Object.defineProperty($[0],$[1],$[3]):$[0][$[1]]=$[2]}}return _}function setReplace(i,o,s,a){var _=Object.getOwnPropertyDescriptor(a,s);_.get!==void 0?_.configurable?(Object.defineProperty(a,s,{value:i}),arr.push([a,s,o,_])):replacerStack.push([o,s,i]):(a[s]=i,arr.push([a,s,o]))}function decirc(i,o,s,a,_,$,_e){$+=1;var tt;if(typeof i=="object"&&i!==null){for(tt=0;tt_e.depthLimit){setReplace(LIMIT_REPLACE_NODE,i,o,_);return}if(typeof _e.edgesLimit<"u"&&s+1>_e.edgesLimit){setReplace(LIMIT_REPLACE_NODE,i,o,_);return}if(a.push(i),Array.isArray(i))for(tt=0;tto?1:0}function deterministicStringify(i,o,s,a){typeof a>"u"&&(a=defaultOptions$2());var _=deterministicDecirc(i,"",0,[],void 0,0,a)||i,$;try{replacerStack.length===0?$=JSON.stringify(_,o,s):$=JSON.stringify(_,replaceGetterValues(o),s)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;arr.length!==0;){var _e=arr.pop();_e.length===4?Object.defineProperty(_e[0],_e[1],_e[3]):_e[0][_e[1]]=_e[2]}}return $}function deterministicDecirc(i,o,s,a,_,$,_e){$+=1;var tt;if(typeof i=="object"&&i!==null){for(tt=0;tt_e.depthLimit){setReplace(LIMIT_REPLACE_NODE,i,o,_);return}if(typeof _e.edgesLimit<"u"&&s+1>_e.edgesLimit){setReplace(LIMIT_REPLACE_NODE,i,o,_);return}if(a.push(i),Array.isArray(i))for(tt=0;tt0)for(var a=0;a{const o=Object.create(null);function s(...a){const _=a.map($=>stringify$1($)).join("|");return o[_]===void 0&&(o[_]=i(...a)),o[_]}return s},BASE_FONT_SIZE=16,UNIT_PX="px",UNIT_EM="em",UNIT_REM="rem";function getUnit(i=""){const o=new RegExp(String.raw`-?\d+(?:\.\d+|\d*)`),s=new RegExp(`${UNIT_PX}|${UNIT_EM}|${UNIT_REM}`),a=i.match(new RegExp(`${o.source}(${s.source})`));return a==null?void 0:a[1]}function toPx(i=""){if(typeof i=="number")return`${i}px`;const o=getUnit(i);if(!o||o===UNIT_PX)return i;if(o===UNIT_EM||o===UNIT_REM)return`${parseFloat(i)*BASE_FONT_SIZE}${UNIT_PX}`}function toRem(i=""){const o=getUnit(i);if(!o||o===UNIT_REM)return i;if(o===UNIT_EM)return`${parseFloat(i)}${UNIT_REM}`;if(o===UNIT_PX)return`${parseFloat(i)/BASE_FONT_SIZE}${UNIT_REM}`}const capitalize$1=i=>i.charAt(0).toUpperCase()+i.slice(1);function createBreakpoints(i){const o=sort(i),s=Object.fromEntries(o);function a(j){return s[j]}function _(j){return build$1(a(j))}function $(){const j=Object.keys(s),rt=getPermutations(j),ot=j.flatMap(at=>{const lt=a(at),ut=[`${at}Down`,build$1({max:adjust(lt.min)})],ct=[at,build$1({min:lt.min})],dt=[`${at}Only`,_(at)];return[ct,dt,ut]}).filter(([,at])=>at!=="").concat(rt.map(([at,lt])=>{const ut=a(at),ct=a(lt);return[`${at}To${capitalize$1(lt)}`,build$1({min:ut.min,max:adjust(ct.min)})]}));return Object.fromEntries(ot)}function _e(){const j=$();return Object.fromEntries(Object.entries(j))}const tt=_e(),st=j=>tt[j];function it(){return["base",...Object.keys(s)]}function nt(j){return build$1({min:a(j).min})}function et(j){return build$1({max:adjust(a(j).min)})}return{values:Object.values(s),only:_,keys:it,conditions:tt,getCondition:st,up:nt,down:et}}function adjust(i){const o=parseFloat(toPx(i)??"")-.04;return toRem(`${o}px`)}function sort(i){return Object.entries(i).sort(([,s],[,a])=>parseInt(s,10){var tt;let _e=null;return _<=$.length-1&&(_e=(tt=$[_+1])==null?void 0:tt[1]),_e!=null&&(_e=adjust(_e)),[s,{name:s,min:toRem(a),max:_e}]})}function getPermutations(i){const o=[];return i.forEach((s,a)=>{let _=a;_++;let $=i[_];for(;$;)o.push([s,$]),_++,$=i[_]}),o}function build$1({min:i,max:o}){return i==null&&o==null?"":["@media screen",i&&`(min-width: ${i})`,o&&`(max-width: ${o})`].filter(Boolean).join(" and ")}const mapEntries$1=(i,o)=>Object.fromEntries(Object.entries(i).map(([s,a])=>o(s,a))),createConditions=i=>{const{breakpoints:o,conditions:s={}}=i,a=mapEntries$1(s,(nt,et)=>[`_${nt}`,et]),_=Object.assign({},a,o.conditions);function $(){return Object.keys(_)}function _e(nt){return $().includes(nt)||/^@|&|&$/.test(nt)||nt.startsWith("_")}function tt(nt){return nt.filter(et=>et!=="base").sort((et,j)=>{const rt=_e(et),ot=_e(j);return rt&&!ot?1:!rt&&ot?-1:0})}function st(nt){return nt.startsWith("@breakpoint")?o.getCondition(nt.replace("@breakpoint ","")):nt}function it(nt){return Reflect.get(_,nt)||nt}return{keys:$,sort:tt,has:_e,resolve:it,breakpoints:o.keys(),expandAtRule:st}},createMediaQueryRegex=i=>({minMax:new RegExp(`(!?\\(\\s*min(-device-)?-${i})(.| +)+\\(\\s*max(-device)?-${i}`,"i"),min:new RegExp(`\\(\\s*min(-device)?-${i}`,"i"),maxMin:new RegExp(`(!?\\(\\s*max(-device)?-${i})(.| +)+\\(\\s*min(-device)?-${i}`,"i"),max:new RegExp(`\\(\\s*max(-device)?-${i}`,"i")}),widthRegex=createMediaQueryRegex("width"),heightRegex=createMediaQueryRegex("height"),createQueryTester=i=>({isMin:_testQuery(i.minMax,i.maxMin,i.min),isMax:_testQuery(i.maxMin,i.minMax,i.max)}),{isMin:isMinWidth,isMax:isMaxWidth}=createQueryTester(widthRegex),{isMin:isMinHeight,isMax:isMaxHeight}=createQueryTester(heightRegex),isPrint=/print/i,isPrintOnly=/^print$/i,isLength=/(-?\d*\.?\d+)(ch|em|ex|px|rem)/,lengthExec=/(\d)/,maxValue=Number.MAX_VALUE,multipliers={ch:8.8984375,em:16,rem:16,ex:8.296875,px:1};function getQueryLength(i){const o=isLength.exec(i)||(isMinWidth(i)||isMinHeight(i)?lengthExec.exec(i):null);if(!o)return maxValue;if(o[0]==="0")return 0;const s=parseFloat(o[1]),a=o[2];return s*(multipliers[a]||1)}function _testQuery(i,o,s){return a=>i.test(a)||!o.test(a)&&s.test(a)}function _testIsPrint(i,o){const s=isPrint.test(i),a=isPrintOnly.test(i),_=isPrint.test(o),$=isPrintOnly.test(o);return s&&_?!a&&$?1:a&&!$?-1:i.localeCompare(o):s?1:_?-1:null}const sortAtParams=memo((i,o)=>{const s=_testIsPrint(i,o);if(s!==null)return s;const a=isMinWidth(i)||isMinHeight(i),_=isMaxWidth(i)||isMaxHeight(i),$=isMinWidth(o)||isMinHeight(o),_e=isMaxWidth(o)||isMaxHeight(o);if(a&&_e)return-1;if(_&&$)return 1;const tt=getQueryLength(i),st=getQueryLength(o);return tt===maxValue&&st===maxValue?i.localeCompare(o):tt===maxValue?1:st===maxValue?-1:tt!==st?tt>st?_?-1:1:_?1:-1:i.localeCompare(o)});function sortQueries(i){return i.sort(([o],[s])=>sortAtParams(o,s))}function sortAtRules(i){const o=[],s=[],a={};for(const[_e,tt]of Object.entries(i))_e.startsWith("@media")?o.push([_e,tt]):_e.startsWith("@container")?s.push([_e,tt]):isObject$4(tt)?a[_e]=sortAtRules(tt):a[_e]=tt;const _=sortQueries(o),$=sortQueries(s);return{...a,...Object.fromEntries(_),...Object.fromEntries($)}}const importantRegex=/\s*!(important)?/i,isImportant=i=>isString$3(i)?importantRegex.test(i):!1,withoutImportant=i=>isString$3(i)?i.replace(importantRegex,"").trim():i;function createCssFn(i){const{transform:o,conditions:s,normalize:a}=i,_=mergeCss(i);return memo(function(..._e){const tt=_(..._e),st=a(tt),it=Object.create(null);return walkObject(st,(nt,et)=>{const j=isImportant(nt);if(nt==null)return;const[rt,...ot]=s.sort(et).map(s.resolve);j&&(nt=withoutImportant(nt));let at=o(rt,nt)??Object.create(null);at=walkObject(at,lt=>isString$3(lt)&&j?`${lt} !important`:lt,{getKey:lt=>s.expandAtRule(lt)}),mergeByPath(it,ot.flat(),at)}),sortAtRules(it)})}function mergeByPath(i,o,s){let a=i;for(const _ of o)_&&(a[_]||(a[_]=Object.create(null)),a=a[_]);mergeWith(a,s)}function compactFn(...i){return i.filter(o=>isObject$4(o)&&Object.keys(compact$1(o)).length>0)}function mergeCss(i){function o(s){const a=compactFn(...s);return a.length===1?a:a.map(_=>i.normalize(_))}return memo(function(...a){return mergeWith({},...o(a))})}const uniq=(...i)=>{const o=i.filter(Boolean);return Array.from(new Set(o))},defaults$1=i=>({base:{},variants:{},defaultVariants:{},compoundVariants:[],...i});function createRecipeFn(i){const{css:o,conditions:s,normalize:a,layers:_}=i;function $(tt={}){const{base:st,variants:it,defaultVariants:nt,compoundVariants:et}=defaults$1(tt),j=createCssFn({conditions:s,normalize:a,transform(ct,dt){var ft;return(ft=it[ct])==null?void 0:ft[dt]}}),rt=(ct={})=>{const dt=a({...nt,...compact$1(ct)});let ft={...st};mergeWith(ft,j(dt));const ht=_e(et,dt);return _.wrap("recipes",o(ft,ht))},ot=Object.keys(it),at=ct=>{const dt=omit(ct,["recipe"]),[ft,ht]=splitProps(dt,ot);return ot.includes("colorPalette")||(ft.colorPalette=ct.colorPalette||nt.colorPalette),ot.includes("orientation")&&(ht.orientation=ct.orientation),[ft,ht]},lt=Object.fromEntries(Object.entries(it).map(([ct,dt])=>[ct,Object.keys(dt)]));return Object.assign(ct=>o(rt(ct)),{className:tt.className,__cva__:!0,variantMap:lt,variantKeys:ot,raw:rt,config:tt,splitVariantProps:at,merge(ct){return $(mergeCva(i)(this,ct))}})}function _e(tt,st){let it={};return tt.forEach(nt=>{Object.entries(nt).every(([j,rt])=>j==="css"?!0:(Array.isArray(rt)?rt:[rt]).some(at=>st[j]===at))&&(it=o(it,nt.css))}),it}return $}function mergeCva(i){const{css:o}=i;return function(a,_){const $=defaults$1(_.config),_e=uniq(a.variantKeys,Object.keys(_.variants)),tt=o(a.base,$.base),st=Object.fromEntries(_e.map(j=>[j,o(a.config.variants[j],$.variants[j])])),it=mergeWith(a.config.defaultVariants,$.defaultVariants),nt=[...a.compoundVariants,...$.compoundVariants];return{className:cx(a.className,_.className),base:tt,variants:st,defaultVariants:it,compoundVariants:nt}}}const defaultLayers={reset:"reset",base:"base",tokens:"tokens",recipes:"recipes"},layerOrder={reset:0,base:1,tokens:2,recipes:3};function createLayers(i){const o=i.layers??defaultLayers,a=Object.values(o).sort((_,$)=>layerOrder[_]-layerOrder[$]);return{names:a,atRule:`@layer ${a.join(", ")};`,wrap(_,$){return i.disableLayers?$:{[`@layer ${o[_]}`]:$}}}}function createNormalizeFn(i){const{utility:o,normalize:s}=i,{hasShorthand:a,resolveShorthand:_}=o;return function($){return walkObject($,s,{stop:_e=>Array.isArray(_e),getKey:a?_:void 0})}}function createPreflight(i){const{preflight:o}=i;if(!o)return{};const{scope:s="",level:a="parent"}=isObject$4(o)?o:{};let _="";s&&a==="parent"?_=`${s} `:s&&a==="element"&&(_=`&${s}`);const $={"*":{margin:"0px",padding:"0px",font:"inherit",wordWrap:"break-word",WebkitTapHighlightColor:"transparent"},"*, *::before, *::after, *::backdrop":{boxSizing:"border-box",borderWidth:"0px",borderStyle:"solid",borderColor:"var(--global-color-border, currentColor)"},hr:{height:"0px",color:"inherit",borderTopWidth:"1px"},body:{minHeight:"100dvh",position:"relative"},img:{borderStyle:"none"},"img, svg, video, canvas, audio, iframe, embed, object":{display:"block",verticalAlign:"middle"},iframe:{border:"none"},"img, video":{maxWidth:"100%",height:"auto"},"p, h1, h2, h3, h4, h5, h6":{overflowWrap:"break-word"},"ol, ul":{listStyle:"none"},"code, kbd, pre, samp":{fontSize:"1em"},"button, [type='button'], [type='reset'], [type='submit']":{WebkitAppearance:"button",backgroundColor:"transparent",backgroundImage:"none"},"button, input, optgroup, select, textarea":{color:"inherit"},"button, select":{textTransform:"none"},table:{textIndent:"0px",borderColor:"inherit",borderCollapse:"collapse"},"*::placeholder":{opacity:"unset",color:"#9ca3af",userSelect:"none"},textarea:{resize:"vertical"},summary:{display:"list-item"},small:{fontSize:"80%"},"sub, sup":{fontSize:"75%",lineHeight:0,position:"relative",verticalAlign:"baseline"},sub:{bottom:"-0.25em"},sup:{top:"-0.5em"},dialog:{padding:"0px"},a:{color:"inherit",textDecoration:"inherit"},"abbr:where([title])":{textDecoration:"underline dotted"},"b, strong":{fontWeight:"bolder"},"code, kbd, samp, pre":{fontSize:"1em","--font-mono-fallback":"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New'",fontFamily:"var(--global-font-mono, var(--font-mono-fallback))"},'input[type="text"], input[type="email"], input[type="search"], input[type="password"]':{WebkitAppearance:"none",MozAppearance:"none"},"input[type='search']":{WebkitAppearance:"textfield",outlineOffset:"-2px"},"::-webkit-search-decoration, ::-webkit-search-cancel-button":{WebkitAppearance:"none"},"::-webkit-file-upload-button":{WebkitAppearance:"button",font:"inherit"},'input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button':{height:"auto"},"input[type='number']":{MozAppearance:"textfield"},":-moz-ui-invalid":{boxShadow:"none"},":-moz-focusring":{outline:"auto"},"[hidden]:where(:not([hidden='until-found']))":{display:"none !important"}},_e={[s||"html"]:{lineHeight:1.5,"--font-fallback":"ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'",WebkitTextSizeAdjust:"100%",WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale",textRendering:"optimizeLegibility",touchAction:"manipulation",MozTabSize:"4",tabSize:"4",fontFamily:"var(--global-font-body, var(--font-fallback))"}};if(a==="element"){const tt=Object.entries($).reduce((st,[it,nt])=>(st[it]={[_]:nt},st),{});Object.assign(_e,tt)}else _?_e[_]=$:Object.assign(_e,$);return _e}function createSerializeFn(i){const{conditions:o,isValidProperty:s}=i;return function(_){return walkObject(_,$=>$,{getKey:($,_e)=>isObject$4(_e)&&!o.has($)&&!s($)?parseSelectors($).map(tt=>"&"+tt).join(", "):$})}}function parseSelectors(i){const o=[];let s=0,a="",_=!1;for(let $=0;${const o=_=>{var $;return{base:(($=i.base)==null?void 0:$[_])??{},variants:{},defaultVariants:i.defaultVariants??{},compoundVariants:i.compoundVariants?getSlotCompoundVariant(i.compoundVariants,_):[]}},a=(i.slots??[]).map(_=>[_,o(_)]);for(const[_,$]of Object.entries(i.variants??{}))for(const[_e,tt]of Object.entries($))a.forEach(([st,it])=>{var nt;(nt=it.variants)[_]??(nt[_]={}),it.variants[_][_e]=tt[st]??{}});return Object.fromEntries(a)},getSlotCompoundVariant=(i,o)=>i.filter(s=>s.css[o]).map(s=>({...s,css:s.css[o]}));function createSlotRecipeFn(i){const{cva:o}=i;return function(a={}){const _=Object.entries(getSlotRecipes(a)).map(([et,j])=>[et,o(j)]);function $(et){const j=_.map(([rt,ot])=>[rt,ot(et)]);return Object.fromEntries(j)}const _e=a.variants??{},tt=Object.keys(_e);function st(et){var at;const j=omit(et,["recipe"]),[rt,ot]=splitProps(j,tt);return tt.includes("colorPalette")||(rt.colorPalette=et.colorPalette||((at=a.defaultVariants)==null?void 0:at.colorPalette)),tt.includes("orientation")&&(ot.orientation=et.orientation),[rt,ot]}const it=Object.fromEntries(Object.entries(_e).map(([et,j])=>[et,Object.keys(j)]));let nt={};return a.className&&(nt=Object.fromEntries(a.slots.map(et=>[et,`${a.className}__${et}`]))),Object.assign($,{variantMap:it,variantKeys:tt,splitVariantProps:st,classNameMap:nt})}}const createProps=()=>i=>Array.from(new Set(i)),rcssescape=/([\0-\x1f\x7f]|^-?\d)|^-$|^-|[^\x80-\uFFFF\w-]/g,fcssescape=function(i,o){return o?i==="\0"?"�":i==="-"&&i.length===1?"\\-":i.slice(0,-1)+"\\"+i.charCodeAt(i.length-1).toString(16):"\\"+i},esc=i=>(i+"").replace(rcssescape,fcssescape),expandTokenReferences=(i,o)=>{let s="",a=0,_="char",$="",_e="";const tt=[];for(;a{let o=0;const s=["("];for(;o{s instanceof Map?o[a]=Object.fromEntries(s):o[a]=s}),o}const REFERENCE_REGEX=/({([^}]*)})/g,CURLY_REGEX=/[{}]/g,TOKEN_PATH_REGEX=/\w+\.\w+/,getReferences=i=>{if(!isString$3(i))return[];const o=i.match(REFERENCE_REGEX);return o?o.map(s=>s.replace(CURLY_REGEX,"")).map(s=>s.trim()):[]},hasReference=i=>REFERENCE_REGEX.test(i);function expandReferences(i){var s,a,_;if(!((s=i.extensions)!=null&&s.references))return((_=(a=i.extensions)==null?void 0:a.cssVar)==null?void 0:_.ref)??i.value;const o=i.extensions.references??{};return i.value=Object.keys(o).reduce(($,_e)=>{const tt=o[_e];if(tt.extensions.conditions)return $;const st=expandReferences(tt);return $.replace(`{${_e}}`,st)},i.value),delete i.extensions.references,i.value}function resolveReference(i){return isObject$4(i)&&i.reference?i.reference:String(i)}const toExpression=(i,...o)=>o.map(resolveReference).join(` ${i} `).replace(/calc/g,""),add=(...i)=>`calc(${toExpression("+",...i)})`,subtract=(...i)=>`calc(${toExpression("-",...i)})`,multiply=(...i)=>`calc(${toExpression("*",...i)})`,divide=(...i)=>`calc(${toExpression("/",...i)})`,negate=i=>{const o=resolveReference(i);return o!=null&&!Number.isNaN(parseFloat(o))?String(o).startsWith("-")?String(o).slice(1):`-${o}`:multiply(o,-1)},calc=Object.assign(i=>({add:(...o)=>calc(add(i,...o)),subtract:(...o)=>calc(subtract(i,...o)),multiply:(...o)=>calc(multiply(i,...o)),divide:(...o)=>calc(divide(i,...o)),negate:()=>calc(negate(i)),toString:()=>i.toString()}),{add,subtract,multiply,divide,negate}),addNegativeTokens={enforce:"pre",transform(i){const{prefix:o,allTokens:s,formatCssVar:a,formatTokenName:_,registerToken:$}=i;s.filter(({extensions:tt})=>tt.category==="spacing").forEach(tt=>{const st=tt.path.slice(),it=a(st,o);if(isString$3(tt.value)&&tt.value==="0rem")return;const nt=structuredClone(tt);Object.assign(nt.extensions,{negative:!0,prop:`-${tt.extensions.prop}`,originalPath:st}),nt.value=calc.negate(it.ref);const et=nt.path[nt.path.length-1];et!=null&&(nt.path[nt.path.length-1]=`-${et}`),nt.path&&(nt.name=_(nt.path)),$(nt)})}},units=new Set(["spacing","sizes","borderWidths","fontSizes","radii"]),addPixelUnit={enforce:"post",transform(i){i.allTokens.filter(s=>units.has(s.extensions.category)&&!s.extensions.negative).forEach(s=>{Object.assign(s.extensions,{pixelValue:toPx(s.value)})})}},addVirtualPalette={enforce:"post",transform(i){const{allTokens:o,registerToken:s,formatTokenName:a}=i,_=o.filter(({extensions:tt})=>tt.category==="colors"),$=new Map,_e=new Map;_.forEach(tt=>{const{colorPalette:st}=tt.extensions;st&&(st.keys.forEach(it=>{$.set(a(it),it)}),st.roots.forEach(it=>{var j;const nt=a(it),et=_e.get(nt)||[];if(et.push(tt),_e.set(nt,et),tt.extensions.default&&it.length===1){const rt=(j=st.keys[0])==null?void 0:j.filter(Boolean);if(!rt.length)return;const ot=it.concat(rt);$.set(a(ot),[])}}))}),$.forEach(tt=>{const st=["colors","colorPalette",...tt].filter(Boolean),it=a(st),nt=a(st.slice(1));s({name:it,value:it,originalValue:it,path:st,extensions:{condition:"base",originalPath:st,category:"colors",prop:nt,virtual:!0}},"pre")})}},removeEmptyTokens={enforce:"post",transform(i){i.allTokens=i.allTokens.filter(o=>o.value!=="")}},tokenMiddlewares=[addNegativeTokens,addVirtualPalette,addPixelUnit,removeEmptyTokens],addCssVariables={type:"extensions",enforce:"pre",name:"tokens/css-var",transform(i,o){const{prefix:s,formatCssVar:a}=o,{negative:_,originalPath:$}=i.extensions,_e=_?$:i.path;return{cssVar:a(_e.filter(Boolean),s)}}},addConditionalCssVariables={enforce:"post",type:"value",name:"tokens/conditionals",transform(i,o){const{prefix:s,formatCssVar:a}=o,_=getReferences(i.value);return _.length&&_.forEach($=>{const _e=a($.split("."),s);i.value=i.value.replace(`{${_e.ref}}`,_e)}),i.value}},addColorPalette={type:"extensions",enforce:"pre",name:"tokens/colors/colorPalette",match(i){return i.extensions.category==="colors"&&!i.extensions.virtual},transform(i,o){let s=i.path.slice();if(s.pop(),s.shift(),s.length===0){const tt=[...i.path];tt.shift(),s=tt}if(s.length===0)return{};const a=s.reduce((tt,st,it,nt)=>{const et=nt.slice(0,it+1);return tt.push(et),tt},[]),_=s[0],$=o.formatTokenName(s),_e=i.path.slice(i.path.indexOf(_)+1).reduce((tt,st,it,nt)=>(tt.push(nt.slice(it)),tt),[]);return _e.length===0&&_e.push([""]),{colorPalette:{value:$,roots:a,keys:_e}}}},tokenTransforms=[addCssVariables,addConditionalCssVariables,addColorPalette],isToken=i=>isObject$4(i)&&Object.prototype.hasOwnProperty.call(i,"value");function expandBreakpoints(i){return i?{breakpoints:mapObject(i,o=>({value:o})),sizes:Object.fromEntries(Object.entries(i).map(([o,s])=>[`breakpoint-${o}`,{value:s}]))}:{breakpoints:{},sizes:{}}}function createTokenDictionary(i){const{prefix:o="",tokens:s={},semanticTokens:a={},breakpoints:_={}}=i,$=Vt=>Vt.join("."),_e=(Vt,Xt)=>cssVar(Vt.join("-"),{prefix:Xt}),tt=[],st=new Map,it=new Map,nt=new Map,et=new Map,j=new Map,rt=new Map,ot=new Map,at=new Map,lt=[];function ut(Vt,Xt){tt.push(Vt),st.set(Vt.name,Vt),Xt&&at.forEach(Zt=>{Zt.enforce===Xt&&jt(Zt,Vt)})}const ct=expandBreakpoints(_),dt=compact$1({...s,breakpoints:ct.breakpoints,sizes:{...s.sizes,...ct.sizes}});function ft(){walkObject(dt,(Vt,Xt)=>{const Zt=Xt.includes("DEFAULT");Xt=filterDefault(Xt);const cr=Xt[0],pr=$(Xt),ir=isString$3(Vt)?{value:Vt}:Vt,hr={value:ir.value,originalValue:ir.value,name:pr,path:Xt,extensions:{condition:"base",originalPath:Xt,category:cr,prop:$(Xt.slice(1))}};Zt&&(hr.extensions.default=!0),ut(hr)},{stop:isToken}),walkObject(a,(Vt,Xt)=>{const Zt=Xt.includes("DEFAULT");Xt=filterBaseCondition(filterDefault(Xt));const cr=Xt[0],pr=$(Xt),ir=isString$3(Vt.value)?{value:{base:Vt.value}}:Vt,hr={value:ir.value.base||"",originalValue:ir.value.base||"",name:pr,path:Xt,extensions:{originalPath:Xt,category:cr,conditions:ir.value,condition:"base",prop:$(Xt.slice(1))}};Zt&&(hr.extensions.default=!0),ut(hr)},{stop:isToken})}function ht(Vt){return st.get(Vt)}function bt(Vt){const{condition:Xt}=Vt.extensions;Xt&&(it.has(Xt)||it.set(Xt,new Set),it.get(Xt).add(Vt))}function yt(Vt){const{category:Xt,prop:Zt}=Vt.extensions;Xt&&(ot.has(Xt)||ot.set(Xt,new Map),ot.get(Xt).set(Zt,Vt))}function mt(Vt){const{condition:Xt,negative:Zt,virtual:cr,cssVar:pr}=Vt.extensions;Zt||cr||!Xt||!pr||(nt.has(Xt)||nt.set(Xt,new Map),nt.get(Xt).set(pr.var,Vt.value))}function gt(Vt){const{category:Xt,prop:Zt,cssVar:cr,negative:pr}=Vt.extensions;if(!Xt)return;rt.has(Xt)||rt.set(Xt,new Map);const ir=pr?Vt.extensions.conditions?Vt.originalValue:Vt.value:cr.ref;rt.get(Xt).set(Zt,ir),j.set([Xt,Zt].join("."),ir)}function vt(Vt){const{colorPalette:Xt,virtual:Zt,default:cr}=Vt.extensions;!Xt||Zt||Xt.roots.forEach(pr=>{var zr;const ir=$(pr);et.has(ir)||et.set(ir,new Map);const hr=replaceRootWithColorPalette([...Vt.path],[...pr]),Rr=$(hr),Or=ht(Rr);if(!Or||!Or.extensions.cssVar)return;const{var:Fr}=Or.extensions.cssVar;if(et.get(ir).set(Fr,Vt.extensions.cssVar.ref),cr&&pr.length===1){const Gr=$(["colors","colorPalette"]),jr=ht(Gr);if(!jr)return;const Nr=$(Vt.path),Tr=ht(Nr);if(!Tr)return;const Mr=(zr=Xt.keys[0])==null?void 0:zr.filter(Boolean);if(!Mr.length)return;const Br=$(pr.concat(Mr));et.has(Br)||et.set(Br,new Map),et.get(Br).set(jr.extensions.cssVar.var,Tr.extensions.cssVar.ref)}})}let wt={};function Ct(){tt.forEach(Vt=>{bt(Vt),yt(Vt),mt(Vt),gt(Vt),vt(Vt)}),wt=mapToJson(rt)}const kt=(Vt,Xt)=>{var Or;if(!Vt||typeof Vt!="string")return{invalid:!0,value:Vt};const[Zt,cr]=Vt.split("/");if(!Zt||!cr)return{invalid:!0,value:Zt};const pr=Xt(Zt),ir=(Or=ht(`opacity.${cr}`))==null?void 0:Or.value;if(!ir&&isNaN(Number(cr)))return{invalid:!0,value:Zt};const hr=ir?Number(ir)*100+"%":`${cr}%`,Rr=pr??Zt;return{invalid:!1,color:Rr,value:`color-mix(in srgb, ${Rr} ${hr}, transparent)`}},It=memo((Vt,Xt)=>j.get(Vt)??Xt),Pt=memo(Vt=>wt[Vt]||null),St=memo(Vt=>expandTokenReferences(Vt,Xt=>{if(!Xt)return;if(Xt.includes("/")){const cr=kt(Xt,pr=>It(pr));if(cr.invalid)throw new Error("Invalid color mix at "+Xt+": "+cr.value);return cr.value}const Zt=It(Xt);return Zt||(TOKEN_PATH_REGEX.test(Xt)?esc(Xt):Xt)})),Rt={prefix:o,allTokens:tt,tokenMap:st,registerToken:ut,getByName:ht,formatTokenName:$,formatCssVar:_e,flatMap:j,cssVarMap:nt,categoryMap:ot,colorPaletteMap:et,getVar:It,getCategoryValues:Pt,expandReferenceInValue:St};function At(...Vt){Vt.forEach(Xt=>{at.set(Xt.name,Xt)})}function Mt(...Vt){lt.push(...Vt)}function jt(Vt,Xt){if(Xt.extensions.references||isFunction$2(Vt.match)&&!Vt.match(Xt))return;const cr=(pr=>Vt.transform(pr,Rt))(Xt);switch(!0){case Vt.type==="extensions":Object.assign(Xt.extensions,cr);break;case Vt.type==="value":Xt.value=cr;break;default:Xt[Vt.type]=cr;break}}function Yt(Vt){lt.forEach(Xt=>{Xt.enforce===Vt&&Xt.transform(Rt)})}function Kt(Vt){at.forEach(Xt=>{Xt.enforce===Vt&&tt.forEach(Zt=>{jt(Xt,Zt)})})}function sr(){tt.forEach(Vt=>{const Xt=getConditionalTokens(Vt);!Xt||Xt.length===0||Xt.forEach(Zt=>{ut(Zt)})})}function ar(Vt){return getReferences(Vt).map(Zt=>ht(Zt)).filter(Boolean)}function Gt(){tt.forEach(Vt=>{if(!hasReference(Vt.value))return;const Xt=ar(Vt.value);Vt.extensions.references=Xt.reduce((Zt,cr)=>(Zt[cr.name]=cr,Zt),{})})}function Qt(){tt.forEach(Vt=>{expandReferences(Vt)})}function tr(){Yt("pre"),Kt("pre"),sr(),Gt(),Qt(),Yt("post"),Kt("post"),Ct()}return ft(),At(...tokenTransforms),Mt(...tokenMiddlewares),tr(),Rt}function filterDefault(i){return i[0]==="DEFAULT"?i:i.filter(o=>o!=="DEFAULT")}function filterBaseCondition(i){return i.filter(o=>o!=="base")}function getConditionalTokens(i){if(!i.extensions.conditions)return;const{conditions:o}=i.extensions,s=[];return walkObject(o,(a,_)=>{const $=filterBaseCondition(_);if(!$.length)return;const _e=structuredClone(i);_e.value=a,_e.extensions.condition=$.join(":"),s.push(_e)}),s}function replaceRootWithColorPalette(i,o){const s=i.findIndex((a,_)=>o.every(($,_e)=>i[_+_e]===$));return s===-1||(i.splice(s,o.length),i.splice(s,0,"colorPalette")),i}createProps()(["aspectRatios","zIndex","opacity","colors","fonts","fontSizes","fontWeights","lineHeights","letterSpacings","sizes","shadows","spacing","radii","cursor","borders","borderWidths","borderStyles","durations","easings","animations","blurs","gradients","breakpoints","assets"]);function normalize(i){return i}function normalizeConfig(i){return Object.fromEntries(Object.entries(i).map(([o,s])=>[o,s]))}function createUtility(i){const o=normalizeConfig(i.config),s=i.tokens,a=new Map,_=new Map;function $(mt,gt){o[mt]=gt,_e(mt,gt)}const _e=(mt,gt)=>{const vt=at(gt);vt&&(_.set(mt,vt),et(mt,gt))},tt=()=>{for(const[mt,gt]of Object.entries(o))gt&&_e(mt,gt)},st=()=>{for(const[mt,gt]of Object.entries(o)){const{shorthand:vt}=gt??{};if(!vt)continue;(Array.isArray(vt)?vt:[vt]).forEach(Ct=>a.set(Ct,mt))}},it=()=>{const mt=mapToJson(s.colorPaletteMap);$("colorPalette",{values:Object.keys(mt),transform:memo(gt=>mt[gt])})},nt=new Map,et=(mt,gt)=>{if(!gt)return;const vt=at(gt,Ct=>`type:Tokens["${Ct}"]`);if(typeof vt=="object"&&vt.type){nt.set(mt,new Set([`type:${vt.type}`]));return}if(vt){const Ct=new Set(Object.keys(vt));nt.set(mt,Ct)}const wt=nt.get(mt)??new Set;gt.property&&nt.set(mt,wt.add(`CssProperties["${gt.property}"]`))},j=()=>{for(const[mt,gt]of Object.entries(o))gt&&et(mt,gt)},rt=(mt,gt)=>{const vt=nt.get(mt)??new Set;nt.set(mt,new Set([...vt,...gt]))},ot=()=>{const mt=new Map;for(const[gt,vt]of nt.entries()){if(vt.size===0){mt.set(gt,["string"]);continue}const wt=Array.from(vt).map(Ct=>Ct.startsWith("CssProperties")?Ct:Ct.startsWith("type:")?Ct.replace("type:",""):JSON.stringify(Ct));mt.set(gt,wt)}return mt},at=(mt,gt)=>{const{values:vt}=mt,wt=Ct=>{const kt=gt==null?void 0:gt(Ct);return kt?{[kt]:kt}:void 0};return isString$3(vt)?(wt==null?void 0:wt(vt))??s.getCategoryValues(vt)??{}:Array.isArray(vt)?vt.reduce((Ct,kt)=>(Ct[kt]=kt,Ct),{}):isFunction$2(vt)?vt(gt?wt:s.getCategoryValues):vt},lt=memo((mt,gt)=>({[mt]:mt.startsWith("--")?s.getVar(gt,gt):gt})),ut=Object.assign(s.getVar,{raw:mt=>s.getByName(mt)}),ct=memo((mt,gt)=>{var It;const vt=ht(mt);isString$3(gt)&&!gt.includes("_EMO_")&&(gt=s.expandReferenceInValue(gt));const wt=o[vt];if(!wt)return lt(vt,gt);const Ct=(It=_.get(vt))==null?void 0:It[gt];if(!wt.transform)return lt(mt,Ct??gt);const kt=Pt=>colorMix(Pt,ut);return wt.transform(Ct??gt,{raw:gt,token:ut,utils:{colorMix:kt}})});function dt(){st(),it(),tt(),j()}dt();const ft=a.size>0,ht=memo(mt=>a.get(mt)??mt);return{keys:()=>[...Array.from(a.keys()),...Object.keys(o)],hasShorthand:ft,transform:ct,shorthands:a,resolveShorthand:ht,register:$,getTypes:ot,addPropertyType:rt}}function createSystem(...i){const o=mergeConfigs(...i),{theme:s={},utilities:a={},globalCss:_={},cssVarsRoot:$=":where(:root, :host)",cssVarsPrefix:_e="chakra",preflight:tt}=o,st=createLayers(o),it=createTokenDictionary({breakpoints:s.breakpoints,tokens:s.tokens,semanticTokens:s.semanticTokens,prefix:_e}),nt=createBreakpoints(s.breakpoints??{}),et=createConditions({conditions:o.conditions??{},breakpoints:nt}),j=createUtility({config:a,tokens:it});function rt(){const{textStyles:At,layerStyles:Mt,animationStyles:jt}=s,Yt=compact$1({textStyle:At,layerStyle:Mt,animationStyle:jt});for(const[Kt,sr]of Object.entries(Yt)){const ar=flatten(sr??{},Gt=>isObject$4(Gt)&&"value"in Gt);j.register(Kt,{values:Object.keys(ar),transform(Gt){return dt(ar[Gt])}})}}rt(),j.addPropertyType("animationName",Object.keys(s.keyframes??{}));const ot=new Set(["css",...j.keys(),...et.keys()]),at=memo(At=>ot.has(At)||isCssProperty(At)),lt=At=>Array.isArray(At)?At.reduce((Mt,jt,Yt)=>{const Kt=et.breakpoints[Yt];return jt!=null&&(Mt[Kt]=jt),Mt},{}):At,ut=createNormalizeFn({utility:j,normalize:lt}),ct=createSerializeFn({conditions:et,isValidProperty:at}),dt=createCssFn({transform:j.transform,conditions:et,normalize:ut}),ft=createRecipeFn({css:dt,conditions:et,normalize:ut,layers:st}),ht=createSlotRecipeFn({cva:ft});function bt(){const At={};for(const[Mt,jt]of it.cssVarMap.entries()){const Yt=Object.fromEntries(jt);if(Object.keys(Yt).length===0)continue;const Kt=Mt==="base"?$:et.resolve(Mt),sr=dt(ct({[Kt]:Yt}));mergeWith(At,sr)}return st.wrap("tokens",At)}function yt(){const At=Object.fromEntries(Object.entries(s.keyframes??{}).map(([jt,Yt])=>[`@keyframes ${jt}`,Yt])),Mt=Object.assign({},At,dt(ct(_)));return st.wrap("base",Mt)}function mt(At){return splitProps(At,at)}function gt(){const At=createPreflight({preflight:tt});return st.wrap("reset",At)}const vt=getTokenMap(it),wt=(At,Mt)=>{var jt;return((jt=vt.get(At))==null?void 0:jt.value)||Mt};wt.var=(At,Mt)=>{var jt;return((jt=vt.get(At))==null?void 0:jt.variable)||Mt};function Ct(At,Mt){var jt;return((jt=s.recipes)==null?void 0:jt[At])??Mt}function kt(At,Mt){var jt;return((jt=s.slotRecipes)==null?void 0:jt[At])??Mt}function It(At){return Object.hasOwnProperty.call(s.recipes??{},At)}function Pt(At){return Object.hasOwnProperty.call(s.slotRecipes??{},At)}function St(At){return It(At)||Pt(At)}const Rt=[gt(),yt(),bt()];return{$$chakra:!0,_config:o,_global:Rt,breakpoints:nt,tokens:it,conditions:et,utility:j,token:wt,properties:ot,layers:st,isValidProperty:at,splitCssProps:mt,normalizeValue:lt,getTokenCss:bt,getGlobalCss:yt,getPreflightCss:gt,css:dt,cva:ft,sva:ht,getRecipe:Ct,getSlotRecipe:kt,hasRecipe:St,isRecipe:It,isSlotRecipe:Pt}}function getTokenMap(i){const o=new Map;return i.allTokens.forEach(s=>{const{cssVar:a,virtual:_,conditions:$}=s.extensions,_e=$||_?a.ref:s.value;o.set(s.name,{value:_e,variable:a.ref})}),o}const breakpoints={sm:"480px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},empty="var(--chakra-empty,/*!*/ /*!*/)",globalCss=defineGlobalStyles({"*":{fontFeatureSettings:'"cv11"',"--ring-inset":empty,"--ring-offset-width":"0px","--ring-offset-color":"#fff","--ring-color":"rgba(66, 153, 225, 0.6)","--ring-offset-shadow":"0 0 #0000","--ring-shadow":"0 0 #0000",...Object.fromEntries(["brightness","contrast","grayscale","hue-rotate","invert","saturate","sepia","drop-shadow"].map(i=>[`--${i}`,empty])),...Object.fromEntries(["blur","brightness","contrast","grayscale","hue-rotate","invert","opacity","saturate","sepia"].map(i=>[`--backdrop-${i}`,empty])),"--global-font-mono":"fonts.mono","--global-font-body":"fonts.body","--global-color-border":"colors.border"},html:{color:"fg",bg:"bg",lineHeight:"1.5",colorPalette:"gray"},"*::placeholder, *[data-placeholder]":{color:"fg.muted/80"},"*::selection":{bg:"colorPalette.emphasized/80"}}),layerStyles=defineLayerStyles({"fill.muted":{value:{background:"colorPalette.muted",color:"colorPalette.fg"}},"fill.subtle":{value:{background:"colorPalette.subtle",color:"colorPalette.fg"}},"fill.surface":{value:{background:"colorPalette.subtle",color:"colorPalette.fg",boxShadow:"0 0 0px 1px var(--shadow-color)",boxShadowColor:"colorPalette.muted"}},"fill.solid":{value:{background:"colorPalette.solid",color:"colorPalette.contrast"}},"outline.subtle":{value:{color:"colorPalette.fg",boxShadow:"inset 0 0 0px 1px var(--shadow-color)",boxShadowColor:"colorPalette.subtle"}},"outline.solid":{value:{borderWidth:"1px",borderColor:"colorPalette.solid",color:"colorPalette.fg"}},"indicator.bottom":{value:{position:"relative","--indicator-color-fallback":"colors.colorPalette.solid",_before:{content:'""',position:"absolute",bottom:"var(--indicator-offset-y, 0)",insetInline:"var(--indicator-offset-x, 0)",height:"var(--indicator-thickness, 2px)",background:"var(--indicator-color, var(--indicator-color-fallback))"}}},"indicator.top":{value:{position:"relative","--indicator-color-fallback":"colors.colorPalette.solid",_before:{content:'""',position:"absolute",top:"var(--indicator-offset-y, 0)",insetInline:"var(--indicator-offset-x, 0)",height:"var(--indicator-thickness, 2px)",background:"var(--indicator-color, var(--indicator-color-fallback))"}}},"indicator.start":{value:{position:"relative","--indicator-color-fallback":"colors.colorPalette.solid",_before:{content:'""',position:"absolute",insetInlineStart:"var(--indicator-offset-x, 0)",insetBlock:"var(--indicator-offset-y, 0)",width:"var(--indicator-thickness, 2px)",background:"var(--indicator-color, var(--indicator-color-fallback))"}}},"indicator.end":{value:{position:"relative","--indicator-color-fallback":"colors.colorPalette.solid",_before:{content:'""',position:"absolute",insetInlineEnd:"var(--indicator-offset-x, 0)",insetBlock:"var(--indicator-offset-y, 0)",width:"var(--indicator-thickness, 2px)",background:"var(--indicator-color, var(--indicator-color-fallback))"}}},disabled:{value:{opacity:"0.5",cursor:"not-allowed"}},none:{value:{}}}),animationStyles=defineAnimationStyles({"slide-fade-in":{value:{transformOrigin:"var(--transform-origin)","&[data-placement^=top]":{animationName:"slide-from-bottom, fade-in"},"&[data-placement^=bottom]":{animationName:"slide-from-top, fade-in"},"&[data-placement^=left]":{animationName:"slide-from-right, fade-in"},"&[data-placement^=right]":{animationName:"slide-from-left, fade-in"}}},"slide-fade-out":{value:{transformOrigin:"var(--transform-origin)","&[data-placement^=top]":{animationName:"slide-to-bottom, fade-out"},"&[data-placement^=bottom]":{animationName:"slide-to-top, fade-out"},"&[data-placement^=left]":{animationName:"slide-to-right, fade-out"},"&[data-placement^=right]":{animationName:"slide-to-left, fade-out"}}},"scale-fade-in":{value:{transformOrigin:"var(--transform-origin)",animationName:"scale-in, fade-in"}},"scale-fade-out":{value:{transformOrigin:"var(--transform-origin)",animationName:"scale-out, fade-out"}}}),badgeRecipe=defineRecipe({className:"chakra-badge",base:{display:"inline-flex",alignItems:"center",borderRadius:"l2",gap:"1",fontWeight:"medium",fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap",userSelect:"none"},variants:{variant:{solid:{bg:"colorPalette.solid",color:"colorPalette.contrast"},subtle:{bg:"colorPalette.subtle",color:"colorPalette.fg"},outline:{color:"colorPalette.fg",shadow:"inset 0 0 0px 1px var(--shadow-color)",shadowColor:"colorPalette.muted"},surface:{bg:"colorPalette.subtle",color:"colorPalette.fg",shadow:"inset 0 0 0px 1px var(--shadow-color)",shadowColor:"colorPalette.muted"},plain:{color:"colorPalette.fg"}},size:{xs:{textStyle:"2xs",px:"1",minH:"4"},sm:{textStyle:"xs",px:"1.5",minH:"5"},md:{textStyle:"sm",px:"2",minH:"6"},lg:{textStyle:"sm",px:"2.5",minH:"7"}}},defaultVariants:{variant:"subtle",size:"sm"}}),buttonRecipe=defineRecipe({className:"chakra-button",base:{display:"inline-flex",appearance:"none",alignItems:"center",justifyContent:"center",userSelect:"none",position:"relative",borderRadius:"l2",whiteSpace:"nowrap",verticalAlign:"middle",borderWidth:"1px",borderColor:"transparent",cursor:"button",flexShrink:"0",outline:"0",lineHeight:"1.2",isolation:"isolate",fontWeight:"medium",transitionProperty:"common",transitionDuration:"moderate",focusVisibleRing:"outside",_disabled:{layerStyle:"disabled"},_icon:{flexShrink:"0"}},variants:{size:{"2xs":{h:"6",minW:"6",textStyle:"xs",px:"2",gap:"1",_icon:{width:"3.5",height:"3.5"}},xs:{h:"8",minW:"8",textStyle:"xs",px:"2.5",gap:"1",_icon:{width:"4",height:"4"}},sm:{h:"9",minW:"9",px:"3.5",textStyle:"sm",gap:"2",_icon:{width:"4",height:"4"}},md:{h:"10",minW:"10",textStyle:"sm",px:"4",gap:"2",_icon:{width:"5",height:"5"}},lg:{h:"11",minW:"11",textStyle:"md",px:"5",gap:"3",_icon:{width:"5",height:"5"}},xl:{h:"12",minW:"12",textStyle:"md",px:"5",gap:"2.5",_icon:{width:"5",height:"5"}},"2xl":{h:"16",minW:"16",textStyle:"lg",px:"7",gap:"3",_icon:{width:"6",height:"6"}}},variant:{solid:{bg:"colorPalette.solid",color:"colorPalette.contrast",borderColor:"transparent",_hover:{bg:"colorPalette.solid/90"},_expanded:{bg:"colorPalette.solid/90"}},subtle:{bg:"colorPalette.subtle",color:"colorPalette.fg",borderColor:"transparent",_hover:{bg:"colorPalette.muted"},_expanded:{bg:"colorPalette.muted"}},surface:{bg:"colorPalette.subtle",color:"colorPalette.fg",shadow:"0 0 0px 1px var(--shadow-color)",shadowColor:"colorPalette.muted",_hover:{bg:"colorPalette.muted"},_expanded:{bg:"colorPalette.muted"}},outline:{borderWidth:"1px",borderColor:"colorPalette.muted",color:"colorPalette.fg",_hover:{bg:"colorPalette.subtle"},_expanded:{bg:"colorPalette.subtle"}},ghost:{bg:"transparent",color:"colorPalette.fg",_hover:{bg:"colorPalette.subtle"},_expanded:{bg:"colorPalette.subtle"}},plain:{color:"colorPalette.fg"}}},defaultVariants:{size:"md",variant:"solid"}}),checkmarkRecipe=defineRecipe({className:"chakra-checkmark",base:{display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:"0",color:"white",borderWidth:"1px",borderColor:"transparent",borderRadius:"l1",focusVisibleRing:"outside",_icon:{boxSize:"full"},_invalid:{colorPalette:"red",borderColor:"border.error"},_disabled:{opacity:"0.5"}},variants:{size:{xs:{boxSize:"3"},sm:{boxSize:"4"},md:{boxSize:"5",p:"0.5"},lg:{boxSize:"6",p:"0.5"}},variant:{solid:{borderColor:"border","&:is([data-state=checked], [data-state=indeterminate])":{bg:"colorPalette.solid",color:"colorPalette.contrast",borderColor:"colorPalette.solid"}},outline:{borderColor:"border","&:is([data-state=checked], [data-state=indeterminate])":{color:"colorPalette.fg",borderColor:"colorPalette.solid"}},subtle:{bg:"colorPalette.muted",borderColor:"colorPalette.muted","&:is([data-state=checked], [data-state=indeterminate])":{color:"colorPalette.fg"}},plain:{"&:is([data-state=checked], [data-state=indeterminate])":{color:"colorPalette.fg"}},inverted:{borderColor:"border",color:"colorPalette.fg","&:is([data-state=checked], [data-state=indeterminate])":{borderColor:"colorPalette.solid"}}}},defaultVariants:{variant:"solid",size:"md"}}),{variants:variants$1,defaultVariants:defaultVariants$1}=badgeRecipe,codeRecipe=defineRecipe({className:"chakra-code",base:{fontFamily:"mono",alignItems:"center",display:"inline-flex",borderRadius:"l2"},variants:variants$1,defaultVariants:defaultVariants$1}),colorSwatchRecipe=defineRecipe({className:"color-swatch",base:{boxSize:"var(--swatch-size)",shadow:"inset 0 0 0 1px rgba(0, 0, 0, 0.1)","--checker-size":"8px","--checker-bg":"colors.bg","--checker-fg":"colors.bg.emphasized",background:"linear-gradient(var(--color), var(--color)), repeating-conic-gradient(var(--checker-fg) 0%, var(--checker-fg) 25%, var(--checker-bg) 0%, var(--checker-bg) 50%) 0% 50% / var(--checker-size) var(--checker-size) !important",display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:"0"},variants:{size:{"2xs":{"--swatch-size":"sizes.3.5"},xs:{"--swatch-size":"sizes.4"},sm:{"--swatch-size":"sizes.4.5"},md:{"--swatch-size":"sizes.5"},lg:{"--swatch-size":"sizes.6"},xl:{"--swatch-size":"sizes.7"},"2xl":{"--swatch-size":"sizes.8"},inherit:{"--swatch-size":"inherit"},full:{"--swatch-size":"100%"}},shape:{square:{borderRadius:"none"},circle:{borderRadius:"full"},rounded:{borderRadius:"l1"}}},defaultVariants:{size:"md",shape:"rounded"}}),containerRecipe=defineRecipe({className:"chakra-container",base:{position:"relative",maxWidth:"8xl",w:"100%",mx:"auto",px:{base:"4",md:"6",lg:"8"}},variants:{centerContent:{true:{display:"flex",flexDirection:"column",alignItems:"center"}},fluid:{true:{maxWidth:"full"}}}}),headingRecipe=defineRecipe({className:"chakra-heading",base:{fontFamily:"heading",fontWeight:"semibold"},variants:{size:{xs:{textStyle:"xs"},sm:{textStyle:"sm"},md:{textStyle:"md"},lg:{textStyle:"lg"},xl:{textStyle:"xl"},"2xl":{textStyle:"2xl"},"3xl":{textStyle:"3xl"},"4xl":{textStyle:"4xl"},"5xl":{textStyle:"5xl"},"6xl":{textStyle:"6xl"},"7xl":{textStyle:"7xl"}}},defaultVariants:{size:"xl"}}),iconRecipe=defineRecipe({className:"chakra-icon",base:{display:"inline-block",lineHeight:"1em",flexShrink:"0",color:"currentcolor",verticalAlign:"middle"},variants:{size:{inherit:{},xs:{boxSize:"3"},sm:{boxSize:"4"},md:{boxSize:"5"},lg:{boxSize:"6"},xl:{boxSize:"7"},"2xl":{boxSize:"8"}}},defaultVariants:{size:"inherit"}}),inputRecipe=defineRecipe({className:"chakra-input",base:{width:"100%",minWidth:"0",outline:"0",position:"relative",appearance:"none",textAlign:"start",borderRadius:"l2",_disabled:{layerStyle:"disabled"},height:"var(--input-height)",minW:"var(--input-height)","--focus-color":"colors.colorPalette.focusRing","--error-color":"colors.border.error",_invalid:{focusRingColor:"var(--error-color)",borderColor:"var(--error-color)"}},variants:{size:{"2xs":{textStyle:"xs",px:"2","--input-height":"sizes.7"},xs:{textStyle:"xs",px:"2","--input-height":"sizes.8"},sm:{textStyle:"sm",px:"2.5","--input-height":"sizes.9"},md:{textStyle:"sm",px:"3","--input-height":"sizes.10"},lg:{textStyle:"md",px:"4","--input-height":"sizes.11"},xl:{textStyle:"md",px:"4.5","--input-height":"sizes.12"},"2xl":{textStyle:"lg",px:"5","--input-height":"sizes.16"}},variant:{outline:{bg:"transparent",borderWidth:"1px",borderColor:"border",focusVisibleRing:"inside",focusRingColor:"var(--focus-color)"},subtle:{borderWidth:"1px",borderColor:"transparent",bg:"bg.muted",focusVisibleRing:"inside",focusRingColor:"var(--focus-color)"},flushed:{bg:"transparent",borderBottomWidth:"1px",borderBottomColor:"border",borderRadius:"0",px:"0",_focusVisible:{borderColor:"var(--focus-color)",boxShadow:"0px 1px 0px 0px var(--focus-color)"}}}},defaultVariants:{size:"md",variant:"outline"}}),inputAddonRecipe=defineRecipe({className:"chakra-input-addon",base:{flex:"0 0 auto",width:"auto",display:"flex",alignItems:"center",whiteSpace:"nowrap",alignSelf:"stretch",borderRadius:"l2"},variants:{size:inputRecipe.variants.size,variant:{outline:{borderWidth:"1px",borderColor:"border",bg:"bg.muted"},subtle:{borderWidth:"1px",borderColor:"transparent",bg:"bg.emphasized"},flushed:{borderBottom:"1px solid",borderColor:"inherit",borderRadius:"0",px:"0",bg:"transparent"}}},defaultVariants:{size:"md",variant:"outline"}}),kbdRecipe=defineRecipe({className:"chakra-kbd",base:{display:"inline-flex",alignItems:"center",fontWeight:"medium",fontFamily:"mono",flexShrink:"0",whiteSpace:"nowrap",wordSpacing:"-0.5em",userSelect:"none",px:"1",borderRadius:"l2"},variants:{variant:{raised:{bg:"colorPalette.subtle",color:"colorPalette.fg",borderWidth:"1px",borderBottomWidth:"2px",borderColor:"colorPalette.muted"},outline:{borderWidth:"1px",color:"colorPalette.fg"},subtle:{bg:"colorPalette.muted",color:"colorPalette.fg"},plain:{color:"colorPalette.fg"}},size:{sm:{textStyle:"xs",height:"4.5"},md:{textStyle:"sm",height:"5"},lg:{textStyle:"md",height:"6"}}},defaultVariants:{size:"md",variant:"raised"}}),linkRecipe=defineRecipe({className:"chakra-link",base:{display:"inline-flex",alignItems:"center",outline:"none",gap:"1.5",cursor:"pointer",borderRadius:"l1",focusRing:"outside"},variants:{variant:{underline:{color:"colorPalette.fg",textDecoration:"underline",textUnderlineOffset:"3px",textDecorationColor:"currentColor/20"},plain:{color:"colorPalette.fg",_hover:{textDecoration:"underline",textUnderlineOffset:"3px",textDecorationColor:"currentColor/20"}}}},defaultVariants:{variant:"plain"}}),markRecipe=defineRecipe({className:"chakra-mark",base:{bg:"transparent",color:"inherit",whiteSpace:"nowrap"},variants:{variant:{subtle:{bg:"colorPalette.subtle",color:"inherit"},solid:{bg:"colorPalette.solid",color:"colorPalette.contrast"},text:{fontWeight:"medium"},plain:{}}}}),radiomarkRecipe=defineRecipe({className:"chakra-radiomark",base:{display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,verticalAlign:"top",color:"white",borderWidth:"1px",borderColor:"transparent",borderRadius:"full",cursor:"radio",_focusVisible:{outline:"2px solid",outlineColor:"colorPalette.focusRing",outlineOffset:"2px"},_invalid:{colorPalette:"red",borderColor:"red.500"},_disabled:{opacity:"0.5",cursor:"disabled"},"& .dot":{height:"100%",width:"100%",borderRadius:"full",bg:"currentColor",scale:"0.4"}},variants:{variant:{solid:{borderWidth:"1px",borderColor:"border",_checked:{bg:"colorPalette.solid",color:"colorPalette.contrast",borderColor:"colorPalette.solid"}},subtle:{borderWidth:"1px",bg:"colorPalette.muted",borderColor:"colorPalette.muted",color:"transparent",_checked:{color:"colorPalette.fg"}},outline:{borderWidth:"1px",borderColor:"inherit",_checked:{color:"colorPalette.fg",borderColor:"colorPalette.solid"},"& .dot":{scale:"0.6"}},inverted:{bg:"bg",borderWidth:"1px",borderColor:"inherit",_checked:{color:"colorPalette.solid",borderColor:"currentcolor"}}},size:{xs:{boxSize:"3"},sm:{boxSize:"4"},md:{boxSize:"5"},lg:{boxSize:"6"}}},defaultVariants:{variant:"solid",size:"md"}}),separatorRecipe=defineRecipe({className:"chakra-separator",base:{display:"block",borderColor:"border"},variants:{variant:{solid:{borderStyle:"solid"},dashed:{borderStyle:"dashed"},dotted:{borderStyle:"dotted"}},orientation:{vertical:{borderInlineStartWidth:"var(--separator-thickness)"},horizontal:{borderTopWidth:"var(--separator-thickness)"}},size:{xs:{"--separator-thickness":"0.5px"},sm:{"--separator-thickness":"1px"},md:{"--separator-thickness":"2px"},lg:{"--separator-thickness":"3px"}}},defaultVariants:{size:"sm",variant:"solid",orientation:"horizontal"}}),skeletonRecipe=defineRecipe({className:"chakra-skeleton",base:{},variants:{loading:{true:{borderRadius:"l2",boxShadow:"none",backgroundClip:"padding-box",cursor:"default",color:"transparent",pointerEvents:"none",userSelect:"none",flexShrink:"0","&::before, &::after, *":{visibility:"hidden"}},false:{background:"unset",animation:"fade-in var(--fade-duration, 0.1s) ease-out !important"}},variant:{pulse:{background:"bg.emphasized",animation:"pulse",animationDuration:"var(--duration, 1.2s)"},shine:{"--animate-from":"200%","--animate-to":"-200%","--start-color":"colors.bg.muted","--end-color":"colors.bg.emphasized",backgroundImage:"linear-gradient(270deg,var(--start-color),var(--end-color),var(--end-color),var(--start-color))",backgroundSize:"400% 100%",animation:"bg-position var(--duration, 5s) ease-in-out infinite"},none:{animation:"none"}}},defaultVariants:{variant:"pulse",loading:!0}}),skipNavLinkRecipe=defineRecipe({className:"chakra-skip-nav",base:{display:"inline-flex",bg:"bg.panel",padding:"2.5",borderRadius:"l2",fontWeight:"semibold",focusVisibleRing:"outside",textStyle:"sm",userSelect:"none",border:"0",height:"1px",width:"1px",margin:"-1px",outline:"0",overflow:"hidden",position:"absolute",clip:"rect(0 0 0 0)",_focusVisible:{clip:"auto",width:"auto",height:"auto",position:"fixed",top:"6",insetStart:"6"}}}),spinnerRecipe=defineRecipe({className:"chakra-spinner",base:{display:"inline-block",borderColor:"currentColor",borderStyle:"solid",borderWidth:"2px",borderRadius:"full",width:"var(--spinner-size)",height:"var(--spinner-size)",animation:"spin",animationDuration:"slowest","--spinner-track-color":"transparent",borderBottomColor:"var(--spinner-track-color)",borderInlineStartColor:"var(--spinner-track-color)"},variants:{size:{inherit:{"--spinner-size":"1em"},xs:{"--spinner-size":"sizes.3"},sm:{"--spinner-size":"sizes.4"},md:{"--spinner-size":"sizes.5"},lg:{"--spinner-size":"sizes.8"},xl:{"--spinner-size":"sizes.10"}}},defaultVariants:{size:"md"}}),textareaRecipe=defineRecipe({className:"chakra-textarea",base:{width:"100%",minWidth:"0",outline:"0",position:"relative",appearance:"none",textAlign:"start",borderRadius:"l2",_disabled:{layerStyle:"disabled"},"--focus-color":"colors.colorPalette.focusRing","--error-color":"colors.border.error",_invalid:{focusRingColor:"var(--error-color)",borderColor:"var(--error-color)"}},variants:{size:{xs:{textStyle:"xs",px:"2",py:"1.5",scrollPaddingBottom:"1.5"},sm:{textStyle:"sm",px:"2.5",py:"2",scrollPaddingBottom:"2"},md:{textStyle:"sm",px:"3",py:"2",scrollPaddingBottom:"2"},lg:{textStyle:"md",px:"4",py:"3",scrollPaddingBottom:"3"},xl:{textStyle:"md",px:"4.5",py:"3.5",scrollPaddingBottom:"3.5"}},variant:{outline:{bg:"transparent",borderWidth:"1px",borderColor:"border",focusVisibleRing:"inside"},subtle:{borderWidth:"1px",borderColor:"transparent",bg:"bg.muted",focusVisibleRing:"inside"},flushed:{bg:"transparent",borderBottomWidth:"1px",borderBottomColor:"border",borderRadius:"0",px:"0",_focusVisible:{borderColor:"var(--focus-color)",boxShadow:"0px 1px 0px 0px var(--focus-color)"}}}},defaultVariants:{size:"md",variant:"outline"}}),recipes={badge:badgeRecipe,button:buttonRecipe,code:codeRecipe,container:containerRecipe,heading:headingRecipe,input:inputRecipe,inputAddon:inputAddonRecipe,kbd:kbdRecipe,link:linkRecipe,mark:markRecipe,separator:separatorRecipe,skeleton:skeletonRecipe,skipNavLink:skipNavLinkRecipe,spinner:spinnerRecipe,textarea:textareaRecipe,icon:iconRecipe,checkmark:checkmarkRecipe,radiomark:radiomarkRecipe,colorSwatch:colorSwatchRecipe},semanticColors=defineSemanticTokens.colors({bg:{DEFAULT:{value:{_light:"{colors.white}",_dark:"{colors.black}"}},subtle:{value:{_light:"{colors.gray.50}",_dark:"{colors.gray.950}"}},muted:{value:{_light:"{colors.gray.100}",_dark:"{colors.gray.900}"}},emphasized:{value:{_light:"{colors.gray.200}",_dark:"{colors.gray.800}"}},inverted:{value:{_light:"{colors.black}",_dark:"{colors.white}"}},panel:{value:{_light:"{colors.white}",_dark:"{colors.gray.950}"}},error:{value:{_light:"{colors.red.50}",_dark:"{colors.red.950}"}},warning:{value:{_light:"{colors.orange.50}",_dark:"{colors.orange.950}"}},success:{value:{_light:"{colors.green.50}",_dark:"{colors.green.950}"}},info:{value:{_light:"{colors.blue.50}",_dark:"{colors.blue.950}"}}},fg:{DEFAULT:{value:{_light:"{colors.black}",_dark:"{colors.gray.50}"}},muted:{value:{_light:"{colors.gray.600}",_dark:"{colors.gray.400}"}},subtle:{value:{_light:"{colors.gray.400}",_dark:"{colors.gray.500}"}},inverted:{value:{_light:"{colors.gray.50}",_dark:"{colors.black}"}},error:{value:{_light:"{colors.red.500}",_dark:"{colors.red.400}"}},warning:{value:{_light:"{colors.orange.600}",_dark:"{colors.orange.300}"}},success:{value:{_light:"{colors.green.600}",_dark:"{colors.green.300}"}},info:{value:{_light:"{colors.blue.600}",_dark:"{colors.blue.300}"}}},border:{DEFAULT:{value:{_light:"{colors.gray.200}",_dark:"{colors.gray.800}"}},muted:{value:{_light:"{colors.gray.100}",_dark:"{colors.gray.900}"}},subtle:{value:{_light:"{colors.gray.50}",_dark:"{colors.gray.950}"}},emphasized:{value:{_light:"{colors.gray.300}",_dark:"{colors.gray.700}"}},inverted:{value:{_light:"{colors.gray.800}",_dark:"{colors.gray.200}"}},error:{value:{_light:"{colors.red.500}",_dark:"{colors.red.400}"}},warning:{value:{_light:"{colors.orange.500}",_dark:"{colors.orange.400}"}},success:{value:{_light:"{colors.green.500}",_dark:"{colors.green.400}"}},info:{value:{_light:"{colors.blue.500}",_dark:"{colors.blue.400}"}}},gray:{contrast:{value:{_light:"{colors.white}",_dark:"{colors.black}"}},fg:{value:{_light:"{colors.gray.800}",_dark:"{colors.gray.200}"}},subtle:{value:{_light:"{colors.gray.100}",_dark:"{colors.gray.900}"}},muted:{value:{_light:"{colors.gray.200}",_dark:"{colors.gray.800}"}},emphasized:{value:{_light:"{colors.gray.300}",_dark:"{colors.gray.700}"}},solid:{value:{_light:"{colors.gray.900}",_dark:"{colors.white}"}},focusRing:{value:{_light:"{colors.gray.400}",_dark:"{colors.gray.400}"}}},red:{contrast:{value:{_light:"white",_dark:"white"}},fg:{value:{_light:"{colors.red.700}",_dark:"{colors.red.300}"}},subtle:{value:{_light:"{colors.red.100}",_dark:"{colors.red.900}"}},muted:{value:{_light:"{colors.red.200}",_dark:"{colors.red.800}"}},emphasized:{value:{_light:"{colors.red.300}",_dark:"{colors.red.700}"}},solid:{value:{_light:"{colors.red.600}",_dark:"{colors.red.600}"}},focusRing:{value:{_light:"{colors.red.400}",_dark:"{colors.red.400}"}}},orange:{contrast:{value:{_light:"white",_dark:"black"}},fg:{value:{_light:"{colors.orange.700}",_dark:"{colors.orange.300}"}},subtle:{value:{_light:"{colors.orange.100}",_dark:"{colors.orange.900}"}},muted:{value:{_light:"{colors.orange.200}",_dark:"{colors.orange.800}"}},emphasized:{value:{_light:"{colors.orange.300}",_dark:"{colors.orange.700}"}},solid:{value:{_light:"{colors.orange.600}",_dark:"{colors.orange.500}"}},focusRing:{value:{_light:"{colors.orange.400}",_dark:"{colors.orange.400}"}}},green:{contrast:{value:{_light:"white",_dark:"white"}},fg:{value:{_light:"{colors.green.700}",_dark:"{colors.green.300}"}},subtle:{value:{_light:"{colors.green.100}",_dark:"{colors.green.900}"}},muted:{value:{_light:"{colors.green.200}",_dark:"{colors.green.800}"}},emphasized:{value:{_light:"{colors.green.300}",_dark:"{colors.green.700}"}},solid:{value:{_light:"{colors.green.600}",_dark:"{colors.green.600}"}},focusRing:{value:{_light:"{colors.green.400}",_dark:"{colors.green.400}"}}},blue:{contrast:{value:{_light:"white",_dark:"white"}},fg:{value:{_light:"{colors.blue.700}",_dark:"{colors.blue.300}"}},subtle:{value:{_light:"{colors.blue.100}",_dark:"{colors.blue.900}"}},muted:{value:{_light:"{colors.blue.200}",_dark:"{colors.blue.800}"}},emphasized:{value:{_light:"{colors.blue.300}",_dark:"{colors.blue.700}"}},solid:{value:{_light:"{colors.blue.600}",_dark:"{colors.blue.600}"}},focusRing:{value:{_light:"{colors.blue.400}",_dark:"{colors.blue.400}"}}},yellow:{contrast:{value:{_light:"black",_dark:"black"}},fg:{value:{_light:"{colors.yellow.800}",_dark:"{colors.yellow.300}"}},subtle:{value:{_light:"{colors.yellow.100}",_dark:"{colors.yellow.900}"}},muted:{value:{_light:"{colors.yellow.200}",_dark:"{colors.yellow.800}"}},emphasized:{value:{_light:"{colors.yellow.300}",_dark:"{colors.yellow.700}"}},solid:{value:{_light:"{colors.yellow.300}",_dark:"{colors.yellow.300}"}},focusRing:{value:{_light:"{colors.yellow.400}",_dark:"{colors.yellow.400}"}}},teal:{contrast:{value:{_light:"white",_dark:"white"}},fg:{value:{_light:"{colors.teal.700}",_dark:"{colors.teal.300}"}},subtle:{value:{_light:"{colors.teal.100}",_dark:"{colors.teal.900}"}},muted:{value:{_light:"{colors.teal.200}",_dark:"{colors.teal.800}"}},emphasized:{value:{_light:"{colors.teal.300}",_dark:"{colors.teal.700}"}},solid:{value:{_light:"{colors.teal.600}",_dark:"{colors.teal.600}"}},focusRing:{value:{_light:"{colors.teal.400}",_dark:"{colors.teal.400}"}}},purple:{contrast:{value:{_light:"white",_dark:"white"}},fg:{value:{_light:"{colors.purple.700}",_dark:"{colors.purple.300}"}},subtle:{value:{_light:"{colors.purple.100}",_dark:"{colors.purple.900}"}},muted:{value:{_light:"{colors.purple.200}",_dark:"{colors.purple.800}"}},emphasized:{value:{_light:"{colors.purple.300}",_dark:"{colors.purple.700}"}},solid:{value:{_light:"{colors.purple.600}",_dark:"{colors.purple.600}"}},focusRing:{value:{_light:"{colors.purple.400}",_dark:"{colors.purple.400}"}}},pink:{contrast:{value:{_light:"white",_dark:"white"}},fg:{value:{_light:"{colors.pink.700}",_dark:"{colors.pink.300}"}},subtle:{value:{_light:"{colors.pink.100}",_dark:"{colors.pink.900}"}},muted:{value:{_light:"{colors.pink.200}",_dark:"{colors.pink.800}"}},emphasized:{value:{_light:"{colors.pink.300}",_dark:"{colors.pink.700}"}},solid:{value:{_light:"{colors.pink.600}",_dark:"{colors.pink.600}"}},focusRing:{value:{_light:"{colors.pink.400}",_dark:"{colors.pink.400}"}}},cyan:{contrast:{value:{_light:"white",_dark:"white"}},fg:{value:{_light:"{colors.cyan.700}",_dark:"{colors.cyan.300}"}},subtle:{value:{_light:"{colors.cyan.100}",_dark:"{colors.cyan.900}"}},muted:{value:{_light:"{colors.cyan.200}",_dark:"{colors.cyan.800}"}},emphasized:{value:{_light:"{colors.cyan.300}",_dark:"{colors.cyan.700}"}},solid:{value:{_light:"{colors.cyan.600}",_dark:"{colors.cyan.600}"}},focusRing:{value:{_light:"{colors.cyan.400}",_dark:"{colors.cyan.400}"}}}}),semanticRadii=defineSemanticTokens.radii({l1:{value:"{radii.xs}"},l2:{value:"{radii.sm}"},l3:{value:"{radii.md}"}}),semanticShadows=defineSemanticTokens.shadows({xs:{value:{_light:"0px 1px 2px {colors.gray.900/10}, 0px 0px 1px {colors.gray.900/20}",_dark:"0px 1px 1px {black/64}, 0px 0px 1px inset {colors.gray.300/20}"}},sm:{value:{_light:"0px 2px 4px {colors.gray.900/10}, 0px 0px 1px {colors.gray.900/30}",_dark:"0px 2px 4px {black/64}, 0px 0px 1px inset {colors.gray.300/30}"}},md:{value:{_light:"0px 4px 8px {colors.gray.900/10}, 0px 0px 1px {colors.gray.900/30}",_dark:"0px 4px 8px {black/64}, 0px 0px 1px inset {colors.gray.300/30}"}},lg:{value:{_light:"0px 8px 16px {colors.gray.900/10}, 0px 0px 1px {colors.gray.900/30}",_dark:"0px 8px 16px {black/64}, 0px 0px 1px inset {colors.gray.300/30}"}},xl:{value:{_light:"0px 16px 24px {colors.gray.900/10}, 0px 0px 1px {colors.gray.900/30}",_dark:"0px 16px 24px {black/64}, 0px 0px 1px inset {colors.gray.300/30}"}},"2xl":{value:{_light:"0px 24px 40px {colors.gray.900/16}, 0px 0px 1px {colors.gray.900/30}",_dark:"0px 24px 40px {black/64}, 0px 0px 1px inset {colors.gray.300/30}"}},inner:{value:{_light:"inset 0 2px 4px 0 {black/5}",_dark:"inset 0 2px 4px 0 black"}},inset:{value:{_light:"inset 0 0 0 1px {black/5}",_dark:"inset 0 0 0 1px {colors.gray.300/5}"}}}),accordionAnatomy=anatomy$l.extendWith("itemBody"),actionBarAnatomy=createAnatomy("action-bar").parts("positioner","content","separator","selectionTrigger","closeTrigger"),alertAnatomy=createAnatomy("alert").parts("title","description","root","indicator","content"),breadcrumbAnatomy=createAnatomy("breadcrumb").parts("link","currentLink","item","list","root","ellipsis","separator"),blockquoteAnatomy=createAnatomy("blockquote").parts("root","icon","content","caption"),cardAnatomy=createAnatomy("card").parts("root","header","body","footer","title","description"),checkboxCardAnatomy=createAnatomy("checkbox-card",["root","control","label","description","addon","indicator","content"]),dataListAnatomy=createAnatomy("data-list").parts("root","item","itemLabel","itemValue"),dialogAnatomy=anatomy$h.extendWith("header","body","footer","backdrop"),drawerAnatomy=anatomy$h.extendWith("header","body","footer","backdrop"),editableAnatomy=anatomy$g.extendWith("textarea"),emptyStateAnatomy=createAnatomy("empty-state",["root","content","indicator","title","description"]),fieldAnatomy=fieldAnatomy$1.extendWith("requiredIndicator"),fieldsetAnatomy=fieldsetAnatomy$1.extendWith("content"),fileUploadAnatomy=anatomy$f.extendWith("itemContent","dropzoneContent","fileText"),listAnatomy=createAnatomy("list").parts("root","item","indicator"),menuAnatomy=anatomy$d.extendWith("itemCommand"),nativeSelectAnatomy=createAnatomy("select").parts("root","field","indicator"),popoverAnatomy=anatomy$a.extendWith("header","body","footer"),radioGroupAnatomy=anatomy$7.extendWith("itemAddon","itemIndicator"),radioCardAnatomy=radioGroupAnatomy.extendWith("itemContent","itemDescription"),ratingGroupAnatomy=anatomy$6.extendWith("itemIndicator"),selectAnatomy=anatomy$5.extendWith("indicatorGroup"),sliderAnatomy=anatomy$4.extendWith("markerIndicator"),statAnatomy=createAnatomy("stat").parts("root","label","helpText","valueText","valueUnit","indicator"),statusAnatomy=createAnatomy("status").parts("root","indicator"),stepsAnatomy=createAnatomy("steps",["root","list","item","trigger","indicator","separator","content","title","description","nextTrigger","prevTrigger","progress"]),switchAnatomy=anatomy$3.extendWith("indicator"),tableAnatomy=createAnatomy("table").parts("root","header","body","row","columnHeader","cell","footer","caption"),toastAnatomy=createAnatomy("toast").parts("root","title","description","indicator","closeTrigger","actionTrigger"),tabsAnatomy=createAnatomy("tabs").parts("root","trigger","list","content","contentGroup","indicator"),tagAnatomy=createAnatomy("tag").parts("root","label","closeTrigger","startElement","endElement"),timelineAnatomy=createAnatomy("timeline").parts("root","item","content","separator","indicator","connector","title","description"),colorPickerAnatomy=colorPickerAnatomy$1.extendWith("channelText"),accordionSlotRecipe=defineSlotRecipe({className:"chakra-accordion",slots:accordionAnatomy.keys(),base:{root:{width:"full","--accordion-radius":"radii.l2"},item:{overflowAnchor:"none"},itemTrigger:{display:"flex",alignItems:"center",textAlign:"start",width:"full",outline:"0",gap:"3",fontWeight:"medium",borderRadius:"var(--accordion-radius)",_focusVisible:{outline:"2px solid",outlineColor:"colorPalette.focusRing"},_disabled:{layerStyle:"disabled"}},itemBody:{pt:"var(--accordion-padding-y)",pb:"calc(var(--accordion-padding-y) * 2)"},itemContent:{overflow:"hidden",borderRadius:"var(--accordion-radius)",_open:{animationName:"expand-height, fade-in",animationDuration:"moderate"},_closed:{animationName:"collapse-height, fade-out",animationDuration:"moderate"}},itemIndicator:{transition:"rotate 0.2s",transformOrigin:"center",color:"fg.subtle",_open:{rotate:"180deg"},_icon:{width:"1.2em",height:"1.2em"}}},variants:{variant:{outline:{item:{borderBottomWidth:"1px"}},subtle:{itemTrigger:{px:"var(--accordion-padding-x)"},itemContent:{px:"var(--accordion-padding-x)"},item:{borderRadius:"var(--accordion-radius)",_open:{bg:"colorPalette.subtle"}}},enclosed:{root:{borderWidth:"1px",borderRadius:"var(--accordion-radius)",divideY:"1px",overflow:"hidden"},itemTrigger:{px:"var(--accordion-padding-x)"},itemContent:{px:"var(--accordion-padding-x)"},item:{_open:{bg:"bg.subtle"}}},plain:{}},size:{sm:{root:{"--accordion-padding-x":"spacing.3","--accordion-padding-y":"spacing.2"},itemTrigger:{textStyle:"sm",py:"var(--accordion-padding-y)"}},md:{root:{"--accordion-padding-x":"spacing.4","--accordion-padding-y":"spacing.2"},itemTrigger:{textStyle:"md",py:"var(--accordion-padding-y)"}},lg:{root:{"--accordion-padding-x":"spacing.4.5","--accordion-padding-y":"spacing.2.5"},itemTrigger:{textStyle:"lg",py:"var(--accordion-padding-y)"}}}},defaultVariants:{size:"md",variant:"outline"}}),actionBarSlotRecipe=defineSlotRecipe({className:"chakra-action-bar",slots:actionBarAnatomy.keys(),base:{positioner:{position:"fixed",display:"flex",justifyContent:"center",pointerEvents:"none",insetInline:"0",top:"unset",bottom:"calc(env(safe-area-inset-bottom) + 20px)"},content:{bg:"bg.panel",shadow:"md",display:"flex",alignItems:"center",gap:"3",borderRadius:"l3",py:"2.5",px:"3",pointerEvents:"auto",translate:"calc(-1 * var(--scrollbar-width) / 2) 0px",_open:{animationName:"slide-from-bottom, fade-in",animationDuration:"moderate"},_closed:{animationName:"slide-to-bottom, fade-out",animationDuration:"faster"}},separator:{width:"1px",height:"5",bg:"border"},selectionTrigger:{display:"inline-flex",alignItems:"center",gap:"2",alignSelf:"stretch",textStyle:"sm",px:"4",py:"1",borderRadius:"l2",borderWidth:"1px",borderStyle:"dashed"}}}),alertSlotRecipe=defineSlotRecipe({slots:alertAnatomy.keys(),className:"chakra-alert",base:{root:{width:"full",display:"flex",alignItems:"flex-start",position:"relative",borderRadius:"l3"},title:{fontWeight:"medium"},description:{display:"inline"},indicator:{display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:"0",width:"1em",height:"1em",_icon:{boxSize:"full"}},content:{display:"flex",flex:"1",gap:"1"}},variants:{status:{info:{root:{colorPalette:"blue"}},warning:{root:{colorPalette:"orange"}},success:{root:{colorPalette:"green"}},error:{root:{colorPalette:"red"}},neutral:{root:{colorPalette:"gray"}}},inline:{true:{content:{display:"inline-flex",flexDirection:"row",alignItems:"center"}},false:{content:{display:"flex",flexDirection:"column"}}},variant:{subtle:{root:{bg:"colorPalette.subtle",color:"colorPalette.fg"}},surface:{root:{bg:"colorPalette.subtle",color:"colorPalette.fg",shadow:"inset 0 0 0px 1px var(--shadow-color)",shadowColor:"colorPalette.muted"},indicator:{color:"colorPalette.fg"}},outline:{root:{color:"colorPalette.fg",shadow:"inset 0 0 0px 1px var(--shadow-color)",shadowColor:"colorPalette.muted"},indicator:{color:"colorPalette.fg"}},solid:{root:{bg:"colorPalette.solid",color:"colorPalette.contrast"},indicator:{color:"colorPalette.contrast"}}},size:{sm:{root:{gap:"2",px:"3",py:"3",textStyle:"xs"},indicator:{textStyle:"lg"}},md:{root:{gap:"3",px:"4",py:"4",textStyle:"sm"},indicator:{textStyle:"xl"}},lg:{root:{gap:"3",px:"4",py:"4",textStyle:"md"},indicator:{textStyle:"2xl"}}}},defaultVariants:{status:"info",variant:"subtle",size:"md",inline:!1}}),avatarSlotRecipe=defineSlotRecipe({slots:anatomy$k.keys(),className:"chakra-avatar",base:{root:{display:"inline-flex",alignItems:"center",justifyContent:"center",fontWeight:"medium",position:"relative",verticalAlign:"top",flexShrink:"0",userSelect:"none",width:"var(--avatar-size)",height:"var(--avatar-size)",fontSize:"var(--avatar-font-size)",borderRadius:"var(--avatar-radius)","&[data-group-item]":{borderWidth:"2px",borderColor:"bg"}},image:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"var(--avatar-radius)"},fallback:{lineHeight:"1",textTransform:"uppercase",fontWeight:"medium",fontSize:"var(--avatar-font-size)",borderRadius:"var(--avatar-radius)"}},variants:{size:{full:{root:{"--avatar-size":"100%","--avatar-font-size":"100%"}},"2xs":{root:{"--avatar-font-size":"fontSizes.2xs","--avatar-size":"sizes.6"}},xs:{root:{"--avatar-font-size":"fontSizes.xs","--avatar-size":"sizes.8"}},sm:{root:{"--avatar-font-size":"fontSizes.sm","--avatar-size":"sizes.9"}},md:{root:{"--avatar-font-size":"fontSizes.md","--avatar-size":"sizes.10"}},lg:{root:{"--avatar-font-size":"fontSizes.md","--avatar-size":"sizes.11"}},xl:{root:{"--avatar-font-size":"fontSizes.lg","--avatar-size":"sizes.12"}},"2xl":{root:{"--avatar-font-size":"fontSizes.xl","--avatar-size":"sizes.16"}}},variant:{solid:{root:{bg:"colorPalette.solid",color:"colorPalette.contrast"}},subtle:{root:{bg:"colorPalette.muted",color:"colorPalette.fg"}},outline:{root:{color:"colorPalette.fg",borderWidth:"1px",borderColor:"colorPalette.muted"}}},shape:{square:{},rounded:{root:{"--avatar-radius":"radii.l3"}},full:{root:{"--avatar-radius":"radii.full"}}},borderless:{true:{root:{"&[data-group-item]":{borderWidth:"0px"}}}}},defaultVariants:{size:"md",shape:"full",variant:"subtle"}}),blockquoteSlotRecipe=defineSlotRecipe({className:"chakra-blockquote",slots:blockquoteAnatomy.keys(),base:{root:{position:"relative",display:"flex",flexDirection:"column",gap:"2"},caption:{textStyle:"sm",color:"fg.muted"},icon:{boxSize:"5"}},variants:{justify:{start:{root:{alignItems:"flex-start",textAlign:"start"}},center:{root:{alignItems:"center",textAlign:"center"}},end:{root:{alignItems:"flex-end",textAlign:"end"}}},variant:{subtle:{root:{paddingX:"5",borderStartWidth:"4px",borderStartColor:"colorPalette.muted"},icon:{color:"colorPalette.fg"}},solid:{root:{paddingX:"5",borderStartWidth:"4px",borderStartColor:"colorPalette.solid"},icon:{color:"colorPalette.solid"}},plain:{root:{paddingX:"5"},icon:{color:"colorPalette.solid"}}}},defaultVariants:{variant:"subtle",justify:"start"}}),breadcrumbSlotRecipe=defineSlotRecipe({className:"chakra-breadcrumb",slots:breadcrumbAnatomy.keys(),base:{list:{display:"flex",alignItems:"center",wordBreak:"break-word",color:"fg.muted",listStyle:"none"},link:{outline:"0",textDecoration:"none",borderRadius:"l1",focusRing:"outside",display:"inline-flex",alignItems:"center",gap:"2"},item:{display:"inline-flex",alignItems:"center"},separator:{color:"fg.muted",opacity:"0.8",_icon:{boxSize:"1em"},_rtl:{rotate:"180deg"}},ellipsis:{display:"inline-flex",alignItems:"center",justifyContent:"center",_icon:{boxSize:"1em"}}},variants:{variant:{underline:{link:{color:"colorPalette.fg",textDecoration:"underline",textUnderlineOffset:"0.2em",textDecorationColor:"colorPalette.muted"},currentLink:{color:"colorPalette.fg"}},plain:{link:{color:"fg.muted",_hover:{color:"fg"}},currentLink:{color:"fg"}}},size:{sm:{list:{gap:"1",textStyle:"xs"}},md:{list:{gap:"1.5",textStyle:"sm"}},lg:{list:{gap:"2",textStyle:"md"}}}},defaultVariants:{variant:"plain",size:"md"}}),cardSlotRecipe=defineSlotRecipe({className:"chakra-card",slots:cardAnatomy.keys(),base:{root:{display:"flex",flexDirection:"column",position:"relative",minWidth:"0",wordWrap:"break-word",borderRadius:"l3",color:"fg",textAlign:"start"},title:{fontWeight:"semibold"},description:{color:"fg.muted",fontSize:"sm"},header:{paddingInline:"var(--card-padding)",paddingTop:"var(--card-padding)",display:"flex",flexDirection:"column",gap:"1.5"},body:{padding:"var(--card-padding)",flex:"1",display:"flex",flexDirection:"column"},footer:{display:"flex",alignItems:"center",gap:"2",paddingInline:"var(--card-padding)",paddingBottom:"var(--card-padding)"}},variants:{size:{sm:{root:{"--card-padding":"spacing.4"},title:{textStyle:"md"}},md:{root:{"--card-padding":"spacing.6"},title:{textStyle:"lg"}},lg:{root:{"--card-padding":"spacing.7"},title:{textStyle:"xl"}}},variant:{elevated:{root:{bg:"bg.panel",boxShadow:"md"}},outline:{root:{bg:"bg.panel",borderWidth:"1px",borderColor:"border"}},subtle:{root:{bg:"bg.muted"}}}},defaultVariants:{variant:"outline",size:"md"}});var fo,ho,go,mo,yo,bo,vo,xo,_o,wo,So,Eo,Co,To;const checkboxSlotRecipe=defineSlotRecipe({slots:checkboxAnatomy.keys(),className:"chakra-checkbox",base:{root:{display:"inline-flex",gap:"2",alignItems:"center",verticalAlign:"top",position:"relative"},control:checkmarkRecipe.base,label:{fontWeight:"medium",userSelect:"none",_disabled:{opacity:"0.5"}}},variants:{size:{xs:{root:{gap:"1.5"},label:{textStyle:"xs"},control:(ho=(fo=checkmarkRecipe.variants)==null?void 0:fo.size)==null?void 0:ho.xs},sm:{root:{gap:"2"},label:{textStyle:"sm"},control:(mo=(go=checkmarkRecipe.variants)==null?void 0:go.size)==null?void 0:mo.sm},md:{root:{gap:"2.5"},label:{textStyle:"sm"},control:(bo=(yo=checkmarkRecipe.variants)==null?void 0:yo.size)==null?void 0:bo.md},lg:{root:{gap:"3"},label:{textStyle:"md"},control:(xo=(vo=checkmarkRecipe.variants)==null?void 0:vo.size)==null?void 0:xo.lg}},variant:{outline:{control:(wo=(_o=checkmarkRecipe.variants)==null?void 0:_o.variant)==null?void 0:wo.outline},solid:{control:(Eo=(So=checkmarkRecipe.variants)==null?void 0:So.variant)==null?void 0:Eo.solid},subtle:{control:(To=(Co=checkmarkRecipe.variants)==null?void 0:Co.variant)==null?void 0:To.subtle}}},defaultVariants:{variant:"solid",size:"md"}});var Po,Io,ko,Oo,Ro,Ao,$o;const checkboxCardSlotRecipe=defineSlotRecipe({slots:checkboxCardAnatomy.keys(),className:"chakra-checkbox-card",base:{root:{display:"flex",flexDirection:"column",userSelect:"none",position:"relative",borderRadius:"l2",flex:"1",focusVisibleRing:"outside",_disabled:{opacity:"0.8"},_invalid:{outline:"2px solid",outlineColor:"border.error"}},control:{display:"inline-flex",flex:"1",position:"relative",borderRadius:"inherit",justifyContent:"var(--checkbox-card-justify)",alignItems:"var(--checkbox-card-align)"},label:{fontWeight:"medium",display:"flex",alignItems:"center",gap:"2",flex:"1",_disabled:{opacity:"0.5"}},description:{opacity:"0.64",textStyle:"sm",_disabled:{opacity:"0.5"}},addon:{_disabled:{opacity:"0.5"}},indicator:checkmarkRecipe.base,content:{display:"flex",flexDirection:"column",flex:"1",gap:"1",justifyContent:"var(--checkbox-card-justify)",alignItems:"var(--checkbox-card-align)"}},variants:{size:{sm:{root:{textStyle:"sm"},control:{padding:"3",gap:"1.5"},addon:{px:"3",py:"1.5",borderTopWidth:"1px"},indicator:(Po=checkmarkRecipe.variants)==null?void 0:Po.size.sm},md:{root:{textStyle:"sm"},control:{padding:"4",gap:"2.5"},addon:{px:"4",py:"2",borderTopWidth:"1px"},indicator:(Io=checkmarkRecipe.variants)==null?void 0:Io.size.md},lg:{root:{textStyle:"md"},control:{padding:"4",gap:"3.5"},addon:{px:"4",py:"2",borderTopWidth:"1px"},indicator:(ko=checkmarkRecipe.variants)==null?void 0:ko.size.lg}},variant:{surface:{root:{borderWidth:"1px",borderColor:"border",_checked:{bg:"colorPalette.subtle",color:"colorPalette.fg",borderColor:"colorPalette.muted"},_disabled:{bg:"bg.muted"}},indicator:(Oo=checkmarkRecipe.variants)==null?void 0:Oo.variant.solid},subtle:{root:{bg:"bg.muted"},control:{_checked:{bg:"colorPalette.muted",color:"colorPalette.fg"}},indicator:(Ro=checkmarkRecipe.variants)==null?void 0:Ro.variant.plain},outline:{root:{borderWidth:"1px",borderColor:"border",_checked:{boxShadow:"0 0 0 1px var(--shadow-color)",boxShadowColor:"colorPalette.solid",borderColor:"colorPalette.solid"}},indicator:(Ao=checkmarkRecipe.variants)==null?void 0:Ao.variant.solid},solid:{root:{borderWidth:"1px",_checked:{bg:"colorPalette.solid",color:"colorPalette.contrast",borderColor:"colorPalette.solid"}},indicator:($o=checkmarkRecipe.variants)==null?void 0:$o.variant.inverted}},justify:{start:{root:{"--checkbox-card-justify":"flex-start"}},end:{root:{"--checkbox-card-justify":"flex-end"}},center:{root:{"--checkbox-card-justify":"center"}}},align:{start:{root:{"--checkbox-card-align":"flex-start"},content:{textAlign:"start"}},end:{root:{"--checkbox-card-align":"flex-end"},content:{textAlign:"end"}},center:{root:{"--checkbox-card-align":"center"},content:{textAlign:"center"}}},orientation:{vertical:{control:{flexDirection:"column"}},horizontal:{control:{flexDirection:"row"}}}},defaultVariants:{size:"md",variant:"outline",align:"start",orientation:"horizontal"}}),collapsibleSlotRecipe=defineSlotRecipe({slots:anatomy$n.keys(),className:"chakra-collapsible",base:{content:{overflow:"hidden",_open:{animationName:"expand-height, fade-in",animationDuration:"moderate"},_closed:{animationName:"collapse-height, fade-out",animationDuration:"moderate"}}}});var Mo,Do,Lo,jo,No,Fo,Bo,Vo,zo,Uo,Wo,Ho,Go,Yo,Xo,Ko,qo,Jo;const colorPickerSlotRecipe=defineSlotRecipe({className:"colorPicker",slots:colorPickerAnatomy.keys(),base:{root:{display:"flex",flexDirection:"column",gap:"1.5"},label:{color:"fg",fontWeight:"medium",textStyle:"sm",_disabled:{opacity:"0.5"}},valueText:{textAlign:"start"},control:{display:"flex",alignItems:"center",flexDirection:"row",gap:"2",position:"relative"},swatchTrigger:{display:"flex",alignItems:"center",justifyContent:"center"},trigger:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"row",flexShrink:"0",gap:"2",textStyle:"sm",minH:"var(--input-height)",minW:"var(--input-height)",px:"1",rounded:"l2",_disabled:{opacity:"0.5"},"--focus-color":"colors.colorPalette.focusRing","&:focus-visible":{borderColor:"var(--focus-color)",outline:"1px solid var(--focus-color)"},"&[data-fit-content]":{"--input-height":"unset",px:"0",border:"0"}},content:{display:"flex",flexDirection:"column",bg:"bg.panel",borderRadius:"l3",boxShadow:"lg",width:"64",p:"4",gap:"3",zIndex:"dropdown",_open:{animationStyle:"slide-fade-in",animationDuration:"fast"},_closed:{animationStyle:"slide-fade-out",animationDuration:"faster"}},area:{height:"180px",borderRadius:"l2",overflow:"hidden"},areaThumb:{borderRadius:"full",height:"var(--thumb-size)",width:"var(--thumb-size)",borderWidth:"2px",borderColor:"white",shadow:"sm",focusVisibleRing:"mixed",focusRingColor:"white"},areaBackground:{height:"full"},channelSlider:{borderRadius:"l2",flex:"1"},channelSliderTrack:{height:"var(--slider-height)",borderRadius:"inherit",boxShadow:"inset 0 0 0 1px rgba(0,0,0,0.1)"},channelText:{textStyle:"xs",color:"fg.muted",fontWeight:"medium",textTransform:"capitalize"},swatchGroup:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"2"},swatch:{...colorSwatchRecipe.base,borderRadius:"l1"},swatchIndicator:{color:"white",rounded:"full"},channelSliderThumb:{borderRadius:"full",height:"var(--thumb-size)",width:"var(--thumb-size)",borderWidth:"2px",borderColor:"white",shadow:"sm",transform:"translate(-50%, -50%)",focusVisibleRing:"outside",focusRingOffset:"1px"},channelInput:{...inputRecipe.base,"&::-webkit-inner-spin-button, &::-webkit-outer-spin-button":{WebkitAppearance:"none",margin:0}},formatSelect:{textStyle:"xs",textTransform:"uppercase",borderWidth:"1px",minH:"6",focusRing:"inside",rounded:"l2"},transparencyGrid:{borderRadius:"l2"},view:{display:"flex",flexDirection:"column",gap:"2"}},variants:{size:{"2xs":{channelInput:(Do=(Mo=inputRecipe.variants)==null?void 0:Mo.size)==null?void 0:Do["2xs"],swatch:{"--swatch-size":"sizes.4.5"},trigger:{"--input-height":"sizes.7"},area:{"--thumb-size":"sizes.3"},channelSlider:{"--slider-height":"sizes.3","--thumb-size":"sizes.3"}},xs:{channelInput:(jo=(Lo=inputRecipe.variants)==null?void 0:Lo.size)==null?void 0:jo.xs,swatch:{"--swatch-size":"sizes.5"},trigger:{"--input-height":"sizes.8"},area:{"--thumb-size":"sizes.3.5"},channelSlider:{"--slider-height":"sizes.3.5","--thumb-size":"sizes.3.5"}},sm:{channelInput:(Fo=(No=inputRecipe.variants)==null?void 0:No.size)==null?void 0:Fo.sm,swatch:{"--swatch-size":"sizes.6"},trigger:{"--input-height":"sizes.9"},area:{"--thumb-size":"sizes.3.5"},channelSlider:{"--slider-height":"sizes.3.5","--thumb-size":"sizes.3.5"}},md:{channelInput:(Vo=(Bo=inputRecipe.variants)==null?void 0:Bo.size)==null?void 0:Vo.md,swatch:{"--swatch-size":"sizes.7"},trigger:{"--input-height":"sizes.10"},area:{"--thumb-size":"sizes.3.5"},channelSlider:{"--slider-height":"sizes.3.5","--thumb-size":"sizes.3.5"}},lg:{channelInput:(Uo=(zo=inputRecipe.variants)==null?void 0:zo.size)==null?void 0:Uo.lg,swatch:{"--swatch-size":"sizes.7"},trigger:{"--input-height":"sizes.11"},area:{"--thumb-size":"sizes.3.5"},channelSlider:{"--slider-height":"sizes.3.5","--thumb-size":"sizes.3.5"}},xl:{channelInput:(Ho=(Wo=inputRecipe.variants)==null?void 0:Wo.size)==null?void 0:Ho.xl,swatch:{"--swatch-size":"sizes.8"},trigger:{"--input-height":"sizes.12"},area:{"--thumb-size":"sizes.3.5"},channelSlider:{"--slider-height":"sizes.3.5","--thumb-size":"sizes.3.5"}},"2xl":{channelInput:(Yo=(Go=inputRecipe.variants)==null?void 0:Go.size)==null?void 0:Yo["2xl"],swatch:{"--swatch-size":"sizes.10"},trigger:{"--input-height":"sizes.16"},area:{"--thumb-size":"sizes.3.5"},channelSlider:{"--slider-height":"sizes.3.5","--thumb-size":"sizes.3.5"}}},variant:{outline:{channelInput:(Ko=(Xo=inputRecipe.variants)==null?void 0:Xo.variant)==null?void 0:Ko.outline,trigger:{borderWidth:"1px"}},subtle:{channelInput:(Jo=(qo=inputRecipe.variants)==null?void 0:qo.variant)==null?void 0:Jo.subtle,trigger:{borderWidth:"1px",borderColor:"transparent",bg:"bg.muted"}}}},defaultVariants:{size:"md",variant:"outline"}}),dataListSlotRecipe=defineSlotRecipe({slots:dataListAnatomy.keys(),className:"chakra-data-list",base:{itemLabel:{display:"flex",alignItems:"center",gap:"1"},itemValue:{display:"flex",minWidth:"0",flex:"1"}},variants:{orientation:{horizontal:{root:{display:"flex",flexDirection:"column"},item:{display:"inline-flex",alignItems:"center",gap:"4"},itemLabel:{minWidth:"120px"}},vertical:{root:{display:"flex",flexDirection:"column"},item:{display:"flex",flexDirection:"column",gap:"1"}}},size:{sm:{root:{gap:"3"},item:{textStyle:"xs"}},md:{root:{gap:"4"},item:{textStyle:"sm"}},lg:{root:{gap:"5"},item:{textStyle:"md"}}},variant:{subtle:{itemLabel:{color:"fg.muted"}},bold:{itemLabel:{fontWeight:"medium"},itemValue:{color:"fg.muted"}}}},defaultVariants:{size:"md",orientation:"vertical",variant:"subtle"}}),dialogSlotRecipe=defineSlotRecipe({slots:dialogAnatomy.keys(),className:"chakra-dialog",base:{backdrop:{bg:"blackAlpha.500",pos:"fixed",left:0,top:0,w:"100vw",h:"100dvh",zIndex:"overlay",_open:{animationName:"fade-in",animationDuration:"slow"},_closed:{animationName:"fade-out",animationDuration:"moderate"}},positioner:{display:"flex",width:"100vw",height:"100dvh",position:"fixed",left:0,top:0,"--dialog-z-index":"zIndex.modal",zIndex:"calc(var(--dialog-z-index) + var(--layer-index, 0))",justifyContent:"center",overscrollBehaviorY:"none"},content:{display:"flex",flexDirection:"column",position:"relative",width:"100%",outline:0,borderRadius:"l3",textStyle:"sm",my:"var(--dialog-margin, var(--dialog-base-margin))","--dialog-z-index":"zIndex.modal",zIndex:"calc(var(--dialog-z-index) + var(--layer-index, 0))",bg:"bg.panel",boxShadow:"lg",_open:{animationDuration:"moderate"},_closed:{animationDuration:"faster"}},header:{display:"flex",gap:"2",flex:0,px:"6",pt:"6",pb:"4"},body:{flex:"1",px:"6",pt:"2",pb:"6"},footer:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"3",px:"6",pt:"2",pb:"4"},title:{textStyle:"lg",fontWeight:"semibold"},description:{color:"fg.muted"},closeTrigger:{pos:"absolute",top:"2",insetEnd:"2"}},variants:{placement:{center:{positioner:{alignItems:"center"},content:{"--dialog-base-margin":"auto",mx:"auto"}},top:{positioner:{alignItems:"flex-start"},content:{"--dialog-base-margin":"spacing.16",mx:"auto"}},bottom:{positioner:{alignItems:"flex-end"},content:{"--dialog-base-margin":"spacing.16",mx:"auto"}}},scrollBehavior:{inside:{positioner:{overflow:"hidden"},content:{maxH:"calc(100% - 7.5rem)"},body:{overflow:"auto"}},outside:{positioner:{overflow:"auto",pointerEvents:"auto"}}},size:{xs:{content:{maxW:"sm"}},sm:{content:{maxW:"md"}},md:{content:{maxW:"lg"}},lg:{content:{maxW:"2xl"}},xl:{content:{maxW:"4xl"}},cover:{positioner:{padding:"10"},content:{width:"100%",height:"100%","--dialog-margin":"0"}},full:{content:{maxW:"100vw",minH:"100vh","--dialog-margin":"0",borderRadius:"0"}}},motionPreset:{scale:{content:{_open:{animationName:"scale-in, fade-in"},_closed:{animationName:"scale-out, fade-out"}}},"slide-in-bottom":{content:{_open:{animationName:"slide-from-bottom, fade-in"},_closed:{animationName:"slide-to-bottom, fade-out"}}},"slide-in-top":{content:{_open:{animationName:"slide-from-top, fade-in"},_closed:{animationName:"slide-to-top, fade-out"}}},"slide-in-left":{content:{_open:{animationName:"slide-from-left, fade-in"},_closed:{animationName:"slide-to-left, fade-out"}}},"slide-in-right":{content:{_open:{animationName:"slide-from-right, fade-in"},_closed:{animationName:"slide-to-right, fade-out"}}},none:{}}},defaultVariants:{size:"md",scrollBehavior:"outside",placement:"top",motionPreset:"scale"}}),drawerSlotRecipe=defineSlotRecipe({slots:drawerAnatomy.keys(),className:"chakra-drawer",base:{backdrop:{bg:"blackAlpha.500",pos:"fixed",insetInlineStart:0,top:0,w:"100vw",h:"100dvh",zIndex:"overlay",_open:{animationName:"fade-in",animationDuration:"slow"},_closed:{animationName:"fade-out",animationDuration:"moderate"}},positioner:{display:"flex",width:"100vw",height:"100dvh",position:"fixed",insetInlineStart:0,top:0,zIndex:"modal",overscrollBehaviorY:"none"},content:{display:"flex",flexDirection:"column",position:"relative",width:"100%",outline:0,zIndex:"modal",textStyle:"sm",maxH:"100dvh",color:"inherit",bg:"bg.panel",boxShadow:"lg",_open:{animationDuration:"slowest",animationTimingFunction:"ease-in-smooth"},_closed:{animationDuration:"slower",animationTimingFunction:"ease-in-smooth"}},header:{display:"flex",alignItems:"center",gap:"2",flex:0,px:"6",pt:"6",pb:"4"},body:{px:"6",py:"2",flex:"1",overflow:"auto"},footer:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"3",px:"6",pt:"2",pb:"4"},title:{flex:"1",textStyle:"lg",fontWeight:"semibold"},description:{color:"fg.muted"},closeTrigger:{pos:"absolute",top:"3",insetEnd:"2"}},variants:{size:{xs:{content:{maxW:"xs"}},sm:{content:{maxW:"md"}},md:{content:{maxW:"lg"}},lg:{content:{maxW:"2xl"}},xl:{content:{maxW:"4xl"}},full:{content:{maxW:"100vw",h:"100dvh"}}},placement:{start:{positioner:{justifyContent:"flex-start"},content:{_open:{animationName:{base:"slide-from-left-full, fade-in",_rtl:"slide-from-right-full, fade-in"}},_closed:{animationName:{base:"slide-to-left-full, fade-out",_rtl:"slide-to-right-full, fade-out"}}}},end:{positioner:{justifyContent:"flex-end"},content:{_open:{animationName:{base:"slide-from-right-full, fade-in",_rtl:"slide-from-left-full, fade-in"}},_closed:{animationName:{base:"slide-to-right-full, fade-out",_rtl:"slide-to-right-full, fade-out"}}}},top:{positioner:{alignItems:"flex-start"},content:{maxW:"100%",_open:{animationName:"slide-from-top-full, fade-in"},_closed:{animationName:"slide-to-top-full, fade-out"}}},bottom:{positioner:{alignItems:"flex-end"},content:{maxW:"100%",_open:{animationName:"slide-from-bottom-full, fade-in"},_closed:{animationName:"slide-to-bottom-full, fade-out"}}}},contained:{true:{positioner:{padding:"4"},content:{borderRadius:"l3"}}}},defaultVariants:{size:"xs",placement:"end"}}),sharedStyles=defineStyle({fontSize:"inherit",fontWeight:"inherit",textAlign:"inherit",bg:"transparent",borderRadius:"l2"}),editableSlotRecipe=defineSlotRecipe({slots:editableAnatomy.keys(),className:"chakra-editable",base:{root:{display:"inline-flex",alignItems:"center",position:"relative",gap:"1.5",width:"full"},preview:{...sharedStyles,py:"1",px:"1",display:"inline-flex",alignItems:"center",transitionProperty:"common",transitionDuration:"normal",cursor:"text",_hover:{bg:"bg.muted"},_disabled:{userSelect:"none"}},input:{...sharedStyles,outline:"0",py:"1",px:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",focusVisibleRing:"inside",focusRingWidth:"2px",_placeholder:{opacity:.6}},control:{display:"inline-flex",alignItems:"center",gap:"1.5"}},variants:{size:{sm:{root:{textStyle:"sm"},preview:{minH:"8"},input:{minH:"8"}},md:{root:{textStyle:"sm"},preview:{minH:"9"},input:{minH:"9"}},lg:{root:{textStyle:"md"},preview:{minH:"10"},input:{minH:"10"}}}},defaultVariants:{size:"md"}}),emptyStateSlotRecipe=defineSlotRecipe({slots:emptyStateAnatomy.keys(),className:"chakra-empty-state",base:{root:{width:"full"},content:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},indicator:{display:"flex",alignItems:"center",justifyContent:"center",color:"fg.subtle",_icon:{boxSize:"1em"}},title:{fontWeight:"semibold"},description:{textStyle:"sm",color:"fg.muted"}},variants:{size:{sm:{root:{px:"4",py:"6"},title:{textStyle:"md"},content:{gap:"4"},indicator:{textStyle:"2xl"}},md:{root:{px:"8",py:"12"},title:{textStyle:"lg"},content:{gap:"6"},indicator:{textStyle:"4xl"}},lg:{root:{px:"12",py:"16"},title:{textStyle:"xl"},content:{gap:"8"},indicator:{textStyle:"6xl"}}}},defaultVariants:{size:"md"}}),fieldSlotRecipe=defineSlotRecipe({className:"chakra-field",slots:fieldAnatomy.keys(),base:{requiredIndicator:{color:"fg.error",lineHeight:"1"},root:{display:"flex",width:"100%",position:"relative",gap:"1.5"},label:{display:"flex",alignItems:"center",textAlign:"start",textStyle:"sm",fontWeight:"medium",gap:"1",userSelect:"none",_disabled:{opacity:"0.5"}},errorText:{display:"inline-flex",alignItems:"center",fontWeight:"medium",gap:"1",color:"fg.error",textStyle:"xs"},helperText:{color:"fg.muted",textStyle:"xs"}},variants:{orientation:{vertical:{root:{flexDirection:"column",alignItems:"flex-start"}},horizontal:{root:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},label:{flex:"0 0 var(--field-label-width, 80px)"}}}},defaultVariants:{orientation:"vertical"}}),fieldsetSlotRecipe=defineSlotRecipe({className:"fieldset",slots:fieldsetAnatomy.keys(),base:{root:{display:"flex",flexDirection:"column",width:"full"},content:{display:"flex",flexDirection:"column",width:"full"},legend:{color:"fg",fontWeight:"medium",_disabled:{opacity:"0.5"}},helperText:{color:"fg.muted",textStyle:"sm"},errorText:{display:"inline-flex",alignItems:"center",color:"fg.error",gap:"2",fontWeight:"medium",textStyle:"sm"}},variants:{size:{sm:{root:{spaceY:"2"},content:{gap:"1.5"},legend:{textStyle:"sm"}},md:{root:{spaceY:"4"},content:{gap:"4"},legend:{textStyle:"sm"}},lg:{root:{spaceY:"6"},content:{gap:"4"},legend:{textStyle:"md"}}}},defaultVariants:{size:"md"}}),fileUploadSlotRecipe=defineSlotRecipe({className:"chakra-file-upload",slots:fileUploadAnatomy.keys(),base:{root:{display:"flex",flexDirection:"column",gap:"4",width:"100%",alignItems:"flex-start"},label:{fontWeight:"medium",textStyle:"sm"},dropzone:{background:"bg",borderRadius:"l3",borderWidth:"2px",borderStyle:"dashed",display:"flex",alignItems:"center",flexDirection:"column",gap:"4",justifyContent:"center",minHeight:"2xs",px:"3",py:"2",transition:"backgrounds",focusVisibleRing:"outside",_hover:{bg:"bg.subtle"},_dragging:{bg:"colorPalette.subtle",borderStyle:"solid",borderColor:"colorPalette.solid"}},dropzoneContent:{display:"flex",flexDirection:"column",alignItems:"center",textAlign:"center",gap:"1",textStyle:"sm"},item:{pos:"relative",textStyle:"sm",animationName:"fade-in",animationDuration:"moderate",background:"bg",borderRadius:"l2",borderWidth:"1px",width:"100%",display:"flex",alignItems:"center",gap:"3",p:"4"},itemGroup:{width:"100%",display:"flex",flexDirection:"column",gap:"3",_empty:{display:"none"}},itemName:{color:"fg",fontWeight:"medium",lineClamp:"1"},itemContent:{display:"flex",flexDirection:"column",gap:"0.5",flex:"1"},itemSizeText:{color:"fg.muted",textStyle:"xs"},itemDeleteTrigger:{display:"flex",alignItems:"center",justifyContent:"center",alignSelf:"flex-start",boxSize:"5",p:"2px",color:"fg.muted",cursor:"button"},itemPreview:{color:"fg.muted",_icon:{boxSize:"4.5"}}},defaultVariants:{}}),hoverCardSlotRecipe=defineSlotRecipe({className:"chakra-hover-card",slots:anatomy$e.keys(),base:{content:{position:"relative",display:"flex",flexDirection:"column",textStyle:"sm","--hovercard-bg":"colors.bg.panel",bg:"var(--hovercard-bg)",boxShadow:"lg",maxWidth:"80",borderRadius:"l3",zIndex:"popover",transformOrigin:"var(--transform-origin)",outline:"0",_open:{animationStyle:"slide-fade-in",animationDuration:"fast"},_closed:{animationStyle:"slide-fade-out",animationDuration:"faster"}},arrow:{"--arrow-size":"sizes.3","--arrow-background":"var(--hovercard-bg)"},arrowTip:{borderTopWidth:"0.5px",borderInlineStartWidth:"0.5px"}},variants:{size:{xs:{content:{padding:"3"}},sm:{content:{padding:"4"}},md:{content:{padding:"5"}},lg:{content:{padding:"6"}}}},defaultVariants:{size:"md"}}),listSlotRecipe=defineSlotRecipe({className:"chakra-list",slots:listAnatomy.keys(),base:{root:{display:"flex",flexDirection:"column",gap:"var(--list-gap)","& :where(ul, ol)":{marginTop:"var(--list-gap)"}},item:{whiteSpace:"normal",display:"list-item"},indicator:{marginEnd:"2",minHeight:"1lh",flexShrink:0,display:"inline-block",verticalAlign:"middle"}},variants:{variant:{marker:{root:{listStyle:"revert"},item:{_marker:{color:"fg.subtle"}}},plain:{item:{alignItems:"flex-start",display:"inline-flex"}}},align:{center:{item:{alignItems:"center"}},start:{item:{alignItems:"flex-start"}},end:{item:{alignItems:"flex-end"}}}},defaultVariants:{variant:"marker"}}),menuSlotRecipe=defineSlotRecipe({className:"chakra-menu",slots:menuAnatomy.keys(),base:{content:{outline:0,bg:"bg.panel",boxShadow:"lg",color:"fg",maxHeight:"var(--available-height)","--menu-z-index":"zIndex.dropdown",zIndex:"calc(var(--menu-z-index) + var(--layer-index, 0))",borderRadius:"l2",overflow:"hidden",overflowY:"auto",_open:{animationStyle:"slide-fade-in",animationDuration:"fast"},_closed:{animationStyle:"slide-fade-out",animationDuration:"faster"}},item:{textDecoration:"none",color:"fg",userSelect:"none",borderRadius:"l1",width:"100%",display:"flex",cursor:"menuitem",alignItems:"center",textAlign:"start",position:"relative",flex:"0 0 auto",outline:0,_disabled:{layerStyle:"disabled"},"&[data-type]":{ps:"8"}},itemText:{flex:"1"},itemIndicator:{position:"absolute",insetStart:"2",transform:"translateY(-50%)",top:"50%"},itemGroupLabel:{px:"2",py:"1.5",fontWeight:"semibold",textStyle:"sm"},indicator:{display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:"0"},itemCommand:{opacity:"0.6",textStyle:"xs",ms:"auto",ps:"4",letterSpacing:"widest",fontFamily:"inherit"},separator:{height:"1px",bg:"bg.muted",my:"1",mx:"-1"}},variants:{variant:{subtle:{item:{_highlighted:{bg:"bg.emphasized/60"}}},solid:{item:{_highlighted:{bg:"colorPalette.solid",color:"colorPalette.contrast"}}}},size:{sm:{content:{minW:"8rem",padding:"1"},item:{gap:"1",textStyle:"xs",py:"1",px:"1.5"}},md:{content:{minW:"8rem",padding:"1.5"},item:{gap:"2",textStyle:"sm",py:"1.5",px:"2"}}}},defaultVariants:{size:"md",variant:"subtle"}}),selectSlotRecipe=defineSlotRecipe({className:"chakra-select",slots:selectAnatomy.keys(),base:{root:{display:"flex",flexDirection:"column",gap:"1.5",width:"full"},trigger:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"full",minH:"var(--select-trigger-height)","--input-height":"var(--select-trigger-height)",px:"var(--select-trigger-padding-x)",borderRadius:"l2",userSelect:"none",textAlign:"start",focusVisibleRing:"inside",_placeholderShown:{color:"fg.muted/80"},_disabled:{layerStyle:"disabled"},_invalid:{borderColor:"border.error"}},indicatorGroup:{display:"flex",alignItems:"center",gap:"1",pos:"absolute",right:"0",top:"0",bottom:"0",px:"var(--select-trigger-padding-x)",pointerEvents:"none"},indicator:{display:"flex",alignItems:"center",justifyContent:"center",color:{base:"fg.muted",_disabled:"fg.subtle",_invalid:"fg.error"}},content:{background:"bg.panel",display:"flex",flexDirection:"column",zIndex:"dropdown",borderRadius:"l2",outline:0,maxH:"96",overflowY:"auto",boxShadow:"md",_open:{animationStyle:"slide-fade-in",animationDuration:"fast"},_closed:{animationStyle:"slide-fade-out",animationDuration:"fastest"}},item:{position:"relative",userSelect:"none",display:"flex",alignItems:"center",gap:"2",cursor:"option",justifyContent:"space-between",flex:"1",textAlign:"start",borderRadius:"l1",_highlighted:{bg:"bg.emphasized/60"},_disabled:{pointerEvents:"none",opacity:"0.5"},_icon:{width:"4",height:"4"}},control:{pos:"relative"},itemText:{flex:"1"},itemGroup:{_first:{mt:"0"}},itemGroupLabel:{py:"1",fontWeight:"medium"},label:{fontWeight:"medium",userSelect:"none",textStyle:"sm",_disabled:{layerStyle:"disabled"}},valueText:{lineClamp:"1",maxW:"80%"},clearTrigger:{color:"fg.muted",pointerEvents:"auto",focusVisibleRing:"inside",focusRingWidth:"2px",rounded:"l1"}},variants:{variant:{outline:{trigger:{bg:"transparent",borderWidth:"1px",borderColor:"border",_expanded:{borderColor:"border.emphasized"}}},subtle:{trigger:{borderWidth:"1px",borderColor:"transparent",bg:"bg.muted"}}},size:{xs:{root:{"--select-trigger-height":"sizes.8","--select-trigger-padding-x":"spacing.2"},content:{p:"1",gap:"1",textStyle:"xs"},trigger:{textStyle:"xs",gap:"1"},item:{py:"1",px:"2"},itemGroupLabel:{py:"1",px:"2"},indicator:{_icon:{width:"3.5",height:"3.5"}}},sm:{root:{"--select-trigger-height":"sizes.9","--select-trigger-padding-x":"spacing.2.5"},content:{p:"1",textStyle:"sm"},trigger:{textStyle:"sm",gap:"1"},indicator:{_icon:{width:"4",height:"4"}},item:{py:"1",px:"1.5"},itemGroup:{mt:"1"},itemGroupLabel:{py:"1",px:"1.5"}},md:{root:{"--select-trigger-height":"sizes.10","--select-trigger-padding-x":"spacing.3"},content:{p:"1",textStyle:"sm"},itemGroup:{mt:"1.5"},item:{py:"1.5",px:"2"},itemIndicator:{display:"flex",alignItems:"center",justifyContent:"center"},itemGroupLabel:{py:"1.5",px:"2"},trigger:{textStyle:"sm",gap:"2"},indicator:{_icon:{width:"4",height:"4"}}},lg:{root:{"--select-trigger-height":"sizes.12","--select-trigger-padding-x":"spacing.4"},content:{p:"1.5",textStyle:"md"},itemGroup:{mt:"2"},item:{py:"2",px:"3"},itemGroupLabel:{py:"2",px:"3"},trigger:{textStyle:"md",py:"3",gap:"2"},indicator:{_icon:{width:"5",height:"5"}}}}},defaultVariants:{size:"md",variant:"outline"}});var Qo,Zo;const nativeSelectSlotRecipe=defineSlotRecipe({className:"chakra-native-select",slots:nativeSelectAnatomy.keys(),base:{root:{height:"fit-content",display:"flex",width:"100%",position:"relative"},field:{width:"100%",minWidth:"0",outline:"0",appearance:"none",borderRadius:"l2","--error-color":"colors.border.error",_disabled:{layerStyle:"disabled"},_invalid:{focusRingColor:"var(--error-color)",borderColor:"var(--error-color)"},focusVisibleRing:"inside",lineHeight:"normal","& > option, & > optgroup":{bg:"bg"}},indicator:{position:"absolute",display:"inline-flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",top:"50%",transform:"translateY(-50%)",height:"100%",color:"fg.muted",_disabled:{opacity:"0.5"},_invalid:{color:"fg.error"},_icon:{width:"1em",height:"1em"}}},variants:{variant:{outline:{field:(Qo=selectSlotRecipe.variants)==null?void 0:Qo.variant.outline.trigger},subtle:{field:(Zo=selectSlotRecipe.variants)==null?void 0:Zo.variant.subtle.trigger},plain:{field:{bg:"transparent",color:"fg",focusRingWidth:"2px"}}},size:{xs:{field:{textStyle:"xs",ps:"2",pe:"6",height:"6"},indicator:{textStyle:"sm",insetEnd:"1.5"}},sm:{field:{textStyle:"sm",ps:"2.5",pe:"8",height:"8"},indicator:{textStyle:"md",insetEnd:"2"}},md:{field:{textStyle:"sm",ps:"3",pe:"8",height:"10"},indicator:{textStyle:"lg",insetEnd:"2"}},lg:{field:{textStyle:"md",ps:"4",pe:"8",height:"11"},indicator:{textStyle:"xl",insetEnd:"3"}},xl:{field:{textStyle:"md",ps:"4.5",pe:"10",height:"12"},indicator:{textStyle:"xl",insetEnd:"3"}}}},defaultVariants:selectSlotRecipe.defaultVariants});function mapEntries(i,o){const s={};for(const a in i){const _=o(a,i[a]);s[_[0]]=_[1]}return s}const triggerStyle=defineStyle({display:"flex",justifyContent:"center",alignItems:"center",flex:"1",userSelect:"none",cursor:"button",lineHeight:"1",color:"fg.muted","--stepper-base-radius":"radii.l1","--stepper-radius":"calc(var(--stepper-base-radius) + 1px)",_icon:{boxSize:"1em"},_disabled:{opacity:"0.5"},_hover:{bg:"bg.muted"},_active:{bg:"bg.emphasized"}}),numberInputSlotRecipe=defineSlotRecipe({className:"chakra-number-input",slots:anatomy$c.keys(),base:{root:{position:"relative",zIndex:"0",isolation:"isolate"},input:{...inputRecipe.base,verticalAlign:"top",pe:"calc(var(--stepper-width) + 0.5rem)"},control:{display:"flex",flexDirection:"column",position:"absolute",top:"0",insetEnd:"0px",margin:"1px",width:"var(--stepper-width)",height:"calc(100% - 2px)",zIndex:"1",borderStartWidth:"1px",divideY:"1px"},incrementTrigger:{...triggerStyle,borderTopEndRadius:"var(--stepper-radius)"},decrementTrigger:{...triggerStyle,borderBottomEndRadius:"var(--stepper-radius)"},valueText:{fontWeight:"medium",fontFeatureSettings:"pnum",fontVariantNumeric:"proportional-nums"}},variants:{size:{xs:{input:inputRecipe.variants.size.xs,control:{fontSize:"2xs","--stepper-width":"sizes.4"}},sm:{input:inputRecipe.variants.size.sm,control:{fontSize:"xs","--stepper-width":"sizes.5"}},md:{input:inputRecipe.variants.size.md,control:{fontSize:"sm","--stepper-width":"sizes.6"}},lg:{input:inputRecipe.variants.size.lg,control:{fontSize:"sm","--stepper-width":"sizes.6"}}},variant:mapEntries(inputRecipe.variants.variant,(i,o)=>[i,{input:o}])},defaultVariants:{size:"md",variant:"outline"}}),{variants,defaultVariants}=inputRecipe,pinInputSlotRecipe=defineSlotRecipe({className:"chakra-pin-input",slots:anatomy$b.keys(),base:{input:{...inputRecipe.base,textAlign:"center",width:"var(--input-height)"},control:{display:"inline-flex",gap:"2",isolation:"isolate"}},variants:{size:mapEntries(variants.size,(i,o)=>[i,{input:o}]),variant:mapEntries(variants.variant,(i,o)=>[i,{input:o}]),attached:{true:{control:{gap:"0",spaceX:"-1px"},input:{_notFirst:{borderStartRadius:"0"},_notLast:{borderEndRadius:"0"},_focusVisible:{zIndex:"1"}}}}},defaultVariants}),popoverSlotRecipe=defineSlotRecipe({className:"chakra-popover",slots:popoverAnatomy.keys(),base:{content:{position:"relative",display:"flex",flexDirection:"column",textStyle:"sm","--popover-bg":"colors.bg.panel",bg:"var(--popover-bg)",boxShadow:"lg","--popover-size":"sizes.xs","--popover-mobile-size":"calc(100dvw - 1rem)",width:{base:"min(var(--popover-mobile-size), var(--popover-size))",sm:"var(--popover-size)"},borderRadius:"l3","--popover-z-index":"zIndex.popover",zIndex:"calc(var(--popover-z-index) + var(--layer-index, 0))",outline:"0",transformOrigin:"var(--transform-origin)",maxHeight:"var(--available-height)",_open:{animationStyle:"scale-fade-in",animationDuration:"fast"},_closed:{animationStyle:"scale-fade-out",animationDuration:"faster"}},header:{paddingInline:"var(--popover-padding)",paddingTop:"var(--popover-padding)"},body:{padding:"var(--popover-padding)",flex:"1"},footer:{display:"flex",alignItems:"center",paddingInline:"var(--popover-padding)",paddingBottom:"var(--popover-padding)"},arrow:{"--arrow-size":"sizes.3","--arrow-background":"var(--popover-bg)"},arrowTip:{borderTopWidth:"1px",borderInlineStartWidth:"1px"}},variants:{size:{xs:{content:{"--popover-padding":"spacing.3"}},sm:{content:{"--popover-padding":"spacing.4"}},md:{content:{"--popover-padding":"spacing.5"}},lg:{content:{"--popover-padding":"spacing.6"}}}},defaultVariants:{size:"md"}}),progressSlotRecipe=defineSlotRecipe({slots:anatomy$9.keys(),className:"chakra-progress",base:{root:{textStyle:"sm",position:"relative"},track:{overflow:"hidden",position:"relative"},range:{display:"flex",alignItems:"center",justifyContent:"center",transitionProperty:"width, height",transitionDuration:"slow",height:"100%",bgColor:"var(--track-color)",_indeterminate:{"--animate-from-x":"-40%","--animate-to-x":"100%",position:"absolute",willChange:"left",minWidth:"50%",animation:"position 1s ease infinite normal none running",backgroundImage:"linear-gradient(to right, transparent 0%, var(--track-color) 50%, transparent 100%)"}},label:{display:"inline-flex",fontWeight:"medium",alignItems:"center",gap:"1"},valueText:{textStyle:"xs",lineHeight:"1",fontWeight:"medium"}},variants:{variant:{outline:{track:{shadow:"inset",bgColor:"bg.muted"},range:{bgColor:"colorPalette.solid"}},subtle:{track:{bgColor:"colorPalette.muted"},range:{bgColor:"colorPalette.solid/72"}}},shape:{square:{},rounded:{track:{borderRadius:"l1"}},full:{track:{borderRadius:"full"}}},striped:{true:{range:{backgroundImage:"linear-gradient(45deg, var(--stripe-color) 25%, transparent 25%, transparent 50%, var(--stripe-color) 50%, var(--stripe-color) 75%, transparent 75%, transparent)",backgroundSize:"var(--stripe-size) var(--stripe-size)","--stripe-size":"1rem","--stripe-color":{_light:"rgba(255, 255, 255, 0.3)",_dark:"rgba(0, 0, 0, 0.3)"}}}},animated:{true:{range:{"--animate-from":"var(--stripe-size)",animation:"bg-position 1s linear infinite"}}},size:{xs:{track:{h:"1.5"}},sm:{track:{h:"2"}},md:{track:{h:"2.5"}},lg:{track:{h:"3"}},xl:{track:{h:"4"}}}},defaultVariants:{variant:"outline",size:"md",shape:"rounded"}}),progressCircleSlotRecipe=defineSlotRecipe({className:"chakra-progress-circle",slots:anatomy$9.keys(),base:{root:{display:"inline-flex",textStyle:"sm",position:"relative"},circle:{_indeterminate:{animation:"spin 2s linear infinite"}},circleTrack:{"--track-color":"colors.colorPalette.muted",stroke:"var(--track-color)"},circleRange:{stroke:"colorPalette.solid",transitionProperty:"stroke-dasharray",transitionDuration:"0.6s",_indeterminate:{animation:"circular-progress 1.5s linear infinite"}},label:{display:"inline-flex"},valueText:{lineHeight:"1",fontWeight:"medium",letterSpacing:"tight",fontVariantNumeric:"tabular-nums"}},variants:{size:{xs:{circle:{"--size":"24px","--thickness":"4px"},valueText:{textStyle:"2xs"}},sm:{circle:{"--size":"32px","--thickness":"5px"},valueText:{textStyle:"2xs"}},md:{circle:{"--size":"40px","--thickness":"6px"},valueText:{textStyle:"xs"}},lg:{circle:{"--size":"48px","--thickness":"7px"},valueText:{textStyle:"sm"}},xl:{circle:{"--size":"64px","--thickness":"8px"},valueText:{textStyle:"sm"}}}},defaultVariants:{size:"md"}}),qrCodeSlotRecipe=defineSlotRecipe({slots:anatomy$8.keys(),className:"chakra-qr-code",base:{root:{position:"relative",width:"fit-content","--qr-code-overlay-size":"calc(var(--qr-code-size) / 3)"},frame:{width:"var(--qr-code-size)",height:"var(--qr-code-size)",fill:"currentColor"},overlay:{display:"flex",alignItems:"center",justifyContent:"center",width:"var(--qr-code-overlay-size)",height:"var(--qr-code-overlay-size)",padding:"1",bg:"bg",rounded:"l1"}},variants:{size:{"2xs":{root:{"--qr-code-size":"40px"}},xs:{root:{"--qr-code-size":"64px"}},sm:{root:{"--qr-code-size":"80px"}},md:{root:{"--qr-code-size":"120px"}},lg:{root:{"--qr-code-size":"160px"}},xl:{root:{"--qr-code-size":"200px"}},"2xl":{root:{"--qr-code-size":"240px"}},full:{root:{"--qr-code-size":"100%"}}}},defaultVariants:{size:"md"}});var es,ts,rs,ns,is,os,ss;const radioCardSlotRecipe=defineSlotRecipe({className:"chakra-radio-card",slots:radioCardAnatomy.keys(),base:{root:{display:"flex",flexDirection:"column",gap:"1.5",isolation:"isolate"},item:{flex:"1",display:"flex",flexDirection:"column",userSelect:"none",position:"relative",borderRadius:"l2",_focus:{bg:"colorPalette.muted/20"},_disabled:{opacity:"0.8",borderColor:"border.disabled"},_checked:{zIndex:"1"}},label:{display:"inline-flex",fontWeight:"medium",textStyle:"sm",_disabled:{opacity:"0.5"}},itemText:{fontWeight:"medium",flex:"1"},itemDescription:{opacity:"0.64",textStyle:"sm"},itemControl:{display:"inline-flex",flex:"1",pos:"relative",rounded:"inherit",justifyContent:"var(--radio-card-justify)",alignItems:"var(--radio-card-align)",_disabled:{bg:"bg.muted"}},itemIndicator:radiomarkRecipe.base,itemAddon:{roundedBottom:"inherit",_disabled:{color:"fg.muted"}},itemContent:{display:"flex",flexDirection:"column",flex:"1",gap:"1",justifyContent:"var(--radio-card-justify)",alignItems:"var(--radio-card-align)"}},variants:{size:{sm:{item:{textStyle:"sm"},itemControl:{padding:"3",gap:"1.5"},itemAddon:{px:"3",py:"1.5",borderTopWidth:"1px"},itemIndicator:(es=radiomarkRecipe.variants)==null?void 0:es.size.sm},md:{item:{textStyle:"sm"},itemControl:{padding:"4",gap:"2.5"},itemAddon:{px:"4",py:"2",borderTopWidth:"1px"},itemIndicator:(ts=radiomarkRecipe.variants)==null?void 0:ts.size.md},lg:{item:{textStyle:"md"},itemControl:{padding:"4",gap:"3.5"},itemAddon:{px:"4",py:"2",borderTopWidth:"1px"},itemIndicator:(rs=radiomarkRecipe.variants)==null?void 0:rs.size.lg}},variant:{surface:{item:{borderWidth:"1px",_checked:{bg:"colorPalette.subtle",color:"colorPalette.fg",borderColor:"colorPalette.muted"}},itemIndicator:(ns=radiomarkRecipe.variants)==null?void 0:ns.variant.solid},subtle:{item:{bg:"bg.muted"},itemControl:{_checked:{bg:"colorPalette.muted",color:"colorPalette.fg"}},itemIndicator:(is=radiomarkRecipe.variants)==null?void 0:is.variant.outline},outline:{item:{borderWidth:"1px",_checked:{boxShadow:"0 0 0 1px var(--shadow-color)",boxShadowColor:"colorPalette.solid",borderColor:"colorPalette.solid"}},itemIndicator:(os=radiomarkRecipe.variants)==null?void 0:os.variant.solid},solid:{item:{borderWidth:"1px",_checked:{bg:"colorPalette.solid",color:"colorPalette.contrast",borderColor:"colorPalette.solid"}},itemIndicator:(ss=radiomarkRecipe.variants)==null?void 0:ss.variant.inverted}},justify:{start:{item:{"--radio-card-justify":"flex-start"}},end:{item:{"--radio-card-justify":"flex-end"}},center:{item:{"--radio-card-justify":"center"}}},align:{start:{item:{"--radio-card-align":"flex-start"},itemControl:{textAlign:"start"}},end:{item:{"--radio-card-align":"flex-end"},itemControl:{textAlign:"end"}},center:{item:{"--radio-card-align":"center"},itemControl:{textAlign:"center"}}},orientation:{vertical:{itemControl:{flexDirection:"column"}},horizontal:{itemControl:{flexDirection:"row"}}}},defaultVariants:{size:"md",variant:"outline",align:"start",orientation:"horizontal"}});var as,ls,us,cs,ds,ps,fs,hs,gs,ms,ys,bs,vs,xs;const radioGroupSlotRecipe=defineSlotRecipe({className:"chakra-radio-group",slots:radioGroupAnatomy.keys(),base:{item:{display:"inline-flex",alignItems:"center",position:"relative",fontWeight:"medium",_disabled:{cursor:"disabled"}},itemControl:radiomarkRecipe.base,label:{userSelect:"none",textStyle:"sm",_disabled:{opacity:"0.5"}}},variants:{variant:{outline:{itemControl:(ls=(as=radiomarkRecipe.variants)==null?void 0:as.variant)==null?void 0:ls.outline},subtle:{itemControl:(cs=(us=radiomarkRecipe.variants)==null?void 0:us.variant)==null?void 0:cs.subtle},solid:{itemControl:(ps=(ds=radiomarkRecipe.variants)==null?void 0:ds.variant)==null?void 0:ps.solid}},size:{xs:{item:{textStyle:"xs",gap:"1.5"},itemControl:(hs=(fs=radiomarkRecipe.variants)==null?void 0:fs.size)==null?void 0:hs.xs},sm:{item:{textStyle:"sm",gap:"2"},itemControl:(ms=(gs=radiomarkRecipe.variants)==null?void 0:gs.size)==null?void 0:ms.sm},md:{item:{textStyle:"sm",gap:"2.5"},itemControl:(bs=(ys=radiomarkRecipe.variants)==null?void 0:ys.size)==null?void 0:bs.md},lg:{item:{textStyle:"md",gap:"3"},itemControl:(xs=(vs=radiomarkRecipe.variants)==null?void 0:vs.size)==null?void 0:xs.lg}}},defaultVariants:{size:"md",variant:"solid"}}),ratingGroupSlotRecipe=defineSlotRecipe({className:"chakra-rating-group",slots:ratingGroupAnatomy.keys(),base:{root:{display:"inline-flex"},control:{display:"inline-flex",alignItems:"center"},item:{display:"inline-flex",alignItems:"center",justifyContent:"center",userSelect:"none"},itemIndicator:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"1em",height:"1em",position:"relative",_icon:{stroke:"currentColor",width:"100%",height:"100%",display:"inline-block",flexShrink:0,position:"absolute",left:0,top:0},"& [data-bg]":{color:"bg.emphasized"},"& [data-fg]":{color:"transparent"},"&[data-highlighted]:not([data-half])":{"& [data-fg]":{color:"colorPalette.solid"}},"&[data-half]":{"& [data-fg]":{color:"colorPalette.solid",clipPath:"inset(0 50% 0 0)"}}}},variants:{size:{xs:{item:{textStyle:"sm"}},sm:{item:{textStyle:"md"}},md:{item:{textStyle:"xl"}},lg:{item:{textStyle:"2xl"}}}},defaultVariants:{size:"md"}}),segmentGroupSlotRecipe=defineSlotRecipe({className:"chakra-segment-group",slots:segmentGroupAnatomy.keys(),base:{root:{"--segment-radius":"radii.l2",borderRadius:"l2",display:"inline-flex",boxShadow:"inset",minW:"max-content",textAlign:"center",position:"relative",isolation:"isolate",bg:"bg.muted",_vertical:{flexDirection:"column"}},item:{display:"flex",alignItems:"center",justifyContent:"center",userSelect:"none",fontSize:"sm",position:"relative",color:"fg",borderRadius:"var(--segment-radius)",_disabled:{opacity:"0.5"},"&:has(input:focus-visible)":{focusRing:"outside"},_before:{content:'""',position:"absolute",bg:"border",transition:"opacity 0.2s"},_horizontal:{_before:{insetInlineStart:0,insetBlock:"1.5",width:"1px"}},_vertical:{_before:{insetBlockStart:0,insetInline:"1.5",height:"1px"}},"& + &[data-state=checked], &[data-state=checked] + &, &:first-of-type":{_before:{opacity:"0"}},"&[data-state=checked][data-ssr]":{shadow:"sm",bg:"bg",borderRadius:"var(--segment-radius)"}},indicator:{shadow:"sm",pos:"absolute",bg:{_light:"bg",_dark:"bg.emphasized"},width:"var(--width)",height:"var(--height)",top:"var(--top)",left:"var(--left)",zIndex:-1,borderRadius:"var(--segment-radius)"}},variants:{size:{xs:{item:{textStyle:"xs",px:"3",gap:"1",height:"6"}},sm:{item:{textStyle:"sm",px:"4",gap:"2",height:"8"}},md:{item:{textStyle:"sm",px:"4",gap:"2",height:"10"}},lg:{item:{textStyle:"md",px:"4.5",gap:"3",height:"11"}}}},defaultVariants:{size:"md"}}),sliderSlotRecipe=defineSlotRecipe({className:"chakra-slider",slots:sliderAnatomy.keys(),base:{root:{display:"flex",flexDirection:"column",gap:"1",textStyle:"sm",position:"relative",isolation:"isolate",touchAction:"none"},label:{fontWeight:"medium",textStyle:"sm"},control:{display:"inline-flex",alignItems:"center",position:"relative"},track:{overflow:"hidden",borderRadius:"full",flex:"1"},range:{width:"inherit",height:"inherit",_disabled:{bg:"border.emphasized!"}},markerGroup:{position:"absolute!",zIndex:"1"},marker:{"--marker-bg":{base:"white",_underValue:"colors.bg"},display:"flex",alignItems:"center",gap:"calc(var(--slider-thumb-size) / 2)",color:"fg.muted",textStyle:"xs"},markerIndicator:{width:"var(--slider-marker-size)",height:"var(--slider-marker-size)",borderRadius:"full",bg:"var(--marker-bg)"},thumb:{width:"var(--slider-thumb-size)",height:"var(--slider-thumb-size)",display:"flex",alignItems:"center",justifyContent:"center",outline:0,zIndex:"2",borderRadius:"full",_focusVisible:{ring:"2px",ringColor:"colorPalette.focusRing",ringOffset:"2px",ringOffsetColor:"bg"}}},variants:{size:{sm:{root:{"--slider-thumb-size":"sizes.4","--slider-track-size":"sizes.1.5","--slider-marker-center":"6px","--slider-marker-size":"sizes.1","--slider-marker-inset":"3px"}},md:{root:{"--slider-thumb-size":"sizes.5","--slider-track-size":"sizes.2","--slider-marker-center":"8px","--slider-marker-size":"sizes.1","--slider-marker-inset":"4px"}},lg:{root:{"--slider-thumb-size":"sizes.6","--slider-track-size":"sizes.2.5","--slider-marker-center":"9px","--slider-marker-size":"sizes.1.5","--slider-marker-inset":"5px"}}},variant:{outline:{track:{shadow:"inset",bg:"bg.emphasized/72"},range:{bg:"colorPalette.solid"},thumb:{borderWidth:"2px",borderColor:"colorPalette.solid",bg:"bg",_disabled:{bg:"border.emphasized",borderColor:"border.emphasized"}}},solid:{track:{bg:"colorPalette.subtle",_disabled:{bg:"bg.muted"}},range:{bg:"colorPalette.solid"},thumb:{bg:"colorPalette.solid",_disabled:{bg:"border.emphasized"}}}},orientation:{vertical:{root:{display:"inline-flex"},control:{flexDirection:"column",height:"100%",minWidth:"var(--slider-thumb-size)","&[data-has-mark-label], &:has(.chakra-slider__marker-label)":{marginEnd:"4"}},track:{width:"var(--slider-track-size)"},thumb:{left:"50%",translate:"-50% 0"},markerGroup:{insetStart:"var(--slider-marker-center)",insetBlock:"var(--slider-marker-inset)"},marker:{flexDirection:"row"}},horizontal:{control:{flexDirection:"row",width:"100%",minHeight:"var(--slider-thumb-size)","&[data-has-mark-label], &:has(.chakra-slider__marker-label)":{marginBottom:"4"}},track:{height:"var(--slider-track-size)"},thumb:{top:"50%",translate:"0 -50%"},markerGroup:{top:"var(--slider-marker-center)",insetInline:"var(--slider-marker-inset)"},marker:{flexDirection:"column"}}}},defaultVariants:{size:"md",variant:"outline",orientation:"horizontal"}}),statSlotRecipe=defineSlotRecipe({className:"chakra-stat",slots:statAnatomy.keys(),base:{root:{display:"flex",flexDirection:"column",gap:"1",position:"relative",flex:"1"},label:{display:"inline-flex",gap:"1.5",alignItems:"center",color:"fg.muted",textStyle:"sm"},helpText:{color:"fg.muted",textStyle:"xs"},valueUnit:{color:"fg.muted",textStyle:"xs",fontWeight:"initial",letterSpacing:"initial"},valueText:{verticalAlign:"baseline",fontWeight:"semibold",letterSpacing:"tight",fontFeatureSettings:"pnum",fontVariantNumeric:"proportional-nums",display:"inline-flex",gap:"1"},indicator:{display:"inline-flex",alignItems:"center",justifyContent:"center",marginEnd:1,"& :where(svg)":{w:"1em",h:"1em"},"&[data-type=up]":{color:"fg.success"},"&[data-type=down]":{color:"fg.error"}}},variants:{size:{sm:{valueText:{textStyle:"xl"}},md:{valueText:{textStyle:"2xl"}},lg:{valueText:{textStyle:"3xl"}}}},defaultVariants:{size:"md"}}),statusSlotRecipe=defineSlotRecipe({className:"chakra-status",slots:statusAnatomy.keys(),base:{root:{display:"inline-flex",alignItems:"center",gap:"2"},indicator:{width:"0.64em",height:"0.64em",flexShrink:0,borderRadius:"full",forcedColorAdjust:"none",bg:"colorPalette.solid"}},variants:{size:{sm:{root:{textStyle:"xs"}},md:{root:{textStyle:"sm"}},lg:{root:{textStyle:"md"}}}},defaultVariants:{size:"md"}}),stepsSlotRecipe=defineSlotRecipe({className:"chakra-steps",slots:stepsAnatomy.keys(),base:{root:{display:"flex",width:"full"},list:{display:"flex",justifyContent:"space-between","--steps-gutter":"spacing.3","--steps-thickness":"2px"},title:{fontWeight:"medium",color:"fg"},description:{color:"fg.muted"},separator:{bg:"border",flex:"1"},indicator:{display:"flex",justifyContent:"center",alignItems:"center",flexShrink:"0",borderRadius:"full",fontWeight:"medium",width:"var(--steps-size)",height:"var(--steps-size)",_icon:{flexShrink:"0",width:"var(--steps-icon-size)",height:"var(--steps-icon-size)"}},item:{position:"relative",display:"flex",gap:"3",flex:"1 0 0","&:last-of-type":{flex:"initial","& [data-part=separator]":{display:"none"}}},trigger:{display:"flex",alignItems:"center",gap:"3",textAlign:"start",focusVisibleRing:"outside",borderRadius:"l2"},content:{focusVisibleRing:"outside"}},variants:{orientation:{vertical:{root:{flexDirection:"row",height:"100%"},list:{flexDirection:"column",alignItems:"flex-start"},separator:{position:"absolute",width:"var(--steps-thickness)",height:"100%",maxHeight:"calc(100% - var(--steps-size) - var(--steps-gutter) * 2)",top:"calc(var(--steps-size) + var(--steps-gutter))",insetStart:"calc(var(--steps-size) / 2 - 1px)"},item:{alignItems:"flex-start"}},horizontal:{root:{flexDirection:"column",width:"100%"},list:{flexDirection:"row",alignItems:"center"},separator:{width:"100%",height:"var(--steps-thickness)",marginX:"var(--steps-gutter)"},item:{alignItems:"center"}}},variant:{solid:{indicator:{_incomplete:{borderWidth:"var(--steps-thickness)"},_current:{bg:"colorPalette.muted",borderWidth:"var(--steps-thickness)",borderColor:"colorPalette.solid",color:"colorPalette.fg"},_complete:{bg:"colorPalette.solid",borderColor:"colorPalette.solid",color:"colorPalette.contrast"}},separator:{_complete:{bg:"colorPalette.solid"}}},subtle:{indicator:{_incomplete:{bg:"bg.muted"},_current:{bg:"colorPalette.muted",color:"colorPalette.fg"},_complete:{bg:"colorPalette.emphasized",color:"colorPalette.fg"}},separator:{_complete:{bg:"colorPalette.emphasized"}}}},size:{xs:{root:{gap:"2.5"},list:{"--steps-size":"sizes.6","--steps-icon-size":"sizes.3.5",textStyle:"xs"},title:{textStyle:"sm"}},sm:{root:{gap:"3"},list:{"--steps-size":"sizes.8","--steps-icon-size":"sizes.4",textStyle:"xs"},title:{textStyle:"sm"}},md:{root:{gap:"4"},list:{"--steps-size":"sizes.10","--steps-icon-size":"sizes.4",textStyle:"sm"},title:{textStyle:"sm"}},lg:{root:{gap:"6"},list:{"--steps-size":"sizes.11","--steps-icon-size":"sizes.5",textStyle:"md"},title:{textStyle:"md"}}}},defaultVariants:{size:"md",variant:"solid",orientation:"horizontal"}}),switchSlotRecipe=defineSlotRecipe({slots:switchAnatomy.keys(),className:"chakra-switch",base:{root:{display:"inline-flex",gap:"2.5",alignItems:"center",position:"relative",verticalAlign:"middle","--switch-diff":"calc(var(--switch-width) - var(--switch-height))","--switch-x":{base:"var(--switch-diff)",_rtl:"calc(var(--switch-diff) * -1)"}},label:{lineHeight:"1",userSelect:"none",fontSize:"sm",fontWeight:"medium",_disabled:{opacity:"0.5"}},indicator:{position:"absolute",height:"var(--switch-height)",width:"var(--switch-height)",fontSize:"var(--switch-indicator-font-size)",fontWeight:"medium",flexShrink:0,userSelect:"none",display:"grid",placeContent:"center",transition:"inset-inline-start 0.12s ease",insetInlineStart:"calc(var(--switch-x) - 2px)",_checked:{insetInlineStart:"2px"}},control:{display:"inline-flex",gap:"0.5rem",flexShrink:0,justifyContent:"flex-start",cursor:"switch",borderRadius:"full",position:"relative",width:"var(--switch-width)",height:"var(--switch-height)",transition:"backgrounds",_disabled:{opacity:"0.5",cursor:"not-allowed"},_invalid:{outline:"2px solid",outlineColor:"border.error",outlineOffset:"2px"}},thumb:{display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transitionProperty:"translate",transitionDuration:"fast",borderRadius:"inherit",_checked:{translate:"var(--switch-x) 0"}}},variants:{variant:{solid:{control:{borderRadius:"full",bg:"bg.emphasized",focusVisibleRing:"outside",_checked:{bg:"colorPalette.solid"}},thumb:{bg:"white",width:"var(--switch-height)",height:"var(--switch-height)",scale:"0.8",boxShadow:"sm",_checked:{bg:"colorPalette.contrast"}}},raised:{control:{borderRadius:"full",height:"calc(var(--switch-height) / 2)",bg:"bg.muted",boxShadow:"inset",_checked:{bg:"colorPalette.solid/60"}},thumb:{width:"var(--switch-height)",height:"var(--switch-height)",position:"relative",top:"calc(var(--switch-height) * -0.25)",bg:"white",boxShadow:"xs",focusVisibleRing:"outside",_checked:{bg:"colorPalette.solid"}}}},size:{xs:{root:{"--switch-width":"sizes.6","--switch-height":"sizes.3","--switch-indicator-font-size":"fontSizes.xs"}},sm:{root:{"--switch-width":"sizes.8","--switch-height":"sizes.4","--switch-indicator-font-size":"fontSizes.xs"}},md:{root:{"--switch-width":"sizes.10","--switch-height":"sizes.5","--switch-indicator-font-size":"fontSizes.sm"}},lg:{root:{"--switch-width":"sizes.12","--switch-height":"sizes.6","--switch-indicator-font-size":"fontSizes.md"}}}},defaultVariants:{variant:"solid",size:"md"}}),tableSlotRecipe=defineSlotRecipe({className:"chakra-table",slots:tableAnatomy.keys(),base:{root:{fontVariantNumeric:"lining-nums tabular-nums",borderCollapse:"collapse",width:"full",textAlign:"start",verticalAlign:"top"},row:{_selected:{bg:"colorPalette.subtle"}},cell:{textAlign:"start",alignItems:"center"},columnHeader:{fontWeight:"medium",textAlign:"start",color:"fg"},caption:{fontWeight:"medium",textStyle:"xs"},footer:{fontWeight:"medium"}},variants:{interactive:{true:{body:{"& tr":{_hover:{bg:"colorPalette.subtle"}}}}},stickyHeader:{true:{header:{"& :where(tr)":{top:"var(--table-sticky-offset, 0)",position:"sticky",zIndex:1}}}},striped:{true:{row:{"&:nth-of-type(odd) td":{bg:"bg.muted"}}}},showColumnBorder:{true:{columnHeader:{"&:not(:last-of-type)":{borderInlineEndWidth:"1px"}},cell:{"&:not(:last-of-type)":{borderInlineEndWidth:"1px"}}}},variant:{line:{columnHeader:{borderBottomWidth:"1px"},cell:{borderBottomWidth:"1px"},row:{bg:"bg"}},outline:{root:{boxShadow:"0 0 0 1px {colors.border}",overflow:"hidden"},columnHeader:{borderBottomWidth:"1px"},header:{bg:"bg.muted"},row:{"&:not(:last-of-type)":{borderBottomWidth:"1px"}},footer:{borderTopWidth:"1px"}}},size:{sm:{root:{textStyle:"sm"},columnHeader:{px:"2",py:"2"},cell:{px:"2",py:"2"}},md:{root:{textStyle:"sm"},columnHeader:{px:"3",py:"3"},cell:{px:"3",py:"3"}},lg:{root:{textStyle:"md"},columnHeader:{px:"4",py:"3"},cell:{px:"4",py:"3"}}}},defaultVariants:{variant:"line",size:"md"}}),tabsSlotRecipe=defineSlotRecipe({slots:tabsAnatomy.keys(),className:"chakra-tabs",base:{root:{"--tabs-trigger-radius":"radii.l2",position:"relative",_horizontal:{display:"block"},_vertical:{display:"flex"}},list:{display:"inline-flex",position:"relative",isolation:"isolate","--tabs-indicator-shadow":"shadows.xs","--tabs-indicator-bg":"colors.bg",minH:"var(--tabs-height)",_horizontal:{flexDirection:"row"},_vertical:{flexDirection:"column"}},trigger:{outline:"0",minW:"var(--tabs-height)",height:"var(--tabs-height)",display:"flex",alignItems:"center",fontWeight:"medium",position:"relative",cursor:"button",gap:"2",_focusVisible:{zIndex:1,outline:"2px solid",outlineColor:"colorPalette.focusRing"},_disabled:{cursor:"not-allowed",opacity:.5}},content:{focusVisibleRing:"inside",_horizontal:{width:"100%",pt:"var(--tabs-content-padding)"},_vertical:{height:"100%",ps:"var(--tabs-content-padding)"}},indicator:{width:"var(--width)",height:"var(--height)",borderRadius:"var(--tabs-indicator-radius)",bg:"var(--tabs-indicator-bg)",shadow:"var(--tabs-indicator-shadow)",zIndex:-1}},variants:{fitted:{true:{list:{display:"flex"},trigger:{flex:1,textAlign:"center",justifyContent:"center"}}},justify:{start:{list:{justifyContent:"flex-start"}},center:{list:{justifyContent:"center"}},end:{list:{justifyContent:"flex-end"}}},size:{sm:{root:{"--tabs-height":"sizes.9","--tabs-content-padding":"spacing.3"},trigger:{py:"1",px:"3",textStyle:"sm"}},md:{root:{"--tabs-height":"sizes.10","--tabs-content-padding":"spacing.4"},trigger:{py:"2",px:"4",textStyle:"sm"}},lg:{root:{"--tabs-height":"sizes.11","--tabs-content-padding":"spacing.4.5"},trigger:{py:"2",px:"4.5",textStyle:"md"}}},variant:{line:{list:{display:"flex",borderColor:"border",_horizontal:{borderBottomWidth:"1px"},_vertical:{borderEndWidth:"1px"}},trigger:{color:"fg.muted",_disabled:{_active:{bg:"initial"}},_selected:{color:"fg",_horizontal:{layerStyle:"indicator.bottom","--indicator-offset-y":"-1px","--indicator-color":"colors.colorPalette.solid"},_vertical:{layerStyle:"indicator.end","--indicator-offset-x":"-1px"}}}},subtle:{trigger:{borderRadius:"var(--tabs-trigger-radius)",color:"fg.muted",_selected:{bg:"colorPalette.subtle",color:"colorPalette.fg"}}},enclosed:{list:{bg:"bg.muted",padding:"1",borderRadius:"l3",minH:"calc(var(--tabs-height) - 4px)"},trigger:{justifyContent:"center",color:"fg.muted",borderRadius:"var(--tabs-trigger-radius)",_selected:{bg:"bg",color:"colorPalette.fg",shadow:"xs"}}},outline:{list:{"--line-thickness":"1px","--line-offset":"calc(var(--line-thickness) * -1)",borderColor:"border",display:"flex",_horizontal:{_before:{content:'""',position:"absolute",bottom:"0px",width:"100%",borderBottomWidth:"var(--line-thickness)",borderBottomColor:"border"}},_vertical:{_before:{content:'""',position:"absolute",insetInline:"var(--line-offset)",height:"calc(100% - calc(var(--line-thickness) * 2))",borderEndWidth:"var(--line-thickness)",borderEndColor:"border"}}},trigger:{color:"fg.muted",borderWidth:"1px",borderColor:"transparent",_selected:{bg:"currentBg",color:"colorPalette.fg"},_horizontal:{borderTopRadius:"var(--tabs-trigger-radius)",marginBottom:"var(--line-offset)",marginEnd:{_notLast:"var(--line-offset)"},_selected:{borderColor:"border",borderBottomColor:"transparent"}},_vertical:{borderStartRadius:"var(--tabs-trigger-radius)",marginEnd:"var(--line-offset)",marginBottom:{_notLast:"var(--line-offset)"},_selected:{borderColor:"border",borderEndColor:"transparent"}}}},plain:{trigger:{color:"fg.muted",_selected:{color:"colorPalette.fg"},borderRadius:"var(--tabs-trigger-radius)","&[data-selected][data-ssr]":{bg:"var(--tabs-indicator-bg)",shadow:"var(--tabs-indicator-shadow)",borderRadius:"var(--tabs-indicator-radius)"}}}}},defaultVariants:{size:"md",variant:"line"}});var _s;const badgeVariant=(_s=badgeRecipe.variants)==null?void 0:_s.variant,tagSlotRecipe=defineSlotRecipe({slots:tagAnatomy.keys(),className:"chakra-tag",base:{root:{display:"inline-flex",alignItems:"center",verticalAlign:"top",maxWidth:"100%",userSelect:"none",borderRadius:"l2",focusVisibleRing:"outside"},label:{lineClamp:"1"},closeTrigger:{display:"flex",alignItems:"center",justifyContent:"center",outline:"0",borderRadius:"l1",color:"currentColor",focusVisibleRing:"inside",focusRingWidth:"2px"},startElement:{flexShrink:0,boxSize:"var(--tag-element-size)",ms:"var(--tag-element-offset)","&:has([data-scope=avatar])":{boxSize:"var(--tag-avatar-size)",ms:"calc(var(--tag-element-offset) * 1.5)"},_icon:{boxSize:"100%"}},endElement:{flexShrink:0,boxSize:"var(--tag-element-size)",me:"var(--tag-element-offset)",_icon:{boxSize:"100%"},"&:has(button)":{ms:"calc(var(--tag-element-offset) * -1)"}}},variants:{size:{sm:{root:{px:"1.5",minH:"4.5",gap:"1","--tag-avatar-size":"spacing.3","--tag-element-size":"spacing.3","--tag-element-offset":"-2px"},label:{textStyle:"xs"}},md:{root:{px:"1.5",minH:"5",gap:"1","--tag-avatar-size":"spacing.3.5","--tag-element-size":"spacing.3.5","--tag-element-offset":"-2px"},label:{textStyle:"xs"}},lg:{root:{px:"2",minH:"6",gap:"1.5","--tag-avatar-size":"spacing.4.5","--tag-element-size":"spacing.4","--tag-element-offset":"-3px"},label:{textStyle:"sm"}},xl:{root:{px:"2.5",minH:"8",gap:"1.5","--tag-avatar-size":"spacing.6","--tag-element-size":"spacing.4.5","--tag-element-offset":"-4px"},label:{textStyle:"sm"}}},variant:{subtle:{root:badgeVariant==null?void 0:badgeVariant.subtle},solid:{root:badgeVariant==null?void 0:badgeVariant.solid},outline:{root:badgeVariant==null?void 0:badgeVariant.outline},surface:{root:badgeVariant==null?void 0:badgeVariant.surface}}},defaultVariants:{size:"md",variant:"surface"}}),timelineSlotRecipe=defineSlotRecipe({slots:timelineAnatomy.keys(),className:"chakra-timeline",base:{root:{display:"flex",flexDirection:"column",width:"full","--timeline-thickness":"1px","--timeline-gutter":"4px"},item:{display:"flex",position:"relative",alignItems:"flex-start",flexShrink:0,gap:"4",_last:{"& :where(.chakra-timeline__separator)":{display:"none"}}},separator:{position:"absolute",borderStartWidth:"var(--timeline-thickness)",ms:"calc(-1 * var(--timeline-thickness) / 2)",insetInlineStart:"calc(var(--timeline-indicator-size) / 2)",insetBlock:"0",borderColor:"border"},indicator:{outline:"2px solid {colors.bg}",position:"relative",flexShrink:"0",boxSize:"var(--timeline-indicator-size)",fontSize:"var(--timeline-font-size)",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"full",fontWeight:"medium"},connector:{alignSelf:"stretch",position:"relative"},content:{pb:"6",display:"flex",flexDirection:"column",width:"full",gap:"2"},title:{display:"flex",fontWeight:"medium",flexWrap:"wrap",gap:"1.5",alignItems:"center",mt:"var(--timeline-margin)"},description:{color:"fg.muted",textStyle:"xs"}},variants:{variant:{subtle:{indicator:{bg:"colorPalette.muted"}},solid:{indicator:{bg:"colorPalette.solid",color:"colorPalette.contrast"}},outline:{indicator:{bg:"currentBg",borderWidth:"1px",borderColor:"colorPalette.muted"}},plain:{}},size:{sm:{root:{"--timeline-indicator-size":"sizes.4","--timeline-font-size":"fontSizes.2xs"},title:{textStyle:"xs"}},md:{root:{"--timeline-indicator-size":"sizes.5","--timeline-font-size":"fontSizes.xs"},title:{textStyle:"sm"}},lg:{root:{"--timeline-indicator-size":"sizes.6","--timeline-font-size":"fontSizes.xs"},title:{mt:"0.5",textStyle:"sm"}},xl:{root:{"--timeline-indicator-size":"sizes.8","--timeline-font-size":"fontSizes.sm"},title:{mt:"1.5",textStyle:"sm"}}}},defaultVariants:{size:"md",variant:"solid"}}),toastSlotRecipe=defineSlotRecipe({slots:toastAnatomy.keys(),className:"chakra-toast",base:{root:{width:"full",display:"flex",alignItems:"flex-start",position:"relative",gap:"3",py:"4",ps:"4",pe:"6",borderRadius:"l2",translate:"var(--x) var(--y)",scale:"var(--scale)",zIndex:"var(--z-index)",height:"var(--height)",opacity:"var(--opacity)",willChange:"translate, opacity, scale",transition:"translate 400ms, scale 400ms, opacity 400ms, height 400ms, box-shadow 200ms",transitionTimingFunction:"cubic-bezier(0.21, 1.02, 0.73, 1)",_closed:{transition:"translate 400ms, scale 400ms, opacity 200ms",transitionTimingFunction:"cubic-bezier(0.06, 0.71, 0.55, 1)"},bg:"bg.panel",color:"fg",boxShadow:"xl","--toast-trigger-bg":"colors.bg.muted","&[data-type=warning]":{bg:"orange.solid",color:"orange.contrast","--toast-trigger-bg":"{white/10}","--toast-border-color":"{white/40}"},"&[data-type=success]":{bg:"green.solid",color:"green.contrast","--toast-trigger-bg":"{white/10}","--toast-border-color":"{white/40}"},"&[data-type=error]":{bg:"red.solid",color:"red.contrast","--toast-trigger-bg":"{white/10}","--toast-border-color":"{white/40}"}},title:{fontWeight:"medium",textStyle:"sm",marginEnd:"2"},description:{display:"inline",textStyle:"sm",opacity:"0.8"},indicator:{flexShrink:"0",boxSize:"5"},actionTrigger:{textStyle:"sm",fontWeight:"medium",height:"8",px:"3",borderRadius:"l2",alignSelf:"center",borderWidth:"1px",borderColor:"var(--toast-border-color, inherit)",transition:"background 200ms",_hover:{bg:"var(--toast-trigger-bg)"}},closeTrigger:{position:"absolute",top:"1",insetEnd:"1",padding:"1",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"{currentColor/60}",borderRadius:"l2",textStyle:"md",transition:"background 200ms",_icon:{boxSize:"1em"}}}}),tooltipSlotRecipe=defineSlotRecipe({slots:anatomy.keys(),className:"chakra-tooltip",base:{content:{"--tooltip-bg":"colors.bg.inverted",bg:"var(--tooltip-bg)",color:"fg.inverted",px:"2.5",py:"1",borderRadius:"l2",fontWeight:"medium",textStyle:"xs",boxShadow:"md",maxW:"xs",zIndex:"tooltip",transformOrigin:"var(--transform-origin)",_open:{animationStyle:"scale-fade-in",animationDuration:"fast"},_closed:{animationStyle:"scale-fade-out",animationDuration:"fast"}},arrow:{"--arrow-size":"sizes.2","--arrow-background":"var(--tooltip-bg)"},arrowTip:{borderTopWidth:"1px",borderInlineStartWidth:"1px",borderColor:"var(--tooltip-bg)"}}}),slotRecipes={accordion:accordionSlotRecipe,actionBar:actionBarSlotRecipe,alert:alertSlotRecipe,avatar:avatarSlotRecipe,blockquote:blockquoteSlotRecipe,breadcrumb:breadcrumbSlotRecipe,card:cardSlotRecipe,checkbox:checkboxSlotRecipe,checkboxCard:checkboxCardSlotRecipe,collapsible:collapsibleSlotRecipe,dataList:dataListSlotRecipe,dialog:dialogSlotRecipe,drawer:drawerSlotRecipe,editable:editableSlotRecipe,emptyState:emptyStateSlotRecipe,field:fieldSlotRecipe,fieldset:fieldsetSlotRecipe,fileUpload:fileUploadSlotRecipe,hoverCard:hoverCardSlotRecipe,list:listSlotRecipe,menu:menuSlotRecipe,nativeSelect:nativeSelectSlotRecipe,numberInput:numberInputSlotRecipe,pinInput:pinInputSlotRecipe,popover:popoverSlotRecipe,progress:progressSlotRecipe,progressCircle:progressCircleSlotRecipe,radioCard:radioCardSlotRecipe,radioGroup:radioGroupSlotRecipe,ratingGroup:ratingGroupSlotRecipe,segmentGroup:segmentGroupSlotRecipe,select:selectSlotRecipe,slider:sliderSlotRecipe,stat:statSlotRecipe,steps:stepsSlotRecipe,switch:switchSlotRecipe,table:tableSlotRecipe,tabs:tabsSlotRecipe,tag:tagSlotRecipe,toast:toastSlotRecipe,tooltip:tooltipSlotRecipe,status:statusSlotRecipe,timeline:timelineSlotRecipe,colorPicker:colorPickerSlotRecipe,qrCode:qrCodeSlotRecipe},textStyles=defineTextStyles({"2xs":{value:{fontSize:"2xs",lineHeight:"0.75rem"}},xs:{value:{fontSize:"xs",lineHeight:"1rem"}},sm:{value:{fontSize:"sm",lineHeight:"1.25rem"}},md:{value:{fontSize:"md",lineHeight:"1.5rem"}},lg:{value:{fontSize:"lg",lineHeight:"1.75rem"}},xl:{value:{fontSize:"xl",lineHeight:"1.875rem"}},"2xl":{value:{fontSize:"2xl",lineHeight:"2rem"}},"3xl":{value:{fontSize:"3xl",lineHeight:"2.375rem"}},"4xl":{value:{fontSize:"4xl",lineHeight:"2.75rem",letterSpacing:"-0.025em"}},"5xl":{value:{fontSize:"5xl",lineHeight:"3.75rem",letterSpacing:"-0.025em"}},"6xl":{value:{fontSize:"6xl",lineHeight:"4.5rem",letterSpacing:"-0.025em"}},"7xl":{value:{fontSize:"7xl",lineHeight:"5.75rem",letterSpacing:"-0.025em"}},none:{value:{}},label:{value:{fontSize:"sm",lineHeight:"1.25rem",fontWeight:"medium"}}}),animations=defineTokens.animations({spin:{value:"spin 1s linear infinite"},ping:{value:"ping 1s cubic-bezier(0, 0, 0.2, 1) infinite"},pulse:{value:"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite"},bounce:{value:"bounce 1s infinite"}}),aspectRatios=defineTokens.aspectRatios({square:{value:"1 / 1"},landscape:{value:"4 / 3"},portrait:{value:"3 / 4"},wide:{value:"16 / 9"},ultrawide:{value:"18 / 5"},golden:{value:"1.618 / 1"}}),blurs=defineTokens.blurs({none:{value:" "},sm:{value:"4px"},md:{value:"8px"},lg:{value:"12px"},xl:{value:"16px"},"2xl":{value:"24px"},"3xl":{value:"40px"},"4xl":{value:"64px"}}),borders=defineTokens.borders({xs:{value:"0.5px solid"},sm:{value:"1px solid"},md:{value:"2px solid"},lg:{value:"4px solid"},xl:{value:"8px solid"}}),colors=defineTokens.colors({transparent:{value:"transparent"},current:{value:"currentColor"},black:{value:"#09090B"},white:{value:"#FFFFFF"},whiteAlpha:{50:{value:"rgba(255, 255, 255, 0.04)"},100:{value:"rgba(255, 255, 255, 0.06)"},200:{value:"rgba(255, 255, 255, 0.08)"},300:{value:"rgba(255, 255, 255, 0.16)"},400:{value:"rgba(255, 255, 255, 0.24)"},500:{value:"rgba(255, 255, 255, 0.36)"},600:{value:"rgba(255, 255, 255, 0.48)"},700:{value:"rgba(255, 255, 255, 0.64)"},800:{value:"rgba(255, 255, 255, 0.80)"},900:{value:"rgba(255, 255, 255, 0.92)"},950:{value:"rgba(255, 255, 255, 0.95)"}},blackAlpha:{50:{value:"rgba(0, 0, 0, 0.04)"},100:{value:"rgba(0, 0, 0, 0.06)"},200:{value:"rgba(0, 0, 0, 0.08)"},300:{value:"rgba(0, 0, 0, 0.16)"},400:{value:"rgba(0, 0, 0, 0.24)"},500:{value:"rgba(0, 0, 0, 0.36)"},600:{value:"rgba(0, 0, 0, 0.48)"},700:{value:"rgba(0, 0, 0, 0.64)"},800:{value:"rgba(0, 0, 0, 0.80)"},900:{value:"rgba(0, 0, 0, 0.92)"},950:{value:"rgba(0, 0, 0, 0.95)"}},gray:{50:{value:"#fafafa"},100:{value:"#f4f4f5"},200:{value:"#e4e4e7"},300:{value:"#d4d4d8"},400:{value:"#a1a1aa"},500:{value:"#71717a"},600:{value:"#52525b"},700:{value:"#3f3f46"},800:{value:"#27272a"},900:{value:"#18181b"},950:{value:"#111111"}},red:{50:{value:"#fef2f2"},100:{value:"#fee2e2"},200:{value:"#fecaca"},300:{value:"#fca5a5"},400:{value:"#f87171"},500:{value:"#ef4444"},600:{value:"#dc2626"},700:{value:"#991919"},800:{value:"#511111"},900:{value:"#300c0c"},950:{value:"#1f0808"}},orange:{50:{value:"#fff7ed"},100:{value:"#ffedd5"},200:{value:"#fed7aa"},300:{value:"#fdba74"},400:{value:"#fb923c"},500:{value:"#f97316"},600:{value:"#ea580c"},700:{value:"#92310a"},800:{value:"#6c2710"},900:{value:"#3b1106"},950:{value:"#220a04"}},yellow:{50:{value:"#fefce8"},100:{value:"#fef9c3"},200:{value:"#fef08a"},300:{value:"#fde047"},400:{value:"#facc15"},500:{value:"#eab308"},600:{value:"#ca8a04"},700:{value:"#845209"},800:{value:"#713f12"},900:{value:"#422006"},950:{value:"#281304"}},green:{50:{value:"#f0fdf4"},100:{value:"#dcfce7"},200:{value:"#bbf7d0"},300:{value:"#86efac"},400:{value:"#4ade80"},500:{value:"#22c55e"},600:{value:"#16a34a"},700:{value:"#116932"},800:{value:"#124a28"},900:{value:"#042713"},950:{value:"#03190c"}},teal:{50:{value:"#f0fdfa"},100:{value:"#ccfbf1"},200:{value:"#99f6e4"},300:{value:"#5eead4"},400:{value:"#2dd4bf"},500:{value:"#14b8a6"},600:{value:"#0d9488"},700:{value:"#0c5d56"},800:{value:"#114240"},900:{value:"#032726"},950:{value:"#021716"}},blue:{50:{value:"#eff6ff"},100:{value:"#dbeafe"},200:{value:"#bfdbfe"},300:{value:"#a3cfff"},400:{value:"#60a5fa"},500:{value:"#3b82f6"},600:{value:"#2563eb"},700:{value:"#173da6"},800:{value:"#1a3478"},900:{value:"#14204a"},950:{value:"#0c142e"}},cyan:{50:{value:"#ecfeff"},100:{value:"#cffafe"},200:{value:"#a5f3fc"},300:{value:"#67e8f9"},400:{value:"#22d3ee"},500:{value:"#06b6d4"},600:{value:"#0891b2"},700:{value:"#0c5c72"},800:{value:"#134152"},900:{value:"#072a38"},950:{value:"#051b24"}},purple:{50:{value:"#faf5ff"},100:{value:"#f3e8ff"},200:{value:"#e9d5ff"},300:{value:"#d8b4fe"},400:{value:"#c084fc"},500:{value:"#a855f7"},600:{value:"#9333ea"},700:{value:"#641ba3"},800:{value:"#4a1772"},900:{value:"#2f0553"},950:{value:"#1a032e"}},pink:{50:{value:"#fdf2f8"},100:{value:"#fce7f3"},200:{value:"#fbcfe8"},300:{value:"#f9a8d4"},400:{value:"#f472b6"},500:{value:"#ec4899"},600:{value:"#db2777"},700:{value:"#a41752"},800:{value:"#6d0e34"},900:{value:"#45061f"},950:{value:"#2c0514"}}}),cursor=defineTokens.cursor({button:{value:"pointer"},checkbox:{value:"default"},disabled:{value:"not-allowed"},menuitem:{value:"default"},option:{value:"default"},radio:{value:"default"},slider:{value:"default"},switch:{value:"pointer"}}),durations=defineTokens.durations({fastest:{value:"50ms"},faster:{value:"100ms"},fast:{value:"150ms"},moderate:{value:"200ms"},slow:{value:"300ms"},slower:{value:"400ms"},slowest:{value:"500ms"}}),easings=defineTokens.easings({"ease-in":{value:"cubic-bezier(0.42, 0, 1, 1)"},"ease-out":{value:"cubic-bezier(0, 0, 0.58, 1)"},"ease-in-out":{value:"cubic-bezier(0.42, 0, 0.58, 1)"},"ease-in-smooth":{value:"cubic-bezier(0.32, 0.72, 0, 1)"}}),fontSizes=defineTokens.fontSizes({"2xs":{value:"0.625rem"},xs:{value:"0.75rem"},sm:{value:"0.875rem"},md:{value:"1rem"},lg:{value:"1.125rem"},xl:{value:"1.25rem"},"2xl":{value:"1.5rem"},"3xl":{value:"1.875rem"},"4xl":{value:"2.25rem"},"5xl":{value:"3rem"},"6xl":{value:"3.75rem"},"7xl":{value:"4.5rem"},"8xl":{value:"6rem"},"9xl":{value:"8rem"}}),fontWeights=defineTokens.fontWeights({thin:{value:"100"},extralight:{value:"200"},light:{value:"300"},normal:{value:"400"},medium:{value:"500"},semibold:{value:"600"},bold:{value:"700"},extrabold:{value:"800"},black:{value:"900"}}),fallback='-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',fonts=defineTokens.fonts({heading:{value:`Inter, ${fallback}`},body:{value:`Inter, ${fallback}`},mono:{value:'SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace'}}),keyframes=defineKeyframes({spin:{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}},pulse:{"50%":{opacity:"0.5"}},ping:{"75%, 100%":{transform:"scale(2)",opacity:"0"}},bounce:{"0%, 100%":{transform:"translateY(-25%)",animationTimingFunction:"cubic-bezier(0.8,0,1,1)"},"50%":{transform:"none",animationTimingFunction:"cubic-bezier(0,0,0.2,1)"}},"bg-position":{from:{backgroundPosition:"var(--animate-from, 1rem) 0"},to:{backgroundPosition:"var(--animate-to, 0) 0"}},position:{from:{insetInlineStart:"var(--animate-from-x)",insetBlockStart:"var(--animate-from-y)"},to:{insetInlineStart:"var(--animate-to-x)",insetBlockStart:"var(--animate-to-y)"}},"circular-progress":{"0%":{strokeDasharray:"1, 400",strokeDashoffset:"0"},"50%":{strokeDasharray:"400, 400",strokeDashoffset:"-100%"},"100%":{strokeDasharray:"400, 400",strokeDashoffset:"-260%"}},"expand-height":{from:{height:"0"},to:{height:"var(--height)"}},"collapse-height":{from:{height:"var(--height)"},to:{height:"0"}},"expand-width":{from:{width:"0"},to:{width:"var(--width)"}},"collapse-width":{from:{height:"var(--width)"},to:{height:"0"}},"fade-in":{from:{opacity:0},to:{opacity:1}},"fade-out":{from:{opacity:1},to:{opacity:0}},"slide-from-left-full":{from:{translate:"-100% 0"},to:{translate:"0 0"}},"slide-from-right-full":{from:{translate:"100% 0"},to:{translate:"0 0"}},"slide-from-top-full":{from:{translate:"0 -100%"},to:{translate:"0 0"}},"slide-from-bottom-full":{from:{translate:"0 100%"},to:{translate:"0 0"}},"slide-to-left-full":{from:{translate:"0 0"},to:{translate:"-100% 0"}},"slide-to-right-full":{from:{translate:"0 0"},to:{translate:"100% 0"}},"slide-to-top-full":{from:{translate:"0 0"},to:{translate:"0 -100%"}},"slide-to-bottom-full":{from:{translate:"0 0"},to:{translate:"0 100%"}},"slide-from-top":{"0%":{translate:"0 -0.5rem"},to:{translate:"0"}},"slide-from-bottom":{"0%":{translate:"0 0.5rem"},to:{translate:"0"}},"slide-from-left":{"0%":{translate:"-0.5rem 0"},to:{translate:"0"}},"slide-from-right":{"0%":{translate:"0.5rem 0"},to:{translate:"0"}},"slide-to-top":{"0%":{translate:"0"},to:{translate:"0 -0.5rem"}},"slide-to-bottom":{"0%":{translate:"0"},to:{translate:"0 0.5rem"}},"slide-to-left":{"0%":{translate:"0"},to:{translate:"-0.5rem 0"}},"slide-to-right":{"0%":{translate:"0"},to:{translate:"0.5rem 0"}},"scale-in":{from:{scale:"0.95"},to:{scale:"1"}},"scale-out":{from:{scale:"1"},to:{scale:"0.95"}}}),letterSpacings=defineTokens.letterSpacings({tighter:{value:"-0.05em"},tight:{value:"-0.025em"},wide:{value:"0.025em"},wider:{value:"0.05em"},widest:{value:"0.1em"}}),lineHeights=defineTokens.lineHeights({shorter:{value:1.25},short:{value:1.375},moderate:{value:1.5},tall:{value:1.625},taller:{value:2}}),radii=defineTokens.radii({none:{value:"0"},"2xs":{value:"0.0625rem"},xs:{value:"0.125rem"},sm:{value:"0.25rem"},md:{value:"0.375rem"},lg:{value:"0.5rem"},xl:{value:"0.75rem"},"2xl":{value:"1rem"},"3xl":{value:"1.5rem"},"4xl":{value:"2rem"},full:{value:"9999px"}}),spacing=defineTokens.spacing({.5:{value:"0.125rem"},1:{value:"0.25rem"},1.5:{value:"0.375rem"},2:{value:"0.5rem"},2.5:{value:"0.625rem"},3:{value:"0.75rem"},3.5:{value:"0.875rem"},4:{value:"1rem"},4.5:{value:"1.125rem"},5:{value:"1.25rem"},6:{value:"1.5rem"},7:{value:"1.75rem"},8:{value:"2rem"},9:{value:"2.25rem"},10:{value:"2.5rem"},11:{value:"2.75rem"},12:{value:"3rem"},14:{value:"3.5rem"},16:{value:"4rem"},20:{value:"5rem"},24:{value:"6rem"},28:{value:"7rem"},32:{value:"8rem"},36:{value:"9rem"},40:{value:"10rem"},44:{value:"11rem"},48:{value:"12rem"},52:{value:"13rem"},56:{value:"14rem"},60:{value:"15rem"},64:{value:"16rem"},72:{value:"18rem"},80:{value:"20rem"},96:{value:"24rem"}}),largeSizes=defineTokens.sizes({"3xs":{value:"14rem"},"2xs":{value:"16rem"},xs:{value:"20rem"},sm:{value:"24rem"},md:{value:"28rem"},lg:{value:"32rem"},xl:{value:"36rem"},"2xl":{value:"42rem"},"3xl":{value:"48rem"},"4xl":{value:"56rem"},"5xl":{value:"64rem"},"6xl":{value:"72rem"},"7xl":{value:"80rem"},"8xl":{value:"90rem"}}),namedSizes=defineTokens.sizes({max:{value:"max-content"},min:{value:"min-content"},fit:{value:"fit-content"},prose:{value:"60ch"},full:{value:"100%"},dvh:{value:"100dvh"},svh:{value:"100svh"},lvh:{value:"100lvh"},dvw:{value:"100dvw"},svw:{value:"100svw"},lvw:{value:"100lvw"},vw:{value:"100vw"},vh:{value:"100vh"}}),fractionalSizes=defineTokens.sizes({"1/2":{value:"50%"},"1/3":{value:"33.333333%"},"2/3":{value:"66.666667%"},"1/4":{value:"25%"},"3/4":{value:"75%"},"1/5":{value:"20%"},"2/5":{value:"40%"},"3/5":{value:"60%"},"4/5":{value:"80%"},"1/6":{value:"16.666667%"},"2/6":{value:"33.333333%"},"3/6":{value:"50%"},"4/6":{value:"66.666667%"},"5/6":{value:"83.333333%"},"1/12":{value:"8.333333%"},"2/12":{value:"16.666667%"},"3/12":{value:"25%"},"4/12":{value:"33.333333%"},"5/12":{value:"41.666667%"},"6/12":{value:"50%"},"7/12":{value:"58.333333%"},"8/12":{value:"66.666667%"},"9/12":{value:"75%"},"10/12":{value:"83.333333%"},"11/12":{value:"91.666667%"}}),sizes=defineTokens.sizes({...largeSizes,...spacing,...fractionalSizes,...namedSizes}),zIndices=defineTokens.zIndex({hide:{value:-1},base:{value:0},docked:{value:10},dropdown:{value:1e3},sticky:{value:1100},banner:{value:1200},overlay:{value:1300},modal:{value:1400},popover:{value:1500},skipNav:{value:1600},toast:{value:1700},tooltip:{value:1800},max:{value:2147483647}}),defaultThemeConfig=defineConfig({preflight:!0,cssVarsPrefix:"chakra",cssVarsRoot:":where(html, .chakra-theme)",globalCss,theme:{breakpoints,keyframes,tokens:{aspectRatios,animations,blurs,borders,colors,durations,easings,fonts,fontSizes,fontWeights,letterSpacings,lineHeights,radii,spacing,sizes,zIndex:zIndices,cursor},semanticTokens:{colors:semanticColors,shadows:semanticShadows,radii:semanticRadii},recipes,slotRecipes,textStyles,layerStyles,animationStyles}}),defaultConfig=mergeConfigs(defaultBaseConfig,defaultThemeConfig),defaultSystem=createSystem(defaultConfig),dataAttr=i=>i?"":void 0,StyledGroup=chakra("div",{base:{display:"inline-flex",gap:"0.5rem",isolation:"isolate",position:"relative","& [data-group-item]":{_focusVisible:{zIndex:1}}},variants:{orientation:{horizontal:{flexDirection:"row"},vertical:{flexDirection:"column"}},attached:{true:{gap:"0!"}},grow:{true:{display:"flex","& > *":{flex:1}}},stacking:{"first-on-top":{"& > [data-group-item]":{zIndex:"calc(var(--group-count) - var(--group-index))"}},"last-on-top":{"& > [data-group-item]":{zIndex:"var(--group-index)"}}}},compoundVariants:[{orientation:"horizontal",attached:!0,css:{"& > *[data-first]":{borderEndRadius:"0!",marginEnd:"-1px"},"& > *[data-between]":{borderRadius:"0!",marginEnd:"-1px"},"& > *[data-last]":{borderStartRadius:"0!"}}},{orientation:"vertical",attached:!0,css:{"& > *[data-first]":{borderBottomRadius:"0!",marginBottom:"-1px"},"& > *[data-between]":{borderRadius:"0!",marginBottom:"-1px"},"& > *[data-last]":{borderTopRadius:"0!"}}}],defaultVariants:{orientation:"horizontal"}}),Group=reactExports.memo(reactExports.forwardRef(function(o,s){const{align:a="center",justify:_="flex-start",children:$,wrap:_e,skip:tt,...st}=o,it=reactExports.useMemo(()=>{let nt=reactExports.Children.toArray($).filter(reactExports.isValidElement);if(nt.length===1)return nt;const et=nt.filter(rt=>!(tt!=null&&tt(rt))),j=et.length;return et.length===1?nt:nt.map(rt=>{const ot=rt.props;if(tt!=null&&tt(rt))return rt;const at=et.indexOf(rt);return reactExports.cloneElement(rt,{...ot,"data-group-item":"","data-first":dataAttr(at===0),"data-last":dataAttr(at===j-1),"data-between":dataAttr(at>0&&atmergeProps$1(a,o),[a,o]),$=useRecipeResult$1(_),{loading:_e,loadingText:tt,children:st,spinner:it,spinnerPlacement:nt,...et}=$.props;return jsxRuntimeExports.jsx(chakra.button,{type:"button",ref:s,...et,disabled:_e||et.disabled,className:cx($.className,_.className),css:[$.styles,_.css],children:!_.asChild&&_e?jsxRuntimeExports.jsx(Loader$1,{spinner:it,text:tt,spinnerPlacement:nt,children:st}):st})}),IconButton=reactExports.forwardRef(function(o,s){return jsxRuntimeExports.jsx(Button$2,{px:"0",py:"0",_icon:{fontSize:"1.2em"},ref:s,...o})}),{withProvider:withProvider$6,withContext:withContext$d}=createSlotRecipeContext({key:"clipboard"});withProvider$6(ClipboardRootProvider,"root",{forwardAsChild:!0});const ClipboardRoot$1=withProvider$6(ClipboardRoot$2,"root",{forwardAsChild:!0}),ClipboardTrigger=withContext$d(ClipboardTrigger$1,"trigger",{forwardAsChild:!0});withContext$d(ClipboardControl,"control",{forwardAsChild:!0});const ClipboardIndicator=withContext$d(ClipboardIndicator$1,"indicator",{forwardAsChild:!0,defaultProps:{copied:jsxRuntimeExports.jsx(CheckIcon,{boxSize:"1em"}),children:jsxRuntimeExports.jsx(CopyIcon,{boxSize:"1em"})}}),ClipboardInput=withContext$d(ClipboardInput$1,"input",{forwardAsChild:!0}),ClipboardLabel=withContext$d(ClipboardLabel$1,"label",{forwardAsChild:!0});withContext$d(ClipboardValueText,"valueText",{forwardAsChild:!0});reactExports.forwardRef(function(o,s){return jsxRuntimeExports.jsx(ClipboardIndicator,{copied:"Copied",...o,ref:s,children:"Copy"})});function getSeparatorStyles(i){const{gap:o,direction:s}=i,a={column:{marginY:o,marginX:0,borderInlineStartWidth:0,borderTopWidth:"1px"},"column-reverse":{marginY:o,marginX:0,borderInlineStartWidth:0,borderTopWidth:"1px"},row:{marginX:o,marginY:0,borderInlineStartWidth:"1px",borderTopWidth:0},"row-reverse":{marginX:o,marginY:0,borderInlineStartWidth:"1px",borderTopWidth:0}};return{"&":mapObject(s,_=>a[_])}}function getValidChildren(i){return reactExports.Children.toArray(i).filter(o=>reactExports.isValidElement(o))}const Stack=reactExports.forwardRef(function(o,s){const{direction:a="column",align:_,justify:$,gap:_e="0.5rem",wrap:tt,children:st,separator:it,className:nt,...et}=o,j=reactExports.useMemo(()=>getSeparatorStyles({gap:_e,direction:a}),[_e,a]),rt=reactExports.useMemo(()=>it?getValidChildren(st).map((ot,at,lt)=>{const ut=typeof ot.key<"u"?ot.key:at,ct=reactExports.cloneElement(it,{css:[j,it.props.css]});return jsxRuntimeExports.jsxs(reactExports.Fragment,{children:[ot,at===lt.length-1?null:ct]},ut)}):st,[st,it,j]);return jsxRuntimeExports.jsx(chakra.div,{ref:s,display:"flex",alignItems:_,justifyContent:$,flexDirection:a,flexWrap:tt,gap:it?void 0:_e,className:cx("chakra-stack",nt),...et,children:rt})}),{withRootProvider:withRootProvider$2,withContext:withContext$c}=createSlotRecipeContext({key:"drawer"});withRootProvider$2(DialogRootProvider,{defaultProps:{unmountOnExit:!0,lazyMount:!0}});const DrawerRoot$1=withRootProvider$2(DialogRoot,{defaultProps:{unmountOnExit:!0,lazyMount:!0}}),DrawerTrigger$1=withContext$c(DialogTrigger,"trigger",{forwardAsChild:!0}),DrawerPositioner=withContext$c(DialogPositioner,"positioner",{forwardAsChild:!0}),DrawerContent$1=withContext$c(DialogContent,"content",{forwardAsChild:!0});withContext$c(DialogDescription,"description",{forwardAsChild:!0});const DrawerTitle$1=withContext$c(DialogTitle,"title",{forwardAsChild:!0}),DrawerCloseTrigger$1=withContext$c(DialogCloseTrigger,"closeTrigger",{forwardAsChild:!0}),DrawerActionTrigger$1=reactExports.forwardRef(function(o,s){const a=useDialogContext();return jsxRuntimeExports.jsx(chakra.button,{...o,ref:s,onClick:()=>a.setOpen(!1)})}),DrawerBackdrop$1=withContext$c(DialogBackdrop,"backdrop",{forwardAsChild:!0}),DrawerBody$1=withContext$c("div","body"),DrawerFooter$1=withContext$c("div","footer"),DrawerHeader$1=withContext$c("div","header"),{useRecipeResult}=createRecipeContext({key:"icon"}),Icon=reactExports.forwardRef(function(o,s){const{styles:a,className:_,props:$}=useRecipeResult({asChild:!o.as,...o});return jsxRuntimeExports.jsx(chakra.svg,{ref:s,focusable:!1,"aria-hidden":"true",...$,css:[a,o.css],className:cx(_,o.className)})});function createIcon(i){const{viewBox:o="0 0 24 24",d:s,displayName:a,defaultProps:_={}}=i,$=reactExports.Children.toArray(i.path),_e=reactExports.forwardRef((tt,st)=>jsxRuntimeExports.jsx(Icon,{ref:st,asChild:!1,viewBox:o,..._,...tt,children:$.length?$:jsxRuntimeExports.jsx("path",{fill:"currentColor",d:s})}));return _e.displayName=a,_e}const{withProvider:withProvider$5,withContext:withContext$b,useStyles:useFieldStyles,useClassNames}=createSlotRecipeContext({key:"field"}),FieldRoot=withProvider$5(FieldRoot$1,"root",{forwardAsChild:!0}),FieldLabel=withContext$b(FieldLabel$1,"label",{forwardAsChild:!0}),FieldHelperText=withContext$b(FieldHelperText$1,"helperText",{forwardAsChild:!0}),FieldErrorText=withContext$b(FieldErrorText$1,"errorText",{forwardAsChild:!0});createIcon({d:"M11.983,0a12.206,12.206,0,0,0-8.51,3.653A11.8,11.8,0,0,0,0,12.207,11.779,11.779,0,0,0,11.8,24h.214A12.111,12.111,0,0,0,24,11.791h0A11.766,11.766,0,0,0,11.983,0ZM10.5,16.542a1.476,1.476,0,0,1,1.449-1.53h.027a1.527,1.527,0,0,1,1.523,1.47,1.475,1.475,0,0,1-1.449,1.53h-.027A1.529,1.529,0,0,1,10.5,16.542ZM11,12.5v-6a1,1,0,0,1,2,0v6a1,1,0,1,1-2,0Z"});const FieldRequiredIndicator=reactExports.forwardRef(function(o,s){const{fallback:a,children:_="*",...$}=o,_e=useFieldContext(),tt=useClassNames(),st=useFieldStyles();return _e!=null&&_e.required?jsxRuntimeExports.jsx(chakra.span,{ref:s,"aria-hidden":"true",...$,className:cx(tt.requiredIndicator,o.className),css:[st.requiredIndicator,o.css],children:_}):a}),Flex=reactExports.forwardRef(function(o,s){const{direction:a,align:_,justify:$,wrap:_e,basis:tt,grow:st,shrink:it,inline:nt,...et}=o;return jsxRuntimeExports.jsx(chakra.div,{ref:s,...et,css:{display:nt?"inline-flex":"flex",flexDirection:a,alignItems:_,justifyContent:$,flexWrap:_e,flexBasis:tt,flexGrow:st,flexShrink:it,...o.css}})}),Image$1=reactExports.forwardRef(function(o,s){const{align:a,fit:_="cover",...$}=o;return jsxRuntimeExports.jsx(chakra.img,{ref:s,objectFit:_,objectPosition:a,className:cx("chakra-image",o.className),...$})}),{withContext:withContext$a}=createRecipeContext({key:"input"}),Input$1=withContext$a(FieldInput),InputElement=chakra("div",{base:{display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",zIndex:2,color:"fg.muted",height:"full",fontSize:"sm",px:"3"},variants:{placement:{start:{insetInlineStart:"0"},end:{insetInlineEnd:"0"}}}}),{withRootProvider:withRootProvider$1,withContext:withContext$9}=createSlotRecipeContext({key:"menu"});withRootProvider$1(MenuRootProvider);const MenuRoot=withRootProvider$1(MenuRoot$1,{defaultProps:{lazyMount:!0,unmountOnExit:!0}}),MenuTrigger=withContext$9(MenuTrigger$1,"trigger",{forwardAsChild:!0});withContext$9(MenuContextTrigger,"contextTrigger",{forwardAsChild:!0});const MenuPositioner=withContext$9(MenuPositioner$1,"positioner",{forwardAsChild:!0});withContext$9(MenuSeparator,"separator",{forwardAsChild:!0});const MenuContent=withContext$9(MenuContent$1,"content",{forwardAsChild:!0}),MenuArrowTip=withContext$9(MenuArrowTip$1,"arrowTip",{forwardAsChild:!0});withContext$9(MenuArrow,"arrow",{forwardAsChild:!0,defaultProps:{children:jsxRuntimeExports.jsx(MenuArrowTip,{})}});withContext$9(MenuIndicator,"indicator",{forwardAsChild:!0});withContext$9(MenuItemGroup,"itemGroup",{forwardAsChild:!0});withContext$9(MenuItemGroupLabel,"itemGroupLabel",{forwardAsChild:!0});withContext$9(MenuItem,"item",{forwardAsChild:!0});withContext$9(MenuTriggerItem,"item",{forwardAsChild:!0});withContext$9(MenuItemText,"itemText",{forwardAsChild:!0});withContext$9("kbd","itemCommand");const MenuItemIndicator=withContext$9(MenuItemIndicator$1,"itemIndicator",{forwardAsChild:!0,defaultProps:{children:jsxRuntimeExports.jsx(CheckIcon,{boxSize:"4"})}});withContext$9(MenuCheckboxItem,"item",{forwardAsChild:!0});const MenuRadioItemGroup=withContext$9(MenuRadioItemGroup$1,"itemGroup",{forwardAsChild:!0}),MenuRadioItem=withContext$9(MenuRadioItem$1,"item",{forwardAsChild:!0}),{withProvider:withProvider$4,withContext:withContext$8}=createSlotRecipeContext({key:"numberInput"});withProvider$4(NumberInputRootProvider,"root",{forwardAsChild:!0});const NumberInputRoot=withProvider$4(NumberInputRoot$1,"root",{forwardAsChild:!0});withContext$8(NumberInputLabel,"label",{forwardAsChild:!0});const NumberInputInput=withContext$8(NumberInputInput$1,"input",{forwardAsChild:!0}),NumberInputIncrementTrigger=withContext$8(NumberInputIncrementTrigger$1,"incrementTrigger",{forwardAsChild:!0,defaultProps:{children:jsxRuntimeExports.jsx(ChevronUpIcon,{})}}),NumberInputDecrementTrigger=withContext$8(NumberInputDecrementTrigger$1,"decrementTrigger",{forwardAsChild:!0,defaultProps:{children:jsxRuntimeExports.jsx(ChevronDownIcon,{})}}),NumberInputControl=withContext$8(NumberInputControl$1,"control",{forwardAsChild:!0,defaultProps:{children:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(NumberInputIncrementTrigger,{}),jsxRuntimeExports.jsx(NumberInputDecrementTrigger,{})]})}});withContext$8(NumberInputScrubber,"scrubber",{forwardAsChild:!0});withContext$8(NumberInputValueText,"valueText",{forwardAsChild:!0});const{withProvider:withProvider$3,withContext:withContext$7}=createSlotRecipeContext({key:"select"});withProvider$3(SelectRootProvider,"root",{forwardAsChild:!0});const SelectRoot$1=withProvider$3(SelectRoot$2,"root",{forwardAsChild:!0,defaultProps:{positioning:{sameWidth:!0}}}),SelectTrigger$1=withContext$7(SelectTrigger$2,"trigger",{forwardAsChild:!0}),SelectPositioner=withContext$7(SelectPositioner$1,"positioner",{forwardAsChild:!0}),SelectContent$1=withContext$7(SelectContent$2,"content",{forwardAsChild:!0}),SelectValueText$1=withContext$7(SelectValueText$2,"valueText",{forwardAsChild:!0}),SelectClearTrigger$1=withContext$7(SelectClearTrigger$2,"clearTrigger",{forwardAsChild:!0,defaultProps:{children:jsxRuntimeExports.jsx(CloseIcon,{boxSize:"1em"})}}),SelectItemGroup=withContext$7(SelectItemGroup$1,"itemGroup",{forwardAsChild:!0}),SelectItemGroupLabel=withContext$7(SelectItemGroupLabel$1,"itemGroupLabel",{forwardAsChild:!0}),SelectItem$1=withContext$7(SelectItem$2,"item",{forwardAsChild:!0});withContext$7(SelectItemText,"itemText",{forwardAsChild:!0});const SelectItemIndicator=withContext$7(SelectItemIndicator$1,"itemIndicator",{forwardAsChild:!0,defaultProps:{children:jsxRuntimeExports.jsx(CheckIcon,{})}}),SelectIndicatorGroup=withContext$7("div","indicatorGroup"),SelectIndicator=withContext$7(SelectIndicator$1,"indicator",{forwardAsChild:!0,defaultProps:{children:jsxRuntimeExports.jsx(ChevronDownIcon,{})}}),SelectControl=withContext$7(SelectControl$1,"control",{forwardAsChild:!0});withContext$7(SelectLabel,"label",{forwardAsChild:!0});const SelectContext=SelectContext$1,SelectHiddenSelect=SelectHiddenSelect$1,HStack=reactExports.forwardRef(function(o,s){return jsxRuntimeExports.jsx(Stack,{align:"center",...o,direction:"row",ref:s})}),VStack=reactExports.forwardRef(function(o,s){return jsxRuntimeExports.jsx(Stack,{align:"center",...o,direction:"column",ref:s})}),{withProvider:withProvider$2,withContext:withContext$6,useStyles:useSwitchStyles}=createSlotRecipeContext({key:"switch"});withProvider$2(SwitchRootProvider,"root",{forwardAsChild:!0});const SwitchRoot=withProvider$2(SwitchRoot$1,"root",{forwardAsChild:!0}),SwitchLabel=withContext$6(SwitchLabel$1,"label",{forwardAsChild:!0}),SwitchThumb=withContext$6(SwitchThumb$1,"thumb",{forwardAsChild:!0}),SwitchControl=withContext$6(SwitchControl$1,"control",{forwardAsChild:!0,defaultProps:{children:jsxRuntimeExports.jsx(SwitchThumb,{})}}),SwitchIndicator=reactExports.forwardRef(function(o,s){const a=useSwitchContext(),_=useSwitchStyles(),{fallback:$,children:_e,...tt}=o;return jsxRuntimeExports.jsx(chakra.span,{ref:s,"data-checked":dataAttr(a.checked),...tt,css:[_.indicator,o.css],children:a.checked?_e:$})}),SwitchThumbIndicator=reactExports.forwardRef(function(o,s){const a=useSwitchContext(),{fallback:_,children:$,..._e}=o;return jsxRuntimeExports.jsx(chakra.span,{ref:s,"data-checked":dataAttr(a.checked),..._e,children:a.checked?$:_})}),SwitchHiddenInput=SwitchHiddenInput$1,{withProvider:withProvider$1,withContext:withContext$5}=createSlotRecipeContext({key:"tabs"});withProvider$1(TabsRootProvider,"root",{forwardAsChild:!0});const TabsRoot=withProvider$1(TabsRoot$1,"root",{forwardAsChild:!0}),TabsTrigger=withContext$5(TabTrigger,"trigger",{forwardAsChild:!0}),TabsContent=withContext$5(TabContent,"content",{forwardAsChild:!0}),TabsContentGroup=withContext$5("div","contentGroup"),TabsList=withContext$5(TabList,"list",{forwardAsChild:!0});withContext$5(TabIndicator,"indicator",{forwardAsChild:!0});const{withContext:withContext$4}=createRecipeContext({key:"textarea"}),Textarea=withContext$4(FieldTextarea),{withProvider,withContext:withContext$3,useStyles:useToastStyles}=createSlotRecipeContext({key:"toast"}),Toaster$1=chakra(Toaster$2,{},{forwardAsChild:!0}),ToastRoot=withProvider(ToastRoot$1,"root",{forwardAsChild:!0}),ToastCloseTrigger=withContext$3(ToastCloseTrigger$1,"closeTrigger",{forwardAsChild:!0,defaultProps:{children:jsxRuntimeExports.jsx(CloseIcon,{})}}),ToastTitle=withContext$3(ToastTitle$1,"title",{forwardAsChild:!0}),ToastDescription=withContext$3(ToastDescription$1,"description",{forwardAsChild:!0}),ToastActionTrigger=withContext$3(ToastActionTrigger$1,"actionTrigger",{forwardAsChild:!0}),iconMap={warning:WarningIcon,success:CheckCircleIcon,error:WarningIcon},ToastIndicator=reactExports.forwardRef(function(o,s){const a=useToastContext(),_=useToastStyles(),$=iconMap[a.type];return $?jsxRuntimeExports.jsx($,{ref:s,...o,css:[_.indicator,o.css]}):null}),{withRootProvider,withContext:withContext$2}=createSlotRecipeContext({key:"tooltip"});withRootProvider(TooltipRootProvider);const TooltipRoot=withRootProvider(TooltipRoot$1,{defaultProps:{lazyMount:!0,unmountOnExit:!0}}),TooltipTrigger=withContext$2(TooltipTrigger$1,"trigger",{forwardAsChild:!0}),TooltipPositioner=withContext$2(TooltipPositioner$1,"positioner",{forwardAsChild:!0}),TooltipContent=withContext$2(TooltipContent$1,"content",{forwardAsChild:!0}),TooltipArrowTip=withContext$2(TooltipArrowTip$1,"arrowTip",{forwardAsChild:!0}),TooltipArrow=withContext$2(TooltipArrow$1,"arrow",{forwardAsChild:!0,defaultProps:{children:jsxRuntimeExports.jsx(TooltipArrowTip,{})}}),{withContext:withContext$1}=createRecipeContext({key:"heading"}),Heading=withContext$1("h2"),{withContext}=createRecipeContext({key:"text"}),Text=withContext("p");var DefaultContext={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},IconContext=React.createContext&&React.createContext(DefaultContext),_excluded$x=["attr","size","title"];function _objectWithoutProperties$x(i,o){if(i==null)return{};var s=_objectWithoutPropertiesLoose$x(i,o),a,_;if(Object.getOwnPropertySymbols){var $=Object.getOwnPropertySymbols(i);for(_=0;_<$.length;_++)a=$[_],!(o.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(i,a)&&(s[a]=i[a])}return s}function _objectWithoutPropertiesLoose$x(i,o){if(i==null)return{};var s={};for(var a in i)if(Object.prototype.hasOwnProperty.call(i,a)){if(o.indexOf(a)>=0)continue;s[a]=i[a]}return s}function _extends$w(){return _extends$w=Object.assign?Object.assign.bind():function(i){for(var o=1;oReact.createElement(o.tag,_objectSpread$2({key:s},o.attr),Tree2Element(o.child)))}function GenIcon(i){return o=>React.createElement(IconBase,_extends$w({attr:_objectSpread$2({},i.attr)},o),Tree2Element(i.child))}function IconBase(i){var o=s=>{var{attr:a,size:_,title:$}=i,_e=_objectWithoutProperties$x(i,_excluded$x),tt=_||s.size||"1em",st;return s.className&&(st=s.className),i.className&&(st=(st?st+" ":"")+i.className),React.createElement("svg",_extends$w({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},s.attr,a,_e,{className:st,style:_objectSpread$2(_objectSpread$2({color:i.color||s.color},s.style),i.style),height:tt,width:tt,xmlns:"http://www.w3.org/2000/svg"}),$&&React.createElement("title",null,$),i.children)};return IconContext!==void 0?React.createElement(IconContext.Consumer,null,s=>o(s)):o(DefaultContext)}function FiCamera(i){return GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"},child:[]},{tag:"circle",attr:{cx:"12",cy:"13",r:"4"},child:[]}]})(i)}function FiChevronDown(i){return GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polyline",attr:{points:"6 9 12 15 18 9"},child:[]}]})(i)}function FiChevronLeft(i){return GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polyline",attr:{points:"15 18 9 12 15 6"},child:[]}]})(i)}function FiChevronsDown(i){return GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polyline",attr:{points:"7 13 12 18 17 13"},child:[]},{tag:"polyline",attr:{points:"7 6 12 11 17 6"},child:[]}]})(i)}function FiClock(i){return GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"12",cy:"12",r:"10"},child:[]},{tag:"polyline",attr:{points:"12 6 12 12 16 14"},child:[]}]})(i)}function FiGlobe(i){return GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"12",cy:"12",r:"10"},child:[]},{tag:"line",attr:{x1:"2",y1:"12",x2:"22",y2:"12"},child:[]},{tag:"path",attr:{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"},child:[]}]})(i)}function FiLayers(i){return GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polygon",attr:{points:"12 2 2 7 12 12 22 7 12 2"},child:[]},{tag:"polyline",attr:{points:"2 17 12 22 22 17"},child:[]},{tag:"polyline",attr:{points:"2 12 12 17 22 12"},child:[]}]})(i)}function FiMaximize2(i){return GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polyline",attr:{points:"15 3 21 3 21 9"},child:[]},{tag:"polyline",attr:{points:"9 21 3 21 3 15"},child:[]},{tag:"line",attr:{x1:"21",y1:"3",x2:"14",y2:"10"},child:[]},{tag:"line",attr:{x1:"3",y1:"21",x2:"10",y2:"14"},child:[]}]})(i)}function FiMinimize2(i){return GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polyline",attr:{points:"4 14 10 14 10 20"},child:[]},{tag:"polyline",attr:{points:"20 10 14 10 14 4"},child:[]},{tag:"line",attr:{x1:"14",y1:"10",x2:"21",y2:"3"},child:[]},{tag:"line",attr:{x1:"3",y1:"21",x2:"10",y2:"14"},child:[]}]})(i)}function FiMinus(i){return GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"line",attr:{x1:"5",y1:"12",x2:"19",y2:"12"},child:[]}]})(i)}function FiMonitor(i){return GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"},child:[]},{tag:"line",attr:{x1:"8",y1:"21",x2:"16",y2:"21"},child:[]},{tag:"line",attr:{x1:"12",y1:"17",x2:"12",y2:"21"},child:[]}]})(i)}function FiPlus(i){return GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"line",attr:{x1:"12",y1:"5",x2:"12",y2:"19"},child:[]},{tag:"line",attr:{x1:"5",y1:"12",x2:"19",y2:"12"},child:[]}]})(i)}function FiSettings(i){return GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"12",cy:"12",r:"3"},child:[]},{tag:"path",attr:{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"},child:[]}]})(i)}function FiTrash2(i){return GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polyline",attr:{points:"3 6 5 6 21 6"},child:[]},{tag:"path",attr:{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"},child:[]},{tag:"line",attr:{x1:"10",y1:"11",x2:"10",y2:"17"},child:[]},{tag:"line",attr:{x1:"14",y1:"11",x2:"14",y2:"17"},child:[]}]})(i)}function FiUsers(i){return GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"},child:[]},{tag:"circle",attr:{cx:"9",cy:"7",r:"4"},child:[]},{tag:"path",attr:{d:"M23 21v-2a4 4 0 0 0-3-3.87"},child:[]},{tag:"path",attr:{d:"M16 3.13a4 4 0 0 1 0 7.75"},child:[]}]})(i)}function FiX(i){return GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"line",attr:{x1:"18",y1:"6",x2:"6",y2:"18"},child:[]},{tag:"line",attr:{x1:"6",y1:"6",x2:"18",y2:"18"},child:[]}]})(i)}const isElectron$2=window.api!==void 0,commonStyles={scrollbar:{"&::-webkit-scrollbar":{width:"4px"},"&::-webkit-scrollbar-track":{bg:"whiteAlpha.100",borderRadius:"full"},"&::-webkit-scrollbar-thumb":{bg:"whiteAlpha.300",borderRadius:"full"}},panel:{border:"1px solid",borderColor:"whiteAlpha.200",borderRadius:"lg",bg:"blackAlpha.400"}},sidebarStyles={sidebar:{container:i=>({position:"absolute",left:0,top:0,height:"100%",width:"440px",bg:"gray.900",transform:i?"translateX(calc(-100% + 24px))":"translateX(0)",transition:"all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",display:"flex",flexDirection:"column",gap:4,overflow:i?"visible":"hidden",pb:"4"}),toggleButton:{position:"absolute",right:0,top:0,width:"24px",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",color:"whiteAlpha.700",_hover:{color:"white"},bg:"transparent",transition:"all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",zIndex:1},content:{flex:1,width:"100%",display:"flex",flexDirection:"column",gap:4,overflow:"hidden"},header:{width:"100%",display:"flex",alignItems:"center",gap:1,p:2}},chatHistoryPanel:{messageList:{css:{...commonStyles.scrollbar}}},historyDrawer:{listContainer:{flex:1,overflowY:"auto",px:4,py:2,css:commonStyles.scrollbar},historyItem:{mb:4,p:3,borderRadius:"md",bg:"whiteAlpha.50",cursor:"pointer",transition:"all 0.2s",_hover:{bg:"whiteAlpha.100"}},historyItemSelected:{bg:"whiteAlpha.200",borderLeft:"3px solid",borderColor:"blue.500"},historyHeader:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},timestamp:{fontSize:"sm",color:"whiteAlpha.700",fontFamily:"mono"},deleteButton:{variant:"ghost",colorScheme:"red",size:"sm",color:"red.300",opacity:.8,_hover:{opacity:1,bg:"whiteAlpha.200"}},messagePreview:{fontSize:"sm",color:"whiteAlpha.900",noOfLines:2,overflow:"hidden",textOverflow:"ellipsis"},drawer:{content:{background:"var(--chakra-colors-gray-900)",maxWidth:"440px",marginTop:isElectron$2?"30px":"0",height:isElectron$2?"calc(100vh - 30px)":"100vh"},title:{color:"white"},closeButton:{color:"white"},actionButton:{color:"white",borderColor:"white",variant:"outline"}}},cameraPanel:{container:{width:"97%",overflow:"hidden",px:4,minH:"240px"},header:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:4},videoContainer:{...commonStyles.panel,width:"100%",height:"240px",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",transition:"all 0.2s"},video:{width:"100%",height:"100%",objectFit:"cover",transform:"scaleX(-1)",borderRadius:"8px",display:"block"}},screenPanel:{container:{width:"97%",overflow:"hidden",px:4,minH:"240px"},header:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:4},screenContainer:{...commonStyles.panel,width:"100%",height:"240px",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",transition:"all 0.2s"},video:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"8px",display:"block"}},browserPanel:{container:{width:"97%",overflow:"hidden",px:4,minH:"240px"},header:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:4},browserContainer:{...commonStyles.panel,width:"100%",height:"240px",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",transition:"all 0.2s",cursor:"pointer",_hover:{bg:"whiteAlpha.100"}},iframe:{width:"100%",height:"100%",border:"none",borderRadius:"8px"}},bottomTab:{container:{width:"97%",px:4,position:"relative",zIndex:0},list:{borderBottom:"none",gap:"2"},trigger:{color:"whiteAlpha.700",display:"flex",alignItems:"center",gap:2,px:3,py:2,borderRadius:"md",_hover:{color:"white",bg:"whiteAlpha.50"},_selected:{color:"white",bg:"whiteAlpha.200"}}},groupDrawer:{section:{mb:6},sectionTitle:{fontSize:"lg",fontWeight:"semibold",color:"white",mb:3},inviteBox:{display:"flex",gap:2},input:{bg:"whiteAlpha.100",border:"none",color:"white",_placeholder:{color:"whiteAlpha.400"}},memberList:{display:"flex",flexDirection:"column",gap:2},memberItem:{display:"flex",justifyContent:"space-between",alignItems:"center",p:2,borderRadius:"md",bg:"whiteAlpha.100"},memberText:{color:"white",fontSize:"sm"},removeButton:{size:"sm",color:"red.300",bg:"transparent",_hover:{bg:"whiteAlpha.200"}},button:{color:"white",bg:"whiteAlpha.100",_hover:{bg:"whiteAlpha.200"}},clipboardButton:{color:"white",bg:"transparent",_hover:{bg:"whiteAlpha.200"},size:"sm"}},toolCallIndicator:{container:{pl:"44px",my:"1",gap:2,width:"100%",minHeight:"24px",display:"flex",alignItems:"center",justifyContent:"center"},icon:{color:"blue.300",boxSize:"14px"},text:{fontSize:"xs",color:"whiteAlpha.700",fontStyle:"italic"},spinner:{color:"blue.300",ml:0},completedIcon:{color:"green.300",boxSize:"14px",ml:0},errorIcon:{color:"red.300",boxSize:"14px",ml:0}}},chatPanelStyles=css$2` + .cs-message-list { + background: var(--chakra-colors-gray-900) !important; + padding: var(--chakra-space-4); + } + + .cs-message { + margin: 12px 0; + // padding-top: 20px !important; + } + + .cs-message__content { + background-color: var(--chakra-colors-gray-700) !important; + border-radius: var(--chakra-radii-md); + padding: 8px !important; + color: var(--chakra-colors-white) !important; + font-size: 0.95rem !important; + line-height: 1.5 !important; + margin-top: 4px !important; + } + + .cs-message__text { + padding: 8px 0 !important; + } + + .cs-message--outgoing .cs-message__content { + background-color: var(--chakra-colors-gray-600) !important; + } + + .cs-chat-container { + background: transparent !important; + border: 1px solid var(--chakra-colors-whiteAlpha-200); + border-radius: var(--chakra-radii-lg); + padding: var(--chakra-space-2); + } + + .cs-main-container { + border: none !important; + background: transparent !important; + width: calc(100% - 24px) !important; + margin-left: 0 !important; + } + + .cs-message__sender { + position: absolute !important; + top: 0 !important; + left: 36px !important; + font-size: 0.875rem !important; + font-weight: 600 !important; + color: var(--chakra-colors-whiteAlpha-900) !important; + } + + .cs-message__content-wrapper { + max-width: 80%; + margin: 0 8px; + } + + .cs-avatar { + background-color: var(--chakra-colors-blue-500) !important; + color: white !important; + width: 28px !important; + height: 28px !important; + font-size: 14px !important; + display: flex !important; + align-items: center !important; + justify-content: center !important; + border-radius: 50% !important; + } + + .cs-message--outgoing .cs-avatar { + background-color: var(--chakra-colors-green-500) !important; + } + + .cs-message__header { + display: block !important; + visibility: visible !important; + opacity: 1 !important; + } +`,warn=(i,o,s,a)=>{var $,_e,tt,st;const _=[s,{code:o,...a||{}}];if((_e=($=i==null?void 0:i.services)==null?void 0:$.logger)!=null&&_e.forward)return i.services.logger.forward(_,"warn","react-i18next::",!0);isString$1(_[0])&&(_[0]=`react-i18next:: ${_[0]}`),(st=(tt=i==null?void 0:i.services)==null?void 0:tt.logger)!=null&&st.warn?i.services.logger.warn(..._):console!=null&&console.warn&&console.warn(..._)},alreadyWarned={},warnOnce=(i,o,s,a)=>{isString$1(s)&&alreadyWarned[s]||(isString$1(s)&&(alreadyWarned[s]=new Date),warn(i,o,s,a))},loadedClb=(i,o)=>()=>{if(i.isInitialized)o();else{const s=()=>{setTimeout(()=>{i.off("initialized",s)},0),o()};i.on("initialized",s)}},loadNamespaces=(i,o,s)=>{i.loadNamespaces(o,loadedClb(i,s))},loadLanguages=(i,o,s,a)=>{if(isString$1(s)&&(s=[s]),i.options.preload&&i.options.preload.indexOf(o)>-1)return loadNamespaces(i,s,a);s.forEach(_=>{i.options.ns.indexOf(_)<0&&i.options.ns.push(_)}),i.loadLanguages(o,loadedClb(i,a))},hasLoadedNamespace=(i,o,s={})=>!o.languages||!o.languages.length?(warnOnce(o,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:o.languages}),!0):o.hasLoadedNamespace(i,{lng:s.lng,precheck:(a,_)=>{var $;if((($=s.bindI18n)==null?void 0:$.indexOf("languageChanging"))>-1&&a.services.backendConnector.backend&&a.isLanguageChangingTo&&!_(a.isLanguageChangingTo,i))return!1}}),isString$1=i=>typeof i=="string",isObject=i=>typeof i=="object"&&i!==null,matchHtmlEntity=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,htmlEntities={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},unescapeHtmlEntity=i=>htmlEntities[i],unescape=i=>i.replace(matchHtmlEntity,unescapeHtmlEntity);let defaultOptions$1={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape};const setDefaults=(i={})=>{defaultOptions$1={...defaultOptions$1,...i}},getDefaults$1=()=>defaultOptions$1;let i18nInstance;const setI18n=i=>{i18nInstance=i},getI18n=()=>i18nInstance,initReactI18next={type:"3rdParty",init(i){setDefaults(i.options.react),setI18n(i)}},I18nContext=reactExports.createContext();class ReportNamespaces{constructor(){this.usedNamespaces={}}addUsedNamespaces(o){o.forEach(s=>{this.usedNamespaces[s]||(this.usedNamespaces[s]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const usePrevious=(i,o)=>{const s=reactExports.useRef();return reactExports.useEffect(()=>{s.current=i},[i,o]),s.current},alwaysNewT=(i,o,s,a)=>i.getFixedT(o,s,a),useMemoizedT=(i,o,s,a)=>reactExports.useCallback(alwaysNewT(i,o,s,a),[i,o,s,a]),useTranslation=(i,o={})=>{var ft,ht,bt,yt;const{i18n:s}=o,{i18n:a,defaultNS:_}=reactExports.useContext(I18nContext)||{},$=s||a||getI18n();if($&&!$.reportNamespaces&&($.reportNamespaces=new ReportNamespaces),!$){warnOnce($,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const mt=(vt,wt)=>isString$1(wt)?wt:isObject(wt)&&isString$1(wt.defaultValue)?wt.defaultValue:Array.isArray(vt)?vt[vt.length-1]:vt,gt=[mt,{},!1];return gt.t=mt,gt.i18n={},gt.ready=!1,gt}(ft=$.options.react)!=null&&ft.wait&&warnOnce($,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const _e={...getDefaults$1(),...$.options.react,...o},{useSuspense:tt,keyPrefix:st}=_e;let it=_||((ht=$.options)==null?void 0:ht.defaultNS);it=isString$1(it)?[it]:it||["translation"],(yt=(bt=$.reportNamespaces).addUsedNamespaces)==null||yt.call(bt,it);const nt=($.isInitialized||$.initializedStoreOnce)&&it.every(mt=>hasLoadedNamespace(mt,$,_e)),et=useMemoizedT($,o.lng||null,_e.nsMode==="fallback"?it:it[0],st),j=()=>et,rt=()=>alwaysNewT($,o.lng||null,_e.nsMode==="fallback"?it:it[0],st),[ot,at]=reactExports.useState(j);let lt=it.join();o.lng&&(lt=`${o.lng}${lt}`);const ut=usePrevious(lt),ct=reactExports.useRef(!0);reactExports.useEffect(()=>{const{bindI18n:mt,bindI18nStore:gt}=_e;ct.current=!0,!nt&&!tt&&(o.lng?loadLanguages($,o.lng,it,()=>{ct.current&&at(rt)}):loadNamespaces($,it,()=>{ct.current&&at(rt)})),nt&&ut&&ut!==lt&&ct.current&&at(rt);const vt=()=>{ct.current&&at(rt)};return mt&&($==null||$.on(mt,vt)),gt&&($==null||$.store.on(gt,vt)),()=>{ct.current=!1,$&&(mt==null||mt.split(" ").forEach(wt=>$.off(wt,vt))),gt&&$&>.split(" ").forEach(wt=>$.store.off(wt,vt))}},[$,lt]),reactExports.useEffect(()=>{ct.current&&nt&&at(j)},[$,st,nt]);const dt=[ot,$,nt];if(dt.t=ot,dt.i18n=$,dt.ready=nt,nt||!nt&&!tt)return dt;throw new Promise(mt=>{o.lng?loadLanguages($,o.lng,it,()=>mt()):loadNamespaces($,it,()=>mt())})};function LuBell(i){return GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"},child:[]},{tag:"path",attr:{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0"},child:[]}]})(i)}function LuCheck(i){return GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M20 6 9 17l-5-5"},child:[]}]})(i)}function LuClipboard(i){return GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1"},child:[]},{tag:"path",attr:{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"},child:[]}]})(i)}function LuHand(i){return GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2"},child:[]},{tag:"path",attr:{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2"},child:[]},{tag:"path",attr:{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8"},child:[]},{tag:"path",attr:{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"},child:[]}]})(i)}function LuLink(i){return GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"},child:[]},{tag:"path",attr:{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"},child:[]}]})(i)}function LuMicOff(i){return GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"line",attr:{x1:"2",x2:"22",y1:"2",y2:"22"},child:[]},{tag:"path",attr:{d:"M18.89 13.23A7.12 7.12 0 0 0 19 12v-2"},child:[]},{tag:"path",attr:{d:"M5 10v2a7 7 0 0 0 12 5"},child:[]},{tag:"path",attr:{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33"},child:[]},{tag:"path",attr:{d:"M9 9v3a3 3 0 0 0 5.12 2.12"},child:[]},{tag:"line",attr:{x1:"12",x2:"12",y1:"19",y2:"22"},child:[]}]})(i)}function LuMic(i){return GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"},child:[]},{tag:"path",attr:{d:"M19 10v2a7 7 0 0 1-14 0v-2"},child:[]},{tag:"line",attr:{x1:"12",x2:"12",y1:"19",y2:"22"},child:[]}]})(i)}function LuSend(i){return GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z"},child:[]},{tag:"path",attr:{d:"m21.854 2.147-10.94 10.939"},child:[]}]})(i)}function LuX(i){return GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M18 6 6 18"},child:[]},{tag:"path",attr:{d:"m6 6 12 12"},child:[]}]})(i)}const CloseButton=reactExports.forwardRef((i,o)=>jsxRuntimeExports.jsx(IconButton,{variant:"ghost","aria-label":"Close",ref:o,...i,children:i.children??jsxRuntimeExports.jsx(LuX,{})})),isElectron$1=window.api!==void 0,settingStyles={settingUI:{tabs:{root:{width:"100%",variant:"plain",colorPalette:"gray"},content:{},trigger:{color:"whiteAlpha.600",_selected:{color:"white"},_hover:{color:"white"}},list:{display:"flex",justifyContent:"flex-start",width:"100%",borderBottom:"1px solid",borderColor:"whiteAlpha.200",mb:4,pl:0}},drawerContent:{bg:"gray.900",maxWidth:"440px",height:isElectron$1?"calc(100vh - 30px)":"100vh",borderLeft:"1px solid",borderColor:"whiteAlpha.200"},drawerHeader:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",position:"relative",px:6,py:4},drawerTitle:{color:"white",fontSize:"lg",fontWeight:"semibold"},closeButton:{position:"absolute",right:1,top:1,color:"white"}},general:{field:{label:{color:"whiteAlpha.800"}},select:{root:{colorPalette:"gray",bg:"gray.800"},trigger:{bg:"gray.800"}},input:{bg:"gray.800"}},common:{field:{orientation:"horizontal"},fieldLabel:{fontSize:"sm",color:"whiteAlpha.800",whiteSpace:"nowrap"},switch:{size:"md",colorPalette:"blue",variant:"solid"},numberInput:{root:{pattern:"[0-9]*\\.?[0-9]*",inputMode:"decimal"},input:{bg:"whiteAlpha.100",borderColor:"whiteAlpha.200",_hover:{bg:"whiteAlpha.200"}}},container:{gap:8,maxW:"sm",css:{"--field-label-width":"120px"}}}};function useLocalStorage(i,o,s){const[a,_]=reactExports.useState(()=>{try{const _e=window.localStorage.getItem(i);return _e?JSON.parse(_e):o}catch(_e){return console.error(`Error reading localStorage key "${i}":`,_e),o}});return[a,_e=>{try{const tt=_e instanceof Function?_e(a):_e,st=s!=null&&s.filter?s.filter(tt):tt;_(tt),window.localStorage.setItem(i,JSON.stringify(st))}catch(tt){console.error(`Error setting localStorage key "${i}":`,tt)}}]}var extendStatics=function(i,o){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,a){s.__proto__=a}||function(s,a){for(var _ in a)Object.prototype.hasOwnProperty.call(a,_)&&(s[_]=a[_])},extendStatics(i,o)};function __extends(i,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");extendStatics(i,o);function s(){this.constructor=i}i.prototype=o===null?Object.create(o):(s.prototype=o.prototype,new s)}function __values(i){var o=typeof Symbol=="function"&&Symbol.iterator,s=o&&i[o],a=0;if(s)return s.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&a>=i.length&&(i=void 0),{value:i&&i[a++],done:!i}}};throw new TypeError(o?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(i,o){var s=typeof Symbol=="function"&&i[Symbol.iterator];if(!s)return i;var a=s.call(i),_,$=[],_e;try{for(;(o===void 0||o-- >0)&&!(_=a.next()).done;)$.push(_.value)}catch(tt){_e={error:tt}}finally{try{_&&!_.done&&(s=a.return)&&s.call(a)}finally{if(_e)throw _e.error}}return $}function __spreadArray(i,o,s){if(s||arguments.length===2)for(var a=0,_=o.length,$;a<_;a++)($||!(a in o))&&($||($=Array.prototype.slice.call(o,0,a)),$[a]=o[a]);return i.concat($||Array.prototype.slice.call(o))}typeof SuppressedError=="function"&&SuppressedError;function isFunction(i){return typeof i=="function"}function createErrorClass(i){var o=function(a){Error.call(a),a.stack=new Error().stack},s=i(o);return s.prototype=Object.create(Error.prototype),s.prototype.constructor=s,s}var UnsubscriptionError=createErrorClass(function(i){return function(s){i(this),this.message=s?s.length+` errors occurred during unsubscription: +`+s.map(function(a,_){return _+1+") "+a.toString()}).join(` + `):"",this.name="UnsubscriptionError",this.errors=s}});function arrRemove(i,o){if(i){var s=i.indexOf(o);0<=s&&i.splice(s,1)}}var Subscription=function(){function i(o){this.initialTeardown=o,this.closed=!1,this._parentage=null,this._finalizers=null}return i.prototype.unsubscribe=function(){var o,s,a,_,$;if(!this.closed){this.closed=!0;var _e=this._parentage;if(_e)if(this._parentage=null,Array.isArray(_e))try{for(var tt=__values(_e),st=tt.next();!st.done;st=tt.next()){var it=st.value;it.remove(this)}}catch(at){o={error:at}}finally{try{st&&!st.done&&(s=tt.return)&&s.call(tt)}finally{if(o)throw o.error}}else _e.remove(this);var nt=this.initialTeardown;if(isFunction(nt))try{nt()}catch(at){$=at instanceof UnsubscriptionError?at.errors:[at]}var et=this._finalizers;if(et){this._finalizers=null;try{for(var j=__values(et),rt=j.next();!rt.done;rt=j.next()){var ot=rt.value;try{execFinalizer(ot)}catch(at){$=$??[],at instanceof UnsubscriptionError?$=__spreadArray(__spreadArray([],__read($)),__read(at.errors)):$.push(at)}}}catch(at){a={error:at}}finally{try{rt&&!rt.done&&(_=j.return)&&_.call(j)}finally{if(a)throw a.error}}}if($)throw new UnsubscriptionError($)}},i.prototype.add=function(o){var s;if(o&&o!==this)if(this.closed)execFinalizer(o);else{if(o instanceof i){if(o.closed||o._hasParent(this))return;o._addParent(this)}(this._finalizers=(s=this._finalizers)!==null&&s!==void 0?s:[]).push(o)}},i.prototype._hasParent=function(o){var s=this._parentage;return s===o||Array.isArray(s)&&s.includes(o)},i.prototype._addParent=function(o){var s=this._parentage;this._parentage=Array.isArray(s)?(s.push(o),s):s?[s,o]:o},i.prototype._removeParent=function(o){var s=this._parentage;s===o?this._parentage=null:Array.isArray(s)&&arrRemove(s,o)},i.prototype.remove=function(o){var s=this._finalizers;s&&arrRemove(s,o),o instanceof i&&o._removeParent(this)},i.EMPTY=function(){var o=new i;return o.closed=!0,o}(),i}(),EMPTY_SUBSCRIPTION=Subscription.EMPTY;function isSubscription(i){return i instanceof Subscription||i&&"closed"in i&&isFunction(i.remove)&&isFunction(i.add)&&isFunction(i.unsubscribe)}function execFinalizer(i){isFunction(i)?i():i.unsubscribe()}var config$1={Promise:void 0},timeoutProvider={setTimeout:function(i,o){for(var s=[],a=2;a0},enumerable:!1,configurable:!0}),o.prototype._trySubscribe=function(s){return this._throwIfClosed(),i.prototype._trySubscribe.call(this,s)},o.prototype._subscribe=function(s){return this._throwIfClosed(),this._checkFinalizedStatuses(s),this._innerSubscribe(s)},o.prototype._innerSubscribe=function(s){var a=this,_=this,$=_.hasError,_e=_.isStopped,tt=_.observers;return $||_e?EMPTY_SUBSCRIPTION:(this.currentObservers=null,tt.push(s),new Subscription(function(){a.currentObservers=null,arrRemove(tt,s)}))},o.prototype._checkFinalizedStatuses=function(s){var a=this,_=a.hasError,$=a.thrownError,_e=a.isStopped;_?s.error($):_e&&s.complete()},o.prototype.asObservable=function(){var s=new Observable;return s.source=this,s},o.create=function(s,a){return new AnonymousSubject(s,a)},o}(Observable),AnonymousSubject=function(i){__extends(o,i);function o(s,a){var _=i.call(this)||this;return _.destination=s,_.source=a,_}return o.prototype.next=function(s){var a,_;(_=(a=this.destination)===null||a===void 0?void 0:a.next)===null||_===void 0||_.call(a,s)},o.prototype.error=function(s){var a,_;(_=(a=this.destination)===null||a===void 0?void 0:a.error)===null||_===void 0||_.call(a,s)},o.prototype.complete=function(){var s,a;(a=(s=this.destination)===null||s===void 0?void 0:s.complete)===null||a===void 0||a.call(s)},o.prototype._subscribe=function(s){var a,_;return(_=(a=this.source)===null||a===void 0?void 0:a.subscribe(s))!==null&&_!==void 0?_:EMPTY_SUBSCRIPTION},o}(Subject);const toaster=createToaster({placement:"top-end",pauseOnPageIdle:!0,max:5});function Toaster(){return jsxRuntimeExports.jsx(Portal,{children:jsxRuntimeExports.jsx(Toaster$1,{toaster,insetInline:{mdDown:"4"},children:i=>{var o;return jsxRuntimeExports.jsxs(ToastRoot,{width:{md:"sm"},children:[i.type==="loading"?jsxRuntimeExports.jsx(Spinner,{size:"sm",color:"blue.solid"}):jsxRuntimeExports.jsx(ToastIndicator,{}),jsxRuntimeExports.jsxs(Stack,{gap:"1",flex:"1",maxWidth:"100%",children:[i.title&&jsxRuntimeExports.jsx(ToastTitle,{children:i.title}),i.description&&jsxRuntimeExports.jsx(ToastDescription,{children:i.description})]}),i.action&&jsxRuntimeExports.jsx(ToastActionTrigger,{children:i.action.label}),((o=i.meta)==null?void 0:o.closable)&&jsxRuntimeExports.jsx(ToastCloseTrigger,{})]})}})})}const getTranslation=()=>{try{const i=require("i18next").default;return i.t.bind(i)}catch{return o=>o}},on=class on{constructor(){xt(this,"ws",null);xt(this,"messageSubject",new Subject);xt(this,"stateSubject",new Subject);xt(this,"currentState","CLOSED")}static getInstance(){return on.instance||(on.instance=new on),on.instance}initializeConnection(){this.sendMessage({type:"fetch-backgrounds"}),this.sendMessage({type:"fetch-configs"}),this.sendMessage({type:"fetch-history-list"}),this.sendMessage({type:"create-new-history"})}connect(o){var s,a;(((s=this.ws)==null?void 0:s.readyState)===WebSocket.CONNECTING||((a=this.ws)==null?void 0:a.readyState)===WebSocket.OPEN)&&this.disconnect();try{this.ws=new WebSocket(o),this.currentState="CONNECTING",this.stateSubject.next("CONNECTING"),this.ws.onopen=()=>{this.currentState="OPEN",this.stateSubject.next("OPEN"),this.initializeConnection()},this.ws.onmessage=_=>{try{const $=JSON.parse(_.data);this.messageSubject.next($)}catch($){console.error("Failed to parse WebSocket message:",$),toaster.create({title:`${getTranslation()("error.failedParseWebSocket")}: ${$}`,type:"error",duration:2e3})}},this.ws.onclose=()=>{this.currentState="CLOSED",this.stateSubject.next("CLOSED")},this.ws.onerror=()=>{this.currentState="CLOSED",this.stateSubject.next("CLOSED")}}catch(_){console.error("Failed to connect to WebSocket:",_),this.currentState="CLOSED",this.stateSubject.next("CLOSED")}}sendMessage(o){var s;((s=this.ws)==null?void 0:s.readyState)===WebSocket.OPEN?this.ws.send(JSON.stringify(o)):(console.warn("WebSocket is not open. Unable to send message:",o),toaster.create({title:getTranslation()("error.websocketNotOpen"),type:"error",duration:2e3}))}onMessage(o){return this.messageSubject.subscribe(o)}onStateChange(o){return this.stateSubject.subscribe(o)}disconnect(){var o;(o=this.ws)==null||o.close(),this.ws=null}getCurrentState(){return this.currentState}};xt(on,"instance");let WebSocketService=on;const wsService=WebSocketService.getInstance(),DEFAULT_WS_URL="ws://127.0.0.1:12393/client-ws",DEFAULT_BASE_URL="http://127.0.0.1:12393",WebSocketContext=React.createContext({sendMessage:wsService.sendMessage.bind(wsService),wsState:"CLOSED",reconnect:()=>wsService.connect(DEFAULT_WS_URL),wsUrl:DEFAULT_WS_URL,setWsUrl:()=>{},baseUrl:DEFAULT_BASE_URL,setBaseUrl:()=>{}});function useWebSocket(){const i=reactExports.useContext(WebSocketContext);if(!i)throw new Error("useWebSocket must be used within a WebSocketProvider");return i}const defaultWsUrl=DEFAULT_WS_URL,defaultBaseUrl=DEFAULT_BASE_URL,BgUrlContext=reactExports.createContext(null);function BgUrlProvider({children:i}){const{baseUrl:o}=useWebSocket(),s=`${o}/bg/ceiling-window-room-night.jpeg`,[a,_]=useLocalStorage("backgroundUrl",s),[$,_e]=reactExports.useState([]),tt=reactExports.useCallback(()=>{_(s)},[_,s]),st=reactExports.useCallback(ot=>{_e(at=>[...at,ot])},[]),it=reactExports.useCallback(ot=>{_e(at=>at.filter(lt=>lt.name!==ot))},[]),nt=reactExports.useMemo(()=>a===s,[a,s]),[et,j]=reactExports.useState(!1),rt=reactExports.useMemo(()=>({backgroundUrl:a,setBackgroundUrl:_,backgroundFiles:$,setBackgroundFiles:_e,resetBackground:tt,addBackgroundFile:st,removeBackgroundFile:it,isDefaultBackground:nt,useCameraBackground:et,setUseCameraBackground:j}),[a,_,$,tt,st,it,nt,et]);return jsxRuntimeExports.jsx(BgUrlContext.Provider,{value:rt,children:i})}function useBgUrl(){const i=reactExports.useContext(BgUrlContext);if(!i)throw new Error("useBgUrl must be used within a BgUrlProvider");return i}const DEFAULT_CONFIG$1={confName:"",confUid:"",configFiles:[]},ConfigContext=reactExports.createContext(null);function CharacterConfigProvider({children:i}){const[o,s]=reactExports.useState(DEFAULT_CONFIG$1.confName),[a,_]=reactExports.useState(DEFAULT_CONFIG$1.confUid),[$,_e]=reactExports.useState(DEFAULT_CONFIG$1.configFiles),tt=reactExports.useCallback(it=>{var nt;return(nt=$.find(et=>et.name===it))==null?void 0:nt.filename},[$]),st=reactExports.useMemo(()=>({confName:o,confUid:a,configFiles:$,setConfName:s,setConfUid:_,setConfigFiles:_e,getFilenameByName:tt}),[o,a,$,tt]);return reactExports.useEffect(()=>{var it,nt;(nt=(it=window.api)==null?void 0:it.updateConfigFiles)==null||nt.call(it,$)},[$]),jsxRuntimeExports.jsx(ConfigContext.Provider,{value:st,children:i})}function useConfig(){const i=reactExports.useContext(ConfigContext);if(!i)throw new Error("useConfig must be used within a CharacterConfigProvider");return i}const DEFAULT_SUBTITLE={text:"Hi, I'm some random AI VTuber. Who the hell are ya? Ahh, you must be amazed by my awesomeness, right? right?"},SubtitleContext=reactExports.createContext(null),SubtitleProvider=reactExports.memo(({children:i})=>{const[o,s]=reactExports.useState(DEFAULT_SUBTITLE.text),[a,_]=reactExports.useState(!0),$=reactExports.useMemo(()=>({subtitleText:o,setSubtitleText:s,showSubtitle:a,setShowSubtitle:_}),[o,a]);return jsxRuntimeExports.jsx(SubtitleContext.Provider,{value:$,children:i})});function useSubtitle(){const i=reactExports.useContext(SubtitleContext);if(!i)throw new Error("useSubtitle must be used within a SubtitleProvider");return i}const DEFAULT_CAMERA_CONFIG={width:320,height:240},CameraContext=reactExports.createContext(null);function CameraProvider({children:i}){const{t:o}=useTranslation(),[s,a]=reactExports.useState(!1),[_,$]=reactExports.useState(!1),[_e,tt]=reactExports.useState(DEFAULT_CAMERA_CONFIG),st=reactExports.useRef(null),it=reactExports.useRef(null),nt=reactExports.useRef(null),et=reactExports.useCallback(async()=>{try{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new Error(o("error.cameraApiNotSupported"));if(!(await navigator.mediaDevices.enumerateDevices()).some(dt=>dt.kind==="videoinput"))throw new Error(o("error.noCameraFound"));const ct=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:_e.width},height:{ideal:_e.height}}});st.current=ct,nt.current&&(nt.current.srcObject=ct),a(!0)}catch(lt){throw console.error("Failed to start camera:",lt),toaster.create({title:`${o("error.failedStartCamera")}: ${lt}`,type:"error",duration:2e3}),lt}},[_e,o]),j=reactExports.useCallback(()=>{st.current&&(st.current.getTracks().forEach(lt=>lt.stop()),st.current=null,a(!1))},[]),rt=reactExports.useCallback(async()=>{try{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new Error(o("error.cameraApiNotSupported"));if(!(await navigator.mediaDevices.enumerateDevices()).some(dt=>dt.kind==="videoinput"))throw new Error(o("error.noCameraFound"));const ct=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:_e.width},height:{ideal:_e.height}}});it.current=ct,$(!0)}catch(lt){throw console.error("Failed to start background camera:",lt),toaster.create({title:`${o("error.failedStartBackgroundCamera")}: ${lt}`,type:"error",duration:2e3}),lt}},[_e,o]),ot=reactExports.useCallback(()=>{it.current&&(it.current.getTracks().forEach(lt=>lt.stop()),it.current=null,$(!1))},[]),at=reactExports.useMemo(()=>({isStreaming:s,stream:st.current,startCamera:et,stopCamera:j,cameraConfig:_e,setCameraConfig:tt,videoRef:nt,backgroundStream:it.current,startBackgroundCamera:rt,stopBackgroundCamera:ot,isBackgroundStreaming:_}),[s,et,j,_e,_,rt,ot]);return jsxRuntimeExports.jsx(CameraContext.Provider,{value:at,children:i})}function useCamera(){const i=reactExports.useContext(CameraContext);if(!i)throw new Error("useCamera must be used within a CameraProvider");return i}const DEFAULT_CONFIG={modelInfo:{scrollToResize:!0},isLoading:!1},Live2DConfigContext=reactExports.createContext(null);function Live2DConfigProvider({children:i}){const{confUid:o}=useConfig(),[s,a]=reactExports.useState(DEFAULT_CONFIG.isLoading),[_,$]=useLocalStorage("modelInfo",DEFAULT_CONFIG.modelInfo,{filter:st=>st&&{...st,url:""}}),_e=st=>{if(!(st!=null&&st.url)){$(void 0);return}const it=Number(st.kScale||.5)*2;console.log("Setting model info with default scale:",it),$({...st,kScale:it,pointerInteractive:"pointerInteractive"in st?st.pointerInteractive:(_==null?void 0:_.pointerInteractive)??!0,scrollToResize:"scrollToResize"in st?st.scrollToResize:(_==null?void 0:_.scrollToResize)??!0})},tt=reactExports.useMemo(()=>({modelInfo:_,setModelInfo:_e,isLoading:s,setIsLoading:a}),[_,s,a]);return jsxRuntimeExports.jsx(Live2DConfigContext.Provider,{value:tt,children:i})}function useLive2DConfig(){const i=reactExports.useContext(Live2DConfigContext);if(!i)throw new Error("useLive2DConfig must be used within a Live2DConfigProvider");return i}var dist={},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(o=>o.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 o=["error","debug","warn"];function s(_){return(...$)=>{console[_](i.LOG_PREFIX,...$)}}const a=o.reduce((_,$)=>(_[$]=s($),_),{});i.log=a})(logging);var messages={};Object.defineProperty(messages,"__esModule",{value:!0});messages.Message=void 0;var Message$1;(function(i){i.AudioFrame="AUDIO_FRAME",i.SpeechStart="SPEECH_START",i.VADMisfire="VAD_MISFIRE",i.SpeechEnd="SPEECH_END",i.SpeechStop="SPEECH_STOP",i.SpeechRealStart="SPEECH_REAL_START",i.FrameProcessed="FRAME_PROCESSED"})(Message$1||(messages.Message=Message$1={}));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 o=i.reduce((a,_)=>(a.push(a.at(-1)+_.length),a),[0]),s=new Float32Array(o.at(-1));return i.forEach((a,_)=>{const $=o[_];s.set(a,$)}),s};class FrameProcessor{constructor(o,s,a){this.modelProcessFunc=o,this.modelResetFunc=s,this.options=a,this.speaking=!1,this.redemptionCounter=0,this.speechFrameCount=0,this.active=!1,this.speechRealStartFired=!1,this.reset=()=>{this.speaking=!1,this.speechRealStartFired=!1,this.audioBuffer=[],this.modelResetFunc(),this.redemptionCounter=0,this.speechFrameCount=0},this.pause=_=>{this.active=!1,this.options.submitUserSpeechOnPause?this.endSegment(_):this.reset()},this.resume=()=>{this.active=!0},this.endSegment=_=>{const $=this.audioBuffer;this.audioBuffer=[];const _e=this.speaking;if(this.reset(),_e)if($.reduce((st,it)=>it.isSpeech?st+1:st,0)>=this.options.minSpeechFrames){const st=concatArrays($.map(it=>it.frame));_({msg:messages_1.Message.SpeechEnd,audio:st})}else _({msg:messages_1.Message.VADMisfire});return{}},this.process=async(_,$)=>{if(!this.active)return;const _e=await this.modelProcessFunc(_),tt=_e.isSpeech>=this.options.positiveSpeechThreshold;if($({probs:_e,msg:messages_1.Message.FrameProcessed,frame:_}),this.audioBuffer.push({frame:_,isSpeech:tt}),tt&&(this.speechFrameCount++,this.redemptionCounter=0),tt&&!this.speaking&&(this.speaking=!0,$({msg:messages_1.Message.SpeechStart})),this.speaking&&this.speechFrameCount===this.options.minSpeechFrames&&!this.speechRealStartFired&&(this.speechRealStartFired=!0,$({msg:messages_1.Message.SpeechRealStart})),_e.isSpeech=this.options.redemptionFrames){this.redemptionCounter=0,this.speechFrameCount=0,this.speaking=!1,this.speechRealStartFired=!1;const st=this.audioBuffer;if(this.audioBuffer=[],st.reduce((nt,et)=>et.isSpeech?nt+1:nt,0)>=this.options.minSpeechFrames){const nt=concatArrays(st.map(et=>et.frame));$({msg:messages_1.Message.SpeechEnd,audio:nt})}else $({msg:messages_1.Message.VADMisfire})}if(!this.speaking){for(;this.audioBuffer.length>this.options.preSpeechPadFrames;)this.audioBuffer.shift();this.speechFrameCount=0}},this.audioBuffer=[],this.reset()}}frameProcessor.FrameProcessor=FrameProcessor;var nonRealTimeVad={},ortWeb_min={exports:{}};const backends={},backendsSortedByPriority=[],registerBackend=(i,o,s)=>{if(o&&typeof o.init=="function"&&typeof o.createSessionHandler=="function"){const a=backends[i];if(a===void 0)backends[i]={backend:o,priority:s};else{if(a.priority>s)return;if(a.priority===s&&a.backend!==o)throw new Error(`cannot register backend "${i}" using priority ${s}`)}if(s>=0){const _=backendsSortedByPriority.indexOf(i);_!==-1&&backendsSortedByPriority.splice(_,1);for(let $=0;${const o=i.length===0?backendsSortedByPriority:i,s=[];for(const a of o){const _=backends[a];if(_){if(_.initialized)return _.backend;if(_.aborted)continue;const $=!!_.initPromise;try{return $||(_.initPromise=_.backend.init()),await _.initPromise,_.initialized=!0,_.backend}catch(_e){$||s.push({name:a,err:_e}),_.aborted=!0}finally{delete _.initPromise}}}throw new Error(`no available backend found. ERR: ${s.map(a=>`[${a.name}] ${a.err}`).join(", ")}`)};class EnvImpl{constructor(){this.wasm={},this.webgl={},this.logLevelInternal="warning"}set logLevel(o){if(o!==void 0){if(typeof o!="string"||["verbose","info","warning","error","fatal"].indexOf(o)===-1)throw new Error(`Unsupported logging level: ${o}`);this.logLevelInternal=o}}get logLevel(){return this.logLevelInternal}}const env$1=new EnvImpl,isBigInt64ArrayAvailable=typeof BigInt64Array<"u"&&typeof BigInt64Array.from=="function",isBigUint64ArrayAvailable=typeof BigUint64Array<"u"&&typeof BigUint64Array.from=="function",NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP=new Map([["float32",Float32Array],["uint8",Uint8Array],["int8",Int8Array],["uint16",Uint16Array],["int16",Int16Array],["int32",Int32Array],["bool",Uint8Array],["float64",Float64Array],["uint32",Uint32Array]]),NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP=new Map([[Float32Array,"float32"],[Uint8Array,"uint8"],[Int8Array,"int8"],[Uint16Array,"uint16"],[Int16Array,"int16"],[Int32Array,"int32"],[Float64Array,"float64"],[Uint32Array,"uint32"]]);isBigInt64ArrayAvailable&&(NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP.set("int64",BigInt64Array),NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP.set(BigInt64Array,"int64"));isBigUint64ArrayAvailable&&(NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP.set("uint64",BigUint64Array),NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP.set(BigUint64Array,"uint64"));const calculateSize=i=>{let o=1;for(let s=0;s{const et=document.createElement("canvas"),j=et.getContext("2d");if(!o||!j)return nt();const rt=new Image;rt.crossOrigin="Anonymous",rt.src=o,rt.onload=()=>{et.width=rt.width,et.height=rt.height,j.drawImage(rt,0,0,et.width,et.height);const ot=j.getImageData(0,0,et.width,et.height);if(s!==void 0){if(s.height!==void 0&&s.height!==et.height)throw new Error("Image input config height doesn't match ImageBitmap height");if(st.height=et.height,s.width!==void 0&&s.width!==et.width)throw new Error("Image input config width doesn't match ImageBitmap width");st.width=et.width}else st.height=et.height,st.width=et.width;it(nn.bufferToTensor(ot.data,st))}});throw new Error("Input data provided is not supported - aborted tensor creation")}if(tt!==void 0)return nn.bufferToTensor(tt,st);throw new Error("Input data provided is not supported - aborted tensor creation")}toImageData(o){var s,a;const _=document.createElement("canvas").getContext("2d");let $;if(_!=null){const _e=this.dims[3],tt=this.dims[2],st=this.dims[1],it=o!==void 0&&o.format!==void 0?o.format:"RGB",nt=o!==void 0&&((s=o.norm)===null||s===void 0?void 0:s.mean)!==void 0?o.norm.mean:255,et=o!==void 0&&((a=o.norm)===null||a===void 0?void 0:a.bias)!==void 0?o.norm.bias:0,j=tt*_e;if(o!==void 0){if(o.height!==void 0&&o.height!==tt)throw new Error("Image output config height doesn't match tensor height");if(o.width!==void 0&&o.width!==_e)throw new Error("Image output config width doesn't match tensor width");if(o.format!==void 0&&st===4&&o.format!=="RGBA"||st===3&&o.format!=="RGB"&&o.format!=="BGR")throw new Error("Tensor format doesn't match input tensor dims")}const rt=4;let ot=0,at=1,lt=2,ut=3,ct=0,dt=j,ft=j*2,ht=-1;it==="RGBA"?(ct=0,dt=j,ft=j*2,ht=j*3):it==="RGB"?(ct=0,dt=j,ft=j*2):it==="RBG"&&(ct=0,ft=j,dt=j*2),$=_.createImageData(_e,tt);for(let bt=0;bt"u")throw new Error(`input '${it}' is missing in 'feeds'.`);if(_e)for(const it of this.outputNames)_[it]=null;const tt=await this.handler.run(o,_,$),st={};for(const it in tt)Object.hasOwnProperty.call(tt,it)&&(st[it]=new Tensor(tt[it].type,tt[it].data,tt[it].dims));return st}static async create(o,s,a,_){let $,_e={};if(typeof o=="string"){if($=o,typeof s=="object"&&s!==null)_e=s;else if(typeof s<"u")throw new TypeError("'options' must be an object.")}else if(o instanceof Uint8Array){if($=o,typeof s=="object"&&s!==null)_e=s;else if(typeof s<"u")throw new TypeError("'options' must be an object.")}else if(o instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&o instanceof SharedArrayBuffer){const et=o;let j=0,rt=o.byteLength;if(typeof s=="object"&&s!==null)_e=s;else if(typeof s=="number"){if(j=s,!Number.isSafeInteger(j))throw new RangeError("'byteOffset' must be an integer.");if(j<0||j>=et.byteLength)throw new RangeError(`'byteOffset' is out of range [0, ${et.byteLength}).`);if(rt=o.byteLength-j,typeof a=="number"){if(rt=a,!Number.isSafeInteger(rt))throw new RangeError("'byteLength' must be an integer.");if(rt<=0||j+rt>et.byteLength)throw new RangeError(`'byteLength' is out of range (0, ${et.byteLength-j}].`);if(typeof _=="object"&&_!==null)_e=_;else if(typeof _<"u")throw new TypeError("'options' must be an object.")}else if(typeof a<"u")throw new TypeError("'byteLength' must be a number.")}else if(typeof s<"u")throw new TypeError("'options' must be an object.");$=new Uint8Array(et,j,rt)}else throw new TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");const st=(_e.executionProviders||[]).map(et=>typeof et=="string"?et:et.name),nt=await(await resolveBackend(st)).createSessionHandler($,_e);return new Ss(nt)}startProfiling(){this.handler.startProfiling()}endProfiling(){this.handler.endProfiling()}get inputNames(){return this.handler.inputNames}get outputNames(){return this.handler.outputNames}};const InferenceSession=InferenceSession$1,lib=Object.freeze(Object.defineProperty({__proto__:null,InferenceSession,Tensor,env:env$1,registerBackend},Symbol.toStringTag,{value:"Module"})),require$$0=getAugmentedNamespace(lib);/*! +* ONNX Runtime Web v1.14.0 +* Copyright (c) Microsoft Corporation. All rights reserved. +* Licensed under the MIT License. +*/(function(module,exports){(function(i,o){module.exports=o(require$$0)})(self,__WEBPACK_EXTERNAL_MODULE__1670__=>(()=>{var __webpack_modules__={3474:(i,o,s)=>{var a,_=(a=(a=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function($){function _e(){return Mt.buffer!=Yt&&ir(Mt.buffer),Kt}function tt(){return Mt.buffer!=Yt&&ir(Mt.buffer),sr}function st(){return Mt.buffer!=Yt&&ir(Mt.buffer),ar}function it(){return Mt.buffer!=Yt&&ir(Mt.buffer),Gt}function nt(){return Mt.buffer!=Yt&&ir(Mt.buffer),Qt}var et,j,rt;$=$||{},et||(et=$!==void 0?$:{}),et.ready=new Promise(function(_t,Et){j=_t,rt=Et});var ot,at,lt,ut,ct,dt,ft=Object.assign({},et),ht="./this.program",bt=(_t,Et)=>{throw Et},yt=typeof window=="object",mt=typeof importScripts=="function",gt=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",vt=et.ENVIRONMENT_IS_PTHREAD||!1,wt="";function Ct(_t){return et.locateFile?et.locateFile(_t,wt):wt+_t}if(gt){let _t;wt=mt?s(908).dirname(wt)+"/":"//",dt=()=>{ct||(ut=s(1384),ct=s(908))},ot=function(Et,Ot){return dt(),Et=ct.normalize(Et),ut.readFileSync(Et,Ot?void 0:"utf8")},lt=Et=>((Et=ot(Et,!0)).buffer||(Et=new Uint8Array(Et)),Et),at=(Et,Ot,Dt)=>{dt(),Et=ct.normalize(Et),ut.readFile(Et,function(Ft,zt){Ft?Dt(Ft):Ot(zt.buffer)})},1{if(jr())throw process.exitCode=Et,Ot;Ot instanceof Xr||Rt("exiting due to exception: "+Ot),process.exit(Et)},et.inspect=function(){return"[Emscripten Module object]"};try{_t=s(9925)}catch(Et){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),Et}s.g.Worker=_t.Worker}else(yt||mt)&&(mt?wt=self.location.href:typeof document<"u"&&document.currentScript&&(wt=document.currentScript.src),a&&(wt=a),wt=wt.indexOf("blob:")!==0?wt.substr(0,wt.replace(/[?#].*/,"").lastIndexOf("/")+1):"",gt||(ot=_t=>{var Et=new XMLHttpRequest;return Et.open("GET",_t,!1),Et.send(null),Et.responseText},mt&&(lt=_t=>{var Et=new XMLHttpRequest;return Et.open("GET",_t,!1),Et.responseType="arraybuffer",Et.send(null),new Uint8Array(Et.response)}),at=(_t,Et,Ot)=>{var Dt=new XMLHttpRequest;Dt.open("GET",_t,!0),Dt.responseType="arraybuffer",Dt.onload=()=>{Dt.status==200||Dt.status==0&&Dt.response?Et(Dt.response):Ot()},Dt.onerror=Ot,Dt.send(null)}));gt&&typeof performance>"u"&&(s.g.performance=s(6953).performance);var kt=console.log.bind(console),It=console.warn.bind(console);gt&&(dt(),kt=_t=>ut.writeSync(1,_t+` +`),It=_t=>ut.writeSync(2,_t+` +`));var Pt,St=et.print||kt,Rt=et.printErr||It;Object.assign(et,ft),ft=null,et.thisProgram&&(ht=et.thisProgram),et.quit&&(bt=et.quit),et.wasmBinary&&(Pt=et.wasmBinary);var At=et.noExitRuntime||!1;typeof WebAssembly!="object"&&xr("no native wasm support detected");var Mt,jt,Yt,Kt,sr,ar,Gt,Qt,tr=!1,Vt=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function Xt(_t,Et,Ot){var Dt=(Et>>>=0)+Ot;for(Ot=Et;_t[Ot]&&!(Ot>=Dt);)++Ot;if(16(Ft=(240&Ft)==224?(15&Ft)<<12|zt<<6|Jt:(7&Ft)<<18|zt<<12|Jt<<6|63&_t[Et++])?Dt+=String.fromCharCode(Ft):(Ft-=65536,Dt+=String.fromCharCode(55296|Ft>>10,56320|1023&Ft))}}else Dt+=String.fromCharCode(Ft)}return Dt}function Zt(_t,Et){return(_t>>>=0)?Xt(tt(),_t,Et):""}function cr(_t,Et,Ot,Dt){if(!(0>>=0;Dt=Ot+Dt-1;for(var zt=0;zt<_t.length;++zt){var Jt=_t.charCodeAt(zt);if(55296<=Jt&&57343>=Jt&&(Jt=65536+((1023&Jt)<<10)|1023&_t.charCodeAt(++zt)),127>=Jt){if(Ot>=Dt)break;Et[Ot++>>>0]=Jt}else{if(2047>=Jt){if(Ot+1>=Dt)break;Et[Ot++>>>0]=192|Jt>>6}else{if(65535>=Jt){if(Ot+2>=Dt)break;Et[Ot++>>>0]=224|Jt>>12}else{if(Ot+3>=Dt)break;Et[Ot++>>>0]=240|Jt>>18,Et[Ot++>>>0]=128|Jt>>12&63}Et[Ot++>>>0]=128|Jt>>6&63}Et[Ot++>>>0]=128|63&Jt}}return Et[Ot>>>0]=0,Ot-Ft}function pr(_t){for(var Et=0,Ot=0;Ot<_t.length;++Ot){var Dt=_t.charCodeAt(Ot);127>=Dt?Et++:2047>=Dt?Et+=2:55296<=Dt&&57343>=Dt?(Et+=4,++Ot):Et+=3}return Et}function ir(_t){Yt=_t,et.HEAP8=Kt=new Int8Array(_t),et.HEAP16=new Int16Array(_t),et.HEAP32=ar=new Int32Array(_t),et.HEAPU8=sr=new Uint8Array(_t),et.HEAPU16=new Uint16Array(_t),et.HEAPU32=Gt=new Uint32Array(_t),et.HEAPF32=new Float32Array(_t),et.HEAPF64=Qt=new Float64Array(_t)}vt&&(Yt=et.buffer);var hr=et.INITIAL_MEMORY||16777216;if(vt)Mt=et.wasmMemory,Yt=et.buffer;else if(et.wasmMemory)Mt=et.wasmMemory;else if(!((Mt=new WebAssembly.Memory({initial:hr/65536,maximum:65536,shared:!0})).buffer instanceof SharedArrayBuffer))throw Rt("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"),gt&&console.log("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)"),Error("bad memory");Mt&&(Yt=Mt.buffer),hr=Yt.byteLength,ir(Yt);var Rr,Or=[],Fr=[],zr=[],Gr=[];function jr(){return At||!1}function Nr(){var _t=et.preRun.shift();Or.unshift(_t)}var Tr,Mr=0,Br=null;function xr(_t){throw vt?postMessage({cmd:"onAbort",arg:_t}):et.onAbort&&et.onAbort(_t),Rt(_t="Aborted("+_t+")"),tr=!0,_t=new WebAssembly.RuntimeError(_t+". Build with -sASSERTIONS for more info."),rt(_t),_t}function dn(){return Tr.startsWith("data:application/octet-stream;base64,")}function sn(){var _t=Tr;try{if(_t==Tr&&Pt)return new Uint8Array(Pt);if(lt)return lt(_t);throw"both async and sync fetching of the wasm failed"}catch(Et){xr(Et)}}Tr="ort-wasm-threaded.wasm",dn()||(Tr=Ct(Tr));var On={};function Xr(_t){this.name="ExitStatus",this.message="Program terminated with exit("+_t+")",this.status=_t}function an(_t){(_t=lr.Vb[_t])||xr(),lr.mc(_t)}function ln(_t){var Et=lr.Cc();if(!Et)return 6;lr.ac.push(Et),lr.Vb[_t.Ub]=Et,Et.Ub=_t.Ub;var Ot={cmd:"run",start_routine:_t.Ic,arg:_t.zc,pthread_ptr:_t.Ub};return Et.$b=()=>{Ot.time=performance.now(),Et.postMessage(Ot,_t.Nc)},Et.loaded&&(Et.$b(),delete Et.$b),0}function Dr(_t){if(vt)return er(1,1,_t);jr()||(lr.oc(),et.onExit&&et.onExit(_t),tr=!0),bt(_t,new Xr(_t))}function Zr(_t,Et){if(!Et&&vt)throw An(_t),"unwind";jr()||vt||(Kn(),Qr(zr),Xn(0),jn[1].length&&Nn(1,10),jn[2].length&&Nn(2,10),lr.oc()),Dr(_t)}var lr={Yb:[],ac:[],qc:[],Vb:{},fc:function(){vt&&lr.Ec()},Pc:function(){},Ec:function(){lr.receiveObjectTransfer=lr.Gc,lr.threadInitTLS=lr.pc,lr.setExitStatus=lr.nc,At=!1},nc:function(){},oc:function(){for(var _t of Object.values(lr.Vb))lr.mc(_t);for(_t of lr.Yb)_t.terminate();lr.Yb=[]},mc:function(_t){var Et=_t.Ub;delete lr.Vb[Et],lr.Yb.push(_t),lr.ac.splice(lr.ac.indexOf(_t),1),_t.Ub=0,Bn(Et)},Gc:function(){},pc:function(){lr.qc.forEach(_t=>_t())},Fc:function(_t,Et){_t.onmessage=Ot=>{var Dt=(Ot=Ot.data).cmd;if(_t.Ub&&(lr.Bc=_t.Ub),Ot.targetThread&&Ot.targetThread!=Mn()){var Ft=lr.Vb[Ot.Qc];Ft?Ft.postMessage(Ot,Ot.transferList):Rt('Internal error! Worker sent a message "'+Dt+'" to target pthread '+Ot.targetThread+", but that thread no longer exists!")}else Dt==="processProxyingQueue"?Lt(Ot.queue):Dt==="spawnThread"?ln(Ot):Dt==="cleanupThread"?an(Ot.thread):Dt==="killThread"?(Ot=Ot.thread,Dt=lr.Vb[Ot],delete lr.Vb[Ot],Dt.terminate(),Bn(Ot),lr.ac.splice(lr.ac.indexOf(Dt),1),Dt.Ub=0):Dt==="cancelThread"?lr.Vb[Ot.thread].postMessage({cmd:"cancel"}):Dt==="loaded"?(_t.loaded=!0,Et&&Et(_t),_t.$b&&(_t.$b(),delete _t.$b)):Dt==="print"?St("Thread "+Ot.threadId+": "+Ot.text):Dt==="printErr"?Rt("Thread "+Ot.threadId+": "+Ot.text):Dt==="alert"?alert("Thread "+Ot.threadId+": "+Ot.text):Ot.target==="setimmediate"?_t.postMessage(Ot):Dt==="onAbort"?et.onAbort&&et.onAbort(Ot.arg):Dt&&Rt("worker sent an unknown command "+Dt);lr.Bc=void 0},_t.onerror=Ot=>{throw Rt("worker sent an error! "+Ot.filename+":"+Ot.lineno+": "+Ot.message),Ot},gt&&(_t.on("message",function(Ot){_t.onmessage({data:Ot})}),_t.on("error",function(Ot){_t.onerror(Ot)}),_t.on("detachedExit",function(){})),_t.postMessage({cmd:"load",urlOrBlob:et.mainScriptUrlOrBlob||a,wasmMemory:Mt,wasmModule:jt})},yc:function(){var _t=Ct("ort-wasm-threaded.worker.js");lr.Yb.push(new Worker(_t))},Cc:function(){return lr.Yb.length==0&&(lr.yc(),lr.Fc(lr.Yb[0])),lr.Yb.pop()}};function Qr(_t){for(;0<_t.length;)_t.shift()(et)}function Rn(_t){var Et=yr();return _t=_t(),mr(Et),_t}function An(_t){if(vt)return er(2,0,_t);try{Zr(_t)}catch(Et){Et instanceof Xr||Et=="unwind"||bt(1,Et)}}et.PThread=lr,et.establishStackSpace=function(){var _t=Mn(),Et=st()[_t+44>>2>>>0];_t=st()[_t+48>>2>>>0],_i(Et,Et-_t),mr(Et)};var Kr=[];function Er(_t){var Et=Kr[_t];return Et||(_t>=Kr.length&&(Kr.length=_t+1),Kr[_t]=Et=Rr.get(_t)),Et}et.invokeEntryPoint=function(_t,Et){_t=Er(_t)(Et),jr()?lr.nc(_t):Zn(_t)};var en,pn,tn=[],fr=0,ur=0;function dr(_t){this.Zb=_t,this.Sb=_t-24,this.xc=function(Et){it()[this.Sb+4>>2>>>0]=Et},this.bc=function(){return it()[this.Sb+4>>2>>>0]},this.wc=function(Et){it()[this.Sb+8>>2>>>0]=Et},this.Dc=function(){return it()[this.Sb+8>>2>>>0]},this.rc=function(){st()[this.Sb>>2>>>0]=0},this.hc=function(Et){Et=Et?1:0,_e()[this.Sb+12>>0>>>0]=Et},this.uc=function(){return _e()[this.Sb+12>>0>>>0]!=0},this.ic=function(Et){Et=Et?1:0,_e()[this.Sb+13>>0>>>0]=Et},this.kc=function(){return _e()[this.Sb+13>>0>>>0]!=0},this.fc=function(Et,Ot){this.cc(0),this.xc(Et),this.wc(Ot),this.rc(),this.hc(!1),this.ic(!1)},this.sc=function(){Atomics.add(st(),this.Sb>>2,1)},this.Hc=function(){return Atomics.sub(st(),this.Sb>>2,1)===1},this.cc=function(Et){it()[this.Sb+16>>2>>>0]=Et},this.tc=function(){return it()[this.Sb+16>>2>>>0]},this.vc=function(){if(eo(this.bc()))return it()[this.Zb>>2>>>0];var Et=this.tc();return Et!==0?Et:this.Zb}}function fn(_t){return Yn(new dr(_t).Sb)}function rn(_t,Et,Ot,Dt){return vt?er(3,1,_t,Et,Ot,Dt):hn(_t,Et,Ot,Dt)}function hn(_t,Et,Ot,Dt){if(typeof SharedArrayBuffer>"u")return Rt("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var Ft=[];return vt&&Ft.length===0?rn(_t,Et,Ot,Dt):(_t={Ic:Ot,Ub:_t,zc:Dt,Nc:Ft},vt?(_t.Oc="spawnThread",postMessage(_t,Ft),0):ln(_t))}function gn(_t,Et,Ot){return vt?er(4,1,_t,Et,Ot):0}function mn(_t,Et){if(vt)return er(5,1,_t,Et)}function yn(_t,Et){if(vt)return er(6,1,_t,Et)}function bn(_t,Et,Ot){if(vt)return er(7,1,_t,Et,Ot)}function xn(_t,Et,Ot){return vt?er(8,1,_t,Et,Ot):0}function _n(_t,Et){if(vt)return er(9,1,_t,Et)}function wn(_t,Et,Ot){if(vt)return er(10,1,_t,Et,Ot)}function Sn(_t,Et,Ot,Dt){if(vt)return er(11,1,_t,Et,Ot,Dt)}function En(_t,Et,Ot,Dt){if(vt)return er(12,1,_t,Et,Ot,Dt)}function Cn(_t,Et,Ot,Dt){if(vt)return er(13,1,_t,Et,Ot,Dt)}function Tn(_t){if(vt)return er(14,1,_t)}function Tt(_t,Et){if(vt)return er(15,1,_t,Et)}function $t(_t,Et,Ot){if(vt)return er(16,1,_t,Et,Ot)}function Lt(_t){Atomics.store(st(),_t>>2,1),Mn()&&Qn(_t),Atomics.compareExchange(st(),_t>>2,1,0)}function Nt(_t){return it()[_t>>>2]+4294967296*st()[_t+4>>>2]}function Bt(_t,Et,Ot,Dt,Ft,zt){return vt?er(17,1,_t,Et,Ot,Dt,Ft,zt):-52}function Ht(_t,Et,Ot,Dt,Ft,zt){if(vt)return er(18,1,_t,Et,Ot,Dt,Ft,zt)}function qt(_t){var Et=pr(_t)+1,Ot=Fn(Et);return Ot&&cr(_t,_e(),Ot,Et),Ot}function rr(_t,Et,Ot){function Dt(_r){return(_r=_r.toTimeString().match(/\(([A-Za-z ]+)\)$/))?_r[1]:"GMT"}if(vt)return er(19,1,_t,Et,Ot);var Ft=new Date().getFullYear(),zt=new Date(Ft,0,1),Jt=new Date(Ft,6,1);Ft=zt.getTimezoneOffset();var nr=Jt.getTimezoneOffset(),vr=Math.max(Ft,nr);st()[_t>>2>>>0]=60*vr,st()[Et>>2>>>0]=+(Ft!=nr),_t=Dt(zt),Et=Dt(Jt),_t=qt(_t),Et=qt(Et),nr>2>>>0]=_t,it()[Ot+4>>2>>>0]=Et):(it()[Ot>>2>>>0]=Et,it()[Ot+4>>2>>>0]=_t)}function er(_t,Et){var Ot=arguments.length-2,Dt=arguments;return Rn(()=>{for(var Ft=Vn(8*Ot),zt=Ft>>3,Jt=0;Jt>>0]=nr}return Jn(_t,Ot,Ft,Et)})}et.executeNotifiedProxyingQueue=Lt,pn=gt?()=>{var _t=process.hrtime();return 1e3*_t[0]+_t[1]/1e6}:vt?()=>performance.now()-et.__performance_now_clock_drift:()=>performance.now();var gr,Cr=[],$r={};function Ar(){if(!gr){var _t,Et={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:ht||"./this.program"};for(_t in $r)$r[_t]===void 0?delete Et[_t]:Et[_t]=$r[_t];var Ot=[];for(_t in Et)Ot.push(_t+"="+Et[_t]);gr=Ot}return gr}function Ut(_t,Et){if(vt)return er(20,1,_t,Et);var Ot=0;return Ar().forEach(function(Dt,Ft){var zt=Et+Ot;for(Ft=it()[_t+4*Ft>>2>>>0]=zt,zt=0;zt>0>>>0]=Dt.charCodeAt(zt);_e()[Ft>>0>>>0]=0,Ot+=Dt.length+1}),0}function wr(_t,Et){if(vt)return er(21,1,_t,Et);var Ot=Ar();it()[_t>>2>>>0]=Ot.length;var Dt=0;return Ot.forEach(function(Ft){Dt+=Ft.length+1}),it()[Et>>2>>>0]=Dt,0}function Pr(_t){return vt?er(22,1,_t):52}function Wr(_t,Et,Ot,Dt){return vt?er(23,1,_t,Et,Ot,Dt):52}function qr(_t,Et,Ot,Dt,Ft){return vt?er(24,1,_t,Et,Ot,Dt,Ft):70}var jn=[null,[],[]];function Nn(_t,Et){var Ot=jn[_t];Et===0||Et===10?((_t===1?St:Rt)(Xt(Ot,0)),Ot.length=0):Ot.push(Et)}function Un(_t,Et,Ot,Dt){if(vt)return er(25,1,_t,Et,Ot,Dt);for(var Ft=0,zt=0;zt>2>>>0],nr=it()[Et+4>>2>>>0];Et+=8;for(var vr=0;vr>>0]);Ft+=nr}return it()[Dt>>2>>>0]=Ft,0}var Vr=0;function $n(_t){return _t%4==0&&(_t%100!=0||_t%400==0)}var Wn=[31,29,31,30,31,30,31,31,30,31,30,31],Hn=[31,28,31,30,31,30,31,31,30,31,30,31];function Gn(_t,Et,Ot,Dt){function Ft(Wt,Sr,Ir){for(Wt=typeof Wt=="number"?Wt.toString():Wt||"";Wt.lengthun?-1:0Jr-Wt.getDate())){Wt.setDate(Wt.getDate()+Sr);break}Sr-=Jr-Wt.getDate()+1,Wt.setDate(1),11>Ir?Wt.setMonth(Ir+1):(Wt.setMonth(0),Wt.setFullYear(Wt.getFullYear()+1))}return Ir=new Date(Wt.getFullYear()+1,0,4),Sr=nr(new Date(Wt.getFullYear(),0,4)),Ir=nr(Ir),0>=Jt(Sr,Wt)?0>=Jt(Ir,Wt)?Wt.getFullYear()+1:Wt.getFullYear():Wt.getFullYear()-1}var _r=st()[Dt+40>>2>>>0];for(var kr in Dt={Lc:st()[Dt>>2>>>0],Kc:st()[Dt+4>>2>>>0],dc:st()[Dt+8>>2>>>0],jc:st()[Dt+12>>2>>>0],ec:st()[Dt+16>>2>>>0],Xb:st()[Dt+20>>2>>>0],Tb:st()[Dt+24>>2>>>0],Wb:st()[Dt+28>>2>>>0],Rc:st()[Dt+32>>2>>>0],Jc:st()[Dt+36>>2>>>0],Mc:_r?Zt(_r):""},Ot=Zt(Ot),_r={"%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"})Ot=Ot.replace(new RegExp(kr,"g"),_r[kr]);var Yr="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),Hr="January February March April May June July August September October November December".split(" ");for(kr in _r={"%a":function(Wt){return Yr[Wt.Tb].substring(0,3)},"%A":function(Wt){return Yr[Wt.Tb]},"%b":function(Wt){return Hr[Wt.ec].substring(0,3)},"%B":function(Wt){return Hr[Wt.ec]},"%C":function(Wt){return zt((Wt.Xb+1900)/100|0,2)},"%d":function(Wt){return zt(Wt.jc,2)},"%e":function(Wt){return Ft(Wt.jc,2," ")},"%g":function(Wt){return vr(Wt).toString().substring(2)},"%G":function(Wt){return vr(Wt)},"%H":function(Wt){return zt(Wt.dc,2)},"%I":function(Wt){return(Wt=Wt.dc)==0?Wt=12:12Wt.dc?"AM":"PM"},"%S":function(Wt){return zt(Wt.Lc,2)},"%t":function(){return" "},"%u":function(Wt){return Wt.Tb||7},"%U":function(Wt){return zt(Math.floor((Wt.Wb+7-Wt.Tb)/7),2)},"%V":function(Wt){var Sr=Math.floor((Wt.Wb+7-(Wt.Tb+6)%7)/7);if(2>=(Wt.Tb+371-Wt.Wb-2)%7&&Sr++,Sr)Sr==53&&((Ir=(Wt.Tb+371-Wt.Wb)%7)==4||Ir==3&&$n(Wt.Xb)||(Sr=1));else{Sr=52;var Ir=(Wt.Tb+7-Wt.Wb-1)%7;(Ir==4||Ir==5&&$n(Wt.Xb%400-1))&&Sr++}return zt(Sr,2)},"%w":function(Wt){return Wt.Tb},"%W":function(Wt){return zt(Math.floor((Wt.Wb+7-(Wt.Tb+6)%7)/7),2)},"%y":function(Wt){return(Wt.Xb+1900).toString().substring(2)},"%Y":function(Wt){return Wt.Xb+1900},"%z":function(Wt){var Sr=0<=(Wt=Wt.Jc);return Wt=Math.abs(Wt)/60,(Sr?"+":"-")+("0000"+(Wt/60*100+Wt%60)).slice(-4)},"%Z":function(Wt){return Wt.Mc},"%%":function(){return"%"}},Ot=Ot.replace(/%%/g,"\0\0"),_r)Ot.includes(kr)&&(Ot=Ot.replace(new RegExp(kr,"g"),_r[kr](Dt)));return kr=function(Wt){var Sr=Array(pr(Wt)+1);return cr(Wt,Sr,0,Sr.length),Sr}(Ot=Ot.replace(/\0\0/g,"%")),kr.length>Et?0:(function(Wt,Sr){_e().set(Wt,Sr>>>0)}(kr,_t),kr.length-1)}lr.fc();var Es=[null,Dr,An,rn,gn,mn,yn,bn,xn,_n,wn,Sn,En,Cn,Tn,Tt,$t,Bt,Ht,rr,Ut,wr,Pr,Wr,qr,Un],Cs={b:function(_t){return Fn(_t+24)+24},n:function(_t){return(_t=new dr(_t)).uc()||(_t.hc(!0),fr--),_t.ic(!1),tn.push(_t),_t.sc(),_t.vc()},ma:function(_t){throw Rt("Unexpected exception thrown, this is not properly supported - aborting"),tr=!0,_t},x:function(){br(0);var _t=tn.pop();if(_t.Hc()&&!_t.kc()){var Et=_t.Dc();Et&&Er(Et)(_t.Zb),fn(_t.Zb)}ur=0},e:function(){var _t=ur;if(!_t)return Vr=0;var Et=new dr(_t);Et.cc(_t);var Ot=Et.bc();if(!Ot)return Vr=0,_t;for(var Dt=Array.prototype.slice.call(arguments),Ft=0;FtLt(Dt));else if(vt)postMessage({targetThread:_t,cmd:"processProxyingQueue",queue:Dt});else{if(!(_t=lr.Vb[_t]))return;_t.postMessage({cmd:"processProxyingQueue",queue:Dt})}return 1},Ea:function(){return-1},Pa:function(_t,Et){_t=new Date(1e3*Nt(_t)),st()[Et>>2>>>0]=_t.getUTCSeconds(),st()[Et+4>>2>>>0]=_t.getUTCMinutes(),st()[Et+8>>2>>>0]=_t.getUTCHours(),st()[Et+12>>2>>>0]=_t.getUTCDate(),st()[Et+16>>2>>>0]=_t.getUTCMonth(),st()[Et+20>>2>>>0]=_t.getUTCFullYear()-1900,st()[Et+24>>2>>>0]=_t.getUTCDay(),_t=(_t.getTime()-Date.UTC(_t.getUTCFullYear(),0,1,0,0,0,0))/864e5|0,st()[Et+28>>2>>>0]=_t},Qa:function(_t,Et){_t=new Date(1e3*Nt(_t)),st()[Et>>2>>>0]=_t.getSeconds(),st()[Et+4>>2>>>0]=_t.getMinutes(),st()[Et+8>>2>>>0]=_t.getHours(),st()[Et+12>>2>>>0]=_t.getDate(),st()[Et+16>>2>>>0]=_t.getMonth(),st()[Et+20>>2>>>0]=_t.getFullYear()-1900,st()[Et+24>>2>>>0]=_t.getDay();var Ot=new Date(_t.getFullYear(),0,1),Dt=(_t.getTime()-Ot.getTime())/864e5|0;st()[Et+28>>2>>>0]=Dt,st()[Et+36>>2>>>0]=-60*_t.getTimezoneOffset(),Dt=new Date(_t.getFullYear(),6,1).getTimezoneOffset(),_t=0|(Dt!=(Ot=Ot.getTimezoneOffset())&&_t.getTimezoneOffset()==Math.min(Ot,Dt)),st()[Et+32>>2>>>0]=_t},Ra:function(_t){var Et=new Date(st()[_t+20>>2>>>0]+1900,st()[_t+16>>2>>>0],st()[_t+12>>2>>>0],st()[_t+8>>2>>>0],st()[_t+4>>2>>>0],st()[_t>>2>>>0],0),Ot=st()[_t+32>>2>>>0],Dt=Et.getTimezoneOffset(),Ft=new Date(Et.getFullYear(),0,1),zt=new Date(Et.getFullYear(),6,1).getTimezoneOffset(),Jt=Ft.getTimezoneOffset(),nr=Math.min(Jt,zt);return 0>Ot?st()[_t+32>>2>>>0]=+(zt!=Jt&&nr==Dt):0>2>>>0]=Et.getDay(),Ot=(Et.getTime()-Ft.getTime())/864e5|0,st()[_t+28>>2>>>0]=Ot,st()[_t>>2>>>0]=Et.getSeconds(),st()[_t+4>>2>>>0]=Et.getMinutes(),st()[_t+8>>2>>>0]=Et.getHours(),st()[_t+12>>2>>>0]=Et.getDate(),st()[_t+16>>2>>>0]=Et.getMonth(),Et.getTime()/1e3|0},Aa:Bt,Ba:Ht,Sa:function _t(Et,Ot,Dt){_t.Ac||(_t.Ac=!0,rr(Et,Ot,Dt))},y:function(){xr("")},U:function(){if(!gt&&!mt){var _t="Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread";en||(en={}),en[_t]||(en[_t]=1,gt&&(_t="warning: "+_t),Rt(_t))}},ra:function(){return 4294901760},B:pn,Ia:function(_t,Et,Ot){tt().copyWithin(_t>>>0,Et>>>0,Et+Ot>>>0)},F:function(){return gt?s(3993).cpus().length:navigator.hardwareConcurrency},Da:function(_t,Et,Ot){Cr.length=Et,Ot>>=3;for(var Dt=0;Dt>>0];return(0>_t?On[-_t-1]:Es[_t]).apply(null,Cr)},qa:function(_t){var Et=tt().length;if((_t>>>=0)<=Et||4294901760<_t)return!1;for(var Ot=1;4>=Ot;Ot*=2){var Dt=Et*(1+.2/Ot);Dt=Math.min(Dt,_t+100663296);var Ft=Math;Dt=Math.max(_t,Dt),Ft=Ft.min.call(Ft,4294901760,Dt+(65536-Dt%65536)%65536);e:{try{Mt.grow(Ft-Yt.byteLength+65535>>>16),ir(Mt.buffer);var zt=1;break e}catch{}zt=void 0}if(zt)return!0}return!1},Na:function(){throw"unwind"},Ga:Ut,Ha:wr,J:Zr,I:Pr,S:Wr,ga:qr,R:Un,d:function(){return Vr},na:function _t(Et,Ot){_t.lc||(_t.lc=function(){if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function"){var Ft=new Uint8Array(1);return()=>(crypto.getRandomValues(Ft),Ft[0])}if(gt)try{var zt=s(Object(function(){var Jt=new Error("Cannot find module 'crypto'");throw Jt.code="MODULE_NOT_FOUND",Jt}()));return()=>zt.randomBytes(1)[0]}catch{}return()=>xr("randomDevice")}());for(var Dt=0;Dt>0>>>0]=_t.lc();return 0},ia:function(_t,Et,Ot){var Dt=yr();try{return Er(_t)(Et,Ot)}catch(Ft){if(mr(Dt),Ft!==Ft+0)throw Ft;br(1,0)}},ja:function(_t,Et,Ot){var Dt=yr();try{return Er(_t)(Et,Ot)}catch(Ft){if(mr(Dt),Ft!==Ft+0)throw Ft;br(1,0)}},K:function(_t){var Et=yr();try{return Er(_t)()}catch(Ot){if(mr(Et),Ot!==Ot+0)throw Ot;br(1,0)}},f:function(_t,Et){var Ot=yr();try{return Er(_t)(Et)}catch(Dt){if(mr(Ot),Dt!==Dt+0)throw Dt;br(1,0)}},P:function(_t,Et,Ot){var Dt=yr();try{return Er(_t)(Et,Ot)}catch(Ft){if(mr(Dt),Ft!==Ft+0)throw Ft;br(1,0)}},Q:function(_t,Et,Ot){var Dt=yr();try{return Er(_t)(Et,Ot)}catch(Ft){if(mr(Dt),Ft!==Ft+0)throw Ft;br(1,0)}},k:function(_t,Et,Ot){var Dt=yr();try{return Er(_t)(Et,Ot)}catch(Ft){if(mr(Dt),Ft!==Ft+0)throw Ft;br(1,0)}},p:function(_t,Et,Ot,Dt){var Ft=yr();try{return Er(_t)(Et,Ot,Dt)}catch(zt){if(mr(Ft),zt!==zt+0)throw zt;br(1,0)}},q:function(_t,Et,Ot,Dt,Ft){var zt=yr();try{return Er(_t)(Et,Ot,Dt,Ft)}catch(Jt){if(mr(zt),Jt!==Jt+0)throw Jt;br(1,0)}},N:function(_t,Et,Ot,Dt,Ft,zt){var Jt=yr();try{return Er(_t)(Et,Ot,Dt,Ft,zt)}catch(nr){if(mr(Jt),nr!==nr+0)throw nr;br(1,0)}},s:function(_t,Et,Ot,Dt,Ft,zt){var Jt=yr();try{return Er(_t)(Et,Ot,Dt,Ft,zt)}catch(nr){if(mr(Jt),nr!==nr+0)throw nr;br(1,0)}},w:function(_t,Et,Ot,Dt,Ft,zt,Jt){var nr=yr();try{return Er(_t)(Et,Ot,Dt,Ft,zt,Jt)}catch(vr){if(mr(nr),vr!==vr+0)throw vr;br(1,0)}},L:function(_t,Et,Ot,Dt,Ft,zt,Jt,nr){var vr=yr();try{return Er(_t)(Et,Ot,Dt,Ft,zt,Jt,nr)}catch(_r){if(mr(vr),_r!==_r+0)throw _r;br(1,0)}},E:function(_t,Et,Ot,Dt,Ft,zt,Jt,nr,vr,_r,kr,Yr){var Hr=yr();try{return Er(_t)(Et,Ot,Dt,Ft,zt,Jt,nr,vr,_r,kr,Yr)}catch(Wt){if(mr(Hr),Wt!==Wt+0)throw Wt;br(1,0)}},aa:function(_t,Et,Ot,Dt,Ft,zt,Jt,nr){var vr=yr();try{return uo(_t,Et,Ot,Dt,Ft,zt,Jt,nr)}catch(_r){if(mr(vr),_r!==_r+0)throw _r;br(1,0)}},_:function(_t,Et,Ot,Dt,Ft,zt,Jt){var nr=yr();try{return ro(_t,Et,Ot,Dt,Ft,zt,Jt)}catch(vr){if(mr(nr),vr!==vr+0)throw vr;br(1,0)}},Z:function(_t,Et,Ot,Dt,Ft){var zt=yr();try{return co(_t,Et,Ot,Dt,Ft)}catch(Jt){if(mr(zt),Jt!==Jt+0)throw Jt;br(1,0)}},ca:function(_t,Et,Ot,Dt){var Ft=yr();try{return ao(_t,Et,Ot,Dt)}catch(zt){if(mr(Ft),zt!==zt+0)throw zt;br(1,0)}},$:function(_t){var Et=yr();try{return to(_t)}catch(Ot){if(mr(Et),Ot!==Ot+0)throw Ot;br(1,0)}},ba:function(_t,Et){var Ot=yr();try{return lo(_t,Et)}catch(Dt){if(mr(Ot),Dt!==Dt+0)throw Dt;br(1,0)}},Y:function(_t,Et,Ot){var Dt=yr();try{return no(_t,Et,Ot)}catch(Ft){if(mr(Dt),Ft!==Ft+0)throw Ft;br(1,0)}},g:function(_t){var Et=yr();try{Er(_t)()}catch(Ot){if(mr(Et),Ot!==Ot+0)throw Ot;br(1,0)}},r:function(_t,Et){var Ot=yr();try{Er(_t)(Et)}catch(Dt){if(mr(Ot),Dt!==Dt+0)throw Dt;br(1,0)}},i:function(_t,Et,Ot){var Dt=yr();try{Er(_t)(Et,Ot)}catch(Ft){if(mr(Dt),Ft!==Ft+0)throw Ft;br(1,0)}},ha:function(_t,Et,Ot,Dt){var Ft=yr();try{Er(_t)(Et,Ot,Dt)}catch(zt){if(mr(Ft),zt!==zt+0)throw zt;br(1,0)}},m:function(_t,Et,Ot,Dt){var Ft=yr();try{Er(_t)(Et,Ot,Dt)}catch(zt){if(mr(Ft),zt!==zt+0)throw zt;br(1,0)}},v:function(_t,Et,Ot,Dt,Ft){var zt=yr();try{Er(_t)(Et,Ot,Dt,Ft)}catch(Jt){if(mr(zt),Jt!==Jt+0)throw Jt;br(1,0)}},u:function(_t,Et,Ot,Dt,Ft,zt){var Jt=yr();try{Er(_t)(Et,Ot,Dt,Ft,zt)}catch(nr){if(mr(Jt),nr!==nr+0)throw nr;br(1,0)}},O:function(_t,Et,Ot,Dt,Ft,zt,Jt){var nr=yr();try{Er(_t)(Et,Ot,Dt,Ft,zt,Jt)}catch(vr){if(mr(nr),vr!==vr+0)throw vr;br(1,0)}},A:function(_t,Et,Ot,Dt,Ft,zt,Jt,nr){var vr=yr();try{Er(_t)(Et,Ot,Dt,Ft,zt,Jt,nr)}catch(_r){if(mr(vr),_r!==_r+0)throw _r;br(1,0)}},ka:function(_t,Et,Ot,Dt,Ft,zt,Jt,nr,vr){var _r=yr();try{Er(_t)(Et,Ot,Dt,Ft,zt,Jt,nr,vr)}catch(kr){if(mr(_r),kr!==kr+0)throw kr;br(1,0)}},C:function(_t,Et,Ot,Dt,Ft,zt,Jt,nr,vr,_r,kr){var Yr=yr();try{Er(_t)(Et,Ot,Dt,Ft,zt,Jt,nr,vr,_r,kr)}catch(Hr){if(mr(Yr),Hr!==Hr+0)throw Hr;br(1,0)}},D:function(_t,Et,Ot,Dt,Ft,zt,Jt,nr,vr,_r,kr,Yr,Hr,Wt,Sr,Ir){var Jr=yr();try{Er(_t)(Et,Ot,Dt,Ft,zt,Jt,nr,vr,_r,kr,Yr,Hr,Wt,Sr,Ir)}catch(un){if(mr(Jr),un!==un+0)throw un;br(1,0)}},fa:function(_t,Et,Ot,Dt,Ft,zt,Jt,nr){var vr=yr();try{io(_t,Et,Ot,Dt,Ft,zt,Jt,nr)}catch(_r){if(mr(vr),_r!==_r+0)throw _r;br(1,0)}},da:function(_t,Et,Ot,Dt,Ft,zt,Jt,nr,vr,_r,kr,Yr){var Hr=yr();try{so(_t,Et,Ot,Dt,Ft,zt,Jt,nr,vr,_r,kr,Yr)}catch(Wt){if(mr(Hr),Wt!==Wt+0)throw Wt;br(1,0)}},ea:function(_t,Et,Ot,Dt,Ft,zt){var Jt=yr();try{oo(_t,Et,Ot,Dt,Ft,zt)}catch(nr){if(mr(Jt),nr!==nr+0)throw nr;br(1,0)}},o:function(_t){return _t},a:Mt||et.wasmMemory,G:function(_t){Vr=_t},la:Gn,z:function(_t,Et,Ot,Dt){return Gn(_t,Et,Ot,Dt)}};(function(){function _t(Ft,zt){et.asm=Ft.exports,lr.qc.push(et.asm.sb),Rr=et.asm.ub,Fr.unshift(et.asm.Va),jt=zt,vt||(Mr--,et.monitorRunDependencies&&et.monitorRunDependencies(Mr),Mr==0&&Br&&(Ft=Br,Br=null,Ft()))}function Et(Ft){_t(Ft.instance,Ft.module)}function Ot(Ft){return function(){if(!Pt&&(yt||mt)){if(typeof fetch=="function"&&!Tr.startsWith("file://"))return fetch(Tr,{credentials:"same-origin"}).then(function(zt){if(!zt.ok)throw"failed to load wasm binary file at '"+Tr+"'";return zt.arrayBuffer()}).catch(function(){return sn()});if(at)return new Promise(function(zt,Jt){at(Tr,function(nr){zt(new Uint8Array(nr))},Jt)})}return Promise.resolve().then(function(){return sn()})}().then(function(zt){return WebAssembly.instantiate(zt,Dt)}).then(function(zt){return zt}).then(Ft,function(zt){Rt("failed to asynchronously prepare wasm: "+zt),xr(zt)})}var Dt={a:Cs};if(vt||(Mr++,et.monitorRunDependencies&&et.monitorRunDependencies(Mr)),et.instantiateWasm)try{return et.instantiateWasm(Dt,_t)}catch(Ft){return Rt("Module.instantiateWasm callback failed with error: "+Ft),!1}(Pt||typeof WebAssembly.instantiateStreaming!="function"||dn()||Tr.startsWith("file://")||gt||typeof fetch!="function"?Ot(Et):fetch(Tr,{credentials:"same-origin"}).then(function(Ft){return WebAssembly.instantiateStreaming(Ft,Dt).then(Et,function(zt){return Rt("wasm streaming compile failed: "+zt),Rt("falling back to ArrayBuffer instantiation"),Ot(Et)})})).catch(rt)})(),et.___wasm_call_ctors=function(){return(et.___wasm_call_ctors=et.asm.Va).apply(null,arguments)},et._OrtInit=function(){return(et._OrtInit=et.asm.Wa).apply(null,arguments)},et._OrtCreateSessionOptions=function(){return(et._OrtCreateSessionOptions=et.asm.Xa).apply(null,arguments)},et._OrtAppendExecutionProvider=function(){return(et._OrtAppendExecutionProvider=et.asm.Ya).apply(null,arguments)},et._OrtAddSessionConfigEntry=function(){return(et._OrtAddSessionConfigEntry=et.asm.Za).apply(null,arguments)},et._OrtReleaseSessionOptions=function(){return(et._OrtReleaseSessionOptions=et.asm._a).apply(null,arguments)},et._OrtCreateSession=function(){return(et._OrtCreateSession=et.asm.$a).apply(null,arguments)},et._OrtReleaseSession=function(){return(et._OrtReleaseSession=et.asm.ab).apply(null,arguments)},et._OrtGetInputCount=function(){return(et._OrtGetInputCount=et.asm.bb).apply(null,arguments)},et._OrtGetOutputCount=function(){return(et._OrtGetOutputCount=et.asm.cb).apply(null,arguments)},et._OrtGetInputName=function(){return(et._OrtGetInputName=et.asm.db).apply(null,arguments)},et._OrtGetOutputName=function(){return(et._OrtGetOutputName=et.asm.eb).apply(null,arguments)},et._OrtFree=function(){return(et._OrtFree=et.asm.fb).apply(null,arguments)},et._OrtCreateTensor=function(){return(et._OrtCreateTensor=et.asm.gb).apply(null,arguments)},et._OrtGetTensorData=function(){return(et._OrtGetTensorData=et.asm.hb).apply(null,arguments)},et._OrtReleaseTensor=function(){return(et._OrtReleaseTensor=et.asm.ib).apply(null,arguments)},et._OrtCreateRunOptions=function(){return(et._OrtCreateRunOptions=et.asm.jb).apply(null,arguments)},et._OrtAddRunConfigEntry=function(){return(et._OrtAddRunConfigEntry=et.asm.kb).apply(null,arguments)},et._OrtReleaseRunOptions=function(){return(et._OrtReleaseRunOptions=et.asm.lb).apply(null,arguments)},et._OrtRun=function(){return(et._OrtRun=et.asm.mb).apply(null,arguments)},et._OrtEndProfiling=function(){return(et._OrtEndProfiling=et.asm.nb).apply(null,arguments)};var Mn=et._pthread_self=function(){return(Mn=et._pthread_self=et.asm.ob).apply(null,arguments)},Fn=et._malloc=function(){return(Fn=et._malloc=et.asm.pb).apply(null,arguments)},Yn=et._free=function(){return(Yn=et._free=et.asm.qb).apply(null,arguments)},Xn=et._fflush=function(){return(Xn=et._fflush=et.asm.rb).apply(null,arguments)};et.__emscripten_tls_init=function(){return(et.__emscripten_tls_init=et.asm.sb).apply(null,arguments)};var Kn=et.___funcs_on_exit=function(){return(Kn=et.___funcs_on_exit=et.asm.tb).apply(null,arguments)},qn=et.__emscripten_thread_init=function(){return(qn=et.__emscripten_thread_init=et.asm.vb).apply(null,arguments)};et.__emscripten_thread_crashed=function(){return(et.__emscripten_thread_crashed=et.asm.wb).apply(null,arguments)};var Dn,Jn=et._emscripten_run_in_main_runtime_thread_js=function(){return(Jn=et._emscripten_run_in_main_runtime_thread_js=et.asm.xb).apply(null,arguments)},Qn=et.__emscripten_proxy_execute_task_queue=function(){return(Qn=et.__emscripten_proxy_execute_task_queue=et.asm.yb).apply(null,arguments)},Bn=et.__emscripten_thread_free_data=function(){return(Bn=et.__emscripten_thread_free_data=et.asm.zb).apply(null,arguments)},Zn=et.__emscripten_thread_exit=function(){return(Zn=et.__emscripten_thread_exit=et.asm.Ab).apply(null,arguments)},br=et._setThrew=function(){return(br=et._setThrew=et.asm.Bb).apply(null,arguments)},_i=et._emscripten_stack_set_limits=function(){return(_i=et._emscripten_stack_set_limits=et.asm.Cb).apply(null,arguments)},yr=et.stackSave=function(){return(yr=et.stackSave=et.asm.Db).apply(null,arguments)},mr=et.stackRestore=function(){return(mr=et.stackRestore=et.asm.Eb).apply(null,arguments)},Vn=et.stackAlloc=function(){return(Vn=et.stackAlloc=et.asm.Fb).apply(null,arguments)},Ln=et.___cxa_can_catch=function(){return(Ln=et.___cxa_can_catch=et.asm.Gb).apply(null,arguments)},eo=et.___cxa_is_pointer_type=function(){return(eo=et.___cxa_is_pointer_type=et.asm.Hb).apply(null,arguments)},to=et.dynCall_j=function(){return(to=et.dynCall_j=et.asm.Ib).apply(null,arguments)},ro=et.dynCall_iiiiij=function(){return(ro=et.dynCall_iiiiij=et.asm.Jb).apply(null,arguments)},no=et.dynCall_jii=function(){return(no=et.dynCall_jii=et.asm.Kb).apply(null,arguments)},io=et.dynCall_viiiiij=function(){return(io=et.dynCall_viiiiij=et.asm.Lb).apply(null,arguments)},oo=et.dynCall_vjji=function(){return(oo=et.dynCall_vjji=et.asm.Mb).apply(null,arguments)},so=et.dynCall_viiijjjii=function(){return(so=et.dynCall_viiijjjii=et.asm.Nb).apply(null,arguments)},ao=et.dynCall_iij=function(){return(ao=et.dynCall_iij=et.asm.Ob).apply(null,arguments)},lo=et.dynCall_ji=function(){return(lo=et.dynCall_ji=et.asm.Pb).apply(null,arguments)},uo=et.dynCall_iiiiiij=function(){return(uo=et.dynCall_iiiiiij=et.asm.Qb).apply(null,arguments)},co=et.dynCall_iiij=function(){return(co=et.dynCall_iiij=et.asm.Rb).apply(null,arguments)};function po(){function _t(){if(!Dn&&(Dn=!0,et.calledRun=!0,!tr)&&(vt||Qr(Fr),j(et),et.onRuntimeInitialized&&et.onRuntimeInitialized(),!vt)){if(et.postRun)for(typeof et.postRun=="function"&&(et.postRun=[et.postRun]);et.postRun.length;){var Et=et.postRun.shift();Gr.unshift(Et)}Qr(Gr)}}if(!(0{var a,_=(a=(a=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function($){var _e,tt,st;$=$||{},_e||(_e=$!==void 0?$:{}),_e.ready=new Promise(function(Tt,$t){tt=Tt,st=$t});var it,nt,et,j,rt,ot,at=Object.assign({},_e),lt="./this.program",ut=(Tt,$t)=>{throw $t},ct=typeof window=="object",dt=typeof importScripts=="function",ft=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",ht="";ft?(ht=dt?s(908).dirname(ht)+"/":"//",ot=()=>{rt||(j=s(1384),rt=s(908))},it=function(Tt,$t){return ot(),Tt=rt.normalize(Tt),j.readFileSync(Tt,$t?void 0:"utf8")},et=Tt=>((Tt=it(Tt,!0)).buffer||(Tt=new Uint8Array(Tt)),Tt),nt=(Tt,$t,Lt)=>{ot(),Tt=rt.normalize(Tt),j.readFile(Tt,function(Nt,Bt){Nt?Lt(Nt):$t(Bt.buffer)})},1{if(gt||0{var $t=new XMLHttpRequest;return $t.open("GET",Tt,!1),$t.send(null),$t.responseText},dt&&(et=Tt=>{var $t=new XMLHttpRequest;return $t.open("GET",Tt,!1),$t.responseType="arraybuffer",$t.send(null),new Uint8Array($t.response)}),nt=(Tt,$t,Lt)=>{var Nt=new XMLHttpRequest;Nt.open("GET",Tt,!0),Nt.responseType="arraybuffer",Nt.onload=()=>{Nt.status==200||Nt.status==0&&Nt.response?$t(Nt.response):Lt()},Nt.onerror=Lt,Nt.send(null)});var bt,yt=_e.print||console.log.bind(console),mt=_e.printErr||console.warn.bind(console);Object.assign(_e,at),at=null,_e.thisProgram&&(lt=_e.thisProgram),_e.quit&&(ut=_e.quit),_e.wasmBinary&&(bt=_e.wasmBinary);var gt=_e.noExitRuntime||!1;typeof WebAssembly!="object"&&ir("no native wasm support detected");var vt,wt,Ct,kt,It,Pt,St=!1,Rt=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function At(Tt,$t,Lt){var Nt=($t>>>=0)+Lt;for(Lt=$t;Tt[Lt]&&!(Lt>=Nt);)++Lt;if(16(Bt=(240&Bt)==224?(15&Bt)<<12|Ht<<6|qt:(7&Bt)<<18|Ht<<12|qt<<6|63&Tt[$t++])?Nt+=String.fromCharCode(Bt):(Bt-=65536,Nt+=String.fromCharCode(55296|Bt>>10,56320|1023&Bt))}}else Nt+=String.fromCharCode(Bt)}return Nt}function Mt(Tt,$t){return(Tt>>>=0)?At(kt,Tt,$t):""}function jt(Tt,$t,Lt,Nt){if(!(0>>=0;Nt=Lt+Nt-1;for(var Ht=0;Ht=qt&&(qt=65536+((1023&qt)<<10)|1023&Tt.charCodeAt(++Ht)),127>=qt){if(Lt>=Nt)break;$t[Lt++>>>0]=qt}else{if(2047>=qt){if(Lt+1>=Nt)break;$t[Lt++>>>0]=192|qt>>6}else{if(65535>=qt){if(Lt+2>=Nt)break;$t[Lt++>>>0]=224|qt>>12}else{if(Lt+3>=Nt)break;$t[Lt++>>>0]=240|qt>>18,$t[Lt++>>>0]=128|qt>>12&63}$t[Lt++>>>0]=128|qt>>6&63}$t[Lt++>>>0]=128|63&qt}}return $t[Lt>>>0]=0,Lt-Bt}function Yt(Tt){for(var $t=0,Lt=0;Lt=Nt?$t++:2047>=Nt?$t+=2:55296<=Nt&&57343>=Nt?($t+=4,++Lt):$t+=3}return $t}function Kt(){var Tt=vt.buffer;wt=Tt,_e.HEAP8=Ct=new Int8Array(Tt),_e.HEAP16=new Int16Array(Tt),_e.HEAP32=It=new Int32Array(Tt),_e.HEAPU8=kt=new Uint8Array(Tt),_e.HEAPU16=new Uint16Array(Tt),_e.HEAPU32=Pt=new Uint32Array(Tt),_e.HEAPF32=new Float32Array(Tt),_e.HEAPF64=new Float64Array(Tt)}var sr,ar=[],Gt=[],Qt=[],tr=[],Vt=0;function Xt(){var Tt=_e.preRun.shift();ar.unshift(Tt)}var Zt,cr=0,pr=null;function ir(Tt){throw _e.onAbort&&_e.onAbort(Tt),mt(Tt="Aborted("+Tt+")"),St=!0,Tt=new WebAssembly.RuntimeError(Tt+". Build with -sASSERTIONS for more info."),st(Tt),Tt}function hr(){return Zt.startsWith("data:application/octet-stream;base64,")}if(Zt="ort-wasm.wasm",!hr()){var Rr=Zt;Zt=_e.locateFile?_e.locateFile(Rr,ht):ht+Rr}function Or(){var Tt=Zt;try{if(Tt==Zt&&bt)return new Uint8Array(bt);if(et)return et(Tt);throw"both async and sync fetching of the wasm failed"}catch($t){ir($t)}}function Fr(Tt){this.name="ExitStatus",this.message="Program terminated with exit("+Tt+")",this.status=Tt}function zr(Tt){for(;0>2>>>0]=$t},this.Eb=function(){return Pt[this.zb+4>>2>>>0]},this.Sb=function($t){Pt[this.zb+8>>2>>>0]=$t},this.Wb=function(){return Pt[this.zb+8>>2>>>0]},this.Tb=function(){It[this.zb>>2>>>0]=0},this.Ib=function($t){Ct[this.zb+12>>0>>>0]=$t?1:0},this.Pb=function(){return Ct[this.zb+12>>0>>>0]!=0},this.Jb=function($t){Ct[this.zb+13>>0>>>0]=$t?1:0},this.Lb=function(){return Ct[this.zb+13>>0>>>0]!=0},this.Rb=function($t,Lt){this.Fb(0),this.Ub($t),this.Sb(Lt),this.Tb(),this.Ib(!1),this.Jb(!1)},this.Nb=function(){It[this.zb>>2>>>0]+=1},this.Xb=function(){var $t=It[this.zb>>2>>>0];return It[this.zb>>2>>>0]=$t-1,$t===1},this.Fb=function($t){Pt[this.zb+16>>2>>>0]=$t},this.Ob=function(){return Pt[this.zb+16>>2>>>0]},this.Qb=function(){if(hn(this.Eb()))return Pt[this.Db>>2>>>0];var $t=this.Ob();return $t!==0?$t:this.Db}}function Mr(Tt){return en(new Tr(Tt).zb)}var Br=[];function xr(Tt){var $t=Br[Tt];return $t||(Tt>=Br.length&&(Br.length=Tt+1),Br[Tt]=$t=sr.get(Tt)),$t}function dn(Tt){var $t=Yt(Tt)+1,Lt=Er($t);return Lt&&jt(Tt,Ct,Lt,$t),Lt}var sn={};function On(){if(!Xr){var Tt,$t={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:lt||"./this.program"};for(Tt in sn)sn[Tt]===void 0?delete $t[Tt]:$t[Tt]=sn[Tt];var Lt=[];for(Tt in $t)Lt.push(Tt+"="+$t[Tt]);Xr=Lt}return Xr}var Xr,an=[null,[],[]];function ln(Tt,$t){var Lt=an[Tt];$t===0||$t===10?((Tt===1?yt:mt)(At(Lt,0)),Lt.length=0):Lt.push($t)}var Dr=0;function Zr(Tt){return Tt%4==0&&(Tt%100!=0||Tt%400==0)}var lr=[31,29,31,30,31,30,31,31,30,31,30,31],Qr=[31,28,31,30,31,30,31,31,30,31,30,31];function Rn(Tt,$t,Lt,Nt){function Bt(Ut,wr,Pr){for(Ut=typeof Ut=="number"?Ut.toString():Ut||"";Ut.lengthqr?-1:0Wr-Ut.getDate())){Ut.setDate(Ut.getDate()+wr);break}wr-=Wr-Ut.getDate()+1,Ut.setDate(1),11>Pr?Ut.setMonth(Pr+1):(Ut.setMonth(0),Ut.setFullYear(Ut.getFullYear()+1))}return Pr=new Date(Ut.getFullYear()+1,0,4),wr=rr(new Date(Ut.getFullYear(),0,4)),Pr=rr(Pr),0>=qt(wr,Ut)?0>=qt(Pr,Ut)?Ut.getFullYear()+1:Ut.getFullYear():Ut.getFullYear()-1}var gr=It[Nt+40>>2>>>0];for(var Cr in Nt={$b:It[Nt>>2>>>0],Zb:It[Nt+4>>2>>>0],Gb:It[Nt+8>>2>>>0],Kb:It[Nt+12>>2>>>0],Hb:It[Nt+16>>2>>>0],Cb:It[Nt+20>>2>>>0],Ab:It[Nt+24>>2>>>0],Bb:It[Nt+28>>2>>>0],bc:It[Nt+32>>2>>>0],Yb:It[Nt+36>>2>>>0],ac:gr?Mt(gr):""},Lt=Mt(Lt),gr={"%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"})Lt=Lt.replace(new RegExp(Cr,"g"),gr[Cr]);var $r="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),Ar="January February March April May June July August September October November December".split(" ");for(Cr in gr={"%a":function(Ut){return $r[Ut.Ab].substring(0,3)},"%A":function(Ut){return $r[Ut.Ab]},"%b":function(Ut){return Ar[Ut.Hb].substring(0,3)},"%B":function(Ut){return Ar[Ut.Hb]},"%C":function(Ut){return Ht((Ut.Cb+1900)/100|0,2)},"%d":function(Ut){return Ht(Ut.Kb,2)},"%e":function(Ut){return Bt(Ut.Kb,2," ")},"%g":function(Ut){return er(Ut).toString().substring(2)},"%G":function(Ut){return er(Ut)},"%H":function(Ut){return Ht(Ut.Gb,2)},"%I":function(Ut){return(Ut=Ut.Gb)==0?Ut=12:12Ut.Gb?"AM":"PM"},"%S":function(Ut){return Ht(Ut.$b,2)},"%t":function(){return" "},"%u":function(Ut){return Ut.Ab||7},"%U":function(Ut){return Ht(Math.floor((Ut.Bb+7-Ut.Ab)/7),2)},"%V":function(Ut){var wr=Math.floor((Ut.Bb+7-(Ut.Ab+6)%7)/7);if(2>=(Ut.Ab+371-Ut.Bb-2)%7&&wr++,wr)wr==53&&((Pr=(Ut.Ab+371-Ut.Bb)%7)==4||Pr==3&&Zr(Ut.Cb)||(wr=1));else{wr=52;var Pr=(Ut.Ab+7-Ut.Bb-1)%7;(Pr==4||Pr==5&&Zr(Ut.Cb%400-1))&&wr++}return Ht(wr,2)},"%w":function(Ut){return Ut.Ab},"%W":function(Ut){return Ht(Math.floor((Ut.Bb+7-(Ut.Ab+6)%7)/7),2)},"%y":function(Ut){return(Ut.Cb+1900).toString().substring(2)},"%Y":function(Ut){return Ut.Cb+1900},"%z":function(Ut){var wr=0<=(Ut=Ut.Yb);return Ut=Math.abs(Ut)/60,(wr?"+":"-")+("0000"+(Ut/60*100+Ut%60)).slice(-4)},"%Z":function(Ut){return Ut.ac},"%%":function(){return"%"}},Lt=Lt.replace(/%%/g,"\0\0"),gr)Lt.includes(Cr)&&(Lt=Lt.replace(new RegExp(Cr,"g"),gr[Cr](Nt)));return Cr=function(Ut){var wr=Array(Yt(Ut)+1);return jt(Ut,wr,0,wr.length),wr}(Lt=Lt.replace(/\0\0/g,"%")),Cr.length>$t?0:(Ct.set(Cr,Tt>>>0),Cr.length-1)}var An={a:function(Tt){return Er(Tt+24)+24},m:function(Tt){return(Tt=new Tr(Tt)).Pb()||(Tt.Ib(!0),jr--),Tt.Jb(!1),Gr.push(Tt),Tt.Nb(),Tt.Qb()},ia:function(Tt){throw mt("Unexpected exception thrown, this is not properly supported - aborting"),St=!0,Tt},w:function(){fr(0);var Tt=Gr.pop();if(Tt.Xb()&&!Tt.Lb()){var $t=Tt.Wb();$t&&xr($t)(Tt.Db),Mr(Tt.Db)}Nr=0},d:function(){var Tt=Nr;if(!Tt)return Dr=0;var $t=new Tr(Tt);$t.Fb(Tt);var Lt=$t.Eb();if(!Lt)return Dr=0,Tt;for(var Nt=Array.prototype.slice.call(arguments),Bt=0;Bt>>2]+4294967296*It[Tt+4>>>2])),It[$t>>2>>>0]=Tt.getUTCSeconds(),It[$t+4>>2>>>0]=Tt.getUTCMinutes(),It[$t+8>>2>>>0]=Tt.getUTCHours(),It[$t+12>>2>>>0]=Tt.getUTCDate(),It[$t+16>>2>>>0]=Tt.getUTCMonth(),It[$t+20>>2>>>0]=Tt.getUTCFullYear()-1900,It[$t+24>>2>>>0]=Tt.getUTCDay(),It[$t+28>>2>>>0]=(Tt.getTime()-Date.UTC(Tt.getUTCFullYear(),0,1,0,0,0,0))/864e5|0},Ea:function(Tt,$t){Tt=new Date(1e3*(Pt[Tt>>>2]+4294967296*It[Tt+4>>>2])),It[$t>>2>>>0]=Tt.getSeconds(),It[$t+4>>2>>>0]=Tt.getMinutes(),It[$t+8>>2>>>0]=Tt.getHours(),It[$t+12>>2>>>0]=Tt.getDate(),It[$t+16>>2>>>0]=Tt.getMonth(),It[$t+20>>2>>>0]=Tt.getFullYear()-1900,It[$t+24>>2>>>0]=Tt.getDay();var Lt=new Date(Tt.getFullYear(),0,1);It[$t+28>>2>>>0]=(Tt.getTime()-Lt.getTime())/864e5|0,It[$t+36>>2>>>0]=-60*Tt.getTimezoneOffset();var Nt=new Date(Tt.getFullYear(),6,1).getTimezoneOffset();Lt=Lt.getTimezoneOffset(),It[$t+32>>2>>>0]=0|(Nt!=Lt&&Tt.getTimezoneOffset()==Math.min(Lt,Nt))},Fa:function(Tt){var $t=new Date(It[Tt+20>>2>>>0]+1900,It[Tt+16>>2>>>0],It[Tt+12>>2>>>0],It[Tt+8>>2>>>0],It[Tt+4>>2>>>0],It[Tt>>2>>>0],0),Lt=It[Tt+32>>2>>>0],Nt=$t.getTimezoneOffset(),Bt=new Date($t.getFullYear(),0,1),Ht=new Date($t.getFullYear(),6,1).getTimezoneOffset(),qt=Bt.getTimezoneOffset(),rr=Math.min(qt,Ht);return 0>Lt?It[Tt+32>>2>>>0]=+(Ht!=qt&&rr==Nt):0>2>>>0]=$t.getDay(),It[Tt+28>>2>>>0]=($t.getTime()-Bt.getTime())/864e5|0,It[Tt>>2>>>0]=$t.getSeconds(),It[Tt+4>>2>>>0]=$t.getMinutes(),It[Tt+8>>2>>>0]=$t.getHours(),It[Tt+12>>2>>>0]=$t.getDate(),It[Tt+16>>2>>>0]=$t.getMonth(),$t.getTime()/1e3|0},sa:function(){return-52},ta:function(){},Ga:function Tt($t,Lt,Nt){Tt.Vb||(Tt.Vb=!0,function(Bt,Ht,qt){function rr(Ar){return(Ar=Ar.toTimeString().match(/\(([A-Za-z ]+)\)$/))?Ar[1]:"GMT"}var er=new Date().getFullYear(),gr=new Date(er,0,1),Cr=new Date(er,6,1);er=gr.getTimezoneOffset();var $r=Cr.getTimezoneOffset();It[Bt>>2>>>0]=60*Math.max(er,$r),It[Ht>>2>>>0]=+(er!=$r),Bt=rr(gr),Ht=rr(Cr),Bt=dn(Bt),Ht=dn(Ht),$r>2>>>0]=Bt,Pt[qt+4>>2>>>0]=Ht):(Pt[qt>>2>>>0]=Ht,Pt[qt+4>>2>>>0]=Bt)}($t,Lt,Nt))},B:function(){ir("")},ma:function(){return 4294901760},I:ft?()=>{var Tt=process.hrtime();return 1e3*Tt[0]+Tt[1]/1e6}:()=>performance.now(),xa:function(Tt,$t,Lt){kt.copyWithin(Tt>>>0,$t>>>0,$t+Lt>>>0)},G:function(Tt){var $t=kt.length;if(4294901760<(Tt>>>=0))return!1;for(var Lt=1;4>=Lt;Lt*=2){var Nt=$t*(1+.2/Lt);Nt=Math.min(Nt,Tt+100663296);var Bt=Math;Nt=Math.max(Tt,Nt),Bt=Bt.min.call(Bt,4294901760,Nt+(65536-Nt%65536)%65536);e:{try{vt.grow(Bt-wt.byteLength+65535>>>16),Kt();var Ht=1;break e}catch{}Ht=void 0}if(Ht)return!0}return!1},va:function(Tt,$t){var Lt=0;return On().forEach(function(Nt,Bt){var Ht=$t+Lt;for(Bt=Pt[Tt+4*Bt>>2>>>0]=Ht,Ht=0;Ht>0>>>0]=Nt.charCodeAt(Ht);Ct[Bt>>0>>>0]=0,Lt+=Nt.length+1}),0},wa:function(Tt,$t){var Lt=On();Pt[Tt>>2>>>0]=Lt.length;var Nt=0;return Lt.forEach(function(Bt){Nt+=Bt.length+1}),Pt[$t>>2>>>0]=Nt,0},ba:function(Tt){gt||0>2>>>0],rr=Pt[$t+4>>2>>>0];$t+=8;for(var er=0;er>>0]);Bt+=rr}return Pt[Nt>>2>>>0]=Bt,0},c:function(){return Dr},ja:function Tt($t,Lt){Tt.Mb||(Tt.Mb=function(){if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function"){var Bt=new Uint8Array(1);return()=>(crypto.getRandomValues(Bt),Bt[0])}if(ft)try{var Ht=s(Object(function(){var qt=new Error("Cannot find module 'crypto'");throw qt.code="MODULE_NOT_FOUND",qt}()));return()=>Ht.randomBytes(1)[0]}catch{}return()=>ir("randomDevice")}());for(var Nt=0;Nt>0>>>0]=Tt.Mb();return 0},ea:function(Tt,$t,Lt){var Nt=ur();try{return xr(Tt)($t,Lt)}catch(Bt){if(dr(Nt),Bt!==Bt+0)throw Bt;fr(1,0)}},fa:function(Tt,$t,Lt){var Nt=ur();try{return xr(Tt)($t,Lt)}catch(Bt){if(dr(Nt),Bt!==Bt+0)throw Bt;fr(1,0)}},J:function(Tt){var $t=ur();try{return xr(Tt)()}catch(Lt){if(dr($t),Lt!==Lt+0)throw Lt;fr(1,0)}},e:function(Tt,$t){var Lt=ur();try{return xr(Tt)($t)}catch(Nt){if(dr(Lt),Nt!==Nt+0)throw Nt;fr(1,0)}},N:function(Tt,$t,Lt){var Nt=ur();try{return xr(Tt)($t,Lt)}catch(Bt){if(dr(Nt),Bt!==Bt+0)throw Bt;fr(1,0)}},O:function(Tt,$t,Lt){var Nt=ur();try{return xr(Tt)($t,Lt)}catch(Bt){if(dr(Nt),Bt!==Bt+0)throw Bt;fr(1,0)}},j:function(Tt,$t,Lt){var Nt=ur();try{return xr(Tt)($t,Lt)}catch(Bt){if(dr(Nt),Bt!==Bt+0)throw Bt;fr(1,0)}},o:function(Tt,$t,Lt,Nt){var Bt=ur();try{return xr(Tt)($t,Lt,Nt)}catch(Ht){if(dr(Bt),Ht!==Ht+0)throw Ht;fr(1,0)}},p:function(Tt,$t,Lt,Nt,Bt){var Ht=ur();try{return xr(Tt)($t,Lt,Nt,Bt)}catch(qt){if(dr(Ht),qt!==qt+0)throw qt;fr(1,0)}},M:function(Tt,$t,Lt,Nt,Bt,Ht){var qt=ur();try{return xr(Tt)($t,Lt,Nt,Bt,Ht)}catch(rr){if(dr(qt),rr!==rr+0)throw rr;fr(1,0)}},r:function(Tt,$t,Lt,Nt,Bt,Ht){var qt=ur();try{return xr(Tt)($t,Lt,Nt,Bt,Ht)}catch(rr){if(dr(qt),rr!==rr+0)throw rr;fr(1,0)}},v:function(Tt,$t,Lt,Nt,Bt,Ht,qt){var rr=ur();try{return xr(Tt)($t,Lt,Nt,Bt,Ht,qt)}catch(er){if(dr(rr),er!==er+0)throw er;fr(1,0)}},K:function(Tt,$t,Lt,Nt,Bt,Ht,qt,rr){var er=ur();try{return xr(Tt)($t,Lt,Nt,Bt,Ht,qt,rr)}catch(gr){if(dr(er),gr!==gr+0)throw gr;fr(1,0)}},D:function(Tt,$t,Lt,Nt,Bt,Ht,qt,rr,er,gr,Cr,$r){var Ar=ur();try{return xr(Tt)($t,Lt,Nt,Bt,Ht,qt,rr,er,gr,Cr,$r)}catch(Ut){if(dr(Ar),Ut!==Ut+0)throw Ut;fr(1,0)}},X:function(Tt,$t,Lt,Nt,Bt,Ht,qt,rr){var er=ur();try{return En(Tt,$t,Lt,Nt,Bt,Ht,qt,rr)}catch(gr){if(dr(er),gr!==gr+0)throw gr;fr(1,0)}},V:function(Tt,$t,Lt,Nt,Bt,Ht,qt){var rr=ur();try{return mn(Tt,$t,Lt,Nt,Bt,Ht,qt)}catch(er){if(dr(rr),er!==er+0)throw er;fr(1,0)}},U:function(Tt,$t,Lt,Nt,Bt){var Ht=ur();try{return Cn(Tt,$t,Lt,Nt,Bt)}catch(qt){if(dr(Ht),qt!==qt+0)throw qt;fr(1,0)}},Z:function(Tt,$t,Lt,Nt){var Bt=ur();try{return wn(Tt,$t,Lt,Nt)}catch(Ht){if(dr(Bt),Ht!==Ht+0)throw Ht;fr(1,0)}},W:function(Tt){var $t=ur();try{return gn(Tt)}catch(Lt){if(dr($t),Lt!==Lt+0)throw Lt;fr(1,0)}},Y:function(Tt,$t){var Lt=ur();try{return Sn(Tt,$t)}catch(Nt){if(dr(Lt),Nt!==Nt+0)throw Nt;fr(1,0)}},T:function(Tt,$t,Lt){var Nt=ur();try{return yn(Tt,$t,Lt)}catch(Bt){if(dr(Nt),Bt!==Bt+0)throw Bt;fr(1,0)}},f:function(Tt){var $t=ur();try{xr(Tt)()}catch(Lt){if(dr($t),Lt!==Lt+0)throw Lt;fr(1,0)}},q:function(Tt,$t){var Lt=ur();try{xr(Tt)($t)}catch(Nt){if(dr(Lt),Nt!==Nt+0)throw Nt;fr(1,0)}},h:function(Tt,$t,Lt){var Nt=ur();try{xr(Tt)($t,Lt)}catch(Bt){if(dr(Nt),Bt!==Bt+0)throw Bt;fr(1,0)}},da:function(Tt,$t,Lt,Nt){var Bt=ur();try{xr(Tt)($t,Lt,Nt)}catch(Ht){if(dr(Bt),Ht!==Ht+0)throw Ht;fr(1,0)}},l:function(Tt,$t,Lt,Nt){var Bt=ur();try{xr(Tt)($t,Lt,Nt)}catch(Ht){if(dr(Bt),Ht!==Ht+0)throw Ht;fr(1,0)}},t:function(Tt,$t,Lt,Nt,Bt){var Ht=ur();try{xr(Tt)($t,Lt,Nt,Bt)}catch(qt){if(dr(Ht),qt!==qt+0)throw qt;fr(1,0)}},u:function(Tt,$t,Lt,Nt,Bt,Ht){var qt=ur();try{xr(Tt)($t,Lt,Nt,Bt,Ht)}catch(rr){if(dr(qt),rr!==rr+0)throw rr;fr(1,0)}},x:function(Tt,$t,Lt,Nt,Bt,Ht,qt){var rr=ur();try{xr(Tt)($t,Lt,Nt,Bt,Ht,qt)}catch(er){if(dr(rr),er!==er+0)throw er;fr(1,0)}},z:function(Tt,$t,Lt,Nt,Bt,Ht,qt,rr){var er=ur();try{xr(Tt)($t,Lt,Nt,Bt,Ht,qt,rr)}catch(gr){if(dr(er),gr!==gr+0)throw gr;fr(1,0)}},ga:function(Tt,$t,Lt,Nt,Bt,Ht,qt,rr,er){var gr=ur();try{xr(Tt)($t,Lt,Nt,Bt,Ht,qt,rr,er)}catch(Cr){if(dr(gr),Cr!==Cr+0)throw Cr;fr(1,0)}},A:function(Tt,$t,Lt,Nt,Bt,Ht,qt,rr,er,gr,Cr){var $r=ur();try{xr(Tt)($t,Lt,Nt,Bt,Ht,qt,rr,er,gr,Cr)}catch(Ar){if(dr($r),Ar!==Ar+0)throw Ar;fr(1,0)}},C:function(Tt,$t,Lt,Nt,Bt,Ht,qt,rr,er,gr,Cr,$r,Ar,Ut,wr,Pr){var Wr=ur();try{xr(Tt)($t,Lt,Nt,Bt,Ht,qt,rr,er,gr,Cr,$r,Ar,Ut,wr,Pr)}catch(qr){if(dr(Wr),qr!==qr+0)throw qr;fr(1,0)}},aa:function(Tt,$t,Lt,Nt,Bt,Ht,qt,rr){var er=ur();try{bn(Tt,$t,Lt,Nt,Bt,Ht,qt,rr)}catch(gr){if(dr(er),gr!==gr+0)throw gr;fr(1,0)}},_:function(Tt,$t,Lt,Nt,Bt,Ht,qt,rr,er,gr,Cr,$r){var Ar=ur();try{_n(Tt,$t,Lt,Nt,Bt,Ht,qt,rr,er,gr,Cr,$r)}catch(Ut){if(dr(Ar),Ut!==Ut+0)throw Ut;fr(1,0)}},$:function(Tt,$t,Lt,Nt,Bt,Ht){var qt=ur();try{xn(Tt,$t,Lt,Nt,Bt,Ht)}catch(rr){if(dr(qt),rr!==rr+0)throw rr;fr(1,0)}},n:function(Tt){return Tt},F:function(Tt){Dr=Tt},ha:Rn,y:function(Tt,$t,Lt,Nt){return Rn(Tt,$t,Lt,Nt)}};(function(){function Tt(Bt){_e.asm=Bt.exports,vt=_e.asm.Ka,Kt(),sr=_e.asm.ib,Gt.unshift(_e.asm.La),cr--,_e.monitorRunDependencies&&_e.monitorRunDependencies(cr),cr==0&&pr&&(Bt=pr,pr=null,Bt())}function $t(Bt){Tt(Bt.instance)}function Lt(Bt){return function(){if(!bt&&(ct||dt)){if(typeof fetch=="function"&&!Zt.startsWith("file://"))return fetch(Zt,{credentials:"same-origin"}).then(function(Ht){if(!Ht.ok)throw"failed to load wasm binary file at '"+Zt+"'";return Ht.arrayBuffer()}).catch(function(){return Or()});if(nt)return new Promise(function(Ht,qt){nt(Zt,function(rr){Ht(new Uint8Array(rr))},qt)})}return Promise.resolve().then(function(){return Or()})}().then(function(Ht){return WebAssembly.instantiate(Ht,Nt)}).then(function(Ht){return Ht}).then(Bt,function(Ht){mt("failed to asynchronously prepare wasm: "+Ht),ir(Ht)})}var Nt={a:An};if(cr++,_e.monitorRunDependencies&&_e.monitorRunDependencies(cr),_e.instantiateWasm)try{return _e.instantiateWasm(Nt,Tt)}catch(Bt){return mt("Module.instantiateWasm callback failed with error: "+Bt),!1}(bt||typeof WebAssembly.instantiateStreaming!="function"||hr()||Zt.startsWith("file://")||ft||typeof fetch!="function"?Lt($t):fetch(Zt,{credentials:"same-origin"}).then(function(Bt){return WebAssembly.instantiateStreaming(Bt,Nt).then($t,function(Ht){return mt("wasm streaming compile failed: "+Ht),mt("falling back to ArrayBuffer instantiation"),Lt($t)})})).catch(st)})(),_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 Kr,Er=_e._malloc=function(){return(Er=_e._malloc=_e.asm.eb).apply(null,arguments)},en=_e._free=function(){return(en=_e._free=_e.asm.fb).apply(null,arguments)},pn=_e._fflush=function(){return(pn=_e._fflush=_e.asm.gb).apply(null,arguments)},tn=_e.___funcs_on_exit=function(){return(tn=_e.___funcs_on_exit=_e.asm.hb).apply(null,arguments)},fr=_e._setThrew=function(){return(fr=_e._setThrew=_e.asm.jb).apply(null,arguments)},ur=_e.stackSave=function(){return(ur=_e.stackSave=_e.asm.kb).apply(null,arguments)},dr=_e.stackRestore=function(){return(dr=_e.stackRestore=_e.asm.lb).apply(null,arguments)},fn=_e.stackAlloc=function(){return(fn=_e.stackAlloc=_e.asm.mb).apply(null,arguments)},rn=_e.___cxa_can_catch=function(){return(rn=_e.___cxa_can_catch=_e.asm.nb).apply(null,arguments)},hn=_e.___cxa_is_pointer_type=function(){return(hn=_e.___cxa_is_pointer_type=_e.asm.ob).apply(null,arguments)},gn=_e.dynCall_j=function(){return(gn=_e.dynCall_j=_e.asm.pb).apply(null,arguments)},mn=_e.dynCall_iiiiij=function(){return(mn=_e.dynCall_iiiiij=_e.asm.qb).apply(null,arguments)},yn=_e.dynCall_jii=function(){return(yn=_e.dynCall_jii=_e.asm.rb).apply(null,arguments)},bn=_e.dynCall_viiiiij=function(){return(bn=_e.dynCall_viiiiij=_e.asm.sb).apply(null,arguments)},xn=_e.dynCall_vjji=function(){return(xn=_e.dynCall_vjji=_e.asm.tb).apply(null,arguments)},_n=_e.dynCall_viiijjjii=function(){return(_n=_e.dynCall_viiijjjii=_e.asm.ub).apply(null,arguments)},wn=_e.dynCall_iij=function(){return(wn=_e.dynCall_iij=_e.asm.vb).apply(null,arguments)},Sn=_e.dynCall_ji=function(){return(Sn=_e.dynCall_ji=_e.asm.wb).apply(null,arguments)},En=_e.dynCall_iiiiiij=function(){return(En=_e.dynCall_iiiiiij=_e.asm.xb).apply(null,arguments)},Cn=_e.dynCall_iiij=function(){return(Cn=_e.dynCall_iiij=_e.asm.yb).apply(null,arguments)};function Tn(){function Tt(){if(!Kr&&(Kr=!0,_e.calledRun=!0,!St)){if(zr(Gt),tt(_e),_e.onRuntimeInitialized&&_e.onRuntimeInitialized(),_e.postRun)for(typeof _e.postRun=="function"&&(_e.postRun=[_e.postRun]);_e.postRun.length;){var $t=_e.postRun.shift();tr.unshift($t)}zr(tr)}}if(!(0{i.exports=function(o,s){for(var a=new Array(arguments.length-1),_=0,$=2,_e=!0;${var s=o;s.length=function(tt){var st=tt.length;if(!st)return 0;for(var it=0;--st%4>1&&tt.charAt(st)==="=";)++it;return Math.ceil(3*tt.length)/4-it};for(var a=new Array(64),_=new Array(123),$=0;$<64;)_[a[$]=$<26?$+65:$<52?$+71:$<62?$-4:$-59|43]=$++;s.encode=function(tt,st,it){for(var nt,et=null,j=[],rt=0,ot=0;st>2],nt=(3&at)<<4,ot=1;break;case 1:j[rt++]=a[nt|at>>4],nt=(15&at)<<2,ot=2;break;case 2:j[rt++]=a[nt|at>>6],j[rt++]=a[63&at],ot=0}rt>8191&&((et||(et=[])).push(String.fromCharCode.apply(String,j)),rt=0)}return ot&&(j[rt++]=a[nt],j[rt++]=61,ot===1&&(j[rt++]=61)),et?(rt&&et.push(String.fromCharCode.apply(String,j.slice(0,rt))),et.join("")):String.fromCharCode.apply(String,j.slice(0,rt))};var _e="invalid encoding";s.decode=function(tt,st,it){for(var nt,et=it,j=0,rt=0;rt1)break;if((ot=_[ot])===void 0)throw Error(_e);switch(j){case 0:nt=ot,j=1;break;case 1:st[it++]=nt<<2|(48&ot)>>4,nt=ot,j=2;break;case 2:st[it++]=(15&nt)<<4|(60&ot)>>2,nt=ot,j=3;break;case 3:st[it++]=(3&nt)<<6|ot,j=0}}if(j===1)throw Error(_e);return it-et},s.test=function(tt){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(tt)}},9211:i=>{function o(){this._listeners={}}i.exports=o,o.prototype.on=function(s,a,_){return(this._listeners[s]||(this._listeners[s]=[])).push({fn:a,ctx:_||this}),this},o.prototype.off=function(s,a){if(s===void 0)this._listeners={};else if(a===void 0)this._listeners[s]=[];else for(var _=this._listeners[s],$=0;$<_.length;)_[$].fn===a?_.splice($,1):++$;return this},o.prototype.emit=function(s){var a=this._listeners[s];if(a){for(var _=[],$=1;${function o(_e){return typeof Float32Array<"u"?function(){var tt=new Float32Array([-0]),st=new Uint8Array(tt.buffer),it=st[3]===128;function nt(ot,at,lt){tt[0]=ot,at[lt]=st[0],at[lt+1]=st[1],at[lt+2]=st[2],at[lt+3]=st[3]}function et(ot,at,lt){tt[0]=ot,at[lt]=st[3],at[lt+1]=st[2],at[lt+2]=st[1],at[lt+3]=st[0]}function j(ot,at){return st[0]=ot[at],st[1]=ot[at+1],st[2]=ot[at+2],st[3]=ot[at+3],tt[0]}function rt(ot,at){return st[3]=ot[at],st[2]=ot[at+1],st[1]=ot[at+2],st[0]=ot[at+3],tt[0]}_e.writeFloatLE=it?nt:et,_e.writeFloatBE=it?et:nt,_e.readFloatLE=it?j:rt,_e.readFloatBE=it?rt:j}():function(){function tt(it,nt,et,j){var rt=nt<0?1:0;if(rt&&(nt=-nt),nt===0)it(1/nt>0?0:2147483648,et,j);else if(isNaN(nt))it(2143289344,et,j);else if(nt>34028234663852886e22)it((rt<<31|2139095040)>>>0,et,j);else if(nt<11754943508222875e-54)it((rt<<31|Math.round(nt/1401298464324817e-60))>>>0,et,j);else{var ot=Math.floor(Math.log(nt)/Math.LN2);it((rt<<31|ot+127<<23|8388607&Math.round(nt*Math.pow(2,-ot)*8388608))>>>0,et,j)}}function st(it,nt,et){var j=it(nt,et),rt=2*(j>>31)+1,ot=j>>>23&255,at=8388607&j;return ot===255?at?NaN:rt*(1/0):ot===0?1401298464324817e-60*rt*at:rt*Math.pow(2,ot-150)*(at+8388608)}_e.writeFloatLE=tt.bind(null,s),_e.writeFloatBE=tt.bind(null,a),_e.readFloatLE=st.bind(null,_),_e.readFloatBE=st.bind(null,$)}(),typeof Float64Array<"u"?function(){var tt=new Float64Array([-0]),st=new Uint8Array(tt.buffer),it=st[7]===128;function nt(ot,at,lt){tt[0]=ot,at[lt]=st[0],at[lt+1]=st[1],at[lt+2]=st[2],at[lt+3]=st[3],at[lt+4]=st[4],at[lt+5]=st[5],at[lt+6]=st[6],at[lt+7]=st[7]}function et(ot,at,lt){tt[0]=ot,at[lt]=st[7],at[lt+1]=st[6],at[lt+2]=st[5],at[lt+3]=st[4],at[lt+4]=st[3],at[lt+5]=st[2],at[lt+6]=st[1],at[lt+7]=st[0]}function j(ot,at){return st[0]=ot[at],st[1]=ot[at+1],st[2]=ot[at+2],st[3]=ot[at+3],st[4]=ot[at+4],st[5]=ot[at+5],st[6]=ot[at+6],st[7]=ot[at+7],tt[0]}function rt(ot,at){return st[7]=ot[at],st[6]=ot[at+1],st[5]=ot[at+2],st[4]=ot[at+3],st[3]=ot[at+4],st[2]=ot[at+5],st[1]=ot[at+6],st[0]=ot[at+7],tt[0]}_e.writeDoubleLE=it?nt:et,_e.writeDoubleBE=it?et:nt,_e.readDoubleLE=it?j:rt,_e.readDoubleBE=it?rt:j}():function(){function tt(it,nt,et,j,rt,ot){var at=j<0?1:0;if(at&&(j=-j),j===0)it(0,rt,ot+nt),it(1/j>0?0:2147483648,rt,ot+et);else if(isNaN(j))it(0,rt,ot+nt),it(2146959360,rt,ot+et);else if(j>17976931348623157e292)it(0,rt,ot+nt),it((at<<31|2146435072)>>>0,rt,ot+et);else{var lt;if(j<22250738585072014e-324)it((lt=j/5e-324)>>>0,rt,ot+nt),it((at<<31|lt/4294967296)>>>0,rt,ot+et);else{var ut=Math.floor(Math.log(j)/Math.LN2);ut===1024&&(ut=1023),it(4503599627370496*(lt=j*Math.pow(2,-ut))>>>0,rt,ot+nt),it((at<<31|ut+1023<<20|1048576*lt&1048575)>>>0,rt,ot+et)}}}function st(it,nt,et,j,rt){var ot=it(j,rt+nt),at=it(j,rt+et),lt=2*(at>>31)+1,ut=at>>>20&2047,ct=4294967296*(1048575&at)+ot;return ut===2047?ct?NaN:lt*(1/0):ut===0?5e-324*lt*ct:lt*Math.pow(2,ut-1075)*(ct+4503599627370496)}_e.writeDoubleLE=tt.bind(null,s,0,4),_e.writeDoubleBE=tt.bind(null,a,4,0),_e.readDoubleLE=st.bind(null,_,0,4),_e.readDoubleBE=st.bind(null,$,4,0)}(),_e}function s(_e,tt,st){tt[st]=255&_e,tt[st+1]=_e>>>8&255,tt[st+2]=_e>>>16&255,tt[st+3]=_e>>>24}function a(_e,tt,st){tt[st]=_e>>>24,tt[st+1]=_e>>>16&255,tt[st+2]=_e>>>8&255,tt[st+3]=255&_e}function _(_e,tt){return(_e[tt]|_e[tt+1]<<8|_e[tt+2]<<16|_e[tt+3]<<24)>>>0}function $(_e,tt){return(_e[tt]<<24|_e[tt+1]<<16|_e[tt+2]<<8|_e[tt+3])>>>0}i.exports=o(o)},7199:module=>{function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(i){}return null}module.exports=inquire},6662:i=>{i.exports=function(o,s,a){var _=a||8192,$=_>>>1,_e=null,tt=_;return function(st){if(st<1||st>$)return o(st);tt+st>_&&(_e=o(_),tt=0);var it=s.call(_e,tt,tt+=st);return 7&tt&&(tt=1+(7|tt)),it}}},4997:(i,o)=>{var s=o;s.length=function(a){for(var _=0,$=0,_e=0;_e191&&_e<224?st[it++]=(31&_e)<<6|63&a[_++]:_e>239&&_e<365?(_e=((7&_e)<<18|(63&a[_++])<<12|(63&a[_++])<<6|63&a[_++])-65536,st[it++]=55296+(_e>>10),st[it++]=56320+(1023&_e)):st[it++]=(15&_e)<<12|(63&a[_++])<<6|63&a[_++],it>8191&&((tt||(tt=[])).push(String.fromCharCode.apply(String,st)),it=0);return tt?(it&&tt.push(String.fromCharCode.apply(String,st.slice(0,it))),tt.join("")):String.fromCharCode.apply(String,st.slice(0,it))},s.write=function(a,_,$){for(var _e,tt,st=$,it=0;it>6|192,_[$++]=63&_e|128):(64512&_e)==55296&&(64512&(tt=a.charCodeAt(it+1)))==56320?(_e=65536+((1023&_e)<<10)+(1023&tt),++it,_[$++]=_e>>18|240,_[$++]=_e>>12&63|128,_[$++]=_e>>6&63|128,_[$++]=63&_e|128):(_[$++]=_e>>12|224,_[$++]=_e>>6&63|128,_[$++]=63&_e|128);return $-st}},3442:(i,o)=>{o.__esModule=!0;var s=function(){function a(_){if(!_)throw new TypeError("Invalid argument; `value` has no value.");this.value=a.EMPTY,_&&a.isGuid(_)&&(this.value=_)}return a.isGuid=function(_){var $=_.toString();return _&&(_ instanceof a||a.validator.test($))},a.create=function(){return new a([a.gen(2),a.gen(1),a.gen(1),a.gen(1),a.gen(3)].join("-"))},a.createEmpty=function(){return new a("emptyguid")},a.parse=function(_){return new a(_)},a.raw=function(){return[a.gen(2),a.gen(1),a.gen(1),a.gen(1),a.gen(3)].join("-")},a.gen=function(_){for(var $="",_e=0;_e<_;_e++)$+=(65536*(1+Math.random())|0).toString(16).substring(1);return $},a.prototype.equals=function(_){return a.isGuid(_)&&this.value===_.toString()},a.prototype.isEmpty=function(){return this.value===a.EMPTY},a.prototype.toString=function(){return this.value},a.prototype.toJSON=function(){return{value:this.value}},a.validator=new RegExp("^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$","i"),a.EMPTY="00000000-0000-0000-0000-000000000000",a}();o.Guid=s},3720:i=>{i.exports=s;var o=null;try{o=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function s(gt,vt,wt){this.low=0|gt,this.high=0|vt,this.unsigned=!!wt}function a(gt){return(gt&>.__isLong__)===!0}s.prototype.__isLong__,Object.defineProperty(s.prototype,"__isLong__",{value:!0}),s.isLong=a;var _={},$={};function _e(gt,vt){var wt,Ct,kt;return vt?(kt=0<=(gt>>>=0)&><256)&&(Ct=$[gt])?Ct:(wt=st(gt,(0|gt)<0?-1:0,!0),kt&&($[gt]=wt),wt):(kt=-128<=(gt|=0)&><128)&&(Ct=_[gt])?Ct:(wt=st(gt,gt<0?-1:0,!1),kt&&(_[gt]=wt),wt)}function tt(gt,vt){if(isNaN(gt))return vt?ut:lt;if(vt){if(gt<0)return ut;if(gt>=rt)return bt}else{if(gt<=-9223372036854776e3)return yt;if(gt+1>=ot)return ht}return gt<0?tt(-gt,vt).neg():st(gt%j|0,gt/j|0,vt)}function st(gt,vt,wt){return new s(gt,vt,wt)}s.fromInt=_e,s.fromNumber=tt,s.fromBits=st;var it=Math.pow;function nt(gt,vt,wt){if(gt.length===0)throw Error("empty string");if(gt==="NaN"||gt==="Infinity"||gt==="+Infinity"||gt==="-Infinity")return lt;if(typeof vt=="number"?(wt=vt,vt=!1):vt=!!vt,(wt=wt||10)<2||360)throw Error("interior hyphen");if(Ct===0)return nt(gt.substring(1),vt,wt).neg();for(var kt=tt(it(wt,8)),It=lt,Pt=0;Pt>>0:this.low},mt.toNumber=function(){return this.unsigned?(this.high>>>0)*j+(this.low>>>0):this.high*j+(this.low>>>0)},mt.toString=function(gt){if((gt=gt||10)<2||36>>0).toString(gt);if((It=St).isZero())return Rt+Pt;for(;Rt.length<6;)Rt="0"+Rt;Pt=""+Rt+Pt}},mt.getHighBits=function(){return this.high},mt.getHighBitsUnsigned=function(){return this.high>>>0},mt.getLowBits=function(){return this.low},mt.getLowBitsUnsigned=function(){return this.low>>>0},mt.getNumBitsAbs=function(){if(this.isNegative())return this.eq(yt)?64:this.neg().getNumBitsAbs();for(var gt=this.high!=0?this.high:this.low,vt=31;vt>0&&!(gt&1<=0},mt.isOdd=function(){return(1&this.low)==1},mt.isEven=function(){return(1&this.low)==0},mt.equals=function(gt){return a(gt)||(gt=et(gt)),(this.unsigned===gt.unsigned||this.high>>>31!=1||gt.high>>>31!=1)&&this.high===gt.high&&this.low===gt.low},mt.eq=mt.equals,mt.notEquals=function(gt){return!this.eq(gt)},mt.neq=mt.notEquals,mt.ne=mt.notEquals,mt.lessThan=function(gt){return this.comp(gt)<0},mt.lt=mt.lessThan,mt.lessThanOrEqual=function(gt){return this.comp(gt)<=0},mt.lte=mt.lessThanOrEqual,mt.le=mt.lessThanOrEqual,mt.greaterThan=function(gt){return this.comp(gt)>0},mt.gt=mt.greaterThan,mt.greaterThanOrEqual=function(gt){return this.comp(gt)>=0},mt.gte=mt.greaterThanOrEqual,mt.ge=mt.greaterThanOrEqual,mt.compare=function(gt){if(a(gt)||(gt=et(gt)),this.eq(gt))return 0;var vt=this.isNegative(),wt=gt.isNegative();return vt&&!wt?-1:!vt&&wt?1:this.unsigned?gt.high>>>0>this.high>>>0||gt.high===this.high&>.low>>>0>this.low>>>0?-1:1:this.sub(gt).isNegative()?-1:1},mt.comp=mt.compare,mt.negate=function(){return!this.unsigned&&this.eq(yt)?yt:this.not().add(ct)},mt.neg=mt.negate,mt.add=function(gt){a(gt)||(gt=et(gt));var vt=this.high>>>16,wt=65535&this.high,Ct=this.low>>>16,kt=65535&this.low,It=gt.high>>>16,Pt=65535>.high,St=gt.low>>>16,Rt=0,At=0,Mt=0,jt=0;return Mt+=(jt+=kt+(65535>.low))>>>16,At+=(Mt+=Ct+St)>>>16,Rt+=(At+=wt+Pt)>>>16,Rt+=vt+It,st((Mt&=65535)<<16|(jt&=65535),(Rt&=65535)<<16|(At&=65535),this.unsigned)},mt.subtract=function(gt){return a(gt)||(gt=et(gt)),this.add(gt.neg())},mt.sub=mt.subtract,mt.multiply=function(gt){if(this.isZero())return lt;if(a(gt)||(gt=et(gt)),o)return st(o.mul(this.low,this.high,gt.low,gt.high),o.get_high(),this.unsigned);if(gt.isZero())return lt;if(this.eq(yt))return gt.isOdd()?yt:lt;if(gt.eq(yt))return this.isOdd()?yt:lt;if(this.isNegative())return gt.isNegative()?this.neg().mul(gt.neg()):this.neg().mul(gt).neg();if(gt.isNegative())return this.mul(gt.neg()).neg();if(this.lt(at)&>.lt(at))return tt(this.toNumber()*gt.toNumber(),this.unsigned);var vt=this.high>>>16,wt=65535&this.high,Ct=this.low>>>16,kt=65535&this.low,It=gt.high>>>16,Pt=65535>.high,St=gt.low>>>16,Rt=65535>.low,At=0,Mt=0,jt=0,Yt=0;return jt+=(Yt+=kt*Rt)>>>16,Mt+=(jt+=Ct*Rt)>>>16,jt&=65535,Mt+=(jt+=kt*St)>>>16,At+=(Mt+=wt*Rt)>>>16,Mt&=65535,At+=(Mt+=Ct*St)>>>16,Mt&=65535,At+=(Mt+=kt*Pt)>>>16,At+=vt*Rt+wt*St+Ct*Pt+kt*It,st((jt&=65535)<<16|(Yt&=65535),(At&=65535)<<16|(Mt&=65535),this.unsigned)},mt.mul=mt.multiply,mt.divide=function(gt){if(a(gt)||(gt=et(gt)),gt.isZero())throw Error("division by zero");var vt,wt,Ct;if(o)return this.unsigned||this.high!==-2147483648||gt.low!==-1||gt.high!==-1?st((this.unsigned?o.div_u:o.div_s)(this.low,this.high,gt.low,gt.high),o.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?ut:lt;if(this.unsigned){if(gt.unsigned||(gt=gt.toUnsigned()),gt.gt(this))return ut;if(gt.gt(this.shru(1)))return dt;Ct=ut}else{if(this.eq(yt))return gt.eq(ct)||gt.eq(ft)?yt:gt.eq(yt)?ct:(vt=this.shr(1).div(gt).shl(1)).eq(lt)?gt.isNegative()?ct:ft:(wt=this.sub(gt.mul(vt)),Ct=vt.add(wt.div(gt)));if(gt.eq(yt))return this.unsigned?ut:lt;if(this.isNegative())return gt.isNegative()?this.neg().div(gt.neg()):this.neg().div(gt).neg();if(gt.isNegative())return this.div(gt.neg()).neg();Ct=lt}for(wt=this;wt.gte(gt);){vt=Math.max(1,Math.floor(wt.toNumber()/gt.toNumber()));for(var kt=Math.ceil(Math.log(vt)/Math.LN2),It=kt<=48?1:it(2,kt-48),Pt=tt(vt),St=Pt.mul(gt);St.isNegative()||St.gt(wt);)St=(Pt=tt(vt-=It,this.unsigned)).mul(gt);Pt.isZero()&&(Pt=ct),Ct=Ct.add(Pt),wt=wt.sub(St)}return Ct},mt.div=mt.divide,mt.modulo=function(gt){return a(gt)||(gt=et(gt)),o?st((this.unsigned?o.rem_u:o.rem_s)(this.low,this.high,gt.low,gt.high),o.get_high(),this.unsigned):this.sub(this.div(gt).mul(gt))},mt.mod=mt.modulo,mt.rem=mt.modulo,mt.not=function(){return st(~this.low,~this.high,this.unsigned)},mt.and=function(gt){return a(gt)||(gt=et(gt)),st(this.low>.low,this.high>.high,this.unsigned)},mt.or=function(gt){return a(gt)||(gt=et(gt)),st(this.low|gt.low,this.high|gt.high,this.unsigned)},mt.xor=function(gt){return a(gt)||(gt=et(gt)),st(this.low^gt.low,this.high^gt.high,this.unsigned)},mt.shiftLeft=function(gt){return a(gt)&&(gt=gt.toInt()),(gt&=63)==0?this:gt<32?st(this.low<>>32-gt,this.unsigned):st(0,this.low<>>gt|this.high<<32-gt,this.high>>gt,this.unsigned):st(this.high>>gt-32,this.high>=0?0:-1,this.unsigned)},mt.shr=mt.shiftRight,mt.shiftRightUnsigned=function(gt){if(a(gt)&&(gt=gt.toInt()),(gt&=63)==0)return this;var vt=this.high;return gt<32?st(this.low>>>gt|vt<<32-gt,vt>>>gt,this.unsigned):st(gt===32?vt:vt>>>gt-32,0,this.unsigned)},mt.shru=mt.shiftRightUnsigned,mt.shr_u=mt.shiftRightUnsigned,mt.toSigned=function(){return this.unsigned?st(this.low,this.high,!1):this},mt.toUnsigned=function(){return this.unsigned?this:st(this.low,this.high,!0)},mt.toBytes=function(gt){return gt?this.toBytesLE():this.toBytesBE()},mt.toBytesLE=function(){var gt=this.high,vt=this.low;return[255&vt,vt>>>8&255,vt>>>16&255,vt>>>24,255>,gt>>>8&255,gt>>>16&255,gt>>>24]},mt.toBytesBE=function(){var gt=this.high,vt=this.low;return[gt>>>24,gt>>>16&255,gt>>>8&255,255>,vt>>>24,vt>>>16&255,vt>>>8&255,255&vt]},s.fromBytes=function(gt,vt,wt){return wt?s.fromBytesLE(gt,vt):s.fromBytesBE(gt,vt)},s.fromBytesLE=function(gt,vt){return new s(gt[0]|gt[1]<<8|gt[2]<<16|gt[3]<<24,gt[4]|gt[5]<<8|gt[6]<<16|gt[7]<<24,vt)},s.fromBytesBE=function(gt,vt){return new s(gt[4]<<24|gt[5]<<16|gt[6]<<8|gt[7],gt[0]<<24|gt[1]<<16|gt[2]<<8|gt[3],vt)}},1446:(i,o,s)=>{var a,_,$,_e=s(2100),tt=_e.Reader,st=_e.Writer,it=_e.util,nt=_e.roots.default||(_e.roots.default={});nt.onnx=(($={}).Version=(a={},(_=Object.create(a))[a[0]="_START_VERSION"]=0,_[a[1]="IR_VERSION_2017_10_10"]=1,_[a[2]="IR_VERSION_2017_10_30"]=2,_[a[3]="IR_VERSION_2017_11_3"]=3,_[a[4]="IR_VERSION_2019_1_22"]=4,_[a[5]="IR_VERSION"]=5,_),$.AttributeProto=function(){function et(j){if(this.floats=[],this.ints=[],this.strings=[],this.tensors=[],this.graphs=[],j)for(var rt=Object.keys(j),ot=0;ot>>3){case 1:at.name=j.string();break;case 21:at.refAttrName=j.string();break;case 13:at.docString=j.string();break;case 20:at.type=j.int32();break;case 2:at.f=j.float();break;case 3:at.i=j.int64();break;case 4:at.s=j.bytes();break;case 5:at.t=nt.onnx.TensorProto.decode(j,j.uint32());break;case 6:at.g=nt.onnx.GraphProto.decode(j,j.uint32());break;case 7:if(at.floats&&at.floats.length||(at.floats=[]),(7<)==2)for(var ut=j.uint32()+j.pos;j.pos>>0,j.i.high>>>0).toNumber())),j.s!=null&&(typeof j.s=="string"?it.base64.decode(j.s,rt.s=it.newBuffer(it.base64.length(j.s)),0):j.s.length&&(rt.s=j.s)),j.t!=null){if(typeof j.t!="object")throw TypeError(".onnx.AttributeProto.t: object expected");rt.t=nt.onnx.TensorProto.fromObject(j.t)}if(j.g!=null){if(typeof j.g!="object")throw TypeError(".onnx.AttributeProto.g: object expected");rt.g=nt.onnx.GraphProto.fromObject(j.g)}if(j.floats){if(!Array.isArray(j.floats))throw TypeError(".onnx.AttributeProto.floats: array expected");rt.floats=[];for(var ot=0;ot>>0,j.ints[ot].high>>>0).toNumber())}if(j.strings){if(!Array.isArray(j.strings))throw TypeError(".onnx.AttributeProto.strings: array expected");for(rt.strings=[],ot=0;ot>>0,j.i.high>>>0).toNumber():j.i),j.s!=null&&j.hasOwnProperty("s")&&(ot.s=rt.bytes===String?it.base64.encode(j.s,0,j.s.length):rt.bytes===Array?Array.prototype.slice.call(j.s):j.s),j.t!=null&&j.hasOwnProperty("t")&&(ot.t=nt.onnx.TensorProto.toObject(j.t,rt)),j.g!=null&&j.hasOwnProperty("g")&&(ot.g=nt.onnx.GraphProto.toObject(j.g,rt)),j.floats&&j.floats.length){ot.floats=[];for(var lt=0;lt>>0,j.ints[lt].high>>>0).toNumber():j.ints[lt];if(j.strings&&j.strings.length)for(ot.strings=[],lt=0;lt>>3){case 1:at.name=j.string();break;case 2:at.type=nt.onnx.TypeProto.decode(j,j.uint32());break;case 3:at.docString=j.string();break;default:j.skipType(7<)}}return at},et.decodeDelimited=function(j){return j instanceof tt||(j=new tt(j)),this.decode(j,j.uint32())},et.verify=function(j){if(typeof j!="object"||j===null)return"object expected";if(j.name!=null&&j.hasOwnProperty("name")&&!it.isString(j.name))return"name: string expected";if(j.type!=null&&j.hasOwnProperty("type")){var rt=nt.onnx.TypeProto.verify(j.type);if(rt)return"type."+rt}return j.docString!=null&&j.hasOwnProperty("docString")&&!it.isString(j.docString)?"docString: string expected":null},et.fromObject=function(j){if(j instanceof nt.onnx.ValueInfoProto)return j;var rt=new nt.onnx.ValueInfoProto;if(j.name!=null&&(rt.name=String(j.name)),j.type!=null){if(typeof j.type!="object")throw TypeError(".onnx.ValueInfoProto.type: object expected");rt.type=nt.onnx.TypeProto.fromObject(j.type)}return j.docString!=null&&(rt.docString=String(j.docString)),rt},et.toObject=function(j,rt){rt||(rt={});var ot={};return rt.defaults&&(ot.name="",ot.type=null,ot.docString=""),j.name!=null&&j.hasOwnProperty("name")&&(ot.name=j.name),j.type!=null&&j.hasOwnProperty("type")&&(ot.type=nt.onnx.TypeProto.toObject(j.type,rt)),j.docString!=null&&j.hasOwnProperty("docString")&&(ot.docString=j.docString),ot},et.prototype.toJSON=function(){return this.constructor.toObject(this,_e.util.toJSONOptions)},et}(),$.NodeProto=function(){function et(j){if(this.input=[],this.output=[],this.attribute=[],j)for(var rt=Object.keys(j),ot=0;ot>>3){case 1:at.input&&at.input.length||(at.input=[]),at.input.push(j.string());break;case 2:at.output&&at.output.length||(at.output=[]),at.output.push(j.string());break;case 3:at.name=j.string();break;case 4:at.opType=j.string();break;case 7:at.domain=j.string();break;case 5:at.attribute&&at.attribute.length||(at.attribute=[]),at.attribute.push(nt.onnx.AttributeProto.decode(j,j.uint32()));break;case 6:at.docString=j.string();break;default:j.skipType(7<)}}return at},et.decodeDelimited=function(j){return j instanceof tt||(j=new tt(j)),this.decode(j,j.uint32())},et.verify=function(j){if(typeof j!="object"||j===null)return"object expected";if(j.input!=null&&j.hasOwnProperty("input")){if(!Array.isArray(j.input))return"input: array expected";for(var rt=0;rt>>3){case 1:at.irVersion=j.int64();break;case 8:at.opsetImport&&at.opsetImport.length||(at.opsetImport=[]),at.opsetImport.push(nt.onnx.OperatorSetIdProto.decode(j,j.uint32()));break;case 2:at.producerName=j.string();break;case 3:at.producerVersion=j.string();break;case 4:at.domain=j.string();break;case 5:at.modelVersion=j.int64();break;case 6:at.docString=j.string();break;case 7:at.graph=nt.onnx.GraphProto.decode(j,j.uint32());break;case 14:at.metadataProps&&at.metadataProps.length||(at.metadataProps=[]),at.metadataProps.push(nt.onnx.StringStringEntryProto.decode(j,j.uint32()));break;default:j.skipType(7<)}}return at},et.decodeDelimited=function(j){return j instanceof tt||(j=new tt(j)),this.decode(j,j.uint32())},et.verify=function(j){if(typeof j!="object"||j===null)return"object expected";if(j.irVersion!=null&&j.hasOwnProperty("irVersion")&&!(it.isInteger(j.irVersion)||j.irVersion&&it.isInteger(j.irVersion.low)&&it.isInteger(j.irVersion.high)))return"irVersion: integer|Long expected";if(j.opsetImport!=null&&j.hasOwnProperty("opsetImport")){if(!Array.isArray(j.opsetImport))return"opsetImport: array expected";for(var rt=0;rt>>0,j.irVersion.high>>>0).toNumber())),j.opsetImport){if(!Array.isArray(j.opsetImport))throw TypeError(".onnx.ModelProto.opsetImport: array expected");rt.opsetImport=[];for(var ot=0;ot>>0,j.modelVersion.high>>>0).toNumber())),j.docString!=null&&(rt.docString=String(j.docString)),j.graph!=null){if(typeof j.graph!="object")throw TypeError(".onnx.ModelProto.graph: object expected");rt.graph=nt.onnx.GraphProto.fromObject(j.graph)}if(j.metadataProps){if(!Array.isArray(j.metadataProps))throw TypeError(".onnx.ModelProto.metadataProps: array expected");for(rt.metadataProps=[],ot=0;ot>>0,j.irVersion.high>>>0).toNumber():j.irVersion),j.producerName!=null&&j.hasOwnProperty("producerName")&&(ot.producerName=j.producerName),j.producerVersion!=null&&j.hasOwnProperty("producerVersion")&&(ot.producerVersion=j.producerVersion),j.domain!=null&&j.hasOwnProperty("domain")&&(ot.domain=j.domain),j.modelVersion!=null&&j.hasOwnProperty("modelVersion")&&(typeof j.modelVersion=="number"?ot.modelVersion=rt.longs===String?String(j.modelVersion):j.modelVersion:ot.modelVersion=rt.longs===String?it.Long.prototype.toString.call(j.modelVersion):rt.longs===Number?new it.LongBits(j.modelVersion.low>>>0,j.modelVersion.high>>>0).toNumber():j.modelVersion),j.docString!=null&&j.hasOwnProperty("docString")&&(ot.docString=j.docString),j.graph!=null&&j.hasOwnProperty("graph")&&(ot.graph=nt.onnx.GraphProto.toObject(j.graph,rt)),j.opsetImport&&j.opsetImport.length){ot.opsetImport=[];for(var lt=0;lt>>3){case 1:at.key=j.string();break;case 2:at.value=j.string();break;default:j.skipType(7<)}}return at},et.decodeDelimited=function(j){return j instanceof tt||(j=new tt(j)),this.decode(j,j.uint32())},et.verify=function(j){return typeof j!="object"||j===null?"object expected":j.key!=null&&j.hasOwnProperty("key")&&!it.isString(j.key)?"key: string expected":j.value!=null&&j.hasOwnProperty("value")&&!it.isString(j.value)?"value: string expected":null},et.fromObject=function(j){if(j instanceof nt.onnx.StringStringEntryProto)return j;var rt=new nt.onnx.StringStringEntryProto;return j.key!=null&&(rt.key=String(j.key)),j.value!=null&&(rt.value=String(j.value)),rt},et.toObject=function(j,rt){rt||(rt={});var ot={};return rt.defaults&&(ot.key="",ot.value=""),j.key!=null&&j.hasOwnProperty("key")&&(ot.key=j.key),j.value!=null&&j.hasOwnProperty("value")&&(ot.value=j.value),ot},et.prototype.toJSON=function(){return this.constructor.toObject(this,_e.util.toJSONOptions)},et}(),$.TensorAnnotation=function(){function et(j){if(this.quantParameterTensorNames=[],j)for(var rt=Object.keys(j),ot=0;ot>>3){case 1:at.tensorName=j.string();break;case 2:at.quantParameterTensorNames&&at.quantParameterTensorNames.length||(at.quantParameterTensorNames=[]),at.quantParameterTensorNames.push(nt.onnx.StringStringEntryProto.decode(j,j.uint32()));break;default:j.skipType(7<)}}return at},et.decodeDelimited=function(j){return j instanceof tt||(j=new tt(j)),this.decode(j,j.uint32())},et.verify=function(j){if(typeof j!="object"||j===null)return"object expected";if(j.tensorName!=null&&j.hasOwnProperty("tensorName")&&!it.isString(j.tensorName))return"tensorName: string expected";if(j.quantParameterTensorNames!=null&&j.hasOwnProperty("quantParameterTensorNames")){if(!Array.isArray(j.quantParameterTensorNames))return"quantParameterTensorNames: array expected";for(var rt=0;rt>>3){case 1:at.node&&at.node.length||(at.node=[]),at.node.push(nt.onnx.NodeProto.decode(j,j.uint32()));break;case 2:at.name=j.string();break;case 5:at.initializer&&at.initializer.length||(at.initializer=[]),at.initializer.push(nt.onnx.TensorProto.decode(j,j.uint32()));break;case 10:at.docString=j.string();break;case 11:at.input&&at.input.length||(at.input=[]),at.input.push(nt.onnx.ValueInfoProto.decode(j,j.uint32()));break;case 12:at.output&&at.output.length||(at.output=[]),at.output.push(nt.onnx.ValueInfoProto.decode(j,j.uint32()));break;case 13:at.valueInfo&&at.valueInfo.length||(at.valueInfo=[]),at.valueInfo.push(nt.onnx.ValueInfoProto.decode(j,j.uint32()));break;case 14:at.quantizationAnnotation&&at.quantizationAnnotation.length||(at.quantizationAnnotation=[]),at.quantizationAnnotation.push(nt.onnx.TensorAnnotation.decode(j,j.uint32()));break;default:j.skipType(7<)}}return at},et.decodeDelimited=function(j){return j instanceof tt||(j=new tt(j)),this.decode(j,j.uint32())},et.verify=function(j){if(typeof j!="object"||j===null)return"object expected";if(j.node!=null&&j.hasOwnProperty("node")){if(!Array.isArray(j.node))return"node: array expected";for(var rt=0;rt>>3){case 1:if(at.dims&&at.dims.length||(at.dims=[]),(7<)==2)for(var ut=j.uint32()+j.pos;j.pos>>0,j.dims[ot].high>>>0).toNumber())}if(j.dataType!=null&&(rt.dataType=0|j.dataType),j.segment!=null){if(typeof j.segment!="object")throw TypeError(".onnx.TensorProto.segment: object expected");rt.segment=nt.onnx.TensorProto.Segment.fromObject(j.segment)}if(j.floatData){if(!Array.isArray(j.floatData))throw TypeError(".onnx.TensorProto.floatData: array expected");for(rt.floatData=[],ot=0;ot>>0,j.int64Data[ot].high>>>0).toNumber())}if(j.name!=null&&(rt.name=String(j.name)),j.docString!=null&&(rt.docString=String(j.docString)),j.rawData!=null&&(typeof j.rawData=="string"?it.base64.decode(j.rawData,rt.rawData=it.newBuffer(it.base64.length(j.rawData)),0):j.rawData.length&&(rt.rawData=j.rawData)),j.externalData){if(!Array.isArray(j.externalData))throw TypeError(".onnx.TensorProto.externalData: array expected");for(rt.externalData=[],ot=0;ot>>0,j.uint64Data[ot].high>>>0).toNumber(!0))}return rt},et.toObject=function(j,rt){rt||(rt={});var ot={};if((rt.arrays||rt.defaults)&&(ot.dims=[],ot.floatData=[],ot.int32Data=[],ot.stringData=[],ot.int64Data=[],ot.doubleData=[],ot.uint64Data=[],ot.externalData=[]),rt.defaults&&(ot.dataType=0,ot.segment=null,ot.name="",rt.bytes===String?ot.rawData="":(ot.rawData=[],rt.bytes!==Array&&(ot.rawData=it.newBuffer(ot.rawData))),ot.docString="",ot.dataLocation=rt.enums===String?"DEFAULT":0),j.dims&&j.dims.length){ot.dims=[];for(var at=0;at>>0,j.dims[at].high>>>0).toNumber():j.dims[at]}if(j.dataType!=null&&j.hasOwnProperty("dataType")&&(ot.dataType=j.dataType),j.segment!=null&&j.hasOwnProperty("segment")&&(ot.segment=nt.onnx.TensorProto.Segment.toObject(j.segment,rt)),j.floatData&&j.floatData.length)for(ot.floatData=[],at=0;at>>0,j.int64Data[at].high>>>0).toNumber():j.int64Data[at];if(j.name!=null&&j.hasOwnProperty("name")&&(ot.name=j.name),j.rawData!=null&&j.hasOwnProperty("rawData")&&(ot.rawData=rt.bytes===String?it.base64.encode(j.rawData,0,j.rawData.length):rt.bytes===Array?Array.prototype.slice.call(j.rawData):j.rawData),j.doubleData&&j.doubleData.length)for(ot.doubleData=[],at=0;at>>0,j.uint64Data[at].high>>>0).toNumber(!0):j.uint64Data[at];if(j.docString!=null&&j.hasOwnProperty("docString")&&(ot.docString=j.docString),j.externalData&&j.externalData.length)for(ot.externalData=[],at=0;at>>3){case 1:lt.begin=rt.int64();break;case 2:lt.end=rt.int64();break;default:rt.skipType(7&ut)}}return lt},j.decodeDelimited=function(rt){return rt instanceof tt||(rt=new tt(rt)),this.decode(rt,rt.uint32())},j.verify=function(rt){return typeof rt!="object"||rt===null?"object expected":rt.begin!=null&&rt.hasOwnProperty("begin")&&!(it.isInteger(rt.begin)||rt.begin&&it.isInteger(rt.begin.low)&&it.isInteger(rt.begin.high))?"begin: integer|Long expected":rt.end!=null&&rt.hasOwnProperty("end")&&!(it.isInteger(rt.end)||rt.end&&it.isInteger(rt.end.low)&&it.isInteger(rt.end.high))?"end: integer|Long expected":null},j.fromObject=function(rt){if(rt instanceof nt.onnx.TensorProto.Segment)return rt;var ot=new nt.onnx.TensorProto.Segment;return rt.begin!=null&&(it.Long?(ot.begin=it.Long.fromValue(rt.begin)).unsigned=!1:typeof rt.begin=="string"?ot.begin=parseInt(rt.begin,10):typeof rt.begin=="number"?ot.begin=rt.begin:typeof rt.begin=="object"&&(ot.begin=new it.LongBits(rt.begin.low>>>0,rt.begin.high>>>0).toNumber())),rt.end!=null&&(it.Long?(ot.end=it.Long.fromValue(rt.end)).unsigned=!1:typeof rt.end=="string"?ot.end=parseInt(rt.end,10):typeof rt.end=="number"?ot.end=rt.end:typeof rt.end=="object"&&(ot.end=new it.LongBits(rt.end.low>>>0,rt.end.high>>>0).toNumber())),ot},j.toObject=function(rt,ot){ot||(ot={});var at={};if(ot.defaults){if(it.Long){var lt=new it.Long(0,0,!1);at.begin=ot.longs===String?lt.toString():ot.longs===Number?lt.toNumber():lt}else at.begin=ot.longs===String?"0":0;it.Long?(lt=new it.Long(0,0,!1),at.end=ot.longs===String?lt.toString():ot.longs===Number?lt.toNumber():lt):at.end=ot.longs===String?"0":0}return rt.begin!=null&&rt.hasOwnProperty("begin")&&(typeof rt.begin=="number"?at.begin=ot.longs===String?String(rt.begin):rt.begin:at.begin=ot.longs===String?it.Long.prototype.toString.call(rt.begin):ot.longs===Number?new it.LongBits(rt.begin.low>>>0,rt.begin.high>>>0).toNumber():rt.begin),rt.end!=null&&rt.hasOwnProperty("end")&&(typeof rt.end=="number"?at.end=ot.longs===String?String(rt.end):rt.end:at.end=ot.longs===String?it.Long.prototype.toString.call(rt.end):ot.longs===Number?new it.LongBits(rt.end.low>>>0,rt.end.high>>>0).toNumber():rt.end),at},j.prototype.toJSON=function(){return this.constructor.toObject(this,_e.util.toJSONOptions)},j}(),et.DataLocation=function(){var j={},rt=Object.create(j);return rt[j[0]="DEFAULT"]=0,rt[j[1]="EXTERNAL"]=1,rt}(),et}(),$.TensorShapeProto=function(){function et(j){if(this.dim=[],j)for(var rt=Object.keys(j),ot=0;ot>>3==1?(at.dim&&at.dim.length||(at.dim=[]),at.dim.push(nt.onnx.TensorShapeProto.Dimension.decode(j,j.uint32()))):j.skipType(7<)}return at},et.decodeDelimited=function(j){return j instanceof tt||(j=new tt(j)),this.decode(j,j.uint32())},et.verify=function(j){if(typeof j!="object"||j===null)return"object expected";if(j.dim!=null&&j.hasOwnProperty("dim")){if(!Array.isArray(j.dim))return"dim: array expected";for(var rt=0;rt>>3){case 1:ut.dimValue=ot.int64();break;case 2:ut.dimParam=ot.string();break;case 3:ut.denotation=ot.string();break;default:ot.skipType(7&ct)}}return ut},j.decodeDelimited=function(ot){return ot instanceof tt||(ot=new tt(ot)),this.decode(ot,ot.uint32())},j.verify=function(ot){if(typeof ot!="object"||ot===null)return"object expected";var at={};if(ot.dimValue!=null&&ot.hasOwnProperty("dimValue")&&(at.value=1,!(it.isInteger(ot.dimValue)||ot.dimValue&&it.isInteger(ot.dimValue.low)&&it.isInteger(ot.dimValue.high))))return"dimValue: integer|Long expected";if(ot.dimParam!=null&&ot.hasOwnProperty("dimParam")){if(at.value===1)return"value: multiple values";if(at.value=1,!it.isString(ot.dimParam))return"dimParam: string expected"}return ot.denotation!=null&&ot.hasOwnProperty("denotation")&&!it.isString(ot.denotation)?"denotation: string expected":null},j.fromObject=function(ot){if(ot instanceof nt.onnx.TensorShapeProto.Dimension)return ot;var at=new nt.onnx.TensorShapeProto.Dimension;return ot.dimValue!=null&&(it.Long?(at.dimValue=it.Long.fromValue(ot.dimValue)).unsigned=!1:typeof ot.dimValue=="string"?at.dimValue=parseInt(ot.dimValue,10):typeof ot.dimValue=="number"?at.dimValue=ot.dimValue:typeof ot.dimValue=="object"&&(at.dimValue=new it.LongBits(ot.dimValue.low>>>0,ot.dimValue.high>>>0).toNumber())),ot.dimParam!=null&&(at.dimParam=String(ot.dimParam)),ot.denotation!=null&&(at.denotation=String(ot.denotation)),at},j.toObject=function(ot,at){at||(at={});var lt={};return at.defaults&&(lt.denotation=""),ot.dimValue!=null&&ot.hasOwnProperty("dimValue")&&(typeof ot.dimValue=="number"?lt.dimValue=at.longs===String?String(ot.dimValue):ot.dimValue:lt.dimValue=at.longs===String?it.Long.prototype.toString.call(ot.dimValue):at.longs===Number?new it.LongBits(ot.dimValue.low>>>0,ot.dimValue.high>>>0).toNumber():ot.dimValue,at.oneofs&&(lt.value="dimValue")),ot.dimParam!=null&&ot.hasOwnProperty("dimParam")&&(lt.dimParam=ot.dimParam,at.oneofs&&(lt.value="dimParam")),ot.denotation!=null&&ot.hasOwnProperty("denotation")&&(lt.denotation=ot.denotation),lt},j.prototype.toJSON=function(){return this.constructor.toObject(this,_e.util.toJSONOptions)},j}(),et}(),$.TypeProto=function(){function et(rt){if(rt)for(var ot=Object.keys(rt),at=0;at>>3){case 1:lt.tensorType=nt.onnx.TypeProto.Tensor.decode(rt,rt.uint32());break;case 6:lt.denotation=rt.string();break;default:rt.skipType(7&ut)}}return lt},et.decodeDelimited=function(rt){return rt instanceof tt||(rt=new tt(rt)),this.decode(rt,rt.uint32())},et.verify=function(rt){if(typeof rt!="object"||rt===null)return"object expected";if(rt.tensorType!=null&&rt.hasOwnProperty("tensorType")){var ot=nt.onnx.TypeProto.Tensor.verify(rt.tensorType);if(ot)return"tensorType."+ot}return rt.denotation!=null&&rt.hasOwnProperty("denotation")&&!it.isString(rt.denotation)?"denotation: string expected":null},et.fromObject=function(rt){if(rt instanceof nt.onnx.TypeProto)return rt;var ot=new nt.onnx.TypeProto;if(rt.tensorType!=null){if(typeof rt.tensorType!="object")throw TypeError(".onnx.TypeProto.tensorType: object expected");ot.tensorType=nt.onnx.TypeProto.Tensor.fromObject(rt.tensorType)}return rt.denotation!=null&&(ot.denotation=String(rt.denotation)),ot},et.toObject=function(rt,ot){ot||(ot={});var at={};return ot.defaults&&(at.denotation=""),rt.tensorType!=null&&rt.hasOwnProperty("tensorType")&&(at.tensorType=nt.onnx.TypeProto.Tensor.toObject(rt.tensorType,ot),ot.oneofs&&(at.value="tensorType")),rt.denotation!=null&&rt.hasOwnProperty("denotation")&&(at.denotation=rt.denotation),at},et.prototype.toJSON=function(){return this.constructor.toObject(this,_e.util.toJSONOptions)},et.Tensor=function(){function rt(ot){if(ot)for(var at=Object.keys(ot),lt=0;lt>>3){case 1:ut.elemType=ot.int32();break;case 2:ut.shape=nt.onnx.TensorShapeProto.decode(ot,ot.uint32());break;default:ot.skipType(7&ct)}}return ut},rt.decodeDelimited=function(ot){return ot instanceof tt||(ot=new tt(ot)),this.decode(ot,ot.uint32())},rt.verify=function(ot){if(typeof ot!="object"||ot===null)return"object expected";if(ot.elemType!=null&&ot.hasOwnProperty("elemType")&&!it.isInteger(ot.elemType))return"elemType: integer expected";if(ot.shape!=null&&ot.hasOwnProperty("shape")){var at=nt.onnx.TensorShapeProto.verify(ot.shape);if(at)return"shape."+at}return null},rt.fromObject=function(ot){if(ot instanceof nt.onnx.TypeProto.Tensor)return ot;var at=new nt.onnx.TypeProto.Tensor;if(ot.elemType!=null&&(at.elemType=0|ot.elemType),ot.shape!=null){if(typeof ot.shape!="object")throw TypeError(".onnx.TypeProto.Tensor.shape: object expected");at.shape=nt.onnx.TensorShapeProto.fromObject(ot.shape)}return at},rt.toObject=function(ot,at){at||(at={});var lt={};return at.defaults&&(lt.elemType=0,lt.shape=null),ot.elemType!=null&&ot.hasOwnProperty("elemType")&&(lt.elemType=ot.elemType),ot.shape!=null&&ot.hasOwnProperty("shape")&&(lt.shape=nt.onnx.TensorShapeProto.toObject(ot.shape,at)),lt},rt.prototype.toJSON=function(){return this.constructor.toObject(this,_e.util.toJSONOptions)},rt}(),et}(),$.OperatorSetIdProto=function(){function et(j){if(j)for(var rt=Object.keys(j),ot=0;ot>>3){case 1:at.domain=j.string();break;case 2:at.version=j.int64();break;default:j.skipType(7<)}}return at},et.decodeDelimited=function(j){return j instanceof tt||(j=new tt(j)),this.decode(j,j.uint32())},et.verify=function(j){return typeof j!="object"||j===null?"object expected":j.domain!=null&&j.hasOwnProperty("domain")&&!it.isString(j.domain)?"domain: string expected":j.version!=null&&j.hasOwnProperty("version")&&!(it.isInteger(j.version)||j.version&&it.isInteger(j.version.low)&&it.isInteger(j.version.high))?"version: integer|Long expected":null},et.fromObject=function(j){if(j instanceof nt.onnx.OperatorSetIdProto)return j;var rt=new nt.onnx.OperatorSetIdProto;return j.domain!=null&&(rt.domain=String(j.domain)),j.version!=null&&(it.Long?(rt.version=it.Long.fromValue(j.version)).unsigned=!1:typeof j.version=="string"?rt.version=parseInt(j.version,10):typeof j.version=="number"?rt.version=j.version:typeof j.version=="object"&&(rt.version=new it.LongBits(j.version.low>>>0,j.version.high>>>0).toNumber())),rt},et.toObject=function(j,rt){rt||(rt={});var ot={};if(rt.defaults)if(ot.domain="",it.Long){var at=new it.Long(0,0,!1);ot.version=rt.longs===String?at.toString():rt.longs===Number?at.toNumber():at}else ot.version=rt.longs===String?"0":0;return j.domain!=null&&j.hasOwnProperty("domain")&&(ot.domain=j.domain),j.version!=null&&j.hasOwnProperty("version")&&(typeof j.version=="number"?ot.version=rt.longs===String?String(j.version):j.version:ot.version=rt.longs===String?it.Long.prototype.toString.call(j.version):rt.longs===Number?new it.LongBits(j.version.low>>>0,j.version.high>>>0).toNumber():j.version),ot},et.prototype.toJSON=function(){return this.constructor.toObject(this,_e.util.toJSONOptions)},et}(),$),i.exports=nt},2100:(i,o,s)=>{i.exports=s(9482)},9482:(i,o,s)=>{var a=o;function _(){a.util._configure(),a.Writer._configure(a.BufferWriter),a.Reader._configure(a.BufferReader)}a.build="minimal",a.Writer=s(1173),a.BufferWriter=s(3155),a.Reader=s(1408),a.BufferReader=s(593),a.util=s(9693),a.rpc=s(5994),a.roots=s(5054),a.configure=_,_()},1408:(i,o,s)=>{i.exports=st;var a,_=s(9693),$=_.LongBits,_e=_.utf8;function tt(at,lt){return RangeError("index out of range: "+at.pos+" + "+(lt||1)+" > "+at.len)}function st(at){this.buf=at,this.pos=0,this.len=at.length}var it,nt=typeof Uint8Array<"u"?function(at){if(at instanceof Uint8Array||Array.isArray(at))return new st(at);throw Error("illegal buffer")}:function(at){if(Array.isArray(at))return new st(at);throw Error("illegal buffer")},et=function(){return _.Buffer?function(at){return(st.create=function(lt){return _.Buffer.isBuffer(lt)?new a(lt):nt(lt)})(at)}:nt};function j(){var at=new $(0,0),lt=0;if(!(this.len-this.pos>4)){for(;lt<3;++lt){if(this.pos>=this.len)throw tt(this);if(at.lo=(at.lo|(127&this.buf[this.pos])<<7*lt)>>>0,this.buf[this.pos++]<128)return at}return at.lo=(at.lo|(127&this.buf[this.pos++])<<7*lt)>>>0,at}for(;lt<4;++lt)if(at.lo=(at.lo|(127&this.buf[this.pos])<<7*lt)>>>0,this.buf[this.pos++]<128)return at;if(at.lo=(at.lo|(127&this.buf[this.pos])<<28)>>>0,at.hi=(at.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return at;if(lt=0,this.len-this.pos>4){for(;lt<5;++lt)if(at.hi=(at.hi|(127&this.buf[this.pos])<<7*lt+3)>>>0,this.buf[this.pos++]<128)return at}else for(;lt<5;++lt){if(this.pos>=this.len)throw tt(this);if(at.hi=(at.hi|(127&this.buf[this.pos])<<7*lt+3)>>>0,this.buf[this.pos++]<128)return at}throw Error("invalid varint encoding")}function rt(at,lt){return(at[lt-4]|at[lt-3]<<8|at[lt-2]<<16|at[lt-1]<<24)>>>0}function ot(){if(this.pos+8>this.len)throw tt(this,8);return new $(rt(this.buf,this.pos+=4),rt(this.buf,this.pos+=4))}st.create=et(),st.prototype._slice=_.Array.prototype.subarray||_.Array.prototype.slice,st.prototype.uint32=(it=4294967295,function(){if(it=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128||(it=(it|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)||(it=(it|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)||(it=(it|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)||(it=(it|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128))return it;if((this.pos+=5)>this.len)throw this.pos=this.len,tt(this,10);return it}),st.prototype.int32=function(){return 0|this.uint32()},st.prototype.sint32=function(){var at=this.uint32();return at>>>1^-(1&at)|0},st.prototype.bool=function(){return this.uint32()!==0},st.prototype.fixed32=function(){if(this.pos+4>this.len)throw tt(this,4);return rt(this.buf,this.pos+=4)},st.prototype.sfixed32=function(){if(this.pos+4>this.len)throw tt(this,4);return 0|rt(this.buf,this.pos+=4)},st.prototype.float=function(){if(this.pos+4>this.len)throw tt(this,4);var at=_.float.readFloatLE(this.buf,this.pos);return this.pos+=4,at},st.prototype.double=function(){if(this.pos+8>this.len)throw tt(this,4);var at=_.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,at},st.prototype.bytes=function(){var at=this.uint32(),lt=this.pos,ut=this.pos+at;if(ut>this.len)throw tt(this,at);return this.pos+=at,Array.isArray(this.buf)?this.buf.slice(lt,ut):lt===ut?new this.buf.constructor(0):this._slice.call(this.buf,lt,ut)},st.prototype.string=function(){var at=this.bytes();return _e.read(at,0,at.length)},st.prototype.skip=function(at){if(typeof at=="number"){if(this.pos+at>this.len)throw tt(this,at);this.pos+=at}else do if(this.pos>=this.len)throw tt(this);while(128&this.buf[this.pos++]);return this},st.prototype.skipType=function(at){switch(at){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(at=7&this.uint32())!=4;)this.skipType(at);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+at+" at offset "+this.pos)}return this},st._configure=function(at){a=at,st.create=et(),a._configure();var lt=_.Long?"toLong":"toNumber";_.merge(st.prototype,{int64:function(){return j.call(this)[lt](!1)},uint64:function(){return j.call(this)[lt](!0)},sint64:function(){return j.call(this).zzDecode()[lt](!1)},fixed64:function(){return ot.call(this)[lt](!0)},sfixed64:function(){return ot.call(this)[lt](!1)}})}},593:(i,o,s)=>{i.exports=$;var a=s(1408);($.prototype=Object.create(a.prototype)).constructor=$;var _=s(9693);function $(_e){a.call(this,_e)}$._configure=function(){_.Buffer&&($.prototype._slice=_.Buffer.prototype.slice)},$.prototype.string=function(){var _e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+_e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+_e,this.len))},$._configure()},5054:i=>{i.exports={}},5994:(i,o,s)=>{o.Service=s(7948)},7948:(i,o,s)=>{i.exports=_;var a=s(9693);function _($,_e,tt){if(typeof $!="function")throw TypeError("rpcImpl must be a function");a.EventEmitter.call(this),this.rpcImpl=$,this.requestDelimited=!!_e,this.responseDelimited=!!tt}(_.prototype=Object.create(a.EventEmitter.prototype)).constructor=_,_.prototype.rpcCall=function $(_e,tt,st,it,nt){if(!it)throw TypeError("request must be specified");var et=this;if(!nt)return a.asPromise($,et,_e,tt,st,it);if(et.rpcImpl)try{return et.rpcImpl(_e,tt[et.requestDelimited?"encodeDelimited":"encode"](it).finish(),function(j,rt){if(j)return et.emit("error",j,_e),nt(j);if(rt!==null){if(!(rt instanceof st))try{rt=st[et.responseDelimited?"decodeDelimited":"decode"](rt)}catch(ot){return et.emit("error",ot,_e),nt(ot)}return et.emit("data",rt,_e),nt(null,rt)}et.end(!0)})}catch(j){return et.emit("error",j,_e),void setTimeout(function(){nt(j)},0)}else setTimeout(function(){nt(Error("already ended"))},0)},_.prototype.end=function($){return this.rpcImpl&&($||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},1945:(i,o,s)=>{i.exports=_;var a=s(9693);function _(st,it){this.lo=st>>>0,this.hi=it>>>0}var $=_.zero=new _(0,0);$.toNumber=function(){return 0},$.zzEncode=$.zzDecode=function(){return this},$.length=function(){return 1};var _e=_.zeroHash="\0\0\0\0\0\0\0\0";_.fromNumber=function(st){if(st===0)return $;var it=st<0;it&&(st=-st);var nt=st>>>0,et=(st-nt)/4294967296>>>0;return it&&(et=~et>>>0,nt=~nt>>>0,++nt>4294967295&&(nt=0,++et>4294967295&&(et=0))),new _(nt,et)},_.from=function(st){if(typeof st=="number")return _.fromNumber(st);if(a.isString(st)){if(!a.Long)return _.fromNumber(parseInt(st,10));st=a.Long.fromString(st)}return st.low||st.high?new _(st.low>>>0,st.high>>>0):$},_.prototype.toNumber=function(st){if(!st&&this.hi>>>31){var it=1+~this.lo>>>0,nt=~this.hi>>>0;return it||(nt=nt+1>>>0),-(it+4294967296*nt)}return this.lo+4294967296*this.hi},_.prototype.toLong=function(st){return a.Long?new a.Long(0|this.lo,0|this.hi,!!st):{low:0|this.lo,high:0|this.hi,unsigned:!!st}};var tt=String.prototype.charCodeAt;_.fromHash=function(st){return st===_e?$:new _((tt.call(st,0)|tt.call(st,1)<<8|tt.call(st,2)<<16|tt.call(st,3)<<24)>>>0,(tt.call(st,4)|tt.call(st,5)<<8|tt.call(st,6)<<16|tt.call(st,7)<<24)>>>0)},_.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},_.prototype.zzEncode=function(){var st=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^st)>>>0,this.lo=(this.lo<<1^st)>>>0,this},_.prototype.zzDecode=function(){var st=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^st)>>>0,this.hi=(this.hi>>>1^st)>>>0,this},_.prototype.length=function(){var st=this.lo,it=(this.lo>>>28|this.hi<<4)>>>0,nt=this.hi>>>24;return nt===0?it===0?st<16384?st<128?1:2:st<2097152?3:4:it<16384?it<128?5:6:it<2097152?7:8:nt<128?9:10}},9693:function(i,o,s){var a=o;function _(_e,tt,st){for(var it=Object.keys(tt),nt=0;nt0)},a.Buffer=function(){try{var _e=a.inquire("buffer").Buffer;return _e.prototype.utf8Write?_e:null}catch{return null}}(),a._Buffer_from=null,a._Buffer_allocUnsafe=null,a.newBuffer=function(_e){return typeof _e=="number"?a.Buffer?a._Buffer_allocUnsafe(_e):new a.Array(_e):a.Buffer?a._Buffer_from(_e):typeof Uint8Array>"u"?_e:new Uint8Array(_e)},a.Array=typeof Uint8Array<"u"?Uint8Array:Array,a.Long=a.global.dcodeIO&&a.global.dcodeIO.Long||a.global.Long||a.inquire("long"),a.key2Re=/^true|false|0|1$/,a.key32Re=/^-?(?:0|[1-9][0-9]*)$/,a.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,a.longToHash=function(_e){return _e?a.LongBits.from(_e).toHash():a.LongBits.zeroHash},a.longFromHash=function(_e,tt){var st=a.LongBits.fromHash(_e);return a.Long?a.Long.fromBits(st.lo,st.hi,tt):st.toNumber(!!tt)},a.merge=_,a.lcFirst=function(_e){return _e.charAt(0).toLowerCase()+_e.substring(1)},a.newError=$,a.ProtocolError=$("ProtocolError"),a.oneOfGetter=function(_e){for(var tt={},st=0;st<_e.length;++st)tt[_e[st]]=1;return function(){for(var it=Object.keys(this),nt=it.length-1;nt>-1;--nt)if(tt[it[nt]]===1&&this[it[nt]]!==void 0&&this[it[nt]]!==null)return it[nt]}},a.oneOfSetter=function(_e){return function(tt){for(var st=0;st<_e.length;++st)_e[st]!==tt&&delete this[_e[st]]}},a.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},a._configure=function(){var _e=a.Buffer;_e?(a._Buffer_from=_e.from!==Uint8Array.from&&_e.from||function(tt,st){return new _e(tt,st)},a._Buffer_allocUnsafe=_e.allocUnsafe||function(tt){return new _e(tt)}):a._Buffer_from=a._Buffer_allocUnsafe=null}},1173:(i,o,s)=>{i.exports=et;var a,_=s(9693),$=_.LongBits,_e=_.base64,tt=_.utf8;function st(ct,dt,ft){this.fn=ct,this.len=dt,this.next=void 0,this.val=ft}function it(){}function nt(ct){this.head=ct.head,this.tail=ct.tail,this.len=ct.len,this.next=ct.states}function et(){this.len=0,this.head=new st(it,0,0),this.tail=this.head,this.states=null}var j=function(){return _.Buffer?function(){return(et.create=function(){return new a})()}:function(){return new et}};function rt(ct,dt,ft){dt[ft]=255&ct}function ot(ct,dt){this.len=ct,this.next=void 0,this.val=dt}function at(ct,dt,ft){for(;ct.hi;)dt[ft++]=127&ct.lo|128,ct.lo=(ct.lo>>>7|ct.hi<<25)>>>0,ct.hi>>>=7;for(;ct.lo>127;)dt[ft++]=127&ct.lo|128,ct.lo=ct.lo>>>7;dt[ft++]=ct.lo}function lt(ct,dt,ft){dt[ft]=255&ct,dt[ft+1]=ct>>>8&255,dt[ft+2]=ct>>>16&255,dt[ft+3]=ct>>>24}et.create=j(),et.alloc=function(ct){return new _.Array(ct)},_.Array!==Array&&(et.alloc=_.pool(et.alloc,_.Array.prototype.subarray)),et.prototype._push=function(ct,dt,ft){return this.tail=this.tail.next=new st(ct,dt,ft),this.len+=dt,this},ot.prototype=Object.create(st.prototype),ot.prototype.fn=function(ct,dt,ft){for(;ct>127;)dt[ft++]=127&ct|128,ct>>>=7;dt[ft]=ct},et.prototype.uint32=function(ct){return this.len+=(this.tail=this.tail.next=new ot((ct>>>=0)<128?1:ct<16384?2:ct<2097152?3:ct<268435456?4:5,ct)).len,this},et.prototype.int32=function(ct){return ct<0?this._push(at,10,$.fromNumber(ct)):this.uint32(ct)},et.prototype.sint32=function(ct){return this.uint32((ct<<1^ct>>31)>>>0)},et.prototype.uint64=function(ct){var dt=$.from(ct);return this._push(at,dt.length(),dt)},et.prototype.int64=et.prototype.uint64,et.prototype.sint64=function(ct){var dt=$.from(ct).zzEncode();return this._push(at,dt.length(),dt)},et.prototype.bool=function(ct){return this._push(rt,1,ct?1:0)},et.prototype.fixed32=function(ct){return this._push(lt,4,ct>>>0)},et.prototype.sfixed32=et.prototype.fixed32,et.prototype.fixed64=function(ct){var dt=$.from(ct);return this._push(lt,4,dt.lo)._push(lt,4,dt.hi)},et.prototype.sfixed64=et.prototype.fixed64,et.prototype.float=function(ct){return this._push(_.float.writeFloatLE,4,ct)},et.prototype.double=function(ct){return this._push(_.float.writeDoubleLE,8,ct)};var ut=_.Array.prototype.set?function(ct,dt,ft){dt.set(ct,ft)}:function(ct,dt,ft){for(var ht=0;ht>>0;if(!dt)return this._push(rt,1,0);if(_.isString(ct)){var ft=et.alloc(dt=_e.length(ct));_e.decode(ct,ft,0),ct=ft}return this.uint32(dt)._push(ut,dt,ct)},et.prototype.string=function(ct){var dt=tt.length(ct);return dt?this.uint32(dt)._push(tt.write,dt,ct):this._push(rt,1,0)},et.prototype.fork=function(){return this.states=new nt(this),this.head=this.tail=new st(it,0,0),this.len=0,this},et.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new st(it,0,0),this.len=0),this},et.prototype.ldelim=function(){var ct=this.head,dt=this.tail,ft=this.len;return this.reset().uint32(ft),ft&&(this.tail.next=ct.next,this.tail=dt,this.len+=ft),this},et.prototype.finish=function(){for(var ct=this.head.next,dt=this.constructor.alloc(this.len),ft=0;ct;)ct.fn(ct.val,dt,ft),ft+=ct.len,ct=ct.next;return dt},et._configure=function(ct){a=ct,et.create=j(),a._configure()}},3155:(i,o,s)=>{i.exports=$;var a=s(1173);($.prototype=Object.create(a.prototype)).constructor=$;var _=s(9693);function $(){a.call(this)}function _e(tt,st,it){tt.length<40?_.utf8.write(tt,st,it):st.utf8Write?st.utf8Write(tt,it):st.write(tt,it)}$._configure=function(){$.alloc=_._Buffer_allocUnsafe,$.writeBytesBuffer=_.Buffer&&_.Buffer.prototype instanceof Uint8Array&&_.Buffer.prototype.set.name==="set"?function(tt,st,it){st.set(tt,it)}:function(tt,st,it){if(tt.copy)tt.copy(st,it,0,tt.length);else for(var nt=0;nt>>0;return this.uint32(st),st&&this._push($.writeBytesBuffer,st,tt),this},$.prototype.string=function(tt){var st=_.Buffer.byteLength(tt);return this.uint32(st),st&&this._push(_e,st,tt),this},$._configure()},7714:(i,o,s)=>{o.R=void 0;const a=s(6919),_=s(7448);o.R=new class{async init(){}async createSessionHandler($,_e){const tt=new a.Session(_e);return await tt.loadModel($),new _.OnnxjsSessionHandler(tt)}}},4200:(i,o,s)=>{o.c8=o.rX=void 0;const a=s(1670),_=s(5381),$=s(2157),_e=s(2306);o.rX=()=>{if((typeof a.env.wasm.initTimeout!="number"||a.env.wasm.initTimeout<0)&&(a.env.wasm.initTimeout=0),typeof a.env.wasm.simd!="boolean"&&(a.env.wasm.simd=!0),typeof a.env.wasm.proxy!="boolean"&&(a.env.wasm.proxy=!1),typeof a.env.wasm.numThreads!="number"||!Number.isInteger(a.env.wasm.numThreads)||a.env.wasm.numThreads<=0){const tt=typeof navigator>"u"?(0,_.cpus)().length:navigator.hardwareConcurrency;a.env.wasm.numThreads=Math.min(4,Math.ceil((tt||1)/2))}},o.c8=new class{async init(){(0,o.rX)(),await(0,$.initWasm)()}async createSessionHandler(tt,st){const it=new _e.OnnxruntimeWebAssemblySessionHandler;return await it.loadModel(tt,st),Promise.resolve(it)}}},6018:function(i,o,s){var a=this&&this.__createBinding||(Object.create?function(_e,tt,st,it){it===void 0&&(it=st);var nt=Object.getOwnPropertyDescriptor(tt,st);nt&&!("get"in nt?!tt.__esModule:nt.writable||nt.configurable)||(nt={enumerable:!0,get:function(){return tt[st]}}),Object.defineProperty(_e,it,nt)}:function(_e,tt,st,it){it===void 0&&(it=st),_e[it]=tt[st]}),_=this&&this.__exportStar||function(_e,tt){for(var st in _e)st==="default"||Object.prototype.hasOwnProperty.call(tt,st)||a(tt,_e,st)};Object.defineProperty(o,"__esModule",{value:!0}),_(s(1670),o);const $=s(1670);{const _e=s(7714).R;(0,$.registerBackend)("webgl",_e,-10)}{const _e=s(4200).c8;(0,$.registerBackend)("cpu",_e,10),(0,$.registerBackend)("wasm",_e,10),(0,$.registerBackend)("xnnpack",_e,9)}},246:(i,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createAttributeWithCacheKey=void 0;class s{constructor(_){Object.assign(this,_)}get cacheKey(){return this._cacheKey||(this._cacheKey=Object.getOwnPropertyNames(this).sort().map(_=>`${this[_]}`).join(";")),this._cacheKey}}o.createAttributeWithCacheKey=a=>new s(a)},7778:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Attribute=void 0;const a=s(1446),_=s(9395),$=s(9162),_e=s(2517);var tt=_.onnxruntime.experimental.fbs;class st{constructor(nt){if(this._attributes=new Map,nt!=null){for(const et of nt)et instanceof a.onnx.AttributeProto?this._attributes.set(et.name,[st.getValue(et),st.getType(et)]):et instanceof tt.Attribute&&this._attributes.set(et.name(),[st.getValue(et),st.getType(et)]);if(this._attributes.size$.Tensor.fromProto(rt));if(nt instanceof tt.Attribute)return j.map(rt=>$.Tensor.fromOrtTensor(rt))}if(et===a.onnx.AttributeProto.AttributeType.STRING&&nt instanceof a.onnx.AttributeProto){const rt=j;return(0,_e.decodeUtf8String)(rt)}return et===a.onnx.AttributeProto.AttributeType.STRINGS&&nt instanceof a.onnx.AttributeProto?j.map(_e.decodeUtf8String):j}static getValueNoCheck(nt){return nt instanceof a.onnx.AttributeProto?this.getValueNoCheckFromOnnxFormat(nt):this.getValueNoCheckFromOrtFormat(nt)}static getValueNoCheckFromOnnxFormat(nt){switch(nt.type){case a.onnx.AttributeProto.AttributeType.FLOAT:return nt.f;case a.onnx.AttributeProto.AttributeType.INT:return nt.i;case a.onnx.AttributeProto.AttributeType.STRING:return nt.s;case a.onnx.AttributeProto.AttributeType.TENSOR:return nt.t;case a.onnx.AttributeProto.AttributeType.GRAPH:return nt.g;case a.onnx.AttributeProto.AttributeType.FLOATS:return nt.floats;case a.onnx.AttributeProto.AttributeType.INTS:return nt.ints;case a.onnx.AttributeProto.AttributeType.STRINGS:return nt.strings;case a.onnx.AttributeProto.AttributeType.TENSORS:return nt.tensors;case a.onnx.AttributeProto.AttributeType.GRAPHS:return nt.graphs;default:throw new Error(`unsupported attribute type: ${a.onnx.AttributeProto.AttributeType[nt.type]}`)}}static getValueNoCheckFromOrtFormat(nt){switch(nt.type()){case tt.AttributeType.FLOAT:return nt.f();case tt.AttributeType.INT:return nt.i();case tt.AttributeType.STRING:return nt.s();case tt.AttributeType.TENSOR:return nt.t();case tt.AttributeType.GRAPH:return nt.g();case tt.AttributeType.FLOATS:return nt.floatsArray();case tt.AttributeType.INTS:{const et=[];for(let j=0;j{Object.defineProperty(o,"__esModule",{value:!0}),o.resolveBackend=o.backend=void 0;const a=s(5038),_=new Map;async function $(_e){const tt=o.backend;if(tt[_e]!==void 0&&function(st){const it=st;return"initialize"in it&&typeof it.initialize=="function"&&"createSessionHandler"in it&&typeof it.createSessionHandler=="function"&&"dispose"in it&&typeof it.dispose=="function"}(tt[_e])){const st=tt[_e];let it=st.initialize();if(typeof it=="object"&&"then"in it&&(it=await it),it)return _.set(_e,st),st}}o.backend={webgl:new a.WebGLBackend},o.resolveBackend=async function _e(tt){if(!tt)return _e(["webgl"]);{const st=typeof tt=="string"?[tt]:tt;for(const it of st){const nt=_.get(it);if(nt)return nt;const et=await $(it);if(et)return et}}throw new Error("no available backend to use")}},5038:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WebGLBackend=void 0;const a=s(1670),_=s(6231),$=s(6416),_e=s(7305);o.WebGLBackend=class{get contextId(){return a.env.webgl.contextId}set contextId(tt){a.env.webgl.contextId=tt}get matmulMaxBatchSize(){return a.env.webgl.matmulMaxBatchSize}set matmulMaxBatchSize(tt){a.env.webgl.matmulMaxBatchSize=tt}get textureCacheMode(){return a.env.webgl.textureCacheMode}set textureCacheMode(tt){a.env.webgl.textureCacheMode=tt}get pack(){return a.env.webgl.pack}set pack(tt){a.env.webgl.pack=tt}get async(){return a.env.webgl.async}set async(tt){a.env.webgl.async=tt}initialize(){try{return this.glContext=(0,_e.createWebGLContext)(this.contextId),typeof this.matmulMaxBatchSize!="number"&&(this.matmulMaxBatchSize=16),typeof this.textureCacheMode!="string"&&(this.textureCacheMode="full"),typeof this.pack!="boolean"&&(this.pack=!1),typeof this.async!="boolean"&&(this.async=!1),_.Logger.setWithEnv(a.env),_.Logger.verbose("WebGLBackend",`Created WebGLContext: ${typeof this.glContext} with matmulMaxBatchSize: ${this.matmulMaxBatchSize}; textureCacheMode: ${this.textureCacheMode}; pack: ${this.pack}; async: ${this.async}.`),!0}catch(tt){return _.Logger.warning("WebGLBackend",`Unable to initialize WebGLBackend. ${tt}`),!1}}createSessionHandler(tt){return new $.WebGLSessionHandler(this,tt)}dispose(){this.glContext.dispose()}}},5107:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CoordsGlslLib=void 0;const a=s(2517),_=s(8520),$=s(5060),_e=s(7859),tt=s(9390);class st extends _.GlslLib{constructor(nt){super(nt)}getFunctions(){return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.offsetToCoords()),this.coordsToOffset()),this.toVec()),this.valueFrom()),this.getCommonUtilFuncs()),this.getInputsSamplingSnippets()),this.getOutputSamplingSnippet())}getCustomTypes(){return{}}offsetToCoords(){return{offsetToCoords:new _.GlslLibRoutine(` + vec2 offsetToCoords(int offset, int width, int height) { + int t = offset / width; + int s = offset - t*width; + vec2 coords = (vec2(s,t) + vec2(0.5,0.5)) / vec2(width, height); + return coords; + } + `)}}coordsToOffset(){return{coordsToOffset:new _.GlslLibRoutine(` + int coordsToOffset(vec2 coords, int width, int height) { + float s = coords.s * float(width); + float t = coords.t * float(height); + int offset = int(t) * width + int(s); + return offset; + } + `)}}getOutputSamplingSnippet(){const nt=this.context.outputTextureLayout;return nt.isPacked?this.getPackedOutputSamplingSnippet(nt):this.getUnpackedOutputSamplingSnippet(nt)}getPackedOutputSamplingSnippet(nt){const et=nt.unpackedShape,j=[nt.width,nt.height],rt={},ot="getOutputCoords";switch(et.length){case 0:rt[ot]=this.getOutputScalarCoords();break;case 1:rt[ot]=this.getOutputPacked1DCoords(et,j);break;case 2:rt[ot]=this.getOutputPacked2DCoords(et,j);break;case 3:rt[ot]=this.getOutputPacked3DCoords(et,j);break;default:rt[ot]=this.getOutputPackedNDCoords(et,j)}const at=` + void setOutput(vec4 val) { + ${(0,$.getGlsl)(this.context.glContext.version).output} = val; + } + `;return rt.floatTextureSetRGBA=new _.GlslLibRoutine(at),rt}getUnpackedOutputSamplingSnippet(nt){const et=nt.unpackedShape,j=[nt.width,nt.height],rt={},ot="getOutputCoords";switch(et.length){case 0:rt[ot]=this.getOutputScalarCoords();break;case 1:rt[ot]=this.getOutputUnpacked1DCoords(et,j);break;case 2:rt[ot]=this.getOutputUnpacked2DCoords(et,j);break;case 3:rt[ot]=this.getOutputUnpacked3DCoords(et,j);break;case 4:rt[ot]=this.getOutputUnpacked4DCoords(et,j);break;case 5:rt[ot]=this.getOutputUnpacked5DCoords(et,j);break;case 6:rt[ot]=this.getOutputUnpacked6DCoords(et,j);break;default:throw new Error(`Unsupported output dimensionality: ${et.length}`)}const at=` + void setOutput(float val) { + ${(0,$.getGlsl)(this.context.glContext.version).output} = vec4(val, 0, 0, 0); + } + `;return rt.floatTextureSetR=new _.GlslLibRoutine(at),rt}getOutputScalarCoords(){return new _.GlslLibRoutine(` + int getOutputCoords() { + return 0; + } + `)}getOutputPacked1DCoords(nt,et){const j=et;let rt="";return j[0]===1?(rt=` + int getOutputCoords() { + return 2 * int(TexCoords.y * ${j[1]}.0); + } + `,new _.GlslLibRoutine(rt)):j[1]===1?(rt=` + int getOutputCoords() { + return 2 * int(TexCoords.x * ${j[0]}.0); + } + `,new _.GlslLibRoutine(rt)):(rt=` + int getOutputCoords() { + ivec2 resTexRC = ivec2(TexCoords.xy * + vec2(${j[0]}, ${j[1]})); + return 2 * (resTexRC.y * ${j[0]} + resTexRC.x); + } + `,new _.GlslLibRoutine(rt))}getOutputPacked2DCoords(nt,et){let j="";if(a.ArrayUtil.arraysEqual(nt,et))return j=` + ivec2 getOutputCoords() { + return 2 * ivec2(TexCoords.xy * vec2(${et[0]}, ${et[1]})); + } + `,new _.GlslLibRoutine(j);const rt=et,ot=Math.ceil(nt[1]/2);return j=` + ivec2 getOutputCoords() { + ivec2 resTexRC = ivec2(TexCoords.xy * + vec2(${rt[0]}, ${rt[1]})); + + int index = resTexRC.y * ${rt[0]} + resTexRC.x; + + // reverse r and c order for packed texture + int r = imod(index, ${ot}) * 2; + int c = 2 * (index / ${ot}); + + return ivec2(r, c); + } + `,new _.GlslLibRoutine(j)}getOutputPacked3DCoords(nt,et){const j=[et[0],et[1]],rt=Math.ceil(nt[2]/2),ot=rt*Math.ceil(nt[1]/2),at=` + ivec3 getOutputCoords() { + ivec2 resTexRC = ivec2(TexCoords.xy * + vec2(${j[0]}, ${j[1]})); + int index = resTexRC.y * ${j[0]} + resTexRC.x; + + int b = index / ${ot}; + index -= b * ${ot}; + + // reverse r and c order for packed texture + int r = imod(index, ${rt}) * 2; + int c = 2 * (index / ${rt}); + + return ivec3(b, r, c); + } + `;return new _.GlslLibRoutine(at)}getOutputPackedNDCoords(nt,et){const j=[et[0],et[1]],rt=Math.ceil(nt[nt.length-1]/2),ot=rt*Math.ceil(nt[nt.length-2]/2);let at=ot,lt="",ut="b, r, c";for(let dt=2;dt=0;--ut)ot[ut]=ot[ut+1]*nt[ut+1];const at=["r","c","d"],lt=ot.map((ut,ct)=>`int ${at[ct]} = index / ${ut}; ${ct===ot.length-1?`int ${at[ct+1]} = index - ${at[ct]} * ${ut}`:`index -= ${at[ct]} * ${ut}`};`).join("");return j=` + ivec3 getOutputCoords() { + ivec2 resTexRC = ivec2(TexCoords.xy * + vec2(${et[0]}, ${et[1]})); + int index = resTexRC.y * ${et[0]} + resTexRC.x; + ${lt} + return ivec3(r, c, d); + } + `,new _.GlslLibRoutine(j)}getOutputUnpacked4DCoords(nt,et){let j="";const rt=nt.length;let ot=null;rt<2&&(ot=[]),ot=new Array(rt-1),ot[rt-2]=nt[rt-1];for(let ut=rt-3;ut>=0;--ut)ot[ut]=ot[ut+1]*nt[ut+1];const at=["r","c","d","d2"],lt=ot.map((ut,ct)=>`int ${at[ct]} = index / ${ut}; ${ct===ot.length-1?`int ${at[ct+1]} = index - ${at[ct]} * ${ut}`:`index -= ${at[ct]} * ${ut}`};`).join("");return j=` + ivec4 getOutputCoords() { + ivec2 resTexRC = ivec2(TexCoords.xy * + vec2(${et[0]}, ${et[1]})); + int index = resTexRC.y * ${et[0]} + resTexRC.x; + ${lt} + return ivec4(r, c, d, d2); + } + `,new _.GlslLibRoutine(j)}getOutputUnpacked5DCoords(nt,et){let j="";const rt=nt.length;let ot=null;rt<2&&(ot=[]),ot=new Array(rt-1),ot[rt-2]=nt[rt-1];for(let ut=rt-3;ut>=0;--ut)ot[ut]=ot[ut+1]*nt[ut+1];const at=["r","c","d","d2","d3"],lt=ot.map((ut,ct)=>`int ${at[ct]} = index / ${ut}; ${ct===ot.length-1?`int ${at[ct+1]} = index - ${at[ct]} * ${ut}`:`index -= ${at[ct]} * ${ut}`};`).join("");return j=` + ivec5 getOutputCoords() { + ivec2 resTexRC = ivec2(TexCoords.xy * + vec2(${et[0]}, ${et[1]})); + int index = resTexRC.y * ${et[0]} + resTexRC.x; + ${lt} + return ivec5(r, c, d, d2, d3); + } + `,new _.GlslLibRoutine(j)}getOutputUnpacked6DCoords(nt,et){let j="";const rt=nt.length;let ot=null;rt<2&&(ot=[]),ot=new Array(rt-1),ot[rt-2]=nt[rt-1];for(let ut=rt-3;ut>=0;--ut)ot[ut]=ot[ut+1]*nt[ut+1];const at=["r","c","d","d2","d3","d4"],lt=ot.map((ut,ct)=>`int ${at[ct]} = index / ${ut}; ${ct===ot.length-1?`int ${at[ct+1]} = index - ${at[ct]} * ${ut}`:`index -= ${at[ct]} * ${ut}`};`).join("");return j=` + ivec6 getOutputCoords() { + ivec2 resTexRC = ivec2(TexCoords.xy * + vec2(${et[0]}, ${et[1]})); + int index = resTexRC.y * ${et[0]} + resTexRC.x; + ${lt} + return ivec6(r, c, d, d2, d3, d4); + } + `,new _.GlslLibRoutine(j)}getCommonUtilFuncs(){const nt={};let et="uvFromFlat";nt[et]=new _.GlslLibRoutine(` + vec2 uvFromFlat(int texNumR, int texNumC, int index) { + int texC = index / texNumR; + int texR = index - texC * texNumR; + // TODO: swap texR, texC order in following function so row is corresponding to u and column is corresponding to + // v. + return (vec2(texR, texC) + halfCR) / vec2(texNumR, texNumC); + } + `),et="packedUVfrom1D",nt[et]=new _.GlslLibRoutine(` + vec2 packedUVfrom1D(int texNumR, int texNumC, int index) { + int texelIndex = index / 2; + int texR = texelIndex / texNumC; + int texC = texelIndex - texR * texNumC; + return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); + } + `),et="packedUVfrom2D",nt[et]=new _.GlslLibRoutine(` + vec2 packedUVfrom2D(int texNumR, int texNumC, int texelsInLogicalRow, int row, int col) { + int texelIndex = (row / 2) * texelsInLogicalRow + (col / 2); + int texR = texelIndex / texNumC; + int texC = texelIndex - texR * texNumC; + return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); + } + `),et="packedUVfrom3D",nt[et]=new _.GlslLibRoutine(` + vec2 packedUVfrom3D(int texNumR, int texNumC, + int texelsInBatch, int texelsInLogicalRow, int b, + int row, int col) { + int index = b * texelsInBatch + (row / 2) * texelsInLogicalRow + (col / 2); + int texR = index / texNumC; + int texC = index - texR * texNumC; + return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); + } + `),et="sampleTexture";const j=(0,$.getGlsl)(this.context.glContext.version);return nt[et]=new _.GlslLibRoutine(` + float sampleTexture(sampler2D textureSampler, vec2 uv) { + return ${j.texture2D}(textureSampler, uv).r; + }`),nt}getInputsSamplingSnippets(){const nt={},et=this.context.outputTextureLayout;return this.context.programInfo.inputNames.forEach((j,rt)=>{const ot=this.context.inputTextureLayouts[rt],at=(0,tt.generateShaderFuncNameFromInputSamplerName)(j);ot.isPacked?nt[at]=this.getPackedSamplerFromInput(at,j,ot):nt[at]=this.getUnpackedSamplerFromInput(at,j,ot);const lt=(0,tt.generateShaderFuncNameFromInputSamplerNameAtOutCoords)(j);ot.unpackedShape.length<=et.unpackedShape.length&&(ot.isPacked?nt[lt]=this.getPackedSamplerAtOutputCoords(lt,ot,et,j):nt[lt]=this.getUnpackedSamplerAtOutputCoords(lt,ot,et,j))}),nt}getPackedSamplerAtOutputCoords(nt,et,j,rt){const ot=et.unpackedShape,at=j.unpackedShape,lt=rt,ut=(0,tt.generateShaderFuncNameFromInputSamplerName)(lt),ct=ot.length,dt=at.length,ft=a.BroadcastUtil.getBroadcastDims(ot,at),ht=(0,tt.getCoordsDataType)(dt),bt=dt-ct;let yt;const mt=(0,tt.getGlChannels)();yt=ct===0?"":dt<2&&ft.length>=1?"coords = 0;":ft.map(It=>`coords.${mt[It+bt]} = 0;`).join(` +`);let gt="";gt=dt<2&&ct>0?"coords":ot.map((It,Pt)=>`coords.${mt[Pt+bt]}`).join(", ");let vt="return outputValue;";const wt=a.ShapeUtil.size(ot)===1,Ct=a.ShapeUtil.size(at)===1;if(ct!==1||wt||Ct){if(wt&&!Ct)vt=dt===1?` + return vec4(outputValue.x, outputValue.x, 0., 0.); + `:` + return vec4(outputValue.x); + `;else if(ft.length){const It=ct-2,Pt=ct-1;ft.indexOf(It)>-1&&ft.indexOf(Pt)>-1?vt="return vec4(outputValue.x);":ft.indexOf(It)>-1?vt="return vec4(outputValue.x, outputValue.y, outputValue.x, outputValue.y);":ft.indexOf(Pt)>-1&&(vt="return vec4(outputValue.xx, outputValue.zz);")}}else vt=` + return vec4(outputValue.xy, outputValue.xy); + `;const kt=` + vec4 ${nt}() { + ${ht} coords = getOutputCoords(); + + int lastDim = coords.${mt[dt-1]}; + coords.${mt[dt-1]} = coords.${mt[dt-2]}; + coords.${mt[dt-2]} = lastDim; + + ${yt} + vec4 outputValue = ${ut}(${gt}); + ${vt} + } + `;return new _.GlslLibRoutine(kt,["coordinates.getOutputCoords"])}getUnpackedSamplerAtOutputCoords(nt,et,j,rt){const ot=[j.width,j.height],at=[et.width,et.height],lt=et.unpackedShape.length,ut=j.unpackedShape.length,ct=et.unpackedShape,dt=j.unpackedShape,ft=(0,tt.generateShaderFuncNameFromInputSamplerName)(rt);if(lt===ut&&a.ArrayUtil.arraysEqual(at,ot)){const Ct=` + float ${nt}() { + return sampleTexture(${rt}, TexCoords); + } + `;return new _.GlslLibRoutine(Ct,["coordinates.sampleTexture"])}const ht=(0,tt.getCoordsDataType)(ut),bt=a.BroadcastUtil.getBroadcastDims(ct,dt),yt=ut-lt;let mt;const gt=(0,tt.getGlChannels)();mt=lt===0?"":ut<2&&bt.length>=1?"coords = 0;":bt.map(Ct=>`coords.${gt[Ct+yt]} = 0;`).join(` +`);let vt="";vt=ut<2&<>0?"coords":et.unpackedShape.map((Ct,kt)=>`coords.${gt[kt+yt]}`).join(", ");const wt=` + float ${nt}() { + ${ht} coords = getOutputCoords(); + ${mt} + return ${ft}(${vt}); + } + `;return new _.GlslLibRoutine(wt,["coordinates.getOutputCoords"])}getPackedSamplerFromInput(nt,et,j){switch(j.unpackedShape.length){case 0:return this.getPackedSamplerScalar(nt,et);case 1:return this.getPackedSampler1D(nt,et,j);case 2:return this.getPackedSampler2D(nt,et,j);case 3:return this.getPackedSampler3D(nt,et,j);default:return this.getPackedSamplerND(nt,et,j)}}getUnpackedSamplerFromInput(nt,et,j){const rt=j.unpackedShape;switch(rt.length){case 0:return this.getUnpackedSamplerScalar(nt,et,j);case 1:return this.getUnpackedSampler1D(nt,et,j);case 2:return this.getUnpackedSampler2D(nt,et,j);case 3:return this.getUnpackedSampler3D(nt,et,j);case 4:return this.getUnpackedSampler4D(nt,et,j);case 5:return this.getUnpackedSampler5D(nt,et,j);case 6:return this.getUnpackedSampler6D(nt,et,j);default:throw new Error(`Unsupported dimension ${rt.length}-D`)}}getPackedSamplerScalar(nt,et){const j=` + vec4 ${nt}() { + return ${(0,$.getGlsl)(this.context.glContext.version).texture2D}(${et}, halfCR); + } + `;return new _.GlslLibRoutine(j)}getPackedSampler1D(nt,et,j){const rt=[j.width,j.height],ot=[rt[1],rt[0]],at=(0,$.getGlsl)(this.context.glContext.version),lt=`vec4 ${nt}(int index) { + vec2 uv = packedUVfrom1D( + ${ot[0]}, ${ot[1]}, index); + return ${at.texture2D}(${et}, uv); + }`;return new _.GlslLibRoutine(lt,["coordinates.packedUVfrom1D"])}getPackedSampler2D(nt,et,j){const rt=j.unpackedShape,ot=[j.width,j.height],at=(0,$.getGlsl)(this.context.glContext.version),lt=ot[0],ut=ot[1];if(ot!=null&&a.ArrayUtil.arraysEqual(rt,ot)){const ht=`vec4 ${nt}(int row, int col) { + vec2 uv = (vec2(col, row) + halfCR) / vec2(${ut}.0, ${lt}.0); + return ${at.texture2D}(${et}, uv); + }`;return new _.GlslLibRoutine(ht)}const ct=ot,dt=Math.ceil(rt[1]/2),ft=`vec4 ${nt}(int row, int col) { + vec2 uv = packedUVfrom2D(${ct[1]}, ${ct[0]}, ${dt}, row, col); + return ${at.texture2D}(${et}, uv); + }`;return new _.GlslLibRoutine(ft,["coordinates.packedUVfrom2D"])}getPackedSampler3D(nt,et,j){const rt=j.unpackedShape,ot=[j.width,j.height],at=[ot[0],ot[1]],lt=(0,$.getGlsl)(this.context.glContext.version);if(rt[0]===1){const ht=rt.slice(1),bt=[1,2],yt=(0,tt.squeezeInputShape)(rt,ht),mt=["b","row","col"],gt=JSON.parse(JSON.stringify(j));gt.unpackedShape=yt;const vt=this.getPackedSamplerFromInput(nt,et,gt),wt=`${vt.routineBody} + vec4 ${nt}(int b, int row, int col) { + return ${nt}(${(0,tt.getSqueezedParams)(mt,bt)}); + } `;return new _.GlslLibRoutine(wt,vt.dependencies)}const ut=at[0],ct=at[1],dt=Math.ceil(rt[2]/2),ft=`vec4 ${nt}(int b, int row, int col) { + vec2 uv = packedUVfrom3D( + ${ct}, ${ut}, ${dt*Math.ceil(rt[1]/2)}, ${dt}, b, row, col); + return ${lt.texture2D}(${et}, uv);}`;return new _.GlslLibRoutine(ft,["coordinates.packedUVfrom3D"])}getPackedSamplerND(nt,et,j){const rt=j.unpackedShape,ot=rt.length,at=[j.width,j.height],lt=(0,$.getGlsl)(this.context.glContext.version),ut=[at[0],at[1]],ct=ut[1],dt=ut[0],ft=Math.ceil(rt[ot-1]/2);let ht=ft*Math.ceil(rt[ot-2]/2),bt="int b, int row, int col",yt=`b * ${ht} + (row / 2) * ${ft} + (col / 2)`;for(let gt=2;gt{const rt=this.context.inputTextureLayouts[j],ot=(rt.unpackedShape.length>0?rt.unpackedShape:rt.shape).length;let at=`_${et}`;nt[at]=new _.GlslLibRoutine(this.getValueFromSingle(et,ot,rt.width,rt.height,!1),[`shapeUtils.indicesToOffset${at}`,"coordinates.offsetToCoords","fragcolor.getColorAsFloat"]),at+="_T",nt[at]=new _.GlslLibRoutine(this.getValueFromSingle(et,ot,rt.width,rt.height,!0),[`shapeUtils.indicesToOffset${at}`,"coordinates.offsetToCoords","fragcolor.getColorAsFloat"])}),nt}getValueFromSingle(nt,et,j,rt,ot){let at=`_${nt}`;return ot&&(at+="_T"),` + float ${at}(int m[${et}]) { + int offset = indicesToOffset${at}(m); + vec2 coords = offsetToCoords(offset, ${j}, ${rt}); + float value = getColorAsFloat(${(0,$.getGlsl)(this.context.glContext.version).texture2D}(${nt}, coords)); + return value; + } + `}getPackedValueFrom(nt,et,j,rt,ot){let at=`_${nt}_Pack`;return ot&&(at+="_T"),` + vec4 ${at}(int m[${et}]) { + int offset = indicesToOffset_${nt}(m); + vec2 coords = offsetToCoords(offset, ${j}, ${rt}); + return ${(0,$.getGlsl)(this.context.glContext.version).texture2D}(${nt}, coords); + } + `}}o.CoordsGlslLib=st},8520:(i,o)=>{var s;Object.defineProperty(o,"__esModule",{value:!0}),o.TopologicalSortGlslRoutines=o.GlslLibRoutineNode=o.GlslLibRoutine=o.GlslLib=o.GlslContext=o.FunctionType=void 0,(s=o.FunctionType||(o.FunctionType={}))[s.ValueBased=0]="ValueBased",s[s.Positional=1]="Positional",o.GlslContext=class{constructor(a,_,$,_e){this.glContext=a,this.programInfo=_,this.inputTextureLayouts=$,this.outputTextureLayout=_e}},o.GlslLib=class{constructor(a){this.context=a}},o.GlslLibRoutine=class{constructor(a,_){this.routineBody=a,this.dependencies=_}},o.GlslLibRoutineNode=class{constructor(a,_,$){this.name=a,this.dependencies=$||[],_&&(this.routineBody=_)}addDependency(a){a&&this.dependencies.push(a)}},o.TopologicalSortGlslRoutines=class{static returnOrderedNodes(a){if(!a||a.length===0)return[];if(a.length===1)return a;const _=new Set,$=new Set,_e=new Array;return this.createOrderedNodes(a,_,$,_e),_e}static createOrderedNodes(a,_,$,_e){for(let tt=0;tt0)for(let st=0;st{Object.defineProperty(o,"__esModule",{value:!0}),o.EncodingGlslLib=void 0;const a=s(8520);class _ extends a.GlslLib{constructor(_e){super(_e)}getFunctions(){return Object.assign(Object.assign({},this.encodeFloat32()),this.decodeFloat32())}getCustomTypes(){return{}}encodeFloat32(){return{encode:new a.GlslLibRoutine(`highp vec4 encode(highp float f) { + return vec4(f, 0.0, 0.0, 0.0); + } + `)}}decodeFloat32(){return{decode:new a.GlslLibRoutine(`highp float decode(highp vec4 rgba) { + return rgba.r; + } + `)}}encodeUint8(){const _e=_.isLittleEndian()?"rgba.rgba=rgba.abgr;":"";return{encode:new a.GlslLibRoutine(` + highp vec4 encode(highp float f) { + highp float F = abs(f); + highp float Sign = step(0.0,-f); + highp float Exponent = floor(log2(F)); + highp float Mantissa = (exp2(- Exponent) * F); + Exponent = floor(log2(F) + 127.0) + floor(log2(Mantissa)); + highp vec4 rgba; + rgba[0] = 128.0 * Sign + floor(Exponent*exp2(-1.0)); + rgba[1] = 128.0 * mod(Exponent,2.0) + mod(floor(Mantissa*128.0),128.0); + rgba[2] = floor(mod(floor(Mantissa*exp2(23.0 -8.0)),exp2(8.0))); + rgba[3] = floor(exp2(23.0)*mod(Mantissa,exp2(-15.0))); + ${_e} + rgba = rgba / 255.0; // values need to be normalized to [0,1] + return rgba; + } + `)}}decodeUint8(){const _e=_.isLittleEndian()?"rgba.rgba=rgba.abgr;":"";return{decode:new a.GlslLibRoutine(` + highp float decode(highp vec4 rgba) { + rgba = rgba * 255.0; // values need to be de-normalized from [0,1] to [0,255] + ${_e} + highp float Sign = 1.0 - step(128.0,rgba[0])*2.0; + highp float Exponent = 2.0 * mod(rgba[0],128.0) + step(128.0,rgba[1]) - 127.0; + highp float Mantissa = mod(rgba[1],128.0)*65536.0 + rgba[2]*256.0 +rgba[3] + float(0x800000); + highp float Result = Sign * exp2(Exponent) * (Mantissa * exp2(-23.0 )); + return Result; + } + `)}}static isLittleEndian(){const _e=new ArrayBuffer(4),tt=new Uint32Array(_e),st=new Uint8Array(_e);if(tt[0]=3735928559,st[0]===239)return!0;if(st[0]===222)return!1;throw new Error("unknown endianness")}}o.EncodingGlslLib=_},9894:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.FragColorGlslLib=void 0;const a=s(8520),_=s(5060);class $ extends a.GlslLib{constructor(tt){super(tt)}getFunctions(){return Object.assign(Object.assign({},this.setFragColor()),this.getColorAsFloat())}getCustomTypes(){return{}}setFragColor(){const tt=(0,_.getGlsl)(this.context.glContext.version);return{setFragColor:new a.GlslLibRoutine(` + void setFragColor(float value) { + ${tt.output} = encode(value); + } + `,["encoding.encode"])}}getColorAsFloat(){return{getColorAsFloat:new a.GlslLibRoutine(` + float getColorAsFloat(vec4 color) { + return decode(color); + } + `,["encoding.decode"])}}}o.FragColorGlslLib=$},2848:(i,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.replaceInlines=void 0;const s=/@inline[\s\n\r]+(\w+)[\s\n\r]+([0-9a-zA-Z_]+)\s*\(([^)]*)\)\s*{(([^}]|[\n\r])*)}/gm;o.replaceInlines=function(a){const _={};let $;for(;($=s.exec(a))!==null;){const _e=$[3].split(",").map(tt=>{const st=tt.trim().split(" ");return st&&st.length===2?{type:st[0],name:st[1]}:null}).filter(tt=>tt!==null);_[$[2]]={params:_e,body:$[4]}}for(const _e in _){const tt="(\\w+)?\\s+([_0-9a-zA-Z]+)\\s+=\\s+__FUNC__\\((.*)\\)\\s*;".replace("__FUNC__",_e),st=new RegExp(tt,"gm");for(;($=st.exec(a))!==null;){const it=$[1],nt=$[2],et=$[3].split(","),j=it?`${it} ${nt};`:"";let rt=_[_e].body,ot="";_[_e].params.forEach((lt,ut)=>{lt&&(ot+=`${lt.type} ${lt.name} = ${et[ut]}; +`)}),rt=`${ot} + ${rt}`,rt=rt.replace("return",`${nt} = `);const at=` + ${j} + { + ${rt} + } + `;a=a.replace($[0],at)}}return a.replace(s,"")}},8879:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.GlslPreprocessor=void 0;const a=s(8520),_=s(2848),$=s(5483),_e=s(5060);o.GlslPreprocessor=class{constructor(tt,st,it,nt){this.libs={},this.glslLibRoutineDependencyGraph={},this.context=new a.GlslContext(tt,st,it,nt),Object.keys($.glslRegistry).forEach(j=>{const rt=new $.glslRegistry[j](this.context);this.libs[j]=rt});const et=this.glslLibRoutineDependencyGraph;for(const j in this.libs){const rt=this.libs[j].getFunctions();for(const ot in rt){const at=j+"."+ot;let lt;et[at]?(lt=et[at],lt.routineBody=rt[ot].routineBody):(lt=new a.GlslLibRoutineNode(at,rt[ot].routineBody),et[at]=lt);const ut=rt[ot].dependencies;if(ut)for(let ct=0;ct{const nt=it.split(".")[1];tt.indexOf(nt)!==-1&&st.push(this.glslLibRoutineDependencyGraph[it])}),a.TopologicalSortGlslRoutines.returnOrderedNodes(st)}getUniforms(tt,st){const it=[];if(tt)for(const nt of tt)it.push(`uniform sampler2D ${nt};`);if(st)for(const nt of st)it.push(`uniform ${nt.type} ${nt.name}${nt.arrayLength?`[${nt.arrayLength}]`:""};`);return it.join(` +`)}}},5483:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.glslRegistry=void 0;const a=s(5107),_=s(7341),$=s(9894),_e=s(2655),tt=s(3891);o.glslRegistry={encoding:_.EncodingGlslLib,fragcolor:$.FragColorGlslLib,vec:tt.VecGlslLib,shapeUtils:_e.ShapeUtilsGlslLib,coordinates:a.CoordsGlslLib}},2655:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ShapeUtilsGlslLib=void 0;const a=s(8520);class _ extends a.GlslLib{constructor(_e){super(_e)}getFunctions(){return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.bcastIndex()),this.bcastMatmulIndex()),this.offsetToIndices()),this.indicesToOffset()),this.incrementIndices())}getCustomTypes(){return{}}bcastIndex(){const _e=this.context.outputTextureLayout.shape.length,tt={};return this.context.programInfo.inputNames.forEach((st,it)=>{const nt=this.context.inputTextureLayouts[it].unpackedShape;if(nt.length<=_e){const et=nt.length,j=_e-et,rt=`bcastIndices_${st}`;let ot="";for(let lt=0;lt{const nt=this.context.inputTextureLayouts[it].shape;if(!(nt.length<2||nt.length>_e)){const et=nt.length,j=_e-et,rt=`bcastMatmulIndices_${st}`;let ot="";for(let lt=0;lt{const it=this.context.inputTextureLayouts[st].shape,nt=this.context.inputTextureLayouts[st].strides,et=it.length;let j=`indicesToOffset_${tt}`;_e[j]=new a.GlslLibRoutine(_.indexToOffsetSingle(j,et,nt)),j=`indicesToOffset_${tt}_T`,_e[j]=new a.GlslLibRoutine(_.indexToOffsetSingle(j,et,nt.slice().reverse()))}),_e}static indexToOffsetSingle(_e,tt,st){let it="";for(let nt=tt-1;nt>=0;--nt)it+=` + offset += indices[${nt}] * ${st[nt]}; + `;return` + int ${_e}(int indices[${tt}]) { + int offset = 0; + ${it} + return offset; + } + `}offsetToIndices(){const _e={};return this.context.programInfo.inputNames.forEach((tt,st)=>{const it=this.context.inputTextureLayouts[st].shape,nt=this.context.inputTextureLayouts[st].strides,et=it.length;let j=`offsetToIndices_${tt}`;_e[j]=new a.GlslLibRoutine(_.offsetToIndicesSingle(j,et,nt)),j=`offsetToIndices_${tt}_T`,_e[j]=new a.GlslLibRoutine(_.offsetToIndicesSingle(j,et,nt.slice().reverse()))}),_e}static offsetToIndicesSingle(_e,tt,st){const it=[];for(let nt=0;nt{const it=this.context.inputTextureLayouts[st].shape,nt=it.length,et=`incrementIndices_${tt}`;let j="";for(let ot=0;ot= 0; --i) { + if(i > axis) continue; + indices[i] += 1; + if(indices[i] < shape[i]) { + break; + } + indices[i] = 0; + } + } + `;_e[et]=new a.GlslLibRoutine(rt)}),_e}}o.ShapeUtilsGlslLib=_},5060:(i,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.getDefaultFragShaderMain=o.getFragShaderPreamble=o.getVertexShaderSource=o.getGlsl=void 0;const s={version:"",attribute:"attribute",varyingVertex:"varying",varyingFrag:"varying",texture2D:"texture2D",output:"gl_FragColor",outputDeclaration:""},a={version:"#version 300 es",attribute:"in",varyingVertex:"out",varyingFrag:"in",texture2D:"texture",output:"outputColor",outputDeclaration:"out vec4 outputColor;"};function _($){return $===1?s:a}o.getGlsl=_,o.getVertexShaderSource=function($){const _e=_($);return`${_e.version} + precision highp float; + ${_e.attribute} vec3 position; + ${_e.attribute} vec2 textureCoord; + + ${_e.varyingVertex} vec2 TexCoords; + + void main() + { + gl_Position = vec4(position, 1.0); + TexCoords = textureCoord; + }`},o.getFragShaderPreamble=function($){const _e=_($);return`${_e.version} + precision highp float; + precision highp int; + precision highp sampler2D; + ${_e.varyingFrag} vec2 TexCoords; + ${_e.outputDeclaration} + const vec2 halfCR = vec2(0.5, 0.5); + + // Custom vector types to handle higher dimenalities. + struct ivec5 + { + int x; + int y; + int z; + int w; + int u; + }; + + struct ivec6 + { + int x; + int y; + int z; + int w; + int u; + int v; + }; + + int imod(int x, int y) { + return x - y * (x / y); + } + + `},o.getDefaultFragShaderMain=function($,_e){return` + void main() { + int indices[${_e}]; + toVec(TexCoords, indices); + vec4 result = vec4(process(indices)); + ${_($).output} = result; + } + `}},3891:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.VecGlslLib=void 0;const a=s(8520);class _ extends a.GlslLib{constructor(_e){super(_e)}getCustomTypes(){return{}}getFunctions(){return Object.assign(Object.assign(Object.assign(Object.assign({},this.binaryVecFunctions()),this.copyVec()),this.setVecItem()),this.getVecItem())}binaryVecFunctions(){const _e=this.context.outputTextureLayout.shape.length,tt={add:"+=",sub:"-=",mul:"*=",div:"/="},st={};for(const it in tt){const nt=`${it}Vec`;let et="";for(let rt=0;rt<_e;++rt)et+=` + dest[${rt}] ${tt[it]} src[${rt}]; + `;const j=` + void ${nt}(int src[${_e}], out int dest[${_e}]) { + ${et} + } + `;st[nt]=new a.GlslLibRoutine(j)}return st}copyVec(){const _e=this.context.outputTextureLayout.shape.length;let tt="";for(let it=0;it<_e;++it)tt+=` + dest[${it}] = src[${it}]; + `;const st=` + void copyVec(int src[${_e}], out int dest[${_e}]) { + ${tt} + } + `;return{copyVec:new a.GlslLibRoutine(st)}}setVecItem(){const _e=this.context.outputTextureLayout.shape.length;let tt=` + if(index < 0) + index =${_e} + index; + if (index == 0) + m[0] = value; + `;for(let it=1;it<_e-1;++it)tt+=` + else if (index == ${it}) + m[${it}] = value; + `;tt+=` + else + m[${_e-1}] = value; + `;const st=` + void setVecItem(out int m[${_e}], int index, int value) { + ${tt} + } + `;return{setVecItem:new a.GlslLibRoutine(st)}}getVecItem(){const _e=this.context.outputTextureLayout.shape.length;let tt=` + if(index < 0) + index = ${_e} + index; + if (index == 0) + return m[0]; + `;for(let it=1;it<_e-1;++it)tt+=` + else if (index == ${it}) + return m[${it}]; + `;tt+=` + else + return m[${_e-1}]; + `;const st=` + int getVecItem(int m[${_e}], int index) { + ${tt} + } + `;return{getVecItem:new a.GlslLibRoutine(st)}}}o.VecGlslLib=_},8316:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WebGLInferenceHandler=void 0;const a=s(6231),_=s(9162),$=s(2517),_e=s(2403),tt=s(7019),st=s(8710),it=s(5611),nt=s(4057),et=s(2039);o.WebGLInferenceHandler=class{constructor(j){this.session=j,this.packedTextureDataCache=new Map,this.unpackedTextureDataCache=new Map}calculateTextureWidthAndHeight(j,rt){return(0,nt.calculateTextureWidthAndHeight)(this.session.layoutStrategy,j,rt)}executeProgram(j,rt){if(rt.length{const bt=ht.map(mt=>`${mt.unpackedShape.join(",")};${mt.width}x${mt.height}`).join("_");let yt=ft.name;return ft.cacheHint&&(yt+="["+ft.cacheHint+"]"),yt+=":"+bt,yt})(j,ot);let lt=this.session.programManager.getArtifact(at);const ut=lt?lt.programInfo:typeof j.get=="function"?j.get():j,ct=(0,nt.createTextureLayoutFromTextureType)(this.session.layoutStrategy,ut.output.dims,ut.output.textureType),dt=this.createTextureData(ct,ut.output.type);return lt||(lt=this.session.programManager.build(ut,ot,dt),this.session.programManager.setArtifact(at,lt)),this.runProgram(lt,ot,dt),dt}run(j,rt){return this.executeProgram(j,rt).tensor}runProgram(j,rt,ot){for(let at=0;atthis.readTexture(ut),async ct=>this.readTextureAsync(ut),void 0,lt),texture:ot});return this.setTextureData(ut.tensor.dataId,ut,j.isPacked),ut}getTextureData(j,rt=!1){return this.session.isInitializer(j)?this.session.getTextureData(j,rt):rt?this.packedTextureDataCache.get(j):this.unpackedTextureDataCache.get(j)}setTextureData(j,rt,ot=!1){this.session.isInitializer(j)?this.session.setTextureData(j,rt,ot):(ot?this.packedTextureDataCache:this.unpackedTextureDataCache).set(j,rt)}isTextureLayoutCached(j,rt=!1){return!!this.getTextureData(j.dataId,rt)}dispose(){this.session.textureManager.clearActiveTextures(),this.packedTextureDataCache.forEach(j=>this.session.textureManager.releaseTexture(j)),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache.forEach(j=>this.session.textureManager.releaseTexture(j)),this.unpackedTextureDataCache=new Map}readTexture(j){return j.isPacked?this.readTexture(this.unpack(j)):this.session.backend.glContext.isFloat32DownloadSupported?this.session.textureManager.readTexture(j,j.tensor.type,j.channels):this.session.textureManager.readUint8TextureAsFloat((0,st.encodeAsUint8)(this,j))}async readTextureAsync(j){return j.isPacked?this.readTextureAsync(this.unpack(j)):this.session.backend.glContext.isFloat32DownloadSupported?this.session.textureManager.readTextureAsync(j,j.tensor.type,j.channels):this.session.textureManager.readUint8TextureAsFloat((0,st.encodeAsUint8)(this,j))}pack(j){return this.executeProgram((0,_e.createPackProgramInfoLoader)(this,j.tensor),[j.tensor])}unpack(j){return this.executeProgram((0,it.createUnpackProgramInfoLoader)(this,j.tensor),[j.tensor])}}},1640:function(i,o,s){var a=this&&this.__createBinding||(Object.create?function(Mt,jt,Yt,Kt){Kt===void 0&&(Kt=Yt);var sr=Object.getOwnPropertyDescriptor(jt,Yt);sr&&!("get"in sr?!jt.__esModule:sr.writable||sr.configurable)||(sr={enumerable:!0,get:function(){return jt[Yt]}}),Object.defineProperty(Mt,Kt,sr)}:function(Mt,jt,Yt,Kt){Kt===void 0&&(Kt=Yt),Mt[Kt]=jt[Yt]}),_=this&&this.__setModuleDefault||(Object.create?function(Mt,jt){Object.defineProperty(Mt,"default",{enumerable:!0,value:jt})}:function(Mt,jt){Mt.default=jt}),$=this&&this.__importStar||function(Mt){if(Mt&&Mt.__esModule)return Mt;var jt={};if(Mt!=null)for(var Yt in Mt)Yt!=="default"&&Object.prototype.hasOwnProperty.call(Mt,Yt)&&a(jt,Mt,Yt);return _(jt,Mt),jt};Object.defineProperty(o,"__esModule",{value:!0}),o.WEBGL_OP_RESOLVE_RULES=void 0;const _e=s(2898),tt=$(s(7839)),st=s(4196),it=s(2069),nt=s(8138),et=s(9663),j=s(5193),rt=s(7992),ot=s(1253),at=s(4776),lt=s(6572),ut=s(3346),ct=s(5623),dt=s(2870),ft=s(2143),ht=s(4939),bt=s(718),yt=s(2268),mt=s(8117),gt=s(2278),vt=s(5524),wt=s(5975),Ct=s(3933),kt=s(6558),It=s(5723),Pt=s(3738),St=$(s(4909)),Rt=s(8428),At=s(9793);o.WEBGL_OP_RESOLVE_RULES=[["Abs","","6+",St.abs],["Acos","","7+",St.acos],["Add","","7+",tt.add],["And","","7+",tt.and],["Asin","","7+",St.asin],["Atan","","7+",St.atan],["AveragePool","","7+",ft.averagePool,ft.parseAveragePoolAttributes],["BatchNormalization","","7+",_e.batchNormalization,_e.parseBatchNormalizationAttributes],["Cast","","6+",st.cast,st.parseCastAttributes],["Ceil","","6+",St.ceil],["Clip","","6-10",St.clip,St.parseClipAttributes],["Clip","","11+",St.clipV11],["Concat","","4+",it.concat,it.parseConcatAttributes],["Conv","","1+",nt.conv,nt.parseConvAttributes],["ConvTranspose","","1+",et.convTranspose,et.parseConvTransposeAttributes],["Cos","","7+",St.cos],["Div","","7+",tt.div],["Dropout","","7+",St.identity],["DepthToSpace","","1+",j.depthToSpace,j.parseDepthToSpaceAttributes],["Equal","","7+",tt.equal],["Elu","","6+",St.elu,St.parseEluAttributes],["Exp","","6+",St.exp],["Flatten","","1+",rt.flatten,rt.parseFlattenAttributes],["Floor","","6+",St.floor],["FusedConv","com.microsoft","1+",nt.conv,nt.parseConvAttributes],["Gather","","1+",ot.gather,ot.parseGatherAttributes],["Gemm","","7-10",at.gemm,at.parseGemmAttributesV7],["Gemm","","11+",at.gemm,at.parseGemmAttributesV11],["GlobalAveragePool","","1+",ft.globalAveragePool,ft.parseGlobalAveragePoolAttributes],["GlobalMaxPool","","1+",ft.globalMaxPool],["Greater","","7+",tt.greater],["Identity","","1+",St.identity],["ImageScaler","","1+",lt.imageScaler,lt.parseImageScalerAttributes],["InstanceNormalization","","6+",ut.instanceNormalization,ut.parseInstanceNormalizationAttributes],["LeakyRelu","","6+",St.leakyRelu,St.parseLeakyReluAttributes],["Less","","7+",tt.less],["Log","","6+",St.log],["MatMul","","1+",ct.matMul,ct.parseMatMulAttributes],["MaxPool","","1+",ft.maxPool,ft.parseMaxPoolAttributes],["Mul","","7+",tt.mul],["Neg","","6+",St.neg],["Not","","1+",St.not],["Or","","7+",tt.or],["Pad","","2-10",dt.padV2,dt.parsePadAttributesV2],["Pad","","11+",dt.padV11,dt.parsePadAttributesV11],["Pow","","7+",tt.pow],["PRelu","","7+",tt.pRelu],["ReduceLogSum","","1+",ht.reduceLogSum,ht.parseReduceAttributes],["ReduceMax","","1+",ht.reduceMax,ht.parseReduceAttributes],["ReduceMean","","1+",ht.reduceMean,ht.parseReduceAttributes],["ReduceMin","","1+",ht.reduceMin,ht.parseReduceAttributes],["ReduceProd","","1+",ht.reduceProd,ht.parseReduceAttributes],["ReduceSum","","1-12",ht.reduceSum,ht.parseReduceAttributes],["ReduceSumSquare","","1+",ht.reduceLogSumSquare,ht.parseReduceAttributes],["Relu","","6+",St.relu],["Reshape","","5+",bt.reshape],["Resize","","10",yt.resize,yt.parseResizeAttributesV10],["Resize","","11+",yt.resize,yt.parseResizeAttributesV11],["Shape","","1+",mt.shape],["Sigmoid","","6+",St.sigmoid],["Sin","","7+",St.sin],["Slice","","10+",gt.sliceV10],["Slice","","1-9",gt.slice,gt.parseSliceAttributes],["Softmax","","1-12",vt.softmax,vt.parseSoftmaxAttributes],["Softmax","","13+",vt.softmaxV13,vt.parseSoftmaxAttributesV13],["Split","","2-12",wt.split,wt.parseSplitAttributes],["Sqrt","","6+",St.sqrt],["Squeeze","","1-12",Ct.squeeze,Ct.parseSqueezeAttributes],["Squeeze","","13+",Ct.squeezeV13],["Sub","","7+",tt.sub],["Sum","","6+",kt.sum],["Tan","","7+",St.tan],["Tanh","","6+",St.tanh],["Tile","","6+",It.tile],["Transpose","","1+",Pt.transpose,Pt.parseTransposeAttributes],["Upsample","","7-8",At.upsample,At.parseUpsampleAttributesV7],["Upsample","","9",At.upsample,At.parseUpsampleAttributesV9],["Unsqueeze","","1-12",Rt.unsqueeze,Rt.parseUnsqueezeAttributes],["Unsqueeze","","13+",Rt.unsqueezeV13],["Xor","","7+",tt.xor]]},2898:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.parseBatchNormalizationAttributes=o.batchNormalization=void 0;const a=s(246),_=s(5060),$=s(2039),_e={name:"BatchNormalization",inputNames:["A","Scale","B","Mean","Variance"],inputTypes:[$.TextureType.unpacked,$.TextureType.unpacked,$.TextureType.unpacked,$.TextureType.unpacked,$.TextureType.unpacked]};o.batchNormalization=(it,nt,et)=>(st(nt),[it.run(Object.assign(Object.assign({},_e),{cacheHint:et.cacheKey,get:()=>tt(it,nt,et)}),nt)]),o.parseBatchNormalizationAttributes=it=>{const nt=it.attributes.getFloat("epsilon",1e-5),et=it.attributes.getFloat("momentum",.9),j=it.attributes.getInt("spatial",1);return(0,a.createAttributeWithCacheKey)({epsilon:nt,momentum:et,spatial:j})};const tt=(it,nt,et)=>{const j=(0,_.getGlsl)(it.session.backend.glContext.version),rt=nt[0].dims.length,[ot,at]=it.calculateTextureWidthAndHeight(nt[1].dims,$.TextureType.unpacked),lt=` + float process(int[${rt}] indices) { + vec2 position = offsetToCoords(indices[1], ${ot}, ${at}); + float scale = getColorAsFloat(${j.texture2D}(Scale, position)); + float mean = getColorAsFloat(${j.texture2D}(Mean, position)); + float variance = getColorAsFloat(${j.texture2D}(Variance, position)); + float b = getColorAsFloat(${j.texture2D}(B, position)); + + return scale * ( (_A(indices) - mean) / sqrt(variance + float(${et.epsilon})) ) + b; + }`;return Object.assign(Object.assign({},_e),{output:{dims:nt[0].dims,type:nt[0].type,textureType:$.TextureType.unpacked},shaderSource:lt})},st=it=>{if(!it||it.length!==5)throw new Error("BatchNormalization requires 5 inputs.");const nt=it[0],et=it[1],j=it[2],rt=it[3],ot=it[4];if(nt.dims.length<3||et.dims.length!==1||j.dims.length!==1||rt.dims.length!==1||ot.dims.length!==1)throw new Error("invalid input shape.");if(et.dims[0]!==nt.dims[1]||j.dims[0]!==nt.dims[1]||rt.dims[0]!==nt.dims[1]||ot.dims[0]!==nt.dims[1])throw new Error("invalid input shape.");if(nt.type!=="float32"&&nt.type!=="float64"||et.type!=="float32"&&et.type!=="float64"||j.type!=="float32"&&j.type!=="float64"||rt.type!=="float32"&&rt.type!=="float64"||ot.type!=="float32"&&ot.type!=="float64")throw new Error("invalid input tensor types.")}},7839:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.xor=o.sub=o.pRelu=o.pow=o.or=o.mul=o.less=o.greater=o.equal=o.div=o.and=o.add=o.glslPRelu=o.glslPow=o.glslXor=o.glslOr=o.glslAnd=o.glslLess=o.glslGreater=o.glslEqual=o.glslSub=o.glslMul=o.glslDiv=o.glslAdd=void 0;const a=s(2517),_=s(8520),$=s(5060),_e=s(2039);function tt(){const ht="add_";return{body:` + float ${ht}(float a, float b) { + return a + b; + } + vec4 ${ht}(vec4 v1, vec4 v2) { + return v1 + v2; + } + `,name:ht,type:_.FunctionType.ValueBased}}function st(){const ht="div_";return{body:` + float ${ht}(float a, float b) { + return a / b; + } + vec4 ${ht}(vec4 v1, vec4 v2) { + return v1 / v2; + } + `,name:ht,type:_.FunctionType.ValueBased}}function it(){const ht="mul_";return{body:` + float ${ht}(float a, float b) { + return a * b; + } + vec4 ${ht}(vec4 v1, vec4 v2) { + return v1 * v2; + } + `,name:ht,type:_.FunctionType.ValueBased}}function nt(){const ht="sub_";return{body:` + float ${ht}(float a, float b) { + return a - b; + } + vec4 ${ht}(vec4 v1, vec4 v2) { + return v1 - v2; + } + `,name:ht,type:_.FunctionType.ValueBased}}function et(){const ht="equal_";return{body:` + float ${ht}(float a, float b) { + return float(a == b); + } + vec4 ${ht}(vec4 v1, vec4 v2) { + return vec4(equal(v1, v2)); + } + `,name:ht,type:_.FunctionType.ValueBased}}function j(){const ht="greater_";return{body:` + float ${ht}(float a, float b) { + return float(a > b); + } + vec4 ${ht}(vec4 v1, vec4 v2) { + return vec4( v1.r > v2.r , + v1.g > v2.g, + v1.b > v2.b, + v1.a > v2.a ); + } + `,name:ht,type:_.FunctionType.ValueBased}}function rt(){const ht="less_";return{body:` + float ${ht}(float a, float b) { + return float(a < b); + } + vec4 ${ht}(vec4 v1, vec4 v2) { + return vec4( v1.r < v2.r , + v1.g < v2.g, + v1.b < v2.b, + v1.a < v2.a ); + } + `,name:ht,type:_.FunctionType.ValueBased}}function ot(){const ht="and_";return{body:` + float ${ht}(float a, float b) { + return float( bool(a) && bool(b) ); + } + vec4 ${ht}(vec4 v1, vec4 v2) { + bvec4 b1 = bvec4(v1); + bvec4 b2 = bvec4(v2); + return vec4( b1.r && b2.r , + b1.g && b2.g, + b1.b && b2.b, + b1.a && b2.a ); + } + `,name:ht,type:_.FunctionType.ValueBased}}function at(){const ht="or_";return{body:` + float ${ht}(float a, float b) { + return float( bool(a) || bool(b) ); + } + vec4 ${ht}(vec4 v1, vec4 v2) { + bvec4 b1 = bvec4(v1); + bvec4 b2 = bvec4(v2); + return vec4( b1.r || b2.r , + b1.g || b2.g, + b1.b || b2.b, + b1.a || b2.a ); + } + `,name:ht,type:_.FunctionType.ValueBased}}function lt(){const ht="xor_";return{body:` + float ${ht}(float a, float b) { + return float( bool(a) ^^ bool(b) ); + } + vec4 ${ht}(vec4 v1, vec4 v2) { + bvec4 b1 = bvec4(v1); + bvec4 b2 = bvec4(v2); + return vec4( b1.r ^^ b2.r , + b1.g ^^ b2.g, + b1.b ^^ b2.b, + b1.a ^^ b2.a ); + } + `,name:ht,type:_.FunctionType.ValueBased}}function ut(){return function(ht){const bt=`${ht}_`;return{body:` + float ${bt}(float a, float b) { + return ${ht}(a, b); + } + vec4 ${bt}(vec4 v1, vec4 v2) { + return ${ht}(v1, v2); + } + `,name:bt,type:_.FunctionType.ValueBased}}("pow")}function ct(){const ht="prelu_";return{body:` + float ${ht}(float a, float b) { + return a < 0.0 ? a * b: a; + } + vec4 ${ht}(vec4 v1, vec4 v2) { + return vec4( + v1.r < 0.0 ? v1.r * v2.r: v1.r, + v1.g < 0.0 ? v1.g * v2.g: v1.g, + v1.b < 0.0 ? v1.b * v2.b: v1.b, + v1.a < 0.0 ? v1.a * v2.a: v1.a + ); + } + `,name:ht,type:_.FunctionType.ValueBased}}o.glslAdd=tt,o.glslDiv=st,o.glslMul=it,o.glslSub=nt,o.glslEqual=et,o.glslGreater=j,o.glslLess=rt,o.glslAnd=ot,o.glslOr=at,o.glslXor=lt,o.glslPow=ut,o.glslPRelu=ct;const dt=(ht,bt,yt,mt=bt[0].type,gt)=>{const vt=ht.session.pack?_e.TextureType.packed:_e.TextureType.unpacked;return{name:yt.name,inputNames:["A","B"],inputTypes:[vt,vt],cacheHint:gt,get:()=>ft(ht,bt,yt,mt)}},ft=(ht,bt,yt,mt=bt[0].type)=>{const gt=ht.session.pack?_e.TextureType.packed:_e.TextureType.unpacked,vt=!a.ShapeUtil.areEqual(bt[0].dims,bt[1].dims);let wt=bt[0].dims;const Ct=ht.session.pack;if(vt){const Pt=a.BroadcastUtil.calcShape(bt[0].dims,bt[1].dims,!1);if(!Pt)throw new Error("Can't perform binary op on the given tensors");wt=Pt;const St=wt.length,Rt=bt[0].dims.length!==0?bt[0].dims.length:1,At=bt[1].dims.length!==0?bt[1].dims.length:1,Mt=bt[0].dims.length!==0?"bcastIndices_A(indices, aindices);":"aindices[0] = 0;",jt=bt[1].dims.length!==0?"bcastIndices_B(indices, bindices);":"bindices[0] = 0;",Yt=(0,$.getGlsl)(ht.session.backend.glContext.version),Kt=Ct?` + ${yt.body} + void main() { + vec4 a = getAAtOutCoords(); + vec4 b = getBAtOutCoords(); + vec4 result = ${yt.name}(a, b); + ${Yt.output} = result; + }`:` + ${yt.body} + float process(int indices[${St}]) { + int aindices[${Rt}]; + int bindices[${At}]; + ${Mt} + ${jt} + return ${yt.name}(_A(aindices), _B(bindices)); + }`;return{name:yt.name,inputNames:["A","B"],inputTypes:[gt,gt],output:{dims:wt,type:mt,textureType:gt},shaderSource:Kt,hasMain:Ct}}const kt=(0,$.getGlsl)(ht.session.backend.glContext.version),It=` + ${yt.body} + void main() { + vec4 v1 = ${kt.texture2D}(A, TexCoords); + vec4 v2 = ${kt.texture2D}(B, TexCoords); + vec4 result = ${yt.name}(v1, v2); + ${kt.output} = result; + } + `;return{name:yt.name,inputNames:["A","B"],inputTypes:[gt,gt],output:{dims:bt[0].dims,type:mt,textureType:gt},shaderSource:It,hasMain:!0}};o.add=(ht,bt)=>[ht.run(dt(ht,bt,tt()),bt)],o.and=(ht,bt)=>[ht.run(dt(ht,bt,ot(),"bool"),bt)],o.div=(ht,bt)=>[ht.run(dt(ht,bt,st()),bt)],o.equal=(ht,bt)=>[ht.run(dt(ht,bt,et(),"bool"),bt)],o.greater=(ht,bt)=>[ht.run(dt(ht,bt,j(),"bool"),bt)],o.less=(ht,bt)=>[ht.run(dt(ht,bt,rt(),"bool"),bt)],o.mul=(ht,bt)=>[ht.run(dt(ht,bt,it()),bt)],o.or=(ht,bt)=>[ht.run(dt(ht,bt,at(),"bool"),bt)],o.pow=(ht,bt)=>[ht.run(dt(ht,bt,ut()),bt)],o.pRelu=(ht,bt)=>[ht.run(dt(ht,bt,ct()),bt)],o.sub=(ht,bt)=>[ht.run(dt(ht,bt,nt()),bt)],o.xor=(ht,bt)=>[ht.run(dt(ht,bt,lt(),"bool"),bt)]},4196:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.parseCastAttributes=o.cast=void 0;const a=s(2517);o.cast=($,_e,tt)=>(_(_e),[$.cast(_e[0],tt)]),o.parseCastAttributes=$=>a.ProtoUtil.tensorDataTypeFromProto($.attributes.getInt("to"));const _=$=>{if(!$||$.length!==1)throw new Error("Cast requires 1 input.");if($[0].type==="string")throw new Error("Invalid input type.")}},1163:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createPackedConcatProgramInfoLoader=void 0;const a=s(5060),_=s(2039),$=s(9390),_e=s(2827);o.createPackedConcatProgramInfoLoader=(st,it,nt)=>{const et=(j=it.length,rt=nt.cacheKey,{name:"Concat (packed)",inputNames:Array.from({length:j},(ot,at)=>`X${at}`),inputTypes:Array(j).fill(_.TextureType.packed),cacheHint:rt});var j,rt;return Object.assign(Object.assign({},et),{get:()=>((ot,at,lt,ut)=>{const ct=lt[0].dims.slice();if(ut>=ct.length||ut<-1*ct.length)throw new Error("axis specified for concat doesn't match input dimensionality");ut<0&&(ut=ct.length+ut);const dt=ct.slice(0);for(let Mt=1;MtMt.dims),gt=(0,$.getGlChannels)(ft),vt=new Array(mt.length-1);vt[0]=mt[0][ut];for(let Mt=1;Mt= ${vt[Mt-1]}) { + return getChannel( + getX${Mt}(${tt(gt,wt,jt)}), + vec2(${tt(Ct,wt,jt)})); + }`}const Pt=vt.length,St=vt[vt.length-1];It+=` + return getChannel( + getX${Pt}(${tt(gt,wt,St)}), + vec2(${tt(Ct,wt,St)}));`;const Rt=(0,a.getGlsl)(ot.session.backend.glContext.version),At=` + ${yt} + float getValue(${gt.map(Mt=>"int "+Mt)}) { + ${It} + } + + void main() { + ${bt} coords = getOutputCoords(); + int lastDim = coords.${gt[ft-1]}; + coords.${gt[ft-1]} = coords.${gt[ft-2]}; + coords.${gt[ft-2]} = lastDim; + + vec4 result = vec4(getValue(${ht}), 0., 0., 0.); + + ${ht[ft-1]} = ${ht[ft-1]} + 1; + if (${ht[ft-1]} < ${dt[ft-1]}) { + result.g = getValue(${ht}); + } + + ${ht[ft-2]} = ${ht[ft-2]} + 1; + if (${ht[ft-2]} < ${dt[ft-2]}) { + result.a = getValue(${ht}); + } + + ${ht[ft-1]} = ${ht[ft-1]} - 1; + if (${ht[ft-2]} < ${dt[ft-2]} && + ${ht[ft-1]} < ${dt[ft-1]}) { + result.b = getValue(${ht}); + } + ${Rt.output} = result; + } + `;return Object.assign(Object.assign({},at),{output:{dims:dt,type:lt[0].type,textureType:_.TextureType.packed},shaderSource:At,hasMain:!0})})(st,et,it,nt.axis)})};const tt=(st,it,nt)=>{const et=st.indexOf(it);return st.map((j,rt)=>rt===et?`${j} - ${nt}`:j).join()}},2069:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.parseConcatAttributes=o.concat=void 0;const a=s(246),_=s(2039),$=s(1163);o.concat=(j,rt,ot)=>(et(rt),j.session.pack&&rt[0].dims.length>1?[j.run((0,$.createPackedConcatProgramInfoLoader)(j,rt,ot),rt)]:[j.run(_e(j,rt,ot),rt)]);const _e=(j,rt,ot)=>{const at=(lt=rt.length,ut=ot.cacheKey,{name:"Concat",inputNames:Array.from({length:lt},(ct,dt)=>`X${dt}`),inputTypes:Array(lt).fill(_.TextureType.unpacked),cacheHint:ut});var lt,ut;return Object.assign(Object.assign({},at),{get:()=>((ct,dt,ft,ht)=>{const bt=ft[0].dims.slice();if(ht>=bt.length||ht<-1*bt.length)throw new Error("axis specified for concat doesn't match input dimensionality");ht<0&&(ht=bt.length+ht);const yt=bt.slice(0);for(let kt=1;kt`int getTextureWhereDataResides(int index) { + ${j.map((rt,ot)=>`if(index<${rt}) {return ${ot};} +`).join("")} + }`,st=j=>tt(j),it=(j,rt)=>{const ot=[`float fetchDataFromCorrectTexture(int textureIndex, int indices[${rt}]) {`];for(let at=0;at{const rt=["int getSizeInConcatAxisValueFromIndex(int index) {"];for(let ot=0;ot(0,a.createAttributeWithCacheKey)({axis:j.attributes.getInt("axis")});const et=j=>{if(!j||j.length<1)throw new Error("too few inputs");const rt=j[0].type,ot=j[0].dims.length;if(rt==="string")throw new Error("string tensor is not supported yet");for(const at of j){if(at.type!==rt)throw new Error("input tensors should be one type");if(at.dims.length!==ot)throw new Error("input tensors should have the same shape")}}},4770:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createUnpackedGroupedConvProgramInfoLoader=void 0;const a=s(6231),_=s(5060),$=s(2039),_e=s(8138),tt=s(2823);o.createUnpackedGroupedConvProgramInfoLoader=(st,it,nt)=>{const et=(j=it.length>2,rt=nt.cacheKey,{name:"GroupedConv",inputNames:j?["X","W","Bias"]:["X","W"],inputTypes:j?[$.TextureType.unpacked,$.TextureType.unpacked,$.TextureType.unpacked]:[$.TextureType.unpacked,$.TextureType.unpacked],cacheHint:rt});var j,rt;return Object.assign(Object.assign({},et),{get:()=>((ot,at,lt,ut)=>{const ct=at.length>2?"value += getBias(output_channel);":"",dt=at[0].dims.slice(),ft=at[1].dims.slice(),ht=ft[0]/ut.group;a.Logger.verbose("GroupedConv",`autpPad:${ut.autoPad}, dilations:${ut.dilations}, group:${ut.group}, kernelShape:${ut.kernelShape}, pads:${ut.pads}, strides:${ut.strides}`);const bt=(0,_e.calculateOutputShape)(dt,ft,ut.dilations,ut.pads,ut.strides),yt=(0,_.getGlsl)(ot.session.backend.glContext.version),{activationFunction:mt,applyActivation:gt}=(0,tt.getActivationSnippet)(ut),vt=` + const ivec2 strides = ivec2(${ut.strides[0]}, ${ut.strides[1]}); + const ivec2 pads = ivec2(${ut.pads[0]}, ${ut.pads[1]}); + ${mt} + void main() { + ivec4 coords = getOutputCoords(); + int batch = coords.x; + int output_channel = coords.y; + ivec2 xRCCorner = coords.zw * strides - pads; + int group_id = output_channel / ${ht}; + + float value = 0.0; + for (int wInChannel = 0; wInChannel < ${ft[1]}; wInChannel++) { + int input_channel = group_id * ${ft[1]} + wInChannel; + for (int wHeight = 0; wHeight < ${ft[2]}; wHeight++) { + int xHeight = xRCCorner.x + wHeight * ${ut.dilations[0]}; + + if (xHeight < 0 || xHeight >= ${dt[2]}) { + continue; + } + + for (int wWidth = 0; wWidth < ${ft[3]}; wWidth++) { + int xWidth = xRCCorner.y + wWidth * ${ut.dilations[1]}; + if (xWidth < 0 || xWidth >= ${dt[3]}) { + continue; + } + + float xVal = getX(batch, input_channel, xWidth, xHeight); + float wVal = getW(output_channel, wInChannel, wWidth, wHeight); + value += xVal*wVal; + } + } + } + ${ct} + ${gt} + ${yt.output} = vec4(value, .0, .0, .0); + } +`;return Object.assign(Object.assign({},lt),{output:{dims:bt,type:at[0].type,textureType:$.TextureType.unpacked},shaderSource:vt,hasMain:!0})})(st,it,et,nt)})}},1386:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.conv2DPacked=o.conv2DPackedPointwise=void 0;const a=s(8138),_=s(8555),$=s(708);o.conv2DPackedPointwise=(_e,tt,st)=>{const it=tt[0].dims,nt=tt[1].dims,et=(0,a.calculateOutputShape)(it,nt,st.dilations,st.pads,st.strides),j=_e.reshapePacked(tt[0],[it[1],it[2]*it[3]]),rt=_e.reshapePacked(tt[1],[nt[0],nt[1]]),ot=tt.length>2?[rt,j,tt[2]]:[rt,j],at=_e.run((0,$.createPackedMatmulProgramInfoLoader)(_e,ot,st),ot);return _e.reshapePacked(at,et)},o.conv2DPacked=(_e,tt,st)=>{const it=tt[0].dims,nt=tt[1].dims,et=(0,a.calculateOutputShape)(it,nt,st.dilations,st.pads,st.strides),j=_e.run((0,_.createPackedIm2ColProgramInfoLoader)(_e,tt[0],tt[1],et,st),[tt[0]]),rt=_e.reshapePacked(tt[1],[nt[0],nt[1]*nt[2]*nt[3]]),ot=tt.length===3?[rt,j,tt[2]]:[rt,j],at=_e.run((0,$.createPackedMatmulProgramInfoLoader)(_e,ot,st),ot);return _e.reshapePacked(at,et)}},9663:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.parseConvTransposeAttributes=o.convTranspose=void 0;const a=s(246),_=s(5060),$=s(2039),_e=s(2823),tt=(rt,ot,at,lt,ut,ct)=>(rt-1)*ot+at+(lt-1)*ut+1-ct,st=(rt,ot,at,lt,ut)=>{const ct=Math.floor(rt/2);ot==="SAME_UPPER"?(at[lt]=ct,at[ut]=rt-ct):ot==="SAME_LOWER"&&(at[lt]=rt-ct,at[ut]=ct)};o.convTranspose=(rt,ot,at)=>(j(ot,at),it(rt,ot,at));const it=(rt,ot,at)=>{const lt=et(at,ot);return[nt(rt,ot,lt)]},nt=(rt,ot,at)=>rt.run(((lt,ut,ct)=>{const dt=(ft=ut.length>2,ht=ct.cacheKey,{name:"ConvTranspose",inputNames:ft?["X","W","B"]:["X","W"],inputTypes:ft?[$.TextureType.unpacked,$.TextureType.unpacked,$.TextureType.unpacked]:[$.TextureType.unpacked,$.TextureType.unpacked],cacheHint:ht});var ft,ht;return Object.assign(Object.assign({},dt),{get:()=>((bt,yt,mt,gt)=>{const vt=yt.length>2?"getB(output_channel)":"0.0",wt=yt[0].dims,Ct=yt[1].dims,kt=Ct[1],It=Ct[0]/gt.group,Pt=[yt[0].dims[0],yt[1].dims[1]*gt.group,...gt.outputShape],St=(0,_.getGlsl)(bt.session.backend.glContext.version),{activationFunction:Rt,applyActivation:At}=(0,_e.getActivationSnippet)(gt),Mt=` + const ivec2 strides = ivec2(${gt.strides[0]}, ${gt.strides[1]}); + const ivec2 pads = ivec2(${gt.pads[0]}, ${gt.pads[1]}); + ${Rt} + void main() { + ivec4 coords = getOutputCoords(); + int batch = coords.x; + int output_channel = coords.y; + + ivec2 loc = coords.zw + pads; + + int group_id = output_channel / ${kt}; + int wOutChannel = output_channel - group_id * ${kt}; + + float value = ${vt}; + for (int inChannelOffset = 0; inChannelOffset < ${It}; inChannelOffset++) { + int input_channel = group_id * ${It} + inChannelOffset; + for (int wWOff = 0; wWOff < ${Ct[2]}; wWOff++) { + for (int wHOff = 0; wHOff < ${Ct[3]}; wHOff++) { + ivec2 wOff = ivec2(wWOff * ${gt.dilations[0]}, wHOff * ${gt.dilations[1]}); + ivec2 wLoc = loc - wOff; + ivec2 wLocIn = wLoc / strides; + if ( + wLocIn * strides == wLoc && + wLocIn.x >= 0 && wLocIn.x < ${wt[2]} && + wLocIn.y >= 0 && wLocIn.y < ${wt[3]} + ) { + float xVal = getX(batch, input_channel, wLocIn.y, wLocIn.x); + float wVal = getW(input_channel, wOutChannel, wHOff, wWOff); + value += xVal * wVal; + } + } + } + } + ${At} + ${St.output} = vec4(value, .0, .0, .0); + } +`;return Object.assign(Object.assign({},mt),{output:{dims:Pt,type:yt[0].type,textureType:$.TextureType.unpacked},shaderSource:Mt,hasMain:!0})})(lt,ut,dt,ct)})})(rt,ot,at),ot),et=(rt,ot)=>{const at=rt.kernelShape.slice();if(rt.kernelShape.length===0)for(let dt=2;dt{const wt=dt.length-2,Ct=vt.length===0;for(let kt=0;kt{const ot=rt.attributes,at=(0,_e.parseInternalActivationAttributes)(ot),lt=ot.getString("auto_pad","NOTSET"),ut=ot.getInts("dilations",[1,1]),ct=ot.getInt("group",1),dt=ot.getInts("kernel_shape",[]),ft=ot.getInts("output_padding",[0,0]),ht=ot.getInts("output_shape",[]),bt=ot.getInts("pads",[0,0,0,0]),yt=ot.getInts("strides",[1,1]);return(0,a.createAttributeWithCacheKey)(Object.assign({autoPad:lt,dilations:ut,group:ct,kernelShape:dt,outputPadding:ft,outputShape:ht,pads:bt,strides:yt},at))};const j=(rt,ot)=>{if(!rt||rt.length!==2&&rt.length!==3)throw new Error("Conv requires 2 or 3 inputs");if(rt[0].dims.length!==4||rt[1].dims.length!==4)throw new Error("currently only support 2-dimensional conv");if(rt[0].dims[1]!==rt[1].dims[0])throw new Error("FILTER_IN_CHANNEL should be equal to DATA_CHANNEL");const at=rt[1].dims[1]*ot.group;if(rt.length===3&&(rt[2].dims.length!==1||rt[2].dims[0]!==at))throw new Error("invalid bias");const lt=rt[0].dims.length-2;if(ot.dilations.length!==lt)throw new Error(`dilations should be ${lt}D`);if(ot.strides.length!==lt)throw new Error(`strides should be ${lt}D`);if(ot.pads.length!==2*lt)throw new Error(`pads should be ${2*lt}D`);if(ot.outputPadding.length!==lt)throw new Error(`output_padding should be ${lt}D`);if(ot.kernelShape.length!==0&&ot.kernelShape.length!==rt[1].dims.length-2)throw new Error("invalid kernel shape");if(ot.outputShape.length!==0&&ot.outputShape.length!==rt[0].dims.length-2)throw new Error("invalid output shape");if(rt[0].type!=="float32"||rt[1].type!=="float32")throw new Error("ConvTranspose input(X,W) should be float tensor");if(rt.length===3&&rt[2].type!=="float32")throw new Error("ConvTranspose input(bias) should be float tensor")}},8138:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.parseConvAttributes=o.conv=o.calculateOutputShape=void 0;const a=s(246),_=s(2517),$=s(4770),_e=s(1386),tt=s(9828),st=s(2823),it=s(3248),nt=s(5623);o.calculateOutputShape=(lt,ut,ct,dt,ft)=>{const ht=lt[0],bt=lt.slice(2),yt=bt.length,mt=ut[0],gt=ut.slice(2).map((wt,Ct)=>wt+(wt-1)*(ct[Ct]-1)),vt=bt.map((wt,Ct)=>wt+dt[Ct]+dt[Ct+yt]).map((wt,Ct)=>Math.floor((wt-gt[Ct]+ft[Ct])/ft[Ct]));return[ht,mt].concat(...vt)},o.conv=(lt,ut,ct)=>(at(ut,ct),et(lt,ut,ct));const et=(lt,ut,ct)=>{const dt=ot(ct,ut),ft=lt.session.pack,ht=dt.kernelShape[0]===1&&dt.kernelShape[1]===1;return dt.group>1?[lt.run((0,$.createUnpackedGroupedConvProgramInfoLoader)(lt,ut,dt),ut)]:ht&&ft?[j(lt,ut,dt)]:ft&&ut[0].dims.length===4&&ut[0].dims[0]===1&&!ht?[(0,_e.conv2DPacked)(lt,ut,dt)]:[rt(lt,ut,dt)]},j=(lt,ut,ct)=>{const dt=ut[0].dims,ft=ut[1].dims,ht=(0,o.calculateOutputShape)(dt,ft,ct.dilations,ct.pads,ct.strides),bt=lt.reshapeUnpacked(ut[0],[dt[1],dt[2]*dt[3]]),yt=lt.reshapeUnpacked(ut[1],[ft[0],ft[1]]),mt=ut.length>2?[yt,bt,ut[2]]:[yt,bt],gt=lt.run((0,nt.createMatmulProgramInfoLoader)(mt,ct),mt);return lt.reshapeUnpacked(gt,ht)},rt=(lt,ut,ct)=>{const dt=ut[0].dims,ft=ut[1].dims,ht=(0,o.calculateOutputShape)(dt,ft,ct.dilations,ct.pads,ct.strides),bt=lt.run((0,it.createIm2ColProgramInfoLoader)(lt,ut[0],ut[1],ht,ct),[ut[0]]),yt=ut.length===3?[bt,ut[1],ut[2]]:[bt,ut[1]];return lt.run((0,tt.createDotProductProgramInfoLoader)(lt,ut,ht,ct),yt)},ot=(lt,ut)=>{const ct=lt.kernelShape.slice();if(lt.kernelShape.length===0)for(let ht=2;ht{const ut=lt.attributes,ct=(0,st.parseInternalActivationAttributes)(ut),dt=ut.getString("auto_pad","NOTSET"),ft=ut.getInts("dilations",[1,1]),ht=ut.getInt("group",1),bt=ut.getInts("kernel_shape",[]),yt=ut.getInts("pads",[0,0,0,0]),mt=ut.getInts("strides",[1,1]);return(0,a.createAttributeWithCacheKey)(Object.assign({autoPad:dt,dilations:ft,group:ht,kernelShape:bt,pads:yt,strides:mt},ct))};const at=(lt,ut)=>{if(!lt||lt.length!==2&<.length!==3)throw new Error("Conv requires 2 or 3 inputs");if(lt[0].dims.length!==4||lt[1].dims.length!==4)throw new Error("currently only support 2-dimensional conv");if(lt[0].dims[1]!==lt[1].dims[1]*ut.group)throw new Error("FILTER_IN_CHANNEL should be equal to DATA_CHANNEL");if(lt.length===3&&(lt[2].dims.length!==1||lt[1].dims[0]!==lt[2].dims[0]))throw new Error("invalid bias");const ct=lt[0].dims.length-2;if(ut.dilations.length!==ct)throw new Error(`dilations should be ${ct}D`);if(ut.strides.length!==ct)throw new Error(`strides should be ${ct}D`);if(ut.pads.length!==2*ct)throw new Error(`pads should be ${2*ct}D`);if(ut.kernelShape.length!==0&&ut.kernelShape.length!==lt[1].dims.length-2)throw new Error("invalid kernel shape");if(lt[0].type!=="float32"||lt[1].type!=="float32")throw new Error("Conv input(X,W) should be float tensor");if(lt.length===3&<[2].type!=="float32")throw new Error("Conv input(bias) should be float tensor")}},5193:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.parseDepthToSpaceAttributes=o.depthToSpace=void 0;const a=s(3738);o.depthToSpace=($,_e,tt)=>{_(_e);const st=tt.blocksize,it=st*st,nt=tt.mode==="DCR"?[0,3,4,1,5,2]:[0,1,4,2,5,3],et=tt.mode==="DCR"?[_e[0].dims[0],st,st,_e[0].dims[1]/it,_e[0].dims[2],_e[0].dims[3]]:[_e[0].dims[0],_e[0].dims[1]/it,st,st,_e[0].dims[2],_e[0].dims[3]],j=$.reshapeUnpacked(_e[0],et),rt={perm:nt,cacheKey:`${nt}`},[ot]=(0,a.transpose)($,[j],rt),at=[_e[0].dims[0],_e[0].dims[1]/it,_e[0].dims[2]*st,_e[0].dims[3]*st];return[$.reshapeUnpacked(ot,at)]},o.parseDepthToSpaceAttributes=$=>{const _e=$.attributes.getInt("blocksize");if(_e<1)throw new Error(`blocksize must be >= 1, but got : ${_e} for DepthToSpace`);const tt=$.attributes.getString("mode","DCR");if(tt!=="DCR"&&tt!=="CRD")throw new Error(`unrecognized mode: ${tt} for DepthToSpace`);return{mode:tt,blocksize:_e}};const _=$=>{if($.length!==1)throw new Error(`DepthToSpace expect 1 inputs, but got ${$.length}`);if($[0].type==="string"||$[0].dims.length!==4)throw new TypeError("DepthToSpace input should be a 4-D numeric tensor")}},9828:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createDotProductProgramInfoLoader=void 0;const a=s(2517),_=s(5060),$=s(2039),_e=s(2823),tt=s(3248);o.createDotProductProgramInfoLoader=(st,it,nt,et)=>{const j=((rt,ot)=>({name:"ConvDotProduct",inputNames:rt?["Im2Col","K","B"]:["Im2Col","K"],inputTypes:rt?[$.TextureType.unpacked,$.TextureType.packedLastDimension,$.TextureType.unpacked]:[$.TextureType.unpacked,$.TextureType.packedLastDimension],cacheKey:ot.activationCacheKey}))(it.length>2,et);return Object.assign(Object.assign({},j),{get:()=>((rt,ot,at,lt,ut)=>{const ct=at[0].dims,dt=at[1].dims,ft=[dt[0],Math.ceil(ct[1]*dt[2]*dt[3]/4)],ht=(0,tt.calculateIm2ColDims)(ct,dt,lt),[bt,yt]=rt.calculateTextureWidthAndHeight(ft,$.TextureType.packedLastDimension),mt=a.ShapeUtil.computeStrides(ht),[gt,vt]=rt.calculateTextureWidthAndHeight(ht,$.TextureType.packedLastDimension),wt=lt.length,Ct=at.length<3?"0.0":"_B(b)",kt=Math.ceil(ct[1]*dt[2]*dt[3]/4),{activationFunction:It,applyActivation:Pt}=(0,_e.getActivationSnippet)(ut),St=(0,_.getGlsl)(rt.session.backend.glContext.version),Rt=` +${It} +float process(int indices[${wt}]) { + int b[1]; + b[0] = indices[1]; + int im2col[4]; + im2col[0] = indices[0]; + im2col[1] = indices[2]; + im2col[2] = indices[3]; + int im2colOffset = im2col[0] * ${mt[0]} + im2col[1] * ${mt[1]} + im2col[2] * ${mt[2]}; + int kernelOffset = indices[1] * ${ft[1]}; + float value = ${Ct}; + for (int i = 0; i < ${kt}; ++i) { + vec2 im2colCoords = offsetToCoords(im2colOffset, ${gt}, ${vt}); + vec2 kernelCoords = offsetToCoords(kernelOffset, ${bt}, ${yt}); + value += dot(${St.texture2D}(Im2Col, im2colCoords), ${St.texture2D}(K, kernelCoords)); + ++im2colOffset; + ++kernelOffset; + } + ${Pt} + return value; +}`;return Object.assign(Object.assign({},ot),{output:{dims:lt,type:at[0].type,textureType:$.TextureType.unpacked},shaderSource:Rt})})(st,j,it,nt,et)})}},7992:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.parseFlattenAttributes=o.flatten=void 0;const a=s(2517);o.flatten=($,_e,tt)=>{_(_e,tt);const st=a.ShapeUtil.flattenShape(_e[0].dims,tt);return[$.reshapeUnpacked(_e[0],st)]},o.parseFlattenAttributes=$=>$.attributes.getInt("axis",1);const _=($,_e)=>{if(!$||$.length!==1)throw new Error("Flatten requires 1 input.");const tt=$[0].dims.length;if(tt===0)throw new Error("scalar tensor is not supported.");if(_e<-tt||_e>tt)throw new Error("Invalid axis");if($[0].type==="string")throw new Error("string tensor is not supported.")}},2823:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.parseInternalActivationAttributes=o.getActivationSnippet=void 0;const a=s(2517),_=s(4909);o.getActivationSnippet=function($){let _e;switch($.activation){case"Relu":_e=(0,_.glslRelu)();break;case"Sigmoid":_e=(0,_.glslSigmoid)();break;case"Clip":_e=(0,_.glslClip)($.clipMin,$.clipMax);break;default:return{activationFunction:"",applyActivation:""}}const tt=_e.name;return{activationFunction:_e.body,applyActivation:`value = ${tt}_(value);`}},o.parseInternalActivationAttributes=$=>{const _e=$.getString("activation","");if(_e==="Clip"){const[tt,st]=$.getFloats("activation_params",[a.MIN_CLIP,a.MAX_CLIP]);return{activation:_e,clipMax:st,clipMin:tt,activationCacheKey:`${_e}:${tt},${st}`}}return{activation:_e,activationCacheKey:_e}}},1253:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.parseGatherAttributes=o.gather=void 0;const a=s(246),_=s(782),$=s(2517),_e=s(2039);o.gather=(nt,et,j)=>(it(et,j.axis),[nt.run(st(nt,et,j),et)]),o.parseGatherAttributes=nt=>(0,a.createAttributeWithCacheKey)({axis:nt.attributes.getInt("axis",0)});const tt={name:"Gather",inputNames:["A","B"],inputTypes:[_e.TextureType.unpacked,_e.TextureType.unpacked]},st=(nt,et,j)=>{const rt=Object.assign(Object.assign({},tt),{cacheHint:j.cacheKey});return Object.assign(Object.assign({},rt),{get:()=>((ot,at,lt,ut)=>{const ct=lt[0].dims.slice(),dt=lt[1].dims.slice(),ft=new Array(ct.length+dt.length-1);ut=$.ShapeUtil.normalizeAxis(ut,ct.length);const ht=[];for(let yt=0;yt{if(!nt||nt.length!==2)throw new Error("Gather requires 2 inputs.");const j=nt[0].dims.length;if(j<1)throw new Error("Invalid input shape.");if(et<-j||et>j-1)throw new Error("Invalid axis.");if(_.NUMBER_TYPES.indexOf(nt[0].type)===-1)throw new Error("Invaid input type.");if(nt[1].type!=="int32"&&nt[1].type!=="int16")throw new Error("Invaid input type.")}},4776:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.parseGemmAttributesV11=o.parseGemmAttributesV7=o.gemm=void 0;const a=s(246),_=s(2517),$=s(2039);o.gemm=(nt,et,j)=>(it(et,j),[nt.run(tt(et,j),et)]);const _e=(nt,et)=>{const j=nt.attributes.getInt("transA",0)!==0,rt=nt.attributes.getInt("transB",0)!==0,ot=nt.attributes.getFloat("alpha",1),at=nt.attributes.getFloat("beta",1);return(0,a.createAttributeWithCacheKey)({transA:j,transB:rt,alpha:ot,beta:at,isOptionalC:et})};o.parseGemmAttributesV7=nt=>_e(nt,!1),o.parseGemmAttributesV11=nt=>_e(nt,!0);const tt=(nt,et)=>{const j={name:"Gemm",inputNames:nt.length===3?["A","B","C"]:["A","B"],inputTypes:nt.length===3?[$.TextureType.unpacked,$.TextureType.unpacked,$.TextureType.unpacked]:[$.TextureType.unpacked,$.TextureType.unpacked],key:et.cacheKey};return Object.assign(Object.assign({},j),{get:()=>st(j,nt,et)})},st=(nt,et,j)=>{const rt=et[0].dims.slice(),ot=et[1].dims.slice(),[at,lt]=_.GemmUtil.getShapeOfGemmResult(rt,j.transA,ot,j.transB,et.length===3?et[2].dims:void 0),ut=[at,lt];if(!ut)throw new Error("Can't use gemm on the given tensors");let ct=rt[rt.length-1],dt="";j.transA&&(ct=rt[0]),j.transA&&j.transB?dt="value += _A_T(a) * _B_T(b);":j.transA&&!j.transB?dt="value += _A_T(a) * _B(b);":!j.transA&&j.transB?dt="value += _A(a) * _B_T(b);":j.transA||j.transB||(dt="value += _A(a) * _B(b);");const ft=ut.length,ht=` + float process(int indices[${ft}]) { + int a[${ft}]; + int b[${ft}]; + ${et.length===3?`int c[${et[2].dims.length}];`:""} + + copyVec(indices, a); + copyVec(indices, b); + ${et.length===3?"bcastIndices_C(indices, c);":""} + + float value = 0.0; + for (int k=0; k<${ct}; ++k) { + a[${ft-1}] = k; + b[${ft-2}] = k; + ${dt} + } + + value = value * alpha; + ${et.length===3?"value += beta * _C(c);":""} + return value; + }`;return Object.assign(Object.assign({},nt),{output:{dims:ut,type:et[0].type,textureType:$.TextureType.unpacked},variables:[{name:"alpha",type:"float",data:j.alpha},{name:"beta",type:"float",data:j.beta}],shaderSource:ht})},it=(nt,et)=>{if(!nt)throw new Error("Input is missing");if(et.isOptionalC&&(nt.length<2||nt.length>3))throw new Error("Invaid input shape.");if(!et.isOptionalC&&nt.length!==3)throw new Error("Gemm requires 3 inputs");if(nt.length===3&&nt[2].dims.length!==1&&nt[2].dims.length!==2)throw new Error("Invalid input shape of C");if(nt[0].type!=="float32"&&nt[0].type!=="float64"||nt[1].type!=="float32"&&nt[1].type!=="float64"||nt.length===3&&nt[2].type!=="float32"&&nt[2].type!=="float64")throw new Error("Invalid input type.");if(nt[0].type!==nt[1].type||nt.length===3&&nt[0].type!==nt[2].type)throw new Error("Input types are mismatched")}},8555:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createPackedIm2ColProgramInfoLoader=void 0;const a=s(5060),_=s(2039),$=s(2827);o.createPackedIm2ColProgramInfoLoader=(_e,tt,st,it,nt)=>{const et=(j=nt.cacheKey,{name:"Im2Col (packed)",inputNames:["A"],inputTypes:[_.TextureType.packed],cacheHint:j});var j;return Object.assign(Object.assign({},et),{get:()=>((rt,ot,at,lt,ut,ct)=>{const dt=at.dims,ft=lt.dims,ht=ut.length,bt=[ft[1]*ft[2]*ft[3],ut[2]*ut[3]],yt=ft[2]*ft[3],mt=(0,$.unpackFromChannel)(),gt=(0,a.getGlsl)(rt.session.backend.glContext.version);let vt="";for(let Ct=0;Ct<=1;Ct++)for(let kt=0;kt<=1;kt++)vt+=` + blockIndex = rc.x + ${kt}; + pos = rc.y + ${Ct}; + + if(blockIndex < ${bt[1]} && pos < ${bt[0]}) { + offsetY = int(blockIndex / (${ut[ht-1]})) * ${ct.strides[0]} - + ${ct.pads[0]}; + d0 = offsetY + ${ct.dilations[0]} * (imod(pos, ${yt}) / ${ft[2]}); + + if(d0 < ${dt[2]} && d0 >= 0) { + offsetX = imod(blockIndex, ${ut[ht-1]}) * ${ct.strides[1]} - + ${ct.pads[1]}; + d1 = offsetX + ${ct.dilations[1]} * imod(imod(pos, ${yt}), ${ft[2]}); + + if(d1 < ${dt[3]} && d1 >= 0) { + + ch = int(float(pos)/ ${yt}.); + innerDims = vec2(d0, d1); + result[${2*Ct+kt}] = getChannel( + getA(0, ch, int(innerDims.x), + int(innerDims.y)), innerDims); + } + } + } + + `;const wt=` + ${mt} + + void main() { + ivec2 rc = getOutputCoords(); + vec4 result = vec4(0.0); + int blockIndex, pos, offsetY, d0, offsetX, d1, ch; + vec2 innerDims; + ${vt} + ${gt.output} = result; + } + `;return Object.assign(Object.assign({},ot),{output:{dims:bt,type:at.type,textureType:_.TextureType.packed},shaderSource:wt,hasMain:!0})})(_e,et,tt,st,it,nt)})}},3248:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.calculateIm2ColDims=o.createIm2ColProgramInfoLoader=void 0;const a=s(2039);o.createIm2ColProgramInfoLoader=(_,$,_e,tt,st)=>{const it=(nt=st.cacheKey,{name:"Im2Col",inputNames:["X"],inputTypes:[a.TextureType.unpacked],cacheHint:nt});var nt;return Object.assign(Object.assign({},it),{get:()=>((et,j,rt,ot,at,lt)=>{const ut=rt.dims,ct=ot.dims,dt=at.length,ft=(0,o.calculateIm2ColDims)(ut,ct,at,4),ht=` + const int XC = ${ut[1]}; + const int XH = ${ut[2]}; + const int XW = ${ut[3]}; + const int KH = ${lt.kernelShape[0]}; + const int KW = ${lt.kernelShape[1]}; + const int dilationH = ${lt.dilations[0]}; + const int dilationW = ${lt.dilations[1]}; + const int strideH = ${lt.strides[0]}; + const int strideW = ${lt.strides[1]}; + const int padH = ${lt.pads[0]}; + const int padW = ${lt.pads[1]}; + const int KHKW = KH*KW; + const int XCKHKW = XC * KHKW; + const int outputChannels = 4; + vec4 process(int indices[${dt}]) { + int b = indices[0]; // batch size + int oh = indices[1] * strideH - padH; //output height + int ow = indices[2] * strideW - padW; //output width + int p = indices[3] * outputChannels; //patch + vec4 value = vec4(0.0); + for(int i=0; i < outputChannels; ++i) { + if(p < XCKHKW) { + int patchC = p / KHKW; + int patchH = (p - patchC*KHKW) / KW; + int patchW = (p - patchC*KHKW) - patchH * KW; + int xh2 = oh + patchH * dilationH; + int xw2 = ow + patchW * dilationW; + int x[${ut.length}]; + x[0] = b; + x[1] = patchC; + x[2] = xh2; + x[3] = xw2; + if(xh2 >= 0 && + xh2 < XH && + xw2 >= 0 && + xw2 < XW) { + value[i] = _X(x); + } + } + ++p; + } + return value; + } + `;return Object.assign(Object.assign({},j),{output:{dims:ft,type:rt.type,textureType:a.TextureType.packedLastDimension},shaderSource:ht})})(0,it,$,_e,tt,st)})},o.calculateIm2ColDims=(_,$,_e,tt=4)=>[_e[0],_e[2],_e[3],Math.ceil(_[1]*$[2]*$[3]/tt)]},6572:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.parseImageScalerAttributes=o.imageScaler=void 0;const a=s(246),_=s(2039);o.imageScaler=(it,nt,et)=>(st(nt),[it.run(_e(it,nt,et),nt)]),o.parseImageScalerAttributes=it=>{const nt=it.attributes.getFloat("scale"),et=it.attributes.getFloats("bias");return(0,a.createAttributeWithCacheKey)({scale:nt,bias:et})};const $={name:"ImageScaler",inputNames:["X"],inputTypes:[_.TextureType.unpacked]},_e=(it,nt,et)=>{const j=Object.assign(Object.assign({},$),{cacheHint:et.cacheKey});return Object.assign(Object.assign({},j),{get:()=>((rt,ot,at,lt)=>{const ut=at[0].dims.slice(),ct=ut.length,dt=` + ${tt(lt.bias.length)} + float process(int indices[${ct}]) { + return _X(indices) * scale + getBias(bias, indices[1]); + }`;return Object.assign(Object.assign({},ot),{output:{dims:ut,type:at[0].type,textureType:_.TextureType.unpacked},variables:[{name:"bias",type:"float",arrayLength:lt.bias.length,data:lt.bias},{name:"scale",type:"float",data:lt.scale}],shaderSource:dt})})(0,j,nt,et)})},tt=it=>{const nt=[`float getBias(float bias[${it}], int channel) {`];for(let et=0;et{if(!it||it.length!==1)throw new Error("ImageScaler requires 1 input.");if(it[0].dims.length!==4)throw new Error("Invalid input shape.");if(it[0].type!=="float32"&&it[0].type!=="float64")throw new Error("Invalid input type.")}},3346:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.parseInstanceNormalizationAttributes=o.instanceNormalization=void 0;const a=s(5060),_=s(2039);o.instanceNormalization=(nt,et,j)=>{it(et);const rt=nt.run(_e(et[0]),et);return[nt.run(st(nt,et[0],j,rt.dims),[et[0],rt,et[1],et[2]])]},o.parseInstanceNormalizationAttributes=nt=>nt.attributes.getFloat("epsilon",1e-5);const $={name:"InstanceNormalization_MeanAndVariance",inputNames:["X"],inputTypes:[_.TextureType.unpacked]},_e=nt=>Object.assign(Object.assign({},$),{get:()=>((et,j)=>{const rt=j.dims.slice(),ot=rt[1],at=rt[2]*rt[3],lt=[rt[0],ot],ut=` + vec4 process(int[2] indices) { + vec4 v = vec4(0.0); + int a[4]; + a[0] = indices[0]; + a[1] = indices[1]; + float temp = 0.0; + for(int a2=0; a2<${rt[2]}; a2++) { + a[2] = a2; + for(int a3=0; a3<${rt[3]}; a3++) { + a[3] = a3; + float x = _X(a); + temp += x; + } + } + float mean = temp / float(${at}); + temp = 0.0; + for(int a2=0; a2<${rt[2]}; a2++) { + a[2] = a2; + for(int a3=0; a3<${rt[3]}; a3++) { + a[3] = a3; + float x = _X(a); + temp += (x - mean) * (x - mean); + } + } + v.r = mean; + v.g = temp / float(${at}); + + return v; + }`;return Object.assign(Object.assign({},et),{output:{dims:lt,type:j.type,textureType:_.TextureType.packedLastDimension},shaderSource:ut})})($,nt)}),tt={name:"InstanceNormalization_ComputeOutput",inputNames:["X","MeanAndVariance","Scale","B"],inputTypes:[_.TextureType.unpacked,_.TextureType.packedLastDimension,_.TextureType.unpacked,_.TextureType.unpacked]},st=(nt,et,j,rt)=>{const ot=Object.assign(Object.assign({},tt),{cacheHint:`${j}`});return Object.assign(Object.assign({},ot),{get:()=>((at,lt,ut,ct,dt)=>{const ft=(0,a.getGlsl)(at.session.backend.glContext.version),[ht,bt]=at.calculateTextureWidthAndHeight(dt,_.TextureType.packedLastDimension),[yt,mt]=[ht/4,bt],gt=` + vec4 get_MeanAndVariance(int[2] mv) { + int offset = indicesToOffset_MeanAndVariance(mv); + vec2 coords = offsetToCoords(offset, ${yt}, ${mt}); + return ${ft.texture2D}(MeanAndVariance, coords); + } + + float process(int[4] indices) { + int mv[2]; + mv[0] = indices[0]; + mv[1] = indices[1]; + vec4 mean_and_variance = get_MeanAndVariance(mv); + float mean = mean_and_variance.r; + float variance = mean_and_variance.g; + + int sb[1]; + sb[0] = indices[1]; + float scale = _Scale(sb); + float b = _B(sb); + + return scale * (_X(indices) - mean) / sqrt(variance + epsilon) + b; + }`;return Object.assign(Object.assign({},lt),{output:{dims:ut.dims,type:ut.type,textureType:_.TextureType.unpacked},variables:[{name:"epsilon",type:"float",data:ct}],shaderSource:gt})})(nt,ot,et,j,rt)})},it=nt=>{if(!nt||nt.length!==3)throw new Error("InstanceNormalization requires 3 inputs.");const et=nt[0],j=nt[1],rt=nt[2];if(et.dims.length<3||j.dims.length!==1||rt.dims.length!==1)throw new Error("Invalid input shape.");if(j.dims[0]!==et.dims[1]||rt.dims[0]!==et.dims[1])throw new Error("Input shapes are mismatched.");if(et.type!=="float32"&&et.type!=="float64"||j.type!=="float32"&&j.type!=="float64"||rt.type!=="float32"&&rt.type!=="float64")throw new Error("Invalid input type.");if(nt[0].dims.length!==4)throw new Error("Only support 4-D input shape.")}},708:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createPackedMatmulProgramInfoLoader=void 0;const a=s(2517),_=s(5060),$=s(2039),_e=s(9390),tt=s(2823),st=s(5623);o.createPackedMatmulProgramInfoLoader=(it,nt,et)=>{const j=(rt=nt.length>2,ot=et.activationCacheKey,{name:"MatMul (packed)",inputNames:rt?["A","B","Bias"]:["A","B"],inputTypes:rt?[$.TextureType.packed,$.TextureType.packed,$.TextureType.packed]:[$.TextureType.packed,$.TextureType.packed],cacheHint:ot});var rt,ot;return Object.assign(Object.assign({},j),{get:()=>((at,lt,ut,ct)=>{const dt=ut.length>2,ft=dt?"value += getBiasForMatmul();":"",ht=ut[0].dims,bt=ut[1].dims,yt=a.BroadcastUtil.calcShape(ht,bt,!0),mt=!a.ShapeUtil.areEqual(ut[0].dims,ut[1].dims);if(!yt)throw new Error("Can't use matmul on the given tensors");const gt=ht[ht.length-1],vt=Math.ceil(gt/2),wt=ht.length,Ct=bt.length,kt=(0,_.getGlsl)(at.session.backend.glContext.version),It=(0,_e.getCoordsDataType)(yt.length),Pt=yt.length,St=(0,_e.getGlChannels)(),{activationFunction:Rt,applyActivation:At}=(0,tt.getActivationSnippet)(ct),Mt=dt?`${(0,st.getBiasForMatmul)(It,St,ut[2].dims,yt,!0)}`:"",jt=mt?`${function(ar,Gt,Qt,tr){let Vt=[],Xt=[];const Zt=Qt[0].dims,cr=Qt[1].dims,pr=Zt.length,ir=cr.length,hr=tr.length,Rr=hr-pr,Or=hr-ir;Vt=Zt.map((Tr,Mr)=>`coords.${Gt[Mr+Rr]}`),Vt[pr-1]="i*2",Vt.join(", "),Xt=cr.map((Tr,Mr)=>`coords.${Gt[Mr+Or]}`),Xt[ir-2]="i*2",Xt.join(", ");const Fr=a.BroadcastUtil.getBroadcastDims(Zt,tr),zr=a.BroadcastUtil.getBroadcastDims(cr,tr),Gr=Fr.map(Tr=>`coords.${Gt[Tr+Rr]} = 0;`).join(` +`),jr=zr.map(Tr=>`coords.${Gt[Tr+Or]} = 0;`).join(` +`),Nr=`int lastDim = coords.${Gt[hr-1]}; + coords.${Gt[hr-1]} = coords.${Gt[hr-2]}; + coords.${Gt[hr-2]} = lastDim;`;return` +vec4 getAAtOutCoordsMatmul(int i) { + ${ar} coords = getOutputCoords(); + ${Nr} + ${Gr} + vec4 outputValue = getA(${Vt}); + return outputValue; +} + +vec4 getBAtOutCoordsMatmul(int i) { + ${ar} coords = getOutputCoords(); + ${Nr} + ${jr} + vec4 outputValue = getB(${Xt}); + return outputValue; +}`}(It,St,ut,yt)}`:"",Yt=mt?"getAAtOutCoordsMatmul(i)":`getA(${function(ar,Gt){let Qt="";for(let tr=0;tr{Object.defineProperty(o,"__esModule",{value:!0}),o.getBiasForMatmul=o.createMatmulProgramInfoLoader=o.parseMatMulAttributes=o.matMul=void 0;const a=s(2517),_=s(2039),$=s(9390),_e=s(2823),tt=s(708);function st(et,j){const rt=(ot=et.length>2,at=j.activationCacheKey,{name:"MatMul",inputNames:ot?["A","B","Bias"]:["A","B"],inputTypes:ot?[_.TextureType.unpacked,_.TextureType.unpacked,_.TextureType.unpacked]:[_.TextureType.unpacked,_.TextureType.unpacked],cacheHint:at});var ot,at;return Object.assign(Object.assign({},rt),{get:()=>function(lt,ut,ct){const dt=ut[0].dims,ft=ut[1].dims,ht=a.BroadcastUtil.calcShape(dt,ft,!0);if(!ht)throw new Error("Can't use matmul on the given tensors");const bt=(0,$.getCoordsDataType)(ht.length),yt=(0,$.getGlChannels)(),{activationFunction:mt,applyActivation:gt}=(0,_e.getActivationSnippet)(ct),vt=ut.length>2,wt=vt?"value += getBiasForMatmul();":"",Ct=vt?`${nt(bt,yt,ut[2].dims,ht,!1)}`:"",kt=ht.length,It=dt.length,Pt=ft.length,St=` + ${mt} + ${Ct} + float process(int indices[${kt}]) { + int a[${It}]; + int b[${Pt}]; + bcastMatmulIndices_A(indices, a); + bcastMatmulIndices_B(indices, b); + + float value; + for (int k=0; k<${dt[dt.length-1]}; ++k) { + a[${It-1}] = k; + b[${Pt-2}] = k; + value += _A(a) * _B(b); + } + ${wt} + ${gt} + return value; + }`;return Object.assign(Object.assign({},lt),{output:{dims:ht,type:ut[0].type,textureType:_.TextureType.unpacked},shaderSource:St})}(rt,et,j)})}o.matMul=(et,j,rt)=>(it(j),et.session.pack?[et.run((0,tt.createPackedMatmulProgramInfoLoader)(et,j,rt),j)]:[et.run(st(j,rt),j)]),o.parseMatMulAttributes=et=>(0,_e.parseInternalActivationAttributes)(et.attributes),o.createMatmulProgramInfoLoader=st;const it=et=>{if(!et||et.length!==2)throw new Error("MatMul requires 2 inputs.");if(et[0].dims[et[0].dims.length-1]!==et[1].dims[et[1].dims.length-2])throw new Error("shared dimension does not match.");if(et[0].type!=="float32"&&et[0].type!=="float64"||et[1].type!=="float32"&&et[1].type!=="float64")throw new Error("inputs should be float type");if(et[0].type!==et[1].type)throw new Error("inputs types should match")};function nt(et,j,rt,ot,at){let lt="";const ut=rt.length,ct=ot.length,dt=ct-ut;lt=ct<2&&ut>0?"coords":rt.map((bt,yt)=>`coords.${j[yt+dt]}`).join(", ");const ft=a.BroadcastUtil.getBroadcastDims(rt,ot).map(bt=>`coords.${j[bt+dt]} = 0;`).join(` +`);let ht="vec4(outputValue.xx, outputValue.yy)";return a.ShapeUtil.size(rt)===1&&(ht="vec4(outputValue.x)"),at?` +vec4 getBiasForMatmul() { + ${et} coords = getOutputCoords(); + ${ft} + vec4 outputValue = getBias(${lt}); + return ${ht}; +}`:` +float getBiasForMatmul() { + ${et} coords = getOutputCoords(); + ${ft} + return getBias(coords.x); +}`}o.getBiasForMatmul=nt},2403:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createPackProgramInfoLoader=void 0;const a=s(5060),_=s(2039),$=s(9390),_e=s(2827),tt={name:"pack",inputNames:["A"],inputTypes:[_.TextureType.unpackedReversed]};o.createPackProgramInfoLoader=(st,it)=>Object.assign(Object.assign({},tt),{get:()=>((nt,et)=>{const j=(0,a.getGlsl)(nt.session.backend.glContext.version),rt=et.dims,ot=rt.length,at=et.dims.length,lt=(0,$.getCoordsDataType)(at),ut=(0,_e.getChannels)("rc",at),ct=(dt=at,ft=ut,ht=rt[rt.length-2],bt=rt[rt.length-1],dt===0||dt===1?"":` + int r = ${ft[dt-2]}; + int c = ${ft[dt-1]}; + int rp1 = ${ft[dt-2]} + 1; + int cp1 = ${ft[dt-1]} + 1; + bool rEdge = rp1 >= ${bt}; + bool cEdge = cp1 >= ${ht}; + `);var dt,ft,ht,bt;let yt;yt=ot===0?[1,1]:ot===1?[rt[0],1]:[rt[at-1],rt[at-2]];const mt=function(wt,Ct,kt){if(wt===0)return"false";if(wt===1)return`rc > ${Ct[0]}`;let It="";for(let Pt=wt-2;Pt= ${Ct[Pt-wt+2]}`,Pt= ${wt[0]} ? 0. : getA(rc + 1), + 0, 0`;let It="";if(kt>2)for(let Pt=0;Pt{Object.defineProperty(o,"__esModule",{value:!0}),o.unpackFromChannel=o.getChannels=o.getVecChannels=void 0;const a=s(9390);function _($,_e){return(0,a.getGlChannels)(_e).map(tt=>`${$}.${tt}`)}o.getVecChannels=_,o.getChannels=function($,_e){return _e===1?[$]:_($,_e)},o.unpackFromChannel=function(){return` + float getChannel(vec4 frag, int dim) { + int modCoord = imod(dim, 2); + return modCoord == 0 ? frag.r : frag.g; + } + + float getChannel(vec4 frag, vec2 innerDims) { + vec2 modCoord = mod(innerDims, 2.); + return modCoord.x == 0. ? + (modCoord.y == 0. ? frag.r : frag.g) : + (modCoord.y == 0. ? frag.b : frag.a); + } + `}},2870:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.parsePadAttributesV11=o.padV11=o.parsePadAttributesV2=o.padV2=void 0;const a=s(246),_=s(2517),$=s(5060),_e=s(2039),tt={name:"Pad",inputNames:["A"],inputTypes:[_e.TextureType.unpacked]};o.padV2=(lt,ut,ct)=>(nt(ut),[lt.run(Object.assign(Object.assign({},tt),{cacheHint:ct.cacheKey,get:()=>it(lt,ut[0],ct)}),ut)]),o.parsePadAttributesV2=lt=>{const ut=lt.attributes.getString("mode","constant"),ct=lt.attributes.getFloat("value",0),dt=lt.attributes.getInts("pads");return(0,a.createAttributeWithCacheKey)({mode:ut,value:ct,pads:dt})},o.padV11=(lt,ut,ct)=>{et(ut);const dt=st(lt,ut,ct);return(0,o.padV2)(lt,[ut[0]],dt)},o.parsePadAttributesV11=lt=>lt.attributes.getString("mode","constant");const st=(lt,ut,ct)=>{if(!lt.session.isInitializer(ut[1].dataId)||ut.length>=3&&!lt.session.isInitializer(ut[2].dataId))throw new Error("dynamic pad attributes are not allowed");const dt=Array.from(ut[1].integerData),ft=ut.length>=3?ut[2].floatData[0]:0;return(0,a.createAttributeWithCacheKey)({mode:ct,pads:dt,value:ft})},it=(lt,ut,ct)=>{const dt=_.ShapeUtil.padShape(ut.dims.slice(),ct.pads),ft=dt.length,ht=` + ${j(lt,ut,ct)} + float process(int[${ft}] indices) { + return padA(indices); + }`;return{name:"Pad",inputNames:["A"],inputTypes:[_e.TextureType.unpacked],output:{dims:dt,type:ut.type,textureType:_e.TextureType.unpacked},shaderSource:ht}},nt=lt=>{if(!lt||lt.length!==1)throw new Error("Pad requires 1 input");if(lt[0].type!=="float32"&<[0].type!=="float64")throw new Error("Invalid input type.")},et=lt=>{if(!lt||lt.length!==2&<.length!==3)throw new Error("Pad requires 2 or 3 inputs");if(lt[1].type!=="int32")throw new Error("Invalid input type.");if(lt.length>=3&<[2].type==="string")throw new Error("Invalid input type.")},j=(lt,ut,ct)=>{const dt=(0,$.getGlsl)(lt.session.backend.glContext.version),[ft,ht]=lt.calculateTextureWidthAndHeight(ut.dims,_e.TextureType.unpacked),bt=_.ShapeUtil.computeStrides(ut.dims);switch(ct.mode){case"constant":return rt(dt,ut.dims,bt,ft,ht,ct.pads,ct.value);case"reflect":return ot(dt,ut.dims,bt,ft,ht,ct.pads);case"edge":return at(dt,ut.dims,bt,ft,ht,ct.pads);default:throw new Error("Invalid mode")}},rt=(lt,ut,ct,dt,ft,ht,bt)=>{const yt=ut.length;let mt="";for(let gt=yt-1;gt>=0;--gt)mt+=` + k = m[${gt}] - ${ht[gt]}; + if (k < 0) return constant; + if (k >= ${ut[gt]}) return constant; + offset += k * ${ct[gt]}; + `;return` + float padA(int m[${yt}]) { + const float constant = float(${bt}); + int offset = 0; + int k = 0; + ${mt} + vec2 coords = offsetToCoords(offset, ${dt}, ${ft}); + float value = getColorAsFloat(${lt.texture2D}(A, coords)); + return value; + } + `},ot=(lt,ut,ct,dt,ft,ht)=>{const bt=ut.length;let yt="";for(let mt=bt-1;mt>=0;--mt)yt+=` + k = m[${mt}] - ${ht[mt]}; + if (k < 0) { k = -k; } + { + const int _2n_1 = ${2*(ut[mt]-1)}; + k = int( mod( float(k), float(_2n_1) ) ) ; + if(k >= ${ut[mt]}) { k = _2n_1 - k; } + } + offset += k * ${ct[mt]}; + `;return` + float padA(int m[${bt}]) { + int offset = 0; + int k = 0; + ${yt} + vec2 coords = offsetToCoords(offset, ${dt}, ${ft}); + float value = getColorAsFloat(${lt.texture2D}(A, coords)); + return value; + } + `},at=(lt,ut,ct,dt,ft,ht)=>{const bt=ut.length;let yt="";for(let mt=bt-1;mt>=0;--mt)yt+=` + k = m[${mt}] - ${ht[mt]}; + if (k < 0) k = 0; + if (k >= ${ut[mt]}) k = ${ut[mt]-1}; + offset += k * ${ct[mt]}; + `;return` + float padA(int m[${bt}]) { + int offset = 0; + int k = 0; + ${yt} + vec2 coords = offsetToCoords(offset, ${dt}, ${ft}); + float value = getColorAsFloat(${lt.texture2D}(A, coords)); + return value; + } + `}},2143:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.globalMaxPool=o.parseMaxPoolAttributes=o.maxPool=o.parseGlobalAveragePoolAttributes=o.globalAveragePool=o.parseAveragePoolAttributes=o.averagePool=void 0;const a=s(246),_=s(2517),$=s(2039);o.averagePool=(at,lt,ut)=>{et(lt);const ct={name:"AveragePool",inputNames:["X"],inputTypes:[$.TextureType.unpacked],cacheHint:ut.cacheKey};return[at.run(Object.assign(Object.assign({},ct),{get:()=>_e(lt,ct,!1,ut)}),lt)]},o.parseAveragePoolAttributes=at=>{const lt=at.attributes.getString("auto_pad","NOTSET"),ut=at.attributes.getInt("ceil_mode",0),ct=at.attributes.getInt("count_include_pad",0)!==0,dt=at.attributes.getInts("kernel_shape"),ft=at.attributes.getInts("strides",[]),ht=at.attributes.getInts("pads",[]);if(ut!==0)throw new Error("using ceil() in shape computation is not yet supported for AveragePool");return(0,a.createAttributeWithCacheKey)({autoPad:lt,ceilMode:ut,countIncludePad:ct,kernelShape:dt,strides:ft,pads:ht})};const _e=(at,lt,ut,ct)=>{const[dt,ft]=st(at,ct,ut),ht=_.ShapeUtil.size(dt.kernelShape);let bt="";dt.countIncludePad?bt+=`value /= float(${ht});`:bt+=`value /= float(${ht} - pad);`;const yt=` + ${j(at[0].dims,dt,"value += _X(x);",bt,"0.0")} + `;return Object.assign(Object.assign({},lt),{output:{dims:ft,type:at[0].type,textureType:$.TextureType.unpacked},shaderSource:yt})};o.globalAveragePool=(at,lt,ut)=>{et(lt);const ct={name:"GlobalAveragePool",inputNames:["X"],inputTypes:[$.TextureType.unpacked],cacheHint:`${ut.countIncludePad}`};return[at.run(Object.assign(Object.assign({},ct),{get:()=>_e(lt,ct,!0,ut)}),lt)]},o.parseGlobalAveragePoolAttributes=at=>{const lt=at.attributes.getInt("count_include_pad",0)!==0;return(0,a.createAttributeWithCacheKey)({autoPad:"",ceilMode:0,countIncludePad:lt,kernelShape:[],strides:[],pads:[]})},o.maxPool=(at,lt,ut)=>{et(lt);const ct={name:"MaxPool",inputNames:["X"],inputTypes:[$.TextureType.unpacked],cacheHint:ut.cacheKey};return[at.run(Object.assign(Object.assign({},ct),{get:()=>tt(lt,ct,!1,ut)}),lt)]},o.parseMaxPoolAttributes=at=>{const lt=at.attributes.getString("auto_pad","NOTSET"),ut=at.attributes.getInt("ceil_mode",0),ct=at.attributes.getInts("kernel_shape"),dt=at.attributes.getInts("strides",[]),ft=at.attributes.getInts("pads",[]),ht=at.attributes.getInt("storage_order",0),bt=at.attributes.getInts("dilations",[]);if(ht!==0)throw new Error("column major storage order is not yet supported for MaxPool");if(ut!==0)throw new Error("using ceil() in shape computation is not yet supported for MaxPool");return(0,a.createAttributeWithCacheKey)({autoPad:lt,ceilMode:ut,countIncludePad:!1,kernelShape:ct,strides:dt,pads:ft,storageOrder:ht,dilations:bt})};const tt=(at,lt,ut,ct)=>{const[dt,ft]=st(at,ct,ut),ht=` + ${j(at[0].dims,dt,` + value = max(_X(x), value); + `,"","-1e5")} + `;return Object.assign(Object.assign({},lt),{output:{dims:ft,type:at[0].type,textureType:$.TextureType.unpacked},shaderSource:ht})},st=(at,lt,ut)=>{const ct=at[0].dims.slice(),dt=Object.hasOwnProperty.call(lt,"dilations"),ft=lt.kernelShape.slice(),ht=lt.strides.slice(),bt=dt?lt.dilations.slice():[],yt=lt.pads.slice();_.PoolConvUtil.adjustPoolAttributes(ut,ct,ft,ht,bt,yt);const mt=_.PoolConvUtil.computePoolOutputShape(ut,ct,ht,bt,ft,yt,lt.autoPad),gt=Object.assign({},lt);return dt?Object.assign(gt,{kernelShape:ft,strides:ht,pads:yt,dilations:bt,cacheKey:lt.cacheKey}):Object.assign(gt,{kernelShape:ft,strides:ht,pads:yt,cacheKey:lt.cacheKey}),[gt,mt]},it={autoPad:"",ceilMode:0,countIncludePad:!1,kernelShape:[],strides:[],pads:[],storageOrder:0,dilations:[],cacheKey:""},nt={name:"GlobalMaxPool",inputNames:["X"],inputTypes:[$.TextureType.unpacked]};o.globalMaxPool=(at,lt)=>(et(lt),[at.run(Object.assign(Object.assign({},nt),{get:()=>tt(lt,nt,!0,it)}),lt)]);const et=at=>{if(!at||at.length!==1)throw new Error("Pool ops requires 1 input.");if(at[0].type!=="float32"&&at[0].type!=="float64")throw new Error("Invalid input type.")},j=(at,lt,ut,ct,dt)=>{const ft=at.length;if(lt.kernelShape.length<=2){const ht=lt.kernelShape[lt.kernelShape.length-1],bt=lt.strides[lt.strides.length-1],yt=lt.pads[lt.pads.length/2-1],mt=lt.pads[lt.pads.length-1],gt=at[ft-1];let vt="",wt="",Ct="";if(vt=yt+mt!==0?` + for (int i = 0; i < ${ht}; i++) { + x[${ft} - 1] = indices[${ft} - 1] * ${bt} - ${yt} + i; + if (x[${ft} - 1] < 0 || x[${ft} - 1] >= ${gt}) { + pad++; + continue; + } + ${ut} + }`:` + for (int i = 0; i < ${ht}; i++) { + x[${ft} - 1] = indices[${ft} - 1] * ${bt} - ${yt} + i; + ${ut} + }`,lt.kernelShape.length===2){const kt=lt.kernelShape[lt.kernelShape.length-2],It=lt.strides[lt.strides.length-2],Pt=lt.pads[lt.pads.length/2-2],St=lt.pads[lt.pads.length-2],Rt=at[ft-2];wt=Pt+St!==0?` + for (int j = 0; j < ${kt}; j++) { + x[${ft} - 2] = indices[${ft} - 2] * ${It} - ${Pt} + j; + if (x[${ft} - 2] < 0 || x[${ft} - 2] >= ${Rt}) { + pad+= ${ht}; + continue; + } + `:` + for (int j = 0; j < ${kt}; j++) { + x[${ft} - 2] = indices[${ft} - 2] * ${It} - ${Pt} + j; + `,Ct=` + } + `}return` + float process(int indices[${ft}]) { + int x[${ft}]; + copyVec(indices, x); + + float value = ${dt}; + int pad = 0; + ${wt} + ${vt} + ${Ct} + ${ct} + return value; + } + `}{const ht=_.ShapeUtil.size(lt.kernelShape),bt=_.ShapeUtil.computeStrides(lt.kernelShape),yt=bt.length,mt=lt.pads.length,gt=ot(yt),vt=rt(at,"inputDims"),wt=rt(lt.pads,"pads"),Ct=rt(bt,"kernelStrides"),kt=rt(lt.strides,"strides");let It="";return It=lt.pads.reduce((Pt,St)=>Pt+St)?` + if (x[j] >= inputDims[j] || x[j] < 0) { + pad++; + isPad = true; + break; + } + } + if (!isPad) { + ${ut} + }`:` + } + ${ut} + `,` + ${gt} + float process(int indices[${ft}]) { + int x[${ft}]; + copyVec(indices, x); + int offset[${yt}]; + int pads[${mt}]; + int inputDims[${ft}]; + int kernelStrides[${yt}]; + int strides[${yt}]; + ${wt} + ${vt} + ${kt} + ${Ct} + + float value = ${dt}; + int pad = 0; + bool isPad = false; + for (int i = 0; i < ${ht}; i++) { + offsetToIndices(i, kernelStrides, offset); + isPad = false; + for (int j = ${ft} - ${yt}; j < ${ft}; j++) { + x[j] = indices[j] * strides[j - ${ft} + ${yt}] + + offset[j - ${ft} + ${yt}] - pads[j - 2]; + ${It} + } + ${ct} + + return value; + } + `}},rt=(at,lt)=>{let ut="";for(let ct=0;ct` + void offsetToIndices(int offset, int[${at}] strides, out int[${at}] indices) { + if (${at} == 0) { + return; + } + for (int i = 0; i < ${at} - 1; ++i) { + indices[i] = offset / strides[i]; + offset -= indices[i] * strides[i]; + } + indices[${at} - 1] = offset; + }`},4939:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.reduceLogSumSquare=o.reduceLogSum=o.reduceProd=o.reduceMin=o.reduceMax=o.reduceMean=o.reduceSum=o.parseReduceAttributes=void 0;const a=s(246),_=s(782),$=s(2517),_e=s(2039),tt=(nt,et,j,rt,ot)=>{it(et);const at={name:rt,inputNames:["A"],inputTypes:[_e.TextureType.unpacked]};return[nt.run(Object.assign(Object.assign({},at),{cacheHint:j.cacheKey,get:()=>st(nt,et,j,rt,ot,at)}),et)]};o.parseReduceAttributes=nt=>{const et=nt.attributes.getInts("axes",[]),j=nt.attributes.getInt("keepdims",1)===1;return(0,a.createAttributeWithCacheKey)({axes:et,keepDims:j})};const st=(nt,et,j,rt,ot,at)=>{const lt=[],ut=et[0].dims.length||1,ct=[],dt=$.ShapeUtil.normalizeAxes(j.axes,et[0].dims.length),ft=ot(et,dt);let ht=ft[1];for(let yt=0;yt=0||dt.length===0?(j.keepDims&<.push(1),ht=` + for(int j${yt} = 0; j${yt} < ${et[0].dims[yt]}; j${yt}++) { + inputIdx[${yt}] = j${yt}; + ${ht} + }`):(ct.push(`inputIdx[${yt}] = outputIdx[${lt.length}];`),lt.push(et[0].dims[yt]));const bt=` + float process(int outputIdx[${lt.length||1}]) { + float value; // final result + int inputIdx[${ut}]; // addressing input data + ${ct.join(` +`)} + ${ft[0]} // init ops for reduce max/min + ${ht} + ${ft[2]} // final computation for reduce mean + return value; + }`;return Object.assign(Object.assign({},at),{output:{dims:lt,type:et[0].type,textureType:_e.TextureType.unpacked},shaderSource:bt})},it=nt=>{if(!nt||nt.length!==1)throw new Error("Reduce op requires 1 input.");if(_.NUMBER_TYPES.indexOf(nt[0].type)===-1)throw new Error("Invalid input type.")};o.reduceSum=(nt,et,j)=>tt(nt,et,j,"ReduceSum",()=>["value = 0.0;","value += _A(inputIdx);",""]),o.reduceMean=(nt,et,j)=>tt(nt,et,j,"ReduceMean",(rt,ot)=>{let at=1;for(let lt=0;lt=0||ot.length===0)&&(at*=rt[0].dims[lt]);return["value = 0.0;","value += _A(inputIdx);",`value /= ${at}.;`]}),o.reduceMax=(nt,et,j)=>tt(nt,et,j,"ReduceMax",(rt,ot)=>{const at=[];for(let lt=0;lt=0||ot.length===0)&&at.push(`inputIdx[${lt}] = 0;`);return[`${at.join(` +`)} +value = _A(inputIdx);`,"value = max(value, _A(inputIdx));",""]}),o.reduceMin=(nt,et,j)=>tt(nt,et,j,"ReduceMin",(rt,ot)=>{const at=[];for(let lt=0;lt=0||ot.length===0)&&at.push(`inputIdx[${lt}] = 0;`);return[`${at.join(` +`)} +value = _A(inputIdx);`,"value = min(value, _A(inputIdx));",""]}),o.reduceProd=(nt,et,j)=>tt(nt,et,j,"ReduceProd",()=>["value = 1.0;","value *= _A(inputIdx);",""]),o.reduceLogSum=(nt,et,j)=>tt(nt,et,j,"ReduceLogSum",()=>["value = 0.0;","value += _A(inputIdx);","value = log(value);"]),o.reduceLogSumSquare=(nt,et,j)=>tt(nt,et,j,"ReduceLogSumSquare",()=>["float t; value = 0.0;","t = _A(inputIdx); value += t * t;",""])},7019:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.isReshapeCheap=o.processDims3D=o.createPackedReshape3DProgramInfoLoader=void 0;const a=s(2517),_=s(5060),$=s(2039),_e=s(2827);o.createPackedReshape3DProgramInfoLoader=(tt,st,it)=>{const nt=(et=>({name:"Reshape (packed)",inputTypes:[$.TextureType.packed],inputNames:["A"],cacheHint:`${et}`}))(it);return Object.assign(Object.assign({},nt),{get:()=>((et,j,rt,ot)=>{const at=j.dims,lt=ot;let ut="";for(let ft=0;ft<4;ft++){let ht="";switch(ft){case 0:ht="outputCoords = rc;";break;case 1:ht="outputCoords = ivec3(rc.x, rc.y+1, rc.z);";break;case 2:ht="outputCoords = ivec3(rc.x, rc.y, rc.z+1);";break;case 3:ht="outputCoords = ivec3(rc.x, rc.y+1, rc.z+1);";break;default:throw new Error}ut+=` + ${ht} + ${ft>0?"if(outputCoords.y < rows && outputCoords.z < cols){":""} + int flattenedIndex = getFlattenedIndex(outputCoords); + + ivec3 inputRC = inputCoordsFromReshapedOutCoords(flattenedIndex); + vec2 innerDims = vec2(float(inputRC.y),float(inputRC.z)); + + result[${ft}] = getChannel(getA(inputRC.x, inputRC.y, inputRC.z), innerDims); + + ${ft>0?"}":""} + `}const ct=(0,_.getGlsl)(et.session.backend.glContext.version),dt=` + ${function(ft){const ht=a.ShapeUtil.computeStrides(ft),bt=["b","r","c"],yt="index";return` + ivec3 inputCoordsFromReshapedOutCoords(int index) { + ${ht.map((mt,gt)=>`int ${bt[gt]} = ${yt} / ${mt}; ${gt===ht.length-1?`int ${bt[gt+1]} = ${yt} - ${bt[gt]} * ${mt}`:`index -= ${bt[gt]} * ${mt}`};`).join("")} + return ivec3(b, r, c); + } + `}(at)} + ${function(ft){const ht=a.ShapeUtil.computeStrides(ft);return` + int getFlattenedIndex(ivec3 coords) { + // reverse y, z order + return coords.x * ${ht[0]} + coords.z * ${ht[1]} + coords.y; + } +`}(lt)} + ${(0,_e.unpackFromChannel)()} + + void main() { + ivec3 rc = getOutputCoords(); + + vec4 result = vec4(0.0); + + ivec3 outputCoords; + int rows = ${lt[2]}; + int cols = ${lt[1]}; + + ${ut} + ${ct.output} = result; + } + `;return Object.assign(Object.assign({},rt),{output:{dims:lt,type:j.type,textureType:$.TextureType.packed},shaderSource:dt,hasMain:!0})})(tt,st,nt,it)})},o.processDims3D=function(tt){if(tt.length===0)return[1,1,1];let st=1;for(let it=0;it1?tt[tt.length-2]:1,tt[tt.length-1]]},o.isReshapeCheap=function(tt,st){let it=!1;return it=tt.length===0||st.length===0||(tt.length<2||st.length<2?tt[tt.length-1]===st[st.length-1]:tt[tt.length-1]===st[st.length-1]&&tt[tt.length-2]===st[st.length-2]),it}},718:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.reshape=void 0;const a=s(2517);o.reshape=(_,$)=>{const _e=a.ShapeUtil.calculateReshapedDims($[0].dims,$[1].integerData);return _.session.pack?[_.reshapePacked($[0],_e)]:[_.reshapeUnpacked($[0],_e)]}},2268:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.parseResizeAttributesV11=o.parseResizeAttributesV10=o.resize=void 0;const a=s(5060),_=s(2039),$=s(9390),_e=s(2827),tt=s(9793),st={name:"Resize",inputNames:["A"],inputTypes:[_.TextureType.packed]};o.resize=(rt,ot,at)=>((0,tt.validateInputs)(ot,at),[rt.run(Object.assign(Object.assign({},st),{cacheHint:at.cacheKey,get:()=>it(rt,ot,at)}),ot)]),o.parseResizeAttributesV10=rt=>(0,tt.parseUpsampleAttributes)(rt,10),o.parseResizeAttributesV11=rt=>(0,tt.parseUpsampleAttributes)(rt,11);const it=(rt,ot,at)=>{const lt=(0,a.getGlsl)(rt.session.backend.glContext.version),[ut,ct]=nt(ot,at);if(ut.every(It=>It===1)&&at.coordinateTransformMode!=="tf_crop_and_resize")return Object.assign(Object.assign({},st),{output:{dims:ct,type:ot[0].type,textureType:_.TextureType.packed},hasMain:!0,shaderSource:`void main() { + vec4 v = ${lt.texture2D}(X, TexCoords); + ${lt.output} = v; + }`});const dt=ct.length;if(dt<2)throw new Error(`output dimension should be at least 2, but got ${dt}`);const ft=ct[dt-2],ht=ct[dt-1],bt=ot[0].dims;if(dt!==bt.length)throw new Error(`output dimension should match input ${bt.length}, but got ${dt}`);const yt=bt[dt-2],mt=bt[dt-1],gt=ut[dt-2],vt=ut[dt-1];let wt="";if(at.mode!=="linear")throw new Error(`resize (packed) does not support mode: '${at.mode}'`);switch(at.coordinateTransformMode){case"asymmetric":wt=` + vec4 getSourceFracIndex(ivec4 coords) { + return vec4(coords) / scaleWHWH; + } + `;break;case"half_pixel":wt=` + vec4 getSourceFracIndex(ivec4 coords) { + return (vec4(coords) + 0.5) / scaleWHWH - 0.5; + } + `;break;case"pytorch_half_pixel":wt=` + vec4 getSourceFracIndex(ivec4 coords) { + vec4 fcoords = vec4(coords); + return vec4( + ${ht}.0 > 1.0 ? (fcoords.x + 0.5) / scaleWHWH.x - 0.5 : 0.0, + ${ft}.0 > 1.0 ? (fcoords.y + 0.5) / scaleWHWH.y - 0.5 : 0.0, + ${ht}.0 > 1.0 ? (fcoords.z + 0.5) / scaleWHWH.z - 0.5 : 0.0, + ${ft}.0 > 1.0 ? (fcoords.w + 0.5) / scaleWHWH.w - 0.5 : 0.0 + ); + } + `;break;case"align_corners":wt=` + vec4 getSourceFracIndex(ivec4 coords) { + vec4 resized = vec4(${ht}.0 - 1.0, ${ft}.0 - 1.0, ${ht}.0 - 1.0, + ${ft}.0 - 1.0); + vec4 original = vec4(${mt}.0 - 1.0, ${yt}.0 - 1.0, ${mt}.0 - 1.0, + ${yt}.0 - 1.0); + vec4 new_scale = original / resized; + return vec4(coords) * new_scale; + } + `;break;default:throw new Error(`resize (packed) does not support coordinateTransformMode: '${at.coordinateTransformMode}'`)}const Ct=(0,$.getCoordsDataType)(dt),kt=` + const vec2 inputWH = vec2(${yt}.0, ${mt}.0); + const vec4 scaleWHWH = vec4(float(${gt}), float(${vt}), float(${gt}), float(${vt})); + ${(0,_e.unpackFromChannel)()} + ${wt} + float getAValue(int x10, int r, int c, int d) { + return getChannel(getA(x10, r, c, d), vec2(c, d)); + } + void main() { + ${Ct} rc = getOutputCoords(); + + int batch = rc[0]; + int depth = rc[1]; + + // retrieve the 4 coordinates that is used in the 4 packed output values. + ivec4 coords = ivec4(rc.wz, rc.w + 1, rc.z + 1); + + // calculate the source index in fraction + vec4 sourceFrac = getSourceFracIndex(coords); + + // get the lower and upper bound of the 4 values that will be packed into one texel. + ivec4 x00 = ivec4(max(sourceFrac.xy, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.xy))); + ivec4 x01 = ivec4(max(sourceFrac.xw, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.xw))); + ivec4 x10 = ivec4(max(sourceFrac.zy, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.zy))); + ivec4 x11 = ivec4(max(sourceFrac.zw, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.zw))); + + bool hasNextRow = rc.w < ${ft-1}; + bool hasNextCol = rc.z < ${ht-1}; + + // pack x00, x01, x10, x11's top-left corner into one vec4 structure + vec4 topLeft = vec4( + getAValue(batch, depth, x00.x, x00.y), + hasNextCol ? getAValue(batch, depth, x01.x, x01.y) : 0.0, + hasNextRow ? getAValue(batch, depth, x10.x, x10.y) : 0.0, + (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.x, x11.y) : 0.0); + + // pack x00, x01, x10, x11's top-right corner into one vec4 structure + vec4 topRight = vec4( + getAValue(batch, depth, x00.x, x00.w), + hasNextCol ? getAValue(batch, depth, x01.x, x01.w) : 0.0, + hasNextRow ? getAValue(batch, depth, x10.x, x10.w) : 0.0, + (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.x, x11.w) : 0.0); + + // pack x00, x01, x10, x11's bottom-left corner into one vec4 structure + vec4 bottomLeft = vec4( + getAValue(batch, depth, x00.z, x00.y), + hasNextCol ? getAValue(batch, depth, x01.z, x01.y) : 0.0, + hasNextRow ? getAValue(batch, depth, x10.z, x10.y) : 0.0, + (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.z, x11.y) : 0.0); + + // pack x00, x01, x10, x11's bottom-right corner into one vec4 structure + vec4 bottomRight = vec4( + getAValue(batch, depth, x00.z, x00.w), + hasNextCol ? getAValue(batch, depth, x01.z, x01.w) : 0.0, + hasNextRow ? getAValue(batch, depth, x10.z, x10.w) : 0.0, + (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.z, x11.w) : 0.0); + + // calculate the interpolation fraction on u and v direction + vec4 frac = vec4(sourceFrac) - floor(sourceFrac); + vec4 clampFrac = clamp(frac, vec4(0.0), vec4(1.0)); + + vec4 top = mix(topLeft, topRight, clampFrac.ywyw); + vec4 bottom = mix(bottomLeft, bottomRight, clampFrac.ywyw); + vec4 newValue = mix(top, bottom, clampFrac.xxzz); + + ${lt.output} = vec4(newValue); + } + `;return Object.assign(Object.assign({},st),{output:{dims:ct,type:ot[0].type,textureType:_.TextureType.packed},hasMain:!0,shaderSource:kt})},nt=(rt,ot)=>{const at=rt[0].dims;let lt,ut=ot.scales;if(ut.length===0){const dt=rt[ot.scalesInputIdx];if(dt&&dt.size!==0){if(rt[ot.sizesInputIdx])throw new Error("Only one of scales or sizes must be provided as input.");ut=et(dt,ot.mode,ot.isResize)}else{const ft=rt[ot.sizesInputIdx];if(!ft||ft.size===0)throw new Error("Either scales or sizes MUST be provided as input.");lt=Array.from(ft.integerData),ut=j(lt,at,ot.mode,ot.isResize)}}else if(rt[ot.sizesInputIdx])throw new Error("Only one of scales or sizes must be provided as input.");const ct=lt||at.map((dt,ft)=>Math.floor(dt*ut[ft]));return[ut,ct]},et=(rt,ot,at)=>{const lt=Array.from(rt.floatData);return(0,tt.scalesValidation)(lt,ot,at),lt},j=(rt,ot,at,lt)=>{const ut=ot.length,ct=new Array(ut);for(let dt=0,ft=ut;dt{Object.defineProperty(o,"__esModule",{value:!0}),o.shape=void 0;const a=s(9162);o.shape=($,_e)=>(_(_e),[new a.Tensor([_e[0].dims.length],"int32",void 0,void 0,new Int32Array(_e[0].dims))]);const _=$=>{if(!$||$.length!==1)throw new Error("Shape requires 1 input.")}},2278:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.sliceV10=o.parseSliceAttributes=o.slice=void 0;const a=s(246),_=s(782),$=s(2517),_e=s(2039),tt={name:"Slice",inputNames:["A"],inputTypes:[_e.TextureType.unpacked]};o.slice=(j,rt,ot)=>(it(rt),[j.run(Object.assign(Object.assign({},tt),{cacheHint:ot.cacheKey,get:()=>st(j,rt[0],ot)}),rt)]),o.parseSliceAttributes=j=>{const rt=j.attributes.getInts("starts"),ot=j.attributes.getInts("ends"),at=j.attributes.getInts("axes",[]);return(0,a.createAttributeWithCacheKey)({starts:rt,ends:ot,axes:at})};const st=(j,rt,ot)=>{const at=ot.axes.length===0?rt.dims.slice(0).map((bt,yt)=>yt):ot.axes,lt=$.ShapeUtil.normalizeAxes(at,rt.dims.length),ut=ot.starts.map((bt,yt)=>bt>rt.dims[lt[yt]]-1?rt.dims[lt[yt]]:$.ShapeUtil.normalizeAxis(bt,rt.dims[lt[yt]])),ct=ot.ends.map((bt,yt)=>bt>rt.dims[lt[yt]]-1?rt.dims[lt[yt]]:$.ShapeUtil.normalizeAxis(bt,rt.dims[lt[yt]])),dt=rt.dims.slice(),ft=[];for(let bt=0;bt0&&ft.push(`outputIdx[${lt[bt]}] += ${ut[bt]};`);const ht=` + float process(int outputIdx[${dt.length}]) { + ${ft.join(` + `)} + return _A(outputIdx); + }`;return Object.assign(Object.assign({},tt),{output:{dims:dt,type:rt.type,textureType:_e.TextureType.unpacked},shaderSource:ht})},it=j=>{if(!j||j.length!==1)throw new Error("Slice requires 1 input.");if(_.NUMBER_TYPES.indexOf(j[0].type)===-1)throw new Error("Invalid input type.")};o.sliceV10=(j,rt)=>{et(rt);const ot=nt(j,rt);return[j.run(Object.assign(Object.assign({},tt),{cacheHint:ot.cacheKey,get:()=>st(j,rt[0],ot)}),[rt[0]])]};const nt=(j,rt)=>{if(!j.session.isInitializer(rt[1].dataId)||!j.session.isInitializer(rt[2].dataId)||rt.length>=4&&!j.session.isInitializer(rt[3].dataId)||rt.length>=5&&!j.session.isInitializer(rt[4].dataId))throw new Error("dynamic slice attributes are not allowed");if(rt.length>=5&&rt[4].integerData.some(ut=>ut!==1))throw new Error("currently non-1 steps is not supported for Slice");const ot=Array.from(rt[1].integerData),at=Array.from(rt[2].integerData),lt=rt.length>=4?Array.from(rt[3].integerData):[];return{starts:ot,ends:at,axes:lt,cacheKey:`${lt};${ot};${at}`}},et=j=>{if(!j||j.length<3||j.length>5)throw new Error("Invalid input number.");if(j[1].type!=="int32"||j[1].dims.length!==1)throw new Error("Invalid input type.");if(j[2].type!=="int32"||j[2].dims.length!==1)throw new Error("Invalid input type.");if(j.length>=4&&(j[3].type!=="int32"||j[3].dims.length!==1))throw new Error("Invalid input type.");if(j.length>=5&&(j[4].type!=="int32"||j[4].dims.length!==1))throw new Error("Invalid input type.")}},5524:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.softmaxV13=o.parseSoftmaxAttributesV13=o.parseSoftmaxAttributes=o.softmax=void 0;const a=s(246),_=s(2517),$=s(5060),_e=s(2039),tt=s(3738),st={name:"SoftmaxComputeMax",inputNames:["A"],inputTypes:[_e.TextureType.unpacked]},it={name:"SoftmaxComputeScale",inputNames:["A","Max"],inputTypes:[_e.TextureType.unpacked,_e.TextureType.unpacked]},nt={name:"SoftMax",inputNames:["A","Max","Norm"],inputTypes:[_e.TextureType.unpacked,_e.TextureType.unpacked,_e.TextureType.unpacked]};o.softmax=(lt,ut,ct)=>{at(ut);const dt=ut[0].dims.slice(),ft=_.ShapeUtil.normalizeAxis(ct.axis,dt.length),ht=_.ShapeUtil.sizeToDimension(dt,ft),bt=_.ShapeUtil.sizeFromDimension(dt,ft);return et(lt,ut,ct,ht,bt)},o.parseSoftmaxAttributes=lt=>(0,a.createAttributeWithCacheKey)({axis:lt.attributes.getInt("axis",1)}),o.parseSoftmaxAttributesV13=lt=>(0,a.createAttributeWithCacheKey)({axis:lt.attributes.getInt("axis",-1)}),o.softmaxV13=(lt,ut,ct)=>{at(ut);const dt=ut[0].dims.slice(),ft=_.ShapeUtil.normalizeAxis(ct.axis,dt.length),ht=dt.length,bt=ft!==ht-1,yt=[];let mt,gt=[],vt=[];bt&&(gt=Array.from({length:ht}).map((It,Pt)=>Pt),gt[ft]=ht-1,gt[ht-1]=ft,gt.map(It=>yt.push(dt[It])),mt=(0,a.createAttributeWithCacheKey)({perm:gt}),vt=(0,tt.transpose)(lt,ut,mt));const wt=bt?_.ShapeUtil.sizeToDimension(yt,ht-1):_.ShapeUtil.sizeToDimension(dt,ht-1),Ct=bt?_.ShapeUtil.sizeFromDimension(yt,ht-1):_.ShapeUtil.sizeFromDimension(dt,ht-1),kt=et(lt,bt?vt:ut,ct,wt,Ct);return bt?(0,tt.transpose)(lt,kt,mt):kt};const et=(lt,ut,ct,dt,ft)=>{const ht=j(lt,ut[0],dt,ft,[dt]),bt=lt.run(Object.assign(Object.assign({},st),{cacheHint:ct.cacheKey,get:()=>ht}),ut),yt=rt(lt,ut[0],dt,ft,ht.output.dims,[dt]),mt=lt.run(Object.assign(Object.assign({},it),{cacheHint:ct.cacheKey,get:()=>yt}),[ut[0],bt]),gt=ot(lt,ut[0],dt,ft,ht.output.dims,yt.output.dims);return[lt.run(Object.assign(Object.assign({},nt),{cacheHint:ct.cacheKey,get:()=>gt}),[ut[0],bt,mt])]},j=(lt,ut,ct,dt,ft)=>{const[ht,bt]=lt.calculateTextureWidthAndHeight(ut.dims,_e.TextureType.unpacked),yt=ft.length;if(ct<1||dt<1)throw new Error("Logical row count N and feature count D must be greater than or equal to 1");if(ft.length!==1)throw new Error("Dimensionality of the output should be 1");if(ft[0]!==ct)throw new Error("Shape of the output should be equal to logical row count");const mt=(0,$.getGlsl)(lt.session.backend.glContext.version),gt=` + float process(int[${yt}] indices) { + int logical_row_start_offset = indices[0] * ${dt}; + + float max = getColorAsFloat(${mt.texture2D}(A, offsetToCoords(logical_row_start_offset, ${ht}, + ${bt} ))); + for(int i=1; i<${dt}; ++i) + { + float current = getColorAsFloat(${mt.texture2D}(A, offsetToCoords(logical_row_start_offset + i, + ${ht}, ${bt}))); + if(current > max) + max = current; + } + + return max; + }`;return Object.assign(Object.assign({},st),{output:{dims:ft,type:ut.type,textureType:_e.TextureType.unpacked},shaderSource:gt})},rt=(lt,ut,ct,dt,ft,ht)=>{const[bt,yt]=lt.calculateTextureWidthAndHeight(ut.dims,_e.TextureType.unpacked),mt=ht.length;if(ct<1||dt<1)throw new Error("Logical row count N and feature count D must be greater than or equal to 1");if(ht.length!==1)throw new Error("Dimensionality of the output should be 1");if(ht[0]!==ct)throw new Error("Shape of the output should be equal to logical row count");if(ft.length!==1)throw new Error("Dimensionality of the intermediate results should be 1");if(ft[0]!==ct)throw new Error("Shape of the intermediate results should be equal to logical row count");const gt=` + float process(int[${mt}] indices) { + int logical_row_start_offset = indices[0] * ${dt}; + + float norm_factor = 0.0; + float max = _Max(indices); + for(int i=0; i<${dt}; ++i) + { + norm_factor += exp(getColorAsFloat(${(0,$.getGlsl)(lt.session.backend.glContext.version).texture2D}(A, offsetToCoords(logical_row_start_offset + i, + ${bt}, ${yt}))) - max); + } + + return norm_factor; + }`;return Object.assign(Object.assign({},it),{output:{dims:ht,type:ut.type,textureType:_e.TextureType.unpacked},shaderSource:gt})},ot=(lt,ut,ct,dt,ft,ht)=>{const[bt,yt]=lt.calculateTextureWidthAndHeight(ut.dims,_e.TextureType.unpacked),mt=ut.dims.length;if(ct<1||dt<1)throw new Error("Logical row count N and feature count D must be greater than or equal to 1");if(ft.length!==1||ht.length!==1)throw new Error("Dimensionality of the intermediate results should be 1");if(ft[0]!==ct||ht[0]!==ct)throw new Error("Shape of the intermediate results should be equal to logical row count");const gt=` + float process(int[${mt}] indices) { + + // get offset of current logical tensor index from the 2-D texture coordinates (TexCoords) + int offset = coordsToOffset(TexCoords, ${bt}, ${yt}); + + //determine the logical row for this index + int logical_row_index[1]; + logical_row_index[0] = offset / ${dt}; + + float norm_factor = _Norm(logical_row_index); + + // avoid possible division by 0 + // if norm_facor is 0, all elements are zero + // if so, return 0 + if(norm_factor == 0.0) + return 0.0; + + return exp(_A(indices) - _Max(logical_row_index)) / norm_factor; + }`;return Object.assign(Object.assign({},nt),{output:{dims:ut.dims,type:ut.type,textureType:_e.TextureType.unpacked},shaderSource:gt})},at=lt=>{if(!lt||lt.length!==1)throw new Error("Softmax requires 1 input.");if(lt[0].type!=="float32"&<[0].type!=="float64")throw new Error("Invalid input type")}},5975:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.parseSplitAttributes=o.split=void 0;const a=s(246),_=s(2517),$=s(2039),_e={name:"Split",inputNames:["A"],inputTypes:[$.TextureType.unpacked]};o.split=(nt,et,j)=>{it(et);const rt=_.ShapeUtil.normalizeAxis(j.axis,et[0].dims.length),ot=tt(nt,et,rt,j),at=[];for(let lt=0;ltst(nt,et[0],j,rt,lt)}),et));return at},o.parseSplitAttributes=nt=>{const et=nt.attributes.getInt("axis",0),j=nt.attributes.getInts("split",[]),rt=nt.outputs.length;return(0,a.createAttributeWithCacheKey)({axis:et,split:j,numOutputs:rt})};const tt=(nt,et,j,rt)=>{const[,ot]=_.SplitUtil.splitShape(et[0].dims,j,rt.split,rt.numOutputs);return ot.length},st=(nt,et,j,rt,ot)=>{const[at,lt]=_.SplitUtil.splitShape(et.dims,rt,j.split,j.numOutputs),ut=lt[ot],ct=at[ot],dt=` + float process(int indices[${ct.length}]) { + indices[${rt}] += ${ut}; + return _A(indices); + } + `;return Object.assign(Object.assign({},_e),{cacheHint:`${j.cacheKey}:${ot}`,output:{dims:ct,type:et.type,textureType:$.TextureType.unpacked},shaderSource:dt})},it=nt=>{if(!nt||nt.length!==1)throw new Error("Split requires one input.");if(nt[0].type!=="int8"&&nt[0].type!=="uint8"&&nt[0].type!=="int16"&&nt[0].type!=="uint16"&&nt[0].type!=="int32"&&nt[0].type!=="uint32"&&nt[0].type!=="float32"&&nt[0].type!=="float64"&&nt[0].type!=="bool")throw new Error("Invalid input type.")}},3933:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.parseSqueezeAttributes=o.squeezeV13=o.squeeze=void 0;const a=s(2517);o.squeeze=(_e,tt,st)=>{_(tt);const it=a.ShapeUtil.squeezeShape(tt[0].dims,st);return[_e.reshapeUnpacked(tt[0],it)]},o.squeezeV13=(_e,tt)=>($(tt),(0,o.squeeze)(_e,[tt[0]],Array.from(tt[1].integerData))),o.parseSqueezeAttributes=_e=>_e.attributes.getInts("axes");const _=_e=>{if(!_e||_e.length!==1)throw new Error("Squeeze requires 1 input.");if(_e[0].type==="string")throw new Error("invalid input tensor types.")},$=_e=>{if(!_e||_e.length!==2)throw new Error("Squeeze requires 2 inputs.");if(_e[1].type!=="int32")throw new Error("Invalid input type.")}},6558:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.sum=void 0;const a=s(5060),_=s(2039);o.sum=(tt,st)=>{_e(st);const it={name:"Sum",inputNames:st.map((nt,et)=>`X${et}`),inputTypes:new Array(st.length).fill(_.TextureType.unpacked)};return[tt.run(Object.assign(Object.assign({},it),{get:()=>$(tt,st,it)}),st)]};const $=(tt,st,it)=>{const nt=(0,a.getGlsl)(tt.session.backend.glContext.version),et=st[0].dims.slice(),j=` + void main() { + vec4 result = ${st.map((rt,ot)=>`${nt.texture2D}(X${ot},TexCoords)`).join(" + ")}; + ${nt.output} = result; + } + `;return Object.assign(Object.assign({},it),{output:{dims:et,type:st[0].type,textureType:_.TextureType.unpacked},hasMain:!0,shaderSource:j})},_e=tt=>{if(!tt||tt.length===0)throw new Error("Sum requires inputs.");const st=tt[0].dims.length;for(let it=1;it{Object.defineProperty(o,"__esModule",{value:!0}),o.tile=void 0;const a=s(782),_=s(2039);o.tile=(tt,st)=>{_e(st);const it={name:"Tile",inputNames:["A"],inputTypes:[_.TextureType.unpacked]};return[tt.run(Object.assign(Object.assign({},it),{get:()=>$(tt,st,it)}),st)]};const $=(tt,st,it)=>{const nt=st[0].dims.slice(),et=new Array(nt.length),j=[];for(let at=0;at{if(!tt||tt.length!==2)throw new Error("Tile requires 2 input.");if(tt[1].dims.length!==1)throw new Error("The second input shape must 1 dimension.");if(tt[1].dims[0]!==tt[0].dims.length)throw new Error("Invalid input shape.");if(a.NUMBER_TYPES.indexOf(tt[0].type)===-1)throw new Error("Invalid input type.");if(tt[1].type!=="int32"&&tt[1].type!=="int16")throw new Error("Invalid repeat type.")}},3738:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.parseTransposeAttributes=o.transpose=void 0;const a=s(246),_=s(2517),$=s(2039),_e={name:"Transpose",inputNames:["A"],inputTypes:[$.TextureType.unpacked]};o.transpose=(j,rt,ot)=>(et(rt),[j.run(Object.assign(Object.assign({},_e),{cacheHint:ot.cacheKey,get:()=>tt(j,rt[0],ot.perm)}),rt)]),o.parseTransposeAttributes=j=>(0,a.createAttributeWithCacheKey)({perm:j.attributes.getInts("perm",[])});const tt=(j,rt,ot)=>{const at=rt.dims;ot=st(at,ot);const lt=it(at,ot),ut=at.length,ct=` + ${nt("perm",ot,ut)} + float process(int indices[${ut}]) { + int a[${ut}]; + perm(a, indices); + return _A(a); + }`;return Object.assign(Object.assign({},_e),{output:{dims:lt,type:rt.type,textureType:$.TextureType.unpacked},shaderSource:ct})},st=(j,rt)=>(rt&&rt.length!==j.length&&(rt=[...j.keys()].reverse()),rt),it=(j,rt)=>(rt=st(j,rt),_.ShapeUtil.sortBasedOnPerm(j,rt)),nt=(j,rt,ot)=>{const at=[];at.push(`void ${j}(out int a[${ot}], int src[${ot}]) {`);for(let lt=0;lt{if(!j||j.length!==1)throw new Error("Transpose requires 1 input.");if(j[0].type!=="float32"&&j[0].type!=="float64")throw new Error("input should be float tensor")}},8710:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.encodeAsUint8=void 0;const a=s(5060),_=s(2039);o.encodeAsUint8=($,_e)=>{const tt=_e.shape,st=(0,a.getGlsl)($.session.backend.glContext.version),it=` + const float FLOAT_MAX = 1.70141184e38; + const float FLOAT_MIN = 1.17549435e-38; + + bool isNaN(float val) { + return (val < 1.0 || 0.0 < val || val == 0.0) ? false : true; + } + + highp vec4 encodeAsUint8(highp float v) { + if (isNaN(v)) { + return vec4(255, 255, 255, 255); + } + + highp float av = abs(v); + + if(av < FLOAT_MIN) { + return vec4(0.0, 0.0, 0.0, 0.0); + } else if(v > FLOAT_MAX) { + return vec4(0.0, 0.0, 128.0, 127.0) / 255.0; + } else if(v < -FLOAT_MAX) { + return vec4(0.0, 0.0, 128.0, 255.0) / 255.0; + } + + highp vec4 c = vec4(0,0,0,0); + + highp float e = floor(log2(av)); + highp float m = exp2(fract(log2(av))) - 1.0; + + c[2] = floor(128.0 * m); + m -= c[2] / 128.0; + c[1] = floor(32768.0 * m); + m -= c[1] / 32768.0; + c[0] = floor(8388608.0 * m); + + highp float ebias = e + 127.0; + c[3] = floor(ebias / 2.0); + ebias -= c[3] * 2.0; + c[2] += floor(ebias) * 128.0; + + c[3] += 128.0 * step(0.0, -v); + + return c / 255.0; + } + + void main() { + float value = ${st.texture2D}(X,TexCoords).r; + ${st.output} = encodeAsUint8(value); + }`,nt={name:"Uint8Encode",inputTypes:[_.TextureType.unpacked],inputNames:["X"],output:{dims:tt,type:_e.tensor.type,textureType:_.TextureType.downloadUint8AsFloat},shaderSource:it,hasMain:!0};return $.executeProgram(nt,[_e.tensor])}},4909:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.tanh=o.tan=o.sqrt=o.sin=o.sigmoid=o.relu=o.not=o.neg=o.log=o.parseLeakyReluAttributes=o.leakyRelu=o.identity=o.floor=o.exp=o.parseEluAttributes=o.elu=o.cos=o.ceil=o.clipV11=o.parseClipAttributes=o.clip=o.atan=o.asin=o.acos=o.abs=o.glslTanh=o.glslTan=o.glslSqrt=o.glslSigmoid=o.glslRelu=o.glslSin=o.glslNot=o.glslNeg=o.glslLog=o.glslLeakyRelu=o.glslIdentity=o.glslClip=o.glslFloor=o.glslExp=o.glslElu=o.glslCos=o.glslCeil=o.glslAtan=o.glslAsin=o.glslAcos=o.glslAbs=void 0;const a=s(246),_=s(2517),$=s(8520),_e=s(5060),tt=s(2039);function st(){return kt("abs")}function it(){return kt("acos")}function nt(){return kt("asin")}function et(){return kt("atan")}function j(){return kt("ceil")}function rt(){return kt("cos")}function ot(St){const Rt="elu";return{body:` + const float alpha = float(${St}); + + float ${Rt}_(float a) { + return a >= 0.0 ? a: (exp(a) - 1.0) * alpha; + } + vec4 ${Rt}_(vec4 v) { + return vec4(${Rt}_(v.x), ${Rt}_(v.y), ${Rt}_(v.z), ${Rt}_(v.w)); + } + `,name:Rt,type:$.FunctionType.ValueBased}}function at(){return kt("exp")}function lt(){return kt("floor")}function ut(St,Rt){const At="clip";return{body:` + const float min = float(${St}); + const float max = float(${Rt}); + + float ${At}_(float a) { + return clamp(a, min, max); + } + vec4 ${At}_(vec4 v) { + return clamp(v, min, max); + } + `,name:At,type:$.FunctionType.ValueBased}}function ct(){const St="indentity";return{body:` + float ${St}_(float a) { + return a; + } + vec4 ${St}_(vec4 v) { + return v; + } + `,name:St,type:$.FunctionType.ValueBased}}function dt(St){const Rt="leakyRelu";return{body:` + const float alpha = float(${St}); + + float ${Rt}_(float a) { + return a < 0.0 ? a * alpha : a; + } + vec4 ${Rt}_(vec4 v) { + return vec4(${Rt}_(v.x), ${Rt}_(v.y), ${Rt}_(v.z), ${Rt}_(v.w)); + } + `,name:Rt,type:$.FunctionType.ValueBased}}function ft(){return kt("log")}function ht(){const St="neg";return{body:` + float ${St}_(float a) { + return -a; + } + vec4 ${St}_(vec4 v) { + return -v; + } + `,name:St,type:$.FunctionType.ValueBased}}function bt(){const St="not";return{body:` + float ${St}_(float a) { + return float( ! bool(a) ); + } + bool ${St}_(bool a) { + return !a; + } + vec4 ${St}_(vec4 v) { + return vec4(!bool(v.x), !bool(v.y), !bool(v.z), !bool(v.w)); + } + bvec4 ${St}_(bvec4 v) { + return bvec4(!v.x, !v.y, !v.z, !v.w); + } + `,name:St,type:$.FunctionType.ValueBased}}function yt(){return kt("sin")}function mt(){const St="relu";return{body:` + float ${St}_(float a) { + return max( a, 0.0 ); + } + vec4 ${St}_(vec4 v) { + return max( v, 0.0 ); + } + `,name:St,type:$.FunctionType.ValueBased}}function gt(){const St="sigmoid";return{body:` + float ${St}_(float a) { + return 1.0 / (1.0 + exp(-a)); + } + vec4 ${St}_(vec4 v) { + return 1.0 / (1.0 + exp(-v)); + } + `,name:St,type:$.FunctionType.ValueBased}}function vt(){return kt("sqrt")}function wt(){return kt("tan")}function Ct(){const St="tanh";return{body:` + float ${St}_(float a) { + a = clamp(a, -10., 10.); + a = exp(2.*a); + return (a - 1.) / (a + 1.); + } + vec4 ${St}_(vec4 v) { + v = clamp(v, -10., 10.); + v = exp(2.*v); + return (v - 1.) / (v + 1.); + } + `,name:St,type:$.FunctionType.ValueBased}}function kt(St){return{body:` + float ${St}_(float a) { + return ${St}(a); + } + vec4 ${St}_(vec4 v) { + return ${St}(v); + } + `,name:St,type:$.FunctionType.ValueBased}}o.glslAbs=st,o.glslAcos=it,o.glslAsin=nt,o.glslAtan=et,o.glslCeil=j,o.glslCos=rt,o.glslElu=ot,o.glslExp=at,o.glslFloor=lt,o.glslClip=ut,o.glslIdentity=ct,o.glslLeakyRelu=dt,o.glslLog=ft,o.glslNeg=ht,o.glslNot=bt,o.glslSin=yt,o.glslRelu=mt,o.glslSigmoid=gt,o.glslSqrt=vt,o.glslTan=wt,o.glslTanh=Ct;const It=(St,Rt,At,Mt)=>{const jt=St.session.pack?tt.TextureType.packed:tt.TextureType.unpacked,Yt={name:At.name,inputTypes:[jt],inputNames:["A"],cacheHint:Mt};return Object.assign(Object.assign({},Yt),{get:()=>((Kt,sr,ar,Gt)=>{const Qt=Kt.session.pack?tt.TextureType.packed:tt.TextureType.unpacked,tr=(0,_e.getGlsl)(Kt.session.backend.glContext.version);return Object.assign(Object.assign({},sr),{output:{dims:ar.dims,type:ar.type,textureType:Qt},shaderSource:` + ${Gt.body} + void main() { + vec4 v = ${tr.texture2D}(A, TexCoords); + v = ${Gt.name}_(v); + ${tr.output} = v; + } + `,hasMain:!0})})(St,Yt,Rt,At)})};o.abs=(St,Rt)=>[St.run(It(St,Rt[0],st()),Rt)],o.acos=(St,Rt)=>[St.run(It(St,Rt[0],it()),Rt)],o.asin=(St,Rt)=>[St.run(It(St,Rt[0],nt()),Rt)],o.atan=(St,Rt)=>[St.run(It(St,Rt[0],et()),Rt)],o.clip=(St,Rt,At)=>[St.run(It(St,Rt[0],ut(At.min,At.max),At.cacheKey),Rt)],o.parseClipAttributes=St=>(0,a.createAttributeWithCacheKey)({min:St.attributes.getFloat("min",_.MIN_CLIP),max:St.attributes.getFloat("max",_.MAX_CLIP)}),o.clipV11=(St,Rt)=>{const At=Pt(St,Rt);return(0,o.clip)(St,[Rt[0]],At)};const Pt=(St,Rt)=>{if(Rt.length>=3&&(!St.session.isInitializer(Rt[1].dataId)||!St.session.isInitializer(Rt[2].dataId)))throw new Error("dynamic clip attributes are not allowed");const At=Rt.length>=3?Rt[1].numberData[0]:_.MIN_CLIP,Mt=Rt.length>=3?Rt[2].numberData[0]:_.MAX_CLIP;return(0,a.createAttributeWithCacheKey)({min:At,max:Mt})};o.ceil=(St,Rt)=>[St.run(It(St,Rt[0],j()),Rt)],o.cos=(St,Rt)=>[St.run(It(St,Rt[0],rt()),Rt)],o.elu=(St,Rt,At)=>[St.run(It(St,Rt[0],ot(At.alpha),At.cacheKey),Rt)],o.parseEluAttributes=St=>(0,a.createAttributeWithCacheKey)({alpha:St.attributes.getFloat("alpha",1)}),o.exp=(St,Rt)=>[St.run(It(St,Rt[0],at()),Rt)],o.floor=(St,Rt)=>[St.run(It(St,Rt[0],lt()),Rt)],o.identity=(St,Rt)=>[St.run(It(St,Rt[0],ct()),Rt)],o.leakyRelu=(St,Rt,At)=>[St.run(It(St,Rt[0],dt(At.alpha),At.cacheKey),Rt)],o.parseLeakyReluAttributes=St=>(0,a.createAttributeWithCacheKey)({alpha:St.attributes.getFloat("alpha",.01)}),o.log=(St,Rt)=>[St.run(It(St,Rt[0],ft()),Rt)],o.neg=(St,Rt)=>[St.run(It(St,Rt[0],ht()),Rt)],o.not=(St,Rt)=>[St.run(It(St,Rt[0],bt()),Rt)],o.relu=(St,Rt)=>[St.run(It(St,Rt[0],mt()),Rt)],o.sigmoid=(St,Rt)=>[St.run(It(St,Rt[0],gt()),Rt)],o.sin=(St,Rt)=>[St.run(It(St,Rt[0],yt()),Rt)],o.sqrt=(St,Rt)=>[St.run(It(St,Rt[0],vt()),Rt)],o.tan=(St,Rt)=>[St.run(It(St,Rt[0],wt()),Rt)],o.tanh=(St,Rt)=>[St.run(It(St,Rt[0],Ct()),Rt)]},5611:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createUnpackProgramInfoLoader=o.createUnpackProgramInfo=void 0;const a=s(5060),_=s(2039),$=s(9390),_e=s(2827),tt={name:"unpack",inputNames:["A"],inputTypes:[_.TextureType.packed]};o.createUnpackProgramInfo=(st,it)=>{const nt=it.dims.length,et=(0,_e.getChannels)("rc",nt),j=et.slice(-2),rt=(0,$.getCoordsDataType)(nt),ot=(0,_e.unpackFromChannel)(),at=it.dims.length===0?"":function(ct,dt){if(ct===1)return"rc";let ft="";for(let ht=0;htObject.assign(Object.assign({},tt),{get:()=>(0,o.createUnpackProgramInfo)(st,it)})},8428:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.parseUnsqueezeAttributes=o.unsqueezeV13=o.unsqueeze=void 0;const a=s(2517);o.unsqueeze=(_e,tt,st)=>{_(tt);const it=a.ShapeUtil.unsqueezeShape(tt[0].dims,st);return[_e.reshapeUnpacked(tt[0],it)]},o.unsqueezeV13=(_e,tt)=>($(tt),(0,o.unsqueeze)(_e,[tt[0]],Array.from(tt[1].integerData))),o.parseUnsqueezeAttributes=_e=>_e.attributes.getInts("axes");const _=_e=>{if(!_e||_e.length!==1)throw new Error("Unsqueeze requires 1 input.");if(_e[0].type==="string")throw new Error("invalid input tensor types.")},$=_e=>{if(!_e||_e.length!==2)throw new Error("Unsqueeze requires 2 inputs.");if(_e[1].type!=="int32")throw new Error("Invalid input type.")}},9793:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.scalesValidation=o.validateInputs=o.parseUpsampleAttributes=o.parseUpsampleAttributesV9=o.parseUpsampleAttributesV7=o.upsample=void 0;const a=s(246),_=s(5060),$=s(2039),_e={name:"Upsample",inputNames:["X"],inputTypes:[$.TextureType.unpacked]};o.upsample=(st,it,nt)=>((0,o.validateInputs)(it,nt),[st.run(Object.assign(Object.assign({},_e),{cacheHint:nt.cacheKey,get:()=>tt(st,it,nt)}),it)]),o.parseUpsampleAttributesV7=st=>(0,o.parseUpsampleAttributes)(st,7),o.parseUpsampleAttributesV9=st=>(0,o.parseUpsampleAttributes)(st,9),o.parseUpsampleAttributes=(st,it)=>{const nt=it>=10,et=st.attributes.getString("mode","nearest");if(et!=="nearest"&&et!=="linear"&&(it<11||et!=="cubic"))throw new Error(`unrecognized mode: ${et}`);let j=[];it<9&&(j=st.attributes.getFloats("scales"),(0,o.scalesValidation)(j,et,nt));const rt=st.attributes.getFloat("extrapolation_value",0),ot=it>10?st.attributes.getString("coordinate_transformation_mode","half_pixel"):"asymmetric";if(["asymmetric","pytorch_half_pixel","tf_half_pixel_for_nn","align_corners","tf_crop_and_resize","half_pixel"].indexOf(ot)===-1)throw new Error(`coordinate_transform_mode '${ot}' is not supported`);const at=ot==="tf_crop_and_resize",lt=at,ut=et==="nearest"&&it>=11?st.attributes.getString("nearest_mode","round_prefer_floor"):"";if(["round_prefer_floor","round_prefer_ceil","floor","ceil",""].indexOf(ut)===-1)throw new Error(`nearest_mode '${ut}' is not supported`);const ct=st.attributes.getFloat("cubic_coeff_a",-.75),dt=st.attributes.getInt("exclude_outside",0)!==0;if(dt&&et!=="cubic")throw new Error("exclude_outside can be set to 1 only when mode is CUBIC.");const ft=it<11||et==="nearest"&&ot==="asymmetric"&&ut==="floor";let ht=0,bt=0,yt=0;return it>10?st.inputs.length>2?(ht=1,bt=2,yt=3):(bt=1,yt=2):it===9&&(bt=1),(0,a.createAttributeWithCacheKey)({opset:it,isResize:nt,mode:et,scales:j,extrapolationValue:rt,coordinateTransformMode:ot,useExtrapolation:lt,needRoiInput:at,nearestMode:ut,cubicCoefficientA:ct,excludeOutside:dt,useNearest2xOptimization:ft,roiInputIdx:ht,scalesInputIdx:bt,sizesInputIdx:yt})};const tt=(st,it,nt)=>{const et=(0,_.getGlsl)(st.session.backend.glContext.version),[j,rt]=st.calculateTextureWidthAndHeight(it[0].dims,$.TextureType.unpacked),ot=it[0].dims.map((yt,mt)=>Math.floor(yt*nt.scales[mt])),[at,lt]=st.calculateTextureWidthAndHeight(ot,$.TextureType.unpacked),ut=ot.length,ct=new Array(ut),dt=new Array(ut);let ft=` + int output_pitches[${ut}]; + int input_pitches[${ut}]; + `;for(let yt=ut-1;yt>=0;yt--)ct[yt]=yt===ut-1?1:ct[yt+1]*ot[yt+1],dt[yt]=yt===ut-1?1:dt[yt+1]*it[0].dims[yt+1],ft+=` + output_pitches[${yt}] = ${ct[yt]}; + input_pitches[${yt}] = ${dt[yt]}; + `;const ht=` + float getInputFloat(int index) { + vec2 coords = offsetToCoords(index, ${j}, ${rt}); + float value = getColorAsFloat(${et.texture2D}(X, coords)); + return value; + } + `,bt=nt.mode==="nearest"?` + ${ht} + float process(int indices[${ut}]) { + int input_index = 0; + int output_index = coordsToOffset(TexCoords, ${at}, ${lt}); + + ${ft} + + int d, m; + for (int dim = 0; dim < ${ut}; ++dim) { + d = output_index / output_pitches[dim]; + m = output_index - d * output_pitches[dim]; + output_index = m; + + if (scales[dim] != 1 && d > 0) { + int d2 = d / scales[dim]; + m = d - d2 * scales[dim]; + d = d2; + } + input_index += input_pitches[dim] * d; + } + + return getInputFloat(input_index); + }`:ut===4?` + ${ht} + float process(int indices[4]) { + int input_index = 0; + int output_index = coordsToOffset(TexCoords, ${at}, ${lt}); + + ${ft} + + int m; + int index_of_dim0, index_of_dim1, index_of_dim2, index_of_dim3; + index_of_dim0 = output_index / output_pitches[0]; + m = output_index - index_of_dim0 * output_pitches[0]; + index_of_dim1 = m / output_pitches[1]; + m = m - index_of_dim1 * output_pitches[1]; + index_of_dim2 = m / output_pitches[2]; + m = m - index_of_dim2 * output_pitches[2]; + index_of_dim3 = m; + + int index_of_input_dim2, index_of_input_dim3, x_offset, y_offset; + index_of_input_dim2 = index_of_dim2 / scales[2]; + y_offset = index_of_dim2 - index_of_input_dim2 * scales[2]; + index_of_input_dim3 = index_of_dim3 / scales[3]; + x_offset = index_of_dim3 - index_of_input_dim3 * scales[3]; + + input_index = index_of_dim0 * input_pitches[0] + + index_of_dim1 * input_pitches[1] + + index_of_input_dim2 * input_pitches[2] + + index_of_input_dim3; + + float x00 = getInputFloat(input_index); + float x10, x01, x11; + + bool end_of_dim2 = false; + if (index_of_input_dim2 == (${it[0].dims[2]} - 1)) { + // It's the end in dimension 2 + x01 = x00; + end_of_dim2 = true; + } else { + x01 = getInputFloat(input_index + input_pitches[2]); + } + + if (index_of_input_dim3 == (input_pitches[2] - 1)) { + // It's the end in dimension 3 + x10 = x00; + x11 = x01; + } + else { + x10 = getInputFloat(input_index + 1); + x11 = end_of_dim2 ? x10 : getInputFloat(input_index + input_pitches[2] + 1); + } + + float y0 = x00 + float(y_offset) * (x01 - x00) / float(scales[2]); + float y1 = x10 + float(y_offset) * (x11 - x10) / float(scales[2]); + return y0 + float(x_offset) * (y1 - y0) / float(scales[3]); + }`:` + ${ht} + float process(int indices[2]) { + int input_index = 0; + int output_index = coordsToOffset(TexCoords, ${at}, ${lt}); + + ${ft} + + int m; + int index_of_dim0, index_of_dim1; + index_of_dim0 = output_index / output_pitches[0]; + m = output_index - index_of_dim0 * output_pitches[0]; + index_of_dim1 = m; + + int index_of_input_dim0, index_of_input_dim1, x_offset, y_offset; + index_of_input_dim0 = index_of_dim0 / scales[0]; + y_offset = index_of_dim0 - index_of_input_dim0 * scales[0]; + index_of_input_dim1 = index_of_dim1 / scales[1]; + x_offset = index_of_dim1 - index_of_input_dim1 * scales[1]; + + input_index = index_of_input_dim0 * input_pitches[0] + index_of_input_dim1; + + float x00 = getInputFloat(input_index); + float x10, x01, x11; + + bool end_of_dim0 = false; + if (index_of_input_dim0 == (${it[0].dims[0]} - 1)) { + // It's the end in dimension 0 + x01 = x00; + end_of_dim0 = true; + } else { + x01 = getInputFloat(input_index + input_pitches[0]); + } + + if (index_of_input_dim1 == (input_pitches[0] - 1)) { + // It's the end in dimension 1 + x10 = x00; + x11 = x01; + } + else { + x10 = getInputFloat(input_index + 1); + x11 = end_of_dim0 ? x10 : getInputFloat(input_index + input_pitches[0] + 1); + } + + float y0 = x00 + float(y_offset) * (x01 - x00) / float(scales[0]); + float y1 = x10 + float(y_offset) * (x11 - x10) / float(scales[0]); + return y0 + float(x_offset) * (y1 - y0) / float(scales[1]); + }`;return Object.assign(Object.assign({},_e),{output:{dims:ot,type:it[0].type,textureType:$.TextureType.unpacked},shaderSource:bt,variables:[{name:"scales",type:"int",arrayLength:nt.scales.length,data:nt.scales.map(yt=>Math.ceil(yt))}]})};o.validateInputs=(st,it)=>{if(!st||it.opset<9&&st.length!==1||it.opset>=9&&it.opset<11&&st.length!==2||it.opset>=11&&st.length<2)throw new Error("invalid inputs.");if(it.scales.length>0&&st[0].dims.length!==it.scales.length)throw new Error("Invalid input shape.");if(st[0].type==="string")throw new Error("Invalid input tensor types.")},o.scalesValidation=(st,it,nt)=>{if(nt){for(const et of st)if(et<=0)throw new Error("Scale value should be greater than 0.")}else for(const et of st)if(et<1)throw new Error("Scale value should be greater than or equal to 1.");if(!(it!=="linear"&&it!=="cubic"||st.length===2||st.length===4&&st[0]===1&&st[1]===1))throw new Error(`'Linear' mode and 'Cubic' mode only support 2-D inputs ('Bilinear', 'Bicubic') or 4-D inputs with the corresponding outermost 2 scale values being 1 in the ${nt?"Resize":"Upsample"} opeartor.`)}},1958:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ProgramManager=void 0;const a=s(1670),_=s(6231),$=s(8879),_e=s(5060);o.ProgramManager=class{constructor(tt,st,it){this.profiler=tt,this.glContext=st,this.textureLayoutStrategy=it,this.repo=new Map,this.attributesBound=!1}getArtifact(tt){return this.repo.get(tt)}setArtifact(tt,st){this.repo.set(tt,st)}run(tt,st,it){var nt;this.profiler.event("op",`ProgramManager.run ${(nt=tt.programInfo.name)!==null&&nt!==void 0?nt:"unknown kernel"}`,()=>{var et;const j=this.glContext.gl,rt=tt.program;j.useProgram(rt);try{this.bindOutput(it),this.attributesBound||this.bindAttributes(tt.attribLocations),this.bindUniforms(tt.uniformLocations,(et=tt.programInfo.variables)!==null&&et!==void 0?et:[],st)}catch(ot){throw _.Logger.error("ProgramManager",tt.programInfo.shaderSource),ot}this.profiler.event("backend","GlContext.draw()",()=>{this.glContext.draw()})},this.glContext)}dispose(){this.vertexShader&&this.glContext.deleteShader(this.vertexShader),this.repo.forEach(tt=>this.glContext.deleteProgram(tt.program))}build(tt,st,it){return this.profiler.event("backend","ProgramManager.build",()=>{const nt=new $.GlslPreprocessor(this.glContext,tt,st,it),et=nt.preprocess(),j=this.compile(et);return{programInfo:tt,program:j,uniformLocations:this.getUniformLocations(j,nt.context.programInfo.inputNames,nt.context.programInfo.variables),attribLocations:this.getAttribLocations(j)}})}compile(tt){if(!this.vertexShader){_.Logger.verbose("ProrgramManager","Compiling and caching Vertex shader for the first time");const nt=(0,_e.getVertexShaderSource)(this.glContext.version);this.vertexShader=this.glContext.compileShader(nt,this.glContext.gl.VERTEX_SHADER)}a.env.debug&&_.Logger.verbose("ProrgramManager",`FragShader: +${tt} +`);const st=this.glContext.compileShader(tt,this.glContext.gl.FRAGMENT_SHADER),it=this.glContext.createProgram(this.vertexShader,st);return this.glContext.deleteShader(st),it}bindOutput(tt){const st=tt.width,it=tt.height;_.Logger.verbose("ProrgramManager",`Binding output texture to Framebuffer: w/h=${st}/${it}, shape=${tt.shape}, type=${tt.tensor.type}`),this.glContext.attachFramebuffer(tt.texture,st,it)}bindAttributes(tt){const st=tt.position,it=tt.textureCoord;this.glContext.setVertexAttributes(st,it),this.attributesBound=!0}bindUniforms(tt,st,it){var nt;const et=this.glContext.gl;let j=0;for(const{name:rt,type:ot,location:at,arrayLength:lt}of tt){const ut=(nt=st.find(ct=>ct.name===rt))===null||nt===void 0?void 0:nt.data;if(ot!=="sampler2D"&&!ut)throw new Error(`variable '${rt}' does not have data defined in program info`);switch(ot){case"sampler2D":this.bindTexture(it[j],at,j),j++;break;case"float":lt?et.uniform1fv(at,ut):et.uniform1f(at,ut);break;case"int":lt?et.uniform1iv(at,ut):et.uniform1i(at,ut);break;default:throw new Error(`Uniform not implemented: ${ot}`)}}}bindTexture(tt,st,it){this.glContext.bindTextureToUniform(tt.texture,it,st)}getAttribLocations(tt){return{position:this.getAttribLocation(tt,"position"),textureCoord:this.getAttribLocation(tt,"textureCoord")}}getUniformLocations(tt,st,it){const nt=[];if(st)for(const et of st)nt.push({name:et,type:"sampler2D",location:this.getUniformLocation(tt,et)});if(it)for(const et of it)nt.push(Object.assign(Object.assign({},et),{location:this.getUniformLocation(tt,et.name)}));return nt}getUniformLocation(tt,st){const it=this.glContext.gl.getUniformLocation(tt,st);if(it===null)throw new Error(`Uniform ${st} not found.`);return it}getAttribLocation(tt,st){return this.glContext.gl.getAttribLocation(tt,st)}}},6416:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WebGLSessionHandler=void 0;const a=s(6231),_=s(1047),$=s(8316),_e=s(1640),tt=s(1958),st=s(7859),it=s(5702);o.WebGLSessionHandler=class{constructor(nt,et){this.backend=nt,this.context=et,this.layoutStrategy=new st.PreferLogicalStrategy(nt.glContext.maxTextureSize),this.programManager=new tt.ProgramManager(this.context.profiler,nt.glContext,this.layoutStrategy),this.textureManager=new it.TextureManager(nt.glContext,this.layoutStrategy,this.context.profiler,{reuseTextures:nt.textureCacheMode==="full"}),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache=new Map,this.pack=nt.pack,this.pack2unpackMap=new Map,this.unpack2packMap=new Map}createInferenceHandler(){return new $.WebGLInferenceHandler(this)}onGraphInitialized(nt){const et=nt.getValues().filter(j=>j.from===-1&&j.tensor).map(j=>j.tensor.dataId);this.initializers=new Set(et)}isInitializer(nt){return!!this.initializers&&this.initializers.has(nt)}addInitializer(nt){this.initializers.add(nt)}getTextureData(nt,et){return et?this.packedTextureDataCache.get(nt):this.unpackedTextureDataCache.get(nt)}setTextureData(nt,et,j=!1){a.Logger.verbose("WebGLSessionHandler","Storing Texture data in cache"),j?this.packedTextureDataCache.set(nt,et):this.unpackedTextureDataCache.set(nt,et)}dispose(){this.programManager.dispose(),this.textureManager.clearActiveTextures(),this.packedTextureDataCache.forEach(nt=>this.textureManager.releaseTexture(nt,!0)),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache.forEach(nt=>this.textureManager.releaseTexture(nt,!0)),this.unpackedTextureDataCache=new Map}resolve(nt,et,j){const rt=(0,_.resolveOperator)(nt,et,_e.WEBGL_OP_RESOLVE_RULES);return{impl:rt.opImpl,context:rt.opInit?rt.opInit(nt,j):nt}}}},7769:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Uint8DataEncoder=o.RGBAFloatDataEncoder=o.RedFloat32DataEncoder=void 0;const a=s(6231);o.RedFloat32DataEncoder=class{constructor(_,$=1){if($===1)this.internalFormat=_.R32F,this.format=_.RED,this.textureType=_.FLOAT,this.channelSize=$;else{if($!==4)throw new Error(`Invalid number of channels: ${$}`);this.internalFormat=_.RGBA32F,this.format=_.RGBA,this.textureType=_.FLOAT,this.channelSize=$}}encode(_,$){let _e,tt;return _.constructor!==Float32Array&&(a.Logger.warning("Encoder","data was not of type Float32; creating new Float32Array"),tt=new Float32Array(_)),$*this.channelSize>_.length?(a.Logger.warning("Encoder","Source data too small. Allocating larger array"),tt=_,_e=this.allocate($*this.channelSize),tt.forEach((st,it)=>_e[it]=st)):(tt=_,_e=tt),_e}allocate(_){return new Float32Array(4*_)}decode(_,$){return this.channelSize===1?_.filter((_e,tt)=>tt%4==0).subarray(0,$):_.subarray(0,$)}},o.RGBAFloatDataEncoder=class{constructor(_,$=1,_e){if($!==1&&$!==4)throw new Error(`Invalid number of channels: ${$}`);this.internalFormat=_.RGBA,this.format=_.RGBA,this.channelSize=$,this.textureType=_e||_.FLOAT}encode(_,$){let _e=_;return this.channelSize===1&&(a.Logger.verbose("Encoder","Exploding into a larger array"),_e=this.allocate($),_.forEach((tt,st)=>_e[4*st]=tt)),_e}allocate(_){return new Float32Array(4*_)}decode(_,$){return this.channelSize===1?_.filter((_e,tt)=>tt%4==0).subarray(0,$):_.subarray(0,$)}},o.Uint8DataEncoder=class{constructor(_,$=1){if(this.channelSize=4,$===1)this.internalFormat=_.ALPHA,this.format=_.ALPHA,this.textureType=_.UNSIGNED_BYTE,this.channelSize=$;else{if($!==4)throw new Error(`Invalid number of channels: ${$}`);this.internalFormat=_.RGBA,this.format=_.RGBA,this.textureType=_.UNSIGNED_BYTE,this.channelSize=$}}encode(_,$){return new Uint8Array(_.buffer,_.byteOffset,_.byteLength)}allocate(_){return new Uint8Array(_*this.channelSize)}decode(_,$){if(_ instanceof Uint8Array)return _.subarray(0,$);throw new Error(`Invalid array type: ${_.constructor}`)}}},7859:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.getBatchDim=o.sizeToSquarishShape=o.getRowsCols=o.sizeFromShape=o.isInt=o.parseAxisParam=o.squeezeShape=o.PreferLogicalStrategy=o.AlwaysKeepOriginalSizeStrategy=void 0;const a=s(6231),_=s(2517);function $(nt,et){const j=[],rt=[],ot=et!=null&&Array.isArray(et)&&et.length===0,at=et==null||ot?null:_e(et,nt).sort();let lt=0;for(let ut=0;utut)&&nt[ut]===1&&(j.push(nt[ut]),rt.push(ut)),at[lt]<=ut&<++}nt[ut]!==1&&(j.push(nt[ut]),rt.push(ut))}return{newShape:j,keptDims:rt}}function _e(nt,et){const j=et.length;return nt=nt==null?et.map((rt,ot)=>ot):[].concat(nt),(0,_.assert)(nt.every(rt=>rt>=-j&&rt`All values in axis param must be in range [-${j}, ${j}) but got axis ${nt}`),(0,_.assert)(nt.every(tt),()=>`All values in axis param must be integers but got axis ${nt}`),nt.map(rt=>rt<0?j+rt:rt)}function tt(nt){return nt%1==0}function st(nt){if(nt.length===0)return 1;let et=nt[0];for(let j=1;j=nt.length?1:nt.slice(et.breakAxis).reduce((ut,ct)=>ut*ct),lt=et.breakAxis<=0?1:nt.slice(0,et.breakAxis).reduce((ut,ct)=>ut*ct);if(!(at>j||lt>j))return[at,lt];a.Logger.verbose("TextureLayout",`Given width/height preferences were unattainable: shape:${nt}, breakAxis:${et.breakAxis}`)}const rt=nt.reduce((at,lt)=>at*lt);let ot=Math.floor(Math.sqrt(rt));for(;ot=j||rt%ot!=0)throw new Error(`The given dimensions are outside this GPU's boundaries: ${nt}`);return[ot,rt/ot]}},o.PreferLogicalStrategy=class{constructor(nt){this.maxTextureSize=nt}computeTextureWH(nt,et){const j=this.computeTexture(nt,et);return et&&et.isPacked&&(j[0]/=2,j[1]/=2),et&&et.reverseWH?[j[1],j[0]]:j}computeTexture(nt,et){const j=et&&et.isPacked;if(nt.length===0)return j?[2,2]:[1,1];let rt=this.maxTextureSize;if(et&&et.breakAxis!==void 0){const lt=et.breakAxis>=nt.length?1:nt.slice(et.breakAxis).reduce((ct,dt)=>ct*dt),ut=et.breakAxis<=0?1:nt.slice(0,et.breakAxis).reduce((ct,dt)=>ct*dt);if(!(lt>rt||ut>rt))return[lt,ut];a.Logger.verbose("TextureLayout",`Given width/height preferences were unattainable: shape:${nt}, breakAxis:${et.breakAxis}`)}let ot=nt.slice(0);j&&(rt*=2,ot=ot.map((lt,ut)=>ut>=ot.length-2?ot[ut]%2==0?ot[ut]:ot[ut]+1:ot[ut]),ot.length===1&&(ot=[2,ot[0]])),ot.length!==2&&(ot=$(ot).newShape);const at=st(ot);return ot.length<=1&&at<=rt?[1,at]:ot.length===2&&ot[0]<=rt&&ot[1]<=rt?ot:ot.length===3&&ot[0]*ot[1]<=rt&&ot[2]<=rt?[ot[0]*ot[1],ot[2]]:ot.length===3&&ot[0]<=rt&&ot[1]*ot[2]<=rt?[ot[0],ot[1]*ot[2]]:ot.length===4&&ot[0]*ot[1]*ot[2]<=rt&&ot[3]<=rt?[ot[0]*ot[1]*ot[2],ot[3]]:ot.length===4&&ot[0]<=rt&&ot[1]*ot[2]*ot[3]<=rt?[ot[0],ot[1]*ot[2]*ot[3]]:j?it(at/4).map(lt=>2*lt):it(at)}},o.squeezeShape=$,o.parseAxisParam=_e,o.isInt=tt,o.sizeFromShape=st,o.getRowsCols=function(nt){if(nt.length===0)throw Error("Cannot get rows and columns of an empty shape array.");return[nt.length>1?nt[nt.length-2]:1,nt[nt.length-1]]},o.sizeToSquarishShape=it,o.getBatchDim=function(nt,et=2){return st(nt.slice(0,nt.length-et))}},4057:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createTextureLayoutFromShape=o.calculateTextureWidthAndHeight=o.createTextureLayoutFromTextureType=void 0;const a=s(2517),_=s(2039);o.createTextureLayoutFromTextureType=($,_e,tt)=>{const st=tt===_.TextureType.unpacked||tt===_.TextureType.unpackedReversed?1:4,it=tt===_.TextureType.packed,nt=tt===_.TextureType.unpackedReversed||tt===_.TextureType.packed,et=tt===_.TextureType.packedLastDimension?_e.length-1:void 0,j=tt===_.TextureType.packedLastDimension?_e.map((rt,ot)=>ot===_e.length-1?4*rt:rt):void 0;return(0,o.createTextureLayoutFromShape)($,_e,st,j,{isPacked:it,reverseWH:nt,breakAxis:et})},o.calculateTextureWidthAndHeight=($,_e,tt)=>{const st=(0,o.createTextureLayoutFromTextureType)($,_e,tt);return[st.width,st.height]},o.createTextureLayoutFromShape=($,_e,tt=1,st,it)=>{const nt=!(!it||!it.isPacked),[et,j]=$.computeTextureWH(nt&&st||_e,it),rt=_e.length;let ot=_e.slice(0);if(rt===0&&(ot=[1]),tt===1)st=_e;else if(nt){if(tt!==4)throw new Error("a packed texture must be 4-channel");st=_e,rt>0&&(ot[rt-1]=Math.ceil(ot[rt-1]/2)),rt>1&&(ot[rt-2]=Math.ceil(ot[rt-2]/2))}else if(!st)throw new Error("Unpacked shape is needed when using channels > 1");return{width:et,height:j,channels:tt,isPacked:nt,shape:ot,strides:a.ShapeUtil.computeStrides(ot),unpackedShape:st,reversedWH:it&&it.reverseWH}}},5702:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.TextureManager=void 0;const a=s(6231);o.TextureManager=class{constructor(_,$,_e,tt){this.glContext=_,this.layoutStrategy=$,this.profiler=_e,this.config=tt,this.pendingRead=new Map,tt.reuseTextures&&(this.inUseTextures=new Map,this.idleTextures=new Map,this.textureLookup=new Map)}createTextureFromLayout(_,$,_e,tt){const st=this.toEncoderType(_),it=this.glContext.getEncoder(st,$.channels||1,tt);if($.isPacked&&tt===1)throw new Error("not implemented");const nt=$.width,et=$.height;let j,rt;if(this.config.reuseTextures){j=`${nt}x${et}_${it.format}_${it.internalFormat}_${it.textureType}`,rt=this.inUseTextures.get(j),rt||(rt=[],this.inUseTextures.set(j,rt));const at=this.idleTextures.get(j);if(at&&at.length>0){const lt=at.pop();return rt.push(lt),tt===1&&this.glContext.updateTexture(lt,nt,et,it,this.toTextureData(_,_e)),lt}}a.Logger.verbose("TextureManager",`Creating new texture of size ${$.width}x${$.height}`);const ot=this.glContext.allocateTexture(nt,et,it,this.toTextureData(_,_e));return this.config.reuseTextures&&(rt.push(ot),this.textureLookup.set(ot,j)),ot}readTexture(_,$,_e){return _e||(_e=1),this.profiler.event("backend","TextureManager.readTexture",()=>{const tt=_.shape.reduce((it,nt)=>it*nt)*_e,st=this.glContext.readTexture(_.texture,_.width,_.height,tt,this.toEncoderType($),_e);return this.toTensorData($,st)})}async readTextureAsync(_,$,_e){const tt=_.tensor.dataId;if(_e||(_e=1),this.pendingRead.has(tt)){const st=this.pendingRead.get(tt);return new Promise(it=>st==null?void 0:st.push(it))}return this.profiler.event("backend","TextureManager.readTextureAsync",async()=>{this.pendingRead.set(tt,[]);const st=_.shape.reduce((j,rt)=>j*rt)*_e;await this.glContext.createAndWaitForFence();const it=this.glContext.readTexture(_.texture,_.width,_.height,st,this.toEncoderType($),_e),nt=this.toTensorData($,it),et=this.pendingRead.get(tt);return this.pendingRead.delete(tt),et==null||et.forEach(j=>j(nt)),nt})}readUint8TextureAsFloat(_){return this.profiler.event("backend","TextureManager.readUint8TextureAsFloat",()=>{const $=_.shape.reduce((tt,st)=>tt*st),_e=this.glContext.readTexture(_.texture,_.width,_.height,4*$,"byte",4);return new Float32Array(_e.buffer,_e.byteOffset,$)})}releaseTexture(_,$){let _e;if(this.config.reuseTextures&&(_e=this.textureLookup.get(_.texture),_e)){$&&this.textureLookup.delete(_e);const tt=this.inUseTextures.get(_e);if(tt){const st=tt.indexOf(_.texture);if(st!==-1){tt.splice(st,1);let it=this.idleTextures.get(_e);it||(it=[],this.idleTextures.set(_e,it)),it.push(_.texture)}}}_e&&!$||(a.Logger.verbose("TextureManager",`Deleting texture of size ${_.width}x${_.height}`),this.glContext.deleteTexture(_.texture))}toTensorData(_,$){switch(_){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 ${_} is not supported`)}}toTextureData(_,$){if($)return $ instanceof Float32Array?$:new Float32Array($)}toEncoderType(_){return"float"}clearActiveTextures(){this.glContext.clearActiveTextures()}}},2039:(i,o)=>{var s;Object.defineProperty(o,"__esModule",{value:!0}),o.TextureType=void 0,(s=o.TextureType||(o.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,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.getGlChannels=o.getCoordsDataType=o.getSqueezedParams=o.squeezeInputShape=o.generateShaderFuncNameFromInputSamplerNameAtOutCoords=o.generateShaderFuncNameFromInputSamplerName=o.repeatedTry=o.getPackedShape=void 0;const a=s(2517);o.getPackedShape=function(_){const $=_.length;return _.slice(0,$-1).concat(_[$-1]/4)},o.repeatedTry=async function(_,$=tt=>0,_e){return new Promise((tt,st)=>{let it=0;const nt=()=>{if(_())return void tt();it++;const et=$(it);_e!=null&&it>=_e?st():setTimeout(nt,et)};nt()})},o.generateShaderFuncNameFromInputSamplerName=function(_){return(0,a.assert)(_!==void 0&&_.length!==0,()=>"empty string found for sampler name"),"get"+_.charAt(0).toUpperCase()+_.slice(1)},o.generateShaderFuncNameFromInputSamplerNameAtOutCoords=function(_){return(0,a.assert)(_!==void 0&&_.length!==0,()=>"empty string found for sampler name"),"get"+_.charAt(0).toUpperCase()+_.slice(1)+"AtOutCoords"},o.squeezeInputShape=function(_,$){let _e=JSON.parse(JSON.stringify(_));return _e=$,_e},o.getSqueezedParams=function(_,$){return $.map(_e=>_[_e]).join(", ")},o.getCoordsDataType=function(_){if(_<=1)return"int";if(_===2)return"ivec2";if(_===3)return"ivec3";if(_===4)return"ivec4";if(_===5)return"ivec5";if(_===6)return"ivec6";throw Error(`GPU for rank ${_} is not yet supported`)},o.getGlChannels=function(_=6){return["x","y","z","w","u","v"].slice(0,_)}},7305:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createNewWebGLContext=o.createWebGLContext=void 0;const a=s(6231),_=s(1713),$={};function _e(tt){const st=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 et=document.createElement("canvas");return et.width=1,et.height=1,et}();let it;const nt={alpha:!1,depth:!1,antialias:!1,stencil:!1,preserveDrawingBuffer:!1,premultipliedAlpha:!1,failIfMajorPerformanceCaveat:!1};if((!tt||tt==="webgl2")&&(it=st.getContext("webgl2",nt),it))try{return new _.WebGLContext(it,2)}catch(et){a.Logger.warning("GlContextFactory",`failed to create WebGLContext using contextId 'webgl2'. Error: ${et}`)}if((!tt||tt==="webgl")&&(it=st.getContext("webgl",nt)||st.getContext("experimental-webgl",nt),it))try{return new _.WebGLContext(it,1)}catch(et){a.Logger.warning("GlContextFactory",`failed to create WebGLContext using contextId 'webgl' or 'experimental-webgl'. Error: ${et}`)}throw new Error("WebGL is not supported")}o.createWebGLContext=function tt(st){let it;st&&st!=="webgl2"||!("webgl2"in $)?st&&st!=="webgl"||!("webgl"in $)||(it=$.webgl):it=$.webgl2,it=it||_e(st),st=st||it.version===1?"webgl":"webgl2";const nt=it.gl;return $[st]=it,nt.isContextLost()?(delete $[st],tt(st)):(nt.disable(nt.DEPTH_TEST),nt.disable(nt.STENCIL_TEST),nt.disable(nt.BLEND),nt.disable(nt.DITHER),nt.disable(nt.POLYGON_OFFSET_FILL),nt.disable(nt.SAMPLE_COVERAGE),nt.enable(nt.SCISSOR_TEST),nt.enable(nt.CULL_FACE),nt.cullFace(nt.BACK),it)},o.createNewWebGLContext=_e},1713:function(i,o,s){var a=this&&this.__createBinding||(Object.create?function(nt,et,j,rt){rt===void 0&&(rt=j);var ot=Object.getOwnPropertyDescriptor(et,j);ot&&!("get"in ot?!et.__esModule:ot.writable||ot.configurable)||(ot={enumerable:!0,get:function(){return et[j]}}),Object.defineProperty(nt,rt,ot)}:function(nt,et,j,rt){rt===void 0&&(rt=j),nt[rt]=et[j]}),_=this&&this.__setModuleDefault||(Object.create?function(nt,et){Object.defineProperty(nt,"default",{enumerable:!0,value:et})}:function(nt,et){nt.default=et}),$=this&&this.__importStar||function(nt){if(nt&&nt.__esModule)return nt;var et={};if(nt!=null)for(var j in nt)j!=="default"&&Object.prototype.hasOwnProperty.call(nt,j)&&a(et,nt,j);return _(et,nt),et};Object.defineProperty(o,"__esModule",{value:!0}),o.WebGLContext=o.linearSearchLastTrue=void 0;const _e=s(1670),tt=$(s(7769)),st=s(9390);function it(nt){let et=0;for(;etthis.isTimerResultAvailable(nt)),this.getTimerResult(nt)}async createAndWaitForFence(){const nt=this.createFence(this.gl);return this.pollFence(nt)}createFence(nt){let et;const j=nt,rt=j.fenceSync(j.SYNC_GPU_COMMANDS_COMPLETE,0);return nt.flush(),et=rt===null?()=>!0:()=>{const ot=j.clientWaitSync(rt,0,0);return ot===j.ALREADY_SIGNALED||ot===j.CONDITION_SATISFIED},{query:rt,isFencePassed:et}}async pollFence(nt){return new Promise(et=>{this.addItemToPoll(()=>nt.isFencePassed(),()=>et())})}pollItems(){const nt=it(this.itemsToPoll.map(et=>et.isDoneFn));for(let et=0;et<=nt;++et){const{resolveFn:j}=this.itemsToPoll[et];j()}this.itemsToPoll=this.itemsToPoll.slice(nt+1)}async addItemToPoll(nt,et){this.itemsToPoll.push({isDoneFn:nt,resolveFn:et}),this.itemsToPoll.length>1||await(0,st.repeatedTry)(()=>(this.pollItems(),this.itemsToPoll.length===0))}}},1036:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ExecutionPlan=void 0;const a=s(6231);class _{constructor(_e,tt){this.op=_e,this.node=tt}}o.ExecutionPlan=class{constructor($,_e,tt){this.graph=$,this.profiler=tt,this.initialize(_e)}initialize($){this.profiler.event("session","ExecutionPlan.initialize",()=>{const _e=this.graph.getNodes();if(_e.length!==$.length)throw new Error("The size of nodes and OPs do not match.");this._ops=$.map((tt,st)=>new _(tt,_e[st])),this.reset(),this._starter=[],this._ops.forEach((tt,st)=>{let it=!0;for(const nt of tt.node.inputs)if(!this._values[nt]&&this.graph.getInputIndices().indexOf(nt)===-1){it=!1;break}it&&this._starter.push(st)})})}reset(){this._values=this.graph.getValues().map($=>$.tensor)}async execute($,_e){return this.profiler.event("session","ExecutionPlan.execute",async()=>{this.reset();const tt=$.createInferenceHandler(),st=this.graph.getInputIndices();if(_e.length!==st.length)throw new Error(`number of input tensors don't match the number of inputs to the model: actual: ${_e.length} expected: ${st.length}`);_e.forEach((ot,at)=>{const lt=st[at];this._values[lt]=ot});const it=this._starter.slice(0),nt=this.graph.getValues(),et=this.graph.getNodes();let j=0;for(;jthis._values[ft]);if(lt.indexOf(void 0)!==-1)throw new Error(`unresolved input detected: op: ${at.node}`);const ut=lt;a.Logger.verbose("ExecPlan",`Runing op:${at.node.name} (${ut.map((ft,ht)=>`'${at.node.inputs[ht]}': ${ft.type}[${ft.dims.join(",")}]`).join(", ")})`);const ct=await this.profiler.event("node",at.node.name,async()=>at.op.impl(tt,ut,at.op.context));if(ct.length!==at.node.outputs.length)throw new Error("the size of output does not match model definition.");ct.forEach((ft,ht)=>{const bt=at.node.outputs[ht];if(this._values[bt])throw new Error(`output [${bt}] already has value: op:${at.node.name}`);this._values[bt]=ft});const dt=new Set;ct.forEach((ft,ht)=>{const bt=at.node.outputs[ht];for(const yt of nt[bt].to){const mt=et[yt];let gt=!0;for(const vt of mt.inputs)if(!this._values[vt]){gt=!1;break}gt&&dt.add(yt)}}),it.push(...dt)}const rt=[];for(let ot=0;ot{Object.defineProperty(o,"__esModule",{value:!0}),o.Graph=void 0;const a=s(1446),_=s(7778),$=s(9395),_e=s(9162),tt=s(2517);var st=$.onnxruntime.experimental.fbs;o.Graph={from:(j,rt)=>new et(j,rt)};class it{constructor(rt){this._from=void 0,this._to=[],this.tensor=void 0,this.type=void 0,rt&&(this.type=tt.ProtoUtil.tensorValueTypeFromProto(rt.type.tensorType))}get from(){return this._from}get to(){return this._to}}class nt{constructor(rt,ot){rt instanceof a.onnx.NodeProto?(this.name=rt.name,this.opType=rt.opType,this.attributes=new _.Attribute(rt.attribute)):rt instanceof st.Node&&(this.name=ot??rt.name(),this.opType=rt.opType(),this.attributes=new _.Attribute(tt.ProtoUtil.tensorAttributesFromORTFormat(rt))),this.inputs=[],this.outputs=[],this.executeNode=!0}}class et{constructor(rt,ot){if(!rt)throw new TypeError("graph is empty");this.buildGraph(rt),this.transformGraph(ot),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(rt){if(rt instanceof a.onnx.GraphProto)this.buildGraphFromOnnxFormat(rt);else{if(!(rt instanceof st.Graph))throw new TypeError("Graph type is not supported.");this.buildGraphFromOrtFormat(rt)}}buildGraphFromOnnxFormat(rt){const ot=new Map;this._allData=[],this._allInputIndices=[],this._allInputNames=[],this._allOutputIndices=[],this._allOutputNames=[],this._nodes=[];const at=new Map;if(!rt.input)throw new Error("missing information in graph: input");const lt=[];for(const ut of rt.input){if(ot.has(ut.name))throw new Error(`duplicated input name: ${ut.name}`);const ct=this._allData.push(new it(ut))-1;ot.set(ut.name,ct),lt.push(ut.name)}if(!rt.initializer)throw new Error("missing information in graph: initializer");for(const ut of rt.initializer){let ct=ot.get(ut.name);if(ct===void 0){const dt=new it;dt.type={shape:{dims:tt.ProtoUtil.tensorDimsFromProto(ut.dims)},tensorType:tt.ProtoUtil.tensorDataTypeFromProto(ut.dataType)},ct=this._allData.push(dt)-1,ot.set(ut.name,ct)}this._allData[ct]._from=-1,this._allData[ct].tensor=_e.Tensor.fromProto(ut)}for(let ut=0;ut{this._allData[lt]._to.forEach(ut=>{rt.add(ut)})});const ot=Array.from(rt),at=new Array(this._nodes.length).fill("white");for(;ot.length>0;){const lt=ot.pop();at[lt]==="gray"?at[lt]="black":(ot.push(lt),at[lt]="gray",this._nodes[lt].outputs.forEach(ut=>{const ct=this._allData[ut];if(ct.tensor!==void 0)throw new Error("node outputs should not be initialized");if(ct._from!==lt)throw new Error("from property of the Value object doesn't match index of Node being processed");ct._to.forEach(dt=>{if(at[dt]==="gray")throw new Error("model graph is cyclic");at[dt]==="white"&&ot.push(dt)})}))}}transformGraph(rt){this.removeAllIdentityNodes(),this.removeAllDropoutNodes(),this.fuseConvActivationNodes(),rt&&rt.transformGraph(this),this.finalizeGraph()}finalizeGraph(){let rt=0;for(let ot=0;ot0&&(this._nodes[ot].inputs.forEach(at=>{const lt=this._allData[at]._to.indexOf(ot+rt);lt!==-1&&(this._allData[at]._to[lt]=ot)}),this._nodes[ot].outputs.forEach(at=>{this._allData[at]._from&&this._allData[at]._from===ot+rt&&(this._allData[at]._from=ot)})):(rt++,this._nodes[ot].outputs.forEach(at=>{this._allData[at]._from=-2}),this._nodes.splice(ot,1),ot--);rt=0;for(let ot=0;ot0){let at=-1;this._allData[ot].from!==void 0&&this._allData[ot].from!==-1?(at=this._nodes[this._allData[ot].from].outputs.indexOf(ot+rt),at!==-1&&(this._nodes[this._allData[ot].from].outputs[at]=ot)):(at=this._allInputIndices.indexOf(ot+rt),at!==-1&&(this._allInputIndices[at]=ot)),this._allData[ot].to.forEach(lt=>{at=this._nodes[lt].inputs.indexOf(ot+rt),at!==-1&&(this._nodes[lt].inputs[at]=ot)}),this._allData[ot].to.length===0&&(at=this._allOutputIndices.indexOf(ot+rt),at!==-1&&(this._allOutputIndices[at]=ot))}}else rt++,this._allData.splice(ot,1),ot--}deleteNode(rt){const ot=this._nodes[rt];if(ot.outputs.length>1){for(let ft=1;ft0)throw new Error("Node deletion with more than one output connected to other nodes is not supported. ")}ot.executeNode=!1;const at=ot.inputs[0],lt=ot.outputs[0],ut=this._allData[lt].to,ct=this._allData[at].to.indexOf(rt);if(ct===-1)throw new Error("The Value object doesn't have the current Node in it's 'to' property ");this._allData[at].to.splice(ct,1),this._allData[lt]._to=[];const dt=this._allOutputIndices.indexOf(lt);if(dt!==-1&&(this._allOutputIndices[dt]=at),ut&&ut.length>0)for(const ft of ut){const ht=this._nodes[ft].inputs.indexOf(lt);if(ht===-1)throw new Error("The Node object doesn't have the output Value in it's 'inputs' property ");this._nodes[ft].inputs[ht]=at,this._allData[at].to.push(ft)}}removeAllDropoutNodes(){let rt=0;for(const ot of this._nodes){if(ot.opType==="Dropout"){if(ot.inputs.length!==1)throw new Error("Dropout nodes should only contain one input. ");if(ot.outputs.length!==1&&ot.outputs.length!==2)throw new Error("Dropout nodes should contain either 1 or 2 output(s)");if(ot.outputs.length===2&&this._allData[ot.outputs[1]]._to.length!==0)throw new Error("Dropout nodes's second output should not be referenced by other nodes");this.deleteNode(rt)}rt++}}removeAllIdentityNodes(){let rt=0;for(const ot of this._nodes)ot.opType==="Identity"&&this.deleteNode(rt),rt++}isActivation(rt){switch(rt.opType){case"Relu":case"Sigmoid":case"Clip":return!0;default:return!1}}fuseConvActivationNodes(){for(const rt of this._nodes)if(rt.opType==="Conv"){const ot=this._allData[rt.outputs[0]]._to;if(ot.length===1&&this.isActivation(this._nodes[ot[0]])){const at=this._nodes[ot[0]];if(at.opType==="Clip")if(at.inputs.length===1)try{rt.attributes.set("activation_params","floats",[at.attributes.getFloat("min"),at.attributes.getFloat("max")])}catch{rt.attributes.set("activation_params","floats",[tt.MIN_CLIP,tt.MAX_CLIP])}else{if(!(at.inputs.length>=3&&this._allData[at.inputs[1]].tensor!==void 0&&this._allData[at.inputs[2]].tensor!==void 0))continue;rt.attributes.set("activation_params","floats",[this._allData[at.inputs[1]].tensor.floatData[0],this._allData[at.inputs[2]].tensor.floatData[0]])}rt.attributes.set("activation","string",at.opType),this.deleteNode(ot[0])}}}}},6231:(i,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.now=o.Profiler=o.Logger=void 0;const s={verbose:1e3,info:2e3,warning:4e3,error:5e3,fatal:6e3},a={none:new class{log(nt,et,j){}},console:new class{log(nt,et,j){console.log(`${this.color(nt)} ${j?"\x1B[35m"+j+"\x1B[0m ":""}${et}`)}color(nt){switch(nt){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: ${nt}`)}}}},_={provider:"console",minimalSeverity:"warning",logDateTime:!0,logSourceLocation:!1};let $={"":_};function _e(nt,et,j,rt){if(et===void 0)return ot=nt,{verbose:_e.verbose.bind(null,ot),info:_e.info.bind(null,ot),warning:_e.warning.bind(null,ot),error:_e.error.bind(null,ot),fatal:_e.fatal.bind(null,ot)};if(j===void 0)tt(nt,et);else if(typeof j=="number"&&rt===void 0)tt(nt,et);else if(typeof j=="string"&&rt===void 0)tt(nt,j,0,et);else{if(typeof j!="string"||typeof rt!="number")throw new TypeError("input is valid");tt(nt,j,0,et)}var ot}function tt(nt,et,j,rt){const ot=$[rt||""]||$[""];s[nt]{lt.then(async dt=>{ot&&await ot.end(),ut(dt)},async dt=>{ot&&await ot.end(),ct(dt)})});if(!at&&ot){const ut=ot.end();if(ut&&typeof ut.then=="function")return new Promise((ct,dt)=>{ut.then(()=>{ct(lt)},ft=>{dt(ft)})})}return lt}begin(nt,et,j){if(!this._started)throw new Error("profiler is not started yet");if(j===void 0){const rt=(0,o.now)();return this.flush(rt),new st(nt,et,rt,ot=>this.endSync(ot))}{const rt=j.beginTimer();return new st(nt,et,0,async ot=>this.end(ot),rt,j)}}async end(nt){const et=await nt.checkTimer();this._timingEvents.length=this._flushBatchSize||nt-this._flushTime>=this._flushIntervalInMilliseconds){for(const et=this._flushPointer;this._flushPointerperformance.now():Date.now},2644:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Model=void 0;const a=s(5686),_=s(1446),$=s(7070),_e=s(9395),tt=s(2517);var st=_e.onnxruntime.experimental.fbs;o.Model=class{constructor(){}load(it,nt,et){if(!et)try{return void this.loadFromOnnxFormat(it,nt)}catch(j){if(et!==void 0)throw j}this.loadFromOrtFormat(it,nt)}loadFromOnnxFormat(it,nt){const et=_.onnx.ModelProto.decode(it);if(tt.LongUtil.longToNumber(et.irVersion)<3)throw new Error("only support ONNX model with IR_VERSION>=3");this._opsets=et.opsetImport.map(j=>({domain:j.domain,version:tt.LongUtil.longToNumber(j.version)})),this._graph=$.Graph.from(et.graph,nt)}loadFromOrtFormat(it,nt){const et=new a.flatbuffers.ByteBuffer(it),j=st.InferenceSession.getRootAsInferenceSession(et).model();if(tt.LongUtil.longToNumber(j.irVersion())<3)throw new Error("only support ONNX model with IR_VERSION>=3");this._opsets=[];for(let rt=0;rt{Object.defineProperty(o,"__esModule",{value:!0}),o.FLOAT_TYPES=o.INT_TYPES=o.NUMBER_TYPES=void 0,o.NUMBER_TYPES=["float32","float64","int32","int16","int8","uint16","uint32","uint8"],o.INT_TYPES=["int32","int16","int8","uint16","uint32","uint8"],o.FLOAT_TYPES=["float32","float64"]},1047:(i,o)=>{function s(a,_){if(_.endsWith("+")){const $=Number.parseInt(_.substring(0,_.length-1),10);return!isNaN($)&&$<=a}if(_.split("-").length===2){const $=_.split("-"),_e=Number.parseInt($[0],10),tt=Number.parseInt($[1],10);return!isNaN(_e)&&!isNaN(tt)&&_e<=a&&a<=tt}return Number.parseInt(_,10)===a}Object.defineProperty(o,"__esModule",{value:!0}),o.resolveOperator=void 0,o.resolveOperator=function(a,_,$){for(const _e of $){const tt=_e[0],st=_e[1],it=_e[2],nt=_e[3],et=_e[4];if(a.opType===tt){for(const j of _)if((j.domain===st||j.domain==="ai.onnx"&&st==="")&&s(j.version,it))return{opImpl:nt,opInit:et}}}throw new TypeError(`cannot resolve operator '${a.opType}' with opsets: ${_.map(_e=>`${_e.domain||"ai.onnx"} v${_e.version}`).join(", ")}`)}},9395:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.onnxruntime=void 0;const a=s(5686);var _,$;_=o.onnxruntime||(o.onnxruntime={}),function(_e){(function(tt){tt[tt.UNDEFINED=0]="UNDEFINED",tt[tt.FLOAT=1]="FLOAT",tt[tt.INT=2]="INT",tt[tt.STRING=3]="STRING",tt[tt.TENSOR=4]="TENSOR",tt[tt.GRAPH=5]="GRAPH",tt[tt.FLOATS=6]="FLOATS",tt[tt.INTS=7]="INTS",tt[tt.STRINGS=8]="STRINGS",tt[tt.TENSORS=9]="TENSORS",tt[tt.GRAPHS=10]="GRAPHS",tt[tt.SPARSE_TENSOR=11]="SPARSE_TENSOR",tt[tt.SPARSE_TENSORS=12]="SPARSE_TENSORS"})(_e.AttributeType||(_e.AttributeType={}))}(($=_.experimental||(_.experimental={})).fbs||($.fbs={})),function(_e){(function(tt){(function(st){(function(it){it[it.UNKNOWN=0]="UNKNOWN",it[it.VALUE=1]="VALUE",it[it.PARAM=2]="PARAM"})(st.DimensionValueType||(st.DimensionValueType={}))})(tt.fbs||(tt.fbs={}))})(_e.experimental||(_e.experimental={}))}(o.onnxruntime||(o.onnxruntime={})),function(_e){(function(tt){(function(st){(function(it){it[it.UNDEFINED=0]="UNDEFINED",it[it.FLOAT=1]="FLOAT",it[it.UINT8=2]="UINT8",it[it.INT8=3]="INT8",it[it.UINT16=4]="UINT16",it[it.INT16=5]="INT16",it[it.INT32=6]="INT32",it[it.INT64=7]="INT64",it[it.STRING=8]="STRING",it[it.BOOL=9]="BOOL",it[it.FLOAT16=10]="FLOAT16",it[it.DOUBLE=11]="DOUBLE",it[it.UINT32=12]="UINT32",it[it.UINT64=13]="UINT64",it[it.COMPLEX64=14]="COMPLEX64",it[it.COMPLEX128=15]="COMPLEX128",it[it.BFLOAT16=16]="BFLOAT16"})(st.TensorDataType||(st.TensorDataType={}))})(tt.fbs||(tt.fbs={}))})(_e.experimental||(_e.experimental={}))}(o.onnxruntime||(o.onnxruntime={})),function(_e){(function(tt){(function(st){(function(it){it[it.Primitive=0]="Primitive",it[it.Fused=1]="Fused"})(st.NodeType||(st.NodeType={}))})(tt.fbs||(tt.fbs={}))})(_e.experimental||(_e.experimental={}))}(o.onnxruntime||(o.onnxruntime={})),function(_e){(function(tt){(function(st){(function(it){it[it.NONE=0]="NONE",it[it.tensor_type=1]="tensor_type",it[it.sequence_type=2]="sequence_type",it[it.map_type=3]="map_type"})(st.TypeInfoValue||(st.TypeInfoValue={}))})(tt.fbs||(tt.fbs={}))})(_e.experimental||(_e.experimental={}))}(o.onnxruntime||(o.onnxruntime={})),function(_e){(function(tt){(function(st){class it{constructor(){this.bb=null,this.bb_pos=0}__init(et,j){return this.bb_pos=et,this.bb=j,this}static getRootAsShape(et,j){return(j||new it).__init(et.readInt32(et.position())+et.position(),et)}static getSizePrefixedRootAsShape(et,j){return et.setPosition(et.position()+a.flatbuffers.SIZE_PREFIX_LENGTH),(j||new it).__init(et.readInt32(et.position())+et.position(),et)}dim(et,j){let rt=this.bb.__offset(this.bb_pos,4);return rt?(j||new _e.experimental.fbs.Dimension).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+rt)+4*et),this.bb):null}dimLength(){let et=this.bb.__offset(this.bb_pos,4);return et?this.bb.__vector_len(this.bb_pos+et):0}static startShape(et){et.startObject(1)}static addDim(et,j){et.addFieldOffset(0,j,0)}static createDimVector(et,j){et.startVector(4,j.length,4);for(let rt=j.length-1;rt>=0;rt--)et.addOffset(j[rt]);return et.endVector()}static startDimVector(et,j){et.startVector(4,j,4)}static endShape(et){return et.endObject()}static createShape(et,j){return it.startShape(et),it.addDim(et,j),it.endShape(et)}}st.Shape=it})(tt.fbs||(tt.fbs={}))})(_e.experimental||(_e.experimental={}))}(o.onnxruntime||(o.onnxruntime={})),function(_e){(function(tt){(function(st){class it{constructor(){this.bb=null,this.bb_pos=0}__init(et,j){return this.bb_pos=et,this.bb=j,this}static getRootAsDimension(et,j){return(j||new it).__init(et.readInt32(et.position())+et.position(),et)}static getSizePrefixedRootAsDimension(et,j){return et.setPosition(et.position()+a.flatbuffers.SIZE_PREFIX_LENGTH),(j||new it).__init(et.readInt32(et.position())+et.position(),et)}value(et){let j=this.bb.__offset(this.bb_pos,4);return j?(et||new _e.experimental.fbs.DimensionValue).__init(this.bb.__indirect(this.bb_pos+j),this.bb):null}denotation(et){let j=this.bb.__offset(this.bb_pos,6);return j?this.bb.__string(this.bb_pos+j,et):null}static startDimension(et){et.startObject(2)}static addValue(et,j){et.addFieldOffset(0,j,0)}static addDenotation(et,j){et.addFieldOffset(1,j,0)}static endDimension(et){return et.endObject()}static createDimension(et,j,rt){return it.startDimension(et),it.addValue(et,j),it.addDenotation(et,rt),it.endDimension(et)}}st.Dimension=it})(tt.fbs||(tt.fbs={}))})(_e.experimental||(_e.experimental={}))}(o.onnxruntime||(o.onnxruntime={})),function(_e){(function(tt){(function(st){class it{constructor(){this.bb=null,this.bb_pos=0}__init(et,j){return this.bb_pos=et,this.bb=j,this}static getRootAsDimensionValue(et,j){return(j||new it).__init(et.readInt32(et.position())+et.position(),et)}static getSizePrefixedRootAsDimensionValue(et,j){return et.setPosition(et.position()+a.flatbuffers.SIZE_PREFIX_LENGTH),(j||new it).__init(et.readInt32(et.position())+et.position(),et)}dimType(){let et=this.bb.__offset(this.bb_pos,4);return et?this.bb.readInt8(this.bb_pos+et):_e.experimental.fbs.DimensionValueType.UNKNOWN}dimValue(){let et=this.bb.__offset(this.bb_pos,6);return et?this.bb.readInt64(this.bb_pos+et):this.bb.createLong(0,0)}dimParam(et){let j=this.bb.__offset(this.bb_pos,8);return j?this.bb.__string(this.bb_pos+j,et):null}static startDimensionValue(et){et.startObject(3)}static addDimType(et,j){et.addFieldInt8(0,j,_e.experimental.fbs.DimensionValueType.UNKNOWN)}static addDimValue(et,j){et.addFieldInt64(1,j,et.createLong(0,0))}static addDimParam(et,j){et.addFieldOffset(2,j,0)}static endDimensionValue(et){return et.endObject()}static createDimensionValue(et,j,rt,ot){return it.startDimensionValue(et),it.addDimType(et,j),it.addDimValue(et,rt),it.addDimParam(et,ot),it.endDimensionValue(et)}}st.DimensionValue=it})(tt.fbs||(tt.fbs={}))})(_e.experimental||(_e.experimental={}))}(o.onnxruntime||(o.onnxruntime={})),function(_e){(function(tt){(function(st){class it{constructor(){this.bb=null,this.bb_pos=0}__init(et,j){return this.bb_pos=et,this.bb=j,this}static getRootAsTensorTypeAndShape(et,j){return(j||new it).__init(et.readInt32(et.position())+et.position(),et)}static getSizePrefixedRootAsTensorTypeAndShape(et,j){return et.setPosition(et.position()+a.flatbuffers.SIZE_PREFIX_LENGTH),(j||new it).__init(et.readInt32(et.position())+et.position(),et)}elemType(){let et=this.bb.__offset(this.bb_pos,4);return et?this.bb.readInt32(this.bb_pos+et):_e.experimental.fbs.TensorDataType.UNDEFINED}shape(et){let j=this.bb.__offset(this.bb_pos,6);return j?(et||new _e.experimental.fbs.Shape).__init(this.bb.__indirect(this.bb_pos+j),this.bb):null}static startTensorTypeAndShape(et){et.startObject(2)}static addElemType(et,j){et.addFieldInt32(0,j,_e.experimental.fbs.TensorDataType.UNDEFINED)}static addShape(et,j){et.addFieldOffset(1,j,0)}static endTensorTypeAndShape(et){return et.endObject()}static createTensorTypeAndShape(et,j,rt){return it.startTensorTypeAndShape(et),it.addElemType(et,j),it.addShape(et,rt),it.endTensorTypeAndShape(et)}}st.TensorTypeAndShape=it})(tt.fbs||(tt.fbs={}))})(_e.experimental||(_e.experimental={}))}(o.onnxruntime||(o.onnxruntime={})),function(_e){(function(tt){(function(st){class it{constructor(){this.bb=null,this.bb_pos=0}__init(et,j){return this.bb_pos=et,this.bb=j,this}static getRootAsMapType(et,j){return(j||new it).__init(et.readInt32(et.position())+et.position(),et)}static getSizePrefixedRootAsMapType(et,j){return et.setPosition(et.position()+a.flatbuffers.SIZE_PREFIX_LENGTH),(j||new it).__init(et.readInt32(et.position())+et.position(),et)}keyType(){let et=this.bb.__offset(this.bb_pos,4);return et?this.bb.readInt32(this.bb_pos+et):_e.experimental.fbs.TensorDataType.UNDEFINED}valueType(et){let j=this.bb.__offset(this.bb_pos,6);return j?(et||new _e.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+j),this.bb):null}static startMapType(et){et.startObject(2)}static addKeyType(et,j){et.addFieldInt32(0,j,_e.experimental.fbs.TensorDataType.UNDEFINED)}static addValueType(et,j){et.addFieldOffset(1,j,0)}static endMapType(et){return et.endObject()}static createMapType(et,j,rt){return it.startMapType(et),it.addKeyType(et,j),it.addValueType(et,rt),it.endMapType(et)}}st.MapType=it})(tt.fbs||(tt.fbs={}))})(_e.experimental||(_e.experimental={}))}(o.onnxruntime||(o.onnxruntime={})),function(_e){(function(tt){(function(st){class it{constructor(){this.bb=null,this.bb_pos=0}__init(et,j){return this.bb_pos=et,this.bb=j,this}static getRootAsSequenceType(et,j){return(j||new it).__init(et.readInt32(et.position())+et.position(),et)}static getSizePrefixedRootAsSequenceType(et,j){return et.setPosition(et.position()+a.flatbuffers.SIZE_PREFIX_LENGTH),(j||new it).__init(et.readInt32(et.position())+et.position(),et)}elemType(et){let j=this.bb.__offset(this.bb_pos,4);return j?(et||new _e.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+j),this.bb):null}static startSequenceType(et){et.startObject(1)}static addElemType(et,j){et.addFieldOffset(0,j,0)}static endSequenceType(et){return et.endObject()}static createSequenceType(et,j){return it.startSequenceType(et),it.addElemType(et,j),it.endSequenceType(et)}}st.SequenceType=it})(tt.fbs||(tt.fbs={}))})(_e.experimental||(_e.experimental={}))}(o.onnxruntime||(o.onnxruntime={})),function(_e){(function(tt){(tt.fbs||(tt.fbs={})).EdgeEnd=class{constructor(){this.bb=null,this.bb_pos=0}__init(st,it){return this.bb_pos=st,this.bb=it,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(st,it,nt,et){return st.prep(4,12),st.writeInt32(et),st.writeInt32(nt),st.writeInt32(it),st.offset()}}})(_e.experimental||(_e.experimental={}))}(o.onnxruntime||(o.onnxruntime={})),function(_e){(function(tt){(function(st){class it{constructor(){this.bb=null,this.bb_pos=0}__init(et,j){return this.bb_pos=et,this.bb=j,this}static getRootAsNodeEdge(et,j){return(j||new it).__init(et.readInt32(et.position())+et.position(),et)}static getSizePrefixedRootAsNodeEdge(et,j){return et.setPosition(et.position()+a.flatbuffers.SIZE_PREFIX_LENGTH),(j||new it).__init(et.readInt32(et.position())+et.position(),et)}nodeIndex(){let et=this.bb.__offset(this.bb_pos,4);return et?this.bb.readUint32(this.bb_pos+et):0}inputEdges(et,j){let rt=this.bb.__offset(this.bb_pos,6);return rt?(j||new _e.experimental.fbs.EdgeEnd).__init(this.bb.__vector(this.bb_pos+rt)+12*et,this.bb):null}inputEdgesLength(){let et=this.bb.__offset(this.bb_pos,6);return et?this.bb.__vector_len(this.bb_pos+et):0}outputEdges(et,j){let rt=this.bb.__offset(this.bb_pos,8);return rt?(j||new _e.experimental.fbs.EdgeEnd).__init(this.bb.__vector(this.bb_pos+rt)+12*et,this.bb):null}outputEdgesLength(){let et=this.bb.__offset(this.bb_pos,8);return et?this.bb.__vector_len(this.bb_pos+et):0}static startNodeEdge(et){et.startObject(3)}static addNodeIndex(et,j){et.addFieldInt32(0,j,0)}static addInputEdges(et,j){et.addFieldOffset(1,j,0)}static startInputEdgesVector(et,j){et.startVector(12,j,4)}static addOutputEdges(et,j){et.addFieldOffset(2,j,0)}static startOutputEdgesVector(et,j){et.startVector(12,j,4)}static endNodeEdge(et){return et.endObject()}static createNodeEdge(et,j,rt,ot){return it.startNodeEdge(et),it.addNodeIndex(et,j),it.addInputEdges(et,rt),it.addOutputEdges(et,ot),it.endNodeEdge(et)}}st.NodeEdge=it})(tt.fbs||(tt.fbs={}))})(_e.experimental||(_e.experimental={}))}(o.onnxruntime||(o.onnxruntime={})),function(_e){(function(tt){(function(st){class it{constructor(){this.bb=null,this.bb_pos=0}__init(et,j){return this.bb_pos=et,this.bb=j,this}static getRootAsNode(et,j){return(j||new it).__init(et.readInt32(et.position())+et.position(),et)}static getSizePrefixedRootAsNode(et,j){return et.setPosition(et.position()+a.flatbuffers.SIZE_PREFIX_LENGTH),(j||new it).__init(et.readInt32(et.position())+et.position(),et)}name(et){let j=this.bb.__offset(this.bb_pos,4);return j?this.bb.__string(this.bb_pos+j,et):null}docString(et){let j=this.bb.__offset(this.bb_pos,6);return j?this.bb.__string(this.bb_pos+j,et):null}domain(et){let j=this.bb.__offset(this.bb_pos,8);return j?this.bb.__string(this.bb_pos+j,et):null}sinceVersion(){let et=this.bb.__offset(this.bb_pos,10);return et?this.bb.readInt32(this.bb_pos+et):0}index(){let et=this.bb.__offset(this.bb_pos,12);return et?this.bb.readUint32(this.bb_pos+et):0}opType(et){let j=this.bb.__offset(this.bb_pos,14);return j?this.bb.__string(this.bb_pos+j,et):null}type(){let et=this.bb.__offset(this.bb_pos,16);return et?this.bb.readInt32(this.bb_pos+et):_e.experimental.fbs.NodeType.Primitive}executionProviderType(et){let j=this.bb.__offset(this.bb_pos,18);return j?this.bb.__string(this.bb_pos+j,et):null}inputs(et,j){let rt=this.bb.__offset(this.bb_pos,20);return rt?this.bb.__string(this.bb.__vector(this.bb_pos+rt)+4*et,j):null}inputsLength(){let et=this.bb.__offset(this.bb_pos,20);return et?this.bb.__vector_len(this.bb_pos+et):0}outputs(et,j){let rt=this.bb.__offset(this.bb_pos,22);return rt?this.bb.__string(this.bb.__vector(this.bb_pos+rt)+4*et,j):null}outputsLength(){let et=this.bb.__offset(this.bb_pos,22);return et?this.bb.__vector_len(this.bb_pos+et):0}attributes(et,j){let rt=this.bb.__offset(this.bb_pos,24);return rt?(j||new _e.experimental.fbs.Attribute).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+rt)+4*et),this.bb):null}attributesLength(){let et=this.bb.__offset(this.bb_pos,24);return et?this.bb.__vector_len(this.bb_pos+et):0}inputArgCounts(et){let j=this.bb.__offset(this.bb_pos,26);return j?this.bb.readInt32(this.bb.__vector(this.bb_pos+j)+4*et):0}inputArgCountsLength(){let et=this.bb.__offset(this.bb_pos,26);return et?this.bb.__vector_len(this.bb_pos+et):0}inputArgCountsArray(){let et=this.bb.__offset(this.bb_pos,26);return et?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+et),this.bb.__vector_len(this.bb_pos+et)):null}implicitInputs(et,j){let rt=this.bb.__offset(this.bb_pos,28);return rt?this.bb.__string(this.bb.__vector(this.bb_pos+rt)+4*et,j):null}implicitInputsLength(){let et=this.bb.__offset(this.bb_pos,28);return et?this.bb.__vector_len(this.bb_pos+et):0}static startNode(et){et.startObject(13)}static addName(et,j){et.addFieldOffset(0,j,0)}static addDocString(et,j){et.addFieldOffset(1,j,0)}static addDomain(et,j){et.addFieldOffset(2,j,0)}static addSinceVersion(et,j){et.addFieldInt32(3,j,0)}static addIndex(et,j){et.addFieldInt32(4,j,0)}static addOpType(et,j){et.addFieldOffset(5,j,0)}static addType(et,j){et.addFieldInt32(6,j,_e.experimental.fbs.NodeType.Primitive)}static addExecutionProviderType(et,j){et.addFieldOffset(7,j,0)}static addInputs(et,j){et.addFieldOffset(8,j,0)}static createInputsVector(et,j){et.startVector(4,j.length,4);for(let rt=j.length-1;rt>=0;rt--)et.addOffset(j[rt]);return et.endVector()}static startInputsVector(et,j){et.startVector(4,j,4)}static addOutputs(et,j){et.addFieldOffset(9,j,0)}static createOutputsVector(et,j){et.startVector(4,j.length,4);for(let rt=j.length-1;rt>=0;rt--)et.addOffset(j[rt]);return et.endVector()}static startOutputsVector(et,j){et.startVector(4,j,4)}static addAttributes(et,j){et.addFieldOffset(10,j,0)}static createAttributesVector(et,j){et.startVector(4,j.length,4);for(let rt=j.length-1;rt>=0;rt--)et.addOffset(j[rt]);return et.endVector()}static startAttributesVector(et,j){et.startVector(4,j,4)}static addInputArgCounts(et,j){et.addFieldOffset(11,j,0)}static createInputArgCountsVector(et,j){et.startVector(4,j.length,4);for(let rt=j.length-1;rt>=0;rt--)et.addInt32(j[rt]);return et.endVector()}static startInputArgCountsVector(et,j){et.startVector(4,j,4)}static addImplicitInputs(et,j){et.addFieldOffset(12,j,0)}static createImplicitInputsVector(et,j){et.startVector(4,j.length,4);for(let rt=j.length-1;rt>=0;rt--)et.addOffset(j[rt]);return et.endVector()}static startImplicitInputsVector(et,j){et.startVector(4,j,4)}static endNode(et){return et.endObject()}static createNode(et,j,rt,ot,at,lt,ut,ct,dt,ft,ht,bt,yt,mt){return it.startNode(et),it.addName(et,j),it.addDocString(et,rt),it.addDomain(et,ot),it.addSinceVersion(et,at),it.addIndex(et,lt),it.addOpType(et,ut),it.addType(et,ct),it.addExecutionProviderType(et,dt),it.addInputs(et,ft),it.addOutputs(et,ht),it.addAttributes(et,bt),it.addInputArgCounts(et,yt),it.addImplicitInputs(et,mt),it.endNode(et)}}st.Node=it})(tt.fbs||(tt.fbs={}))})(_e.experimental||(_e.experimental={}))}(o.onnxruntime||(o.onnxruntime={})),function(_e){(function(tt){(function(st){class it{constructor(){this.bb=null,this.bb_pos=0}__init(et,j){return this.bb_pos=et,this.bb=j,this}static getRootAsValueInfo(et,j){return(j||new it).__init(et.readInt32(et.position())+et.position(),et)}static getSizePrefixedRootAsValueInfo(et,j){return et.setPosition(et.position()+a.flatbuffers.SIZE_PREFIX_LENGTH),(j||new it).__init(et.readInt32(et.position())+et.position(),et)}name(et){let j=this.bb.__offset(this.bb_pos,4);return j?this.bb.__string(this.bb_pos+j,et):null}docString(et){let j=this.bb.__offset(this.bb_pos,6);return j?this.bb.__string(this.bb_pos+j,et):null}type(et){let j=this.bb.__offset(this.bb_pos,8);return j?(et||new _e.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+j),this.bb):null}static startValueInfo(et){et.startObject(3)}static addName(et,j){et.addFieldOffset(0,j,0)}static addDocString(et,j){et.addFieldOffset(1,j,0)}static addType(et,j){et.addFieldOffset(2,j,0)}static endValueInfo(et){return et.endObject()}static createValueInfo(et,j,rt,ot){return it.startValueInfo(et),it.addName(et,j),it.addDocString(et,rt),it.addType(et,ot),it.endValueInfo(et)}}st.ValueInfo=it})(tt.fbs||(tt.fbs={}))})(_e.experimental||(_e.experimental={}))}(o.onnxruntime||(o.onnxruntime={})),function(_e){(function(tt){(function(st){class it{constructor(){this.bb=null,this.bb_pos=0}__init(et,j){return this.bb_pos=et,this.bb=j,this}static getRootAsTypeInfo(et,j){return(j||new it).__init(et.readInt32(et.position())+et.position(),et)}static getSizePrefixedRootAsTypeInfo(et,j){return et.setPosition(et.position()+a.flatbuffers.SIZE_PREFIX_LENGTH),(j||new it).__init(et.readInt32(et.position())+et.position(),et)}denotation(et){let j=this.bb.__offset(this.bb_pos,4);return j?this.bb.__string(this.bb_pos+j,et):null}valueType(){let et=this.bb.__offset(this.bb_pos,6);return et?this.bb.readUint8(this.bb_pos+et):_e.experimental.fbs.TypeInfoValue.NONE}value(et){let j=this.bb.__offset(this.bb_pos,8);return j?this.bb.__union(et,this.bb_pos+j):null}static startTypeInfo(et){et.startObject(3)}static addDenotation(et,j){et.addFieldOffset(0,j,0)}static addValueType(et,j){et.addFieldInt8(1,j,_e.experimental.fbs.TypeInfoValue.NONE)}static addValue(et,j){et.addFieldOffset(2,j,0)}static endTypeInfo(et){return et.endObject()}static createTypeInfo(et,j,rt,ot){return it.startTypeInfo(et),it.addDenotation(et,j),it.addValueType(et,rt),it.addValue(et,ot),it.endTypeInfo(et)}}st.TypeInfo=it})(tt.fbs||(tt.fbs={}))})(_e.experimental||(_e.experimental={}))}(o.onnxruntime||(o.onnxruntime={})),function(_e){(function(tt){(function(st){class it{constructor(){this.bb=null,this.bb_pos=0}__init(et,j){return this.bb_pos=et,this.bb=j,this}static getRootAsOperatorSetId(et,j){return(j||new it).__init(et.readInt32(et.position())+et.position(),et)}static getSizePrefixedRootAsOperatorSetId(et,j){return et.setPosition(et.position()+a.flatbuffers.SIZE_PREFIX_LENGTH),(j||new it).__init(et.readInt32(et.position())+et.position(),et)}domain(et){let j=this.bb.__offset(this.bb_pos,4);return j?this.bb.__string(this.bb_pos+j,et):null}version(){let et=this.bb.__offset(this.bb_pos,6);return et?this.bb.readInt64(this.bb_pos+et):this.bb.createLong(0,0)}static startOperatorSetId(et){et.startObject(2)}static addDomain(et,j){et.addFieldOffset(0,j,0)}static addVersion(et,j){et.addFieldInt64(1,j,et.createLong(0,0))}static endOperatorSetId(et){return et.endObject()}static createOperatorSetId(et,j,rt){return it.startOperatorSetId(et),it.addDomain(et,j),it.addVersion(et,rt),it.endOperatorSetId(et)}}st.OperatorSetId=it})(tt.fbs||(tt.fbs={}))})(_e.experimental||(_e.experimental={}))}(o.onnxruntime||(o.onnxruntime={})),function(_e){(function(tt){(function(st){class it{constructor(){this.bb=null,this.bb_pos=0}__init(et,j){return this.bb_pos=et,this.bb=j,this}static getRootAsTensor(et,j){return(j||new it).__init(et.readInt32(et.position())+et.position(),et)}static getSizePrefixedRootAsTensor(et,j){return et.setPosition(et.position()+a.flatbuffers.SIZE_PREFIX_LENGTH),(j||new it).__init(et.readInt32(et.position())+et.position(),et)}name(et){let j=this.bb.__offset(this.bb_pos,4);return j?this.bb.__string(this.bb_pos+j,et):null}docString(et){let j=this.bb.__offset(this.bb_pos,6);return j?this.bb.__string(this.bb_pos+j,et):null}dims(et){let j=this.bb.__offset(this.bb_pos,8);return j?this.bb.readInt64(this.bb.__vector(this.bb_pos+j)+8*et):this.bb.createLong(0,0)}dimsLength(){let et=this.bb.__offset(this.bb_pos,8);return et?this.bb.__vector_len(this.bb_pos+et):0}dataType(){let et=this.bb.__offset(this.bb_pos,10);return et?this.bb.readInt32(this.bb_pos+et):_e.experimental.fbs.TensorDataType.UNDEFINED}rawData(et){let j=this.bb.__offset(this.bb_pos,12);return j?this.bb.readUint8(this.bb.__vector(this.bb_pos+j)+et):0}rawDataLength(){let et=this.bb.__offset(this.bb_pos,12);return et?this.bb.__vector_len(this.bb_pos+et):0}rawDataArray(){let et=this.bb.__offset(this.bb_pos,12);return et?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+et),this.bb.__vector_len(this.bb_pos+et)):null}stringData(et,j){let rt=this.bb.__offset(this.bb_pos,14);return rt?this.bb.__string(this.bb.__vector(this.bb_pos+rt)+4*et,j):null}stringDataLength(){let et=this.bb.__offset(this.bb_pos,14);return et?this.bb.__vector_len(this.bb_pos+et):0}static startTensor(et){et.startObject(6)}static addName(et,j){et.addFieldOffset(0,j,0)}static addDocString(et,j){et.addFieldOffset(1,j,0)}static addDims(et,j){et.addFieldOffset(2,j,0)}static createDimsVector(et,j){et.startVector(8,j.length,8);for(let rt=j.length-1;rt>=0;rt--)et.addInt64(j[rt]);return et.endVector()}static startDimsVector(et,j){et.startVector(8,j,8)}static addDataType(et,j){et.addFieldInt32(3,j,_e.experimental.fbs.TensorDataType.UNDEFINED)}static addRawData(et,j){et.addFieldOffset(4,j,0)}static createRawDataVector(et,j){et.startVector(1,j.length,1);for(let rt=j.length-1;rt>=0;rt--)et.addInt8(j[rt]);return et.endVector()}static startRawDataVector(et,j){et.startVector(1,j,1)}static addStringData(et,j){et.addFieldOffset(5,j,0)}static createStringDataVector(et,j){et.startVector(4,j.length,4);for(let rt=j.length-1;rt>=0;rt--)et.addOffset(j[rt]);return et.endVector()}static startStringDataVector(et,j){et.startVector(4,j,4)}static endTensor(et){return et.endObject()}static createTensor(et,j,rt,ot,at,lt,ut){return it.startTensor(et),it.addName(et,j),it.addDocString(et,rt),it.addDims(et,ot),it.addDataType(et,at),it.addRawData(et,lt),it.addStringData(et,ut),it.endTensor(et)}}st.Tensor=it})(tt.fbs||(tt.fbs={}))})(_e.experimental||(_e.experimental={}))}(o.onnxruntime||(o.onnxruntime={})),function(_e){(function(tt){(function(st){class it{constructor(){this.bb=null,this.bb_pos=0}__init(et,j){return this.bb_pos=et,this.bb=j,this}static getRootAsSparseTensor(et,j){return(j||new it).__init(et.readInt32(et.position())+et.position(),et)}static getSizePrefixedRootAsSparseTensor(et,j){return et.setPosition(et.position()+a.flatbuffers.SIZE_PREFIX_LENGTH),(j||new it).__init(et.readInt32(et.position())+et.position(),et)}values(et){let j=this.bb.__offset(this.bb_pos,4);return j?(et||new _e.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+j),this.bb):null}indices(et){let j=this.bb.__offset(this.bb_pos,6);return j?(et||new _e.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+j),this.bb):null}dims(et){let j=this.bb.__offset(this.bb_pos,8);return j?this.bb.readInt64(this.bb.__vector(this.bb_pos+j)+8*et):this.bb.createLong(0,0)}dimsLength(){let et=this.bb.__offset(this.bb_pos,8);return et?this.bb.__vector_len(this.bb_pos+et):0}static startSparseTensor(et){et.startObject(3)}static addValues(et,j){et.addFieldOffset(0,j,0)}static addIndices(et,j){et.addFieldOffset(1,j,0)}static addDims(et,j){et.addFieldOffset(2,j,0)}static createDimsVector(et,j){et.startVector(8,j.length,8);for(let rt=j.length-1;rt>=0;rt--)et.addInt64(j[rt]);return et.endVector()}static startDimsVector(et,j){et.startVector(8,j,8)}static endSparseTensor(et){return et.endObject()}static createSparseTensor(et,j,rt,ot){return it.startSparseTensor(et),it.addValues(et,j),it.addIndices(et,rt),it.addDims(et,ot),it.endSparseTensor(et)}}st.SparseTensor=it})(tt.fbs||(tt.fbs={}))})(_e.experimental||(_e.experimental={}))}(o.onnxruntime||(o.onnxruntime={})),function(_e){(function(tt){(function(st){class it{constructor(){this.bb=null,this.bb_pos=0}__init(et,j){return this.bb_pos=et,this.bb=j,this}static getRootAsAttribute(et,j){return(j||new it).__init(et.readInt32(et.position())+et.position(),et)}static getSizePrefixedRootAsAttribute(et,j){return et.setPosition(et.position()+a.flatbuffers.SIZE_PREFIX_LENGTH),(j||new it).__init(et.readInt32(et.position())+et.position(),et)}name(et){let j=this.bb.__offset(this.bb_pos,4);return j?this.bb.__string(this.bb_pos+j,et):null}docString(et){let j=this.bb.__offset(this.bb_pos,6);return j?this.bb.__string(this.bb_pos+j,et):null}type(){let et=this.bb.__offset(this.bb_pos,8);return et?this.bb.readInt32(this.bb_pos+et):_e.experimental.fbs.AttributeType.UNDEFINED}f(){let et=this.bb.__offset(this.bb_pos,10);return et?this.bb.readFloat32(this.bb_pos+et):0}i(){let et=this.bb.__offset(this.bb_pos,12);return et?this.bb.readInt64(this.bb_pos+et):this.bb.createLong(0,0)}s(et){let j=this.bb.__offset(this.bb_pos,14);return j?this.bb.__string(this.bb_pos+j,et):null}t(et){let j=this.bb.__offset(this.bb_pos,16);return j?(et||new _e.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+j),this.bb):null}g(et){let j=this.bb.__offset(this.bb_pos,18);return j?(et||new _e.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb_pos+j),this.bb):null}floats(et){let j=this.bb.__offset(this.bb_pos,20);return j?this.bb.readFloat32(this.bb.__vector(this.bb_pos+j)+4*et):0}floatsLength(){let et=this.bb.__offset(this.bb_pos,20);return et?this.bb.__vector_len(this.bb_pos+et):0}floatsArray(){let et=this.bb.__offset(this.bb_pos,20);return et?new Float32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+et),this.bb.__vector_len(this.bb_pos+et)):null}ints(et){let j=this.bb.__offset(this.bb_pos,22);return j?this.bb.readInt64(this.bb.__vector(this.bb_pos+j)+8*et):this.bb.createLong(0,0)}intsLength(){let et=this.bb.__offset(this.bb_pos,22);return et?this.bb.__vector_len(this.bb_pos+et):0}strings(et,j){let rt=this.bb.__offset(this.bb_pos,24);return rt?this.bb.__string(this.bb.__vector(this.bb_pos+rt)+4*et,j):null}stringsLength(){let et=this.bb.__offset(this.bb_pos,24);return et?this.bb.__vector_len(this.bb_pos+et):0}tensors(et,j){let rt=this.bb.__offset(this.bb_pos,26);return rt?(j||new _e.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+rt)+4*et),this.bb):null}tensorsLength(){let et=this.bb.__offset(this.bb_pos,26);return et?this.bb.__vector_len(this.bb_pos+et):0}graphs(et,j){let rt=this.bb.__offset(this.bb_pos,28);return rt?(j||new _e.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+rt)+4*et),this.bb):null}graphsLength(){let et=this.bb.__offset(this.bb_pos,28);return et?this.bb.__vector_len(this.bb_pos+et):0}static startAttribute(et){et.startObject(13)}static addName(et,j){et.addFieldOffset(0,j,0)}static addDocString(et,j){et.addFieldOffset(1,j,0)}static addType(et,j){et.addFieldInt32(2,j,_e.experimental.fbs.AttributeType.UNDEFINED)}static addF(et,j){et.addFieldFloat32(3,j,0)}static addI(et,j){et.addFieldInt64(4,j,et.createLong(0,0))}static addS(et,j){et.addFieldOffset(5,j,0)}static addT(et,j){et.addFieldOffset(6,j,0)}static addG(et,j){et.addFieldOffset(7,j,0)}static addFloats(et,j){et.addFieldOffset(8,j,0)}static createFloatsVector(et,j){et.startVector(4,j.length,4);for(let rt=j.length-1;rt>=0;rt--)et.addFloat32(j[rt]);return et.endVector()}static startFloatsVector(et,j){et.startVector(4,j,4)}static addInts(et,j){et.addFieldOffset(9,j,0)}static createIntsVector(et,j){et.startVector(8,j.length,8);for(let rt=j.length-1;rt>=0;rt--)et.addInt64(j[rt]);return et.endVector()}static startIntsVector(et,j){et.startVector(8,j,8)}static addStrings(et,j){et.addFieldOffset(10,j,0)}static createStringsVector(et,j){et.startVector(4,j.length,4);for(let rt=j.length-1;rt>=0;rt--)et.addOffset(j[rt]);return et.endVector()}static startStringsVector(et,j){et.startVector(4,j,4)}static addTensors(et,j){et.addFieldOffset(11,j,0)}static createTensorsVector(et,j){et.startVector(4,j.length,4);for(let rt=j.length-1;rt>=0;rt--)et.addOffset(j[rt]);return et.endVector()}static startTensorsVector(et,j){et.startVector(4,j,4)}static addGraphs(et,j){et.addFieldOffset(12,j,0)}static createGraphsVector(et,j){et.startVector(4,j.length,4);for(let rt=j.length-1;rt>=0;rt--)et.addOffset(j[rt]);return et.endVector()}static startGraphsVector(et,j){et.startVector(4,j,4)}static endAttribute(et){return et.endObject()}static createAttribute(et,j,rt,ot,at,lt,ut,ct,dt,ft,ht,bt,yt,mt){return it.startAttribute(et),it.addName(et,j),it.addDocString(et,rt),it.addType(et,ot),it.addF(et,at),it.addI(et,lt),it.addS(et,ut),it.addT(et,ct),it.addG(et,dt),it.addFloats(et,ft),it.addInts(et,ht),it.addStrings(et,bt),it.addTensors(et,yt),it.addGraphs(et,mt),it.endAttribute(et)}}st.Attribute=it})(tt.fbs||(tt.fbs={}))})(_e.experimental||(_e.experimental={}))}(o.onnxruntime||(o.onnxruntime={})),function(_e){(function(tt){(function(st){class it{constructor(){this.bb=null,this.bb_pos=0}__init(et,j){return this.bb_pos=et,this.bb=j,this}static getRootAsGraph(et,j){return(j||new it).__init(et.readInt32(et.position())+et.position(),et)}static getSizePrefixedRootAsGraph(et,j){return et.setPosition(et.position()+a.flatbuffers.SIZE_PREFIX_LENGTH),(j||new it).__init(et.readInt32(et.position())+et.position(),et)}initializers(et,j){let rt=this.bb.__offset(this.bb_pos,4);return rt?(j||new _e.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+rt)+4*et),this.bb):null}initializersLength(){let et=this.bb.__offset(this.bb_pos,4);return et?this.bb.__vector_len(this.bb_pos+et):0}nodeArgs(et,j){let rt=this.bb.__offset(this.bb_pos,6);return rt?(j||new _e.experimental.fbs.ValueInfo).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+rt)+4*et),this.bb):null}nodeArgsLength(){let et=this.bb.__offset(this.bb_pos,6);return et?this.bb.__vector_len(this.bb_pos+et):0}nodes(et,j){let rt=this.bb.__offset(this.bb_pos,8);return rt?(j||new _e.experimental.fbs.Node).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+rt)+4*et),this.bb):null}nodesLength(){let et=this.bb.__offset(this.bb_pos,8);return et?this.bb.__vector_len(this.bb_pos+et):0}maxNodeIndex(){let et=this.bb.__offset(this.bb_pos,10);return et?this.bb.readUint32(this.bb_pos+et):0}nodeEdges(et,j){let rt=this.bb.__offset(this.bb_pos,12);return rt?(j||new _e.experimental.fbs.NodeEdge).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+rt)+4*et),this.bb):null}nodeEdgesLength(){let et=this.bb.__offset(this.bb_pos,12);return et?this.bb.__vector_len(this.bb_pos+et):0}inputs(et,j){let rt=this.bb.__offset(this.bb_pos,14);return rt?this.bb.__string(this.bb.__vector(this.bb_pos+rt)+4*et,j):null}inputsLength(){let et=this.bb.__offset(this.bb_pos,14);return et?this.bb.__vector_len(this.bb_pos+et):0}outputs(et,j){let rt=this.bb.__offset(this.bb_pos,16);return rt?this.bb.__string(this.bb.__vector(this.bb_pos+rt)+4*et,j):null}outputsLength(){let et=this.bb.__offset(this.bb_pos,16);return et?this.bb.__vector_len(this.bb_pos+et):0}sparseInitializers(et,j){let rt=this.bb.__offset(this.bb_pos,18);return rt?(j||new _e.experimental.fbs.SparseTensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+rt)+4*et),this.bb):null}sparseInitializersLength(){let et=this.bb.__offset(this.bb_pos,18);return et?this.bb.__vector_len(this.bb_pos+et):0}static startGraph(et){et.startObject(8)}static addInitializers(et,j){et.addFieldOffset(0,j,0)}static createInitializersVector(et,j){et.startVector(4,j.length,4);for(let rt=j.length-1;rt>=0;rt--)et.addOffset(j[rt]);return et.endVector()}static startInitializersVector(et,j){et.startVector(4,j,4)}static addNodeArgs(et,j){et.addFieldOffset(1,j,0)}static createNodeArgsVector(et,j){et.startVector(4,j.length,4);for(let rt=j.length-1;rt>=0;rt--)et.addOffset(j[rt]);return et.endVector()}static startNodeArgsVector(et,j){et.startVector(4,j,4)}static addNodes(et,j){et.addFieldOffset(2,j,0)}static createNodesVector(et,j){et.startVector(4,j.length,4);for(let rt=j.length-1;rt>=0;rt--)et.addOffset(j[rt]);return et.endVector()}static startNodesVector(et,j){et.startVector(4,j,4)}static addMaxNodeIndex(et,j){et.addFieldInt32(3,j,0)}static addNodeEdges(et,j){et.addFieldOffset(4,j,0)}static createNodeEdgesVector(et,j){et.startVector(4,j.length,4);for(let rt=j.length-1;rt>=0;rt--)et.addOffset(j[rt]);return et.endVector()}static startNodeEdgesVector(et,j){et.startVector(4,j,4)}static addInputs(et,j){et.addFieldOffset(5,j,0)}static createInputsVector(et,j){et.startVector(4,j.length,4);for(let rt=j.length-1;rt>=0;rt--)et.addOffset(j[rt]);return et.endVector()}static startInputsVector(et,j){et.startVector(4,j,4)}static addOutputs(et,j){et.addFieldOffset(6,j,0)}static createOutputsVector(et,j){et.startVector(4,j.length,4);for(let rt=j.length-1;rt>=0;rt--)et.addOffset(j[rt]);return et.endVector()}static startOutputsVector(et,j){et.startVector(4,j,4)}static addSparseInitializers(et,j){et.addFieldOffset(7,j,0)}static createSparseInitializersVector(et,j){et.startVector(4,j.length,4);for(let rt=j.length-1;rt>=0;rt--)et.addOffset(j[rt]);return et.endVector()}static startSparseInitializersVector(et,j){et.startVector(4,j,4)}static endGraph(et){return et.endObject()}static createGraph(et,j,rt,ot,at,lt,ut,ct,dt){return it.startGraph(et),it.addInitializers(et,j),it.addNodeArgs(et,rt),it.addNodes(et,ot),it.addMaxNodeIndex(et,at),it.addNodeEdges(et,lt),it.addInputs(et,ut),it.addOutputs(et,ct),it.addSparseInitializers(et,dt),it.endGraph(et)}}st.Graph=it})(tt.fbs||(tt.fbs={}))})(_e.experimental||(_e.experimental={}))}(o.onnxruntime||(o.onnxruntime={})),function(_e){(function(tt){(function(st){class it{constructor(){this.bb=null,this.bb_pos=0}__init(et,j){return this.bb_pos=et,this.bb=j,this}static getRootAsModel(et,j){return(j||new it).__init(et.readInt32(et.position())+et.position(),et)}static getSizePrefixedRootAsModel(et,j){return et.setPosition(et.position()+a.flatbuffers.SIZE_PREFIX_LENGTH),(j||new it).__init(et.readInt32(et.position())+et.position(),et)}irVersion(){let et=this.bb.__offset(this.bb_pos,4);return et?this.bb.readInt64(this.bb_pos+et):this.bb.createLong(0,0)}opsetImport(et,j){let rt=this.bb.__offset(this.bb_pos,6);return rt?(j||new _e.experimental.fbs.OperatorSetId).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+rt)+4*et),this.bb):null}opsetImportLength(){let et=this.bb.__offset(this.bb_pos,6);return et?this.bb.__vector_len(this.bb_pos+et):0}producerName(et){let j=this.bb.__offset(this.bb_pos,8);return j?this.bb.__string(this.bb_pos+j,et):null}producerVersion(et){let j=this.bb.__offset(this.bb_pos,10);return j?this.bb.__string(this.bb_pos+j,et):null}domain(et){let j=this.bb.__offset(this.bb_pos,12);return j?this.bb.__string(this.bb_pos+j,et):null}modelVersion(){let et=this.bb.__offset(this.bb_pos,14);return et?this.bb.readInt64(this.bb_pos+et):this.bb.createLong(0,0)}docString(et){let j=this.bb.__offset(this.bb_pos,16);return j?this.bb.__string(this.bb_pos+j,et):null}graph(et){let j=this.bb.__offset(this.bb_pos,18);return j?(et||new _e.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb_pos+j),this.bb):null}graphDocString(et){let j=this.bb.__offset(this.bb_pos,20);return j?this.bb.__string(this.bb_pos+j,et):null}static startModel(et){et.startObject(9)}static addIrVersion(et,j){et.addFieldInt64(0,j,et.createLong(0,0))}static addOpsetImport(et,j){et.addFieldOffset(1,j,0)}static createOpsetImportVector(et,j){et.startVector(4,j.length,4);for(let rt=j.length-1;rt>=0;rt--)et.addOffset(j[rt]);return et.endVector()}static startOpsetImportVector(et,j){et.startVector(4,j,4)}static addProducerName(et,j){et.addFieldOffset(2,j,0)}static addProducerVersion(et,j){et.addFieldOffset(3,j,0)}static addDomain(et,j){et.addFieldOffset(4,j,0)}static addModelVersion(et,j){et.addFieldInt64(5,j,et.createLong(0,0))}static addDocString(et,j){et.addFieldOffset(6,j,0)}static addGraph(et,j){et.addFieldOffset(7,j,0)}static addGraphDocString(et,j){et.addFieldOffset(8,j,0)}static endModel(et){return et.endObject()}static createModel(et,j,rt,ot,at,lt,ut,ct,dt,ft){return it.startModel(et),it.addIrVersion(et,j),it.addOpsetImport(et,rt),it.addProducerName(et,ot),it.addProducerVersion(et,at),it.addDomain(et,lt),it.addModelVersion(et,ut),it.addDocString(et,ct),it.addGraph(et,dt),it.addGraphDocString(et,ft),it.endModel(et)}}st.Model=it})(tt.fbs||(tt.fbs={}))})(_e.experimental||(_e.experimental={}))}(o.onnxruntime||(o.onnxruntime={})),function(_e){(function(tt){(function(st){class it{constructor(){this.bb=null,this.bb_pos=0}__init(et,j){return this.bb_pos=et,this.bb=j,this}static getRootAsKernelCreateInfos(et,j){return(j||new it).__init(et.readInt32(et.position())+et.position(),et)}static getSizePrefixedRootAsKernelCreateInfos(et,j){return et.setPosition(et.position()+a.flatbuffers.SIZE_PREFIX_LENGTH),(j||new it).__init(et.readInt32(et.position())+et.position(),et)}nodeIndices(et){let j=this.bb.__offset(this.bb_pos,4);return j?this.bb.readUint32(this.bb.__vector(this.bb_pos+j)+4*et):0}nodeIndicesLength(){let et=this.bb.__offset(this.bb_pos,4);return et?this.bb.__vector_len(this.bb_pos+et):0}nodeIndicesArray(){let et=this.bb.__offset(this.bb_pos,4);return et?new Uint32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+et),this.bb.__vector_len(this.bb_pos+et)):null}kernelDefHashes(et){let j=this.bb.__offset(this.bb_pos,6);return j?this.bb.readUint64(this.bb.__vector(this.bb_pos+j)+8*et):this.bb.createLong(0,0)}kernelDefHashesLength(){let et=this.bb.__offset(this.bb_pos,6);return et?this.bb.__vector_len(this.bb_pos+et):0}static startKernelCreateInfos(et){et.startObject(2)}static addNodeIndices(et,j){et.addFieldOffset(0,j,0)}static createNodeIndicesVector(et,j){et.startVector(4,j.length,4);for(let rt=j.length-1;rt>=0;rt--)et.addInt32(j[rt]);return et.endVector()}static startNodeIndicesVector(et,j){et.startVector(4,j,4)}static addKernelDefHashes(et,j){et.addFieldOffset(1,j,0)}static createKernelDefHashesVector(et,j){et.startVector(8,j.length,8);for(let rt=j.length-1;rt>=0;rt--)et.addInt64(j[rt]);return et.endVector()}static startKernelDefHashesVector(et,j){et.startVector(8,j,8)}static endKernelCreateInfos(et){return et.endObject()}static createKernelCreateInfos(et,j,rt){return it.startKernelCreateInfos(et),it.addNodeIndices(et,j),it.addKernelDefHashes(et,rt),it.endKernelCreateInfos(et)}}st.KernelCreateInfos=it})(tt.fbs||(tt.fbs={}))})(_e.experimental||(_e.experimental={}))}(o.onnxruntime||(o.onnxruntime={})),function(_e){(function(tt){(function(st){class it{constructor(){this.bb=null,this.bb_pos=0}__init(et,j){return this.bb_pos=et,this.bb=j,this}static getRootAsSubGraphSessionState(et,j){return(j||new it).__init(et.readInt32(et.position())+et.position(),et)}static getSizePrefixedRootAsSubGraphSessionState(et,j){return et.setPosition(et.position()+a.flatbuffers.SIZE_PREFIX_LENGTH),(j||new it).__init(et.readInt32(et.position())+et.position(),et)}graphId(et){let j=this.bb.__offset(this.bb_pos,4);return j?this.bb.__string(this.bb_pos+j,et):null}sessionState(et){let j=this.bb.__offset(this.bb_pos,6);return j?(et||new _e.experimental.fbs.SessionState).__init(this.bb.__indirect(this.bb_pos+j),this.bb):null}static startSubGraphSessionState(et){et.startObject(2)}static addGraphId(et,j){et.addFieldOffset(0,j,0)}static addSessionState(et,j){et.addFieldOffset(1,j,0)}static endSubGraphSessionState(et){let j=et.endObject();return et.requiredField(j,4),j}static createSubGraphSessionState(et,j,rt){return it.startSubGraphSessionState(et),it.addGraphId(et,j),it.addSessionState(et,rt),it.endSubGraphSessionState(et)}}st.SubGraphSessionState=it})(tt.fbs||(tt.fbs={}))})(_e.experimental||(_e.experimental={}))}(o.onnxruntime||(o.onnxruntime={})),function(_e){(function(tt){(function(st){class it{constructor(){this.bb=null,this.bb_pos=0}__init(et,j){return this.bb_pos=et,this.bb=j,this}static getRootAsSessionState(et,j){return(j||new it).__init(et.readInt32(et.position())+et.position(),et)}static getSizePrefixedRootAsSessionState(et,j){return et.setPosition(et.position()+a.flatbuffers.SIZE_PREFIX_LENGTH),(j||new it).__init(et.readInt32(et.position())+et.position(),et)}kernels(et){let j=this.bb.__offset(this.bb_pos,4);return j?(et||new _e.experimental.fbs.KernelCreateInfos).__init(this.bb.__indirect(this.bb_pos+j),this.bb):null}subGraphSessionStates(et,j){let rt=this.bb.__offset(this.bb_pos,6);return rt?(j||new _e.experimental.fbs.SubGraphSessionState).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+rt)+4*et),this.bb):null}subGraphSessionStatesLength(){let et=this.bb.__offset(this.bb_pos,6);return et?this.bb.__vector_len(this.bb_pos+et):0}static startSessionState(et){et.startObject(2)}static addKernels(et,j){et.addFieldOffset(0,j,0)}static addSubGraphSessionStates(et,j){et.addFieldOffset(1,j,0)}static createSubGraphSessionStatesVector(et,j){et.startVector(4,j.length,4);for(let rt=j.length-1;rt>=0;rt--)et.addOffset(j[rt]);return et.endVector()}static startSubGraphSessionStatesVector(et,j){et.startVector(4,j,4)}static endSessionState(et){return et.endObject()}static createSessionState(et,j,rt){return it.startSessionState(et),it.addKernels(et,j),it.addSubGraphSessionStates(et,rt),it.endSessionState(et)}}st.SessionState=it})(tt.fbs||(tt.fbs={}))})(_e.experimental||(_e.experimental={}))}(o.onnxruntime||(o.onnxruntime={})),function(_e){(function(tt){(function(st){class it{constructor(){this.bb=null,this.bb_pos=0}__init(et,j){return this.bb_pos=et,this.bb=j,this}static getRootAsInferenceSession(et,j){return(j||new it).__init(et.readInt32(et.position())+et.position(),et)}static getSizePrefixedRootAsInferenceSession(et,j){return et.setPosition(et.position()+a.flatbuffers.SIZE_PREFIX_LENGTH),(j||new it).__init(et.readInt32(et.position())+et.position(),et)}static bufferHasIdentifier(et){return et.__has_identifier("ORTM")}ortVersion(et){let j=this.bb.__offset(this.bb_pos,4);return j?this.bb.__string(this.bb_pos+j,et):null}model(et){let j=this.bb.__offset(this.bb_pos,6);return j?(et||new _e.experimental.fbs.Model).__init(this.bb.__indirect(this.bb_pos+j),this.bb):null}sessionState(et){let j=this.bb.__offset(this.bb_pos,8);return j?(et||new _e.experimental.fbs.SessionState).__init(this.bb.__indirect(this.bb_pos+j),this.bb):null}static startInferenceSession(et){et.startObject(3)}static addOrtVersion(et,j){et.addFieldOffset(0,j,0)}static addModel(et,j){et.addFieldOffset(1,j,0)}static addSessionState(et,j){et.addFieldOffset(2,j,0)}static endInferenceSession(et){return et.endObject()}static finishInferenceSessionBuffer(et,j){et.finish(j,"ORTM")}static finishSizePrefixedInferenceSessionBuffer(et,j){et.finish(j,"ORTM",!0)}static createInferenceSession(et,j,rt,ot){return it.startInferenceSession(et),it.addOrtVersion(et,j),it.addModel(et,rt),it.addSessionState(et,ot),it.endInferenceSession(et)}}st.InferenceSession=it})(tt.fbs||(tt.fbs={}))})(_e.experimental||(_e.experimental={}))}(o.onnxruntime||(o.onnxruntime={}))},7448:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.OnnxjsSessionHandler=void 0;const a=s(1670),_=s(9162);o.OnnxjsSessionHandler=class{constructor($){this.session=$,this.inputNames=this.session.inputNames,this.outputNames=this.session.outputNames}async dispose(){}async run($,_e,tt){const st=new Map;for(const et in $)if(Object.hasOwnProperty.call($,et)){const j=$[et];st.set(et,new _.Tensor(j.dims,j.type,void 0,void 0,j.data))}const it=await this.session.run(st),nt={};return it.forEach((et,j)=>{nt[j]=new a.Tensor(et.type,et.data,et.dims)}),nt}startProfiling(){this.session.startProfiling()}endProfiling(){this.session.endProfiling()}}},6919:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Session=void 0;const a=s(7067),_=s(1296),$=s(7091),_e=s(1036),tt=s(6231),st=s(2644);o.Session=class{constructor(it={}){this._initialized=!1,this.backendHint=it.backendHint,this.profiler=tt.Profiler.create(it.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(it,nt,et){await this.profiler.event("session","Session.loadModel",async()=>{const j=await(0,$.resolveBackend)(this.backendHint);if(this.sessionHandler=j.createSessionHandler(this.context),this._model=new st.Model,typeof it=="string"){const rt=it.endsWith(".ort");if(typeof fetch>"u"){const ot=await(0,_.promisify)(a.readFile)(it);this.initialize(ot,rt)}else{const ot=await fetch(it),at=await ot.arrayBuffer();this.initialize(new Uint8Array(at),rt)}}else if(ArrayBuffer.isView(it))this.initialize(it);else{const rt=new Uint8Array(it,nt||0,et||it.byteLength);this.initialize(rt)}})}initialize(it,nt){if(this._initialized)throw new Error("already initialized");this.profiler.event("session","Session.initialize",()=>{const et=this.sessionHandler.transformGraph?this.sessionHandler:void 0;this._model.load(it,et,nt),this.sessionHandler.onGraphInitialized&&this.sessionHandler.onGraphInitialized(this._model.graph),this.initializeOps(this._model.graph),this._executionPlan=new _e.ExecutionPlan(this._model.graph,this._ops,this.profiler)}),this._initialized=!0}async run(it){if(!this._initialized)throw new Error("session not initialized yet");return this.profiler.event("session","Session.run",async()=>{const nt=this.normalizeAndValidateInputs(it),et=await this._executionPlan.execute(this.sessionHandler,nt);return this.createOutput(et)})}normalizeAndValidateInputs(it){const nt=this._model.graph.getInputNames();if(Array.isArray(it)){if(it.length!==nt.length)throw new Error(`incorrect input array length: expected ${nt.length} but got ${it.length}`)}else{if(it.size!==nt.length)throw new Error(`incorrect input map size: expected ${nt.length} but got ${it.size}`);const et=new Array(it.size);let j=0;for(let rt=0;rttypeof mt=="string")))throw new TypeError("cache should be a string array");yt&&(this.cache=new Array(bt))}else{if(ft!==void 0){const mt=j(ut);if(!(ft instanceof mt))throw new TypeError(`cache should be type ${mt.name}`)}if(yt){const mt=new ArrayBuffer(bt*function(gt){switch(gt){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 ${gt}`)}}(ut));this.cache=function(gt,vt){return new(j(vt))(gt)}(mt,ut)}}}static fromProto(lt){if(!lt)throw new Error("cannot construct Value from an empty tensor");const ut=st.ProtoUtil.tensorDataTypeFromProto(lt.dataType),ct=st.ProtoUtil.tensorDimsFromProto(lt.dims),dt=new nt(ct,ut);if(ut==="string")lt.stringData.forEach((ft,ht)=>{dt.data[ht]=(0,st.decodeUtf8String)(ft)});else if(lt.rawData&&typeof lt.rawData.byteLength=="number"&<.rawData.byteLength>0){const ft=dt.data,ht=new DataView(lt.rawData.buffer,lt.rawData.byteOffset,lt.rawData.byteLength),bt=et(lt.dataType),yt=lt.rawData.byteLength/bt;if(lt.rawData.byteLength%bt!=0)throw new Error("invalid buffer length");if(ft.length!==yt)throw new Error("buffer length mismatch");for(let mt=0;mt0){const ft=dt.data,ht=new DataView(lt.rawDataArray().buffer,lt.rawDataArray().byteOffset,lt.rawDataLength()),bt=et(lt.dataType()),yt=lt.rawDataLength()/bt;if(lt.rawDataLength()%bt!=0)throw new Error("invalid buffer length");if(ft.length!==yt)throw new Error("buffer length mismatch");for(let mt=0;mt1&&vt>1)return;yt[bt-mt]=Math.max(gt,vt)}return yt}static index(ut,ct){const dt=new Array(ct.length);return it.fillIndex(ut,ct,dt),dt}static fillIndex(ut,ct,dt){const ft=ut.length-ct.length;for(let ht=0;ht=0;At--)gt[At]=Ct%bt[At],Ct=Math.floor(Ct/bt[At]);Pt||(it.fillIndex(gt,ut.dims,vt),kt=ut.get(vt)),St||(it.fillIndex(gt,ct.dims,wt),It=ct.get(wt)),mt.set(gt,dt(kt,It))}}return mt}}static isValidBroadcast(ut,ct){const dt=ut.length,ft=ct.length;if(dt>ft)return!1;for(let ht=1;ht<=dt;ht++)if(ut[dt-ht]!==1&&ut[dt-ht]!==ct[ft-ht])return!1;return!0}static getBroadcastDims(ut,ct){const dt=ut.length,ft=[];for(let ht=0;ht1&&yt===1&&ft.unshift(bt)}return ft}}o.BroadcastUtil=it,o.arrayCopyHelper=function(lt,ut,ct,dt,ft){if(dt<0||dt>=ut.length)throw new Error("sourceIndex out of bounds");if(ct<0||ct>=lt.length)throw new Error("targetIndex out of bounds");if(dt+ft>ut.length)throw new Error("source indices to be copied are outside bounds");if(ct+ft>lt.length)throw new Error("target array is too small to hold result");for(let ht=0;ht$.default.isLong(ct)?ct.toNumber():ct)}static tensorValueTypeFromProto(ut){return{tensorType:nt.tensorDataTypeFromProto(ut.elemType),shape:{dims:nt.tensorDimsFromProto(ut.shape.dim.map(ct=>ct.dimValue))}}}static tensorDimsFromORTFormat(ut){const ct=[];for(let dt=0;dtut.length)throw new Error(`invalid dimension of ${ct} for sizeFromDimension as Tensor has ${ut.length} dimensions.`);return j.getSizeFromDimensionRange(ut,ct,ut.length)}static sizeToDimension(ut,ct){if(ct<0||ct>ut.length)throw new Error(`invalid dimension of ${ct} for sizeToDimension as Tensor has ${ut.length} dimensions.`);return j.getSizeFromDimensionRange(ut,0,ct)}static getSizeFromDimensionRange(ut,ct,dt){let ft=1;for(let ht=ct;ht=0;--ft)dt[ft]=dt[ft+1]*ut[ft+1];return dt}static transpose(ut){return ut.slice().reverse()}static indicesToOffset(ut,ct,dt){dt===void 0&&(dt=ut.length);let ft=0;for(let ht=0;ht=ct)throw new Error("unsupported axis for this operation.");return ut<0?ut+ct:ut}static normalizeAxes(ut,ct){return ut.map(dt=>this.normalizeAxis(dt,ct))}static incrementIndex(ut,ct,dt){if(ct.length===0||ut.length===0)throw new Error("Index incrementing unsupported for scalar Tensor");if(dt===void 0)dt=ct.length;else if(dt<=0||dt>ct.length)throw new Error("Incorrect axis to increment on");for(let ft=dt-1;ft>=0&&(ut[ft]++,!(ut[ft]=ut.length)throw new Error("the dimension with value zero exceeds the dimension size of the input tensor");ft[mt]=ut[mt]}else ft[mt]=ct[mt];bt*=ft[mt]}}const yt=j.size(ut);if(ht!==-1){if(yt%bt!=0)throw new Error(`the input tensor cannot be reshaped to the requested shape. Input shape: [${ut}] Output shape: [${ct}]`);ft[ht]=yt/bt}else if(bt!==yt)throw new Error("reshapedDims and originalDims don't have matching sizes");return ft}static sortBasedOnPerm(ut,ct){return ct?ct.map(dt=>ut[dt]):ut.slice().reverse()}static padShape(ut,ct){const dt=ut.length;return ut.map((ft,ht)=>ft+ct[ht]+ct[ht+dt])}static areEqual(ut,ct){return ut.length===ct.length&&ut.every((dt,ft)=>dt===ct[ft])}static validateDimsAndCalcSize(ut){if(ut.length>6)throw new TypeError("Only rank 0 to 6 is supported for tensor shape.");let ct=1;for(const dt of ut){if(!Number.isInteger(dt))throw new TypeError(`Invalid shape: ${dt} is not an integer`);if(dt<0||dt>2147483647)throw new TypeError(`Invalid shape: length ${dt} is not allowed`);ct*=dt}return ct}static flattenShape(ut,ct){ct<0&&(ct+=ut.length);const dt=ut.reduce((ht,bt)=>ht*bt,1),ft=ut.slice(ct).reduce((ht,bt)=>ht*bt,1);return[dt/ft,ft]}static squeezeShape(ut,ct){const dt=new Array;ct=j.normalizeAxes(ct,ut.length);for(let ft=0;ft=0;if(ht&&ut[ft]!==1)throw new Error("squeeze an axis of size different than 1");(ct.length===0&&ut[ft]>1||ct.length>0&&!ht)&&dt.push(ut[ft])}return dt}static unsqueezeShape(ut,ct){const dt=new Array(ut.length+ct.length);dt.fill(0);for(let ht=0;ht=dt.length)throw new Error("'axes' has an out of range axis");if(dt[bt]!==0)throw new Error("'axes' has a duplicate axis");dt[bt]=1}let ft=0;for(let ht=0;ht=ut.length)throw new Error("sourceIndex out of bounds");if(ct<0||ct>=lt.length)throw new Error("targetIndex out of bounds");if(dt+ft>ut.length)throw new Error("source indices to be copied are outside bounds");if(ct+ft>lt.length)throw new Error("target array is too small to hold result");for(let ht=0;ht=ut.length)throw new Error("sourceIndex out of bounds");if(ct<0||ct>=lt.length)throw new Error("targetIndex out of bounds");if(dt+ft>ut.length)throw new Error("source indices to be copied are outside bounds");if(ct+ft>lt.length)throw new Error("target array is too small to hold result");for(let bt=0;bt=ut.length)throw new Error("sourceIndex out of bounds");if(ct<0||ct>=lt.length)throw new Error("targetIndex out of bounds");if(dt+ft>ut.length)throw new Error("source indices to be copied are outside bounds");if(ct+ft>lt.length)throw new Error("target array is too small to hold result");for(let bt=0;bt=ut.length)throw new Error("sourceIndex out of bounds");if(ct<0||ct>=lt.length)throw new Error("targetIndex out of bounds");if(dt+ft>ut.length)throw new Error("source indices to be copied are outside bounds");if(ct+ft>lt.length)throw new Error("target array is too small to hold result");for(let ht=0;htct.push(It));const yt=ot.calcReduceShape(bt,ct,!0),mt=j.size(yt),gt=new tt.Tensor(yt,ut.type),vt=j.computeStrides(yt),wt=j.computeStrides(bt),Ct=new Array(bt.length);for(let kt=0;kt=ct.length)return bt(ut[ht]);const gt=ct[ft],vt=gt>=dt.length?1:j.size(dt.slice(gt+1));for(let wt=0;wtht!==0)}}o.ReduceUtil=ot;class at{static adjustPoolAttributes(ut,ct,dt,ft,ht,bt){if(!ut&&dt.length!==ct.length-2)throw new Error("length of specified kernel shapes should be 2 less than length of input dimensions");if(ut)for(let yt=0;yt=dt.length?dt.push(ct[yt+2]):dt[yt]=ct[yt+2];for(let yt=0;yt=dt[yt]||bt[yt+dt.length]>=dt[yt])throw new Error("pads should be smaller than kernel")}}static adjustPadsBasedOnAutoPad(ut,ct,dt,ft,ht,bt){if(bt){if(ht.length!==2*(ut.length-2))throw new Error("length of pads should be twice the length of data dimensions");if(ct.length!==ut.length-2)throw new Error("length of strides should be the length of data dimensions");if(ft.length!==ut.length-2)throw new Error("length of kernel shapes should be the length of data dimensions");for(let yt=0;yt{Object.defineProperty(o,"__esModule",{value:!0}),o.iterateExtraOptions=void 0,o.iterateExtraOptions=(s,a,_,$)=>{if(typeof s=="object"&&s!==null){if(_.has(s))throw new Error("Circular reference in options");_.add(s)}Object.entries(s).forEach(([_e,tt])=>{const st=a?a+_e:_e;if(typeof tt=="object")(0,o.iterateExtraOptions)(tt,st+".",_,$);else if(typeof tt=="string"||typeof tt=="number")$(st,tt.toString());else{if(typeof tt!="boolean")throw new Error("Can't handle extra config type: "+typeof tt);$(st,tt?"1":"0")}})}},2157:function(i,o,s){var a,_=this&&this.__createBinding||(Object.create?function(vt,wt,Ct,kt){kt===void 0&&(kt=Ct);var It=Object.getOwnPropertyDescriptor(wt,Ct);It&&!("get"in It?!wt.__esModule:It.writable||It.configurable)||(It={enumerable:!0,get:function(){return wt[Ct]}}),Object.defineProperty(vt,kt,It)}:function(vt,wt,Ct,kt){kt===void 0&&(kt=Ct),vt[kt]=wt[Ct]}),$=this&&this.__setModuleDefault||(Object.create?function(vt,wt){Object.defineProperty(vt,"default",{enumerable:!0,value:wt})}:function(vt,wt){vt.default=wt}),_e=this&&this.__importStar||function(vt){if(vt&&vt.__esModule)return vt;var wt={};if(vt!=null)for(var Ct in vt)Ct!=="default"&&Object.prototype.hasOwnProperty.call(vt,Ct)&&_(wt,vt,Ct);return $(wt,vt),wt};Object.defineProperty(o,"__esModule",{value:!0}),o.endProfiling=o.run=o.releaseSession=o.createSession=o.createSessionFinalize=o.createSessionAllocate=o.initOrt=o.initWasm=void 0;const tt=s(1670),st=_e(s(349)),it=s(6361),nt=()=>!!tt.env.wasm.proxy&&typeof document<"u";let et,j,rt,ot=!1,at=!1,lt=!1;const ut=[],ct=[],dt=[],ft=[],ht=[],bt=[],yt=()=>{if(ot||!at||lt||!et)throw new Error("worker not ready")},mt=vt=>{switch(vt.data.type){case"init-wasm":ot=!1,vt.data.err?(lt=!0,j[1](vt.data.err)):(at=!0,j[0]());break;case"init-ort":vt.data.err?rt[1](vt.data.err):rt[0]();break;case"create_allocate":vt.data.err?ut.shift()[1](vt.data.err):ut.shift()[0](vt.data.out);break;case"create_finalize":vt.data.err?ct.shift()[1](vt.data.err):ct.shift()[0](vt.data.out);break;case"create":vt.data.err?dt.shift()[1](vt.data.err):dt.shift()[0](vt.data.out);break;case"release":vt.data.err?ft.shift()[1](vt.data.err):ft.shift()[0]();break;case"run":vt.data.err?ht.shift()[1](vt.data.err):ht.shift()[0](vt.data.out);break;case"end-profiling":vt.data.err?bt.shift()[1](vt.data.err):bt.shift()[0]()}},gt=typeof document<"u"?(a=document==null?void 0:document.currentScript)===null||a===void 0?void 0:a.src:void 0;o.initWasm=async()=>{if(nt()){if(at)return;if(ot)throw new Error("multiple calls to 'initWasm()' detected.");if(lt)throw new Error("previous call to 'initWasm()' failed.");return ot=!0,tt.env.wasm.wasmPaths===void 0&>&>.indexOf("blob:")!==0&&(tt.env.wasm.wasmPaths=gt.substr(0,+gt.lastIndexOf("/")+1)),new Promise((vt,wt)=>{et==null||et.terminate(),et=s(9710).Z(),et.onmessage=mt,j=[vt,wt];const Ct={type:"init-wasm",in:tt.env.wasm};et.postMessage(Ct)})}return(0,it.initializeWebAssembly)(tt.env.wasm)},o.initOrt=async(vt,wt)=>{if(nt())return yt(),new Promise((Ct,kt)=>{rt=[Ct,kt];const It={type:"init-ort",in:{numThreads:vt,loggingLevel:wt}};et.postMessage(It)});st.initOrt(vt,wt)},o.createSessionAllocate=async vt=>nt()?(yt(),new Promise((wt,Ct)=>{ut.push([wt,Ct]);const kt={type:"create_allocate",in:{model:vt}};et.postMessage(kt,[vt.buffer])})):st.createSessionAllocate(vt),o.createSessionFinalize=async(vt,wt)=>nt()?(yt(),new Promise((Ct,kt)=>{ct.push([Ct,kt]);const It={type:"create_finalize",in:{modeldata:vt,options:wt}};et.postMessage(It)})):st.createSessionFinalize(vt,wt),o.createSession=async(vt,wt)=>nt()?(yt(),new Promise((Ct,kt)=>{dt.push([Ct,kt]);const It={type:"create",in:{model:vt,options:wt}};et.postMessage(It,[vt.buffer])})):st.createSession(vt,wt),o.releaseSession=async vt=>{if(nt())return yt(),new Promise((wt,Ct)=>{ft.push([wt,Ct]);const kt={type:"release",in:vt};et.postMessage(kt)});st.releaseSession(vt)},o.run=async(vt,wt,Ct,kt,It)=>nt()?(yt(),new Promise((Pt,St)=>{ht.push([Pt,St]);const Rt={type:"run",in:{sessionId:vt,inputIndices:wt,inputs:Ct,outputIndices:kt,options:It}};et.postMessage(Rt,st.extractTransferableBuffers(Ct))})):st.run(vt,wt,Ct,kt,It),o.endProfiling=async vt=>{if(nt())return yt(),new Promise((wt,Ct)=>{bt.push([wt,Ct]);const kt={type:"end-profiling",in:vt};et.postMessage(kt)});st.endProfiling(vt)}},586:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.setRunOptions=void 0;const a=s(7967),_=s(4983),$=s(6361);o.setRunOptions=_e=>{const tt=(0,$.getInstance)();let st=0;const it=[],nt=_e||{};try{if((_e==null?void 0:_e.logSeverityLevel)===void 0)nt.logSeverityLevel=2;else if(typeof _e.logSeverityLevel!="number"||!Number.isInteger(_e.logSeverityLevel)||_e.logSeverityLevel<0||_e.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${_e.logSeverityLevel}`);if((_e==null?void 0:_e.logVerbosityLevel)===void 0)nt.logVerbosityLevel=0;else if(typeof _e.logVerbosityLevel!="number"||!Number.isInteger(_e.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${_e.logVerbosityLevel}`);(_e==null?void 0:_e.terminate)===void 0&&(nt.terminate=!1);let et=0;if((_e==null?void 0:_e.tag)!==void 0&&(et=(0,_.allocWasmString)(_e.tag,it)),st=tt._OrtCreateRunOptions(nt.logSeverityLevel,nt.logVerbosityLevel,!!nt.terminate,et),st===0)throw new Error("Can't create run options");return(_e==null?void 0:_e.extra)!==void 0&&(0,a.iterateExtraOptions)(_e.extra,"",new WeakSet,(j,rt)=>{const ot=(0,_.allocWasmString)(j,it),at=(0,_.allocWasmString)(rt,it);if(tt._OrtAddRunConfigEntry(st,ot,at)!==0)throw new Error(`Can't set a run config entry: ${j} - ${rt}`)}),[st,it]}catch(et){throw st!==0&&tt._OrtReleaseRunOptions(st),it.forEach(tt._free),et}}},2306:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.OnnxruntimeWebAssemblySessionHandler=void 0;const a=s(2806),_=s(1670),$=s(2850),_e=s(2157);let tt;o.OnnxruntimeWebAssemblySessionHandler=class{async createSessionAllocate(st){const it=await fetch(st),nt=await it.arrayBuffer();return(0,_e.createSessionAllocate)(new Uint8Array(nt))}async loadModel(st,it){if(tt||(await(0,_e.initOrt)(_.env.wasm.numThreads,(nt=>{switch(nt){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: ${nt}`)}})(_.env.logLevel)),tt=!0),typeof st=="string")if(typeof fetch>"u"){const nt=await(0,$.promisify)(a.readFile)(st);[this.sessionId,this.inputNames,this.outputNames]=await(0,_e.createSession)(nt,it)}else{const nt=await this.createSessionAllocate(st);[this.sessionId,this.inputNames,this.outputNames]=await(0,_e.createSessionFinalize)(nt,it)}else[this.sessionId,this.inputNames,this.outputNames]=await(0,_e.createSession)(st,it)}async dispose(){return(0,_e.releaseSession)(this.sessionId)}async run(st,it,nt){const et=[],j=[];Object.entries(st).forEach(lt=>{const ut=lt[0],ct=lt[1],dt=this.inputNames.indexOf(ut);if(dt===-1)throw new Error(`invalid input '${ut}'`);et.push(ct),j.push(dt)});const rt=[];Object.entries(it).forEach(lt=>{const ut=lt[0],ct=this.outputNames.indexOf(ut);if(ct===-1)throw new Error(`invalid output '${ut}'`);rt.push(ct)});const ot=await(0,_e.run)(this.sessionId,j,et.map(lt=>[lt.type,lt.dims,lt.data]),rt,nt),at={};for(let lt=0;lt{Object.defineProperty(o,"__esModule",{value:!0}),o.setSessionOptions=void 0;const a=s(7967),_=s(4983),$=s(6361);o.setSessionOptions=_e=>{const tt=(0,$.getInstance)();let st=0;const it=[],nt=_e||{};(et=>{et.extra||(et.extra={}),et.extra.session||(et.extra.session={});const j=et.extra.session;j.use_ort_model_bytes_directly||(j.use_ort_model_bytes_directly="1")})(nt);try{(_e==null?void 0:_e.graphOptimizationLevel)===void 0&&(nt.graphOptimizationLevel="all");const et=(ot=>{switch(ot){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${ot}`)}})(nt.graphOptimizationLevel);(_e==null?void 0:_e.enableCpuMemArena)===void 0&&(nt.enableCpuMemArena=!0),(_e==null?void 0:_e.enableMemPattern)===void 0&&(nt.enableMemPattern=!0),(_e==null?void 0:_e.executionMode)===void 0&&(nt.executionMode="sequential");const j=(ot=>{switch(ot){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${ot}`)}})(nt.executionMode);let rt=0;if((_e==null?void 0:_e.logId)!==void 0&&(rt=(0,_.allocWasmString)(_e.logId,it)),(_e==null?void 0:_e.logSeverityLevel)===void 0)nt.logSeverityLevel=2;else if(typeof _e.logSeverityLevel!="number"||!Number.isInteger(_e.logSeverityLevel)||_e.logSeverityLevel<0||_e.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${_e.logSeverityLevel}`);if((_e==null?void 0:_e.logVerbosityLevel)===void 0)nt.logVerbosityLevel=0;else if(typeof _e.logVerbosityLevel!="number"||!Number.isInteger(_e.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${_e.logVerbosityLevel}`);if((_e==null?void 0:_e.enableProfiling)===void 0&&(nt.enableProfiling=!1),st=tt._OrtCreateSessionOptions(et,!!nt.enableCpuMemArena,!!nt.enableMemPattern,j,!!nt.enableProfiling,0,rt,nt.logSeverityLevel,nt.logVerbosityLevel),st===0)throw new Error("Can't create session options");return _e!=null&&_e.executionProviders&&((ot,at,lt)=>{for(const ut of at){let ct=typeof ut=="string"?ut:ut.name;switch(ct){case"xnnpack":ct="XNNPACK";break;case"wasm":case"cpu":continue;default:throw new Error(`not supported EP: ${ct}`)}const dt=(0,_.allocWasmString)(ct,lt);if((0,$.getInstance)()._OrtAppendExecutionProvider(ot,dt)!==0)throw new Error(`Can't append execution provider: ${ct}`)}})(st,_e.executionProviders,it),(_e==null?void 0:_e.extra)!==void 0&&(0,a.iterateExtraOptions)(_e.extra,"",new WeakSet,(ot,at)=>{const lt=(0,_.allocWasmString)(ot,it),ut=(0,_.allocWasmString)(at,it);if(tt._OrtAddSessionConfigEntry(st,lt,ut)!==0)throw new Error(`Can't set a session config entry: ${ot} - ${at}`)}),[st,it]}catch(et){throw st!==0&&tt._OrtReleaseSessionOptions(st),it.forEach(tt._free),et}}},4983:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.allocWasmString=void 0;const a=s(6361);o.allocWasmString=(_,$)=>{const _e=(0,a.getInstance)(),tt=_e.lengthBytesUTF8(_)+1,st=_e._malloc(tt);return _e.stringToUTF8(_,st,tt),$.push(st),st}},349:(i,o,s)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.extractTransferableBuffers=o.endProfiling=o.run=o.releaseSession=o.createSession=o.createSessionFinalize=o.createSessionAllocate=o.initOrt=void 0;const a=s(586),_=s(4919),$=s(4983),_e=s(6361);o.initOrt=(et,j)=>{const rt=(0,_e.getInstance)()._OrtInit(et,j);if(rt!==0)throw new Error(`Can't initialize onnxruntime. error code = ${rt}`)};const tt=new Map;o.createSessionAllocate=et=>{const j=(0,_e.getInstance)(),rt=j._malloc(et.byteLength);return j.HEAPU8.set(et,rt),[rt,et.byteLength]},o.createSessionFinalize=(et,j)=>{const rt=(0,_e.getInstance)();let ot=0,at=0,lt=[];try{if([at,lt]=(0,_.setSessionOptions)(j),ot=rt._OrtCreateSession(et[0],et[1],at),ot===0)throw new Error("Can't create a session")}finally{rt._free(et[0]),rt._OrtReleaseSessionOptions(at),lt.forEach(rt._free)}const ut=rt._OrtGetInputCount(ot),ct=rt._OrtGetOutputCount(ot),dt=[],ft=[],ht=[],bt=[];for(let yt=0;yt{const rt=(0,o.createSessionAllocate)(et);return(0,o.createSessionFinalize)(rt,j)},o.releaseSession=et=>{const j=(0,_e.getInstance)(),rt=tt.get(et);if(!rt)throw new Error("invalid session id");const ot=rt[0],at=rt[1],lt=rt[2];at.forEach(j._OrtFree),lt.forEach(j._OrtFree),j._OrtReleaseSession(ot),tt.delete(et)};const st=et=>{switch(et){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: ${et}`)}},it=et=>{switch(et){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: ${et}`)}},nt=et=>{switch(et){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: ${et}`)}};o.run=(et,j,rt,ot,at)=>{const lt=(0,_e.getInstance)(),ut=tt.get(et);if(!ut)throw new Error("invalid session id");const ct=ut[0],dt=ut[1],ft=ut[2],ht=j.length,bt=ot.length;let yt=0,mt=[];const gt=[],vt=[];try{[yt,mt]=(0,a.setRunOptions)(at);for(let St=0;Stlt.HEAP32[ar++]=Qt);const Gt=lt._OrtCreateTensor(st(Rt),jt,Yt,sr,At.length);if(Gt===0)throw new Error("Can't create a tensor");gt.push(Gt)}finally{lt.stackRestore(Kt)}}const wt=lt.stackSave(),Ct=lt.stackAlloc(4*ht),kt=lt.stackAlloc(4*ht),It=lt.stackAlloc(4*bt),Pt=lt.stackAlloc(4*bt);try{let St=Ct/4,Rt=kt/4,At=It/4,Mt=Pt/4;for(let Kt=0;Kthr*Rr);if(Qt=it(Xt),Qt==="string"){const hr=[];let Rr=tr/4;for(let Or=0;Or{const j=(0,_e.getInstance)(),rt=tt.get(et);if(!rt)throw new Error("invalid session id");const ot=rt[0],at=j._OrtEndProfiling(ot);if(at===0)throw new Error("Can't get an profile file name");j._OrtFree(at)},o.extractTransferableBuffers=et=>{const j=[];for(const rt of et){const ot=rt[2];!Array.isArray(ot)&&ot.buffer&&j.push(ot.buffer)}return j}},6361:function(i,o,s){var a=this&&this.__createBinding||(Object.create?function(at,lt,ut,ct){ct===void 0&&(ct=ut);var dt=Object.getOwnPropertyDescriptor(lt,ut);dt&&!("get"in dt?!lt.__esModule:dt.writable||dt.configurable)||(dt={enumerable:!0,get:function(){return lt[ut]}}),Object.defineProperty(at,ct,dt)}:function(at,lt,ut,ct){ct===void 0&&(ct=ut),at[ct]=lt[ut]}),_=this&&this.__setModuleDefault||(Object.create?function(at,lt){Object.defineProperty(at,"default",{enumerable:!0,value:lt})}:function(at,lt){at.default=lt}),$=this&&this.__importStar||function(at){if(at&&at.__esModule)return at;var lt={};if(at!=null)for(var ut in at)ut!=="default"&&Object.prototype.hasOwnProperty.call(at,ut)&&a(lt,at,ut);return _(lt,at),lt},_e=this&&this.__importDefault||function(at){return at&&at.__esModule?at:{default:at}};Object.defineProperty(o,"__esModule",{value:!0}),o.dispose=o.getInstance=o.initializeWebAssembly=void 0;const tt=$(s(6449)),st=_e(s(932)),it=s(3474);let nt,et=!1,j=!1,rt=!1;const ot=(at,lt)=>lt?at?"ort-wasm-simd-threaded.wasm":"ort-wasm-threaded.wasm":at?"ort-wasm-simd.wasm":"ort-wasm.wasm";o.initializeWebAssembly=async at=>{if(et)return Promise.resolve();if(j)throw new Error("multiple calls to 'initializeWebAssembly()' detected.");if(rt)throw new Error("previous call to 'initializeWebAssembly()' failed.");j=!0;const lt=at.initTimeout,ut=at.numThreads,ct=at.simd,dt=ut>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}})(),ft=ct&&(()=>{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}})(),ht=typeof at.wasmPaths=="string"?at.wasmPaths:void 0,bt=ot(!1,dt),yt=ot(ft,dt),mt=typeof at.wasmPaths=="object"?at.wasmPaths[yt]:void 0;let gt=!1;const vt=[];if(lt>0&&vt.push(new Promise(wt=>{setTimeout(()=>{gt=!0,wt()},lt)})),vt.push(new Promise((wt,Ct)=>{const kt=dt?it:st.default,It={locateFile:(Pt,St)=>dt&&Pt.endsWith(".worker.js")&&typeof Blob<"u"?URL.createObjectURL(new Blob([s(4154)],{type:"text/javascript"})):Pt===bt?mt??(ht??St)+yt:St+Pt};if(dt)if(typeof Blob>"u")It.mainScriptUrlOrBlob=tt.join("/","ort-wasm-threaded.js");else{const Pt=`var ortWasmThreaded=(function(){var _scriptDir;return ${kt.toString()}})();`;It.mainScriptUrlOrBlob=new Blob([Pt],{type:"text/javascript"})}kt(It).then(Pt=>{j=!1,et=!0,nt=Pt,wt()},Pt=>{j=!1,rt=!0,Ct(Pt)})})),await Promise.race(vt),gt)throw new Error(`WebAssembly backend initializing failed due to timeout: ${lt}ms`)},o.getInstance=()=>{if(et&&nt)return nt;throw new Error("WebAssembly is not initialized yet.")},o.dispose=()=>{var at;!et||j||rt||(j=!0,(at=nt.PThread)===null||at===void 0||at.terminateAllThreads(),nt=void 0,j=!1,et=!1,rt=!0)}},9710:(i,o,s)=>{s.d(o,{Z:()=>$});var a=s(477),_=s.n(a);function $(){return _()('/*!\n* ONNX Runtime Web v1.14.0\n* Copyright (c) Microsoft Corporation. All rights reserved.\n* Licensed under the MIT License.\n*/\n(()=>{var t={474:(t,e,n)=>{var _scriptDir,r=(_scriptDir=(_scriptDir="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(t){function e(){return j.buffer!=D&&N(j.buffer),P}function r(){return j.buffer!=D&&N(j.buffer),U}function a(){return j.buffer!=D&&N(j.buffer),F}function i(){return j.buffer!=D&&N(j.buffer),I}function o(){return j.buffer!=D&&N(j.buffer),W}var u,c,s;t=t||{},u||(u=void 0!==t?t:{}),u.ready=new Promise((function(t,e){c=t,s=e}));var l,f,p,h,d,y,b=Object.assign({},u),m="./this.program",g=(t,e)=>{throw e},v="object"==typeof window,w="function"==typeof importScripts,_="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,O=u.ENVIRONMENT_IS_PTHREAD||!1,A="";function S(t){return u.locateFile?u.locateFile(t,A):A+t}if(_){let e;A=w?n(908).dirname(A)+"/":"//",y=()=>{d||(h=n(384),d=n(908))},l=function(t,e){return y(),t=d.normalize(t),h.readFileSync(t,e?void 0:"utf8")},p=t=>((t=l(t,!0)).buffer||(t=new Uint8Array(t)),t),f=(t,e,n)=>{y(),t=d.normalize(t),h.readFile(t,(function(t,r){t?n(t):e(r.buffer)}))},1{if(Q())throw process.exitCode=t,e;e instanceof ct||x("exiting due to exception: "+e),process.exit(t)},u.inspect=function(){return"[Emscripten Module object]"};try{e=n(925)}catch(t){throw console.error(\'The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?\'),t}n.g.Worker=e.Worker}else(v||w)&&(w?A=self.location.href:"undefined"!=typeof document&&document.currentScript&&(A=document.currentScript.src),_scriptDir&&(A=_scriptDir),A=0!==A.indexOf("blob:")?A.substr(0,A.replace(/[?#].*/,"").lastIndexOf("/")+1):"",_||(l=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},w&&(p=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),f=(t,e,n)=>{var r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=()=>{200==r.status||0==r.status&&r.response?e(r.response):n()},r.onerror=n,r.send(null)}));_&&"undefined"==typeof performance&&(n.g.performance=n(953).performance);var T=console.log.bind(console),E=console.warn.bind(console);_&&(y(),T=t=>h.writeSync(1,t+"\\n"),E=t=>h.writeSync(2,t+"\\n"));var M,C=u.print||T,x=u.printErr||E;Object.assign(u,b),b=null,u.thisProgram&&(m=u.thisProgram),u.quit&&(g=u.quit),u.wasmBinary&&(M=u.wasmBinary);var R=u.noExitRuntime||!1;"object"!=typeof WebAssembly&&at("no native wasm support detected");var j,k,D,P,U,F,I,W,H=!1,L="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function z(t,e,n){var r=(e>>>=0)+n;for(n=e;t[n]&&!(n>=r);)++n;if(16(a=224==(240&a)?(15&a)<<12|i<<6|o:(7&a)<<18|i<<12|o<<6|63&t[e++])?r+=String.fromCharCode(a):(a-=65536,r+=String.fromCharCode(55296|a>>10,56320|1023&a))}}else r+=String.fromCharCode(a)}return r}function Y(t,e){return(t>>>=0)?z(r(),t,e):""}function B(t,e,n,r){if(!(0>>=0;r=n+r-1;for(var i=0;i=o&&(o=65536+((1023&o)<<10)|1023&t.charCodeAt(++i)),127>=o){if(n>=r)break;e[n++>>>0]=o}else{if(2047>=o){if(n+1>=r)break;e[n++>>>0]=192|o>>6}else{if(65535>=o){if(n+2>=r)break;e[n++>>>0]=224|o>>12}else{if(n+3>=r)break;e[n++>>>0]=240|o>>18,e[n++>>>0]=128|o>>12&63}e[n++>>>0]=128|o>>6&63}e[n++>>>0]=128|63&o}}return e[n>>>0]=0,n-a}function G(t){for(var e=0,n=0;n=r?e++:2047>=r?e+=2:55296<=r&&57343>=r?(e+=4,++n):e+=3}return e}function N(t){D=t,u.HEAP8=P=new Int8Array(t),u.HEAP16=new Int16Array(t),u.HEAP32=F=new Int32Array(t),u.HEAPU8=U=new Uint8Array(t),u.HEAPU16=new Uint16Array(t),u.HEAPU32=I=new Uint32Array(t),u.HEAPF32=new Float32Array(t),u.HEAPF64=W=new Float64Array(t)}O&&(D=u.buffer);var V=u.INITIAL_MEMORY||16777216;if(O)j=u.wasmMemory,D=u.buffer;else if(u.wasmMemory)j=u.wasmMemory;else if(!((j=new WebAssembly.Memory({initial:V/65536,maximum:65536,shared:!0})).buffer instanceof SharedArrayBuffer))throw x("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),_&&console.log("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)"),Error("bad memory");j&&(D=j.buffer),V=D.byteLength,N(D);var $,q=[],X=[],J=[],Z=[];function Q(){return R||!1}function K(){var t=u.preRun.shift();q.unshift(t)}var tt,et=0,nt=null,rt=null;function at(t){throw O?postMessage({cmd:"onAbort",arg:t}):u.onAbort&&u.onAbort(t),x(t="Aborted("+t+")"),H=!0,t=new WebAssembly.RuntimeError(t+". Build with -sASSERTIONS for more info."),s(t),t}function it(){return tt.startsWith("data:application/octet-stream;base64,")}function ot(){var t=tt;try{if(t==tt&&M)return new Uint8Array(M);if(p)return p(t);throw"both async and sync fetching of the wasm failed"}catch(t){at(t)}}tt="ort-wasm-threaded.wasm",it()||(tt=S(tt));var ut={};function ct(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}function st(t){(t=ht.Vb[t])||at(),ht.mc(t)}function lt(t){var e=ht.Cc();if(!e)return 6;ht.ac.push(e),ht.Vb[t.Ub]=e,e.Ub=t.Ub;var n={cmd:"run",start_routine:t.Ic,arg:t.zc,pthread_ptr:t.Ub};return e.$b=()=>{n.time=performance.now(),e.postMessage(n,t.Nc)},e.loaded&&(e.$b(),delete e.$b),0}function ft(t){if(O)return $t(1,1,t);Q()||(ht.oc(),u.onExit&&u.onExit(t),H=!0),g(t,new ct(t))}function pt(t,e){if(!e&&O)throw bt(t),"unwind";Q()||O||(me(),dt(J),be(0),re[1].length&&ae(1,10),re[2].length&&ae(2,10),ht.oc()),ft(t)}var ht={Yb:[],ac:[],qc:[],Vb:{},fc:function(){O&&ht.Ec()},Pc:function(){},Ec:function(){ht.receiveObjectTransfer=ht.Gc,ht.threadInitTLS=ht.pc,ht.setExitStatus=ht.nc,R=!1},nc:function(){},oc:function(){for(var t of Object.values(ht.Vb))ht.mc(t);for(t of ht.Yb)t.terminate();ht.Yb=[]},mc:function(t){var e=t.Ub;delete ht.Vb[e],ht.Yb.push(t),ht.ac.splice(ht.ac.indexOf(t),1),t.Ub=0,Oe(e)},Gc:function(){},pc:function(){ht.qc.forEach((t=>t()))},Fc:function(t,e){t.onmessage=n=>{var r=(n=n.data).cmd;if(t.Ub&&(ht.Bc=t.Ub),n.targetThread&&n.targetThread!=he()){var a=ht.Vb[n.Qc];a?a.postMessage(n,n.transferList):x(\'Internal error! Worker sent a message "\'+r+\'" to target pthread \'+n.targetThread+", but that thread no longer exists!")}else"processProxyingQueue"===r?zt(n.queue):"spawnThread"===r?lt(n):"cleanupThread"===r?st(n.thread):"killThread"===r?(n=n.thread,r=ht.Vb[n],delete ht.Vb[n],r.terminate(),Oe(n),ht.ac.splice(ht.ac.indexOf(r),1),r.Ub=0):"cancelThread"===r?ht.Vb[n.thread].postMessage({cmd:"cancel"}):"loaded"===r?(t.loaded=!0,e&&e(t),t.$b&&(t.$b(),delete t.$b)):"print"===r?C("Thread "+n.threadId+": "+n.text):"printErr"===r?x("Thread "+n.threadId+": "+n.text):"alert"===r?alert("Thread "+n.threadId+": "+n.text):"setimmediate"===n.target?t.postMessage(n):"onAbort"===r?u.onAbort&&u.onAbort(n.arg):r&&x("worker sent an unknown command "+r);ht.Bc=void 0},t.onerror=t=>{throw x("worker sent an error! "+t.filename+":"+t.lineno+": "+t.message),t},_&&(t.on("message",(function(e){t.onmessage({data:e})})),t.on("error",(function(e){t.onerror(e)})),t.on("detachedExit",(function(){}))),t.postMessage({cmd:"load",urlOrBlob:u.mainScriptUrlOrBlob||_scriptDir,wasmMemory:j,wasmModule:k})},yc:function(){var t=S("ort-wasm-threaded.worker.js");ht.Yb.push(new Worker(t))},Cc:function(){return 0==ht.Yb.length&&(ht.yc(),ht.Fc(ht.Yb[0])),ht.Yb.pop()}};function dt(t){for(;0>2>>>0];t=a()[t+48>>2>>>0],Te(e,e-t),Me(e)};var mt=[];function gt(t){var e=mt[t];return e||(t>=mt.length&&(mt.length=t+1),mt[t]=e=$.get(t)),e}u.invokeEntryPoint=function(t,e){t=gt(t)(e),Q()?ht.nc(t):Ae(t)};var vt,wt,_t=[],Ot=0,At=0;function St(t){this.Zb=t,this.Sb=t-24,this.xc=function(t){i()[this.Sb+4>>2>>>0]=t},this.bc=function(){return i()[this.Sb+4>>2>>>0]},this.wc=function(t){i()[this.Sb+8>>2>>>0]=t},this.Dc=function(){return i()[this.Sb+8>>2>>>0]},this.rc=function(){a()[this.Sb>>2>>>0]=0},this.hc=function(t){t=t?1:0,e()[this.Sb+12>>0>>>0]=t},this.uc=function(){return 0!=e()[this.Sb+12>>0>>>0]},this.ic=function(t){t=t?1:0,e()[this.Sb+13>>0>>>0]=t},this.kc=function(){return 0!=e()[this.Sb+13>>0>>>0]},this.fc=function(t,e){this.cc(0),this.xc(t),this.wc(e),this.rc(),this.hc(!1),this.ic(!1)},this.sc=function(){Atomics.add(a(),this.Sb>>2,1)},this.Hc=function(){return 1===Atomics.sub(a(),this.Sb>>2,1)},this.cc=function(t){i()[this.Sb+16>>2>>>0]=t},this.tc=function(){return i()[this.Sb+16>>2>>>0]},this.vc=function(){if(Re(this.bc()))return i()[this.Zb>>2>>>0];var t=this.tc();return 0!==t?t:this.Zb}}function Tt(t){return ye(new St(t).Sb)}function Et(t,e,n,r){return O?$t(3,1,t,e,n,r):Mt(t,e,n,r)}function Mt(t,e,n,r){if("undefined"==typeof SharedArrayBuffer)return x("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var a=[];return O&&0===a.length?Et(t,e,n,r):(t={Ic:n,Ub:t,zc:r,Nc:a},O?(t.Oc="spawnThread",postMessage(t,a),0):lt(t))}function Ct(t,e,n){return O?$t(4,1,t,e,n):0}function xt(t,e){if(O)return $t(5,1,t,e)}function Rt(t,e){if(O)return $t(6,1,t,e)}function jt(t,e,n){if(O)return $t(7,1,t,e,n)}function kt(t,e,n){return O?$t(8,1,t,e,n):0}function Dt(t,e){if(O)return $t(9,1,t,e)}function Pt(t,e,n){if(O)return $t(10,1,t,e,n)}function Ut(t,e,n,r){if(O)return $t(11,1,t,e,n,r)}function Ft(t,e,n,r){if(O)return $t(12,1,t,e,n,r)}function It(t,e,n,r){if(O)return $t(13,1,t,e,n,r)}function Wt(t){if(O)return $t(14,1,t)}function Ht(t,e){if(O)return $t(15,1,t,e)}function Lt(t,e,n){if(O)return $t(16,1,t,e,n)}function zt(t){Atomics.store(a(),t>>2,1),he()&&_e(t),Atomics.compareExchange(a(),t>>2,1,0)}function Yt(t){return i()[t>>>2]+4294967296*a()[t+4>>>2]}function Bt(t,e,n,r,a,i){return O?$t(17,1,t,e,n,r,a,i):-52}function Gt(t,e,n,r,a,i){if(O)return $t(18,1,t,e,n,r,a,i)}function Nt(t){var n=G(t)+1,r=de(n);return r&&B(t,e(),r,n),r}function Vt(t,e,n){function r(t){return(t=t.toTimeString().match(/\\(([A-Za-z ]+)\\)$/))?t[1]:"GMT"}if(O)return $t(19,1,t,e,n);var o=(new Date).getFullYear(),u=new Date(o,0,1),c=new Date(o,6,1);o=u.getTimezoneOffset();var s=c.getTimezoneOffset(),l=Math.max(o,s);a()[t>>2>>>0]=60*l,a()[e>>2>>>0]=Number(o!=s),t=r(u),e=r(c),t=Nt(t),e=Nt(e),s>2>>>0]=t,i()[n+4>>2>>>0]=e):(i()[n>>2>>>0]=e,i()[n+4>>2>>>0]=t)}function $t(t,e){var n=arguments.length-2,r=arguments;return yt((()=>{for(var a=Ce(8*n),i=a>>3,u=0;u>>0]=c}return we(t,n,a,e)}))}u.executeNotifiedProxyingQueue=zt,wt=_?()=>{var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:O?()=>performance.now()-u.__performance_now_clock_drift:()=>performance.now();var qt,Xt=[],Jt={};function Zt(){if(!qt){var t,e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:m||"./this.program"};for(t in Jt)void 0===Jt[t]?delete e[t]:e[t]=Jt[t];var n=[];for(t in e)n.push(t+"="+e[t]);qt=n}return qt}function Qt(t,n){if(O)return $t(20,1,t,n);var r=0;return Zt().forEach((function(a,o){var u=n+r;for(o=i()[t+4*o>>2>>>0]=u,u=0;u>0>>>0]=a.charCodeAt(u);e()[o>>0>>>0]=0,r+=a.length+1})),0}function Kt(t,e){if(O)return $t(21,1,t,e);var n=Zt();i()[t>>2>>>0]=n.length;var r=0;return n.forEach((function(t){r+=t.length+1})),i()[e>>2>>>0]=r,0}function te(t){return O?$t(22,1,t):52}function ee(t,e,n,r){return O?$t(23,1,t,e,n,r):52}function ne(t,e,n,r,a){return O?$t(24,1,t,e,n,r,a):70}var re=[null,[],[]];function ae(t,e){var n=re[t];0===e||10===e?((1===t?C:x)(z(n,0)),n.length=0):n.push(e)}function ie(t,e,n,a){if(O)return $t(25,1,t,e,n,a);for(var o=0,u=0;u>2>>>0],s=i()[e+4>>2>>>0];e+=8;for(var l=0;l>>0]);o+=s}return i()[a>>2>>>0]=o,0}var oe=0;function ue(t){return 0==t%4&&(0!=t%100||0==t%400)}var ce=[31,29,31,30,31,30,31,31,30,31,30,31],se=[31,28,31,30,31,30,31,31,30,31,30,31];function le(t,n,r,i){function o(t,e,n){for(t="number"==typeof t?t.toString():t||"";t.lengtht?-1:0r-t.getDate())){t.setDate(t.getDate()+e);break}e-=r-t.getDate()+1,t.setDate(1),11>n?t.setMonth(n+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1))}return n=new Date(t.getFullYear()+1,0,4),e=s(new Date(t.getFullYear(),0,4)),n=s(n),0>=c(e,t)?0>=c(n,t)?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var f=a()[i+40>>2>>>0];for(var p in i={Lc:a()[i>>2>>>0],Kc:a()[i+4>>2>>>0],dc:a()[i+8>>2>>>0],jc:a()[i+12>>2>>>0],ec:a()[i+16>>2>>>0],Xb:a()[i+20>>2>>>0],Tb:a()[i+24>>2>>>0],Wb:a()[i+28>>2>>>0],Rc:a()[i+32>>2>>>0],Jc:a()[i+36>>2>>>0],Mc:f?Y(f):""},r=Y(r),f={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})r=r.replace(new RegExp(p,"g"),f[p]);var h="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),d="January February March April May June July August September October November December".split(" ");for(p in f={"%a":function(t){return h[t.Tb].substring(0,3)},"%A":function(t){return h[t.Tb]},"%b":function(t){return d[t.ec].substring(0,3)},"%B":function(t){return d[t.ec]},"%C":function(t){return u((t.Xb+1900)/100|0,2)},"%d":function(t){return u(t.jc,2)},"%e":function(t){return o(t.jc,2," ")},"%g":function(t){return l(t).toString().substring(2)},"%G":function(t){return l(t)},"%H":function(t){return u(t.dc,2)},"%I":function(t){return 0==(t=t.dc)?t=12:12t.dc?"AM":"PM"},"%S":function(t){return u(t.Lc,2)},"%t":function(){return"\\t"},"%u":function(t){return t.Tb||7},"%U":function(t){return u(Math.floor((t.Wb+7-t.Tb)/7),2)},"%V":function(t){var e=Math.floor((t.Wb+7-(t.Tb+6)%7)/7);if(2>=(t.Tb+371-t.Wb-2)%7&&e++,e)53==e&&(4==(n=(t.Tb+371-t.Wb)%7)||3==n&&ue(t.Xb)||(e=1));else{e=52;var n=(t.Tb+7-t.Wb-1)%7;(4==n||5==n&&ue(t.Xb%400-1))&&e++}return u(e,2)},"%w":function(t){return t.Tb},"%W":function(t){return u(Math.floor((t.Wb+7-(t.Tb+6)%7)/7),2)},"%y":function(t){return(t.Xb+1900).toString().substring(2)},"%Y":function(t){return t.Xb+1900},"%z":function(t){var e=0<=(t=t.Jc);return t=Math.abs(t)/60,(e?"+":"-")+String("0000"+(t/60*100+t%60)).slice(-4)},"%Z":function(t){return t.Mc},"%%":function(){return"%"}},r=r.replace(/%%/g,"\\0\\0"),f)r.includes(p)&&(r=r.replace(new RegExp(p,"g"),f[p](i)));return p=function(t){var e=Array(G(t)+1);return B(t,e,0,e.length),e}(r=r.replace(/\\0\\0/g,"%")),p.length>n?0:(function(t,n){e().set(t,n>>>0)}(p,t),p.length-1)}ht.fc();var fe=[null,ft,bt,Et,Ct,xt,Rt,jt,kt,Dt,Pt,Ut,Ft,It,Wt,Ht,Lt,Bt,Gt,Vt,Qt,Kt,te,ee,ne,ie],pe={b:function(t){return de(t+24)+24},n:function(t){return(t=new St(t)).uc()||(t.hc(!0),Ot--),t.ic(!1),_t.push(t),t.sc(),t.vc()},ma:function(t){throw x("Unexpected exception thrown, this is not properly supported - aborting"),H=!0,t},x:function(){Se(0);var t=_t.pop();if(t.Hc()&&!t.kc()){var e=t.Dc();e&>(e)(t.Zb),Tt(t.Zb)}At=0},e:function(){var t=At;if(!t)return oe=0;var e=new St(t);e.cc(t);var n=e.bc();if(!n)return oe=0,t;for(var r=Array.prototype.slice.call(arguments),a=0;azt(r)));else if(O)postMessage({targetThread:t,cmd:"processProxyingQueue",queue:r});else{if(!(t=ht.Vb[t]))return;t.postMessage({cmd:"processProxyingQueue",queue:r})}return 1},Ea:function(){return-1},Pa:function(t,e){t=new Date(1e3*Yt(t)),a()[e>>2>>>0]=t.getUTCSeconds(),a()[e+4>>2>>>0]=t.getUTCMinutes(),a()[e+8>>2>>>0]=t.getUTCHours(),a()[e+12>>2>>>0]=t.getUTCDate(),a()[e+16>>2>>>0]=t.getUTCMonth(),a()[e+20>>2>>>0]=t.getUTCFullYear()-1900,a()[e+24>>2>>>0]=t.getUTCDay(),t=(t.getTime()-Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0))/864e5|0,a()[e+28>>2>>>0]=t},Qa:function(t,e){t=new Date(1e3*Yt(t)),a()[e>>2>>>0]=t.getSeconds(),a()[e+4>>2>>>0]=t.getMinutes(),a()[e+8>>2>>>0]=t.getHours(),a()[e+12>>2>>>0]=t.getDate(),a()[e+16>>2>>>0]=t.getMonth(),a()[e+20>>2>>>0]=t.getFullYear()-1900,a()[e+24>>2>>>0]=t.getDay();var n=new Date(t.getFullYear(),0,1),r=(t.getTime()-n.getTime())/864e5|0;a()[e+28>>2>>>0]=r,a()[e+36>>2>>>0]=-60*t.getTimezoneOffset(),r=new Date(t.getFullYear(),6,1).getTimezoneOffset(),t=0|(r!=(n=n.getTimezoneOffset())&&t.getTimezoneOffset()==Math.min(n,r)),a()[e+32>>2>>>0]=t},Ra:function(t){var e=new Date(a()[t+20>>2>>>0]+1900,a()[t+16>>2>>>0],a()[t+12>>2>>>0],a()[t+8>>2>>>0],a()[t+4>>2>>>0],a()[t>>2>>>0],0),n=a()[t+32>>2>>>0],r=e.getTimezoneOffset(),i=new Date(e.getFullYear(),0,1),o=new Date(e.getFullYear(),6,1).getTimezoneOffset(),u=i.getTimezoneOffset(),c=Math.min(u,o);return 0>n?a()[t+32>>2>>>0]=Number(o!=u&&c==r):0>2>>>0]=e.getDay(),n=(e.getTime()-i.getTime())/864e5|0,a()[t+28>>2>>>0]=n,a()[t>>2>>>0]=e.getSeconds(),a()[t+4>>2>>>0]=e.getMinutes(),a()[t+8>>2>>>0]=e.getHours(),a()[t+12>>2>>>0]=e.getDate(),a()[t+16>>2>>>0]=e.getMonth(),e.getTime()/1e3|0},Aa:Bt,Ba:Gt,Sa:function t(e,n,r){t.Ac||(t.Ac=!0,Vt(e,n,r))},y:function(){at("")},U:function(){if(!_&&!w){var t="Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread";vt||(vt={}),vt[t]||(vt[t]=1,_&&(t="warning: "+t),x(t))}},ra:function(){return 4294901760},B:wt,Ia:function(t,e,n){r().copyWithin(t>>>0,e>>>0,e+n>>>0)},F:function(){return _?n(993).cpus().length:navigator.hardwareConcurrency},Da:function(t,e,n){Xt.length=e,n>>=3;for(var r=0;r>>0];return(0>t?ut[-t-1]:fe[t]).apply(null,Xt)},qa:function(t){var e=r().length;if((t>>>=0)<=e||4294901760=n;n*=2){var a=e*(1+.2/n);a=Math.min(a,t+100663296);var i=Math;a=Math.max(t,a),i=i.min.call(i,4294901760,a+(65536-a%65536)%65536);t:{try{j.grow(i-D.byteLength+65535>>>16),N(j.buffer);var o=1;break t}catch(t){}o=void 0}if(o)return!0}return!1},Na:function(){throw"unwind"},Ga:Qt,Ha:Kt,J:pt,I:te,S:ee,ga:ne,R:ie,d:function(){return oe},na:function t(r,a){t.lc||(t.lc=function(){if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var t=new Uint8Array(1);return()=>(crypto.getRandomValues(t),t[0])}if(_)try{var e=n(Object(function(){var t=new Error("Cannot find module \'crypto\'");throw t.code="MODULE_NOT_FOUND",t}()));return()=>e.randomBytes(1)[0]}catch(t){}return()=>at("randomDevice")}());for(var i=0;i>0>>>0]=t.lc();return 0},ia:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},ja:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},K:function(t){var e=Ee();try{return gt(t)()}catch(t){if(Me(e),t!==t+0)throw t;Se(1,0)}},f:function(t,e){var n=Ee();try{return gt(t)(e)}catch(t){if(Me(n),t!==t+0)throw t;Se(1,0)}},P:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},Q:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},k:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},p:function(t,e,n,r){var a=Ee();try{return gt(t)(e,n,r)}catch(t){if(Me(a),t!==t+0)throw t;Se(1,0)}},q:function(t,e,n,r,a){var i=Ee();try{return gt(t)(e,n,r,a)}catch(t){if(Me(i),t!==t+0)throw t;Se(1,0)}},N:function(t,e,n,r,a,i){var o=Ee();try{return gt(t)(e,n,r,a,i)}catch(t){if(Me(o),t!==t+0)throw t;Se(1,0)}},s:function(t,e,n,r,a,i){var o=Ee();try{return gt(t)(e,n,r,a,i)}catch(t){if(Me(o),t!==t+0)throw t;Se(1,0)}},w:function(t,e,n,r,a,i,o){var u=Ee();try{return gt(t)(e,n,r,a,i,o)}catch(t){if(Me(u),t!==t+0)throw t;Se(1,0)}},L:function(t,e,n,r,a,i,o,u){var c=Ee();try{return gt(t)(e,n,r,a,i,o,u)}catch(t){if(Me(c),t!==t+0)throw t;Se(1,0)}},E:function(t,e,n,r,a,i,o,u,c,s,l,f){var p=Ee();try{return gt(t)(e,n,r,a,i,o,u,c,s,l,f)}catch(t){if(Me(p),t!==t+0)throw t;Se(1,0)}},aa:function(t,e,n,r,a,i,o,u){var c=Ee();try{return He(t,e,n,r,a,i,o,u)}catch(t){if(Me(c),t!==t+0)throw t;Se(1,0)}},_:function(t,e,n,r,a,i,o){var u=Ee();try{return ke(t,e,n,r,a,i,o)}catch(t){if(Me(u),t!==t+0)throw t;Se(1,0)}},Z:function(t,e,n,r,a){var i=Ee();try{return Le(t,e,n,r,a)}catch(t){if(Me(i),t!==t+0)throw t;Se(1,0)}},ca:function(t,e,n,r){var a=Ee();try{return Ie(t,e,n,r)}catch(t){if(Me(a),t!==t+0)throw t;Se(1,0)}},$:function(t){var e=Ee();try{return je(t)}catch(t){if(Me(e),t!==t+0)throw t;Se(1,0)}},ba:function(t,e){var n=Ee();try{return We(t,e)}catch(t){if(Me(n),t!==t+0)throw t;Se(1,0)}},Y:function(t,e,n){var r=Ee();try{return De(t,e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},g:function(t){var e=Ee();try{gt(t)()}catch(t){if(Me(e),t!==t+0)throw t;Se(1,0)}},r:function(t,e){var n=Ee();try{gt(t)(e)}catch(t){if(Me(n),t!==t+0)throw t;Se(1,0)}},i:function(t,e,n){var r=Ee();try{gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},ha:function(t,e,n,r){var a=Ee();try{gt(t)(e,n,r)}catch(t){if(Me(a),t!==t+0)throw t;Se(1,0)}},m:function(t,e,n,r){var a=Ee();try{gt(t)(e,n,r)}catch(t){if(Me(a),t!==t+0)throw t;Se(1,0)}},v:function(t,e,n,r,a){var i=Ee();try{gt(t)(e,n,r,a)}catch(t){if(Me(i),t!==t+0)throw t;Se(1,0)}},u:function(t,e,n,r,a,i){var o=Ee();try{gt(t)(e,n,r,a,i)}catch(t){if(Me(o),t!==t+0)throw t;Se(1,0)}},O:function(t,e,n,r,a,i,o){var u=Ee();try{gt(t)(e,n,r,a,i,o)}catch(t){if(Me(u),t!==t+0)throw t;Se(1,0)}},A:function(t,e,n,r,a,i,o,u){var c=Ee();try{gt(t)(e,n,r,a,i,o,u)}catch(t){if(Me(c),t!==t+0)throw t;Se(1,0)}},ka:function(t,e,n,r,a,i,o,u,c){var s=Ee();try{gt(t)(e,n,r,a,i,o,u,c)}catch(t){if(Me(s),t!==t+0)throw t;Se(1,0)}},C:function(t,e,n,r,a,i,o,u,c,s,l){var f=Ee();try{gt(t)(e,n,r,a,i,o,u,c,s,l)}catch(t){if(Me(f),t!==t+0)throw t;Se(1,0)}},D:function(t,e,n,r,a,i,o,u,c,s,l,f,p,h,d,y){var b=Ee();try{gt(t)(e,n,r,a,i,o,u,c,s,l,f,p,h,d,y)}catch(t){if(Me(b),t!==t+0)throw t;Se(1,0)}},fa:function(t,e,n,r,a,i,o,u){var c=Ee();try{Pe(t,e,n,r,a,i,o,u)}catch(t){if(Me(c),t!==t+0)throw t;Se(1,0)}},da:function(t,e,n,r,a,i,o,u,c,s,l,f){var p=Ee();try{Fe(t,e,n,r,a,i,o,u,c,s,l,f)}catch(t){if(Me(p),t!==t+0)throw t;Se(1,0)}},ea:function(t,e,n,r,a,i){var o=Ee();try{Ue(t,e,n,r,a,i)}catch(t){if(Me(o),t!==t+0)throw t;Se(1,0)}},o:function(t){return t},a:j||u.wasmMemory,G:function(t){oe=t},la:le,z:function(t,e,n,r){return le(t,e,n,r)}};!function(){function t(t,e){u.asm=t.exports,ht.qc.push(u.asm.sb),$=u.asm.ub,X.unshift(u.asm.Va),k=e,O||(et--,u.monitorRunDependencies&&u.monitorRunDependencies(et),0==et&&(null!==nt&&(clearInterval(nt),nt=null),rt&&(t=rt,rt=null,t())))}function e(e){t(e.instance,e.module)}function n(t){return function(){if(!M&&(v||w)){if("function"==typeof fetch&&!tt.startsWith("file://"))return fetch(tt,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at \'"+tt+"\'";return t.arrayBuffer()})).catch((function(){return ot()}));if(f)return new Promise((function(t,e){f(tt,(function(e){t(new Uint8Array(e))}),e)}))}return Promise.resolve().then((function(){return ot()}))}().then((function(t){return WebAssembly.instantiate(t,r)})).then((function(t){return t})).then(t,(function(t){x("failed to asynchronously prepare wasm: "+t),at(t)}))}var r={a:pe};if(O||(et++,u.monitorRunDependencies&&u.monitorRunDependencies(et)),u.instantiateWasm)try{return u.instantiateWasm(r,t)}catch(t){return x("Module.instantiateWasm callback failed with error: "+t),!1}(M||"function"!=typeof WebAssembly.instantiateStreaming||it()||tt.startsWith("file://")||_||"function"!=typeof fetch?n(e):fetch(tt,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,r).then(e,(function(t){return x("wasm streaming compile failed: "+t),x("falling back to ArrayBuffer instantiation"),n(e)}))}))).catch(s)}(),u.___wasm_call_ctors=function(){return(u.___wasm_call_ctors=u.asm.Va).apply(null,arguments)},u._OrtInit=function(){return(u._OrtInit=u.asm.Wa).apply(null,arguments)},u._OrtCreateSessionOptions=function(){return(u._OrtCreateSessionOptions=u.asm.Xa).apply(null,arguments)},u._OrtAppendExecutionProvider=function(){return(u._OrtAppendExecutionProvider=u.asm.Ya).apply(null,arguments)},u._OrtAddSessionConfigEntry=function(){return(u._OrtAddSessionConfigEntry=u.asm.Za).apply(null,arguments)},u._OrtReleaseSessionOptions=function(){return(u._OrtReleaseSessionOptions=u.asm._a).apply(null,arguments)},u._OrtCreateSession=function(){return(u._OrtCreateSession=u.asm.$a).apply(null,arguments)},u._OrtReleaseSession=function(){return(u._OrtReleaseSession=u.asm.ab).apply(null,arguments)},u._OrtGetInputCount=function(){return(u._OrtGetInputCount=u.asm.bb).apply(null,arguments)},u._OrtGetOutputCount=function(){return(u._OrtGetOutputCount=u.asm.cb).apply(null,arguments)},u._OrtGetInputName=function(){return(u._OrtGetInputName=u.asm.db).apply(null,arguments)},u._OrtGetOutputName=function(){return(u._OrtGetOutputName=u.asm.eb).apply(null,arguments)},u._OrtFree=function(){return(u._OrtFree=u.asm.fb).apply(null,arguments)},u._OrtCreateTensor=function(){return(u._OrtCreateTensor=u.asm.gb).apply(null,arguments)},u._OrtGetTensorData=function(){return(u._OrtGetTensorData=u.asm.hb).apply(null,arguments)},u._OrtReleaseTensor=function(){return(u._OrtReleaseTensor=u.asm.ib).apply(null,arguments)},u._OrtCreateRunOptions=function(){return(u._OrtCreateRunOptions=u.asm.jb).apply(null,arguments)},u._OrtAddRunConfigEntry=function(){return(u._OrtAddRunConfigEntry=u.asm.kb).apply(null,arguments)},u._OrtReleaseRunOptions=function(){return(u._OrtReleaseRunOptions=u.asm.lb).apply(null,arguments)},u._OrtRun=function(){return(u._OrtRun=u.asm.mb).apply(null,arguments)},u._OrtEndProfiling=function(){return(u._OrtEndProfiling=u.asm.nb).apply(null,arguments)};var he=u._pthread_self=function(){return(he=u._pthread_self=u.asm.ob).apply(null,arguments)},de=u._malloc=function(){return(de=u._malloc=u.asm.pb).apply(null,arguments)},ye=u._free=function(){return(ye=u._free=u.asm.qb).apply(null,arguments)},be=u._fflush=function(){return(be=u._fflush=u.asm.rb).apply(null,arguments)};u.__emscripten_tls_init=function(){return(u.__emscripten_tls_init=u.asm.sb).apply(null,arguments)};var me=u.___funcs_on_exit=function(){return(me=u.___funcs_on_exit=u.asm.tb).apply(null,arguments)},ge=u.__emscripten_thread_init=function(){return(ge=u.__emscripten_thread_init=u.asm.vb).apply(null,arguments)};u.__emscripten_thread_crashed=function(){return(u.__emscripten_thread_crashed=u.asm.wb).apply(null,arguments)};var ve,we=u._emscripten_run_in_main_runtime_thread_js=function(){return(we=u._emscripten_run_in_main_runtime_thread_js=u.asm.xb).apply(null,arguments)},_e=u.__emscripten_proxy_execute_task_queue=function(){return(_e=u.__emscripten_proxy_execute_task_queue=u.asm.yb).apply(null,arguments)},Oe=u.__emscripten_thread_free_data=function(){return(Oe=u.__emscripten_thread_free_data=u.asm.zb).apply(null,arguments)},Ae=u.__emscripten_thread_exit=function(){return(Ae=u.__emscripten_thread_exit=u.asm.Ab).apply(null,arguments)},Se=u._setThrew=function(){return(Se=u._setThrew=u.asm.Bb).apply(null,arguments)},Te=u._emscripten_stack_set_limits=function(){return(Te=u._emscripten_stack_set_limits=u.asm.Cb).apply(null,arguments)},Ee=u.stackSave=function(){return(Ee=u.stackSave=u.asm.Db).apply(null,arguments)},Me=u.stackRestore=function(){return(Me=u.stackRestore=u.asm.Eb).apply(null,arguments)},Ce=u.stackAlloc=function(){return(Ce=u.stackAlloc=u.asm.Fb).apply(null,arguments)},xe=u.___cxa_can_catch=function(){return(xe=u.___cxa_can_catch=u.asm.Gb).apply(null,arguments)},Re=u.___cxa_is_pointer_type=function(){return(Re=u.___cxa_is_pointer_type=u.asm.Hb).apply(null,arguments)},je=u.dynCall_j=function(){return(je=u.dynCall_j=u.asm.Ib).apply(null,arguments)},ke=u.dynCall_iiiiij=function(){return(ke=u.dynCall_iiiiij=u.asm.Jb).apply(null,arguments)},De=u.dynCall_jii=function(){return(De=u.dynCall_jii=u.asm.Kb).apply(null,arguments)},Pe=u.dynCall_viiiiij=function(){return(Pe=u.dynCall_viiiiij=u.asm.Lb).apply(null,arguments)},Ue=u.dynCall_vjji=function(){return(Ue=u.dynCall_vjji=u.asm.Mb).apply(null,arguments)},Fe=u.dynCall_viiijjjii=function(){return(Fe=u.dynCall_viiijjjii=u.asm.Nb).apply(null,arguments)},Ie=u.dynCall_iij=function(){return(Ie=u.dynCall_iij=u.asm.Ob).apply(null,arguments)},We=u.dynCall_ji=function(){return(We=u.dynCall_ji=u.asm.Pb).apply(null,arguments)},He=u.dynCall_iiiiiij=function(){return(He=u.dynCall_iiiiiij=u.asm.Qb).apply(null,arguments)},Le=u.dynCall_iiij=function(){return(Le=u.dynCall_iiij=u.asm.Rb).apply(null,arguments)};function ze(){function t(){if(!ve&&(ve=!0,u.calledRun=!0,!H)&&(O||dt(X),c(u),u.onRuntimeInitialized&&u.onRuntimeInitialized(),!O)){if(u.postRun)for("function"==typeof u.postRun&&(u.postRun=[u.postRun]);u.postRun.length;){var t=u.postRun.shift();Z.unshift(t)}dt(Z)}}if(!(0{var _scriptDir,r=(_scriptDir=(_scriptDir="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(t){var e,r,a;t=t||{},e||(e=void 0!==t?t:{}),e.ready=new Promise((function(t,e){r=t,a=e}));var i,o,u,c,s,l,f=Object.assign({},e),p="./this.program",h=(t,e)=>{throw e},d="object"==typeof window,y="function"==typeof importScripts,b="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,m="";b?(m=y?n(908).dirname(m)+"/":"//",l=()=>{s||(c=n(384),s=n(908))},i=function(t,e){return l(),t=s.normalize(t),c.readFileSync(t,e?void 0:"utf8")},u=t=>((t=i(t,!0)).buffer||(t=new Uint8Array(t)),t),o=(t,e,n)=>{l(),t=s.normalize(t),c.readFile(t,(function(t,r){t?n(t):e(r.buffer)}))},1{if(_||0{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},y&&(u=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),o=(t,e,n)=>{var r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=()=>{200==r.status||0==r.status&&r.response?e(r.response):n()},r.onerror=n,r.send(null)});var g,v=e.print||console.log.bind(console),w=e.printErr||console.warn.bind(console);Object.assign(e,f),f=null,e.thisProgram&&(p=e.thisProgram),e.quit&&(h=e.quit),e.wasmBinary&&(g=e.wasmBinary);var _=e.noExitRuntime||!1;"object"!=typeof WebAssembly&&V("no native wasm support detected");var O,A,S,T,E,M,C=!1,x="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function R(t,e,n){var r=(e>>>=0)+n;for(n=e;t[n]&&!(n>=r);)++n;if(16(a=224==(240&a)?(15&a)<<12|i<<6|o:(7&a)<<18|i<<12|o<<6|63&t[e++])?r+=String.fromCharCode(a):(a-=65536,r+=String.fromCharCode(55296|a>>10,56320|1023&a))}}else r+=String.fromCharCode(a)}return r}function j(t,e){return(t>>>=0)?R(T,t,e):""}function k(t,e,n,r){if(!(0>>=0;r=n+r-1;for(var i=0;i=o&&(o=65536+((1023&o)<<10)|1023&t.charCodeAt(++i)),127>=o){if(n>=r)break;e[n++>>>0]=o}else{if(2047>=o){if(n+1>=r)break;e[n++>>>0]=192|o>>6}else{if(65535>=o){if(n+2>=r)break;e[n++>>>0]=224|o>>12}else{if(n+3>=r)break;e[n++>>>0]=240|o>>18,e[n++>>>0]=128|o>>12&63}e[n++>>>0]=128|o>>6&63}e[n++>>>0]=128|63&o}}return e[n>>>0]=0,n-a}function D(t){for(var e=0,n=0;n=r?e++:2047>=r?e+=2:55296<=r&&57343>=r?(e+=4,++n):e+=3}return e}function P(){var t=O.buffer;A=t,e.HEAP8=S=new Int8Array(t),e.HEAP16=new Int16Array(t),e.HEAP32=E=new Int32Array(t),e.HEAPU8=T=new Uint8Array(t),e.HEAPU16=new Uint16Array(t),e.HEAPU32=M=new Uint32Array(t),e.HEAPF32=new Float32Array(t),e.HEAPF64=new Float64Array(t)}var U,F=[],I=[],W=[],H=[],L=0;function z(){var t=e.preRun.shift();F.unshift(t)}var Y,B=0,G=null,N=null;function V(t){throw e.onAbort&&e.onAbort(t),w(t="Aborted("+t+")"),C=!0,t=new WebAssembly.RuntimeError(t+". Build with -sASSERTIONS for more info."),a(t),t}function $(){return Y.startsWith("data:application/octet-stream;base64,")}if(Y="ort-wasm.wasm",!$()){var q=Y;Y=e.locateFile?e.locateFile(q,m):m+q}function X(){var t=Y;try{if(t==Y&&g)return new Uint8Array(g);if(u)return u(t);throw"both async and sync fetching of the wasm failed"}catch(t){V(t)}}function J(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}function Z(t){for(;0>2>>>0]=t},this.Eb=function(){return M[this.zb+4>>2>>>0]},this.Sb=function(t){M[this.zb+8>>2>>>0]=t},this.Wb=function(){return M[this.zb+8>>2>>>0]},this.Tb=function(){E[this.zb>>2>>>0]=0},this.Ib=function(t){S[this.zb+12>>0>>>0]=t?1:0},this.Pb=function(){return 0!=S[this.zb+12>>0>>>0]},this.Jb=function(t){S[this.zb+13>>0>>>0]=t?1:0},this.Lb=function(){return 0!=S[this.zb+13>>0>>>0]},this.Rb=function(t,e){this.Fb(0),this.Ub(t),this.Sb(e),this.Tb(),this.Ib(!1),this.Jb(!1)},this.Nb=function(){E[this.zb>>2>>>0]+=1},this.Xb=function(){var t=E[this.zb>>2>>>0];return E[this.zb>>2>>>0]=t-1,1===t},this.Fb=function(t){M[this.zb+16>>2>>>0]=t},this.Ob=function(){return M[this.zb+16>>2>>>0]},this.Qb=function(){if(Mt(this.Eb()))return M[this.Db>>2>>>0];var t=this.Ob();return 0!==t?t:this.Db}}function nt(t){return vt(new et(t).zb)}var rt=[];function at(t){var e=rt[t];return e||(t>=rt.length&&(rt.length=t+1),rt[t]=e=U.get(t)),e}function it(t){var e=D(t)+1,n=gt(e);return n&&k(t,S,n,e),n}var ot={};function ut(){if(!ct){var t,e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:p||"./this.program"};for(t in ot)void 0===ot[t]?delete e[t]:e[t]=ot[t];var n=[];for(t in e)n.push(t+"="+e[t]);ct=n}return ct}var ct,st=[null,[],[]];function lt(t,e){var n=st[t];0===e||10===e?((1===t?v:w)(R(n,0)),n.length=0):n.push(e)}var ft=0;function pt(t){return 0==t%4&&(0!=t%100||0==t%400)}var ht=[31,29,31,30,31,30,31,31,30,31,30,31],dt=[31,28,31,30,31,30,31,31,30,31,30,31];function yt(t,e,n,r){function a(t,e,n){for(t="number"==typeof t?t.toString():t||"";t.lengtht?-1:0r-t.getDate())){t.setDate(t.getDate()+e);break}e-=r-t.getDate()+1,t.setDate(1),11>n?t.setMonth(n+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1))}return n=new Date(t.getFullYear()+1,0,4),e=u(new Date(t.getFullYear(),0,4)),n=u(n),0>=o(e,t)?0>=o(n,t)?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var s=E[r+40>>2>>>0];for(var l in r={$b:E[r>>2>>>0],Zb:E[r+4>>2>>>0],Gb:E[r+8>>2>>>0],Kb:E[r+12>>2>>>0],Hb:E[r+16>>2>>>0],Cb:E[r+20>>2>>>0],Ab:E[r+24>>2>>>0],Bb:E[r+28>>2>>>0],bc:E[r+32>>2>>>0],Yb:E[r+36>>2>>>0],ac:s?j(s):""},n=j(n),s={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})n=n.replace(new RegExp(l,"g"),s[l]);var f="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),p="January February March April May June July August September October November December".split(" ");for(l in s={"%a":function(t){return f[t.Ab].substring(0,3)},"%A":function(t){return f[t.Ab]},"%b":function(t){return p[t.Hb].substring(0,3)},"%B":function(t){return p[t.Hb]},"%C":function(t){return i((t.Cb+1900)/100|0,2)},"%d":function(t){return i(t.Kb,2)},"%e":function(t){return a(t.Kb,2," ")},"%g":function(t){return c(t).toString().substring(2)},"%G":function(t){return c(t)},"%H":function(t){return i(t.Gb,2)},"%I":function(t){return 0==(t=t.Gb)?t=12:12t.Gb?"AM":"PM"},"%S":function(t){return i(t.$b,2)},"%t":function(){return"\\t"},"%u":function(t){return t.Ab||7},"%U":function(t){return i(Math.floor((t.Bb+7-t.Ab)/7),2)},"%V":function(t){var e=Math.floor((t.Bb+7-(t.Ab+6)%7)/7);if(2>=(t.Ab+371-t.Bb-2)%7&&e++,e)53==e&&(4==(n=(t.Ab+371-t.Bb)%7)||3==n&&pt(t.Cb)||(e=1));else{e=52;var n=(t.Ab+7-t.Bb-1)%7;(4==n||5==n&&pt(t.Cb%400-1))&&e++}return i(e,2)},"%w":function(t){return t.Ab},"%W":function(t){return i(Math.floor((t.Bb+7-(t.Ab+6)%7)/7),2)},"%y":function(t){return(t.Cb+1900).toString().substring(2)},"%Y":function(t){return t.Cb+1900},"%z":function(t){var e=0<=(t=t.Yb);return t=Math.abs(t)/60,(e?"+":"-")+String("0000"+(t/60*100+t%60)).slice(-4)},"%Z":function(t){return t.ac},"%%":function(){return"%"}},n=n.replace(/%%/g,"\\0\\0"),s)n.includes(l)&&(n=n.replace(new RegExp(l,"g"),s[l](r)));return l=function(t){var e=Array(D(t)+1);return k(t,e,0,e.length),e}(n=n.replace(/\\0\\0/g,"%")),l.length>e?0:(S.set(l,t>>>0),l.length-1)}var bt={a:function(t){return gt(t+24)+24},m:function(t){return(t=new et(t)).Pb()||(t.Ib(!0),K--),t.Jb(!1),Q.push(t),t.Nb(),t.Qb()},ia:function(t){throw w("Unexpected exception thrown, this is not properly supported - aborting"),C=!0,t},w:function(){Ot(0);var t=Q.pop();if(t.Xb()&&!t.Lb()){var e=t.Wb();e&&at(e)(t.Db),nt(t.Db)}tt=0},d:function(){var t=tt;if(!t)return ft=0;var e=new et(t);e.Fb(t);var n=e.Eb();if(!n)return ft=0,t;for(var r=Array.prototype.slice.call(arguments),a=0;a>>2]+4294967296*E[t+4>>>2])),E[e>>2>>>0]=t.getUTCSeconds(),E[e+4>>2>>>0]=t.getUTCMinutes(),E[e+8>>2>>>0]=t.getUTCHours(),E[e+12>>2>>>0]=t.getUTCDate(),E[e+16>>2>>>0]=t.getUTCMonth(),E[e+20>>2>>>0]=t.getUTCFullYear()-1900,E[e+24>>2>>>0]=t.getUTCDay(),E[e+28>>2>>>0]=(t.getTime()-Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0))/864e5|0},Ea:function(t,e){t=new Date(1e3*(M[t>>>2]+4294967296*E[t+4>>>2])),E[e>>2>>>0]=t.getSeconds(),E[e+4>>2>>>0]=t.getMinutes(),E[e+8>>2>>>0]=t.getHours(),E[e+12>>2>>>0]=t.getDate(),E[e+16>>2>>>0]=t.getMonth(),E[e+20>>2>>>0]=t.getFullYear()-1900,E[e+24>>2>>>0]=t.getDay();var n=new Date(t.getFullYear(),0,1);E[e+28>>2>>>0]=(t.getTime()-n.getTime())/864e5|0,E[e+36>>2>>>0]=-60*t.getTimezoneOffset();var r=new Date(t.getFullYear(),6,1).getTimezoneOffset();n=n.getTimezoneOffset(),E[e+32>>2>>>0]=0|(r!=n&&t.getTimezoneOffset()==Math.min(n,r))},Fa:function(t){var e=new Date(E[t+20>>2>>>0]+1900,E[t+16>>2>>>0],E[t+12>>2>>>0],E[t+8>>2>>>0],E[t+4>>2>>>0],E[t>>2>>>0],0),n=E[t+32>>2>>>0],r=e.getTimezoneOffset(),a=new Date(e.getFullYear(),0,1),i=new Date(e.getFullYear(),6,1).getTimezoneOffset(),o=a.getTimezoneOffset(),u=Math.min(o,i);return 0>n?E[t+32>>2>>>0]=Number(i!=o&&u==r):0>2>>>0]=e.getDay(),E[t+28>>2>>>0]=(e.getTime()-a.getTime())/864e5|0,E[t>>2>>>0]=e.getSeconds(),E[t+4>>2>>>0]=e.getMinutes(),E[t+8>>2>>>0]=e.getHours(),E[t+12>>2>>>0]=e.getDate(),E[t+16>>2>>>0]=e.getMonth(),e.getTime()/1e3|0},sa:function(){return-52},ta:function(){},Ga:function t(e,n,r){t.Vb||(t.Vb=!0,function(t,e,n){function r(t){return(t=t.toTimeString().match(/\\(([A-Za-z ]+)\\)$/))?t[1]:"GMT"}var a=(new Date).getFullYear(),i=new Date(a,0,1),o=new Date(a,6,1);a=i.getTimezoneOffset();var u=o.getTimezoneOffset();E[t>>2>>>0]=60*Math.max(a,u),E[e>>2>>>0]=Number(a!=u),t=r(i),e=r(o),t=it(t),e=it(e),u>2>>>0]=t,M[n+4>>2>>>0]=e):(M[n>>2>>>0]=e,M[n+4>>2>>>0]=t)}(e,n,r))},B:function(){V("")},ma:function(){return 4294901760},I:b?()=>{var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:()=>performance.now(),xa:function(t,e,n){T.copyWithin(t>>>0,e>>>0,e+n>>>0)},G:function(t){var e=T.length;if(4294901760<(t>>>=0))return!1;for(var n=1;4>=n;n*=2){var r=e*(1+.2/n);r=Math.min(r,t+100663296);var a=Math;r=Math.max(t,r),a=a.min.call(a,4294901760,r+(65536-r%65536)%65536);t:{try{O.grow(a-A.byteLength+65535>>>16),P();var i=1;break t}catch(t){}i=void 0}if(i)return!0}return!1},va:function(t,e){var n=0;return ut().forEach((function(r,a){var i=e+n;for(a=M[t+4*a>>2>>>0]=i,i=0;i>0>>>0]=r.charCodeAt(i);S[a>>0>>>0]=0,n+=r.length+1})),0},wa:function(t,e){var n=ut();M[t>>2>>>0]=n.length;var r=0;return n.forEach((function(t){r+=t.length+1})),M[e>>2>>>0]=r,0},ba:function(t){_||0>2>>>0],u=M[e+4>>2>>>0];e+=8;for(var c=0;c>>0]);a+=u}return M[r>>2>>>0]=a,0},c:function(){return ft},ja:function t(e,r){t.Mb||(t.Mb=function(){if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var t=new Uint8Array(1);return()=>(crypto.getRandomValues(t),t[0])}if(b)try{var e=n(Object(function(){var t=new Error("Cannot find module \'crypto\'");throw t.code="MODULE_NOT_FOUND",t}()));return()=>e.randomBytes(1)[0]}catch(t){}return()=>V("randomDevice")}());for(var a=0;a>0>>>0]=t.Mb();return 0},ea:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},fa:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},J:function(t){var e=At();try{return at(t)()}catch(t){if(St(e),t!==t+0)throw t;Ot(1,0)}},e:function(t,e){var n=At();try{return at(t)(e)}catch(t){if(St(n),t!==t+0)throw t;Ot(1,0)}},N:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},O:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},j:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},o:function(t,e,n,r){var a=At();try{return at(t)(e,n,r)}catch(t){if(St(a),t!==t+0)throw t;Ot(1,0)}},p:function(t,e,n,r,a){var i=At();try{return at(t)(e,n,r,a)}catch(t){if(St(i),t!==t+0)throw t;Ot(1,0)}},M:function(t,e,n,r,a,i){var o=At();try{return at(t)(e,n,r,a,i)}catch(t){if(St(o),t!==t+0)throw t;Ot(1,0)}},r:function(t,e,n,r,a,i){var o=At();try{return at(t)(e,n,r,a,i)}catch(t){if(St(o),t!==t+0)throw t;Ot(1,0)}},v:function(t,e,n,r,a,i,o){var u=At();try{return at(t)(e,n,r,a,i,o)}catch(t){if(St(u),t!==t+0)throw t;Ot(1,0)}},K:function(t,e,n,r,a,i,o,u){var c=At();try{return at(t)(e,n,r,a,i,o,u)}catch(t){if(St(c),t!==t+0)throw t;Ot(1,0)}},D:function(t,e,n,r,a,i,o,u,c,s,l,f){var p=At();try{return at(t)(e,n,r,a,i,o,u,c,s,l,f)}catch(t){if(St(p),t!==t+0)throw t;Ot(1,0)}},X:function(t,e,n,r,a,i,o,u){var c=At();try{return Ft(t,e,n,r,a,i,o,u)}catch(t){if(St(c),t!==t+0)throw t;Ot(1,0)}},V:function(t,e,n,r,a,i,o){var u=At();try{return xt(t,e,n,r,a,i,o)}catch(t){if(St(u),t!==t+0)throw t;Ot(1,0)}},U:function(t,e,n,r,a){var i=At();try{return It(t,e,n,r,a)}catch(t){if(St(i),t!==t+0)throw t;Ot(1,0)}},Z:function(t,e,n,r){var a=At();try{return Pt(t,e,n,r)}catch(t){if(St(a),t!==t+0)throw t;Ot(1,0)}},W:function(t){var e=At();try{return Ct(t)}catch(t){if(St(e),t!==t+0)throw t;Ot(1,0)}},Y:function(t,e){var n=At();try{return Ut(t,e)}catch(t){if(St(n),t!==t+0)throw t;Ot(1,0)}},T:function(t,e,n){var r=At();try{return Rt(t,e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},f:function(t){var e=At();try{at(t)()}catch(t){if(St(e),t!==t+0)throw t;Ot(1,0)}},q:function(t,e){var n=At();try{at(t)(e)}catch(t){if(St(n),t!==t+0)throw t;Ot(1,0)}},h:function(t,e,n){var r=At();try{at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},da:function(t,e,n,r){var a=At();try{at(t)(e,n,r)}catch(t){if(St(a),t!==t+0)throw t;Ot(1,0)}},l:function(t,e,n,r){var a=At();try{at(t)(e,n,r)}catch(t){if(St(a),t!==t+0)throw t;Ot(1,0)}},t:function(t,e,n,r,a){var i=At();try{at(t)(e,n,r,a)}catch(t){if(St(i),t!==t+0)throw t;Ot(1,0)}},u:function(t,e,n,r,a,i){var o=At();try{at(t)(e,n,r,a,i)}catch(t){if(St(o),t!==t+0)throw t;Ot(1,0)}},x:function(t,e,n,r,a,i,o){var u=At();try{at(t)(e,n,r,a,i,o)}catch(t){if(St(u),t!==t+0)throw t;Ot(1,0)}},z:function(t,e,n,r,a,i,o,u){var c=At();try{at(t)(e,n,r,a,i,o,u)}catch(t){if(St(c),t!==t+0)throw t;Ot(1,0)}},ga:function(t,e,n,r,a,i,o,u,c){var s=At();try{at(t)(e,n,r,a,i,o,u,c)}catch(t){if(St(s),t!==t+0)throw t;Ot(1,0)}},A:function(t,e,n,r,a,i,o,u,c,s,l){var f=At();try{at(t)(e,n,r,a,i,o,u,c,s,l)}catch(t){if(St(f),t!==t+0)throw t;Ot(1,0)}},C:function(t,e,n,r,a,i,o,u,c,s,l,f,p,h,d,y){var b=At();try{at(t)(e,n,r,a,i,o,u,c,s,l,f,p,h,d,y)}catch(t){if(St(b),t!==t+0)throw t;Ot(1,0)}},aa:function(t,e,n,r,a,i,o,u){var c=At();try{jt(t,e,n,r,a,i,o,u)}catch(t){if(St(c),t!==t+0)throw t;Ot(1,0)}},_:function(t,e,n,r,a,i,o,u,c,s,l,f){var p=At();try{Dt(t,e,n,r,a,i,o,u,c,s,l,f)}catch(t){if(St(p),t!==t+0)throw t;Ot(1,0)}},$:function(t,e,n,r,a,i){var o=At();try{kt(t,e,n,r,a,i)}catch(t){if(St(o),t!==t+0)throw t;Ot(1,0)}},n:function(t){return t},F:function(t){ft=t},ha:yt,y:function(t,e,n,r){return yt(t,e,n,r)}};!function(){function t(t){e.asm=t.exports,O=e.asm.Ka,P(),U=e.asm.ib,I.unshift(e.asm.La),B--,e.monitorRunDependencies&&e.monitorRunDependencies(B),0==B&&(null!==G&&(clearInterval(G),G=null),N&&(t=N,N=null,t()))}function n(e){t(e.instance)}function r(t){return function(){if(!g&&(d||y)){if("function"==typeof fetch&&!Y.startsWith("file://"))return fetch(Y,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at \'"+Y+"\'";return t.arrayBuffer()})).catch((function(){return X()}));if(o)return new Promise((function(t,e){o(Y,(function(e){t(new Uint8Array(e))}),e)}))}return Promise.resolve().then((function(){return X()}))}().then((function(t){return WebAssembly.instantiate(t,i)})).then((function(t){return t})).then(t,(function(t){w("failed to asynchronously prepare wasm: "+t),V(t)}))}var i={a:bt};if(B++,e.monitorRunDependencies&&e.monitorRunDependencies(B),e.instantiateWasm)try{return e.instantiateWasm(i,t)}catch(t){return w("Module.instantiateWasm callback failed with error: "+t),!1}(g||"function"!=typeof WebAssembly.instantiateStreaming||$()||Y.startsWith("file://")||b||"function"!=typeof fetch?r(n):fetch(Y,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,i).then(n,(function(t){return w("wasm streaming compile failed: "+t),w("falling back to ArrayBuffer instantiation"),r(n)}))}))).catch(a)}(),e.___wasm_call_ctors=function(){return(e.___wasm_call_ctors=e.asm.La).apply(null,arguments)},e._OrtInit=function(){return(e._OrtInit=e.asm.Ma).apply(null,arguments)},e._OrtCreateSessionOptions=function(){return(e._OrtCreateSessionOptions=e.asm.Na).apply(null,arguments)},e._OrtAppendExecutionProvider=function(){return(e._OrtAppendExecutionProvider=e.asm.Oa).apply(null,arguments)},e._OrtAddSessionConfigEntry=function(){return(e._OrtAddSessionConfigEntry=e.asm.Pa).apply(null,arguments)},e._OrtReleaseSessionOptions=function(){return(e._OrtReleaseSessionOptions=e.asm.Qa).apply(null,arguments)},e._OrtCreateSession=function(){return(e._OrtCreateSession=e.asm.Ra).apply(null,arguments)},e._OrtReleaseSession=function(){return(e._OrtReleaseSession=e.asm.Sa).apply(null,arguments)},e._OrtGetInputCount=function(){return(e._OrtGetInputCount=e.asm.Ta).apply(null,arguments)},e._OrtGetOutputCount=function(){return(e._OrtGetOutputCount=e.asm.Ua).apply(null,arguments)},e._OrtGetInputName=function(){return(e._OrtGetInputName=e.asm.Va).apply(null,arguments)},e._OrtGetOutputName=function(){return(e._OrtGetOutputName=e.asm.Wa).apply(null,arguments)},e._OrtFree=function(){return(e._OrtFree=e.asm.Xa).apply(null,arguments)},e._OrtCreateTensor=function(){return(e._OrtCreateTensor=e.asm.Ya).apply(null,arguments)},e._OrtGetTensorData=function(){return(e._OrtGetTensorData=e.asm.Za).apply(null,arguments)},e._OrtReleaseTensor=function(){return(e._OrtReleaseTensor=e.asm._a).apply(null,arguments)},e._OrtCreateRunOptions=function(){return(e._OrtCreateRunOptions=e.asm.$a).apply(null,arguments)},e._OrtAddRunConfigEntry=function(){return(e._OrtAddRunConfigEntry=e.asm.ab).apply(null,arguments)},e._OrtReleaseRunOptions=function(){return(e._OrtReleaseRunOptions=e.asm.bb).apply(null,arguments)},e._OrtRun=function(){return(e._OrtRun=e.asm.cb).apply(null,arguments)},e._OrtEndProfiling=function(){return(e._OrtEndProfiling=e.asm.db).apply(null,arguments)};var mt,gt=e._malloc=function(){return(gt=e._malloc=e.asm.eb).apply(null,arguments)},vt=e._free=function(){return(vt=e._free=e.asm.fb).apply(null,arguments)},wt=e._fflush=function(){return(wt=e._fflush=e.asm.gb).apply(null,arguments)},_t=e.___funcs_on_exit=function(){return(_t=e.___funcs_on_exit=e.asm.hb).apply(null,arguments)},Ot=e._setThrew=function(){return(Ot=e._setThrew=e.asm.jb).apply(null,arguments)},At=e.stackSave=function(){return(At=e.stackSave=e.asm.kb).apply(null,arguments)},St=e.stackRestore=function(){return(St=e.stackRestore=e.asm.lb).apply(null,arguments)},Tt=e.stackAlloc=function(){return(Tt=e.stackAlloc=e.asm.mb).apply(null,arguments)},Et=e.___cxa_can_catch=function(){return(Et=e.___cxa_can_catch=e.asm.nb).apply(null,arguments)},Mt=e.___cxa_is_pointer_type=function(){return(Mt=e.___cxa_is_pointer_type=e.asm.ob).apply(null,arguments)},Ct=e.dynCall_j=function(){return(Ct=e.dynCall_j=e.asm.pb).apply(null,arguments)},xt=e.dynCall_iiiiij=function(){return(xt=e.dynCall_iiiiij=e.asm.qb).apply(null,arguments)},Rt=e.dynCall_jii=function(){return(Rt=e.dynCall_jii=e.asm.rb).apply(null,arguments)},jt=e.dynCall_viiiiij=function(){return(jt=e.dynCall_viiiiij=e.asm.sb).apply(null,arguments)},kt=e.dynCall_vjji=function(){return(kt=e.dynCall_vjji=e.asm.tb).apply(null,arguments)},Dt=e.dynCall_viiijjjii=function(){return(Dt=e.dynCall_viiijjjii=e.asm.ub).apply(null,arguments)},Pt=e.dynCall_iij=function(){return(Pt=e.dynCall_iij=e.asm.vb).apply(null,arguments)},Ut=e.dynCall_ji=function(){return(Ut=e.dynCall_ji=e.asm.wb).apply(null,arguments)},Ft=e.dynCall_iiiiiij=function(){return(Ft=e.dynCall_iiiiiij=e.asm.xb).apply(null,arguments)},It=e.dynCall_iiij=function(){return(It=e.dynCall_iiij=e.asm.yb).apply(null,arguments)};function Wt(){function t(){if(!mt&&(mt=!0,e.calledRun=!0,!C)){if(Z(I),r(e),e.onRuntimeInitialized&&e.onRuntimeInitialized(),e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;){var t=e.postRun.shift();H.unshift(t)}Z(H)}}if(!(0{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.iterateExtraOptions=void 0,e.iterateExtraOptions=(t,n,r,a)=>{if("object"==typeof t&&null!==t){if(r.has(t))throw new Error("Circular reference in options");r.add(t)}Object.entries(t).forEach((([t,i])=>{const o=n?n+t:t;if("object"==typeof i)(0,e.iterateExtraOptions)(i,o+".",r,a);else if("string"==typeof i||"number"==typeof i)a(o,i.toString());else{if("boolean"!=typeof i)throw new Error("Can\'t handle extra config type: "+typeof i);a(o,i?"1":"0")}}))}},586:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setRunOptions=void 0;const r=n(967),a=n(983),i=n(361);e.setRunOptions=t=>{const e=(0,i.getInstance)();let n=0;const o=[],u=t||{};try{if(void 0===(null==t?void 0:t.logSeverityLevel))u.logSeverityLevel=2;else if("number"!=typeof t.logSeverityLevel||!Number.isInteger(t.logSeverityLevel)||t.logSeverityLevel<0||t.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${t.logSeverityLevel}`);if(void 0===(null==t?void 0:t.logVerbosityLevel))u.logVerbosityLevel=0;else if("number"!=typeof t.logVerbosityLevel||!Number.isInteger(t.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${t.logVerbosityLevel}`);void 0===(null==t?void 0:t.terminate)&&(u.terminate=!1);let i=0;if(void 0!==(null==t?void 0:t.tag)&&(i=(0,a.allocWasmString)(t.tag,o)),n=e._OrtCreateRunOptions(u.logSeverityLevel,u.logVerbosityLevel,!!u.terminate,i),0===n)throw new Error("Can\'t create run options");return void 0!==(null==t?void 0:t.extra)&&(0,r.iterateExtraOptions)(t.extra,"",new WeakSet,((t,r)=>{const i=(0,a.allocWasmString)(t,o),u=(0,a.allocWasmString)(r,o);if(0!==e._OrtAddRunConfigEntry(n,i,u))throw new Error(`Can\'t set a run config entry: ${t} - ${r}`)})),[n,o]}catch(t){throw 0!==n&&e._OrtReleaseRunOptions(n),o.forEach(e._free),t}}},919:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setSessionOptions=void 0;const r=n(967),a=n(983),i=n(361);e.setSessionOptions=t=>{const e=(0,i.getInstance)();let n=0;const o=[],u=t||{};(t=>{t.extra||(t.extra={}),t.extra.session||(t.extra.session={});const e=t.extra.session;e.use_ort_model_bytes_directly||(e.use_ort_model_bytes_directly="1")})(u);try{void 0===(null==t?void 0:t.graphOptimizationLevel)&&(u.graphOptimizationLevel="all");const c=(t=>{switch(t){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${t}`)}})(u.graphOptimizationLevel);void 0===(null==t?void 0:t.enableCpuMemArena)&&(u.enableCpuMemArena=!0),void 0===(null==t?void 0:t.enableMemPattern)&&(u.enableMemPattern=!0),void 0===(null==t?void 0:t.executionMode)&&(u.executionMode="sequential");const s=(t=>{switch(t){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${t}`)}})(u.executionMode);let l=0;if(void 0!==(null==t?void 0:t.logId)&&(l=(0,a.allocWasmString)(t.logId,o)),void 0===(null==t?void 0:t.logSeverityLevel))u.logSeverityLevel=2;else if("number"!=typeof t.logSeverityLevel||!Number.isInteger(t.logSeverityLevel)||t.logSeverityLevel<0||t.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${t.logSeverityLevel}`);if(void 0===(null==t?void 0:t.logVerbosityLevel))u.logVerbosityLevel=0;else if("number"!=typeof t.logVerbosityLevel||!Number.isInteger(t.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${t.logVerbosityLevel}`);if(void 0===(null==t?void 0:t.enableProfiling)&&(u.enableProfiling=!1),n=e._OrtCreateSessionOptions(c,!!u.enableCpuMemArena,!!u.enableMemPattern,s,!!u.enableProfiling,0,l,u.logSeverityLevel,u.logVerbosityLevel),0===n)throw new Error("Can\'t create session options");return(null==t?void 0:t.executionProviders)&&((t,e,n)=>{for(const r of e){let e="string"==typeof r?r:r.name;switch(e){case"xnnpack":e="XNNPACK";break;case"wasm":case"cpu":continue;default:throw new Error(`not supported EP: ${e}`)}const o=(0,a.allocWasmString)(e,n);if(0!==(0,i.getInstance)()._OrtAppendExecutionProvider(t,o))throw new Error(`Can\'t append execution provider: ${e}`)}})(n,t.executionProviders,o),void 0!==(null==t?void 0:t.extra)&&(0,r.iterateExtraOptions)(t.extra,"",new WeakSet,((t,r)=>{const i=(0,a.allocWasmString)(t,o),u=(0,a.allocWasmString)(r,o);if(0!==e._OrtAddSessionConfigEntry(n,i,u))throw new Error(`Can\'t set a session config entry: ${t} - ${r}`)})),[n,o]}catch(t){throw 0!==n&&e._OrtReleaseSessionOptions(n),o.forEach(e._free),t}}},983:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.allocWasmString=void 0;const r=n(361);e.allocWasmString=(t,e)=>{const n=(0,r.getInstance)(),a=n.lengthBytesUTF8(t)+1,i=n._malloc(a);return n.stringToUTF8(t,i,a),e.push(i),i}},349:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.extractTransferableBuffers=e.endProfiling=e.run=e.releaseSession=e.createSession=e.createSessionFinalize=e.createSessionAllocate=e.initOrt=void 0;const r=n(586),a=n(919),i=n(983),o=n(361);e.initOrt=(t,e)=>{const n=(0,o.getInstance)()._OrtInit(t,e);if(0!==n)throw new Error(`Can\'t initialize onnxruntime. error code = ${n}`)};const u=new Map;e.createSessionAllocate=t=>{const e=(0,o.getInstance)(),n=e._malloc(t.byteLength);return e.HEAPU8.set(t,n),[n,t.byteLength]},e.createSessionFinalize=(t,e)=>{const n=(0,o.getInstance)();let r=0,i=0,c=[];try{if([i,c]=(0,a.setSessionOptions)(e),r=n._OrtCreateSession(t[0],t[1],i),0===r)throw new Error("Can\'t create a session")}finally{n._free(t[0]),n._OrtReleaseSessionOptions(i),c.forEach(n._free)}const s=n._OrtGetInputCount(r),l=n._OrtGetOutputCount(r),f=[],p=[],h=[],d=[];for(let t=0;t{const r=(0,e.createSessionAllocate)(t);return(0,e.createSessionFinalize)(r,n)},e.releaseSession=t=>{const e=(0,o.getInstance)(),n=u.get(t);if(!n)throw new Error("invalid session id");const r=n[0],a=n[1],i=n[2];a.forEach(e._OrtFree),i.forEach(e._OrtFree),e._OrtReleaseSession(r),u.delete(t)};const c=t=>{switch(t){case"int8":return 3;case"uint8":return 2;case"bool":return 9;case"int16":return 5;case"uint16":return 4;case"int32":return 6;case"uint32":return 12;case"float32":return 1;case"float64":return 11;case"string":return 8;case"int64":return 7;case"uint64":return 13;default:throw new Error(`unsupported data type: ${t}`)}},s=t=>{switch(t){case 3:return"int8";case 2:return"uint8";case 9:return"bool";case 5:return"int16";case 4:return"uint16";case 6:return"int32";case 12:return"uint32";case 1:return"float32";case 11:return"float64";case 8:return"string";case 7:return"int64";case 13:return"uint64";default:throw new Error(`unsupported data type: ${t}`)}},l=t=>{switch(t){case"float32":return Float32Array;case"uint8":case"bool":return Uint8Array;case"int8":return Int8Array;case"uint16":return Uint16Array;case"int16":return Int16Array;case"int32":return Int32Array;case"float64":return Float64Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"uint64":return BigUint64Array;default:throw new Error(`unsupported type: ${t}`)}};e.run=(t,e,n,a,f)=>{const p=(0,o.getInstance)(),h=u.get(t);if(!h)throw new Error("invalid session id");const d=h[0],y=h[1],b=h[2],m=e.length,g=a.length;let v=0,w=[];const _=[],O=[];try{[v,w]=(0,r.setRunOptions)(f);for(let t=0;tp.HEAP32[t++]=e));const n=p._OrtCreateTensor(c(e),o,u,l,r.length);if(0===n)throw new Error("Can\'t create a tensor");_.push(n)}finally{p.stackRestore(s)}}const t=p.stackSave(),o=p.stackAlloc(4*m),u=p.stackAlloc(4*m),h=p.stackAlloc(4*g),A=p.stackAlloc(4*g);try{let n=o/4,r=u/4,i=h/4,c=A/4;for(let t=0;tt*e));if(a=s(o),"string"===a){const t=[];let e=i/4;for(let n=0;n{const e=(0,o.getInstance)(),n=u.get(t);if(!n)throw new Error("invalid session id");const r=n[0],a=e._OrtEndProfiling(r);if(0===a)throw new Error("Can\'t get an profile file name");e._OrtFree(a)},e.extractTransferableBuffers=t=>{const e=[];for(const n of t){const t=n[2];!Array.isArray(t)&&t.buffer&&e.push(t.buffer)}return e}},361:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var a=Object.getOwnPropertyDescriptor(e,n);a&&!("get"in a?!e.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,a)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),a=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return a(e,t),e},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.dispose=e.getInstance=e.initializeWebAssembly=void 0;const u=i(n(449)),c=o(n(932)),s=n(474);let l,f=!1,p=!1,h=!1;const d=(t,e)=>e?t?"ort-wasm-simd-threaded.wasm":"ort-wasm-threaded.wasm":t?"ort-wasm-simd.wasm":"ort-wasm.wasm";e.initializeWebAssembly=async t=>{if(f)return Promise.resolve();if(p)throw new Error("multiple calls to \'initializeWebAssembly()\' detected.");if(h)throw new Error("previous call to \'initializeWebAssembly()\' failed.");p=!0;const e=t.initTimeout,r=t.numThreads,a=t.simd,i=r>1&&(()=>{try{return"undefined"!=typeof SharedArrayBuffer&&("undefined"!=typeof MessageChannel&&(new MessageChannel).port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])))}catch(t){return!1}})(),o=a&&(()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,30,1,28,0,65,0,253,15,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,186,1,26,11]))}catch(t){return!1}})(),y="string"==typeof t.wasmPaths?t.wasmPaths:void 0,b=d(!1,i),m=d(o,i),g="object"==typeof t.wasmPaths?t.wasmPaths[m]:void 0;let v=!1;const w=[];if(e>0&&w.push(new Promise((t=>{setTimeout((()=>{v=!0,t()}),e)}))),w.push(new Promise(((t,e)=>{const r=i?s:c.default,a={locateFile:(t,e)=>i&&t.endsWith(".worker.js")&&"undefined"!=typeof Blob?URL.createObjectURL(new Blob([n(154)],{type:"text/javascript"})):t===b?null!=g?g:(null!=y?y:e)+m:e+t};if(i)if("undefined"==typeof Blob)a.mainScriptUrlOrBlob=u.join("/","ort-wasm-threaded.js");else{const t=`var ortWasmThreaded=(function(){var _scriptDir;return ${r.toString()}})();`;a.mainScriptUrlOrBlob=new Blob([t],{type:"text/javascript"})}r(a).then((e=>{p=!1,f=!0,l=e,t()}),(t=>{p=!1,h=!0,e(t)}))}))),await Promise.race(w),v)throw new Error(`WebAssembly backend initializing failed due to timeout: ${e}ms`)},e.getInstance=()=>{if(f&&l)return l;throw new Error("WebAssembly is not initialized yet.")},e.dispose=()=>{var t;!f||p||h||(p=!0,null===(t=l.PThread)||void 0===t||t.terminateAllThreads(),l=void 0,p=!1,f=!1,h=!0)}},154:t=>{"use strict";t.exports=\'"use strict";var e={},t="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node;if(t){var r=require("worker_threads"),a=r.parentPort;a.on("message",(e=>onmessage({data:e})));var o=require("fs");Object.assign(global,{self:global,require:require,Module:e,location:{href:__filename},Worker:r.Worker,importScripts:function(e){(0,eval)(o.readFileSync(e,"utf8"))},postMessage:function(e){a.postMessage(e)},performance:global.performance||{now:function(){return Date.now()}}})}var s=!1,n=[],i=function(){var e=Array.prototype.slice.call(arguments).join(" ");t?o.writeSync(2,e+"\\\\n"):console.error(e)};self.alert=function(){var t=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:t,threadId:e._pthread_self()})},e.instantiateWasm=(t,r)=>{var a=new WebAssembly.Instance(e.wasmModule,t);return r(a),e.wasmModule=null,a.exports},self.onunhandledrejection=e=>{throw e.reason??e},self.onmessage=t=>{try{if("load"===t.data.cmd){if(e.wasmModule=t.data.wasmModule,e.wasmMemory=t.data.wasmMemory,e.buffer=e.wasmMemory.buffer,e.ENVIRONMENT_IS_PTHREAD=!0,"string"==typeof t.data.urlOrBlob)importScripts(t.data.urlOrBlob);else{var r=URL.createObjectURL(t.data.urlOrBlob);importScripts(r),URL.revokeObjectURL(r)}ortWasmThreaded(e).then((function(t){e=t}))}else if("run"===t.data.cmd){e.__performance_now_clock_drift=performance.now()-t.data.time,e.__emscripten_thread_init(t.data.pthread_ptr,0,0,1),e.establishStackSpace(),e.PThread.receiveObjectTransfer(t.data),e.PThread.threadInitTLS(),s||(n.forEach((t=>{e.executeNotifiedProxyingQueue(t)})),n=[],s=!0);try{e.invokeEntryPoint(t.data.start_routine,t.data.arg)}catch(t){if("unwind"!=t){if(!(t instanceof e.ExitStatus))throw t;e.keepRuntimeAlive()||e.__emscripten_thread_exit(t.status)}}}else"cancel"===t.data.cmd?e._pthread_self()&&e.__emscripten_thread_exit(-1):"setimmediate"===t.data.target||("processProxyingQueue"===t.data.cmd?s?e.executeNotifiedProxyingQueue(t.data.queue):n.push(t.data.queue):(i("worker.js received unknown command "+t.data.cmd),i(t.data)))}catch(t){throw i("worker.js onmessage() captured an uncaught exception: "+t),t&&t.stack&&i(t.stack),e.__emscripten_thread_crashed&&e.__emscripten_thread_crashed(),t}};\\n\'},384:()=>{},993:()=>{},908:()=>{},953:()=>{},925:()=>{},449:()=>{}},e={};function n(r){var a=e[r];if(void 0!==a)return a.exports;var i=e[r]={exports:{}};return t[r].call(i.exports,i,i.exports,n),i.exports}n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),(()=>{"use strict";const t=n(349),e=n(361);self.onmessage=n=>{switch(n.data.type){case"init-wasm":(0,e.initializeWebAssembly)(n.data.in).then((()=>postMessage({type:"init-wasm"})),(t=>postMessage({type:"init-wasm",err:t})));break;case"init-ort":try{const{numThreads:e,loggingLevel:r}=n.data.in;(0,t.initOrt)(e,r),postMessage({type:"init-ort"})}catch(t){postMessage({type:"init-ort",err:t})}break;case"create_allocate":try{const{model:e}=n.data.in,r=(0,t.createSessionAllocate)(e);postMessage({type:"create_allocate",out:r})}catch(t){postMessage({type:"create_allocate",err:t})}break;case"create_finalize":try{const{modeldata:e,options:r}=n.data.in,a=(0,t.createSessionFinalize)(e,r);postMessage({type:"create_finalize",out:a})}catch(t){postMessage({type:"create_finalize",err:t})}break;case"create":try{const{model:e,options:r}=n.data.in,a=(0,t.createSession)(e,r);postMessage({type:"create",out:a})}catch(t){postMessage({type:"create",err:t})}break;case"release":try{const e=n.data.in;(0,t.releaseSession)(e),postMessage({type:"release"})}catch(t){postMessage({type:"release",err:t})}break;case"run":try{const{sessionId:e,inputIndices:r,inputs:a,outputIndices:i,options:o}=n.data.in,u=(0,t.run)(e,r,a,i,o);postMessage({type:"run",out:u},(0,t.extractTransferableBuffers)(u))}catch(t){postMessage({type:"run",err:t})}break;case"end-profiling":try{const e=n.data.in;(0,t.endProfiling)(e),postMessage({type:"end-profiling"})}catch(t){postMessage({type:"end-profiling",err:t})}}}})()})();\n',"Worker",void 0,void 0)}},477:i=>{i.exports=function(o,s,a,_){var $=self||window;try{try{var _e;try{_e=new $.Blob([o])}catch{(_e=new($.BlobBuilder||$.WebKitBlobBuilder||$.MozBlobBuilder||$.MSBlobBuilder)).append(o),_e=_e.getBlob()}var tt=$.URL||$.webkitURL,st=tt.createObjectURL(_e),it=new $[s](st,a);return tt.revokeObjectURL(st),it}catch{return new $[s]("data:application/javascript,".concat(encodeURIComponent(o)),a)}}catch{if(!_)throw Error("Inline worker is not supported");return new $[s](_,a)}}},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}}; +`},1670:i=>{i.exports=__WEBPACK_EXTERNAL_MODULE__1670__},7067:()=>{},1296:()=>{},1384:()=>{},3993:()=>{},908:()=>{},6953:()=>{},9925:()=>{},2806:()=>{},6449:()=>{},2850:()=>{},5381:()=>{},5686:(i,o,s)=>{s.r(o),s.d(o,{flatbuffers:()=>a});var a={};a.Offset,a.Table,a.SIZEOF_SHORT=2,a.SIZEOF_INT=4,a.FILE_IDENTIFIER_LENGTH=4,a.SIZE_PREFIX_LENGTH=4,a.Encoding={UTF8_BYTES:1,UTF16_STRING:2},a.int32=new Int32Array(2),a.float32=new Float32Array(a.int32.buffer),a.float64=new Float64Array(a.int32.buffer),a.isLittleEndian=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1,a.Long=function(_,$){this.low=0|_,this.high=0|$},a.Long.create=function(_,$){return _==0&&$==0?a.Long.ZERO:new a.Long(_,$)},a.Long.prototype.toFloat64=function(){return(this.low>>>0)+4294967296*this.high},a.Long.prototype.equals=function(_){return this.low==_.low&&this.high==_.high},a.Long.ZERO=new a.Long(0,0),a.Builder=function(_){if(_)$=_;else var $=1024;this.bb=a.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},a.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},a.Builder.prototype.forceDefaults=function(_){this.force_defaults=_},a.Builder.prototype.dataBuffer=function(){return this.bb},a.Builder.prototype.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},a.Builder.prototype.prep=function(_,$){_>this.minalign&&(this.minalign=_);for(var _e=1+~(this.bb.capacity()-this.space+$)&_-1;this.space<_e+_+$;){var tt=this.bb.capacity();this.bb=a.Builder.growByteBuffer(this.bb),this.space+=this.bb.capacity()-tt}this.pad(_e)},a.Builder.prototype.pad=function(_){for(var $=0;$<_;$++)this.bb.writeInt8(--this.space,0)},a.Builder.prototype.writeInt8=function(_){this.bb.writeInt8(this.space-=1,_)},a.Builder.prototype.writeInt16=function(_){this.bb.writeInt16(this.space-=2,_)},a.Builder.prototype.writeInt32=function(_){this.bb.writeInt32(this.space-=4,_)},a.Builder.prototype.writeInt64=function(_){this.bb.writeInt64(this.space-=8,_)},a.Builder.prototype.writeFloat32=function(_){this.bb.writeFloat32(this.space-=4,_)},a.Builder.prototype.writeFloat64=function(_){this.bb.writeFloat64(this.space-=8,_)},a.Builder.prototype.addInt8=function(_){this.prep(1,0),this.writeInt8(_)},a.Builder.prototype.addInt16=function(_){this.prep(2,0),this.writeInt16(_)},a.Builder.prototype.addInt32=function(_){this.prep(4,0),this.writeInt32(_)},a.Builder.prototype.addInt64=function(_){this.prep(8,0),this.writeInt64(_)},a.Builder.prototype.addFloat32=function(_){this.prep(4,0),this.writeFloat32(_)},a.Builder.prototype.addFloat64=function(_){this.prep(8,0),this.writeFloat64(_)},a.Builder.prototype.addFieldInt8=function(_,$,_e){(this.force_defaults||$!=_e)&&(this.addInt8($),this.slot(_))},a.Builder.prototype.addFieldInt16=function(_,$,_e){(this.force_defaults||$!=_e)&&(this.addInt16($),this.slot(_))},a.Builder.prototype.addFieldInt32=function(_,$,_e){(this.force_defaults||$!=_e)&&(this.addInt32($),this.slot(_))},a.Builder.prototype.addFieldInt64=function(_,$,_e){!this.force_defaults&&$.equals(_e)||(this.addInt64($),this.slot(_))},a.Builder.prototype.addFieldFloat32=function(_,$,_e){(this.force_defaults||$!=_e)&&(this.addFloat32($),this.slot(_))},a.Builder.prototype.addFieldFloat64=function(_,$,_e){(this.force_defaults||$!=_e)&&(this.addFloat64($),this.slot(_))},a.Builder.prototype.addFieldOffset=function(_,$,_e){(this.force_defaults||$!=_e)&&(this.addOffset($),this.slot(_))},a.Builder.prototype.addFieldStruct=function(_,$,_e){$!=_e&&(this.nested($),this.slot(_))},a.Builder.prototype.nested=function(_){if(_!=this.offset())throw new Error("FlatBuffers: struct must be serialized inline.")},a.Builder.prototype.notNested=function(){if(this.isNested)throw new Error("FlatBuffers: object serialization must not be nested.")},a.Builder.prototype.slot=function(_){this.vtable[_]=this.offset()},a.Builder.prototype.offset=function(){return this.bb.capacity()-this.space},a.Builder.growByteBuffer=function(_){var $=_.capacity();if(3221225472&$)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");var _e=$<<1,tt=a.ByteBuffer.allocate(_e);return tt.setPosition(_e-$),tt.bytes().set(_.bytes(),_e-$),tt},a.Builder.prototype.addOffset=function(_){this.prep(a.SIZEOF_INT,0),this.writeInt32(this.offset()-_+a.SIZEOF_INT)},a.Builder.prototype.startObject=function(_){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=_;for(var $=0;$<_;$++)this.vtable[$]=0;this.isNested=!0,this.object_start=this.offset()},a.Builder.prototype.endObject=function(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);for(var _=this.offset(),$=this.vtable_in_use-1;$>=0&&this.vtable[$]==0;$--);for(var _e=$+1;$>=0;$--)this.addInt16(this.vtable[$]!=0?_-this.vtable[$]:0);this.addInt16(_-this.object_start);var tt=(_e+2)*a.SIZEOF_SHORT;this.addInt16(tt);var st=0,it=this.space;e:for($=0;$=0;it--)this.writeInt8(st.charCodeAt(it))}this.prep(this.minalign,a.SIZEOF_INT+tt),this.addOffset(_),tt&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)},a.Builder.prototype.finishSizePrefixed=function(_,$){this.finish(_,$,!0)},a.Builder.prototype.requiredField=function(_,$){var _e=this.bb.capacity()-_,tt=_e-this.bb.readInt32(_e);if(this.bb.readInt16(tt+$)==0)throw new Error("FlatBuffers: field "+$+" must be set")},a.Builder.prototype.startVector=function(_,$,_e){this.notNested(),this.vector_num_elems=$,this.prep(a.SIZEOF_INT,_*$),this.prep(_e,_*$)},a.Builder.prototype.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},a.Builder.prototype.createString=function(_){if(_ instanceof Uint8Array)var $=_;else{$=[];for(var _e=0;_e<_.length;){var tt,st=_.charCodeAt(_e++);(tt=st<55296||st>=56320?st:(st<<10)+_.charCodeAt(_e++)+-56613888)<128?$.push(tt):(tt<2048?$.push(tt>>6&31|192):(tt<65536?$.push(tt>>12&15|224):$.push(tt>>18&7|240,tt>>12&63|128),$.push(tt>>6&63|128)),$.push(63&tt|128))}}this.addInt8(0),this.startVector(1,$.length,1),this.bb.setPosition(this.space-=$.length),_e=0;for(var it=this.space,nt=this.bb.bytes();_e<$.length;_e++)nt[it++]=$[_e];return this.endVector()},a.Builder.prototype.createLong=function(_,$){return a.Long.create(_,$)},a.ByteBuffer=function(_){this.bytes_=_,this.position_=0},a.ByteBuffer.allocate=function(_){return new a.ByteBuffer(new Uint8Array(_))},a.ByteBuffer.prototype.clear=function(){this.position_=0},a.ByteBuffer.prototype.bytes=function(){return this.bytes_},a.ByteBuffer.prototype.position=function(){return this.position_},a.ByteBuffer.prototype.setPosition=function(_){this.position_=_},a.ByteBuffer.prototype.capacity=function(){return this.bytes_.length},a.ByteBuffer.prototype.readInt8=function(_){return this.readUint8(_)<<24>>24},a.ByteBuffer.prototype.readUint8=function(_){return this.bytes_[_]},a.ByteBuffer.prototype.readInt16=function(_){return this.readUint16(_)<<16>>16},a.ByteBuffer.prototype.readUint16=function(_){return this.bytes_[_]|this.bytes_[_+1]<<8},a.ByteBuffer.prototype.readInt32=function(_){return this.bytes_[_]|this.bytes_[_+1]<<8|this.bytes_[_+2]<<16|this.bytes_[_+3]<<24},a.ByteBuffer.prototype.readUint32=function(_){return this.readInt32(_)>>>0},a.ByteBuffer.prototype.readInt64=function(_){return new a.Long(this.readInt32(_),this.readInt32(_+4))},a.ByteBuffer.prototype.readUint64=function(_){return new a.Long(this.readUint32(_),this.readUint32(_+4))},a.ByteBuffer.prototype.readFloat32=function(_){return a.int32[0]=this.readInt32(_),a.float32[0]},a.ByteBuffer.prototype.readFloat64=function(_){return a.int32[a.isLittleEndian?0:1]=this.readInt32(_),a.int32[a.isLittleEndian?1:0]=this.readInt32(_+4),a.float64[0]},a.ByteBuffer.prototype.writeInt8=function(_,$){this.bytes_[_]=$},a.ByteBuffer.prototype.writeUint8=function(_,$){this.bytes_[_]=$},a.ByteBuffer.prototype.writeInt16=function(_,$){this.bytes_[_]=$,this.bytes_[_+1]=$>>8},a.ByteBuffer.prototype.writeUint16=function(_,$){this.bytes_[_]=$,this.bytes_[_+1]=$>>8},a.ByteBuffer.prototype.writeInt32=function(_,$){this.bytes_[_]=$,this.bytes_[_+1]=$>>8,this.bytes_[_+2]=$>>16,this.bytes_[_+3]=$>>24},a.ByteBuffer.prototype.writeUint32=function(_,$){this.bytes_[_]=$,this.bytes_[_+1]=$>>8,this.bytes_[_+2]=$>>16,this.bytes_[_+3]=$>>24},a.ByteBuffer.prototype.writeInt64=function(_,$){this.writeInt32(_,$.low),this.writeInt32(_+4,$.high)},a.ByteBuffer.prototype.writeUint64=function(_,$){this.writeUint32(_,$.low),this.writeUint32(_+4,$.high)},a.ByteBuffer.prototype.writeFloat32=function(_,$){a.float32[0]=$,this.writeInt32(_,a.int32[0])},a.ByteBuffer.prototype.writeFloat64=function(_,$){a.float64[0]=$,this.writeInt32(_,a.int32[a.isLittleEndian?0:1]),this.writeInt32(_+4,a.int32[a.isLittleEndian?1:0])},a.ByteBuffer.prototype.getBufferIdentifier=function(){if(this.bytes_.length>10),56320+(1023&it)))}return tt},a.ByteBuffer.prototype.__indirect=function(_){return _+this.readInt32(_)},a.ByteBuffer.prototype.__vector=function(_){return _+this.readInt32(_)+a.SIZEOF_INT},a.ByteBuffer.prototype.__vector_len=function(_){return this.readInt32(_+this.readInt32(_))},a.ByteBuffer.prototype.__has_identifier=function(_){if(_.length!=a.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+a.FILE_IDENTIFIER_LENGTH);for(var $=0;${var o=i&&i.__esModule?()=>i.default:()=>i;return __webpack_require__.d(o,{a:o}),o},__webpack_require__.d=(i,o)=>{for(var s in o)__webpack_require__.o(o,s)&&!__webpack_require__.o(i,s)&&Object.defineProperty(i,s,{enumerable:!0,get:o[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,o)=>Object.prototype.hasOwnProperty.call(i,o),__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,models={},common$2={};Object.defineProperty(common$2,"__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(o,s,a,_,$){this.ortInstance=o,this._session=s,this._h=a,this._c=_,this._sr=$,this.reset_state=()=>{const _e=Array(128).fill(0);this._h=new this.ortInstance.Tensor("float32",_e,[2,1,64]),this._c=new this.ortInstance.Tensor("float32",_e,[2,1,64])},this.process=async _e=>{var j;const st={input:new this.ortInstance.Tensor("float32",_e,[1,_e.length]),h:this._h,c:this._c,sr:this._sr},it=await this._session.run(st);this._h=it.hn,this._c=it.cn;const[nt]=(j=it.output)==null?void 0:j.data;return{notSpeech:1-nt,isSpeech:nt}}}}legacy.SileroLegacy=SileroLegacy;_a$1=SileroLegacy;SileroLegacy.new=async(i,o)=>{logging_1$2.log.debug("initializing vad");const s=await o(),a=await i.InferenceSession.create(s),_=new i.Tensor("int64",[16000n]),$=Array(2*64).fill(0),_e=new i.Tensor("float32",$,[2,1,64]),tt=new i.Tensor("float32",$,[2,1,64]);return logging_1$2.log.debug("vad is initialized"),new _a$1(i,a,_e,tt,_)};var v5={},_a;Object.defineProperty(v5,"__esModule",{value:!0});v5.SileroV5=void 0;const logging_1$1=logging;function getNewState(i){const o=Array(256).fill(0);return new i.Tensor("float32",o,[2,1,128])}class SileroV5{constructor(o,s,a,_){this._session=o,this._state=s,this._sr=a,this.ortInstance=_,this.reset_state=()=>{this._state=getNewState(this.ortInstance)},this.process=async $=>{var et;const tt={input:new this.ortInstance.Tensor("float32",$,[1,$.length]),state:this._state,sr:this._sr},st=await this._session.run(tt);this._state=st.stateN;const[it]=(et=st.output)==null?void 0:et.data;return{notSpeech:1-it,isSpeech:it}}}}v5.SileroV5=SileroV5;_a=SileroV5;SileroV5.new=async(i,o)=>{logging_1$1.log.debug("Loading VAD...");const s=await o(),a=await i.InferenceSession.create(s),_=new i.Tensor("int64",[16000n]),$=getNewState(i);return logging_1$1.log.debug("...finished loading VAD"),new _a(a,$,_,i)};(function(i){var o=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function($,_e,tt,st){st===void 0&&(st=tt);var it=Object.getOwnPropertyDescriptor(_e,tt);(!it||("get"in it?!_e.__esModule:it.writable||it.configurable))&&(it={enumerable:!0,get:function(){return _e[tt]}}),Object.defineProperty($,st,it)}:function($,_e,tt,st){st===void 0&&(st=tt),$[st]=_e[tt]}),s=commonjsGlobal&&commonjsGlobal.__exportStar||function($,_e){for(var tt in $)tt!=="default"&&!Object.prototype.hasOwnProperty.call(_e,tt)&&o(_e,$,tt)};Object.defineProperty(i,"__esModule",{value:!0}),i.SileroV5=i.SileroLegacy=void 0,s(common$2,i);var a=legacy;Object.defineProperty(i,"SileroLegacy",{enumerable:!0,get:function(){return a.SileroLegacy}});var _=v5;Object.defineProperty(i,"SileroV5",{enumerable:!0,get:function(){return _.SileroV5}})})(models);var resampler={};Object.defineProperty(resampler,"__esModule",{value:!0});resampler.Resampler=void 0;const logging_1=logging;class Resampler{constructor(o){this.options=o,this.process=s=>{const a=[];for(const _ of s)for(this.inputBuffer.push(_);this.hasEnoughDataForFrame();){const $=this.generateOutputFrame();a.push($)}return a},o.nativeSampleRate<16e3&&logging_1.log.error("nativeSampleRate is too low. Should have 16000 = targetSampleRate <= nativeSampleRate"),this.inputBuffer=[]}async*stream(o){for(const s of o)for(this.inputBuffer.push(s);this.hasEnoughDataForFrame();)yield this.generateOutputFrame()}hasEnoughDataForFrame(){return this.inputBuffer.length*this.options.targetSampleRate/this.options.nativeSampleRate>=this.options.targetFrameSize}generateOutputFrame(){const o=new Float32Array(this.options.targetFrameSize);let s=0,a=0;for(;sot.modelFetcher(ot.modelURL),lt=await it.SileroLegacy.new(_,at),ut=new tt.FrameProcessor(lt.process,lt.reset_state,{frameSamples:ot.frameSamples,positiveSpeechThreshold:ot.positiveSpeechThreshold,negativeSpeechThreshold:ot.negativeSpeechThreshold,redemptionFrames:ot.redemptionFrames,preSpeechPadFrames:ot.preSpeechPadFrames,minSpeechFrames:ot.minSpeechFrames,submitUserSpeechOnPause:ot.submitUserSpeechOnPause});return ut.resume(),new this(at,_,ot,ut)}constructor(rt,ot,at,lt){this.modelFetcher=rt,this.ort=ot,this.options=at,this.frameProcessor=lt}async*run(rt,ot){const at={nativeSampleRate:ot,targetSampleRate:16e3,targetFrameSize:this.options.frameSamples},lt=new nt.Resampler(at);let ut=0,ct=0,dt=0,ft=[];for await(const yt of lt.stream(rt)){await this.frameProcessor.process(yt,mt=>{ft.push(mt)});for(const mt of ft)switch(mt.msg){case st.Message.SpeechStart:ut=dt*this.options.frameSamples/16;break;case st.Message.SpeechEnd:ct=(dt+1)*this.options.frameSamples/16,yield{audio:mt.audio,start:ut,end:ct};break}dt++}const{msg:ht,audio:bt}=this.frameProcessor.endSegment(yt=>{ft.push(yt)});for(const yt of ft)switch(yt.msg){case st.Message.SpeechEnd:yield{audio:yt.audio,start:ut,end:dt*this.options.frameSamples/16}}}}i.NonRealTimeVAD=et})(nonRealTimeVad);var utils={};Object.defineProperty(utils,"__esModule",{value:!0});utils.audioFileToArray=utils.encodeWAV=utils.arrayBufferToBase64=utils.minFramesForTargetMS=void 0;function minFramesForTargetMS(i,o,s=16e3){return Math.ceil(i*s/1e3/o)}utils.minFramesForTargetMS=minFramesForTargetMS;function arrayBufferToBase64(i){const o=new Uint8Array(i),s=o.byteLength,a=new Array(s);for(var _=0;_{s.addEventListener("loadend",tt=>{const st=s.result;o.decodeAudioData(st,it=>{a=it,o.startRendering().then(nt=>{console.log("Rendering completed successfully"),_e()}).catch(nt=>{console.error(`Rendering failed: ${nt}`)})},it=>{console.log(`Error with decoding audio data: ${it}`)})}),s.readAsArrayBuffer(i)}),a===null)throw Error("some shit");let _=a,$=new Float32Array(_.length);for(let _e=0;_e<_.length;_e++)for(let tt=0;tt<_.numberOfChannels;tt++)$[_e]+=_.getChannelData(tt)[_e];return{audio:$,sampleRate:_.sampleRate}}utils.audioFileToArray=audioFileToArray;var realTimeVad={};(function(i){var o=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(ut,ct,dt,ft){ft===void 0&&(ft=dt);var ht=Object.getOwnPropertyDescriptor(ct,dt);(!ht||("get"in ht?!ct.__esModule:ht.writable||ht.configurable))&&(ht={enumerable:!0,get:function(){return ct[dt]}}),Object.defineProperty(ut,ft,ht)}:function(ut,ct,dt,ft){ft===void 0&&(ft=dt),ut[ft]=ct[dt]}),s=commonjsGlobal&&commonjsGlobal.__setModuleDefault||(Object.create?function(ut,ct){Object.defineProperty(ut,"default",{enumerable:!0,value:ct})}:function(ut,ct){ut.default=ct}),a=commonjsGlobal&&commonjsGlobal.__importStar||function(ut){if(ut&&ut.__esModule)return ut;var ct={};if(ut!=null)for(var dt in ut)dt!=="default"&&Object.prototype.hasOwnProperty.call(ut,dt)&&o(ct,ut,dt);return s(ct,ut),ct};Object.defineProperty(i,"__esModule",{value:!0}),i.AudioNodeVAD=i.MicVAD=i.getDefaultRealTimeVADOptions=i.ort=i.DEFAULT_MODEL=void 0;const _=a(ortWeb_minExports),$=defaultModelFetcher$1,_e=frameProcessor,tt=logging,st=messages,it=models,nt=resampler;i.DEFAULT_MODEL="legacy",i.ort=_;const et="vad.worklet.bundle.min.js",j="silero_vad_v5.onnx",rt="silero_vad_legacy.onnx",ot=ut=>({...ut==="v5"?_e.defaultV5FrameProcessorOptions:_e.defaultLegacyFrameProcessorOptions,onFrameProcessed:(dt,ft)=>{},onVADMisfire:()=>{tt.log.debug("VAD misfire")},onSpeechStart:()=>{tt.log.debug("Detected speech start")},onSpeechEnd:()=>{tt.log.debug("Detected speech end")},onSpeechRealStart:()=>{tt.log.debug("Detected real speech start")},baseAssetPath:"https://cdn.jsdelivr.net/npm/@ricky0123/vad-web@latest/dist/",onnxWASMBasePath:"https://cdn.jsdelivr.net/npm/onnxruntime-web@1.14.0/dist/",stream:void 0,ortConfig:void 0,model:ut,workletOptions:{}});i.getDefaultRealTimeVADOptions=ot;class at{static async new(ct={}){const dt={...(0,i.getDefaultRealTimeVADOptions)(ct.model??i.DEFAULT_MODEL),...ct};(0,_e.validateOptions)(dt);let ft;dt.stream===void 0?ft=await navigator.mediaDevices.getUserMedia({audio:{...dt.additionalAudioConstraints,channelCount:1,echoCancellation:!0,autoGainControl:!0,noiseSuppression:!0}}):ft=dt.stream;const ht=new AudioContext,bt=new MediaStreamAudioSourceNode(ht,{mediaStream:ft}),yt=await lt.new(ht,dt);return yt.receive(bt),new at(dt,ht,ft,yt,bt)}constructor(ct,dt,ft,ht,bt,yt=!1){this.options=ct,this.audioContext=dt,this.stream=ft,this.audioNodeVAD=ht,this.sourceNode=bt,this.listening=yt,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(mt=>mt.stop()),this.sourceNode.disconnect(),this.audioNodeVAD.destroy(),this.audioContext.close()},this.setOptions=mt=>{this.audioNodeVAD.setFrameProcessorOptions(mt)}}}i.MicVAD=at;class lt{static async new(ct,dt={}){const ft={...(0,i.getDefaultRealTimeVADOptions)(dt.model??i.DEFAULT_MODEL),...dt};(0,_e.validateOptions)(ft),i.ort.env.wasm.wasmPaths=ft.onnxWASMBasePath,ft.ortConfig!==void 0&&ft.ortConfig(i.ort);const ht=ft.model==="v5"?j:rt,bt=ft.baseAssetPath+ht,yt=ft.model==="v5"?it.SileroV5.new:it.SileroLegacy.new;let mt;try{mt=await yt(i.ort,()=>(0,$.defaultModelFetcher)(bt))}catch(wt){throw console.error(`Encountered an error while loading model file ${bt}`),wt}const gt=new _e.FrameProcessor(mt.process,mt.reset_state,{frameSamples:ft.frameSamples,positiveSpeechThreshold:ft.positiveSpeechThreshold,negativeSpeechThreshold:ft.negativeSpeechThreshold,redemptionFrames:ft.redemptionFrames,preSpeechPadFrames:ft.preSpeechPadFrames,minSpeechFrames:ft.minSpeechFrames,submitUserSpeechOnPause:ft.submitUserSpeechOnPause}),vt=new lt(ct,ft,gt);return await vt.setupAudioNode(),vt}constructor(ct,dt,ft){this.ctx=ct,this.options=dt,this.bufferIndex=0,this.pause=()=>{this.frameProcessor.pause(this.handleFrameProcessorEvent)},this.start=()=>{this.frameProcessor.resume()},this.receive=ht=>{ht.connect(this.audioNode)},this.processFrame=async ht=>{await this.frameProcessor.process(ht,this.handleFrameProcessorEvent)},this.handleFrameProcessorEvent=ht=>{switch(ht.msg){case st.Message.FrameProcessed:this.options.onFrameProcessed(ht.probs,ht.frame);break;case st.Message.SpeechStart:this.options.onSpeechStart();break;case st.Message.SpeechRealStart:this.options.onSpeechRealStart();break;case st.Message.VADMisfire:this.options.onVADMisfire();break;case st.Message.SpeechEnd:this.options.onSpeechEnd(ht.audio);break}},this.destroy=()=>{var ht;this.audioNode instanceof AudioWorkletNode&&this.audioNode.port.postMessage({message:st.Message.SpeechStop}),this.audioNode.disconnect(),(ht=this.gainNode)==null||ht.disconnect()},this.setFrameProcessorOptions=ht=>{this.frameProcessor.options={...this.frameProcessor.options,...ht}},this.frameProcessor=ft}async setupAudioNode(){if("audioWorklet"in this.ctx&&typeof AudioWorkletNode=="function")try{const ht=this.options.baseAssetPath+et;await this.ctx.audioWorklet.addModule(ht);const bt=this.options.workletOptions??{};bt.processorOptions={...bt.processorOptions??{},frameSamples:this.options.frameSamples},this.audioNode=new AudioWorkletNode(this.ctx,"vad-helper-worklet",bt),this.audioNode.port.onmessage=async yt=>{var mt;switch((mt=yt.data)==null?void 0:mt.message){case st.Message.AudioFrame:let gt=yt.data.data;gt instanceof ArrayBuffer||(gt=new ArrayBuffer(yt.data.data.byteLength),new Uint8Array(gt).set(new Uint8Array(yt.data.data)));const vt=new Float32Array(gt);await this.processFrame(vt);break}};return}catch(ht){console.log("AudioWorklet setup failed, falling back to ScriptProcessor",ht)}this.resampler=new nt.Resampler({nativeSampleRate:this.ctx.sampleRate,targetSampleRate:16e3,targetFrameSize:this.options.frameSamples??480});const dt=4096;this.audioNode=this.ctx.createScriptProcessor(dt,1,1),this.gainNode=this.ctx.createGain(),this.gainNode.gain.value=0;let ft=!1;this.audioNode.onaudioprocess=async ht=>{if(!ft){ft=!0;try{const bt=ht.inputBuffer.getChannelData(0);if(ht.outputBuffer.getChannelData(0).fill(0),this.resampler){const mt=this.resampler.process(bt);for(const gt of mt)await this.processFrame(gt)}}catch(bt){console.error("Error processing audio:",bt)}finally{ft=!1}}},this.audioNode.connect(this.gainNode),this.gainNode.connect(this.ctx.destination)}}i.AudioNodeVAD=lt})(realTimeVad);(function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.getDefaultRealTimeVADOptions=i.MicVAD=i.DEFAULT_MODEL=i.AudioNodeVAD=i.utils=i.NonRealTimeVAD=i.Message=i.FrameProcessor=i.defaultModelFetcher=i.baseAssetPath=void 0;var o=assetPath;Object.defineProperty(i,"baseAssetPath",{enumerable:!0,get:function(){return o.baseAssetPath}});var s=defaultModelFetcher$1;Object.defineProperty(i,"defaultModelFetcher",{enumerable:!0,get:function(){return s.defaultModelFetcher}});var a=frameProcessor;Object.defineProperty(i,"FrameProcessor",{enumerable:!0,get:function(){return a.FrameProcessor}});var _=messages;Object.defineProperty(i,"Message",{enumerable:!0,get:function(){return _.Message}});var $=nonRealTimeVad;Object.defineProperty(i,"NonRealTimeVAD",{enumerable:!0,get:function(){return $.NonRealTimeVAD}});const _e=utils;i.utils={audioFileToArray:_e.audioFileToArray,minFramesForTargetMS:_e.minFramesForTargetMS,arrayBufferToBase64:_e.arrayBufferToBase64,encodeWAV:_e.encodeWAV};var tt=realTimeVad;Object.defineProperty(i,"AudioNodeVAD",{enumerable:!0,get:function(){return tt.AudioNodeVAD}}),Object.defineProperty(i,"DEFAULT_MODEL",{enumerable:!0,get:function(){return tt.DEFAULT_MODEL}}),Object.defineProperty(i,"MicVAD",{enumerable:!0,get:function(){return tt.MicVAD}}),Object.defineProperty(i,"getDefaultRealTimeVADOptions",{enumerable:!0,get:function(){return tt.getDefaultRealTimeVADOptions}})})(dist);class TaskQueue{constructor(o=3e3){xt(this,"queue",[]);xt(this,"running",!1);xt(this,"taskInterval");xt(this,"pendingComplete",!1);xt(this,"activeTasks",new Set);this.taskInterval=o}addTask(o){this.queue.push(o),this.runNextTask()}clearQueue(){this.queue=[],this.activeTasks.clear(),this.running=!1}async runNextTask(){if(this.running||this.queue.length===0){this.queue.length===0&&this.activeTasks.size===0&&this.pendingComplete&&(this.pendingComplete=!1,await new Promise(s=>setTimeout(s,this.taskInterval)));return}this.running=!0;const o=this.queue.shift();if(o){const s=o();this.activeTasks.add(s);try{await s,await new Promise(a=>setTimeout(a,this.taskInterval))}catch(a){console.error("Task Queue Error",a)}finally{this.activeTasks.delete(s),this.running=!1,this.runNextTask()}}}hasTask(){return this.queue.length>0||this.activeTasks.size>0||this.running}waitForCompletion(){return this.pendingComplete=!0,new Promise(o=>{const s=()=>{this.hasTask()?setTimeout(s,100):o()};s()})}}const audioTaskQueue=new TaskQueue(20),ScreenCaptureContext=reactExports.createContext(void 0);function ScreenCaptureProvider({children:i}){const{t:o}=useTranslation(),[s,a]=reactExports.useState(null),[_,$]=reactExports.useState(!1),[_e,tt]=reactExports.useState(""),st=async()=>{try{let nt;if(window.electron){const j={video:{mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:await window.electron.ipcRenderer.invoke("get-screen-capture"),minWidth:1280,maxWidth:1280,minHeight:720,maxHeight:720}},audio:!1};nt=await navigator.mediaDevices.getUserMedia(j)}else{const et={video:!0,audio:!1};nt=await navigator.mediaDevices.getDisplayMedia(et)}a(nt),$(!0),tt("")}catch(nt){tt(o("error.failedStartScreenCapture")),toaster.create({title:`${o("error.failedStartScreenCapture")}: ${nt}`,type:"error",duration:2e3}),console.error(nt)}},it=()=>{s&&(s.getTracks().forEach(nt=>nt.stop()),a(null),$(!1))};return jsxRuntimeExports.jsx(ScreenCaptureContext.Provider,{value:{stream:s,isStreaming:_,error:_e,startCapture:st,stopCapture:it},children:i})}const useScreenCaptureContext=()=>{const i=reactExports.useContext(ScreenCaptureContext);if(i===void 0)throw new Error("useScreenCaptureContext must be used within a ScreenCaptureProvider");return i};function useMediaCapture(){const{t:i}=useTranslation(),{stream:o}=useCamera(),{stream:s}=useScreenCaptureContext(),a=reactExports.useCallback(()=>{const tt=localStorage.getItem(IMAGE_COMPRESSION_QUALITY_KEY);if(tt){const st=parseFloat(tt);if(!Number.isNaN(st)&&st>=.1&&st<=1)return st}return DEFAULT_IMAGE_COMPRESSION_QUALITY},[]),_=reactExports.useCallback(()=>{const tt=localStorage.getItem(IMAGE_MAX_WIDTH_KEY);if(tt){const st=parseInt(tt,10);if(!Number.isNaN(st)&&st>0)return st}return DEFAULT_IMAGE_MAX_WIDTH},[]),$=reactExports.useCallback(async(tt,st)=>{if(!tt)return console.warn(`No ${st} stream available`),null;const it=tt.getVideoTracks()[0];if(!it)return console.warn(`No video track in ${st} stream`),null;const nt=new ImageCapture(it);try{const et=await nt.grabFrame(),j=document.createElement("canvas");let{width:rt,height:ot}=et;const at=_();rt>at&&(ot=at/rt*ot,rt=at),j.width=rt,j.height=ot;const lt=j.getContext("2d");if(!lt)return console.error("Failed to get canvas context"),null;lt.drawImage(et,0,0);const ut=a();return j.toDataURL("image/jpeg",ut)}catch(et){return console.error(`Error capturing ${st} frame:`,et),toaster.create({title:`${i("error.failedCapture",{source:st})}: ${et}`,type:"error",duration:2e3}),null}},[i,a,_]);return{captureAllMedia:reactExports.useCallback(async()=>{const tt=[];if(o){const st=await $(o,"camera");st&&tt.push({source:"camera",data:st,mime_type:"image/jpeg"})}if(s){const st=await $(s,"screen");st&&tt.push({source:"screen",data:st,mime_type:"image/jpeg"})}return console.log("images: ",tt),tt},[o,s,$])}}function useSendAudio(){const{sendMessage:i}=useWebSocket(),{captureAllMedia:o}=useMediaCapture();return{sendAudioPartition:reactExports.useCallback(async a=>{for(let _e=0;_e(i.IDLE="idle",i.THINKING_SPEAKING="thinking-speaking",i.INTERRUPTED="interrupted",i.LOADING="loading",i.LISTENING="listening",i.WAITING="waiting",i))(AiStateEnum||{});const initialState="loading",AiStateContext=reactExports.createContext(null);function AiStateProvider({children:i}){const[o,s]=reactExports.useState(initialState),[a,_]=reactExports.useState(!1),$=reactExports.useRef(null),_e=reactExports.useCallback(nt=>{const et=typeof nt=="function"?nt(o):nt;et==="waiting"?o!=="thinking-speaking"&&(s(et),$.current&&clearTimeout($.current),$.current=setTimeout(()=>{s("idle"),$.current=null},2e3)):(s(et),$.current&&(clearTimeout($.current),$.current=null))},[o]),tt=reactExports.useMemo(()=>({isIdle:o==="idle",isThinkingSpeaking:o==="thinking-speaking",isInterrupted:o==="interrupted",isLoading:o==="loading",isListening:o==="listening",isWaiting:o==="waiting"}),[o]),st=reactExports.useCallback(()=>{_e("idle")},[_e]);reactExports.useEffect(()=>()=>{$.current&&clearTimeout($.current)},[]);const it=reactExports.useMemo(()=>({aiState:o,setAiState:_e,backendSynthComplete:a,setBackendSynthComplete:_,...tt,resetState:st}),[o,_e,a,tt,st]);return jsxRuntimeExports.jsx(AiStateContext.Provider,{value:it,children:i})}function useAiState(){const i=reactExports.useContext(AiStateContext);if(!i)throw new Error("useAiState must be used within a AiStateProvider");return i}const DEFAULT_VAD_SETTINGS={positiveSpeechThreshold:50,negativeSpeechThreshold:35,redemptionFrames:35},DEFAULT_VAD_STATE={micOn:!1,autoStopMic:!1,autoStartMicOn:!1,autoStartMicOnConvEnd:!1},VADContext=reactExports.createContext(null);function VADProvider({children:i}){const{t:o}=useTranslation(),s=reactExports.useRef(null),a=reactExports.useRef(0),_=reactExports.useRef("idle"),[$,_e]=useLocalStorage("micOn",DEFAULT_VAD_STATE.micOn),tt=reactExports.useRef(!0),[st,it]=useLocalStorage("autoStopMic",DEFAULT_VAD_STATE.autoStopMic),[nt,et]=useLocalStorage("vadSettings",DEFAULT_VAD_SETTINGS),[j,rt]=useLocalStorage("autoStartMicOn",DEFAULT_VAD_STATE.autoStartMicOn),ot=reactExports.useRef(!1),[at,lt]=useLocalStorage("autoStartMicOnConvEnd",DEFAULT_VAD_STATE.autoStartMicOnConvEnd),ut=reactExports.useRef(!1),[,ct]=reactExports.useReducer(Vt=>Vt+1,0),{interrupt:dt}=useInterrupt(),{sendAudioPartition:ft}=useSendAudio(),{setSubtitleText:ht}=reactExports.useContext(SubtitleContext),{aiState:bt,setAiState:yt}=reactExports.useContext(AiStateContext),mt=reactExports.useRef(dt),gt=reactExports.useRef(ft),vt=reactExports.useRef(bt),wt=reactExports.useRef(ht),Ct=reactExports.useRef(yt),kt=reactExports.useRef(!1);reactExports.useEffect(()=>{vt.current=bt},[bt]),reactExports.useEffect(()=>{mt.current=dt},[dt]),reactExports.useEffect(()=>{gt.current=ft},[ft]),reactExports.useEffect(()=>{wt.current=ht},[ht]),reactExports.useEffect(()=>{Ct.current=yt},[yt]),reactExports.useEffect(()=>{tt.current=st},[]),reactExports.useEffect(()=>{ot.current=j},[]),reactExports.useEffect(()=>{ut.current=at},[]);const It=reactExports.useCallback(Vt=>{a.current=Vt,ct()},[]),Pt=reactExports.useCallback(()=>{console.log("Speech started - saving current state"),_.current=vt.current,kt.current=!0},[]),St=reactExports.useCallback(()=>{console.log("Real speech confirmed - checking if need to interrupt"),_.current==="thinking-speaking"&&(console.log("Interrupting AI speech due to user speaking"),mt.current()),Ct.current("listening")},[]),Rt=reactExports.useCallback(Vt=>{Vt.isSpeech>a.current&&It(Vt.isSpeech)},[]),At=reactExports.useCallback(Vt=>{kt.current&&(console.log("Speech ended"),audioTaskQueue.clearQueue(),tt.current?sr():console.log("Auto stop mic is OFF, keeping mic active"),It(0),gt.current(Vt),kt.current=!1,Ct.current("thinking-speaking"))},[]),Mt=reactExports.useCallback(()=>{kt.current&&(console.log("VAD misfire detected"),It(0),kt.current=!1,Ct.current(_.current),wt.current(o("error.vadMisfire")))},[o]),jt=reactExports.useCallback(Vt=>{et(Vt),s.current&&(sr(),setTimeout(()=>{Kt()},100))},[]),Yt=async()=>{const Vt=await dist.MicVAD.new({model:"v5",preSpeechPadFrames:20,positiveSpeechThreshold:nt.positiveSpeechThreshold/100,negativeSpeechThreshold:nt.negativeSpeechThreshold/100,redemptionFrames:nt.redemptionFrames,baseAssetPath:"./libs/",onnxWASMBasePath:"./libs/",onSpeechStart:Pt,onSpeechRealStart:St,onFrameProcessed:Rt,onSpeechEnd:At,onVADMisfire:Mt});s.current=Vt,Vt.start()},Kt=reactExports.useCallback(async()=>{try{s.current?(console.log("Starting VAD"),s.current.start()):(console.log("Initializing VAD"),await Yt()),_e(!0)}catch(Vt){console.error("Failed to start VAD:",Vt),toaster.create({title:`${o("error.failedStartVAD")}: ${Vt}`,type:"error",duration:2e3})}},[o]),sr=reactExports.useCallback(()=>{console.log("Stopping VAD"),s.current?(s.current.pause(),s.current.destroy(),s.current=null,console.log("VAD stopped and destroyed successfully"),It(0)):console.log("VAD instance not found"),_e(!1),kt.current=!1},[]),ar=reactExports.useCallback(Vt=>{tt.current=Vt,it(Vt),ct()},[]),Gt=reactExports.useCallback(Vt=>{ot.current=Vt,rt(Vt),ct()},[]),Qt=reactExports.useCallback(Vt=>{ut.current=Vt,lt(Vt),ct()},[]),tr=reactExports.useMemo(()=>({autoStopMic:tt.current,micOn:$,setMicOn:_e,setAutoStopMic:ar,startMic:Kt,stopMic:sr,previousTriggeredProbability:a.current,setPreviousTriggeredProbability:It,settings:nt,updateSettings:jt,autoStartMicOn:ot.current,setAutoStartMicOn:Gt,autoStartMicOnConvEnd:ut.current,setAutoStartMicOnConvEnd:Qt}),[$,Kt,sr,nt,jt]);return jsxRuntimeExports.jsx(VADContext.Provider,{value:tr,children:i})}function useVAD(){const i=reactExports.useContext(VADContext);if(!i)throw new Error("useVAD must be used within a VADProvider");return i}function useMicToggle(){const{startMic:i,stopMic:o,micOn:s}=useVAD(),{aiState:a,setAiState:_}=useAiState();return{handleMicToggle:async()=>{s?(o(),a==="listening"&&_("idle")):await i()},micOn:s}}const createStoreImpl=i=>{let o;const s=new Set,a=(it,nt)=>{const et=typeof it=="function"?it(o):it;if(!Object.is(et,o)){const j=o;o=nt??(typeof et!="object"||et===null)?et:Object.assign({},o,et),s.forEach(rt=>rt(o,j))}},_=()=>o,tt={setState:a,getState:_,getInitialState:()=>st,subscribe:it=>(s.add(it),()=>s.delete(it))},st=o=i(a,_,tt);return tt},createStore=i=>i?createStoreImpl(i):createStoreImpl,identity=i=>i;function useStore(i,o=identity){const s=React.useSyncExternalStore(i.subscribe,()=>o(i.getState()),()=>o(i.getInitialState()));return React.useDebugValue(s),s}const createImpl=i=>{const o=createStore(i),s=a=>useStore(o,a);return Object.assign(s,o),s},create=i=>i?createImpl(i):createImpl,useForceIgnoreMouseStore=create(i=>({forceIgnoreMouse:!1,setForceIgnoreMouse:o=>i({forceIgnoreMouse:o})}));function useForceIgnoreMouse(){const{forceIgnoreMouse:i,setForceIgnoreMouse:o}=useForceIgnoreMouseStore();return{forceIgnoreMouse:i,setForceIgnoreMouse:o}}const ModeContext=reactExports.createContext(void 0),ModeProvider=({children:i})=>{const[o,s]=reactExports.useState("window"),a=window.api!==void 0,_=$=>{if($==="pet"&&!a){toaster.create({title:"Pet mode unavailable",description:"Pet mode is only available in the desktop application",type:"info",duration:2e3});return}a&&window.api?window.api.setMode($):s($)};return reactExports.useEffect(()=>{if(a&&window.electron){const $=(tt,st)=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{var it;(it=window.electron)==null||it.ipcRenderer.send("renderer-ready-for-mode-change",st)})})},_e=(tt,st)=>{s(st),requestAnimationFrame(()=>{requestAnimationFrame(()=>{var it;(it=window.electron)==null||it.ipcRenderer.send("mode-change-rendered")})})};return window.electron.ipcRenderer.on("pre-mode-changed",$),window.electron.ipcRenderer.on("mode-changed",_e),()=>{window.electron&&(window.electron.ipcRenderer.removeListener("pre-mode-changed",$),window.electron.ipcRenderer.removeListener("mode-changed",_e))}}},[a]),jsxRuntimeExports.jsx(ModeContext.Provider,{value:{mode:o,setMode:_,isElectron:a},children:i})},useMode=()=>{const i=reactExports.useContext(ModeContext);if(i===void 0)throw new Error("useMode must be used within a ModeProvider");return i};function useIpcHandlers(){const{handleMicToggle:i}=useMicToggle(),{interrupt:o}=useInterrupt(),{modelInfo:s,setModelInfo:a}=useLive2DConfig(),{switchCharacter:_}=useSwitchCharacter(),{setForceIgnoreMouse:$}=useForceIgnoreMouse(),{mode:_e}=useMode(),tt=_e==="pet",st=reactExports.useCallback(()=>{i()},[i]),it=reactExports.useCallback(()=>{o()},[o]),nt=reactExports.useCallback(()=>{s&&a({...s,scrollToResize:!s.scrollToResize})},[s,a]),et=reactExports.useCallback((ot,at)=>{_(at)},[_]),j=reactExports.useCallback((ot,at)=>{console.log("Force ignore mouse changed:",at),$(at)},[$]),rt=reactExports.useCallback(()=>{window.api.toggleForceIgnoreMouse()},[]);reactExports.useEffect(()=>{var ot;if((ot=window.electron)!=null&&ot.ipcRenderer&&tt)return window.electron.ipcRenderer.removeAllListeners("mic-toggle"),window.electron.ipcRenderer.removeAllListeners("interrupt"),window.electron.ipcRenderer.removeAllListeners("toggle-scroll-to-resize"),window.electron.ipcRenderer.removeAllListeners("switch-character"),window.electron.ipcRenderer.removeAllListeners("toggle-force-ignore-mouse"),window.electron.ipcRenderer.removeAllListeners("force-ignore-mouse-changed"),window.electron.ipcRenderer.on("mic-toggle",st),window.electron.ipcRenderer.on("interrupt",it),window.electron.ipcRenderer.on("toggle-scroll-to-resize",nt),window.electron.ipcRenderer.on("switch-character",et),window.electron.ipcRenderer.on("toggle-force-ignore-mouse",rt),window.electron.ipcRenderer.on("force-ignore-mouse-changed",j),()=>{var at,lt,ut,ct,dt,ft;(at=window.electron)==null||at.ipcRenderer.removeAllListeners("mic-toggle"),(lt=window.electron)==null||lt.ipcRenderer.removeAllListeners("interrupt"),(ut=window.electron)==null||ut.ipcRenderer.removeAllListeners("toggle-scroll-to-resize"),(ct=window.electron)==null||ct.ipcRenderer.removeAllListeners("switch-character"),(dt=window.electron)==null||dt.ipcRenderer.removeAllListeners("toggle-force-ignore-mouse"),(ft=window.electron)==null||ft.ipcRenderer.removeAllListeners("force-ignore-mouse-changed")}},[st,it,nt,et,rt,j,tt])}const DEFAULT_HISTORY={messages:[],historyList:[],currentHistoryUid:null,fullResponse:""},ChatHistoryContext=reactExports.createContext(null);function ChatHistoryProvider({children:i}){const[o,s]=reactExports.useState(DEFAULT_HISTORY.messages),[a,_]=reactExports.useState(DEFAULT_HISTORY.historyList),[$,_e]=reactExports.useState(DEFAULT_HISTORY.currentHistoryUid),[tt,st]=reactExports.useState(DEFAULT_HISTORY.fullResponse),[it,nt]=reactExports.useState(!1),et=reactExports.useCallback(ct=>{const dt={id:Date.now().toString(),content:ct,role:"human",type:"text",timestamp:new Date().toISOString()};s(ft=>[...ft,dt])},[]),j=reactExports.useCallback((ct,dt,ft)=>{s(ht=>{const bt=ht[ht.length-1];return it||!bt||bt.role!=="ai"||bt.type!=="text"?(nt(!1),[...ht,{id:Date.now().toString(),content:ct,role:"ai",type:"text",timestamp:new Date().toISOString(),name:dt,avatar:ft}]):[...ht.slice(0,-1),{...bt,content:bt.content+ct,timestamp:new Date().toISOString()}]})},[it,nt]),rt=reactExports.useCallback(ct=>{if(!ct.tool_id||!ct.tool_name||!ct.status||!ct.timestamp){console.error("Incomplete tool message data received:",ct);return}s(dt=>{const ft=dt.findIndex(ht=>ht.type==="tool_call_status"&&ht.tool_id===ct.tool_id);if(ft!==-1){const ht=[...dt],bt=ht[ft];return ht[ft]={...bt,status:ct.status,name:ct.name||bt.name,content:ct.content||bt.content,timestamp:ct.timestamp},ht}else{const ht={id:ct.tool_id,role:"ai",type:"tool_call_status",name:ct.name||"",tool_id:ct.tool_id,tool_name:ct.tool_name,status:ct.status,content:ct.content||"",timestamp:ct.timestamp};return[...dt,ht]}})},[]),ot=reactExports.useCallback((ct,dt)=>{ct||console.error("updateHistoryList: uid is null"),$||console.error("updateHistoryList: currentHistoryUid is null"),_(ft=>ft.map(ht=>ht.uid===ct?{...ht,latest_message:dt?{content:dt.content,role:dt.role,timestamp:dt.timestamp}:null,timestamp:(dt==null?void 0:dt.timestamp)||ht.timestamp}:ht))},[$]),at=reactExports.useCallback(ct=>{st(dt=>dt+(ct||""))},[]),lt=reactExports.useCallback(()=>{st(DEFAULT_HISTORY.fullResponse)},[]),ut=reactExports.useMemo(()=>({messages:o,historyList:a,currentHistoryUid:$,appendHumanMessage:et,appendAIMessage:j,appendOrUpdateToolCallMessage:rt,setMessages:s,setHistoryList:_,setCurrentHistoryUid:_e,updateHistoryList:ot,fullResponse:tt,setFullResponse:st,appendResponse:at,clearResponse:lt,setForceNewMessage:nt}),[o,a,$,et,j,rt,ot,tt,at,lt,nt]);return jsxRuntimeExports.jsx(ChatHistoryContext.Provider,{value:ut,children:i})}function useChatHistory(){const i=reactExports.useContext(ChatHistoryContext);if(!i)throw new Error("useChatHistory must be used within a ChatHistoryProvider");return i}class AudioManager{constructor(){xt(this,"currentAudio",null);xt(this,"currentModel",null)}setCurrentAudio(o,s){this.currentAudio=o,this.currentModel=s}stopCurrentAudioAndLipSync(){if(this.currentAudio){console.log("[AudioManager] Stopping current audio and lip sync");const o=this.currentAudio;o.pause(),o.src="",o.load();const s=this.currentModel;if(s&&s._wavFileHandler)try{s._wavFileHandler.releasePcmData(),console.log("[AudioManager] Called _wavFileHandler.releasePcmData()"),s._wavFileHandler._lastRms=0,s._wavFileHandler._sampleOffset=0,s._wavFileHandler._userTimeSeconds=0,console.log("[AudioManager] Also reset _lastRms, _sampleOffset, _userTimeSeconds as fallback")}catch(a){console.error("[AudioManager] Error stopping/resetting wavFileHandler:",a)}else s?console.warn("[AudioManager] Current model does not have _wavFileHandler to stop/reset."):console.log("[AudioManager] No associated model found to stop lip sync.");this.currentAudio=null,this.currentModel=null}else console.log("[AudioManager] No current audio playing to stop.")}clearCurrentAudio(o){this.currentAudio===o&&(this.currentAudio=null,this.currentModel=null)}hasCurrentAudio(){return this.currentAudio!==null}}const audioManager=new AudioManager,useLive2DExpression=()=>{const i=reactExports.useCallback((s,a,_)=>{try{if(typeof s=="string")a.setExpression(s);else if(typeof s=="number"){const $=a.getExpressionName(s);$&&a.setExpression($)}_&&console.log(_)}catch($){console.error("Failed to set expression:",$)}},[]),o=reactExports.useCallback((s,a)=>{if(s)try{const _=s.getModel();if(!_||!_._modelSetting){console.log("Model or model settings not loaded yet, skipping expression reset");return}if((a==null?void 0:a.defaultEmotion)!==void 0)i(a.defaultEmotion,s,`Reset expression to default: ${a.defaultEmotion}`);else if(s.getExpressionCount()>0){const _e=s.getExpressionName(0);_e&&i(_e,s)}}catch(_){console.log("Failed to reset expression:",_)}},[i]);return{setExpression:i,resetExpression:o}},Pn=class Pn{constructor(o=0){xt(this,"_ptr");xt(this,"_size");xt(this,"_capacity");o<1?(this._ptr=[],this._capacity=0,this._size=0):(this._ptr=new Array(o),this._capacity=o,this._size=0)}at(o){return this._ptr[o]}set(o,s){this._ptr[o]=s}get(o=0){const s=new Array;for(let a=o;a=this._capacity&&this.prepareCapacity(this._capacity==0?Pn.DefaultSize:this._capacity*2),this._ptr[this._size++]=o}clear(){this._ptr.length=0,this._size=0}getSize(){return this._size}assign(o,s){this._size0)for(let it=0;itthis._capacity&&(this._capacity==0?(this._ptr=new Array(o),this._capacity=o):(this._ptr.length=o,this._capacity=o))}begin(){return this._size==0?this.end():new iterator$1(this,0)}end(){return new iterator$1(this,this._size)}getOffset(o){const s=new Pn;return s._ptr=this.get(o),s._size=this.get(o).length,s._capacity=this.get(o).length,s}};xt(Pn,"DefaultSize",10);let csmVector=Pn,iterator$1=class zn{constructor(o,s){xt(this,"_index");xt(this,"_vector");this._vector=o??null,this._index=s??0}set(o){return this._index=o._index,this._vector=o._vector,this}preIncrement(){return++this._index,this}preDecrement(){return--this._index,this}increment(){return new zn(this._vector,this._index++)}decrement(){return new zn(this._vector,this._index--)}ptr(){return this._vector._ptr[this._index]}substitution(o){return this._index=o._index,this._vector=o._vector,this}notEqual(o){return this._index!=o._index||this._vector!=o._vector}};var Live2DCubismFramework$E;(i=>{i.csmVector=csmVector,i.iterator=iterator$1})(Live2DCubismFramework$E||(Live2DCubismFramework$E={}));class csmString{constructor(o){xt(this,"s");this.s=o}append(o,s){return this.s+=s!==void 0?o.substr(0,s):o,this}expansion(o,s){for(let a=0;ao.s}isEqual(o){return this.s==o}isEmpty(){return this.s.length==0}}var Live2DCubismFramework$D;(i=>{i.csmString=csmString})(Live2DCubismFramework$D||(Live2DCubismFramework$D={}));class CubismId{constructor(o){xt(this,"_id");if(typeof o=="string"){this._id=new csmString(o);return}this._id=o}static createIdInternal(o){return new CubismId(o)}getString(){return this._id}isEqual(o){return typeof o=="string"?this._id.isEqual(o):o instanceof csmString?this._id.isEqual(o.s):o instanceof CubismId?this._id.isEqual(o._id.s):!1}isNotEqual(o){return typeof o=="string"?!this._id.isEqual(o):o instanceof csmString?!this._id.isEqual(o.s):o instanceof CubismId?!this._id.isEqual(o._id.s):!1}}var Live2DCubismFramework$C;(i=>{i.CubismId=CubismId})(Live2DCubismFramework$C||(Live2DCubismFramework$C={}));class CubismIdManager{constructor(){xt(this,"_ids");this._ids=new csmVector}release(){for(let o=0;o{i.CubismIdManager=CubismIdManager})(Live2DCubismFramework$B||(Live2DCubismFramework$B={}));class CubismMatrix44{constructor(){xt(this,"_tr");this._tr=new Float32Array(16),this.loadIdentity()}static multiply(o,s,a){const _=new Float32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),$=4;for(let _e=0;_e<$;++_e)for(let tt=0;tt<$;++tt)for(let st=0;st<$;++st)_[tt+_e*4]+=o[st+_e*4]*s[tt+st*4];for(let _e=0;_e<16;++_e)a[_e]=_[_e]}loadIdentity(){const o=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);this.setMatrix(o)}setMatrix(o){for(let s=0;s<16;++s)this._tr[s]=o[s]}getArray(){return this._tr}getScaleX(){return this._tr[0]}getScaleY(){return this._tr[5]}getTranslateX(){return this._tr[12]}getTranslateY(){return this._tr[13]}transformX(o){return this._tr[0]*o+this._tr[12]}transformY(o){return this._tr[5]*o+this._tr[13]}invertTransformX(o){return(o-this._tr[12])/this._tr[0]}invertTransformY(o){return(o-this._tr[13])/this._tr[5]}translateRelative(o,s){const a=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,o,s,0,1]);CubismMatrix44.multiply(a,this._tr,this._tr)}translate(o,s){this._tr[12]=o,this._tr[13]=s}translateX(o){this._tr[12]=o}translateY(o){this._tr[13]=o}scaleRelative(o,s){const a=new Float32Array([o,0,0,0,0,s,0,0,0,0,1,0,0,0,0,1]);CubismMatrix44.multiply(a,this._tr,this._tr)}scale(o,s){this._tr[0]=o,this._tr[5]=s}multiplyByMatrix(o){CubismMatrix44.multiply(o.getArray(),this._tr,this._tr)}clone(){const o=new CubismMatrix44;for(let s=0;s{i.CubismMatrix44=CubismMatrix44})(Live2DCubismFramework$A||(Live2DCubismFramework$A={}));class csmRect{constructor(o,s,a,_){xt(this,"x");xt(this,"y");xt(this,"width");xt(this,"height");this.x=o,this.y=s,this.width=a,this.height=_}getCenterX(){return this.x+.5*this.width}getCenterY(){return this.y+.5*this.height}getRight(){return this.x+this.width}getBottom(){return this.y+this.height}setRect(o){this.x=o.x,this.y=o.y,this.width=o.width,this.height=o.height}expand(o,s){this.x-=o,this.y-=s,this.width+=o*2,this.height+=s*2}}var Live2DCubismFramework$z;(i=>{i.csmRect=csmRect})(Live2DCubismFramework$z||(Live2DCubismFramework$z={}));class CubismRenderer{constructor(){xt(this,"_mvpMatrix4x4");xt(this,"_modelColor");xt(this,"_isCulling");xt(this,"_isPremultipliedAlpha");xt(this,"_anisotropy");xt(this,"_model");xt(this,"_useHighPrecisionMask");this._isCulling=!1,this._isPremultipliedAlpha=!1,this._anisotropy=0,this._model=null,this._modelColor=new CubismTextureColor,this._useHighPrecisionMask=!1,this._mvpMatrix4x4=new CubismMatrix44,this._mvpMatrix4x4.loadIdentity()}static create(){return null}static delete(o){}initialize(o){this._model=o}drawModel(){this.getModel()!=null&&(this.saveProfile(),this.doDrawModel(),this.restoreProfile())}setMvpMatrix(o){this._mvpMatrix4x4.setMatrix(o.getArray())}getMvpMatrix(){return this._mvpMatrix4x4}setModelColor(o,s,a,_){o<0?o=0:o>1&&(o=1),s<0?s=0:s>1&&(s=1),a<0?a=0:a>1&&(a=1),_<0?_=0:_>1&&(_=1),this._modelColor.r=o,this._modelColor.g=s,this._modelColor.b=a,this._modelColor.a=_}getModelColor(){return JSON.parse(JSON.stringify(this._modelColor))}getModelColorWithOpacity(o){const s=this.getModelColor();return s.a*=o,this.isPremultipliedAlpha()&&(s.r*=s.a,s.g*=s.a,s.b*=s.a),s}setIsPremultipliedAlpha(o){this._isPremultipliedAlpha=o}isPremultipliedAlpha(){return this._isPremultipliedAlpha}setIsCulling(o){this._isCulling=o}isCulling(){return this._isCulling}setAnisotropy(o){this._anisotropy=o}getAnisotropy(){return this._anisotropy}getModel(){return this._model}useHighPrecisionMask(o){this._useHighPrecisionMask=o}isUsingHighPrecisionMask(){return this._useHighPrecisionMask}}xt(CubismRenderer,"staticRelease");var CubismBlendMode=(i=>(i[i.CubismBlendMode_Normal=0]="CubismBlendMode_Normal",i[i.CubismBlendMode_Additive=1]="CubismBlendMode_Additive",i[i.CubismBlendMode_Multiplicative=2]="CubismBlendMode_Multiplicative",i))(CubismBlendMode||{});class CubismTextureColor{constructor(o=1,s=1,a=1,_=1){xt(this,"r");xt(this,"g");xt(this,"b");xt(this,"a");this.r=o,this.g=s,this.b=a,this.a=_}}class CubismClippingContext{constructor(o,s){xt(this,"_isUsing");xt(this,"_clippingIdList");xt(this,"_clippingIdCount");xt(this,"_layoutChannelIndex");xt(this,"_layoutBounds");xt(this,"_allClippedDrawRect");xt(this,"_matrixForMask");xt(this,"_matrixForDraw");xt(this,"_clippedDrawableIndexList");xt(this,"_bufferIndex");this._clippingIdList=o,this._clippingIdCount=s,this._allClippedDrawRect=new csmRect,this._layoutBounds=new csmRect,this._clippedDrawableIndexList=[],this._matrixForMask=new CubismMatrix44,this._matrixForDraw=new CubismMatrix44,this._bufferIndex=0}release(){this._layoutBounds!=null&&(this._layoutBounds=null),this._allClippedDrawRect!=null&&(this._allClippedDrawRect=null),this._clippedDrawableIndexList!=null&&(this._clippedDrawableIndexList=null)}addClippedDrawable(o){this._clippedDrawableIndexList.push(o)}}var Live2DCubismFramework$y;(i=>{i.CubismBlendMode=CubismBlendMode,i.CubismRenderer=CubismRenderer,i.CubismTextureColor=CubismTextureColor})(Live2DCubismFramework$y||(Live2DCubismFramework$y={}));const CubismLogPrint=(i,o,s)=>{CubismDebug.print(i,"[CSM]"+o,s)},CubismLogPrintIn=(i,o,s)=>{CubismLogPrint(i,o+` +`,s)},CSM_ASSERT=i=>{console.assert(i)};let CubismLogDebug,CubismLogInfo,CubismLogWarning,CubismLogError;CubismLogDebug=(i,...o)=>{CubismLogPrintIn(LogLevel.LogLevel_Debug,"[D]"+i,o)},CubismLogInfo=(i,...o)=>{CubismLogPrintIn(LogLevel.LogLevel_Info,"[I]"+i,o)},CubismLogWarning=(i,...o)=>{CubismLogPrintIn(LogLevel.LogLevel_Warning,"[W]"+i,o)},CubismLogError=(i,...o)=>{CubismLogPrintIn(LogLevel.LogLevel_Error,"[E]"+i,o)};class CubismDebug{static print(o,s,a){if(oa[tt]);_($)}static dumpBytes(o,s,a){for(let _=0;_0?this.print(o,` +`):_%8==0&&_>0&&this.print(o," "),this.print(o,"{0} ",[s[_]&255]);this.print(o,` +`)}constructor(){}}var Live2DCubismFramework$x;(i=>{i.CubismDebug=CubismDebug})(Live2DCubismFramework$x||(Live2DCubismFramework$x={}));class csmPair{constructor(o,s){xt(this,"first");xt(this,"second");this.first=o??null,this.second=s??null}}const In=class In{constructor(o){xt(this,"_keyValues");xt(this,"_dummyValue");xt(this,"_size");o!=null?o<1?(this._keyValues=[],this._dummyValue=null,this._size=0):(this._keyValues=new Array(o),this._size=o):(this._keyValues=[],this._dummyValue=null,this._size=0)}release(){this.clear()}appendKey(o){this.prepareCapacity(this._size+1,!1),this._keyValues[this._size]=new csmPair(o),this._size+=1}getValue(o){let s=-1;for(let a=0;a=0?this._keyValues[s].second:(this.appendKey(o),this._keyValues[this._size-1].second)}setValue(o,s){let a=-1;for(let _=0;_=0?this._keyValues[a].second=s:(this.appendKey(o),this._keyValues[this._size-1].second=s)}isExist(o){for(let s=0;sthis._keyValues.length&&(this._keyValues.length==0?(!s&&o{i.csmMap=csmMap,i.csmPair=csmPair,i.iterator=iterator})(Live2DCubismFramework$w||(Live2DCubismFramework$w={}));class CubismJsonExtension{static parseJsonObject(o,s){return Object.keys(o).forEach(a=>{if(typeof o[a]=="boolean"){const _=!!o[a];s.put(a,new JsonBoolean(_))}else if(typeof o[a]=="string"){const _=String(o[a]);s.put(a,new JsonString(_))}else if(typeof o[a]=="number"){const _=Number(o[a]);s.put(a,new JsonFloat(_))}else o[a]instanceof Array?s.put(a,CubismJsonExtension.parseJsonArray(o[a])):o[a]instanceof Object?s.put(a,CubismJsonExtension.parseJsonObject(o[a],new JsonMap)):o[a]==null?s.put(a,new JsonNullvalue):s.put(a,o[a])}),s}static parseJsonArray(o){const s=new JsonArray;return Object.keys(o).forEach(a=>{if(typeof Number(a)=="number")if(typeof o[a]=="boolean"){const $=!!o[a];s.add(new JsonBoolean($))}else if(typeof o[a]=="string"){const $=String(o[a]);s.add(new JsonString($))}else if(typeof o[a]=="number"){const $=Number(o[a]);s.add(new JsonFloat($))}else o[a]instanceof Array?s.add(this.parseJsonArray(o[a])):o[a]instanceof Object?s.add(this.parseJsonObject(o[a],new JsonMap)):o[a]==null?s.add(new JsonNullvalue):s.add(o[a]);else if(o[a]instanceof Array)s.add(this.parseJsonArray(o[a]));else if(o[a]instanceof Object)s.add(this.parseJsonObject(o[a],new JsonMap));else if(o[a]==null)s.add(new JsonNullvalue);else{const $=Array(o[a]);for(let _e=0;_e<$.length;_e++)s.add($[_e])}}),s}}const CSM_JSON_ERROR_TYPE_MISMATCH="Error: type mismatch",CSM_JSON_ERROR_INDEX_OF_BOUNDS="Error: index out of bounds";var Lr;let Value$2=(Lr=class{constructor(){xt(this,"_stringBuffer")}getRawString(o,s){return this.getString(o,s)}toInt(o=0){return o}toFloat(o=0){return o}toBoolean(o=!1){return o}getSize(){return 0}getArray(o=null){return o}getVector(o=new csmVector){return o}getMap(o){return o}getValueByIndex(o){return Lr.errorValue.setErrorNotForClientCall(CSM_JSON_ERROR_TYPE_MISMATCH)}getValueByString(o){return Lr.nullValue.setErrorNotForClientCall(CSM_JSON_ERROR_TYPE_MISMATCH)}getKeys(){return Lr.dummyKeys}isError(){return!1}isNull(){return!1}isBool(){return!1}isFloat(){return!1}isString(){return!1}isArray(){return!1}isMap(){return!1}equals(o){return!1}isStatic(){return!1}setErrorNotForClientCall(o){return JsonError.errorValue}static staticInitializeNotForClientCall(){JsonBoolean.trueValue=new JsonBoolean(!0),JsonBoolean.falseValue=new JsonBoolean(!1),Lr.errorValue=new JsonError("ERROR",!0),Lr.nullValue=new JsonNullvalue,Lr.dummyKeys=new csmVector}static staticReleaseNotForClientCall(){JsonBoolean.trueValue=null,JsonBoolean.falseValue=null,Lr.errorValue=null,Lr.nullValue=null,Lr.dummyKeys=null}},xt(Lr,"dummyKeys"),xt(Lr,"errorValue"),xt(Lr,"nullValue"),Lr);class CubismJson{constructor(o,s){xt(this,"_parseCallback",CubismJsonExtension.parseJsonObject);xt(this,"_error");xt(this,"_lineCount");xt(this,"_root");this._error=null,this._lineCount=0,this._root=null,o!=null&&this.parseBytes(o,s,this._parseCallback)}static create(o,s){const a=new CubismJson;return a.parseBytes(o,s,a._parseCallback)?a:(CubismJson.delete(a),null)}static delete(o){}getRoot(){return this._root}static arrayBufferToString(o){const s=new Uint8Array(o);let a="";for(let _=0,$=s.length;_<$;++_)a+="%"+this.pad(s[_].toString(16));return a=decodeURIComponent(a),a}static pad(o){return o.length<2?"0"+o:o}parseBytes(o,s,a){const _=new Array(1),$=CubismJson.arrayBufferToString(o);if(a==null?this._root=this.parseValue($,s,0,_):this._root=a(JSON.parse($),new JsonMap),this._error){let _e="\0";return _e="Json parse error : @line "+(this._lineCount+1)+` +`,this._root=new JsonString(_e),CubismLogInfo("{0}",this._root.getRawString()),!1}else if(this._root==null)return this._root=new JsonError(new csmString(this._error),!1),!1;return!0}getParseError(){return this._error}checkEndOfFile(){return this._root.getArray()[1].equals("EOF")}parseValue(o,s,a,_){if(this._error)return null;let $=null,_e=a,tt;for(;_eit&&st.append(o.slice(it),$-it),it=$+1,$(super(..._l),xt(this,"_isStatic"),this);o(s),this._isStatic=a}isStatic(){return this._isStatic}setErrorNotForClientCall(s){return this._stringBuffer=s,this}isError(){return!0}}class JsonNullvalue extends Value$2{isNull(){return!0}getString(o,s){return this._stringBuffer}isStatic(){return!0}setErrorNotForClientCall(o){return this._stringBuffer=o,JsonError.nullValue}constructor(){super(),this._stringBuffer="NullValue"}}class JsonArray extends Value$2{constructor(){super();xt(this,"_array");this._array=new csmVector}release(){for(let s=this._array.begin();s.notEqual(this._array.end());s.preIncrement()){let a=s.ptr();a&&!a.isStatic()&&(a=void 0,a=null)}}isArray(){return!0}getValueByIndex(s){if(s<0||this._array.getSize()<=s)return Value$2.errorValue.setErrorNotForClientCall(CSM_JSON_ERROR_INDEX_OF_BOUNDS);const a=this._array.at(s);return a??Value$2.nullValue}getValueByString(s){return Value$2.errorValue.setErrorNotForClientCall(CSM_JSON_ERROR_TYPE_MISMATCH)}getString(s,a){const _=a+`[ +`;for(let $=this._array.begin();$.notEqual(this._array.end());$.increment()){const _e=$.ptr();this._stringBuffer+=a+""+_e.getString(a+" ")+` +`}return this._stringBuffer=_+a+`] +`,this._stringBuffer}add(s){this._array.pushBack(s)}getVector(s=null){return this._array}getSize(){return this._array.getSize()}}class JsonMap extends Value$2{constructor(){super();xt(this,"_map");xt(this,"_keys");this._map=new csmMap}release(){const s=this._map.begin();for(;s.notEqual(this._map.end());){let a=s.ptr().second;a&&!a.isStatic()&&(a=void 0,a=null),s.preIncrement()}}isMap(){return!0}getValueByString(s){if(s instanceof csmString){const a=this._map.getValue(s.s);return a??Value$2.nullValue}for(let a=this._map.begin();a.notEqual(this._map.end());a.preIncrement())if(a.ptr().first==s)return a.ptr().second==null?Value$2.nullValue:a.ptr().second;return Value$2.nullValue}getValueByIndex(s){return Value$2.errorValue.setErrorNotForClientCall(CSM_JSON_ERROR_TYPE_MISMATCH)}getString(s,a){this._stringBuffer=a+`{ +`;const _=this._map.begin();for(;_.notEqual(this._map.end());){const $=_.ptr().first,_e=_.ptr().second;this._stringBuffer+=a+" "+$+" : "+_e.getString(a+" ")+` +`,_.preIncrement()}return this._stringBuffer+=a+`} +`,this._stringBuffer}getMap(s){return this._map}put(s,a){this._map.setValue(s,a)}getKeys(){if(!this._keys){this._keys=new csmVector;const s=this._map.begin();for(;s.notEqual(this._map.end());){const a=s.ptr().first;this._keys.pushBack(a),s.preIncrement()}}return this._keys}getSize(){return this._keys.getSize()}}var Live2DCubismFramework$v;(i=>{i.CubismJson=CubismJson,i.JsonArray=JsonArray,i.JsonBoolean=JsonBoolean,i.JsonError=JsonError,i.JsonFloat=JsonFloat,i.JsonMap=JsonMap,i.JsonNullvalue=JsonNullvalue,i.JsonString=JsonString,i.Value=Value$2})(Live2DCubismFramework$v||(Live2DCubismFramework$v={}));function strtod(i,o){let s=0;for(let _=1;;_++){const $=i.slice(_-1,_);if($=="e"||$=="-"||$=="E")continue;const _e=i.substring(0,_),tt=Number(_e);if(isNaN(tt))break;s=_}let a=parseFloat(i);return isNaN(a)&&(a=NaN),o[0]=i.slice(s),a}let s_isStarted=!1,s_isInitialized=!1,s_option=null,s_cubismIdManager=null;const Constant=Object.freeze({vertexOffset:0,vertexStep:2});function csmDelete(i){i&&(i=void 0)}class CubismFramework{static startUp(o=null){if(s_isStarted)return CubismLogInfo("CubismFramework.startUp() is already done."),s_isStarted;if(s_option=o,s_option!=null&&Live2DCubismCore.Logging.csmSetLogFunction(s_option.logFunction),s_isStarted=!0,s_isStarted){const s=Live2DCubismCore.Version.csmGetVersion(),a=(s&4278190080)>>24,_=(s&16711680)>>16,$=s&65535,_e=s;CubismLogInfo("Live2D Cubism Core version: {0}.{1}.{2} ({3})",("00"+a).slice(-2),("00"+_).slice(-2),("0000"+$).slice(-4),_e)}return CubismLogInfo("CubismFramework.startUp() is complete."),s_isStarted}static cleanUp(){s_isStarted=!1,s_isInitialized=!1,s_option=null,s_cubismIdManager=null}static initialize(o=0){if(CSM_ASSERT(s_isStarted),!s_isStarted){CubismLogWarning("CubismFramework is not started.");return}if(s_isInitialized){CubismLogWarning("CubismFramework.initialize() skipped, already initialized.");return}Value$2.staticInitializeNotForClientCall(),s_cubismIdManager=new CubismIdManager,Live2DCubismCore.Memory.initializeAmountOfMemory(o),s_isInitialized=!0,CubismLogInfo("CubismFramework.initialize() is complete.")}static dispose(){if(CSM_ASSERT(s_isStarted),!s_isStarted){CubismLogWarning("CubismFramework is not started.");return}if(!s_isInitialized){CubismLogWarning("CubismFramework.dispose() skipped, not initialized.");return}Value$2.staticReleaseNotForClientCall(),s_cubismIdManager.release(),s_cubismIdManager=null,CubismRenderer.staticRelease(),s_isInitialized=!1,CubismLogInfo("CubismFramework.dispose() is complete.")}static isStarted(){return s_isStarted}static isInitialized(){return s_isInitialized}static coreLogFunction(o){Live2DCubismCore.Logging.csmGetLogFunction()&&Live2DCubismCore.Logging.csmGetLogFunction()(o)}static getLoggingLevel(){return s_option!=null?s_option.loggingLevel:5}static getIdManager(){return s_cubismIdManager}constructor(){}}class Option{constructor(){xt(this,"logFunction");xt(this,"loggingLevel")}}var LogLevel=(i=>(i[i.LogLevel_Verbose=0]="LogLevel_Verbose",i[i.LogLevel_Debug=1]="LogLevel_Debug",i[i.LogLevel_Info=2]="LogLevel_Info",i[i.LogLevel_Warning=3]="LogLevel_Warning",i[i.LogLevel_Error=4]="LogLevel_Error",i[i.LogLevel_Off=5]="LogLevel_Off",i))(LogLevel||{}),Live2DCubismFramework$u;(i=>{i.Constant=Constant,i.csmDelete=csmDelete,i.CubismFramework=CubismFramework})(Live2DCubismFramework$u||(Live2DCubismFramework$u={}));const CanvasSize="auto",ViewScale=1;let CurrentKScale=ViewScale;const ViewMaxScale=2,ViewMinScale=.8,ViewLogicalLeft=-1,ViewLogicalRight=1,ViewLogicalBottom=-1,ViewLogicalTop=1,ViewLogicalMaxLeft=-2,ViewLogicalMaxRight=2,ViewLogicalMaxBottom=-2,ViewLogicalMaxTop=2;let ResourcesPath="",ModelDir=[],ModelFileNames=[];function updateModelConfig(i,o,s,a){console.log("Updating model config:",{resourcePath:i,modelDirectory:o,modelFileName:s,kScale:a}),ResourcesPath=i,ModelDir=[o],ModelFileNames=[s],a!==void 0&&(CurrentKScale=a),ModelDirSize=ModelDir.length}let ModelDirSize=ModelDir.length;const BackImageName="back_class_normal.png",GearImageName="icon_gear.png",PowerImageName="CloseNormal.png",MotionGroupIdle="Idle",MotionGroupTapBody="TapBody",HitAreaNameHead="Head",HitAreaNameBody="Body",PriorityNone=0,PriorityIdle=1,PriorityNormal=2,PriorityForce=3,MOCConsistencyValidationEnable=!0,DebugLogEnable=!1,DebugTouchLogEnable=!1,CubismLoggingLevel=LogLevel.LogLevel_Verbose,RenderTargetWidth=1900,RenderTargetHeight=1e3,ENABLE_LIMITED_FRAME_RATE=!0,LIMITED_FRAME_RATE=60,LAppDefine=Object.freeze(Object.defineProperty({__proto__:null,BackImageName,CanvasSize,CubismLoggingLevel,get CurrentKScale(){return CurrentKScale},DebugLogEnable,DebugTouchLogEnable,ENABLE_LIMITED_FRAME_RATE,GearImageName,HitAreaNameBody,HitAreaNameHead,LIMITED_FRAME_RATE,MOCConsistencyValidationEnable,get ModelDir(){return ModelDir},get ModelDirSize(){return ModelDirSize},get ModelFileNames(){return ModelFileNames},MotionGroupIdle,MotionGroupTapBody,PowerImageName,PriorityForce,PriorityIdle,PriorityNone,PriorityNormal,RenderTargetHeight,RenderTargetWidth,get ResourcesPath(){return ResourcesPath},ViewLogicalBottom,ViewLogicalLeft,ViewLogicalMaxBottom,ViewLogicalMaxLeft,ViewLogicalMaxRight,ViewLogicalMaxTop,ViewLogicalRight,ViewLogicalTop,ViewMaxScale,ViewMinScale,ViewScale,updateModelConfig},Symbol.toStringTag,{value:"Module"})),useAudioTask=()=>{const{t:i}=useTranslation(),{aiState:o,backendSynthComplete:s,setBackendSynthComplete:a}=useAiState(),{setSubtitleText:_}=useSubtitle(),{appendResponse:$,appendAIMessage:_e}=useChatHistory(),{sendMessage:tt}=useWebSocket(),{setExpression:st}=useLive2DExpression(),it=reactExports.useRef({aiState:o,setSubtitleText:_,appendResponse:$,appendAIMessage:_e});it.current={aiState:o,setSubtitleText:_,appendResponse:$,appendAIMessage:_e};const nt=reactExports.useCallback(()=>{audioManager.stopCurrentAudioAndLipSync()},[]),et=rt=>new Promise(ot=>{var yt,mt;const{aiState:at,setSubtitleText:lt,appendResponse:ut,appendAIMessage:ct}=it.current;if(at==="interrupted"){console.warn("Audio playback blocked by interruption state."),ot();return}const{audioBase64:dt,displayText:ft,expressions:ht,forwarded:bt}=rt;ft&&(ut(ft.text),ct(ft.text,ft.name,ft.avatar),dt&<(ft.text),bt||tt({type:"audio-play-start",display_text:ft,forwarded:!0}));try{if(dt){const gt=`data:audio/wav;base64,${dt}`,vt=(yt=window.getLive2DManager)==null?void 0:yt.call(window);if(!vt){console.error("Live2D manager not found"),ot();return}const wt=vt.getModel(0);if(!wt){console.error("Live2D model not found at index 0"),ot();return}console.log("Found model for audio playback"),wt._wavFileHandler?console.log("Model has _wavFileHandler available"):console.warn("Model does not have _wavFileHandler for lip sync");const Ct=(mt=window.getLAppAdapter)==null?void 0:mt.call(window);Ct&&(ht==null?void 0:ht[0])!==void 0&&st(ht[0],Ct,`Set expression to: ${ht[0]}`),LAppDefine&&PriorityNormal?(console.log("Starting random 'Talk' motion"),wt.startRandomMotion("Talk",PriorityNormal)):console.warn("LAppDefine.PriorityNormal not found - cannot start talk motion");const kt=new Audio(gt);audioManager.setCurrentAudio(kt,wt);let It=!1;const Pt=()=>{audioManager.clearCurrentAudio(kt),It||(It=!0,ot())},St=2;kt.addEventListener("canplaythrough",()=>{if(it.current.aiState==="interrupted"||!audioManager.hasCurrentAudio()){console.warn("Audio playback cancelled due to interruption or audio was stopped"),Pt();return}if(console.log("Starting audio playback with lip sync"),kt.play().catch(Rt=>{console.error("Audio play error:",Rt),Pt()}),wt._wavFileHandler){if(!wt._wavFileHandler._initialized){console.log("Applying enhanced lip sync"),wt._wavFileHandler._initialized=!0;const Rt=wt._wavFileHandler.update.bind(wt._wavFileHandler);wt._wavFileHandler.update=function(At){const Mt=Rt(At);return this._lastRms=Math.min(2,this._lastRms*St),Mt}}audioManager.hasCurrentAudio()?wt._wavFileHandler.start(gt):console.warn("WavFileHandler start skipped - audio was stopped")}}),kt.addEventListener("ended",()=>{console.log("Audio playback completed"),Pt()}),kt.addEventListener("error",Rt=>{console.error("Audio playback error:",Rt),Pt()}),kt.load()}else ot()}catch(gt){console.error("Audio playback setup error:",gt),toaster.create({title:`${i("error.audioPlayback")}: ${gt}`,type:"error",duration:2e3}),ot()}});return reactExports.useEffect(()=>{let rt=!0;return(async()=>{await audioTaskQueue.waitForCompletion(),rt&&s&&(nt(),tt({type:"frontend-playback-complete"}),a(!1))})(),()=>{rt=!1}},[s,tt,a,nt]),{addAudioTask:async rt=>{var at;const{aiState:ot}=it.current;if(ot==="interrupted"){console.log("Skipping audio task due to interrupted state");return}console.log(`Adding audio task ${(at=rt.displayText)==null?void 0:at.text} to queue`),audioTaskQueue.addTask(()=>et(rt))},appendResponse:$,stopCurrentAudioAndLipSync:nt}},useInterrupt=()=>{const{aiState:i,setAiState:o}=useAiState(),{sendMessage:s}=useWebSocket(),{fullResponse:a,clearResponse:_}=useChatHistory(),{subtitleText:$,setSubtitleText:_e}=useSubtitle(),{stopCurrentAudioAndLipSync:tt}=useAudioTask();return{interrupt:(it=!0)=>{i==="thinking-speaking"&&(console.log("Interrupting conversation chain"),tt(),audioTaskQueue.clearQueue(),o("interrupted"),it&&s({type:"interrupt-signal",text:a}),_(),$==="Thinking..."&&_e(""),console.log("Interrupted!"))}}};let canvas=null,gl=null,s_instance$4=null;class LAppGlManager{static getInstance(){return s_instance$4==null&&(s_instance$4=new LAppGlManager),s_instance$4}static releaseInstance(){s_instance$4!=null&&s_instance$4.release(),s_instance$4=null}constructor(){if(canvas=document.getElementById("canvas"),!canvas){console.warn("Canvas element not found during LAppGlManager initialization");return}gl=canvas.getContext("webgl2"),gl||(alert("Cannot initialize WebGL. This browser does not support."),gl=null,document.body.innerHTML="This browser does not support the <canvas> element.")}release(){}}const CubismDefaultParameterId=Object.freeze({HitAreaPrefix:"HitArea",HitAreaHead:"Head",HitAreaBody:"Body",PartsIdCore:"Parts01Core",PartsArmPrefix:"Parts01Arm_",PartsArmLPrefix:"Parts01ArmL_",PartsArmRPrefix:"Parts01ArmR_",ParamAngleX:"ParamAngleX",ParamAngleY:"ParamAngleY",ParamAngleZ:"ParamAngleZ",ParamEyeLOpen:"ParamEyeLOpen",ParamEyeLSmile:"ParamEyeLSmile",ParamEyeROpen:"ParamEyeROpen",ParamEyeRSmile:"ParamEyeRSmile",ParamEyeBallX:"ParamEyeBallX",ParamEyeBallY:"ParamEyeBallY",ParamEyeBallForm:"ParamEyeBallForm",ParamBrowLY:"ParamBrowLY",ParamBrowRY:"ParamBrowRY",ParamBrowLX:"ParamBrowLX",ParamBrowRX:"ParamBrowRX",ParamBrowLAngle:"ParamBrowLAngle",ParamBrowRAngle:"ParamBrowRAngle",ParamBrowLForm:"ParamBrowLForm",ParamBrowRForm:"ParamBrowRForm",ParamMouthForm:"ParamMouthForm",ParamMouthOpenY:"ParamMouthOpenY",ParamCheek:"ParamCheek",ParamBodyAngleX:"ParamBodyAngleX",ParamBodyAngleY:"ParamBodyAngleY",ParamBodyAngleZ:"ParamBodyAngleZ",ParamBreath:"ParamBreath",ParamArmLA:"ParamArmLA",ParamArmRA:"ParamArmRA",ParamArmLB:"ParamArmLB",ParamArmRB:"ParamArmRB",ParamHandL:"ParamHandL",ParamHandR:"ParamHandR",ParamHairFront:"ParamHairFront",ParamHairSide:"ParamHairSide",ParamHairBack:"ParamHairBack",ParamHairFluffy:"ParamHairFluffy",ParamShoulderY:"ParamShoulderY",ParamBustX:"ParamBustX",ParamBustY:"ParamBustY",ParamBaseX:"ParamBaseX",ParamBaseY:"ParamBaseY",ParamNONE:"NONE:"});var Live2DCubismFramework$t;(i=>{i.HitAreaBody=CubismDefaultParameterId.HitAreaBody,i.HitAreaHead=CubismDefaultParameterId.HitAreaHead,i.HitAreaPrefix=CubismDefaultParameterId.HitAreaPrefix,i.ParamAngleX=CubismDefaultParameterId.ParamAngleX,i.ParamAngleY=CubismDefaultParameterId.ParamAngleY,i.ParamAngleZ=CubismDefaultParameterId.ParamAngleZ,i.ParamArmLA=CubismDefaultParameterId.ParamArmLA,i.ParamArmLB=CubismDefaultParameterId.ParamArmLB,i.ParamArmRA=CubismDefaultParameterId.ParamArmRA,i.ParamArmRB=CubismDefaultParameterId.ParamArmRB,i.ParamBaseX=CubismDefaultParameterId.ParamBaseX,i.ParamBaseY=CubismDefaultParameterId.ParamBaseY,i.ParamBodyAngleX=CubismDefaultParameterId.ParamBodyAngleX,i.ParamBodyAngleY=CubismDefaultParameterId.ParamBodyAngleY,i.ParamBodyAngleZ=CubismDefaultParameterId.ParamBodyAngleZ,i.ParamBreath=CubismDefaultParameterId.ParamBreath,i.ParamBrowLAngle=CubismDefaultParameterId.ParamBrowLAngle,i.ParamBrowLForm=CubismDefaultParameterId.ParamBrowLForm,i.ParamBrowLX=CubismDefaultParameterId.ParamBrowLX,i.ParamBrowLY=CubismDefaultParameterId.ParamBrowLY,i.ParamBrowRAngle=CubismDefaultParameterId.ParamBrowRAngle,i.ParamBrowRForm=CubismDefaultParameterId.ParamBrowRForm,i.ParamBrowRX=CubismDefaultParameterId.ParamBrowRX,i.ParamBrowRY=CubismDefaultParameterId.ParamBrowRY,i.ParamBustX=CubismDefaultParameterId.ParamBustX,i.ParamBustY=CubismDefaultParameterId.ParamBustY,i.ParamCheek=CubismDefaultParameterId.ParamCheek,i.ParamEyeBallForm=CubismDefaultParameterId.ParamEyeBallForm,i.ParamEyeBallX=CubismDefaultParameterId.ParamEyeBallX,i.ParamEyeBallY=CubismDefaultParameterId.ParamEyeBallY,i.ParamEyeLOpen=CubismDefaultParameterId.ParamEyeLOpen,i.ParamEyeLSmile=CubismDefaultParameterId.ParamEyeLSmile,i.ParamEyeROpen=CubismDefaultParameterId.ParamEyeROpen,i.ParamEyeRSmile=CubismDefaultParameterId.ParamEyeRSmile,i.ParamHairBack=CubismDefaultParameterId.ParamHairBack,i.ParamHairFluffy=CubismDefaultParameterId.ParamHairFluffy,i.ParamHairFront=CubismDefaultParameterId.ParamHairFront,i.ParamHairSide=CubismDefaultParameterId.ParamHairSide,i.ParamHandL=CubismDefaultParameterId.ParamHandL,i.ParamHandR=CubismDefaultParameterId.ParamHandR,i.ParamMouthForm=CubismDefaultParameterId.ParamMouthForm,i.ParamMouthOpenY=CubismDefaultParameterId.ParamMouthOpenY,i.ParamNONE=CubismDefaultParameterId.ParamNONE,i.ParamShoulderY=CubismDefaultParameterId.ParamShoulderY,i.PartsArmLPrefix=CubismDefaultParameterId.PartsArmLPrefix,i.PartsArmPrefix=CubismDefaultParameterId.PartsArmPrefix,i.PartsArmRPrefix=CubismDefaultParameterId.PartsArmRPrefix,i.PartsIdCore=CubismDefaultParameterId.PartsIdCore})(Live2DCubismFramework$t||(Live2DCubismFramework$t={}));class ICubismModelSetting{}var Live2DCubismFramework$s;(i=>{i.ICubismModelSetting=ICubismModelSetting})(Live2DCubismFramework$s||(Live2DCubismFramework$s={}));const FileReferences="FileReferences",Groups$1="Groups",Layout="Layout",HitAreas="HitAreas",Moc="Moc",Textures="Textures",Physics="Physics",Pose="Pose",Expressions="Expressions",Motions="Motions",UserData$2="UserData",Name="Name",FilePath="File",Id$4="Id",Ids="Ids",SoundPath="Sound",FadeInTime$1="FadeInTime",FadeOutTime$1="FadeOutTime",LipSync="LipSync",EyeBlink="EyeBlink";class CubismModelSettingJson extends ICubismModelSetting{constructor(s,a){super();xt(this,"_json");xt(this,"_jsonValue");this._json=CubismJson.create(s,a),this.getJson()&&(this._jsonValue=new csmVector,this._jsonValue.pushBack(this.getJson().getRoot().getValueByString(Groups$1)),this._jsonValue.pushBack(this.getJson().getRoot().getValueByString(FileReferences).getValueByString(Moc)),this._jsonValue.pushBack(this.getJson().getRoot().getValueByString(FileReferences).getValueByString(Motions)),this._jsonValue.pushBack(this.getJson().getRoot().getValueByString(FileReferences).getValueByString(Expressions)),this._jsonValue.pushBack(this.getJson().getRoot().getValueByString(FileReferences).getValueByString(Textures)),this._jsonValue.pushBack(this.getJson().getRoot().getValueByString(FileReferences).getValueByString(Physics)),this._jsonValue.pushBack(this.getJson().getRoot().getValueByString(FileReferences).getValueByString(Pose)),this._jsonValue.pushBack(this.getJson().getRoot().getValueByString(HitAreas)))}release(){CubismJson.delete(this._json),this._jsonValue=null}getJson(){return this._json}getModelFileName(){return this.isExistModelFile()?this._jsonValue.at(1).getRawString():""}getTextureCount(){return this.isExistTextureFiles()?this._jsonValue.at(4).getSize():0}getTextureDirectory(){const a=this._jsonValue.at(4).getValueByIndex(0).getRawString().split("/"),_=a.length-1;let $="";for(let _e=0;_e<_;_e++)$+=a[_e],_e<_-1&&($+="/");return $}getTextureFileName(s){return this._jsonValue.at(4).getValueByIndex(s).getRawString()}getHitAreasCount(){return this.isExistHitAreas()?this._jsonValue.at(7).getSize():0}getHitAreaId(s){return CubismFramework.getIdManager().getId(this._jsonValue.at(7).getValueByIndex(s).getValueByString(Id$4).getRawString())}getHitAreaName(s){return this._jsonValue.at(7).getValueByIndex(s).getValueByString(Name).getRawString()}getPhysicsFileName(){return this.isExistPhysicsFile()?this._jsonValue.at(5).getRawString():""}getPoseFileName(){return this.isExistPoseFile()?this._jsonValue.at(6).getRawString():""}getExpressionCount(){return this.isExistExpressionFile()?this._jsonValue.at(3).getSize():0}getExpressionName(s){return this._jsonValue.at(3).getValueByIndex(s).getValueByString(Name).getRawString()}getExpressionFileName(s){return this._jsonValue.at(3).getValueByIndex(s).getValueByString(FilePath).getRawString()}getMotionGroupCount(){return this.isExistMotionGroups()?this._jsonValue.at(2).getKeys().getSize():0}getMotionGroupName(s){return this.isExistMotionGroups()?this._jsonValue.at(2).getKeys().at(s):null}getMotionCount(s){return this.isExistMotionGroupName(s)?this._jsonValue.at(2).getValueByString(s).getSize():0}getMotionFileName(s,a){return this.isExistMotionGroupName(s)?this._jsonValue.at(2).getValueByString(s).getValueByIndex(a).getValueByString(FilePath).getRawString():""}getMotionSoundFileName(s,a){return this.isExistMotionSoundFile(s,a)?this._jsonValue.at(2).getValueByString(s).getValueByIndex(a).getValueByString(SoundPath).getRawString():""}getMotionFadeInTimeValue(s,a){return this.isExistMotionFadeIn(s,a)?this._jsonValue.at(2).getValueByString(s).getValueByIndex(a).getValueByString(FadeInTime$1).toFloat():-1}getMotionFadeOutTimeValue(s,a){return this.isExistMotionFadeOut(s,a)?this._jsonValue.at(2).getValueByString(s).getValueByIndex(a).getValueByString(FadeOutTime$1).toFloat():-1}getUserDataFile(){return this.isExistUserDataFile()?this.getJson().getRoot().getValueByString(FileReferences).getValueByString(UserData$2).getRawString():""}getLayoutMap(s){const a=this.getJson().getRoot().getValueByString(Layout).getMap();if(a==null)return!1;let _=!1;for(const $=a.begin();$.notEqual(a.end());$.preIncrement())s.setValue($.ptr().first,$.ptr().second.toFloat()),_=!0;return _}getEyeBlinkParameterCount(){if(!this.isExistEyeBlinkParameters())return 0;let s=0;for(let a=0;a{i.CubismModelSettingJson=CubismModelSettingJson})(Live2DCubismFramework$r||(Live2DCubismFramework$r={}));class CubismBreath{constructor(){xt(this,"_breathParameters");xt(this,"_currentTime");this._currentTime=0}static create(){return new CubismBreath}static delete(o){}setParameters(o){this._breathParameters=o}getParameters(){return this._breathParameters}updateParameters(o,s){this._currentTime+=s;const a=this._currentTime*2*3.14159;for(let _=0;_{i.BreathParameterData=BreathParameterData,i.CubismBreath=CubismBreath})(Live2DCubismFramework$q||(Live2DCubismFramework$q={}));const kn=class kn{constructor(o){xt(this,"_blinkingState");xt(this,"_parameterIds");xt(this,"_nextBlinkingTime");xt(this,"_stateStartTimeSeconds");xt(this,"_blinkingIntervalSeconds");xt(this,"_closingSeconds");xt(this,"_closedSeconds");xt(this,"_openingSeconds");xt(this,"_userTimeSeconds");if(this._blinkingState=0,this._nextBlinkingTime=0,this._stateStartTimeSeconds=0,this._blinkingIntervalSeconds=4,this._closingSeconds=.1,this._closedSeconds=.05,this._openingSeconds=.15,this._userTimeSeconds=0,this._parameterIds=new csmVector,o!=null)for(let s=0;s=1&&(_=1,this._blinkingState=3,this._stateStartTimeSeconds=this._userTimeSeconds),a=1-_;break;case 3:_=(this._userTimeSeconds-this._stateStartTimeSeconds)/this._closedSeconds,_>=1&&(this._blinkingState=4,this._stateStartTimeSeconds=this._userTimeSeconds),a=0;break;case 4:_=(this._userTimeSeconds-this._stateStartTimeSeconds)/this._openingSeconds,_>=1&&(_=1,this._blinkingState=1,this._nextBlinkingTime=this.determinNextBlinkingTiming()),a=_;break;case 1:this._nextBlinkingTime(i[i.EyeState_First=0]="EyeState_First",i[i.EyeState_Interval=1]="EyeState_Interval",i[i.EyeState_Closing=2]="EyeState_Closing",i[i.EyeState_Closed=3]="EyeState_Closed",i[i.EyeState_Opening=4]="EyeState_Opening",i))(EyeState||{}),Live2DCubismFramework$p;(i=>{i.CubismEyeBlink=CubismEyeBlink,i.EyeState=EyeState})(Live2DCubismFramework$p||(Live2DCubismFramework$p={}));const Epsilon$1=.001,DefaultFadeInSeconds=.5,FadeIn="FadeInTime",Link="Link",Groups="Groups",Id$3="Id";class CubismPose{constructor(){xt(this,"_partGroups");xt(this,"_partGroupCounts");xt(this,"_fadeTimeSeconds");xt(this,"_lastModel");this._fadeTimeSeconds=DefaultFadeInSeconds,this._lastModel=null,this._partGroups=new csmVector,this._partGroupCounts=new csmVector}static create(o,s){const a=CubismJson.create(o,s);if(!a)return null;const _=new CubismPose,$=a.getRoot();$.getValueByString(FadeIn).isNull()||(_._fadeTimeSeconds=$.getValueByString(FadeIn).toFloat(DefaultFadeInSeconds),_._fadeTimeSeconds<=0&&(_._fadeTimeSeconds=DefaultFadeInSeconds));const _e=$.getValueByString(Groups),tt=_e.getSize();for(let st=0;stEpsilon$1){if($>=0)break;$=it,_e=o.getPartOpacityByIndex(nt),_e+=s/this._fadeTimeSeconds,_e>1&&(_e=1)}}$<0&&($=0,_e=1);for(let it=a;itst&&(j=1-st/(1-_e)),et>j&&(et=j),o.setPartOpacityByIndex(nt,et)}}}}class PartData{constructor(o){xt(this,"partId");xt(this,"parameterIndex");xt(this,"partIndex");xt(this,"link");if(this.parameterIndex=0,this.partIndex=0,this.link=new csmVector,o!=null){this.partId=o.partId;for(const s=o.link.begin();s.notEqual(o.link.end());s.preIncrement())this.link.pushBack(s.ptr().clone())}}assignment(o){this.partId=o.partId;for(const s=o.link.begin();s.notEqual(o.link.end());s.preIncrement())this.link.pushBack(s.ptr().clone());return this}initialize(o){this.parameterIndex=o.getParameterIndex(this.partId),this.partIndex=o.getPartIndex(this.partId),o.setParameterValueByIndex(this.parameterIndex,1)}clone(){const o=new PartData;o.partId=this.partId,o.parameterIndex=this.parameterIndex,o.partIndex=this.partIndex,o.link=new csmVector;for(let s=this.link.begin();s.notEqual(this.link.end());s.increment())o.link.pushBack(s.ptr().clone());return o}}var Live2DCubismFramework$o;(i=>{i.CubismPose=CubismPose,i.PartData=PartData})(Live2DCubismFramework$o||(Live2DCubismFramework$o={}));class CubismModelMatrix extends CubismMatrix44{constructor(s,a){super();xt(this,"_width");xt(this,"_height");this._width=s!==void 0?s:0,this._height=a!==void 0?a:0,this.setHeight(2)}setWidth(s){const a=s/this._width,_=a;this.scale(a,_)}setHeight(s){const a=s/this._height,_=a;this.scale(a,_)}setPosition(s,a){this.translate(s,a)}setCenterPosition(s,a){this.centerX(s),this.centerY(a)}top(s){this.setY(s)}bottom(s){const a=this._height*this.getScaleY();this.translateY(s-a)}left(s){this.setX(s)}right(s){const a=this._width*this.getScaleX();this.translateX(s-a)}centerX(s){const a=this._width*this.getScaleX();this.translateX(s-a/2)}setX(s){this.translateX(s)}centerY(s){const a=this._height*this.getScaleY();this.translateY(s-a/2)}setY(s){this.translateY(s)}setupFromLayout(s){const a="width",_="height",$="x",_e="y",tt="center_x",st="center_y",it="top",nt="bottom",et="left",j="right";for(const rt=s.begin();rt.notEqual(s.end());rt.preIncrement()){const ot=rt.ptr().first,at=rt.ptr().second;ot==a?this.setWidth(at):ot==_&&this.setHeight(at)}for(const rt=s.begin();rt.notEqual(s.end());rt.preIncrement()){const ot=rt.ptr().first,at=rt.ptr().second;ot==$?this.setX(at):ot==_e?this.setY(at):ot==tt?this.centerX(at):ot==st?this.centerY(at):ot==it?this.top(at):ot==nt?this.bottom(at):ot==et?this.left(at):ot==j&&this.right(at)}}}var Live2DCubismFramework$n;(i=>{i.CubismModelMatrix=CubismModelMatrix})(Live2DCubismFramework$n||(Live2DCubismFramework$n={}));class CubismVector2{constructor(o,s){this.x=o,this.y=s,this.x=o??0,this.y=s??0}add(o){const s=new CubismVector2(0,0);return s.x=this.x+o.x,s.y=this.y+o.y,s}substract(o){const s=new CubismVector2(0,0);return s.x=this.x-o.x,s.y=this.y-o.y,s}multiply(o){const s=new CubismVector2(0,0);return s.x=this.x*o.x,s.y=this.y*o.y,s}multiplyByScaler(o){return this.multiply(new CubismVector2(o,o))}division(o){const s=new CubismVector2(0,0);return s.x=this.x/o.x,s.y=this.y/o.y,s}divisionByScalar(o){return this.division(new CubismVector2(o,o))}getLength(){return Math.sqrt(this.x*this.x+this.y*this.y)}getDistanceWith(o){return Math.sqrt((this.x-o.x)*(this.x-o.x)+(this.y-o.y)*(this.y-o.y))}dot(o){return this.x*o.x+this.y*o.y}normalize(){const o=Math.pow(this.x*this.x+this.y*this.y,.5);this.x=this.x/o,this.y=this.y/o}isEqual(o){return this.x==o.x&&this.y==o.y}isNotEqual(o){return!this.isEqual(o)}}var Live2DCubismFramework$m;(i=>{i.CubismVector2=CubismVector2})(Live2DCubismFramework$m||(Live2DCubismFramework$m={}));const cn=class cn{static range(o,s,a){return oa&&(o=a),o}static sin(o){return Math.sin(o)}static cos(o){return Math.cos(o)}static abs(o){return Math.abs(o)}static sqrt(o){return Math.sqrt(o)}static cbrt(o){if(o===0)return o;let s=o;const a=s<0;a&&(s=-s);let _;return s===1/0?_=1/0:(_=Math.exp(Math.log(s)/3),_=(s/(_*_)+2*_)/3),a?-_:_}static getEasingSine(o){return o<0?0:o>1?1:.5-.5*this.cos(o*Math.PI)}static max(o,s){return o>s?o:s}static min(o,s){return o>s?s:o}static degreesToRadian(o){return o/180*Math.PI}static radianToDegrees(o){return o*180/Math.PI}static directionToRadian(o,s){const a=Math.atan2(s.y,s.x),_=Math.atan2(o.y,o.x);let $=a-_;for(;$<-Math.PI;)$+=Math.PI*2;for(;$>Math.PI;)$-=Math.PI*2;return $}static directionToDegrees(o,s){const a=this.directionToRadian(o,s);let _=this.radianToDegrees(a);return s.x-o.x>0&&(_=-_),_}static radianToDirection(o){const s=new CubismVector2;return s.x=this.sin(o),s.y=this.cos(o),s}static quadraticEquation(o,s,a){return this.abs(o){i.CubismMath=CubismMath})(Live2DCubismFramework$l||(Live2DCubismFramework$l={}));const FrameRate=30,Epsilon=.01;class CubismTargetPoint{constructor(){xt(this,"_faceTargetX");xt(this,"_faceTargetY");xt(this,"_faceX");xt(this,"_faceY");xt(this,"_faceVX");xt(this,"_faceVY");xt(this,"_lastTimeSeconds");xt(this,"_userTimeSeconds");this._faceTargetX=0,this._faceTargetY=0,this._faceX=0,this._faceY=0,this._faceVX=0,this._faceVY=0,this._lastTimeSeconds=0,this._userTimeSeconds=0}update(o){this._userTimeSeconds+=o;const a=40/10*1/FrameRate;if(this._lastTimeSeconds==0){this._lastTimeSeconds=this._userTimeSeconds;return}const _=(this._userTimeSeconds-this._lastTimeSeconds)*FrameRate;this._lastTimeSeconds=this._userTimeSeconds;const _e=.15*FrameRate,tt=_*a/_e,st=this._faceTargetX-this._faceX,it=this._faceTargetY-this._faceY;if(CubismMath.abs(st)<=Epsilon&&CubismMath.abs(it)<=Epsilon)return;const nt=CubismMath.sqrt(st*st+it*it),et=a*st/nt,j=a*it/nt;let rt=et-this._faceVX,ot=j-this._faceVY;const at=CubismMath.sqrt(rt*rt+ot*ot);(at<-tt||at>tt)&&(rt*=tt/at,ot*=tt/at),this._faceVX+=rt,this._faceVY+=ot;{const lt=.5*(CubismMath.sqrt(tt*tt+16*tt*nt-8*tt*nt)-tt),ut=CubismMath.sqrt(this._faceVX*this._faceVX+this._faceVY*this._faceVY);ut>lt&&(this._faceVX*=lt/ut,this._faceVY*=lt/ut)}this._faceX+=this._faceVX,this._faceY+=this._faceVY}getX(){return this._faceX}getY(){return this._faceY}set(o,s){this._faceTargetX=o,this._faceTargetY=s}}var Live2DCubismFramework$k;(i=>{i.CubismTargetPoint=CubismTargetPoint})(Live2DCubismFramework$k||(Live2DCubismFramework$k={}));class ACubismMotion{constructor(){xt(this,"setFinishedMotionHandler",o=>this._onFinishedMotion=o);xt(this,"getFinishedMotionHandler",()=>this._onFinishedMotion);xt(this,"_fadeInSeconds");xt(this,"_fadeOutSeconds");xt(this,"_weight");xt(this,"_offsetSeconds");xt(this,"_firedEventValues");xt(this,"_onFinishedMotion");this._fadeInSeconds=-1,this._fadeOutSeconds=-1,this._weight=1,this._offsetSeconds=0,this._firedEventValues=new csmVector}static delete(o){o.release(),o=null}release(){this._weight=0}updateParameters(o,s,a){if(!s.isAvailable()||s.isFinished())return;this.setupMotionQueueEntry(s,a);const _=this.updateFadeWeight(s,a);this.doUpdateParameters(o,a,_,s),s.getEndTime()>0&&s.getEndTime(){i.ACubismMotion=ACubismMotion})(Live2DCubismFramework$j||(Live2DCubismFramework$j={}));const ExpressionKeyFadeIn="FadeInTime",ExpressionKeyFadeOut="FadeOutTime",ExpressionKeyParameters="Parameters",ExpressionKeyId="Id",ExpressionKeyValue="Value",ExpressionKeyBlend="Blend",BlendValueAdd="Add",BlendValueMultiply="Multiply",BlendValueOverwrite="Overwrite",DefaultFadeTime=1,Ur=class Ur extends ACubismMotion{constructor(){super();xt(this,"_parameters");xt(this,"_fadeWeight");this._parameters=new csmVector,this._fadeWeight=0}static create(s,a){const _=new Ur;return _.parse(s,a),_}doUpdateParameters(s,a,_,$){for(let _e=0;_e(i[i.Additive=0]="Additive",i[i.Multiply=1]="Multiply",i[i.Overwrite=2]="Overwrite",i))(ExpressionBlendType||{});class ExpressionParameter{constructor(){xt(this,"parameterId");xt(this,"blendType");xt(this,"value")}}var Live2DCubismFramework$i;(i=>{i.CubismExpressionMotion=CubismExpressionMotion,i.ExpressionBlendType=ExpressionBlendType,i.ExpressionParameter=ExpressionParameter})(Live2DCubismFramework$i||(Live2DCubismFramework$i={}));class CubismMotionQueueEntry{constructor(){xt(this,"_autoDelete");xt(this,"_motion");xt(this,"_available");xt(this,"_finished");xt(this,"_started");xt(this,"_startTimeSeconds");xt(this,"_fadeInStartTimeSeconds");xt(this,"_endTimeSeconds");xt(this,"_stateTimeSeconds");xt(this,"_stateWeight");xt(this,"_lastEventCheckSeconds");xt(this,"_fadeOutSeconds");xt(this,"_isTriggeredFadeOut");xt(this,"_motionQueueEntryHandle");this._autoDelete=!1,this._motion=null,this._available=!0,this._finished=!1,this._started=!1,this._startTimeSeconds=-1,this._fadeInStartTimeSeconds=0,this._endTimeSeconds=-1,this._stateTimeSeconds=0,this._stateWeight=0,this._lastEventCheckSeconds=0,this._motionQueueEntryHandle=this,this._fadeOutSeconds=0,this._isTriggeredFadeOut=!1}release(){this._autoDelete&&this._motion&&ACubismMotion.delete(this._motion)}setFadeOut(o){this._fadeOutSeconds=o,this._isTriggeredFadeOut=!0}startFadeOut(o,s){const a=s+o;this._isTriggeredFadeOut=!0,(this._endTimeSeconds<0||a{i.CubismMotionQueueEntry=CubismMotionQueueEntry})(Live2DCubismFramework$h||(Live2DCubismFramework$h={}));class CubismMotionQueueManager{constructor(){xt(this,"_userTimeSeconds");xt(this,"_motions");xt(this,"_eventCallBack");xt(this,"_eventCustomData");this._userTimeSeconds=0,this._eventCallBack=null,this._eventCustomData=null,this._motions=new csmVector}release(){for(let o=0;o{i.CubismMotionQueueManager=CubismMotionQueueManager,i.InvalidMotionQueueEntryHandleValue=InvalidMotionQueueEntryHandleValue})(Live2DCubismFramework$g||(Live2DCubismFramework$g={}));class ExpressionParameterValue{constructor(){xt(this,"parameterId");xt(this,"additiveValue");xt(this,"multiplyValue");xt(this,"overwriteValue")}}class CubismExpressionMotionManager extends CubismMotionQueueManager{constructor(){super();xt(this,"_expressionParameterValues");xt(this,"_fadeWeights");xt(this,"_currentPriority");xt(this,"_reservePriority");xt(this,"_startExpressionTime");this._currentPriority=0,this._reservePriority=0,this._expressionParameterValues=new csmVector,this._fadeWeights=new csmVector}release(){this._expressionParameterValues&&(csmDelete(this._expressionParameterValues),this._expressionParameterValues=null),this._fadeWeights&&(csmDelete(this._fadeWeights),this._fadeWeights=null)}getCurrentPriority(){return this._currentPriority}getReservePriority(){return this._reservePriority}getFadeWeight(s){return this._fadeWeights.at(s)}setReservePriority(s){this._reservePriority=s}startMotionPriority(s,a,_){return _==this.getReservePriority()&&this.setReservePriority(0),this._currentPriority=_,this._fadeWeights.pushBack(0),this.startMotion(s,a)}updateMotion(s,a){this._userTimeSeconds+=a;let _=!1;const $=this.getCubismMotionQueueEntries();let _e=0,tt=0;for(let st=this._motions.begin();st.notEqual(this._motions.end());){const it=st.ptr();if(it==null){st=$.erase(st);continue}const nt=it.getCubismMotion();if(nt==null){csmDelete(it),st=$.erase(st);continue}const et=nt.getExpressionParameters();if(it.isAvailable())for(let j=0;j=0)continue;const ot=new ExpressionParameterValue;ot.parameterId=et.at(j).parameterId,ot.additiveValue=CubismExpressionMotion.DefaultAdditiveValue,ot.multiplyValue=CubismExpressionMotion.DefaultMultiplyValue,ot.overwriteValue=s.getParameterValueById(ot.parameterId),this._expressionParameterValues.pushBack(ot)}nt.setupMotionQueueEntry(it,this._userTimeSeconds),this._fadeWeights.set(tt,nt.updateFadeWeight(it,this._userTimeSeconds)),nt.calculateExpressionParameters(s,this._userTimeSeconds,it,this._expressionParameterValues,tt,this._fadeWeights.at(tt)),_e+=nt.getFadeInTime()==0?1:CubismMath.getEasingSine((this._userTimeSeconds-it.getFadeInStartTime())/nt.getFadeInTime()),_=!0,it.isTriggeredFadeOut()&&it.startFadeOut(it.getFadeOutSeconds(),this._userTimeSeconds),st.preIncrement(),++tt}if($.getSize()>1&&($.at($.getSize()-1).getCubismMotion(),this._fadeWeights.at(this._fadeWeights.getSize()-1)>=1))for(let it=$.getSize()-2;it>=0;--it){const nt=$.at(it);csmDelete(nt),$.remove(it),this._fadeWeights.remove(it)}_e>1&&(_e=1);for(let st=0;st{i.CubismExpressionMotionManager=CubismExpressionMotionManager})(Live2DCubismFramework$f||(Live2DCubismFramework$f={}));var CubismMotionCurveTarget=(i=>(i[i.CubismMotionCurveTarget_Model=0]="CubismMotionCurveTarget_Model",i[i.CubismMotionCurveTarget_Parameter=1]="CubismMotionCurveTarget_Parameter",i[i.CubismMotionCurveTarget_PartOpacity=2]="CubismMotionCurveTarget_PartOpacity",i))(CubismMotionCurveTarget||{}),CubismMotionSegmentType=(i=>(i[i.CubismMotionSegmentType_Linear=0]="CubismMotionSegmentType_Linear",i[i.CubismMotionSegmentType_Bezier=1]="CubismMotionSegmentType_Bezier",i[i.CubismMotionSegmentType_Stepped=2]="CubismMotionSegmentType_Stepped",i[i.CubismMotionSegmentType_InverseStepped=3]="CubismMotionSegmentType_InverseStepped",i))(CubismMotionSegmentType||{});class CubismMotionPoint{constructor(){xt(this,"time",0);xt(this,"value",0)}}class CubismMotionSegment{constructor(){xt(this,"evaluate");xt(this,"basePointIndex");xt(this,"segmentType");this.evaluate=null,this.basePointIndex=0,this.segmentType=0}}class CubismMotionCurve{constructor(){xt(this,"type");xt(this,"id");xt(this,"segmentCount");xt(this,"baseSegmentIndex");xt(this,"fadeInTime");xt(this,"fadeOutTime");this.type=0,this.segmentCount=0,this.baseSegmentIndex=0,this.fadeInTime=0,this.fadeOutTime=0}}class CubismMotionEvent{constructor(){xt(this,"fireTime",0);xt(this,"value")}}class CubismMotionData{constructor(){xt(this,"duration");xt(this,"loop");xt(this,"curveCount");xt(this,"eventCount");xt(this,"fps");xt(this,"curves");xt(this,"segments");xt(this,"points");xt(this,"events");this.duration=0,this.loop=!1,this.curveCount=0,this.eventCount=0,this.fps=0,this.curves=new csmVector,this.segments=new csmVector,this.points=new csmVector,this.events=new csmVector}}var Live2DCubismFramework$e;(i=>{i.CubismMotionCurve=CubismMotionCurve,i.CubismMotionCurveTarget=CubismMotionCurveTarget,i.CubismMotionData=CubismMotionData,i.CubismMotionEvent=CubismMotionEvent,i.CubismMotionPoint=CubismMotionPoint,i.CubismMotionSegment=CubismMotionSegment,i.CubismMotionSegmentType=CubismMotionSegmentType})(Live2DCubismFramework$e||(Live2DCubismFramework$e={}));const Meta$2="Meta",Duration="Duration",Loop="Loop",AreBeziersRestricted="AreBeziersRestricted",CurveCount="CurveCount",Fps$1="Fps",TotalSegmentCount="TotalSegmentCount",TotalPointCount="TotalPointCount",Curves="Curves",Target$1="Target",Id$2="Id",FadeInTime="FadeInTime",FadeOutTime="FadeOutTime",Segments="Segments",UserData$1="UserData",UserDataCount$1="UserDataCount",TotalUserDataSize$1="TotalUserDataSize",Time="Time",Value$1="Value";class CubismMotionJson{constructor(o,s){xt(this,"_json");this._json=CubismJson.create(o,s)}release(){CubismJson.delete(this._json)}getMotionDuration(){return this._json.getRoot().getValueByString(Meta$2).getValueByString(Duration).toFloat()}isMotionLoop(){return this._json.getRoot().getValueByString(Meta$2).getValueByString(Loop).toBoolean()}getEvaluationOptionFlag(o){return o==0?this._json.getRoot().getValueByString(Meta$2).getValueByString(AreBeziersRestricted).toBoolean():!1}getMotionCurveCount(){return this._json.getRoot().getValueByString(Meta$2).getValueByString(CurveCount).toInt()}getMotionFps(){return this._json.getRoot().getValueByString(Meta$2).getValueByString(Fps$1).toFloat()}getMotionTotalSegmentCount(){return this._json.getRoot().getValueByString(Meta$2).getValueByString(TotalSegmentCount).toInt()}getMotionTotalPointCount(){return this._json.getRoot().getValueByString(Meta$2).getValueByString(TotalPointCount).toInt()}isExistMotionFadeInTime(){return!this._json.getRoot().getValueByString(Meta$2).getValueByString(FadeInTime).isNull()}isExistMotionFadeOutTime(){return!this._json.getRoot().getValueByString(Meta$2).getValueByString(FadeOutTime).isNull()}getMotionFadeInTime(){return this._json.getRoot().getValueByString(Meta$2).getValueByString(FadeInTime).toFloat()}getMotionFadeOutTime(){return this._json.getRoot().getValueByString(Meta$2).getValueByString(FadeOutTime).toFloat()}getMotionCurveTarget(o){return this._json.getRoot().getValueByString(Curves).getValueByIndex(o).getValueByString(Target$1).getRawString()}getMotionCurveId(o){return CubismFramework.getIdManager().getId(this._json.getRoot().getValueByString(Curves).getValueByIndex(o).getValueByString(Id$2).getRawString())}isExistMotionCurveFadeInTime(o){return!this._json.getRoot().getValueByString(Curves).getValueByIndex(o).getValueByString(FadeInTime).isNull()}isExistMotionCurveFadeOutTime(o){return!this._json.getRoot().getValueByString(Curves).getValueByIndex(o).getValueByString(FadeOutTime).isNull()}getMotionCurveFadeInTime(o){return this._json.getRoot().getValueByString(Curves).getValueByIndex(o).getValueByString(FadeInTime).toFloat()}getMotionCurveFadeOutTime(o){return this._json.getRoot().getValueByString(Curves).getValueByIndex(o).getValueByString(FadeOutTime).toFloat()}getMotionCurveSegmentCount(o){return this._json.getRoot().getValueByString(Curves).getValueByIndex(o).getValueByString(Segments).getVector().getSize()}getMotionCurveSegment(o,s){return this._json.getRoot().getValueByString(Curves).getValueByIndex(o).getValueByString(Segments).getValueByIndex(s).toFloat()}getEventCount(){return this._json.getRoot().getValueByString(Meta$2).getValueByString(UserDataCount$1).toInt()}getTotalEventValueSize(){return this._json.getRoot().getValueByString(Meta$2).getValueByString(TotalUserDataSize$1).toInt()}getEventTime(o){return this._json.getRoot().getValueByString(UserData$1).getValueByIndex(o).getValueByString(Time).toFloat()}getEventValue(o){return new csmString(this._json.getRoot().getValueByString(UserData$1).getValueByIndex(o).getValueByString(Value$1).getRawString())}}var EvaluationOptionFlag=(i=>(i[i.EvaluationOptionFlag_AreBeziersRistricted=0]="EvaluationOptionFlag_AreBeziersRistricted",i))(EvaluationOptionFlag||{}),Live2DCubismFramework$d;(i=>{i.CubismMotionJson=CubismMotionJson})(Live2DCubismFramework$d||(Live2DCubismFramework$d={}));const EffectNameEyeBlink="EyeBlink",EffectNameLipSync="LipSync",TargetNameModel="Model",TargetNameParameter="Parameter",TargetNamePartOpacity="PartOpacity",IdNameOpacity="Opacity",UseOldBeziersCurveMotion=!1;function lerpPoints(i,o,s){const a=new CubismMotionPoint;return a.time=i.time+(o.time-i.time)*s,a.value=i.value+(o.value-i.value)*s,a}function linearEvaluate(i,o){let s=(o-i[0].time)/(i[1].time-i[0].time);return s<0&&(s=0),i[0].value+(i[1].value-i[0].value)*s}function bezierEvaluate(i,o){let s=(o-i[0].time)/(i[3].time-i[0].time);s<0&&(s=0);const a=lerpPoints(i[0],i[1],s),_=lerpPoints(i[1],i[2],s),$=lerpPoints(i[2],i[3],s),_e=lerpPoints(a,_,s),tt=lerpPoints(_,$,s);return lerpPoints(_e,tt,s).value}function bezierEvaluateCardanoInterpretation(i,o){const s=o,a=i[0].time,_=i[3].time,$=i[1].time,_e=i[2].time,tt=_-3*_e+3*$-a,st=3*_e-6*$+3*a,it=3*$-3*a,nt=a-s,et=CubismMath.cardanoAlgorithmForBezier(tt,st,it,nt),j=lerpPoints(i[0],i[1],et),rt=lerpPoints(i[1],i[2],et),ot=lerpPoints(i[2],i[3],et),at=lerpPoints(j,rt,et),lt=lerpPoints(rt,ot,et);return lerpPoints(at,lt,et).value}function steppedEvaluate(i,o){return i[0].value}function inverseSteppedEvaluate(i,o){return i[1].value}function evaluateCurve(i,o,s){const a=i.curves.at(o);let _=-1;const $=a.baseSegmentIndex+a.segmentCount;let _e=0;for(let st=a.baseSegmentIndex;st<$;++st)if(_e=i.segments.at(st).basePointIndex+(i.segments.at(st).segmentType==CubismMotionSegmentType.CubismMotionSegmentType_Bezier?3:1),i.points.at(_e).time>s){_=st;break}if(_==-1)return i.points.at(_e).value;const tt=i.segments.at(_);return tt.evaluate(i.points.get(tt.basePointIndex),s)}class CubismMotion extends ACubismMotion{constructor(){super();xt(this,"_sourceFrameRate");xt(this,"_loopDurationSeconds");xt(this,"_isLoop");xt(this,"_isLoopFadeIn");xt(this,"_lastWeight");xt(this,"_motionData");xt(this,"_eyeBlinkParameterIds");xt(this,"_lipSyncParameterIds");xt(this,"_modelCurveIdEyeBlink");xt(this,"_modelCurveIdLipSync");xt(this,"_modelCurveIdOpacity");xt(this,"_modelOpacity");this._sourceFrameRate=30,this._loopDurationSeconds=-1,this._isLoop=!1,this._isLoopFadeIn=!0,this._lastWeight=0,this._motionData=null,this._modelCurveIdEyeBlink=null,this._modelCurveIdLipSync=null,this._modelCurveIdOpacity=null,this._eyeBlinkParameterIds=null,this._lipSyncParameterIds=null,this._modelOpacity=1}static create(s,a,_){const $=new CubismMotion;try{return $.parse(s,a),$._motionData?($._sourceFrameRate=$._motionData.fps,$._loopDurationSeconds=$._motionData.duration,$._onFinishedMotion=_,$):(CubismLogError("Failed to parse motion data - motion data is null"),null)}catch(_e){return CubismLogError(`Failed to create motion: ${_e}`),null}}doUpdateParameters(s,a,_,$){this._modelCurveIdEyeBlink==null&&(this._modelCurveIdEyeBlink=CubismFramework.getIdManager().getId(EffectNameEyeBlink)),this._modelCurveIdLipSync==null&&(this._modelCurveIdLipSync=CubismFramework.getIdManager().getId(EffectNameLipSync)),this._modelCurveIdOpacity==null&&(this._modelCurveIdOpacity=CubismFramework.getIdManager().getId(IdNameOpacity));let _e=a-$.getStartTime();_e<0&&(_e=0);let tt=Number.MAX_VALUE,st=Number.MAX_VALUE;const it=64;let nt=0,et=0;this._eyeBlinkParameterIds.getSize()>it&&CubismLogDebug("too many eye blink targets : {0}",this._eyeBlinkParameterIds.getSize()),this._lipSyncParameterIds.getSize()>it&&CubismLogDebug("too many lip sync targets : {0}",this._lipSyncParameterIds.getSize());const j=this._fadeInSeconds<=0?1:CubismMath.getEasingSine((a-$.getFadeInStartTime())/this._fadeInSeconds),rt=this._fadeOutSeconds<=0||$.getEndTime()<0?1:CubismMath.getEasingSine(($.getEndTime()-a)/this._fadeOutSeconds);let ot,at,lt,ut=_e;if(this._isLoop)for(;ut>this._motionData.duration;)ut-=this._motionData.duration;const ct=this._motionData.curves;for(at=0;at>dt&1)continue;const ht=ft+(st-ft)*_;s.setParameterValueById(this._eyeBlinkParameterIds.at(dt),ht)}if(tt!=Number.MAX_VALUE)for(let dt=0;dt>dt&1)continue;const ht=ft+(tt-ft)*_;s.setParameterValueById(this._lipSyncParameterIds.at(dt),ht)}}for(;at=this._motionData.duration&&(this._isLoop?($.setStartTime(a),this._isLoopFadeIn&&$.setFadeInStartTime(a)):(this._onFinishedMotion&&this._onFinishedMotion(this),$.setIsFinished(!0))),this._lastWeight=_}setIsLoop(s){this._isLoop=s}isLoop(){return this._isLoop}setIsLoopFadeIn(s){this._isLoopFadeIn=s}isLoopFadeIn(){return this._isLoopFadeIn}getDuration(){return this._isLoop?-1:this._loopDurationSeconds}getLoopDuration(){return this._loopDurationSeconds}setParameterFadeInTime(s,a){const _=this._motionData.curves;for(let $=0;$=this._motionData.points.getSize()){const ot=Math.max(st+1,this._motionData.points.getSize()*2);CubismLogWarning(`Expanding motion points array from ${this._motionData.points.getSize()} to ${ot} for Linear segment`),this._motionData.points.updateSize(ot,CubismMotionPoint,!0)}this._motionData.points.at(st).time=_.getMotionCurveSegment(nt,et+1),this._motionData.points.at(st).value=_.getMotionCurveSegment(nt,et+2),st+=1,et+=3;break}case CubismMotionSegmentType.CubismMotionSegmentType_Bezier:{this._motionData.segments.at(it).segmentType=CubismMotionSegmentType.CubismMotionSegmentType_Bezier,$||UseOldBeziersCurveMotion?this._motionData.segments.at(it).evaluate=bezierEvaluate:this._motionData.segments.at(it).evaluate=bezierEvaluateCardanoInterpretation,this._motionData.points.at(st).time=_.getMotionCurveSegment(nt,et+1),this._motionData.points.at(st).value=_.getMotionCurveSegment(nt,et+2),this._motionData.points.at(st+1).time=_.getMotionCurveSegment(nt,et+3),this._motionData.points.at(st+1).value=_.getMotionCurveSegment(nt,et+4),this._motionData.points.at(st+2).time=_.getMotionCurveSegment(nt,et+5),this._motionData.points.at(st+2).value=_.getMotionCurveSegment(nt,et+6),st+=3,et+=7;break}case CubismMotionSegmentType.CubismMotionSegmentType_Stepped:{this._motionData.segments.at(it).segmentType=CubismMotionSegmentType.CubismMotionSegmentType_Stepped,this._motionData.segments.at(it).evaluate=steppedEvaluate,this._motionData.points.at(st).time=_.getMotionCurveSegment(nt,et+1),this._motionData.points.at(st).value=_.getMotionCurveSegment(nt,et+2),st+=1,et+=3;break}case CubismMotionSegmentType.CubismMotionSegmentType_InverseStepped:{this._motionData.segments.at(it).segmentType=CubismMotionSegmentType.CubismMotionSegmentType_InverseStepped,this._motionData.segments.at(it).evaluate=inverseSteppedEvaluate,this._motionData.points.at(st).time=_.getMotionCurveSegment(nt,et+1),this._motionData.points.at(st).value=_.getMotionCurveSegment(nt,et+2),st+=1,et+=3;break}default:{CSM_ASSERT(0);break}}++this._motionData.curves.at(nt).segmentCount,++it}}for(let nt=0;nt<_.getEventCount();++nt)this._motionData.events.at(nt).fireTime=_.getEventTime(nt),this._motionData.events.at(nt).value=_.getEventValue(nt);_.release(),_=void 0,_=null}getFiredEvent(s,a){this._firedEventValues.updateSize(0);for(let _=0;_s&&this._motionData.events.at(_).fireTime<=a&&this._firedEventValues.pushBack(new csmString(this._motionData.events.at(_).value.s));return this._firedEventValues}isExistModelOpacity(){for(let s=0;s{i.CubismMotion=CubismMotion})(Live2DCubismFramework$c||(Live2DCubismFramework$c={}));class CubismMotionManager extends CubismMotionQueueManager{constructor(){super();xt(this,"_currentPriority");xt(this,"_reservePriority");this._currentPriority=0,this._reservePriority=0}getCurrentPriority(){return this._currentPriority}getReservePriority(){return this._reservePriority}setReservePriority(s){this._reservePriority=s}startMotionPriority(s,a,_){return _==this._reservePriority&&(this._reservePriority=0),this._currentPriority=_,super.startMotion(s,a)}updateMotion(s,a){this._userTimeSeconds+=a;const _=super.doUpdateMotion(s,this._userTimeSeconds);return this.isFinished()&&(this._currentPriority=0),_}reserveMotion(s){return s<=this._reservePriority||s<=this._currentPriority?!1:(this._reservePriority=s,!0)}}var Live2DCubismFramework$b;(i=>{i.CubismMotionManager=CubismMotionManager})(Live2DCubismFramework$b||(Live2DCubismFramework$b={}));var CubismPhysicsTargetType=(i=>(i[i.CubismPhysicsTargetType_Parameter=0]="CubismPhysicsTargetType_Parameter",i))(CubismPhysicsTargetType||{}),CubismPhysicsSource=(i=>(i[i.CubismPhysicsSource_X=0]="CubismPhysicsSource_X",i[i.CubismPhysicsSource_Y=1]="CubismPhysicsSource_Y",i[i.CubismPhysicsSource_Angle=2]="CubismPhysicsSource_Angle",i))(CubismPhysicsSource||{});class PhysicsJsonEffectiveForces{constructor(){xt(this,"gravity");xt(this,"wind");this.gravity=new CubismVector2(0,0),this.wind=new CubismVector2(0,0)}}class CubismPhysicsParameter{constructor(){xt(this,"id");xt(this,"targetType")}}class CubismPhysicsNormalization{constructor(){xt(this,"minimum");xt(this,"maximum");xt(this,"defalut")}}class CubismPhysicsParticle{constructor(){xt(this,"initialPosition");xt(this,"mobility");xt(this,"delay");xt(this,"acceleration");xt(this,"radius");xt(this,"position");xt(this,"lastPosition");xt(this,"lastGravity");xt(this,"force");xt(this,"velocity");this.initialPosition=new CubismVector2(0,0),this.position=new CubismVector2(0,0),this.lastPosition=new CubismVector2(0,0),this.lastGravity=new CubismVector2(0,0),this.force=new CubismVector2(0,0),this.velocity=new CubismVector2(0,0)}}class CubismPhysicsSubRig{constructor(){xt(this,"inputCount");xt(this,"outputCount");xt(this,"particleCount");xt(this,"baseInputIndex");xt(this,"baseOutputIndex");xt(this,"baseParticleIndex");xt(this,"normalizationPosition");xt(this,"normalizationAngle");this.normalizationPosition=new CubismPhysicsNormalization,this.normalizationAngle=new CubismPhysicsNormalization}}class CubismPhysicsInput{constructor(){xt(this,"source");xt(this,"sourceParameterIndex");xt(this,"weight");xt(this,"type");xt(this,"reflect");xt(this,"getNormalizedParameterValue");this.source=new CubismPhysicsParameter}}class CubismPhysicsOutput{constructor(){xt(this,"destination");xt(this,"destinationParameterIndex");xt(this,"vertexIndex");xt(this,"translationScale");xt(this,"angleScale");xt(this,"weight");xt(this,"type");xt(this,"reflect");xt(this,"valueBelowMinimum");xt(this,"valueExceededMaximum");xt(this,"getValue");xt(this,"getScale");this.destination=new CubismPhysicsParameter,this.translationScale=new CubismVector2(0,0)}}class CubismPhysicsRig{constructor(){xt(this,"subRigCount");xt(this,"settings");xt(this,"inputs");xt(this,"outputs");xt(this,"particles");xt(this,"gravity");xt(this,"wind");xt(this,"fps");this.settings=new csmVector,this.inputs=new csmVector,this.outputs=new csmVector,this.particles=new csmVector,this.gravity=new CubismVector2(0,0),this.wind=new CubismVector2(0,0),this.fps=0}}var Live2DCubismFramework$a;(i=>{i.CubismPhysicsInput=CubismPhysicsInput,i.CubismPhysicsNormalization=CubismPhysicsNormalization,i.CubismPhysicsOutput=CubismPhysicsOutput,i.CubismPhysicsParameter=CubismPhysicsParameter,i.CubismPhysicsParticle=CubismPhysicsParticle,i.CubismPhysicsRig=CubismPhysicsRig,i.CubismPhysicsSource=CubismPhysicsSource,i.CubismPhysicsSubRig=CubismPhysicsSubRig,i.CubismPhysicsTargetType=CubismPhysicsTargetType,i.PhysicsJsonEffectiveForces=PhysicsJsonEffectiveForces})(Live2DCubismFramework$a||(Live2DCubismFramework$a={}));const Position="Position",X="X",Y="Y",Angle="Angle",Type="Type",Id$1="Id",Meta$1="Meta",EffectiveForces="EffectiveForces",TotalInputCount="TotalInputCount",TotalOutputCount="TotalOutputCount",PhysicsSettingCount="PhysicsSettingCount",Gravity="Gravity",Wind="Wind",VertexCount="VertexCount",Fps="Fps",PhysicsSettings="PhysicsSettings",Normalization="Normalization",Minimum="Minimum",Maximum="Maximum",Default="Default",Reflect$1="Reflect",Weight="Weight",Input="Input",Source="Source",Output="Output",Scale="Scale",VertexIndex="VertexIndex",Destination="Destination",Vertices="Vertices",Mobility="Mobility",Delay="Delay",Radius="Radius",Acceleration="Acceleration";class CubismPhysicsJson{constructor(o,s){xt(this,"_json");this._json=CubismJson.create(o,s)}release(){CubismJson.delete(this._json)}getGravity(){const o=new CubismVector2(0,0);return o.x=this._json.getRoot().getValueByString(Meta$1).getValueByString(EffectiveForces).getValueByString(Gravity).getValueByString(X).toFloat(),o.y=this._json.getRoot().getValueByString(Meta$1).getValueByString(EffectiveForces).getValueByString(Gravity).getValueByString(Y).toFloat(),o}getWind(){const o=new CubismVector2(0,0);return o.x=this._json.getRoot().getValueByString(Meta$1).getValueByString(EffectiveForces).getValueByString(Wind).getValueByString(X).toFloat(),o.y=this._json.getRoot().getValueByString(Meta$1).getValueByString(EffectiveForces).getValueByString(Wind).getValueByString(Y).toFloat(),o}getFps(){return this._json.getRoot().getValueByString(Meta$1).getValueByString(Fps).toFloat(0)}getSubRigCount(){return this._json.getRoot().getValueByString(Meta$1).getValueByString(PhysicsSettingCount).toInt()}getTotalInputCount(){return this._json.getRoot().getValueByString(Meta$1).getValueByString(TotalInputCount).toInt()}getTotalOutputCount(){return this._json.getRoot().getValueByString(Meta$1).getValueByString(TotalOutputCount).toInt()}getVertexCount(){return this._json.getRoot().getValueByString(Meta$1).getValueByString(VertexCount).toInt()}getNormalizationPositionMinimumValue(o){return this._json.getRoot().getValueByString(PhysicsSettings).getValueByIndex(o).getValueByString(Normalization).getValueByString(Position).getValueByString(Minimum).toFloat()}getNormalizationPositionMaximumValue(o){return this._json.getRoot().getValueByString(PhysicsSettings).getValueByIndex(o).getValueByString(Normalization).getValueByString(Position).getValueByString(Maximum).toFloat()}getNormalizationPositionDefaultValue(o){return this._json.getRoot().getValueByString(PhysicsSettings).getValueByIndex(o).getValueByString(Normalization).getValueByString(Position).getValueByString(Default).toFloat()}getNormalizationAngleMinimumValue(o){return this._json.getRoot().getValueByString(PhysicsSettings).getValueByIndex(o).getValueByString(Normalization).getValueByString(Angle).getValueByString(Minimum).toFloat()}getNormalizationAngleMaximumValue(o){return this._json.getRoot().getValueByString(PhysicsSettings).getValueByIndex(o).getValueByString(Normalization).getValueByString(Angle).getValueByString(Maximum).toFloat()}getNormalizationAngleDefaultValue(o){return this._json.getRoot().getValueByString(PhysicsSettings).getValueByIndex(o).getValueByString(Normalization).getValueByString(Angle).getValueByString(Default).toFloat()}getInputCount(o){return this._json.getRoot().getValueByString(PhysicsSettings).getValueByIndex(o).getValueByString(Input).getVector().getSize()}getInputWeight(o,s){return this._json.getRoot().getValueByString(PhysicsSettings).getValueByIndex(o).getValueByString(Input).getValueByIndex(s).getValueByString(Weight).toFloat()}getInputReflect(o,s){return this._json.getRoot().getValueByString(PhysicsSettings).getValueByIndex(o).getValueByString(Input).getValueByIndex(s).getValueByString(Reflect$1).toBoolean()}getInputType(o,s){return this._json.getRoot().getValueByString(PhysicsSettings).getValueByIndex(o).getValueByString(Input).getValueByIndex(s).getValueByString(Type).getRawString()}getInputSourceId(o,s){return CubismFramework.getIdManager().getId(this._json.getRoot().getValueByString(PhysicsSettings).getValueByIndex(o).getValueByString(Input).getValueByIndex(s).getValueByString(Source).getValueByString(Id$1).getRawString())}getOutputCount(o){return this._json.getRoot().getValueByString(PhysicsSettings).getValueByIndex(o).getValueByString(Output).getVector().getSize()}getOutputVertexIndex(o,s){return this._json.getRoot().getValueByString(PhysicsSettings).getValueByIndex(o).getValueByString(Output).getValueByIndex(s).getValueByString(VertexIndex).toInt()}getOutputAngleScale(o,s){return this._json.getRoot().getValueByString(PhysicsSettings).getValueByIndex(o).getValueByString(Output).getValueByIndex(s).getValueByString(Scale).toFloat()}getOutputWeight(o,s){return this._json.getRoot().getValueByString(PhysicsSettings).getValueByIndex(o).getValueByString(Output).getValueByIndex(s).getValueByString(Weight).toFloat()}getOutputDestinationId(o,s){return CubismFramework.getIdManager().getId(this._json.getRoot().getValueByString(PhysicsSettings).getValueByIndex(o).getValueByString(Output).getValueByIndex(s).getValueByString(Destination).getValueByString(Id$1).getRawString())}getOutputType(o,s){return this._json.getRoot().getValueByString(PhysicsSettings).getValueByIndex(o).getValueByString(Output).getValueByIndex(s).getValueByString(Type).getRawString()}getOutputReflect(o,s){return this._json.getRoot().getValueByString(PhysicsSettings).getValueByIndex(o).getValueByString(Output).getValueByIndex(s).getValueByString(Reflect$1).toBoolean()}getParticleCount(o){return this._json.getRoot().getValueByString(PhysicsSettings).getValueByIndex(o).getValueByString(Vertices).getVector().getSize()}getParticleMobility(o,s){return this._json.getRoot().getValueByString(PhysicsSettings).getValueByIndex(o).getValueByString(Vertices).getValueByIndex(s).getValueByString(Mobility).toFloat()}getParticleDelay(o,s){return this._json.getRoot().getValueByString(PhysicsSettings).getValueByIndex(o).getValueByString(Vertices).getValueByIndex(s).getValueByString(Delay).toFloat()}getParticleAcceleration(o,s){return this._json.getRoot().getValueByString(PhysicsSettings).getValueByIndex(o).getValueByString(Vertices).getValueByIndex(s).getValueByString(Acceleration).toFloat()}getParticleRadius(o,s){return this._json.getRoot().getValueByString(PhysicsSettings).getValueByIndex(o).getValueByString(Vertices).getValueByIndex(s).getValueByString(Radius).toFloat()}getParticlePosition(o,s){const a=new CubismVector2(0,0);return a.x=this._json.getRoot().getValueByString(PhysicsSettings).getValueByIndex(o).getValueByString(Vertices).getValueByIndex(s).getValueByString(Position).getValueByString(X).toFloat(),a.y=this._json.getRoot().getValueByString(PhysicsSettings).getValueByIndex(o).getValueByString(Vertices).getValueByIndex(s).getValueByString(Position).getValueByString(Y).toFloat(),a}}var Live2DCubismFramework$9;(i=>{i.CubismPhysicsJson=CubismPhysicsJson})(Live2DCubismFramework$9||(Live2DCubismFramework$9={}));const PhysicsTypeTagX="X",PhysicsTypeTagY="Y",PhysicsTypeTagAngle="Angle",AirResistance=5,MaximumWeight=100,MovementThreshold=.001,MaxDeltaTime=5;class CubismPhysics{constructor(){xt(this,"_physicsRig");xt(this,"_options");xt(this,"_currentRigOutputs");xt(this,"_previousRigOutputs");xt(this,"_currentRemainTime");xt(this,"_parameterCaches");xt(this,"_parameterInputCaches");this._physicsRig=null,this._options=new Options,this._options.gravity.y=-1,this._options.gravity.x=0,this._options.wind.x=0,this._options.wind.y=0,this._currentRigOutputs=new csmVector,this._previousRigOutputs=new csmVector,this._currentRemainTime=0,this._parameterCaches=null,this._parameterInputCaches=null}static create(o,s){const a=new CubismPhysics;return a.parse(o,s),a._physicsRig.gravity.y=0,a}static delete(o){o!=null&&(o.release(),o=null)}parse(o,s){this._physicsRig=new CubismPhysicsRig;let a=new CubismPhysicsJson(o,s);this._physicsRig.gravity=a.getGravity(),this._physicsRig.wind=a.getWind(),this._physicsRig.subRigCount=a.getSubRigCount(),this._physicsRig.fps=a.getFps(),this._physicsRig.settings.updateSize(this._physicsRig.subRigCount,CubismPhysicsSubRig,!0),this._physicsRig.inputs.updateSize(a.getTotalInputCount(),CubismPhysicsInput,!0),this._physicsRig.outputs.updateSize(a.getTotalOutputCount(),CubismPhysicsOutput,!0),this._physicsRig.particles.updateSize(a.getVertexCount(),CubismPhysicsParticle,!0),this._currentRigOutputs.clear(),this._previousRigOutputs.clear();let _=0,$=0,_e=0;for(let tt=0;tt=tt.particleCount)continue;let ft=new CubismVector2;ft=nt[dt].position.substract(nt[dt-1].position),$=it[ct].getValue(ft,nt,dt,it[ct].reflect,this._options.gravity),this._currentRigOutputs.at(ut).outputs.set(ct,$),this._previousRigOutputs.at(ut).outputs.set(ct,$);const ht=it[ct].destinationParameterIndex,bt=!Float32Array.prototype.slice&&"subarray"in Float32Array.prototype?JSON.parse(JSON.stringify(et.subarray(ht))):et.slice(ht);updateOutputParameterValue(bt,rt[ht],j[ht],$,it[ct]);for(let yt=ht,mt=0;yt=s)return;const j=o.getModel().parameters.values,rt=o.getModel().parameters.maximumValues,ot=o.getModel().parameters.minimumValues,at=o.getModel().parameters.defaultValues;let lt;if(this._currentRemainTime+=s,this._currentRemainTime>MaxDeltaTime&&(this._currentRemainTime=0),(((ct=this._parameterCaches)==null?void 0:ct.length)??0)0?lt=1/this._physicsRig.fps:lt=s;this._currentRemainTime>=lt;){for(let ht=0;ht=st.particleCount)continue;const mt=new CubismVector2;mt.x=et[yt].position.x-et[yt-1].position.x,mt.y=et[yt].position.y-et[yt-1].position.y,_e=nt[bt].getValue(mt,et,yt,nt[bt].reflect,this._options.gravity),this._currentRigOutputs.at(ht).outputs.set(bt,_e);const gt=nt[bt].destinationParameterIndex,vt=!Float32Array.prototype.slice&&"subarray"in Float32Array.prototype?JSON.parse(JSON.stringify(this._parameterCaches.subarray(gt))):this._parameterCaches.slice(gt);updateOutputParameterValue(vt,ot[gt],rt[gt],_e,nt[bt]);for(let wt=gt,Ct=0;wt0?o=1:i<0&&(o=-1),o}function getInputTranslationXFromNormalizedParameterValue(i,o,s,a,_,$,_e,tt,st,it){i.x+=normalizeParameterValue(s,a,_,$,_e.minimum,_e.maximum,_e.defalut,st)*it}function getInputTranslationYFromNormalizedParamterValue(i,o,s,a,_,$,_e,tt,st,it){i.y+=normalizeParameterValue(s,a,_,$,_e.minimum,_e.maximum,_e.defalut,st)*it}function getInputAngleFromNormalizedParameterValue(i,o,s,a,_,$,_e,tt,st,it){o.angle+=normalizeParameterValue(s,a,_,$,tt.minimum,tt.maximum,tt.defalut,st)*it}function getOutputTranslationX(i,o,s,a,_){let $=i.x;return a&&($*=-1),$}function getOutputTranslationY(i,o,s,a,_){let $=i.y;return a&&($*=-1),$}function getOutputAngle(i,o,s,a,_){let $;return s>=2?_=o[s-1].position.substract(o[s-2].position):_=_.multiplyByScaler(-1),$=CubismMath.directionToRadian(_,i),a&&($*=-1),$}function getRangeValue(i,o){const s=CubismMath.max(i,o),a=CubismMath.min(i,o);return CubismMath.abs(s-a)}function getDefaultValue(i,o){return CubismMath.min(i,o)+getRangeValue(i,o)/2}function getOutputScaleTranslationX(i,o){return JSON.parse(JSON.stringify(i.x))}function getOutputScaleTranslationY(i,o){return JSON.parse(JSON.stringify(i.y))}function getOutputScaleAngle(i,o){return JSON.parse(JSON.stringify(o))}function updateParticles(i,o,s,a,_,$,_e,tt){let st,it,nt=new CubismVector2(0,0),et=new CubismVector2(0,0),j=new CubismVector2(0,0),rt=new CubismVector2(0,0);i[0].position=new CubismVector2(s.x,s.y);const ot=CubismMath.degreesToRadian(a),at=CubismMath.radianToDirection(ot);at.normalize();for(let lt=1;lts&&($>_.valueExceededMaximum&&(_.valueExceededMaximum=$),$=s);const tt=_.weight/MaximumWeight;tt>=1||($=i[0]*(1-tt)+$*tt),i[0]=$}function normalizeParameterValue(i,o,s,a,_,$,_e,tt){let st=0;const it=CubismMath.max(s,o);iti&&(i=nt);const et=CubismMath.min(_,$),j=CubismMath.max(_,$),rt=_e,ot=getDefaultValue(nt,it),at=i-ot;switch(sign(at)){case 1:{const lt=j-rt,ut=it-ot;ut!=0&&(st=at*(lt/ut),st+=rt);break}case-1:{const lt=et-rt,ut=nt-ot;ut!=0&&(st=at*(lt/ut),st+=rt);break}case 0:{st=rt;break}}return tt?st:st*-1}var Live2DCubismFramework$8;(i=>{i.CubismPhysics=CubismPhysics,i.Options=Options})(Live2DCubismFramework$8||(Live2DCubismFramework$8={}));const ColorChannelCount=4,ClippingMaskMaxCountOnDefault=36,ClippingMaskMaxCountOnMultiRenderTexture=32;class CubismClippingManager{constructor(o){xt(this,"_clearedFrameBufferFlags");xt(this,"_channelColors");xt(this,"_clippingContextListForMask");xt(this,"_clippingContextListForDraw");xt(this,"_clippingMaskBufferSize");xt(this,"_renderTextureCount");xt(this,"_tmpMatrix");xt(this,"_tmpMatrixForMask");xt(this,"_tmpMatrixForDraw");xt(this,"_tmpBoundsOnModel");xt(this,"_clippingContexttConstructor");this._renderTextureCount=0,this._clippingMaskBufferSize=256,this._clippingContextListForMask=new csmVector,this._clippingContextListForDraw=new csmVector,this._channelColors=new csmVector,this._tmpBoundsOnModel=new csmRect,this._tmpMatrix=new CubismMatrix44,this._tmpMatrixForMask=new CubismMatrix44,this._tmpMatrixForDraw=new CubismMatrix44,this._clippingContexttConstructor=o;let s=new CubismTextureColor;s.r=1,s.g=0,s.b=0,s.a=0,this._channelColors.pushBack(s),s=new CubismTextureColor,s.r=0,s.g=1,s.b=0,s.a=0,this._channelColors.pushBack(s),s=new CubismTextureColor,s.r=0,s.g=0,s.b=1,s.a=0,this._channelColors.pushBack(s),s=new CubismTextureColor,s.r=0,s.g=0,s.b=0,s.a=1,this._channelColors.pushBack(s)}release(){for(let o=0;o0){if(this.setupLayoutBounds(0),this._clearedFrameBufferFlags.getSize()!=this._renderTextureCount){this._clearedFrameBufferFlags.clear();for(let _=0;_rt?(this._tmpBoundsOnModel.expand(_e.width*st,0),it=tt.width/this._tmpBoundsOnModel.width):it=et/rt,this._tmpBoundsOnModel.height*et>ot?(this._tmpBoundsOnModel.expand(0,_e.height*st),nt=tt.height/this._tmpBoundsOnModel.height):nt=et/ot,this.createMatrixForMask(s,tt,it,nt),$._matrixForMask.setMatrix(this._tmpMatrixForMask.getArray()),$._matrixForDraw.setMatrix(this._tmpMatrixForDraw.getArray())}}}createMatrixForMask(o,s,a,_){this._tmpMatrix.loadIdentity(),this._tmpMatrix.translateRelative(-1,-1),this._tmpMatrix.scaleRelative(2,2),this._tmpMatrix.translateRelative(s.x,s.y),this._tmpMatrix.scaleRelative(a,_),this._tmpMatrix.translateRelative(-this._tmpBoundsOnModel.x,-this._tmpBoundsOnModel.y),this._tmpMatrixForMask.setMatrix(this._tmpMatrix.getArray()),this._tmpMatrix.loadIdentity(),this._tmpMatrix.translateRelative(s.x,s.y*(o?-1:1)),this._tmpMatrix.scaleRelative(a,_*(o?-1:1)),this._tmpMatrix.translateRelative(-this._tmpBoundsOnModel.x,-this._tmpBoundsOnModel.y),this._tmpMatrixForDraw.setMatrix(this._tmpMatrix.getArray())}setupLayoutBounds(o){const s=this._renderTextureCount<=1?ClippingMaskMaxCountOnDefault:ClippingMaskMaxCountOnMultiRenderTexture*this._renderTextureCount;if(o<=0||o>s){o>s&&CubismLogError(`not supported mask count : {0} +[Details] render texture count : {1}, mask count : {2}`,o-s,this._renderTextureCount,o);for(let it=0;it0&&(et-=it<$?0:1),et!=0)if(et==1){const rt=this._clippingContextListForMask.at(st++);rt._layoutChannelIndex=nt,rt._layoutBounds.x=0,rt._layoutBounds.y=0,rt._layoutBounds.width=1,rt._layoutBounds.height=1,rt._bufferIndex=it}else if(et==2)for(let rt=0;rtot&&(ot=ct),dtat&&(at=dt)}if(j!=Number.MAX_VALUE)if(j$&&($=ot),at>_e&&(_e=at),a==Number.MAX_VALUE)s._allClippedDrawRect.x=0,s._allClippedDrawRect.y=0,s._allClippedDrawRect.width=0,s._allClippedDrawRect.height=0,s._isUsing=!1;else{s._isUsing=!0;const ut=$-a,ct=_e-_;s._allClippedDrawRect.x=a,s._allClippedDrawRect.y=_,s._allClippedDrawRect.width=ut,s._allClippedDrawRect.height=ct}}}getClippingContextListForDraw(){return this._clippingContextListForDraw}getClippingMaskBufferSize(){return this._clippingMaskBufferSize}getRenderTextureCount(){return this._renderTextureCount}getChannelFlagAsColor(o){return this._channelColors.at(o)}setClippingMaskBufferSize(o){this._clippingMaskBufferSize=o}}let s_instance$3;const ShaderCount=10;class CubismShader_WebGL{constructor(){xt(this,"_shaderSets");xt(this,"gl");this._shaderSets=new csmVector}static getInstance(){return s_instance$3==null&&(s_instance$3=new CubismShader_WebGL),s_instance$3}static deleteInstance(){s_instance$3&&(s_instance$3.release(),s_instance$3=null)}release(){this.releaseShaderProgram()}setupShaderProgramForDraw(o,s,a){o.isPremultipliedAlpha()||CubismLogError("NoPremultipliedAlpha is not allowed"),this._shaderSets.getSize()==0&&this.generateShaders();let _,$,_e,tt;const st=o.getClippingContextBufferForDraw()!=null,it=s.getDrawableInvertedMaskBit(a),nt=st?it?2:1:0;let et;switch(s.getDrawableBlendMode(a)){case CubismBlendMode.CubismBlendMode_Normal:default:et=this._shaderSets.at(1+nt),_=this.gl.ONE,$=this.gl.ONE_MINUS_SRC_ALPHA,_e=this.gl.ONE,tt=this.gl.ONE_MINUS_SRC_ALPHA;break;case CubismBlendMode.CubismBlendMode_Additive:et=this._shaderSets.at(4+nt),_=this.gl.ONE,$=this.gl.ONE,_e=this.gl.ZERO,tt=this.gl.ONE;break;case CubismBlendMode.CubismBlendMode_Multiplicative:et=this._shaderSets.at(7+nt),_=this.gl.DST_COLOR,$=this.gl.ONE_MINUS_SRC_ALPHA,_e=this.gl.ZERO,tt=this.gl.ONE;break}this.gl.useProgram(et.shaderProgram),o._bufferData.vertex==null&&(o._bufferData.vertex=this.gl.createBuffer()),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,o._bufferData.vertex);const j=s.getDrawableVertices(a);this.gl.bufferData(this.gl.ARRAY_BUFFER,j,this.gl.DYNAMIC_DRAW),this.gl.enableVertexAttribArray(et.attributePositionLocation),this.gl.vertexAttribPointer(et.attributePositionLocation,2,this.gl.FLOAT,!1,0,0),o._bufferData.uv==null&&(o._bufferData.uv=this.gl.createBuffer()),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,o._bufferData.uv);const rt=s.getDrawableVertexUvs(a);if(this.gl.bufferData(this.gl.ARRAY_BUFFER,rt,this.gl.DYNAMIC_DRAW),this.gl.enableVertexAttribArray(et.attributeTexCoordLocation),this.gl.vertexAttribPointer(et.attributeTexCoordLocation,2,this.gl.FLOAT,!1,0,0),st){this.gl.activeTexture(this.gl.TEXTURE1);const ht=o.getClippingContextBufferForDraw().getClippingManager().getColorBuffer().at(o.getClippingContextBufferForDraw()._bufferIndex);this.gl.bindTexture(this.gl.TEXTURE_2D,ht),this.gl.uniform1i(et.samplerTexture1Location,1),this.gl.uniformMatrix4fv(et.uniformClipMatrixLocation,!1,o.getClippingContextBufferForDraw()._matrixForDraw.getArray());const bt=o.getClippingContextBufferForDraw()._layoutChannelIndex,yt=o.getClippingContextBufferForDraw().getClippingManager().getChannelFlagAsColor(bt);this.gl.uniform4f(et.uniformChannelFlagLocation,yt.r,yt.g,yt.b,yt.a)}const ot=s.getDrawableTextureIndex(a),at=o.getBindedTextures().getValue(ot);this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,at),this.gl.uniform1i(et.samplerTexture0Location,0);const lt=o.getMvpMatrix();this.gl.uniformMatrix4fv(et.uniformMatrixLocation,!1,lt.getArray());const ut=o.getModelColorWithOpacity(s.getDrawableOpacity(a)),ct=s.getMultiplyColor(a),dt=s.getScreenColor(a);this.gl.uniform4f(et.uniformBaseColorLocation,ut.r,ut.g,ut.b,ut.a),this.gl.uniform4f(et.uniformMultiplyColorLocation,ct.r,ct.g,ct.b,ct.a),this.gl.uniform4f(et.uniformScreenColorLocation,dt.r,dt.g,dt.b,dt.a),o._bufferData.index==null&&(o._bufferData.index=this.gl.createBuffer());const ft=s.getDrawableVertexIndices(a);this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,o._bufferData.index),this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER,ft,this.gl.DYNAMIC_DRAW),this.gl.blendFuncSeparate(_,$,_e,tt)}setupShaderProgramForMask(o,s,a){o.isPremultipliedAlpha()||CubismLogError("NoPremultipliedAlpha is not allowed"),this._shaderSets.getSize()==0&&this.generateShaders();const _=this._shaderSets.at(0);this.gl.useProgram(_.shaderProgram),o._bufferData.vertex==null&&(o._bufferData.vertex=this.gl.createBuffer()),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,o._bufferData.vertex);const $=s.getDrawableVertices(a);this.gl.bufferData(this.gl.ARRAY_BUFFER,$,this.gl.DYNAMIC_DRAW),this.gl.enableVertexAttribArray(_.attributePositionLocation),this.gl.vertexAttribPointer(_.attributePositionLocation,2,this.gl.FLOAT,!1,0,0),o._bufferData.uv==null&&(o._bufferData.uv=this.gl.createBuffer()),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,o._bufferData.uv);const _e=s.getDrawableTextureIndex(a),tt=o.getBindedTextures().getValue(_e);this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,tt),this.gl.uniform1i(_.samplerTexture0Location,0),o._bufferData.uv==null&&(o._bufferData.uv=this.gl.createBuffer()),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,o._bufferData.uv);const st=s.getDrawableVertexUvs(a);this.gl.bufferData(this.gl.ARRAY_BUFFER,st,this.gl.DYNAMIC_DRAW),this.gl.enableVertexAttribArray(_.attributeTexCoordLocation),this.gl.vertexAttribPointer(_.attributeTexCoordLocation,2,this.gl.FLOAT,!1,0,0),o.getClippingContextBufferForMask();const it=o.getClippingContextBufferForMask()._layoutChannelIndex,nt=o.getClippingContextBufferForMask().getClippingManager().getChannelFlagAsColor(it);this.gl.uniform4f(_.uniformChannelFlagLocation,nt.r,nt.g,nt.b,nt.a),this.gl.uniformMatrix4fv(_.uniformClipMatrixLocation,!1,o.getClippingContextBufferForMask()._matrixForMask.getArray());const et=o.getClippingContextBufferForMask()._layoutBounds;this.gl.uniform4f(_.uniformBaseColorLocation,et.x*2-1,et.y*2-1,et.getRight()*2-1,et.getBottom()*2-1);const j=s.getMultiplyColor(a),rt=s.getScreenColor(a);this.gl.uniform4f(_.uniformMultiplyColorLocation,j.r,j.g,j.b,j.a),this.gl.uniform4f(_.uniformScreenColorLocation,rt.r,rt.g,rt.b,rt.a);const ot=this.gl.ZERO,at=this.gl.ONE_MINUS_SRC_COLOR,lt=this.gl.ZERO,ut=this.gl.ONE_MINUS_SRC_ALPHA;o._bufferData.index==null&&(o._bufferData.index=this.gl.createBuffer());const ct=s.getDrawableVertexIndices(a);this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,o._bufferData.index),this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER,ct,this.gl.DYNAMIC_DRAW),this.gl.blendFuncSeparate(ot,at,lt,ut)}releaseShaderProgram(){for(let o=0;o(i[i.ShaderNames_SetupMask=0]="ShaderNames_SetupMask",i[i.ShaderNames_NormalPremultipliedAlpha=1]="ShaderNames_NormalPremultipliedAlpha",i[i.ShaderNames_NormalMaskedPremultipliedAlpha=2]="ShaderNames_NormalMaskedPremultipliedAlpha",i[i.ShaderNames_NomralMaskedInvertedPremultipliedAlpha=3]="ShaderNames_NomralMaskedInvertedPremultipliedAlpha",i[i.ShaderNames_AddPremultipliedAlpha=4]="ShaderNames_AddPremultipliedAlpha",i[i.ShaderNames_AddMaskedPremultipliedAlpha=5]="ShaderNames_AddMaskedPremultipliedAlpha",i[i.ShaderNames_AddMaskedPremultipliedAlphaInverted=6]="ShaderNames_AddMaskedPremultipliedAlphaInverted",i[i.ShaderNames_MultPremultipliedAlpha=7]="ShaderNames_MultPremultipliedAlpha",i[i.ShaderNames_MultMaskedPremultipliedAlpha=8]="ShaderNames_MultMaskedPremultipliedAlpha",i[i.ShaderNames_MultMaskedPremultipliedAlphaInverted=9]="ShaderNames_MultMaskedPremultipliedAlphaInverted",i))(ShaderNames||{});const vertexShaderSrcSetupMask="attribute vec4 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;varying vec4 v_myPos;uniform mat4 u_clipMatrix;void main(){ gl_Position = u_clipMatrix * a_position; v_myPos = u_clipMatrix * a_position; v_texCoord = a_texCoord; v_texCoord.y = 1.0 - v_texCoord.y;}",fragmentShaderSrcsetupMask="precision mediump float;varying vec2 v_texCoord;varying vec4 v_myPos;uniform vec4 u_baseColor;uniform vec4 u_channelFlag;uniform sampler2D s_texture0;void main(){ float isInside = step(u_baseColor.x, v_myPos.x/v_myPos.w) * step(u_baseColor.y, v_myPos.y/v_myPos.w) * step(v_myPos.x/v_myPos.w, u_baseColor.z) * step(v_myPos.y/v_myPos.w, u_baseColor.w); gl_FragColor = u_channelFlag * texture2D(s_texture0, v_texCoord).a * isInside;}",vertexShaderSrc="attribute vec4 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;uniform mat4 u_matrix;void main(){ gl_Position = u_matrix * a_position; v_texCoord = a_texCoord; v_texCoord.y = 1.0 - v_texCoord.y;}",vertexShaderSrcMasked="attribute vec4 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;varying vec4 v_clipPos;uniform mat4 u_matrix;uniform mat4 u_clipMatrix;void main(){ gl_Position = u_matrix * a_position; v_clipPos = u_clipMatrix * a_position; v_texCoord = a_texCoord; v_texCoord.y = 1.0 - v_texCoord.y;}",fragmentShaderSrcPremultipliedAlpha="precision mediump float;varying vec2 v_texCoord;uniform vec4 u_baseColor;uniform sampler2D s_texture0;uniform vec4 u_multiplyColor;uniform vec4 u_screenColor;void main(){ vec4 texColor = texture2D(s_texture0, v_texCoord); texColor.rgb = texColor.rgb * u_multiplyColor.rgb; texColor.rgb = (texColor.rgb + u_screenColor.rgb * texColor.a) - (texColor.rgb * u_screenColor.rgb); vec4 color = texColor * u_baseColor; gl_FragColor = vec4(color.rgb, color.a);}",fragmentShaderSrcMaskPremultipliedAlpha="precision mediump float;varying vec2 v_texCoord;varying vec4 v_clipPos;uniform vec4 u_baseColor;uniform vec4 u_channelFlag;uniform sampler2D s_texture0;uniform sampler2D s_texture1;uniform vec4 u_multiplyColor;uniform vec4 u_screenColor;void main(){ vec4 texColor = texture2D(s_texture0, v_texCoord); texColor.rgb = texColor.rgb * u_multiplyColor.rgb; texColor.rgb = (texColor.rgb + u_screenColor.rgb * texColor.a) - (texColor.rgb * u_screenColor.rgb); vec4 col_formask = texColor * u_baseColor; vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag; float maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a; col_formask = col_formask * maskVal; gl_FragColor = col_formask;}",fragmentShaderSrcMaskInvertedPremultipliedAlpha="precision mediump float;varying vec2 v_texCoord;varying vec4 v_clipPos;uniform sampler2D s_texture0;uniform sampler2D s_texture1;uniform vec4 u_channelFlag;uniform vec4 u_baseColor;uniform vec4 u_multiplyColor;uniform vec4 u_screenColor;void main(){ vec4 texColor = texture2D(s_texture0, v_texCoord); texColor.rgb = texColor.rgb * u_multiplyColor.rgb; texColor.rgb = (texColor.rgb + u_screenColor.rgb * texColor.a) - (texColor.rgb * u_screenColor.rgb); vec4 col_formask = texColor * u_baseColor; vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag; float maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a; col_formask = col_formask * (1.0 - maskVal); gl_FragColor = col_formask;}";var Live2DCubismFramework$7;(i=>{i.CubismShaderSet=CubismShaderSet,i.CubismShader_WebGL=CubismShader_WebGL,i.ShaderNames=ShaderNames})(Live2DCubismFramework$7||(Live2DCubismFramework$7={}));let s_viewport,s_fbo;class CubismClippingManager_WebGL extends CubismClippingManager{constructor(){super(CubismClippingContext_WebGL);xt(this,"_currentMaskRenderTexture");xt(this,"_maskRenderTextures");xt(this,"_maskColorBuffers");xt(this,"_currentFrameNo");xt(this,"_maskTexture");xt(this,"gl")}getMaskRenderTexture(){if(this._maskTexture&&this._maskTexture.textures!=null)this._maskTexture.frameNo=this._currentFrameNo;else{this._maskRenderTextures!=null&&this._maskRenderTextures.clear(),this._maskRenderTextures=new csmVector,this._maskColorBuffers!=null&&this._maskColorBuffers.clear(),this._maskColorBuffers=new csmVector;const s=this._clippingMaskBufferSize;for(let a=0;a0){this.gl.viewport(0,0,this._clippingMaskBufferSize,this._clippingMaskBufferSize),this._currentMaskRenderTexture=this.getMaskRenderTexture().at(0),a.preDraw(),this.setupLayoutBounds(_),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this._currentMaskRenderTexture),this._clearedFrameBufferFlags.getSize()!=this._renderTextureCount&&(this._clearedFrameBufferFlags.clear(),this._clearedFrameBufferFlags=new csmVector(this._renderTextureCount));for(let $=0;$0&&this._extension)for(let s=0;s{CubismRenderer_WebGL.doStaticRelease()};var Live2DCubismFramework$6;(i=>{i.CubismClippingContext=CubismClippingContext_WebGL,i.CubismClippingManager_WebGL=CubismClippingManager_WebGL,i.CubismRenderTextureResource=CubismRenderTextureResource,i.CubismRenderer_WebGL=CubismRenderer_WebGL})(Live2DCubismFramework$6||(Live2DCubismFramework$6={}));class DrawableColorData{constructor(o=!1,s=new CubismTextureColor){xt(this,"isOverwritten");xt(this,"color");this.isOverwritten=o,this.color=s}}class PartColorData{constructor(o=!1,s=new CubismTextureColor){xt(this,"isOverwritten");xt(this,"color");this.isOverwritten=o,this.color=s}}class DrawableCullingData{constructor(o=!1,s=!1){xt(this,"isOverwritten");xt(this,"isCulling");this.isOverwritten=o,this.isCulling=s}}class CubismModel{constructor(o){xt(this,"_notExistPartOpacities");xt(this,"_notExistPartId");xt(this,"_notExistParameterValues");xt(this,"_notExistParameterId");xt(this,"_savedParameters");xt(this,"_isOverwrittenModelMultiplyColors");xt(this,"_isOverwrittenModelScreenColors");xt(this,"_userMultiplyColors");xt(this,"_userScreenColors");xt(this,"_userPartScreenColors");xt(this,"_userPartMultiplyColors");xt(this,"_partChildDrawables");xt(this,"_model");xt(this,"_parameterValues");xt(this,"_parameterMaximumValues");xt(this,"_parameterMinimumValues");xt(this,"_partOpacities");xt(this,"_modelOpacity");xt(this,"_parameterIds");xt(this,"_partIds");xt(this,"_drawableIds");xt(this,"_isOverwrittenCullings");xt(this,"_userCullings");this._model=o,this._parameterValues=null,this._parameterMaximumValues=null,this._parameterMinimumValues=null,this._partOpacities=null,this._savedParameters=new csmVector,this._parameterIds=new csmVector,this._drawableIds=new csmVector,this._partIds=new csmVector,this._isOverwrittenModelMultiplyColors=!1,this._isOverwrittenModelScreenColors=!1,this._isOverwrittenCullings=!1,this._modelOpacity=1,this._userMultiplyColors=new csmVector,this._userScreenColors=new csmVector,this._userCullings=new csmVector,this._userPartMultiplyColors=new csmVector,this._userPartScreenColors=new csmVector,this._partChildDrawables=new csmVector,this._notExistPartId=new csmMap,this._notExistParameterId=new csmMap,this._notExistParameterValues=new csmMap,this._notExistPartOpacities=new csmMap}update(){this._model.update(),this._model.drawables.resetDynamicFlags()}getPixelsPerUnit(){return this._model==null?0:this._model.canvasinfo.PixelsPerUnit}getCanvasWidth(){return this._model==null?0:this._model.canvasinfo.CanvasWidth/this._model.canvasinfo.PixelsPerUnit}getCanvasHeight(){return this._model==null?0:this._model.canvasinfo.CanvasHeight/this._model.canvasinfo.PixelsPerUnit}saveParameters(){const o=this._model.parameters.count,s=this._savedParameters.getSize();for(let a=0;as&&(s=this._model.parameters.minimumValues[o]),this._parameterValues[o]=a==1?s:this._parameterValues[o]=this._parameterValues[o]*(1-a)+s*a}setParameterValueById(o,s,a=1){const _=this.getParameterIndex(o);this.setParameterValueByIndex(_,s,a)}addParameterValueByIndex(o,s,a=1){this.setParameterValueByIndex(o,this.getParameterValueByIndex(o)+s*a)}addParameterValueById(o,s,a=1){const _=this.getParameterIndex(o);this.addParameterValueByIndex(_,s,a)}multiplyParameterValueById(o,s,a=1){const _=this.getParameterIndex(o);this.multiplyParameterValueByIndex(_,s,a)}multiplyParameterValueByIndex(o,s,a=1){this.setParameterValueByIndex(o,this.getParameterValueByIndex(o)*(1+(s-1)*a))}getDrawableIndex(o){const s=this._model.drawables.count;for(let a=0;as&&(o=s);for(let a=0;a=0&&this._partChildDrawables.at(nt).pushBack($)}}}release(){this._model.release(),this._model=null}}var Live2DCubismFramework$5;(i=>{i.CubismModel=CubismModel})(Live2DCubismFramework$5||(Live2DCubismFramework$5={}));class CubismMoc{constructor(o){xt(this,"_moc");xt(this,"_modelCount");xt(this,"_mocVersion");this._moc=o,this._modelCount=0,this._mocVersion=0}static create(o,s){let a=null;if(s&&!this.hasMocConsistency(o))return CubismLogError("Inconsistent MOC3."),a;const _=Live2DCubismCore.Moc.fromArrayBuffer(o);return _&&(a=new CubismMoc(_),a._mocVersion=Live2DCubismCore.Version.csmGetMocVersion(_,o)),a}static delete(o){o._moc._release(),o._moc=null,o=null}createModel(){let o=null;const s=Live2DCubismCore.Model.fromMoc(this._moc);return s&&(o=new CubismModel(s),o.initialize(),++this._modelCount),o}deleteModel(o){o!=null&&(o.release(),o=null,--this._modelCount)}release(){CSM_ASSERT(this._modelCount==0),this._moc._release(),this._moc=null}getLatestMocVersion(){return Live2DCubismCore.Version.csmGetLatestMocVersion()}getMocVersion(){return this._mocVersion}static hasMocConsistency(o){return Live2DCubismCore.Moc.prototype.hasMocConsistency(o)===1}}var Live2DCubismFramework$4;(i=>{i.CubismMoc=CubismMoc})(Live2DCubismFramework$4||(Live2DCubismFramework$4={}));const Meta="Meta",UserDataCount="UserDataCount",TotalUserDataSize="TotalUserDataSize",UserData="UserData",Target="Target",Id="Id",Value="Value";class CubismModelUserDataJson{constructor(o,s){xt(this,"_json");this._json=CubismJson.create(o,s)}release(){CubismJson.delete(this._json)}getUserDataCount(){return this._json.getRoot().getValueByString(Meta).getValueByString(UserDataCount).toInt()}getTotalUserDataSize(){return this._json.getRoot().getValueByString(Meta).getValueByString(TotalUserDataSize).toInt()}getUserDataTargetType(o){return this._json.getRoot().getValueByString(UserData).getValueByIndex(o).getValueByString(Target).getRawString()}getUserDataId(o){return CubismFramework.getIdManager().getId(this._json.getRoot().getValueByString(UserData).getValueByIndex(o).getValueByString(Id).getRawString())}getUserDataValue(o){return this._json.getRoot().getValueByString(UserData).getValueByIndex(o).getValueByString(Value).getRawString()}}var Live2DCubismFramework$3;(i=>{i.CubismModelUserDataJson=CubismModelUserDataJson})(Live2DCubismFramework$3||(Live2DCubismFramework$3={}));const ArtMesh="ArtMesh";class CubismModelUserDataNode{constructor(){xt(this,"targetType");xt(this,"targetId");xt(this,"value")}}class CubismModelUserData{constructor(){xt(this,"_userDataNodes");xt(this,"_artMeshUserDataNode");this._userDataNodes=new csmVector,this._artMeshUserDataNode=new csmVector}static create(o,s){const a=new CubismModelUserData;return a.parseUserData(o,s),a}static delete(o){o!=null&&(o.release(),o=null)}getArtMeshUserDatas(){return this._artMeshUserDataNode}parseUserData(o,s){let a=new CubismModelUserDataJson(o,s);if(!a){a.release(),a=void 0;return}const _=CubismFramework.getIdManager().getId(ArtMesh),$=a.getUserDataCount();for(let _e=0;_e<$;_e++){const tt=new CubismModelUserDataNode;tt.targetId=a.getUserDataId(_e),tt.targetType=CubismFramework.getIdManager().getId(a.getUserDataTargetType(_e)),tt.value=new csmString(a.getUserDataValue(_e)),this._userDataNodes.pushBack(tt),tt.targetType==_&&this._artMeshUserDataNode.pushBack(tt)}a.release(),a=void 0}release(){for(let o=0;o{i.CubismModelUserData=CubismModelUserData,i.CubismModelUserDataNode=CubismModelUserDataNode})(Live2DCubismFramework$2||(Live2DCubismFramework$2={}));class CubismUserModel{constructor(){xt(this,"_moc");xt(this,"_model");xt(this,"_motionManager");xt(this,"_expressionManager");xt(this,"_eyeBlink");xt(this,"_breath");xt(this,"_modelMatrix");xt(this,"_pose");xt(this,"_dragManager");xt(this,"_physics");xt(this,"_modelUserData");xt(this,"_initialized");xt(this,"_updating");xt(this,"_opacity");xt(this,"_lipsync");xt(this,"_lastLipSyncValue");xt(this,"_dragX");xt(this,"_dragY");xt(this,"_accelerationX");xt(this,"_accelerationY");xt(this,"_accelerationZ");xt(this,"_mocConsistency");xt(this,"_debugMode");xt(this,"_renderer");this._moc=null,this._model=null,this._motionManager=null,this._expressionManager=null,this._eyeBlink=null,this._breath=null,this._modelMatrix=null,this._pose=null,this._dragManager=null,this._physics=null,this._modelUserData=null,this._initialized=!1,this._updating=!1,this._opacity=1,this._lipsync=!0,this._lastLipSyncValue=0,this._dragX=0,this._dragY=0,this._accelerationX=0,this._accelerationY=0,this._accelerationZ=0,this._mocConsistency=!1,this._debugMode=!1,this._renderer=null,this._motionManager=new CubismMotionManager,this._motionManager.setEventCallback(CubismUserModel.cubismDefaultMotionEventCallback,this),this._expressionManager=new CubismExpressionMotionManager,this._dragManager=new CubismTargetPoint}isInitialized(){return this._initialized}setInitialized(o){this._initialized=o}isUpdating(){return this._updating}setUpdating(o){this._updating=o}setDragging(o,s){this._dragManager.set(o,s)}setAcceleration(o,s,a){this._accelerationX=o,this._accelerationY=s,this._accelerationZ=a}getModelMatrix(){return this._modelMatrix}setOpacity(o){this._opacity=o}getOpacity(){return this._opacity}loadModel(o,s=!1,a=1){if(this._moc=CubismMoc.create(o,s),this._moc==null){CubismLogError("Failed to CubismMoc.create().");return}if(this._model=this._moc.createModel(),this._model==null){CubismLogError("Failed to CreateModel().");return}this._model.saveParameters(),this._modelMatrix=new CubismModelMatrix(this._model.getCanvasWidth(),this._model.getCanvasHeight()),this._modelMatrix.scale(a,a)}loadMotion(o,s,a,_){return o==null||s==0?(CubismLogError("Failed to loadMotion()."),null):CubismMotion.create(o,s,_)}loadExpression(o,s,a){return o==null||s==0?(CubismLogError("Failed to loadExpression()."),null):CubismExpressionMotion.create(o,s)}loadPose(o,s){if(o==null||s==0){CubismLogError("Failed to loadPose().");return}this._pose=CubismPose.create(o,s)}loadUserData(o,s){if(o==null||s==0){CubismLogError("Failed to loadUserData().");return}this._modelUserData=CubismModelUserData.create(o,s)}loadPhysics(o,s){if(o==null||s==0){CubismLogError("Failed to loadPhysics().");return}this._physics=CubismPhysics.create(o,s)}isHit(o,s,a){const _=this._model.getDrawableIndex(o);if(_<0)return!1;const $=this._model.getDrawableVertexCount(_),_e=this._model.getDrawableVertices(_);let tt=_e[0],st=_e[0],it=_e[1],nt=_e[1];for(let rt=1;rt<$;++rt){const ot=_e[Constant.vertexOffset+rt*Constant.vertexStep],at=_e[Constant.vertexOffset+rt*Constant.vertexStep+1];otst&&(st=ot),atnt&&(nt=at)}const et=this._modelMatrix.invertTransformX(s),j=this._modelMatrix.invertTransformY(a);return tt<=et&&et<=st&&it<=j&&j<=nt}getModel(){return this._model}getRenderer(){return this._renderer}createRenderer(o=1){this._renderer&&this.deleteRenderer(),this._renderer=new CubismRenderer_WebGL,this._renderer.initialize(this._model,o)}deleteRenderer(){this._renderer!=null&&(this._renderer.release(),this._renderer=null)}motionEventFired(o){CubismLogInfo("{0}",o.s)}static cubismDefaultMotionEventCallback(o,s,a){const _=a;_!=null&&_.motionEventFired(s)}release(){this._motionManager!=null&&(this._motionManager.release(),this._motionManager=null),this._expressionManager!=null&&(this._expressionManager.release(),this._expressionManager=null),this._moc!=null&&(this._moc.deleteModel(this._model),this._moc.release(),this._moc=null),this._modelMatrix=null,CubismPose.delete(this._pose),CubismEyeBlink.delete(this._eyeBlink),CubismBreath.delete(this._breath),this._dragManager=null,CubismPhysics.delete(this._physics),CubismModelUserData.delete(this._modelUserData),this.deleteRenderer()}}var Live2DCubismFramework$1;(i=>{i.CubismUserModel=CubismUserModel})(Live2DCubismFramework$1||(Live2DCubismFramework$1={}));class LAppPal{static loadFileAsBytes(o,s){fetch(o).then(a=>a.arrayBuffer()).then(a=>s(a,a.byteLength))}static getDeltaTime(){return this.s_deltaTime}static updateTime(o=!0){this.s_currentFrame=Date.now(),this.s_deltaTime=(this.s_currentFrame-this.s_lastFrame)/1e3,o===!0&&(this.s_lastFrame=this.s_currentFrame)}static printMessage(o){console.log(o)}}xt(LAppPal,"lastUpdate",Date.now()),xt(LAppPal,"s_currentFrame",0),xt(LAppPal,"s_lastFrame",0),xt(LAppPal,"s_deltaTime",0);let s_instance$2=null;class LAppWavFileHandler{constructor(){xt(this,"_pcmData");xt(this,"_userTimeSeconds");xt(this,"_lastRms");xt(this,"_sampleOffset");xt(this,"_wavFileInfo");xt(this,"_byteReader");xt(this,"_loadFiletoBytes",(o,s)=>{this._byteReader._fileByte=o,this._byteReader._fileDataView=new DataView(this._byteReader._fileByte),this._byteReader._fileSize=s});this._pcmData=null,this._userTimeSeconds=0,this._lastRms=0,this._sampleOffset=0,this._wavFileInfo=new WavFileInfo,this._byteReader=new ByteReader}static getInstance(){return s_instance$2==null&&(s_instance$2=new LAppWavFileHandler),s_instance$2}static releaseInstance(){s_instance$2!=null&&(s_instance$2=void 0),s_instance$2=null}update(o){let s,a;if(this._pcmData==null||this._sampleOffset>=this._wavFileInfo._samplesPerChannel)return this._lastRms=0,!1;this._userTimeSeconds+=o,s=Math.floor(this._userTimeSeconds*this._wavFileInfo._samplingRate),s>this._wavFileInfo._samplesPerChannel&&(s=this._wavFileInfo._samplesPerChannel),a=0;for(let _=0;_{let a=!1;this._pcmData!=null&&this.releasePcmData();const _=async()=>fetch(o).then($=>$.arrayBuffer());(async()=>{if(this._byteReader._fileByte=await _(),this._byteReader._fileDataView=new DataView(this._byteReader._fileByte),this._byteReader._fileSize=this._byteReader._fileByte.byteLength,this._byteReader._readOffset=0,this._byteReader._fileByte==null||this._byteReader._fileSize<4){s(!1);return}this._wavFileInfo._fileName=o;try{if(!this._byteReader.getCheckSignature("RIFF"))throw a=!1,new Error('Cannot find Signeture "RIFF".');if(this._byteReader.get32LittleEndian(),!this._byteReader.getCheckSignature("WAVE"))throw a=!1,new Error('Cannot find Signeture "WAVE".');if(!this._byteReader.getCheckSignature("fmt "))throw a=!1,new Error('Cannot find Signeture "fmt".');const $=this._byteReader.get32LittleEndian();if(this._byteReader.get16LittleEndian()!=1)throw a=!1,new Error("File is not linear PCM.");for(this._wavFileInfo._numberOfChannels=this._byteReader.get16LittleEndian(),this._wavFileInfo._samplingRate=this._byteReader.get32LittleEndian(),this._byteReader.get32LittleEndian(),this._byteReader.get16LittleEndian(),this._wavFileInfo._bitsPerSample=this._byteReader.get16LittleEndian(),$>16&&(this._byteReader._readOffset+=$-16);!this._byteReader.getCheckSignature("data")&&this._byteReader._readOffset=this._byteReader._fileSize)throw a=!1,new Error('Cannot find "data" Chunk.');{const _e=this._byteReader.get32LittleEndian();this._wavFileInfo._samplesPerChannel=_e*8/(this._wavFileInfo._bitsPerSample*this._wavFileInfo._numberOfChannels)}this._pcmData=new Array(this._wavFileInfo._numberOfChannels);for(let _e=0;_e{s(a)})})}getPcmSample(){let o;switch(this._wavFileInfo._bitsPerSample){case 8:o=this._byteReader.get8()-128,o<<=24;break;case 16:o=this._byteReader.get16LittleEndian()<<16;break;case 24:o=this._byteReader.get24LittleEndian()<<8;break;default:o=0;break}return o/2147483647}getPcmDataChannel(o){return!this._pcmData||!(o_.arrayBuffer()).then(_=>{const $=new CubismModelSettingJson(_,_.byteLength);this._state=1,this.setupModel($)}).catch(_=>{CubismLogError(`Failed to load file ${this._modelHomeDir}${a}`)})}setupModel(s){this._updating=!0,this._initialized=!1,this._modelSetting=s;const a=this._modelSetting.getHitAreasCount();if(console.log(`Model has ${a} hit areas`),this._modelSetting.getModelFileName()!=""){const ot=this._modelSetting.getModelFileName();fetch(`${this._modelHomeDir}${ot}`).then(at=>{if(at.ok)return at.arrayBuffer();if(at.status>=400)return CubismLogError(`Failed to load file ${this._modelHomeDir}${ot}`),new ArrayBuffer(0)}).then(at=>{this.loadModel(at,this._mocConsistency,CurrentKScale),this._state=3,_()}),this._state=2}else LAppPal.printMessage("Model data does not exist.");const _=()=>{if(this._modelSetting.getExpressionCount()>0){const ot=this._modelSetting.getExpressionCount();for(let at=0;at{if(ct.ok)return ct.arrayBuffer();if(ct.status>=400)return CubismLogError(`Failed to load file ${this._modelHomeDir}${ut}`),new ArrayBuffer(0)}).then(ct=>{const dt=this.loadExpression(ct,ct.byteLength,lt);this._expressions.getValue(lt)!=null&&(ACubismMotion.delete(this._expressions.getValue(lt)),this._expressions.setValue(lt,null)),this._expressions.setValue(lt,dt),this._expressionCount++,this._expressionCount>=ot&&(this._state=5,$())})}this._state=4}else this._state=5,$()},$=()=>{if(this._modelSetting.getPhysicsFileName()!=""){const ot=this._modelSetting.getPhysicsFileName();fetch(`${this._modelHomeDir}${ot}`).then(at=>{if(at.ok)return at.arrayBuffer();if(at.status>=400)return CubismLogError(`Failed to load file ${this._modelHomeDir}${ot}`),new ArrayBuffer(0)}).then(at=>{this.loadPhysics(at,at.byteLength),this._state=7,_e()}),this._state=6}else this._state=7,_e()},_e=()=>{if(this._modelSetting.getPoseFileName()!=""){const ot=this._modelSetting.getPoseFileName();fetch(`${this._modelHomeDir}${ot}`).then(at=>{if(at.ok)return at.arrayBuffer();if(at.status>=400)return CubismLogError(`Failed to load file ${this._modelHomeDir}${ot}`),new ArrayBuffer(0)}).then(at=>{this.loadPose(at,at.byteLength),this._state=9,tt()}),this._state=8}else this._state=9,tt()},tt=()=>{this._modelSetting.getEyeBlinkParameterCount()>0&&(this._eyeBlink=CubismEyeBlink.create(this._modelSetting),this._state=10),st()},st=()=>{this._breath=CubismBreath.create();const ot=new csmVector;ot.pushBack(new BreathParameterData(this._idParamAngleX,0,15,6.5345,.5)),ot.pushBack(new BreathParameterData(this._idParamAngleY,0,8,3.5345,.5)),ot.pushBack(new BreathParameterData(this._idParamAngleZ,0,10,5.5345,.5)),ot.pushBack(new BreathParameterData(this._idParamBodyAngleX,0,4,15.5345,.5));const at=CubismFramework.getIdManager();if(at){const lt=at.getId(CubismDefaultParameterId.ParamBreath);lt&&ot.pushBack(new BreathParameterData(lt,.5,.5,3.2345,1))}this._breath.setParameters(ot),this._state=11,it()},it=()=>{if(this._modelSetting.getUserDataFile()!=""){const ot=this._modelSetting.getUserDataFile();fetch(`${this._modelHomeDir}${ot}`).then(at=>{if(at.ok)return at.arrayBuffer();if(at.status>=400)return CubismLogError(`Failed to load file ${this._modelHomeDir}${ot}`),new ArrayBuffer(0)}).then(at=>{this.loadUserData(at,at.byteLength),this._state=13,nt()}),this._state=12}else this._state=13,nt()},nt=()=>{const ot=this._modelSetting.getEyeBlinkParameterCount();for(let at=0;at{const ot=this._modelSetting.getLipSyncParameterCount();for(let at=0;at{const ot=new csmMap;if(this._modelSetting==null||this._modelMatrix==null){CubismLogError("Failed to setupLayout().");return}this._modelSetting.getLayoutMap(ot),this._modelMatrix.setupFromLayout(ot),this._state=16,rt()},rt=()=>{this._state=17,this._model.saveParameters(),this._allMotionCount=0,this._motionCount=0;const ot=[],at=this._modelSetting.getMotionGroupCount();for(let lt=0;lt{this.getRenderer().bindTexture(_,tt.id),this._textureCount++,this._textureCount>=a&&(this._state=22)};LAppDelegate.getInstance().getTextureManager().createTextureFromPngFile($,s,_e),this.getRenderer().setIsPremultipliedAlpha(s)}this._state=21}}reloadRenderer(){this.deleteRenderer(),this.createRenderer(),this.setupTextures()}update(){if(this._state!=22)return;const s=LAppPal.getDeltaTime();this._userTimeSeconds+=s,this._dragManager.update(s),this._dragX=this._dragManager.getX(),this._dragY=this._dragManager.getY();let a=!1;if(this._model.loadParameters(),this._motionManager.isFinished()?this.startRandomMotion(MotionGroupIdle,PriorityIdle):a=this._motionManager.updateMotion(this._model,s),this._model.saveParameters(),a||this._eyeBlink!=null&&this._eyeBlink.updateParameters(this._model,s),this._expressionManager!=null&&this._expressionManager.updateMotion(this._model,s),this._model.addParameterValueById(this._idParamAngleX,this._dragX*30),this._model.addParameterValueById(this._idParamAngleY,this._dragY*30),this._model.addParameterValueById(this._idParamAngleZ,this._dragX*this._dragY*-30),this._model.addParameterValueById(this._idParamBodyAngleX,this._dragX*10),this._model.addParameterValueById(this._idParamEyeBallX,this._dragX),this._model.addParameterValueById(this._idParamEyeBallY,this._dragY),this._breath!=null&&this._breath.updateParameters(this._model,s),this._physics!=null&&this._physics.evaluate(this._model,s),this._lipsync){let _=0;this._wavFileHandler.update(s),_=this._wavFileHandler.getRms(),_=Math.min(1,_*1.5);const $=4;for(let _e=0;_e{if(nt.ok)return nt.arrayBuffer();if(nt.status>=400)return CubismLogError(`Failed to load file ${this._modelHomeDir}${_e}`),new ArrayBuffer(0)}).then(nt=>{if(st=this.loadMotion(nt,nt.byteLength,null,$),st==null)return;let et=this._modelSetting.getMotionFadeInTimeValue(s,a);et>=0&&st.setFadeInTime(et),et=this._modelSetting.getMotionFadeOutTimeValue(s,a),et>=0&&st.setFadeOutTime(et),st.setEffectIds(this._eyeBlinkIds,this._lipSyncIds),it=!0,this._motionManager.startMotionPriority(st,it,_)}),InvalidMotionQueueEntryHandleValue):(st.setFinishedMotionHandler($),this._motionManager.startMotionPriority(st,it,_))}startRandomMotion(s,a,_){if(this._modelSetting.getMotionCount(s)==0)return InvalidMotionQueueEntryHandleValue;const $=Math.floor(Math.random()*this._modelSetting.getMotionCount(s));return this.startMotion(s,$,a,_)}setExpression(s){const a=this._expressions.getValue(s);this._debugMode&&LAppPal.printMessage(`[APP]expression: [${s}]`),a!=null?this._expressionManager.startMotionPriority(a,!1,PriorityForce):this._debugMode&&LAppPal.printMessage(`[APP]expression[${s}] is null`)}setRandomExpression(){if(this._expressions.getSize()==0)return;const s=Math.floor(Math.random()*this._expressions.getSize());for(let a=0;a [${$}]`),fetch(`${this._modelHomeDir}${_}`).then(_e=>{if(_e.ok)return _e.arrayBuffer();if(_e.status>=400)return CubismLogError(`Failed to load file ${this._modelHomeDir}${_}`),null}).then(_e=>{if(!_e){this._allMotionCount--;return}const tt=this.loadMotion(_e,_e.byteLength,$);if(tt!=null){let st=this._modelSetting.getMotionFadeInTimeValue(s,a);st>=0&&tt.setFadeInTime(st),st=this._modelSetting.getMotionFadeOutTimeValue(s,a),st>=0&&tt.setFadeOutTime(st),tt.setEffectIds(this._eyeBlinkIds,this._lipSyncIds),this._motions.getValue($)!=null&&ACubismMotion.delete(this._motions.getValue($)),this._motions.setValue($,tt),this._motionCount++,this._motionCount>=this._allMotionCount&&(this._state=20,this._motionManager.stopAllMotions(),this._updating=!1,this._initialized=!0,this.createRenderer(),this.setupTextures(),this.getRenderer().startUp(gl))}else this._allMotionCount--}).catch(_e=>{CubismLogError(`Failed to load motion: ${_e}`),this._allMotionCount--})}}releaseMotions(){this._motions.clear()}releaseExpressions(){this._expressions.clear()}doDraw(){if(this._model==null)return;const s=[0,0,canvas.width,canvas.height];this.getRenderer().setRenderState(frameBuffer,s),this.getRenderer().drawModel()}draw(s){this._model!=null&&this._state==22&&(s.multiplyByMatrix(this._modelMatrix),this.getRenderer().setMvpMatrix(s),this.doDraw())}async hasMocConsistencyFromFile(){if(CSM_ASSERT(this._modelSetting.getModelFileName().localeCompare("")),this._modelSetting.getModelFileName()!=""){const s=this._modelSetting.getModelFileName(),_=await(await fetch(`${this._modelHomeDir}${s}`)).arrayBuffer();return this._consistency=CubismMoc.hasMocConsistency(_),this._consistency?CubismLogInfo("Consistent MOC3."):CubismLogInfo("Inconsistent MOC3."),this._consistency}else LAppPal.printMessage("Model data does not exist.")}isHitOnModel(s,a){if(this._opacity<1)return!1;const _=this._model.getDrawableCount(),$=this._modelMatrix.getArray(),_e=$[0]*$[5]-$[1]*$[4];if(Math.abs(_e)<1e-4)return!1;const tt=1/_e,st={a:$[5]*tt,b:-$[1]*tt,c:-$[4]*tt,d:$[0]*tt,tx:($[4]*$[13]-$[5]*$[12])*tt,ty:($[1]*$[12]-$[0]*$[13])*tt},it={x:s*st.a+a*st.c+st.tx,y:s*st.b+a*st.d+st.ty};for(let nt=0;nt<_;nt++){if(!this._model.getDrawableDynamicFlagIsVisible(nt))continue;const et=this._model.getDrawableVertices(nt);let j=et[0],rt=et[1],ot=et[0],at=et[1];for(let lt=2;lt=j&&it.x<=ot&&it.y>=rt&&it.y<=at)return!0}return!1}anyHitTestWithFallback(s,a){return this.anyhitTest(s,a)!==null||this.isHitOnModel(s,a)}startTapMotion(s,a){if(!a||Object.keys(a).length===0)return;let _={},$=!1;if(s&&a[s]&&(_=a[s],$=!0),$||(_={},Object.values(a).forEach(et=>{for(const[j,rt]of Object.entries(et))_[j]?_[j]+=Number(rt):_[j]=Number(rt)})),Object.keys(_).length===0)return;const _e=Object.keys(_),tt=Object.values(_).map(Number),st=tt.reduce((et,j)=>et+(isNaN(j)?0:j),0);if(st<=0)return;let it=Math.random()*st,nt=null;for(let et=0;et<_e.length;et++){const j=isNaN(tt[et])?0:tt[et];if(it{LAppPal.printMessage("Motion Finished:"),console.log(o)});this._viewMatrix=new CubismMatrix44,this._models=new csmVector,this._sceneIndex=0,this.changeScene(this._sceneIndex)}static getInstance(){return s_instance$1==null&&(s_instance$1=new LAppLive2DManager),s_instance$1}static releaseInstance(){s_instance$1!=null&&(s_instance$1=void 0),s_instance$1=null}getModel(o){return o1&&oa($.ptr()),{passive:!0}),$.ptr().img.src=o;return}const _=new Image;_.crossOrigin="anonymous",_.addEventListener("load",()=>{const $=gl.createTexture();gl.bindTexture(gl.TEXTURE_2D,$),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.LINEAR_MIPMAP_LINEAR),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,gl.LINEAR),s&&gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,1),gl.texImage2D(gl.TEXTURE_2D,0,gl.RGBA,gl.RGBA,gl.UNSIGNED_BYTE,_),gl.generateMipmap(gl.TEXTURE_2D),gl.bindTexture(gl.TEXTURE_2D,null);const _e=new TextureInfo;_e!=null&&(_e.fileName=o,_e.width=_.width,_e.height=_.height,_e.id=$,_e.img=_,_e.usePremultply=s,this._textures.pushBack(_e)),a(_e)},{passive:!0}),_.src=o}releaseTextures(){for(let o=0;othis._screenLeft&&(s=this._screenLeft-this._tr[0]*this._maxLeft-this._tr[12]),this._tr[0]*this._maxRight+(this._tr[12]+s)this._screenBottom&&(a=this._screenBottom-this._tr[5]*this._maxBottom-this._tr[13]);const _=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,s,a,0,1]);CubismMatrix44.multiply(_,this._tr,this._tr)}adjustScale(s,a,_){const $=this.getMaxScale(),_e=this.getMinScale(),tt=_*this._tr[0];tt<_e?this._tr[0]>0&&(_=_e/this._tr[0]):tt>$&&this._tr[0]>0&&(_=$/this._tr[0]);const st=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,s,a,0,1]),it=new Float32Array([_,0,0,0,0,_,0,0,0,0,1,0,0,0,0,1]),nt=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,-s,-a,0,1]);CubismMatrix44.multiply(nt,this._tr,this._tr),CubismMatrix44.multiply(it,this._tr,this._tr),CubismMatrix44.multiply(st,this._tr,this._tr)}setScreenRect(s,a,_,$){this._screenLeft=s,this._screenRight=a,this._screenBottom=_,this._screenTop=$}setMaxScreenRect(s,a,_,$){this._maxLeft=s,this._maxRight=a,this._maxTop=$,this._maxBottom=_}setMaxScale(s){this._maxScale=s}setMinScale(s){this._minScale=s}getMaxScale(){return this._maxScale}getMinScale(){return this._minScale}isMaxScale(){return this.getScaleX()>=this._maxScale}isMinScale(){return this.getScaleX()<=this._minScale}getScreenLeft(){return this._screenLeft}getScreenRight(){return this._screenRight}getScreenBottom(){return this._screenBottom}getScreenTop(){return this._screenTop}getMaxLeft(){return this._maxLeft}getMaxRight(){return this._maxRight}getMaxBottom(){return this._maxBottom}getMaxTop(){return this._maxTop}}var Live2DCubismFramework;(i=>{i.CubismViewMatrix=CubismViewMatrix})(Live2DCubismFramework||(Live2DCubismFramework={}));class TouchManager{constructor(){xt(this,"_startY");xt(this,"_startX");xt(this,"_lastX");xt(this,"_lastY");xt(this,"_lastX1");xt(this,"_lastY1");xt(this,"_lastX2");xt(this,"_lastY2");xt(this,"_lastTouchDistance");xt(this,"_deltaX");xt(this,"_deltaY");xt(this,"_scale");xt(this,"_touchSingle");xt(this,"_flipAvailable");this._startX=0,this._startY=0,this._lastX=0,this._lastY=0,this._lastX1=0,this._lastY1=0,this._lastX2=0,this._lastY2=0,this._lastTouchDistance=0,this._deltaX=0,this._deltaY=0,this._scale=1,this._touchSingle=!1,this._flipAvailable=!1}getCenterX(){return this._lastX}getCenterY(){return this._lastY}getDeltaX(){return this._deltaX}getDeltaY(){return this._deltaY}getStartX(){return this._startX}getStartY(){return this._startY}getScale(){return this._scale}getX(){return this._lastX}getY(){return this._lastY}getX1(){return this._lastX1}getY1(){return this._lastY1}getX2(){return this._lastX2}getY2(){return this._lastY2}isSingleTouch(){return this._touchSingle}isFlickAvailable(){return this._flipAvailable}disableFlick(){this._flipAvailable=!1}touchesBegan(o,s){this._lastX=o,this._lastY=s,this._startX=o,this._startY=s,this._lastTouchDistance=-1,this._flipAvailable=!0,this._touchSingle=!0}touchesMoved(o,s){this._lastX=o,this._lastY=s,this._lastTouchDistance=-1,this._touchSingle=!0}getFlickDistance(){return this.calculateDistance(this._startX,this._startY,this._lastX,this._lastY)}calculateDistance(o,s,a,_){return Math.sqrt((o-a)*(o-a)+(s-_)*(s-_))}calculateMovingAmount(o,s){if(o>0!=s>0)return 0;const a=o>0?1:-1,_=Math.abs(o),$=Math.abs(s);return a*(_<$?_:$)}}class LAppView{constructor(){xt(this,"_touchManager");xt(this,"_deviceToScreen");xt(this,"_viewMatrix");xt(this,"_programId");xt(this,"_back");xt(this,"_changeModel");xt(this,"_isClick");this._programId=null,this._back=null,this._touchManager=new TouchManager,this._deviceToScreen=new CubismMatrix44,this._viewMatrix=new CubismViewMatrix}initialize(){if(!canvas){console.warn("Canvas is null, cannot initialize LAppView");return}const{width:o,height:s}=canvas,a=o/s,_=-a,$=a,_e=ViewLogicalLeft,tt=ViewLogicalRight;if(this._viewMatrix.setScreenRect(_,$,_e,tt),this._viewMatrix.scale(ViewScale,ViewScale),this._deviceToScreen.loadIdentity(),o>s){const st=Math.abs($-_);this._deviceToScreen.scaleRelative(st/o,-st/o)}else{const st=Math.abs(tt-_e);this._deviceToScreen.scaleRelative(st/s,-st/s)}this._deviceToScreen.translateRelative(-o*.5,-s*.5),this._viewMatrix.setMaxScale(ViewMaxScale),this._viewMatrix.setMinScale(ViewMinScale),this._viewMatrix.setMaxScreenRect(ViewLogicalMaxLeft,ViewLogicalMaxRight,ViewLogicalMaxBottom,ViewLogicalMaxTop)}release(){this._viewMatrix=null,this._touchManager=null,this._deviceToScreen=null,this._back.release(),this._back=null,gl.deleteProgram(this._programId),this._programId=null}render(){gl.useProgram(this._programId),this._back&&this._back.render(this._programId),gl.flush();const o=LAppLive2DManager.getInstance();o.setViewMatrix(this._viewMatrix),o.onUpdate()}initializeSprite(){canvas.width,canvas.height,LAppDelegate.getInstance().getTextureManager(),this._programId==null&&(this._programId=LAppDelegate.getInstance().createShader())}onTouchesBegan(o,s){this._touchManager.touchesBegan(o*window.devicePixelRatio,s*window.devicePixelRatio)}onTouchesMoved(o,s){const a=this.transformViewX(this._touchManager.getX()),_=this.transformViewY(this._touchManager.getY());this._touchManager.touchesMoved(o*window.devicePixelRatio,s*window.devicePixelRatio),LAppLive2DManager.getInstance().onDrag(a,_)}onTouchesEnded(o,s){const a=LAppLive2DManager.getInstance();a.onDrag(0,0);{const _=this._deviceToScreen.transformX(this._touchManager.getX()),$=this._deviceToScreen.transformY(this._touchManager.getY());a.onTap(_,$)}}transformViewX(o){const s=this._deviceToScreen.transformX(o);return this._viewMatrix.invertTransformX(s)}transformViewY(o){const s=this._deviceToScreen.transformY(o);return this._viewMatrix.invertTransformY(s)}transformScreenX(o){return this._deviceToScreen.transformX(o)}transformScreenY(o){return this._deviceToScreen.transformY(o)}}let s_instance=null,frameBuffer=null;class LAppDelegate{constructor(){xt(this,"_cubismOption");xt(this,"_view");xt(this,"_captured");xt(this,"_mouseX");xt(this,"_mouseY");xt(this,"_isEnd");xt(this,"_textureManager");this._captured=!1,this._mouseX=0,this._mouseY=0,this._isEnd=!1,this._cubismOption=new Option,this._view=new LAppView,this._textureManager=new LAppTextureManager}static getInstance(){return s_instance==null&&(s_instance=new LAppDelegate),s_instance}static releaseInstance(){s_instance!=null&&s_instance.release(),s_instance=null}initialize(){return this._resizeCanvas(),frameBuffer||(frameBuffer=gl.getParameter(gl.FRAMEBUFFER_BINDING)),gl.enable(gl.BLEND),gl.blendFunc(gl.SRC_ALPHA,gl.ONE_MINUS_SRC_ALPHA),"ontouchend"in canvas?(canvas.addEventListener("touchstart",onTouchBegan,{passive:!0}),canvas.addEventListener("touchmove",onTouchMoved,{passive:!0}),canvas.addEventListener("touchend",onTouchEnded,{passive:!0}),canvas.addEventListener("touchcancel",onTouchCancel,{passive:!0})):(canvas.addEventListener("mousedown",onClickBegan,{passive:!0}),canvas.addEventListener("mousemove",onMouseMoved,{passive:!0}),canvas.addEventListener("mouseup",onClickEnded,{passive:!0})),this._view.initialize(),this.initializeCubism(),!0}onResize(){if(this._resizeCanvas(),this._view&&canvas){this._view.initialize(),this._view.initializeSprite();const o=LAppLive2DManager.getInstance();if(o){const s=o.getModel(0);if(s){const a=canvas.width,_=canvas.height;a>0&&_>0&&s.setPosition&&s.setPosition(a/2,_/2)}}}}release(){this._textureManager.release(),this._textureManager=null,this._view.release(),this._view=null,LAppLive2DManager.releaseInstance(),CubismFramework.dispose()}run(){const o=()=>{if(s_instance!=null){if(LAppPal.updateTime(!1),LAppPal.getDeltaTime()<1/LIMITED_FRAME_RATE){requestAnimationFrame(o);return}LAppPal.updateTime(!0),gl.clearColor(0,0,0,1),gl.enable(gl.DEPTH_TEST),gl.depthFunc(gl.LEQUAL),gl.clear(gl.DEPTH_BUFFER_BIT),gl.clearDepth(1),gl.enable(gl.BLEND),gl.blendFunc(gl.SRC_ALPHA,gl.ONE_MINUS_SRC_ALPHA),this._view.render(),requestAnimationFrame(o)}};o()}createShader(){const o=gl.createShader(gl.VERTEX_SHADER);if(o==null)return LAppPal.printMessage("failed to create vertexShader"),null;gl.shaderSource(o,"precision mediump float;attribute vec3 position;attribute vec2 uv;varying vec2 vuv;void main(void){ gl_Position = vec4(position, 1.0); vuv = uv;}"),gl.compileShader(o);const a=gl.createShader(gl.FRAGMENT_SHADER);if(a==null)return LAppPal.printMessage("failed to create fragmentShader"),null;gl.shaderSource(a,"precision mediump float;varying vec2 vuv;uniform sampler2D texture;void main(void){ gl_FragColor = texture2D(texture, vuv);}"),gl.compileShader(a);const $=gl.createProgram();return gl.attachShader($,o),gl.attachShader($,a),gl.deleteShader(o),gl.deleteShader(a),gl.linkProgram($),gl.useProgram($),$}getView(){return this._view}getTextureManager(){return this._textureManager}initializeCubism(){this._cubismOption.logFunction=LAppPal.printMessage,this._cubismOption.loggingLevel=CubismLoggingLevel,CubismFramework.startUp(this._cubismOption),CubismFramework.initialize(),LAppLive2DManager.getInstance(),LAppPal.updateTime(),this._view.initializeSprite()}_resizeCanvas(){if(!canvas){console.warn("Canvas is null, skipping resize");return}canvas.width=canvas.clientWidth*window.devicePixelRatio,canvas.height=canvas.clientHeight*window.devicePixelRatio,gl&&gl.viewport(0,0,gl.drawingBufferWidth,gl.drawingBufferHeight)}}function onClickBegan(i){if(!LAppDelegate.getInstance()._view){LAppPal.printMessage("view notfound");return}LAppDelegate.getInstance()._captured=!0;const o=i.pageX,s=i.pageY;LAppDelegate.getInstance()._view.onTouchesBegan(o,s)}function onMouseMoved(i){if(!LAppDelegate.getInstance()._captured)return;if(!LAppDelegate.getInstance()._view){LAppPal.printMessage("view notfound");return}const o=i.target.getBoundingClientRect(),s=i.clientX-o.left,a=i.clientY-o.top;LAppDelegate.getInstance()._view.onTouchesMoved(s,a)}function onClickEnded(i){if(LAppDelegate.getInstance()._captured=!1,!LAppDelegate.getInstance()._view){LAppPal.printMessage("view notfound");return}const o=i.target.getBoundingClientRect(),s=i.clientX-o.left,a=i.clientY-o.top;LAppDelegate.getInstance()._view.onTouchesEnded(s,a)}function onTouchBegan(i){if(!LAppDelegate.getInstance()._view){LAppPal.printMessage("view notfound");return}LAppDelegate.getInstance()._captured=!0;const o=i.changedTouches[0].pageX,s=i.changedTouches[0].pageY;LAppDelegate.getInstance()._view.onTouchesBegan(o,s)}function onTouchMoved(i){if(!LAppDelegate.getInstance()._captured)return;if(!LAppDelegate.getInstance()._view){LAppPal.printMessage("view notfound");return}const o=i.target.getBoundingClientRect(),s=i.changedTouches[0].clientX-o.left,a=i.changedTouches[0].clientY-o.top;LAppDelegate.getInstance()._view.onTouchesMoved(s,a)}function onTouchEnded(i){if(LAppDelegate.getInstance()._captured=!1,!LAppDelegate.getInstance()._view){LAppPal.printMessage("view notfound");return}const o=i.target.getBoundingClientRect(),s=i.changedTouches[0].clientX-o.left,a=i.changedTouches[0].clientY-o.top;LAppDelegate.getInstance()._view.onTouchesEnded(s,a)}function onTouchCancel(i){if(LAppDelegate.getInstance()._captured=!1,!LAppDelegate.getInstance()._view){LAppPal.printMessage("view notfound");return}const o=i.target.getBoundingClientRect(),s=i.changedTouches[0].clientX-o.left,a=i.changedTouches[0].clientY-o.top;LAppDelegate.getInstance()._view.onTouchesEnded(s,a)}function initializeLive2D(){var i;if(console.log("Initializing Live2D with resourcePath:",ResourcesPath),console.log("Model directories:",ModelDir),LAppDelegate.getInstance()&&LAppLive2DManager.releaseInstance(),!LAppGlManager.getInstance()||!LAppDelegate.getInstance().initialize()){console.error("Failed to initialize Live2D");return}if(LAppDelegate.getInstance().run(),window.getLive2DManager=()=>LAppLive2DManager.getInstance(),!window.getLAppAdapter){console.log("Setting up getLAppAdapter function");const{LAppAdapter:o}=require("./lappadapter");window.getLAppAdapter=()=>o.getInstance()}if((i=window.api)!=null&&i.setIgnoreMouseEvent){const o=document.getElementById("live2d");o==null||o.addEventListener("pointermove",s=>{const a=LAppLive2DManager.getInstance().getModel(0),_=LAppDelegate.getInstance().getView(),$=_==null?void 0:_._deviceToScreen.transformX(s.x),_e=_==null?void 0:_._deviceToScreen.transformY(s.y);window.api.setIgnoreMouseEvent(!(a!=null&&a.anyhitTest($,_e))&&!(a!=null&&a.isHitOnModel($,_e)))}),o==null||o.addEventListener("pointerdown",s=>{const a=LAppLive2DManager.getInstance().getModel(0),_=LAppDelegate.getInstance().getView(),$=_==null?void 0:_._deviceToScreen.transformX(s.x),_e=_==null?void 0:_._deviceToScreen.transformY(s.y),tt=a==null?void 0:a.anyhitTest($,_e),st=tt!==null||(a==null?void 0:a.isHitOnModel($,_e));console.log("Model clicked:",st,tt?`in area: ${tt}`:"")})}}window.addEventListener("beforeunload",()=>LAppDelegate.releaseInstance(),{passive:!0});window.addEventListener("resize",()=>{LAppDelegate.getInstance().onResize()},{passive:!0});window.initializeLive2D=initializeLive2D;const TAP_DURATION_THRESHOLD_MS=200,DRAG_DISTANCE_THRESHOLD_PX=5;function parseModelUrl(i){try{const o=new URL(i),{pathname:s}=o,a=s.lastIndexOf("/");if(a===-1)throw new Error("Invalid model URL format");const $=s.substring(a+1).replace(".model3.json",""),_e=s.lastIndexOf("/",a-1);if(_e===-1)throw new Error("Invalid model URL format");const tt=s.substring(_e+1,a);return{baseUrl:`${o.protocol}//${o.host}${s.substring(0,_e+1)}`,modelDir:tt,modelFileName:$}}catch(o){return console.error("Error parsing model URL:",o),{baseUrl:"",modelDir:"",modelFileName:""}}}const useLive2DModel=({modelInfo:i,canvasRef:o})=>{const{mode:s}=useMode(),a=s==="pet",[_,$]=reactExports.useState(!1),[_e,tt]=reactExports.useState({x:0,y:0}),st=reactExports.useRef({x:0,y:0}),it=reactExports.useRef({x:0,y:0}),nt=reactExports.useRef({x:0,y:0}),et=reactExports.useRef(null),j=reactExports.useRef(!1),rt=window.electron,ot=reactExports.useRef(0),at=reactExports.useRef({x:0,y:0}),lt=reactExports.useRef(!1);reactExports.useEffect(()=>{var wt;const yt=i==null?void 0:i.url,mt=(wt=window.LAppDefine)==null?void 0:wt.CurrentKScale,gt=(i==null?void 0:i.kScale)!==void 0?Number(i.kScale):void 0;if(yt&&(yt!==et.current||mt!==void 0&>!==void 0&&mt!==gt)){et.current=yt;try{const{baseUrl:Ct,modelDir:kt,modelFileName:It}=parseModelUrl(yt);Ct&&kt&&(updateModelConfig(Ct,kt,It,Number(i.kScale)),setTimeout(()=>{var Pt;(Pt=window.LAppLive2DManager)!=null&&Pt.releaseInstance&&window.LAppLive2DManager.releaseInstance(),initializeLive2D()},500))}catch(Ct){console.error("Error processing model URL:",Ct)}}},[i==null?void 0:i.url,i==null?void 0:i.kScale]);const ut=reactExports.useCallback(()=>{var mt;const yt=(mt=window.getLAppAdapter)==null?void 0:mt.call(window);if(yt){const gt=yt.getModel();if(gt&>._modelMatrix){const vt=gt._modelMatrix.getArray();return{x:vt[12],y:vt[13]}}}return{x:0,y:0}},[]);reactExports.useCallback((yt,mt)=>{var vt;const gt=(vt=window.getLAppAdapter)==null?void 0:vt.call(window);if(gt){const wt=gt.getModel();if(wt&&wt._modelMatrix){const kt=[...wt._modelMatrix.getArray()];kt[12]=yt,kt[13]=mt,wt._modelMatrix.setMatrix(kt),nt.current={x:yt,y:mt}}}},[]),reactExports.useEffect(()=>{const yt=setTimeout(()=>{const mt=ut();nt.current=mt,tt(mt)},500);return()=>clearTimeout(yt)},[i==null?void 0:i.url,ut]);const ct=reactExports.useCallback(()=>{const yt=document.getElementById("canvas");if(!yt)return{width:1,height:1,scale:1};const{width:mt}=yt,{height:gt}=yt,vt=mt/yt.clientWidth;return{width:mt,height:gt,scale:vt}},[]);reactExports.useCallback((yt,mt)=>{const{width:gt,height:vt,scale:wt}=ct(),Ct=yt*wt/gt*2-1,kt=-(mt*wt/vt)*2+1;return{x:Ct,y:kt}},[ct]);const dt=reactExports.useCallback(yt=>{var Kt;const mt=(Kt=window.getLAppAdapter)==null?void 0:Kt.call(window);if(!mt||!o.current)return;const gt=mt.getModel(),vt=LAppDelegate.getInstance().getView();if(!vt||!gt)return;const wt=o.current,Ct=wt.getBoundingClientRect(),kt=yt.clientX-Ct.left,It=yt.clientY-Ct.top,Pt=wt.width/wt.clientWidth,St=kt*Pt,Rt=It*Pt,At=vt._deviceToScreen.transformX(St),Mt=vt._deviceToScreen.transformY(Rt),jt=gt.anyhitTest(At,Mt),Yt=gt.isHitOnModel(At,Mt);if((jt!==null||Yt)&&(ot.current=Date.now(),at.current={x:yt.clientX,y:yt.clientY},lt.current=!0,$(!1),gt._modelMatrix)){const sr=gt._modelMatrix.getArray();it.current={x:sr[12],y:sr[13]}}},[o,i]),ft=reactExports.useCallback(yt=>{var wt;const mt=(wt=window.getLAppAdapter)==null?void 0:wt.call(window),gt=LAppDelegate.getInstance().getView(),vt=mt==null?void 0:mt.getModel();if(lt.current&&mt&>&&vt&&o.current){const Ct=Date.now()-ot.current,kt=yt.clientX-at.current.x,It=yt.clientY-at.current.y,Pt=Math.sqrt(kt*kt+It*It);if(Pt>DRAG_DISTANCE_THRESHOLD_PX||Ct>TAP_DURATION_THRESHOLD_MS&&Pt>1){lt.current=!1,$(!0);const Rt=o.current.getBoundingClientRect();st.current={x:at.current.x-Rt.left,y:at.current.y-Rt.top}}}if(_&&mt&>&&vt&&o.current){const Ct=o.current,kt=Ct.getBoundingClientRect(),It=yt.clientX-kt.left,Pt=yt.clientY-kt.top,St=Ct.width/Ct.clientWidth,Rt=st.current.x*St,At=st.current.y*St,Mt=gt._deviceToScreen.transformX(Rt),jt=gt._deviceToScreen.transformY(At),Yt=It*St,Kt=Pt*St,sr=gt._deviceToScreen.transformX(Yt),ar=gt._deviceToScreen.transformY(Kt),Gt=sr-Mt,Qt=ar-jt,tr=it.current.x+Gt,Vt=it.current.y+Qt;if(mt.setModelPosition)mt.setModelPosition(tr,Vt);else if(vt._modelMatrix){const Zt=[...vt._modelMatrix.getArray()];Zt[12]=tr,Zt[13]=Vt,vt._modelMatrix.setMatrix(Zt)}nt.current={x:tr,y:Vt},tt({x:tr,y:Vt})}if(a&&!_&&!lt.current&&rt&&mt&>&&vt&&o.current){const Ct=o.current,kt=Ct.getBoundingClientRect(),It=yt.clientX-kt.left,Pt=yt.clientY-kt.top,St=Ct.width/Ct.clientWidth,Rt=It*St,At=Pt*St,Mt=gt._deviceToScreen.transformX(Rt),jt=gt._deviceToScreen.transformY(At),Yt=vt.anyhitTest(Mt,jt)!==null||vt.isHitOnModel(Mt,jt);Yt!==j.current&&(j.current=Yt,rt.ipcRenderer.send("update-component-hover","live2d-model",Yt))}},[a,_,rt,o]),ht=reactExports.useCallback(yt=>{var wt;const mt=(wt=window.getLAppAdapter)==null?void 0:wt.call(window),gt=mt==null?void 0:mt.getModel(),vt=LAppDelegate.getInstance().getView();if(_){if($(!1),mt){const Ct=mt.getModel();if(Ct&&Ct._modelMatrix){const kt=Ct._modelMatrix.getArray(),It={x:kt[12],y:kt[13]};nt.current=It,it.current=It,tt(It)}}}else if(lt.current&&mt&>&&vt&&o.current){const Ct=Date.now()-ot.current,kt=yt.clientX-at.current.x,It=yt.clientY-at.current.y,Pt=Math.sqrt(kt*kt+It*It);if(Ct{_&&ht({}),lt.current&&(lt.current=!1),a&&rt&&j.current&&(j.current=!1,rt.ipcRenderer.send("update-component-hover","live2d-model",!1))},[a,_,rt,ht]);return reactExports.useEffect(()=>{!a&&rt&&j.current&&(j.current=!1)},[a,rt]),reactExports.useEffect(()=>{const yt=(vt,wt=0,Ct=3)=>{var Pt;const kt=(Pt=window.getLAppAdapter)==null?void 0:Pt.call(window);if(!kt)return console.error("Live2D adapter not available"),!1;const It=kt.getModel();if(!It)return console.error("Live2D model not available"),!1;try{console.log(`Playing motion: group="${vt}", index=${wt}, priority=${Ct}`);const St=It.startMotion(vt,wt,Ct);return console.log("Motion start result:",St),St}catch(St){return console.error("Error playing motion:",St),!1}},mt=(vt,wt=3)=>{var It;const Ct=(It=window.getLAppAdapter)==null?void 0:It.call(window);if(!Ct)return console.error("Live2D adapter not available"),!1;const kt=Ct.getModel();if(!kt)return console.error("Live2D model not available"),!1;try{console.log(`Playing random motion from group: "${vt}", priority=${wt}`);const Pt=kt.startRandomMotion(vt,wt);return console.log("Random motion start result:",Pt),Pt}catch(Pt){return console.error("Error playing random motion:",Pt),!1}},gt=()=>{var Ct,kt,It;const vt=(Ct=window.getLAppAdapter)==null?void 0:Ct.call(window);if(!vt)return console.error("Live2D adapter not available"),null;const wt=vt.getModel();if(!wt)return console.error("Live2D model not available"),null;try{const Pt=[],St=wt._modelSetting;if(St){const Rt=(It=(kt=St._json)==null?void 0:kt.FileReferences)==null?void 0:It.Motions;if(Rt)for(const At in Rt){const Mt=Rt[At];Pt.push({name:At,count:Mt.length,motions:Mt.map((jt,Yt)=>({index:Yt,file:jt.File}))})}}return console.log("Available motion groups:",Pt),Pt}catch(Pt){return console.error("Error getting motion info:",Pt),null}};return window.Live2DDebug={playMotion:yt,playRandomMotion:mt,getMotionInfo:gt,help:()=>{console.log(` +Live2D Motion Debug Functions: +- Live2DDebug.getMotionInfo() - Get all available motion groups and their motions +- Live2DDebug.playMotion(group, index, priority) - Play specific motion +- Live2DDebug.playRandomMotion(group, priority) - Play random motion from group +- Live2DDebug.help() - Show this help + +Example usage: +Live2DDebug.getMotionInfo() // See available motions +Live2DDebug.playMotion("", 0) // Play first motion from default group +Live2DDebug.playRandomMotion("") // Play random motion from default group + `)}},console.log("Live2D Debug functions exposed to window.Live2DDebug"),console.log("Type Live2DDebug.help() for usage information"),()=>{delete window.Live2DDebug}},[]),{position:_e,isDragging:_,handlers:{onMouseDown:dt,onMouseMove:ft,onMouseUp:ht,onMouseLeave:bt}}},MIN_SCALE=.1,MAX_SCALE=5,EASING_FACTOR=.3,WHEEL_SCALE_STEP=.03,DEFAULT_SCALE=1,applyScale=i=>{try{const o=LAppLive2DManager.getInstance();if(!o)return;const s=o.getModel(0);if(!s)return;s._modelMatrix.scale(i,i)}catch{console.debug("Model not ready for scaling yet")}},useLive2DResize=({containerRef:i,modelInfo:o,showSidebar:s})=>{const{mode:a}=useMode(),_=a==="pet",$=reactExports.useRef(null),_e=reactExports.useRef(null),tt=reactExports.useRef(!1),st=(o==null?void 0:o.kScale)||DEFAULT_SCALE,it=reactExports.useRef(st),nt=reactExports.useRef(st),et=reactExports.useRef(),j=reactExports.useRef(!1),rt=reactExports.useRef(!1),ot=reactExports.useRef({width:0,height:0}),at=reactExports.useRef(s);reactExports.useEffect(()=>{const ft=(o==null?void 0:o.kScale)||DEFAULT_SCALE;it.current=ft,nt.current=ft,rt.current=!1,et.current&&(cancelAnimationFrame(et.current),j.current=!1);const ht=requestAnimationFrame(()=>{dt()});return()=>cancelAnimationFrame(ht)},[o==null?void 0:o.url,o==null?void 0:o.kScale]);const lt=reactExports.useCallback(()=>{const ft=Math.max(MIN_SCALE,Math.min(MAX_SCALE,nt.current)),ht=it.current,bt=ft-ht,yt=ht+bt*EASING_FACTOR;applyScale(yt),it.current=yt,et.current=requestAnimationFrame(lt)},[]),ut=reactExports.useCallback(ft=>{if(ft.preventDefault(),!(o!=null&&o.scrollToResize))return;const ht=ft.deltaY>0?-1:1,bt=WHEEL_SCALE_STEP*ht,yt=it.current,mt=Math.max(MIN_SCALE,Math.min(MAX_SCALE,yt+bt));nt.current=mt,j.current||(j.current=!0,et.current=requestAnimationFrame(lt))},[o==null?void 0:o.scrollToResize,lt]),ct=reactExports.useCallback(()=>{_e.current&&(tt.current=!0,$.current!==null&&(cancelAnimationFrame($.current),$.current=null))},[]),dt=reactExports.useCallback(()=>{var ht;const ft=_e.current;if(ft){tt.current||ct();try{const bt=(ht=i.current)==null?void 0:ht.getBoundingClientRect(),{width:yt,height:mt}=_?{width:window.innerWidth,height:window.innerHeight}:bt||{width:0,height:0},gt=ot.current,vt=at.current!==s;if(!(Math.abs(gt.width-yt)>1||Math.abs(gt.height-mt)>1||vt)&&rt.current){tt.current=!1;return}if(ot.current={width:yt,height:mt},at.current=s,!bt&&!_&&console.warn("[Resize] Container bounds not available in window mode."),yt===0||mt===0){console.warn("[Resize] Width or Height is zero, skipping canvas/delegate update."),tt.current=!1;return}const kt=window.devicePixelRatio||1;ft.width=Math.round(yt*kt),ft.height=Math.round(mt*kt),ft.style.width=`${yt}px`,ft.style.height=`${mt}px`;const It=LAppDelegate.getInstance();It?It.onResize():console.warn("[Resize] LAppDelegate instance not found."),tt.current=!1}catch{tt.current=!1}}},[_,i,o==null?void 0:o.kScale,o==null?void 0:o.initialXshift,o==null?void 0:o.initialYshift,s,ct,_e]);return reactExports.useEffect(()=>{at.current!==s&&($.current!==null&&cancelAnimationFrame($.current),$.current=requestAnimationFrame(()=>{dt(),$.current=null}))},[s,dt]),reactExports.useEffect(()=>{const ft=_e.current;if(ft)return ft.addEventListener("wheel",ut,{passive:!1}),()=>{ft.removeEventListener("wheel",ut)}},[ut,_e]),reactExports.useEffect(()=>()=>{et.current&&(cancelAnimationFrame(et.current),et.current=void 0),$.current!==null&&(cancelAnimationFrame($.current),$.current=null)},[]),reactExports.useEffect(()=>{const ft=i.current;if(!ft)return;$.current!==null&&cancelAnimationFrame($.current),$.current=requestAnimationFrame(()=>{dt(),$.current=null});const ht=new ResizeObserver(()=>{tt.current||($.current!==null&&cancelAnimationFrame($.current),$.current=requestAnimationFrame(()=>{dt(),$.current=null}))});return ht.observe(ft),()=>{$.current!==null&&(cancelAnimationFrame($.current),$.current=null),ht.disconnect()}},[i,dt]),reactExports.useEffect(()=>{const ft=()=>{tt.current||($.current!==null&&cancelAnimationFrame($.current),$.current=requestAnimationFrame(()=>{dt(),$.current=null}))};return window.addEventListener("resize",ft),()=>{window.removeEventListener("resize",ft),$.current!==null&&(cancelAnimationFrame($.current),$.current=null)}},[dt]),{canvasRef:_e,handleResize:dt}},Live2D=reactExports.memo(({showSidebar:i})=>{const{forceIgnoreMouse:o}=useForceIgnoreMouse(),{modelInfo:s}=useLive2DConfig(),{mode:a}=useMode(),_=reactExports.useRef(null),{aiState:$}=useAiState(),{resetExpression:_e}=useLive2DExpression(),tt=a==="pet",{canvasRef:st}=useLive2DResize({containerRef:_,modelInfo:s,showSidebar:i}),{isDragging:it,handlers:nt}=useLive2DModel({modelInfo:s,canvasRef:st});useIpcHandlers(),useInterrupt(),useAudioTask(),reactExports.useEffect(()=>{var rt;if($===AiStateEnum.IDLE){const ot=(rt=window.getLAppAdapter)==null?void 0:rt.call(window);ot&&_e(ot,s)}},[$,s,_e]);const et=rt=>{nt.onMouseDown(rt)},j=rt=>{var ot,at;tt&&(rt.preventDefault(),console.log("[ContextMenu] (Pet Mode) Right-click detected, requesting menu..."),(at=(ot=window.api)==null?void 0:ot.showContextMenu)==null||at.call(ot))};return jsxRuntimeExports.jsx("div",{ref:_,id:"live2d-internal-wrapper",style:{width:"100%",height:"100%",pointerEvents:tt&&o?"none":"auto",overflow:"hidden",position:"relative",cursor:it?"grabbing":"default"},onPointerDown:et,onContextMenu:j,...nt,children:jsxRuntimeExports.jsx("canvas",{id:"canvas",ref:st,style:{width:"100%",height:"100%",pointerEvents:tt&&o?"none":"auto",display:"block",cursor:it?"grabbing":"default"}})})});Live2D.displayName="Live2D";function useSwitchCharacter(){const{sendMessage:i}=useWebSocket(),{confName:o,getFilenameByName:s}=useConfig(),{interrupt:a}=useInterrupt(),{stopMic:_}=useVAD(),{setSubtitleText:$}=useSubtitle(),{setAiState:_e}=useAiState(),{setModelInfo:tt}=useLive2DConfig();return{switchCharacter:reactExports.useCallback(it=>{if(s(o)===it){console.log("Skipping character switch - same configuration file");return}$("New Character Loading..."),a(),_(),_e("loading"),tt(void 0),i({type:"switch-config",file:it}),console.log("Switch Character fileName: ",it)},[o,s,i,a,_,$,_e])}}const isString=i=>typeof i=="string",defer=()=>{let i,o;const s=new Promise((a,_)=>{i=a,o=_});return s.resolve=i,s.reject=o,s},makeString=i=>i==null?"":""+i,copy=(i,o,s)=>{i.forEach(a=>{o[a]&&(s[a]=o[a])})},lastOfPathSeparatorRegExp=/###/g,cleanKey=i=>i&&i.indexOf("###")>-1?i.replace(lastOfPathSeparatorRegExp,"."):i,canNotTraverseDeeper=i=>!i||isString(i),getLastOfPath=(i,o,s)=>{const a=isString(o)?o.split("."):o;let _=0;for(;_{const{obj:a,k:_}=getLastOfPath(i,o,Object);if(a!==void 0||o.length===1){a[_]=s;return}let $=o[o.length-1],_e=o.slice(0,o.length-1),tt=getLastOfPath(i,_e,Object);for(;tt.obj===void 0&&_e.length;)$=`${_e[_e.length-1]}.${$}`,_e=_e.slice(0,_e.length-1),tt=getLastOfPath(i,_e,Object),tt!=null&&tt.obj&&typeof tt.obj[`${tt.k}.${$}`]<"u"&&(tt.obj=void 0);tt.obj[`${tt.k}.${$}`]=s},pushPath=(i,o,s,a)=>{const{obj:_,k:$}=getLastOfPath(i,o,Object);_[$]=_[$]||[],_[$].push(s)},getPath=(i,o)=>{const{obj:s,k:a}=getLastOfPath(i,o);if(s&&Object.prototype.hasOwnProperty.call(s,a))return s[a]},getPathWithDefaults=(i,o,s)=>{const a=getPath(i,s);return a!==void 0?a:getPath(o,s)},deepExtend=(i,o,s)=>{for(const a in o)a!=="__proto__"&&a!=="constructor"&&(a in i?isString(i[a])||i[a]instanceof String||isString(o[a])||o[a]instanceof String?s&&(i[a]=o[a]):deepExtend(i[a],o[a],s):i[a]=o[a]);return i},regexEscape=i=>i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var _entityMap={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const escape=i=>isString(i)?i.replace(/[&<>"'\/]/g,o=>_entityMap[o]):i;class RegExpCache{constructor(o){this.capacity=o,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(o){const s=this.regExpMap.get(o);if(s!==void 0)return s;const a=new RegExp(o);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(o,a),this.regExpQueue.push(o),a}}const chars=[" ",",","?","!",";"],looksLikeObjectPathRegExpCache=new RegExpCache(20),looksLikeObjectPath=(i,o,s)=>{o=o||"",s=s||"";const a=chars.filter(_e=>o.indexOf(_e)<0&&s.indexOf(_e)<0);if(a.length===0)return!0;const _=looksLikeObjectPathRegExpCache.getRegExp(`(${a.map(_e=>_e==="?"?"\\?":_e).join("|")})`);let $=!_.test(i);if(!$){const _e=i.indexOf(s);_e>0&&!_.test(i.substring(0,_e))&&($=!0)}return $},deepFind=function(i,o){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!i)return;if(i[o])return Object.prototype.hasOwnProperty.call(i,o)?i[o]:void 0;const a=o.split(s);let _=i;for(let $=0;$-1&&sti==null?void 0:i.replace("_","-"),consoleLogger={type:"logger",log(i){this.output("log",i)},warn(i){this.output("warn",i)},error(i){this.output("error",i)},output(i,o){var s,a;(a=(s=console==null?void 0:console[i])==null?void 0:s.apply)==null||a.call(s,console,o)}};class Logger{constructor(o){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(o,s)}init(o){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=s.prefix||"i18next:",this.logger=o||consoleLogger,this.options=s,this.debug=s.debug}log(){for(var o=arguments.length,s=new Array(o),a=0;a{this.observers[a]||(this.observers[a]=new Map);const _=this.observers[a].get(s)||0;this.observers[a].set(s,_+1)}),this}off(o,s){if(this.observers[o]){if(!s){delete this.observers[o];return}this.observers[o].delete(s)}}emit(o){for(var s=arguments.length,a=new Array(s>1?s-1:0),_=1;_{let[tt,st]=_e;for(let it=0;it{let[tt,st]=_e;for(let it=0;it1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=o||{},this.options=s,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(o){this.options.ns.indexOf(o)<0&&this.options.ns.push(o)}removeNamespaces(o){const s=this.options.ns.indexOf(o);s>-1&&this.options.ns.splice(s,1)}getResource(o,s,a){var it,nt;let _=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const $=_.keySeparator!==void 0?_.keySeparator:this.options.keySeparator,_e=_.ignoreJSONStructure!==void 0?_.ignoreJSONStructure:this.options.ignoreJSONStructure;let tt;o.indexOf(".")>-1?tt=o.split("."):(tt=[o,s],a&&(Array.isArray(a)?tt.push(...a):isString(a)&&$?tt.push(...a.split($)):tt.push(a)));const st=getPath(this.data,tt);return!st&&!s&&!a&&o.indexOf(".")>-1&&(o=tt[0],s=tt[1],a=tt.slice(2).join(".")),st||!_e||!isString(a)?st:deepFind((nt=(it=this.data)==null?void 0:it[o])==null?void 0:nt[s],a,$)}addResource(o,s,a,_){let $=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const _e=$.keySeparator!==void 0?$.keySeparator:this.options.keySeparator;let tt=[o,s];a&&(tt=tt.concat(_e?a.split(_e):a)),o.indexOf(".")>-1&&(tt=o.split("."),_=s,s=tt[1]),this.addNamespaces(s),setPath(this.data,tt,_),$.silent||this.emit("added",o,s,a,_)}addResources(o,s,a){let _=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const $ in a)(isString(a[$])||Array.isArray(a[$]))&&this.addResource(o,s,$,a[$],{silent:!0});_.silent||this.emit("added",o,s,a)}addResourceBundle(o,s,a,_,$){let _e=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},tt=[o,s];o.indexOf(".")>-1&&(tt=o.split("."),_=a,a=s,s=tt[1]),this.addNamespaces(s);let st=getPath(this.data,tt)||{};_e.skipCopy||(a=JSON.parse(JSON.stringify(a))),_?deepExtend(st,a,$):st={...st,...a},setPath(this.data,tt,st),_e.silent||this.emit("added",o,s,a)}removeResourceBundle(o,s){this.hasResourceBundle(o,s)&&delete this.data[o][s],this.removeNamespaces(s),this.emit("removed",o,s)}hasResourceBundle(o,s){return this.getResource(o,s)!==void 0}getResourceBundle(o,s){return s||(s=this.options.defaultNS),this.getResource(o,s)}getDataByLanguage(o){return this.data[o]}hasLanguageSomeTranslations(o){const s=this.getDataByLanguage(o);return!!(s&&Object.keys(s)||[]).find(_=>s[_]&&Object.keys(s[_]).length>0)}toJSON(){return this.data}}var postProcessor={processors:{},addPostProcessor(i){this.processors[i.name]=i},handle(i,o,s,a,_){return i.forEach($=>{var _e;o=((_e=this.processors[$])==null?void 0:_e.process(o,s,a,_))??o}),o}};const checkedLoadedFor={},shouldHandleAsObject=i=>!isString(i)&&typeof i!="boolean"&&typeof i!="number";class Translator extends EventEmitter{constructor(o){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),copy(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],o,this),this.options=s,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=baseLogger.create("translator")}changeLanguage(o){o&&(this.language=o)}exists(o){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(o==null)return!1;const a=this.resolve(o,s);return(a==null?void 0:a.res)!==void 0}extractFromKey(o,s){let a=s.nsSeparator!==void 0?s.nsSeparator:this.options.nsSeparator;a===void 0&&(a=":");const _=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator;let $=s.ns||this.options.defaultNS||[];const _e=a&&o.indexOf(a)>-1,tt=!this.options.userDefinedKeySeparator&&!s.keySeparator&&!this.options.userDefinedNsSeparator&&!s.nsSeparator&&!looksLikeObjectPath(o,a,_);if(_e&&!tt){const st=o.match(this.interpolator.nestingRegexp);if(st&&st.length>0)return{key:o,namespaces:isString($)?[$]:$};const it=o.split(a);(a!==_||a===_&&this.options.ns.indexOf(it[0])>-1)&&($=it.shift()),o=it.join(_)}return{key:o,namespaces:isString($)?[$]:$}}translate(o,s,a){if(typeof s!="object"&&this.options.overloadTranslationOptionHandler&&(s=this.options.overloadTranslationOptionHandler(arguments)),typeof options=="object"&&(s={...s}),s||(s={}),o==null)return"";Array.isArray(o)||(o=[String(o)]);const _=s.returnDetails!==void 0?s.returnDetails:this.options.returnDetails,$=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,{key:_e,namespaces:tt}=this.extractFromKey(o[o.length-1],s),st=tt[tt.length-1],it=s.lng||this.language,nt=s.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((it==null?void 0:it.toLowerCase())==="cimode"){if(nt){const wt=s.nsSeparator||this.options.nsSeparator;return _?{res:`${st}${wt}${_e}`,usedKey:_e,exactUsedKey:_e,usedLng:it,usedNS:st,usedParams:this.getUsedParamsDetails(s)}:`${st}${wt}${_e}`}return _?{res:_e,usedKey:_e,exactUsedKey:_e,usedLng:it,usedNS:st,usedParams:this.getUsedParamsDetails(s)}:_e}const et=this.resolve(o,s);let j=et==null?void 0:et.res;const rt=(et==null?void 0:et.usedKey)||_e,ot=(et==null?void 0:et.exactUsedKey)||_e,at=["[object Number]","[object Function]","[object RegExp]"],lt=s.joinArrays!==void 0?s.joinArrays:this.options.joinArrays,ut=!this.i18nFormat||this.i18nFormat.handleAsObject,ct=s.count!==void 0&&!isString(s.count),dt=Translator.hasDefaultValue(s),ft=ct?this.pluralResolver.getSuffix(it,s.count,s):"",ht=s.ordinal&&ct?this.pluralResolver.getSuffix(it,s.count,{ordinal:!1}):"",bt=ct&&!s.ordinal&&s.count===0,yt=bt&&s[`defaultValue${this.options.pluralSeparator}zero`]||s[`defaultValue${ft}`]||s[`defaultValue${ht}`]||s.defaultValue;let mt=j;ut&&!j&&dt&&(mt=yt);const gt=shouldHandleAsObject(mt),vt=Object.prototype.toString.apply(mt);if(ut&&mt&>&&at.indexOf(vt)<0&&!(isString(lt)&&Array.isArray(mt))){if(!s.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const wt=this.options.returnedObjectHandler?this.options.returnedObjectHandler(rt,mt,{...s,ns:tt}):`key '${_e} (${this.language})' returned an object instead of string.`;return _?(et.res=wt,et.usedParams=this.getUsedParamsDetails(s),et):wt}if($){const wt=Array.isArray(mt),Ct=wt?[]:{},kt=wt?ot:rt;for(const It in mt)if(Object.prototype.hasOwnProperty.call(mt,It)){const Pt=`${kt}${$}${It}`;dt&&!j?Ct[It]=this.translate(Pt,{...s,defaultValue:shouldHandleAsObject(yt)?yt[It]:void 0,joinArrays:!1,ns:tt}):Ct[It]=this.translate(Pt,{...s,joinArrays:!1,ns:tt}),Ct[It]===Pt&&(Ct[It]=mt[It])}j=Ct}}else if(ut&&isString(lt)&&Array.isArray(j))j=j.join(lt),j&&(j=this.extendTranslation(j,o,s,a));else{let wt=!1,Ct=!1;!this.isValidLookup(j)&&dt&&(wt=!0,j=yt),this.isValidLookup(j)||(Ct=!0,j=_e);const It=(s.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&Ct?void 0:j,Pt=dt&&yt!==j&&this.options.updateMissing;if(Ct||wt||Pt){if(this.logger.log(Pt?"updateKey":"missingKey",it,st,_e,Pt?yt:j),$){const Mt=this.resolve(_e,{...s,keySeparator:!1});Mt&&Mt.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let St=[];const Rt=this.languageUtils.getFallbackCodes(this.options.fallbackLng,s.lng||this.language);if(this.options.saveMissingTo==="fallback"&&Rt&&Rt[0])for(let Mt=0;Mt{var sr;const Kt=dt&&Yt!==j?Yt:It;this.options.missingKeyHandler?this.options.missingKeyHandler(Mt,st,jt,Kt,Pt,s):(sr=this.backendConnector)!=null&&sr.saveMissing&&this.backendConnector.saveMissing(Mt,st,jt,Kt,Pt,s),this.emit("missingKey",Mt,st,jt,j)};this.options.saveMissing&&(this.options.saveMissingPlurals&&ct?St.forEach(Mt=>{const jt=this.pluralResolver.getSuffixes(Mt,s);bt&&s[`defaultValue${this.options.pluralSeparator}zero`]&&jt.indexOf(`${this.options.pluralSeparator}zero`)<0&&jt.push(`${this.options.pluralSeparator}zero`),jt.forEach(Yt=>{At([Mt],_e+Yt,s[`defaultValue${Yt}`]||yt)})}):At(St,_e,yt))}j=this.extendTranslation(j,o,s,et,a),Ct&&j===_e&&this.options.appendNamespaceToMissingKey&&(j=`${st}:${_e}`),(Ct||wt)&&this.options.parseMissingKeyHandler&&(j=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${st}:${_e}`:_e,wt?j:void 0))}return _?(et.res=j,et.usedParams=this.getUsedParamsDetails(s),et):j}extendTranslation(o,s,a,_,$){var it,nt;var _e=this;if((it=this.i18nFormat)!=null&&it.parse)o=this.i18nFormat.parse(o,{...this.options.interpolation.defaultVariables,...a},a.lng||this.language||_.usedLng,_.usedNS,_.usedKey,{resolved:_});else if(!a.skipInterpolation){a.interpolation&&this.interpolator.init({...a,interpolation:{...this.options.interpolation,...a.interpolation}});const et=isString(o)&&(((nt=a==null?void 0:a.interpolation)==null?void 0:nt.skipOnVariables)!==void 0?a.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let j;if(et){const ot=o.match(this.interpolator.nestingRegexp);j=ot&&ot.length}let rt=a.replace&&!isString(a.replace)?a.replace:a;if(this.options.interpolation.defaultVariables&&(rt={...this.options.interpolation.defaultVariables,...rt}),o=this.interpolator.interpolate(o,rt,a.lng||this.language||_.usedLng,a),et){const ot=o.match(this.interpolator.nestingRegexp),at=ot&&ot.length;j1&&arguments[1]!==void 0?arguments[1]:{},a,_,$,_e,tt;return isString(o)&&(o=[o]),o.forEach(st=>{if(this.isValidLookup(a))return;const it=this.extractFromKey(st,s),nt=it.key;_=nt;let et=it.namespaces;this.options.fallbackNS&&(et=et.concat(this.options.fallbackNS));const j=s.count!==void 0&&!isString(s.count),rt=j&&!s.ordinal&&s.count===0,ot=s.context!==void 0&&(isString(s.context)||typeof s.context=="number")&&s.context!=="",at=s.lngs?s.lngs:this.languageUtils.toResolveHierarchy(s.lng||this.language,s.fallbackLng);et.forEach(lt=>{var ut,ct;this.isValidLookup(a)||(tt=lt,!checkedLoadedFor[`${at[0]}-${lt}`]&&((ut=this.utils)!=null&&ut.hasLoadedNamespace)&&!((ct=this.utils)!=null&&ct.hasLoadedNamespace(tt))&&(checkedLoadedFor[`${at[0]}-${lt}`]=!0,this.logger.warn(`key "${_}" for languages "${at.join(", ")}" won't get resolved as namespace "${tt}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),at.forEach(dt=>{var bt;if(this.isValidLookup(a))return;_e=dt;const ft=[nt];if((bt=this.i18nFormat)!=null&&bt.addLookupKeys)this.i18nFormat.addLookupKeys(ft,nt,dt,lt,s);else{let yt;j&&(yt=this.pluralResolver.getSuffix(dt,s.count,s));const mt=`${this.options.pluralSeparator}zero`,gt=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(j&&(ft.push(nt+yt),s.ordinal&&yt.indexOf(gt)===0&&ft.push(nt+yt.replace(gt,this.options.pluralSeparator)),rt&&ft.push(nt+mt)),ot){const vt=`${nt}${this.options.contextSeparator}${s.context}`;ft.push(vt),j&&(ft.push(vt+yt),s.ordinal&&yt.indexOf(gt)===0&&ft.push(vt+yt.replace(gt,this.options.pluralSeparator)),rt&&ft.push(vt+mt))}}let ht;for(;ht=ft.pop();)this.isValidLookup(a)||($=ht,a=this.getResource(dt,lt,ht,s))}))})}),{res:a,usedKey:_,exactUsedKey:$,usedLng:_e,usedNS:tt}}isValidLookup(o){return o!==void 0&&!(!this.options.returnNull&&o===null)&&!(!this.options.returnEmptyString&&o==="")}getResource(o,s,a){var $;let _=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return($=this.i18nFormat)!=null&&$.getResource?this.i18nFormat.getResource(o,s,a,_):this.resourceStore.getResource(o,s,a,_)}getUsedParamsDetails(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const s=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],a=o.replace&&!isString(o.replace);let _=a?o.replace:o;if(a&&typeof o.count<"u"&&(_.count=o.count),this.options.interpolation.defaultVariables&&(_={...this.options.interpolation.defaultVariables,..._}),!a){_={..._};for(const $ of s)delete _[$]}return _}static hasDefaultValue(o){const s="defaultValue";for(const a in o)if(Object.prototype.hasOwnProperty.call(o,a)&&s===a.substring(0,s.length)&&o[a]!==void 0)return!0;return!1}}class LanguageUtil{constructor(o){this.options=o,this.supportedLngs=this.options.supportedLngs||!1,this.logger=baseLogger.create("languageUtils")}getScriptPartFromCode(o){if(o=getCleanedCode(o),!o||o.indexOf("-")<0)return null;const s=o.split("-");return s.length===2||(s.pop(),s[s.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(s.join("-"))}getLanguagePartFromCode(o){if(o=getCleanedCode(o),!o||o.indexOf("-")<0)return o;const s=o.split("-");return this.formatLanguageCode(s[0])}formatLanguageCode(o){if(isString(o)&&o.indexOf("-")>-1){let s;try{s=Intl.getCanonicalLocales(o)[0]}catch{}return s&&this.options.lowerCaseLng&&(s=s.toLowerCase()),s||(this.options.lowerCaseLng?o.toLowerCase():o)}return this.options.cleanCode||this.options.lowerCaseLng?o.toLowerCase():o}isSupportedCode(o){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(o=this.getLanguagePartFromCode(o)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(o)>-1}getBestMatchFromCodes(o){if(!o)return null;let s;return o.forEach(a=>{if(s)return;const _=this.formatLanguageCode(a);(!this.options.supportedLngs||this.isSupportedCode(_))&&(s=_)}),!s&&this.options.supportedLngs&&o.forEach(a=>{if(s)return;const _=this.getScriptPartFromCode(a);if(this.isSupportedCode(_))return s=_;const $=this.getLanguagePartFromCode(a);if(this.isSupportedCode($))return s=$;s=this.options.supportedLngs.find(_e=>{if(_e===$)return _e;if(!(_e.indexOf("-")<0&&$.indexOf("-")<0)&&(_e.indexOf("-")>0&&$.indexOf("-")<0&&_e.substring(0,_e.indexOf("-"))===$||_e.indexOf($)===0&&$.length>1))return _e})}),s||(s=this.getFallbackCodes(this.options.fallbackLng)[0]),s}getFallbackCodes(o,s){if(!o)return[];if(typeof o=="function"&&(o=o(s)),isString(o)&&(o=[o]),Array.isArray(o))return o;if(!s)return o.default||[];let a=o[s];return a||(a=o[this.getScriptPartFromCode(s)]),a||(a=o[this.formatLanguageCode(s)]),a||(a=o[this.getLanguagePartFromCode(s)]),a||(a=o.default),a||[]}toResolveHierarchy(o,s){const a=this.getFallbackCodes(s||this.options.fallbackLng||[],o),_=[],$=_e=>{_e&&(this.isSupportedCode(_e)?_.push(_e):this.logger.warn(`rejecting language code not found in supportedLngs: ${_e}`))};return isString(o)&&(o.indexOf("-")>-1||o.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&$(this.formatLanguageCode(o)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&$(this.getScriptPartFromCode(o)),this.options.load!=="currentOnly"&&$(this.getLanguagePartFromCode(o))):isString(o)&&$(this.formatLanguageCode(o)),a.forEach(_e=>{_.indexOf(_e)<0&&$(this.formatLanguageCode(_e))}),_}}const suffixesOrder={zero:0,one:1,two:2,few:3,many:4,other:5},dummyRule={select:i=>i===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class PluralResolver{constructor(o){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=o,this.options=s,this.logger=baseLogger.create("pluralResolver"),this.pluralRulesCache={}}addRule(o,s){this.rules[o]=s}clearCache(){this.pluralRulesCache={}}getRule(o){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const a=getCleanedCode(o==="dev"?"en":o),_=s.ordinal?"ordinal":"cardinal",$=JSON.stringify({cleanedCode:a,type:_});if($ in this.pluralRulesCache)return this.pluralRulesCache[$];let _e;try{_e=new Intl.PluralRules(a,{type:_})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),dummyRule;if(!o.match(/-|_/))return dummyRule;const st=this.languageUtils.getLanguagePartFromCode(o);_e=this.getRule(st,s)}return this.pluralRulesCache[$]=_e,_e}needsPlural(o){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=this.getRule(o,s);return a||(a=this.getRule("dev",s)),(a==null?void 0:a.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(o,s){let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(o,a).map(_=>`${s}${_}`)}getSuffixes(o){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=this.getRule(o,s);return a||(a=this.getRule("dev",s)),a?a.resolvedOptions().pluralCategories.sort((_,$)=>suffixesOrder[_]-suffixesOrder[$]).map(_=>`${this.options.prepend}${s.ordinal?`ordinal${this.options.prepend}`:""}${_}`):[]}getSuffix(o,s){let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const _=this.getRule(o,a);return _?`${this.options.prepend}${a.ordinal?`ordinal${this.options.prepend}`:""}${_.select(s)}`:(this.logger.warn(`no plural rule found for: ${o}`),this.getSuffix("dev",s,a))}}const deepFindWithDefaults=function(i,o,s){let a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",_=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,$=getPathWithDefaults(i,o,s);return!$&&_&&isString(s)&&($=deepFind(i,s,a),$===void 0&&($=deepFind(o,s,a))),$},regexSafe=i=>i.replace(/\$/g,"$$$$");class Interpolator{constructor(){var s;let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=baseLogger.create("interpolator"),this.options=o,this.format=((s=o==null?void 0:o.interpolation)==null?void 0:s.format)||(a=>a),this.init(o)}init(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};o.interpolation||(o.interpolation={escapeValue:!0});const{escape:s,escapeValue:a,useRawValueToEscape:_,prefix:$,prefixEscaped:_e,suffix:tt,suffixEscaped:st,formatSeparator:it,unescapeSuffix:nt,unescapePrefix:et,nestingPrefix:j,nestingPrefixEscaped:rt,nestingSuffix:ot,nestingSuffixEscaped:at,nestingOptionsSeparator:lt,maxReplaces:ut,alwaysFormat:ct}=o.interpolation;this.escape=s!==void 0?s:escape,this.escapeValue=a!==void 0?a:!0,this.useRawValueToEscape=_!==void 0?_:!1,this.prefix=$?regexEscape($):_e||"{{",this.suffix=tt?regexEscape(tt):st||"}}",this.formatSeparator=it||",",this.unescapePrefix=nt?"":et||"-",this.unescapeSuffix=this.unescapePrefix?"":nt||"",this.nestingPrefix=j?regexEscape(j):rt||regexEscape("$t("),this.nestingSuffix=ot?regexEscape(ot):at||regexEscape(")"),this.nestingOptionsSeparator=lt||",",this.maxReplaces=ut||1e3,this.alwaysFormat=ct!==void 0?ct:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const o=(s,a)=>(s==null?void 0:s.source)===a?(s.lastIndex=0,s):new RegExp(a,"g");this.regexp=o(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=o(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=o(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(o,s,a,_){var rt;let $,_e,tt;const st=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},it=ot=>{if(ot.indexOf(this.formatSeparator)<0){const ct=deepFindWithDefaults(s,st,ot,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(ct,void 0,a,{..._,...s,interpolationkey:ot}):ct}const at=ot.split(this.formatSeparator),lt=at.shift().trim(),ut=at.join(this.formatSeparator).trim();return this.format(deepFindWithDefaults(s,st,lt,this.options.keySeparator,this.options.ignoreJSONStructure),ut,a,{..._,...s,interpolationkey:lt})};this.resetRegExp();const nt=(_==null?void 0:_.missingInterpolationHandler)||this.options.missingInterpolationHandler,et=((rt=_==null?void 0:_.interpolation)==null?void 0:rt.skipOnVariables)!==void 0?_.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:ot=>regexSafe(ot)},{regex:this.regexp,safeValue:ot=>this.escapeValue?regexSafe(this.escape(ot)):regexSafe(ot)}].forEach(ot=>{for(tt=0;$=ot.regex.exec(o);){const at=$[1].trim();if(_e=it(at),_e===void 0)if(typeof nt=="function"){const ut=nt(o,$,_);_e=isString(ut)?ut:""}else if(_&&Object.prototype.hasOwnProperty.call(_,at))_e="";else if(et){_e=$[0];continue}else this.logger.warn(`missed to pass in variable ${at} for interpolating ${o}`),_e="";else!isString(_e)&&!this.useRawValueToEscape&&(_e=makeString(_e));const lt=ot.safeValue(_e);if(o=o.replace($[0],lt),et?(ot.regex.lastIndex+=_e.length,ot.regex.lastIndex-=$[0].length):ot.regex.lastIndex=0,tt++,tt>=this.maxReplaces)break}}),o}nest(o,s){let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},_,$,_e;const tt=(st,it)=>{const nt=this.nestingOptionsSeparator;if(st.indexOf(nt)<0)return st;const et=st.split(new RegExp(`${nt}[ ]*{`));let j=`{${et[1]}`;st=et[0],j=this.interpolate(j,_e);const rt=j.match(/'/g),ot=j.match(/"/g);(((rt==null?void 0:rt.length)??0)%2===0&&!ot||ot.length%2!==0)&&(j=j.replace(/'/g,'"'));try{_e=JSON.parse(j),it&&(_e={...it,..._e})}catch(at){return this.logger.warn(`failed parsing options string in nesting for key ${st}`,at),`${st}${nt}${j}`}return _e.defaultValue&&_e.defaultValue.indexOf(this.prefix)>-1&&delete _e.defaultValue,st};for(;_=this.nestingRegexp.exec(o);){let st=[];_e={...a},_e=_e.replace&&!isString(_e.replace)?_e.replace:_e,_e.applyPostProcessor=!1,delete _e.defaultValue;let it=!1;if(_[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(_[1])){const nt=_[1].split(this.formatSeparator).map(et=>et.trim());_[1]=nt.shift(),st=nt,it=!0}if($=s(tt.call(this,_[1].trim(),_e),_e),$&&_[0]===o&&!isString($))return $;isString($)||($=makeString($)),$||(this.logger.warn(`missed to resolve ${_[1]} for nesting ${o}`),$=""),it&&($=st.reduce((nt,et)=>this.format(nt,et,a.lng,{...a,interpolationkey:_[1].trim()}),$.trim())),o=o.replace(_[0],$),this.regexp.lastIndex=0}return o}}const parseFormatStr=i=>{let o=i.toLowerCase().trim();const s={};if(i.indexOf("(")>-1){const a=i.split("(");o=a[0].toLowerCase().trim();const _=a[1].substring(0,a[1].length-1);o==="currency"&&_.indexOf(":")<0?s.currency||(s.currency=_.trim()):o==="relativetime"&&_.indexOf(":")<0?s.range||(s.range=_.trim()):_.split(";").forEach(_e=>{if(_e){const[tt,...st]=_e.split(":"),it=st.join(":").trim().replace(/^'+|'+$/g,""),nt=tt.trim();s[nt]||(s[nt]=it),it==="false"&&(s[nt]=!1),it==="true"&&(s[nt]=!0),isNaN(it)||(s[nt]=parseInt(it,10))}})}return{formatName:o,formatOptions:s}},createCachedFormatter=i=>{const o={};return(s,a,_)=>{let $=_;_&&_.interpolationkey&&_.formatParams&&_.formatParams[_.interpolationkey]&&_[_.interpolationkey]&&($={...$,[_.interpolationkey]:void 0});const _e=a+JSON.stringify($);let tt=o[_e];return tt||(tt=i(getCleanedCode(a),_),o[_e]=tt),tt(s)}};class Formatter{constructor(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=baseLogger.create("formatter"),this.options=o,this.formats={number:createCachedFormatter((s,a)=>{const _=new Intl.NumberFormat(s,{...a});return $=>_.format($)}),currency:createCachedFormatter((s,a)=>{const _=new Intl.NumberFormat(s,{...a,style:"currency"});return $=>_.format($)}),datetime:createCachedFormatter((s,a)=>{const _=new Intl.DateTimeFormat(s,{...a});return $=>_.format($)}),relativetime:createCachedFormatter((s,a)=>{const _=new Intl.RelativeTimeFormat(s,{...a});return $=>_.format($,a.range||"day")}),list:createCachedFormatter((s,a)=>{const _=new Intl.ListFormat(s,{...a});return $=>_.format($)})},this.init(o)}init(o){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};this.formatSeparator=s.interpolation.formatSeparator||","}add(o,s){this.formats[o.toLowerCase().trim()]=s}addCached(o,s){this.formats[o.toLowerCase().trim()]=createCachedFormatter(s)}format(o,s,a){let _=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const $=s.split(this.formatSeparator);if($.length>1&&$[0].indexOf("(")>1&&$[0].indexOf(")")<0&&$.find(tt=>tt.indexOf(")")>-1)){const tt=$.findIndex(st=>st.indexOf(")")>-1);$[0]=[$[0],...$.splice(1,tt)].join(this.formatSeparator)}return $.reduce((tt,st)=>{var et;const{formatName:it,formatOptions:nt}=parseFormatStr(st);if(this.formats[it]){let j=tt;try{const rt=((et=_==null?void 0:_.formatParams)==null?void 0:et[_.interpolationkey])||{},ot=rt.locale||rt.lng||_.locale||_.lng||a;j=this.formats[it](tt,ot,{...nt,..._,...rt})}catch(rt){this.logger.warn(rt)}return j}else this.logger.warn(`there was no format function for ${it}`);return tt},o)}}const removePending=(i,o)=>{i.pending[o]!==void 0&&(delete i.pending[o],i.pendingCount--)};class Connector extends EventEmitter{constructor(o,s,a){var $,_e;let _=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=o,this.store=s,this.services=a,this.languageUtils=a.languageUtils,this.options=_,this.logger=baseLogger.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=_.maxParallelReads||10,this.readingCalls=0,this.maxRetries=_.maxRetries>=0?_.maxRetries:5,this.retryTimeout=_.retryTimeout>=1?_.retryTimeout:350,this.state={},this.queue=[],(_e=($=this.backend)==null?void 0:$.init)==null||_e.call($,a,_.backend,_)}queueLoad(o,s,a,_){const $={},_e={},tt={},st={};return o.forEach(it=>{let nt=!0;s.forEach(et=>{const j=`${it}|${et}`;!a.reload&&this.store.hasResourceBundle(it,et)?this.state[j]=2:this.state[j]<0||(this.state[j]===1?_e[j]===void 0&&(_e[j]=!0):(this.state[j]=1,nt=!1,_e[j]===void 0&&(_e[j]=!0),$[j]===void 0&&($[j]=!0),st[et]===void 0&&(st[et]=!0)))}),nt||(tt[it]=!0)}),(Object.keys($).length||Object.keys(_e).length)&&this.queue.push({pending:_e,pendingCount:Object.keys(_e).length,loaded:{},errors:[],callback:_}),{toLoad:Object.keys($),pending:Object.keys(_e),toLoadLanguages:Object.keys(tt),toLoadNamespaces:Object.keys(st)}}loaded(o,s,a){const _=o.split("|"),$=_[0],_e=_[1];s&&this.emit("failedLoading",$,_e,s),!s&&a&&this.store.addResourceBundle($,_e,a,void 0,void 0,{skipCopy:!0}),this.state[o]=s?-1:2,s&&a&&(this.state[o]=0);const tt={};this.queue.forEach(st=>{pushPath(st.loaded,[$],_e),removePending(st,o),s&&st.errors.push(s),st.pendingCount===0&&!st.done&&(Object.keys(st.loaded).forEach(it=>{tt[it]||(tt[it]={});const nt=st.loaded[it];nt.length&&nt.forEach(et=>{tt[it][et]===void 0&&(tt[it][et]=!0)})}),st.done=!0,st.errors.length?st.callback(st.errors):st.callback())}),this.emit("loaded",tt),this.queue=this.queue.filter(st=>!st.done)}read(o,s,a){let _=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,$=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,_e=arguments.length>5?arguments[5]:void 0;if(!o.length)return _e(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:o,ns:s,fcName:a,tried:_,wait:$,callback:_e});return}this.readingCalls++;const tt=(it,nt)=>{if(this.readingCalls--,this.waitingReads.length>0){const et=this.waitingReads.shift();this.read(et.lng,et.ns,et.fcName,et.tried,et.wait,et.callback)}if(it&&nt&&_{this.read.call(this,o,s,a,_+1,$*2,_e)},$);return}_e(it,nt)},st=this.backend[a].bind(this.backend);if(st.length===2){try{const it=st(o,s);it&&typeof it.then=="function"?it.then(nt=>tt(null,nt)).catch(tt):tt(null,it)}catch(it){tt(it)}return}return st(o,s,tt)}prepareLoading(o,s){let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},_=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),_&&_();isString(o)&&(o=this.languageUtils.toResolveHierarchy(o)),isString(s)&&(s=[s]);const $=this.queueLoad(o,s,a,_);if(!$.toLoad.length)return $.pending.length||_(),null;$.toLoad.forEach(_e=>{this.loadOne(_e)})}load(o,s,a){this.prepareLoading(o,s,{},a)}reload(o,s,a){this.prepareLoading(o,s,{reload:!0},a)}loadOne(o){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const a=o.split("|"),_=a[0],$=a[1];this.read(_,$,"read",void 0,void 0,(_e,tt)=>{_e&&this.logger.warn(`${s}loading namespace ${$} for language ${_} failed`,_e),!_e&&tt&&this.logger.log(`${s}loaded namespace ${$} for language ${_}`,tt),this.loaded(o,_e,tt)})}saveMissing(o,s,a,_,$){var st,it,nt,et,j;let _e=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},tt=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if((it=(st=this.services)==null?void 0:st.utils)!=null&&it.hasLoadedNamespace&&!((et=(nt=this.services)==null?void 0:nt.utils)!=null&&et.hasLoadedNamespace(s))){this.logger.warn(`did not save key "${a}" as the namespace "${s}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(a==null||a==="")){if((j=this.backend)!=null&&j.create){const rt={..._e,isUpdate:$},ot=this.backend.create.bind(this.backend);if(ot.length<6)try{let at;ot.length===5?at=ot(o,s,a,_,rt):at=ot(o,s,a,_),at&&typeof at.then=="function"?at.then(lt=>tt(null,lt)).catch(tt):tt(null,at)}catch(at){tt(at)}else ot(o,s,a,_,tt,rt)}!o||!o[0]||this.store.addResource(o[0],s,a,_)}}}const get$1=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:i=>{let o={};if(typeof i[1]=="object"&&(o=i[1]),isString(i[1])&&(o.defaultValue=i[1]),isString(i[2])&&(o.tDescription=i[2]),typeof i[2]=="object"||typeof i[3]=="object"){const s=i[3]||i[2];Object.keys(s).forEach(a=>{o[a]=s[a]})}return o},interpolation:{escapeValue:!0,format:i=>i,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),transformOptions=i=>{var o,s;return isString(i.ns)&&(i.ns=[i.ns]),isString(i.fallbackLng)&&(i.fallbackLng=[i.fallbackLng]),isString(i.fallbackNS)&&(i.fallbackNS=[i.fallbackNS]),((s=(o=i.supportedLngs)==null?void 0:o.indexOf)==null?void 0:s.call(o,"cimode"))<0&&(i.supportedLngs=i.supportedLngs.concat(["cimode"])),typeof i.initImmediate=="boolean"&&(i.initAsync=i.initImmediate),i},noop$2=()=>{},bindMemberFunctions=i=>{Object.getOwnPropertyNames(Object.getPrototypeOf(i)).forEach(s=>{typeof i[s]=="function"&&(i[s]=i[s].bind(i))})};class I18n extends EventEmitter{constructor(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0;if(super(),this.options=transformOptions(o),this.services={},this.logger=baseLogger,this.modules={external:[]},bindMemberFunctions(this),s&&!this.isInitialized&&!o.isClone){if(!this.options.initAsync)return this.init(o,s),this;setTimeout(()=>{this.init(o,s)},0)}}init(){var o=this;let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},a=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof s=="function"&&(a=s,s={}),s.defaultNS==null&&s.ns&&(isString(s.ns)?s.defaultNS=s.ns:s.ns.indexOf("translation")<0&&(s.defaultNS=s.ns[0]));const _=get$1();this.options={..._,...this.options,...transformOptions(s)},this.options.interpolation={..._.interpolation,...this.options.interpolation},s.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=s.keySeparator),s.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=s.nsSeparator);const $=nt=>nt?typeof nt=="function"?new nt:nt:null;if(!this.options.isClone){this.modules.logger?baseLogger.init($(this.modules.logger),this.options):baseLogger.init(null,this.options);let nt;this.modules.formatter?nt=this.modules.formatter:nt=Formatter;const et=new LanguageUtil(this.options);this.store=new ResourceStore(this.options.resources,this.options);const j=this.services;j.logger=baseLogger,j.resourceStore=this.store,j.languageUtils=et,j.pluralResolver=new PluralResolver(et,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),nt&&(!this.options.interpolation.format||this.options.interpolation.format===_.interpolation.format)&&(j.formatter=$(nt),j.formatter.init(j,this.options),this.options.interpolation.format=j.formatter.format.bind(j.formatter)),j.interpolator=new Interpolator(this.options),j.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},j.backendConnector=new Connector($(this.modules.backend),j.resourceStore,j,this.options),j.backendConnector.on("*",function(rt){for(var ot=arguments.length,at=new Array(ot>1?ot-1:0),lt=1;lt1?ot-1:0),lt=1;lt{rt.init&&rt.init(this)})}if(this.format=this.options.interpolation.format,a||(a=noop$2),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const nt=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);nt.length>0&&nt[0]!=="dev"&&(this.options.lng=nt[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(nt=>{this[nt]=function(){return o.store[nt](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(nt=>{this[nt]=function(){return o.store[nt](...arguments),o}});const st=defer(),it=()=>{const nt=(et,j)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),st.resolve(j),a(et,j)};if(this.languages&&!this.isInitialized)return nt(null,this.t.bind(this));this.changeLanguage(this.options.lng,nt)};return this.options.resources||!this.options.initAsync?it():setTimeout(it,0),st}loadResources(o){var $,_e;let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:noop$2;const _=isString(o)?o:this.language;if(typeof o=="function"&&(a=o),!this.options.resources||this.options.partialBundledLanguages){if((_==null?void 0:_.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return a();const tt=[],st=it=>{if(!it||it==="cimode")return;this.services.languageUtils.toResolveHierarchy(it).forEach(et=>{et!=="cimode"&&tt.indexOf(et)<0&&tt.push(et)})};_?st(_):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(nt=>st(nt)),(_e=($=this.options.preload)==null?void 0:$.forEach)==null||_e.call($,it=>st(it)),this.services.backendConnector.load(tt,this.options.ns,it=>{!it&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),a(it)})}else a(null)}reloadResources(o,s,a){const _=defer();return typeof o=="function"&&(a=o,o=void 0),typeof s=="function"&&(a=s,s=void 0),o||(o=this.languages),s||(s=this.options.ns),a||(a=noop$2),this.services.backendConnector.reload(o,s,$=>{_.resolve(),a($)}),_}use(o){if(!o)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!o.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return o.type==="backend"&&(this.modules.backend=o),(o.type==="logger"||o.log&&o.warn&&o.error)&&(this.modules.logger=o),o.type==="languageDetector"&&(this.modules.languageDetector=o),o.type==="i18nFormat"&&(this.modules.i18nFormat=o),o.type==="postProcessor"&&postProcessor.addPostProcessor(o),o.type==="formatter"&&(this.modules.formatter=o),o.type==="3rdParty"&&this.modules.external.push(o),this}setResolvedLanguage(o){if(!(!o||!this.languages)&&!(["cimode","dev"].indexOf(o)>-1)){for(let s=0;s-1)&&this.store.hasLanguageSomeTranslations(a)){this.resolvedLanguage=a;break}}!this.resolvedLanguage&&this.languages.indexOf(o)<0&&this.store.hasLanguageSomeTranslations(o)&&(this.resolvedLanguage=o,this.languages.indexOf(o)<0&&this.languages.unshift(o))}}changeLanguage(o,s){var a=this;this.isLanguageChangingTo=o;const _=defer();this.emit("languageChanging",o);const $=st=>{this.language=st,this.languages=this.services.languageUtils.toResolveHierarchy(st),this.resolvedLanguage=void 0,this.setResolvedLanguage(st)},_e=(st,it)=>{it?this.isLanguageChangingTo===o&&($(it),this.translator.changeLanguage(it),this.isLanguageChangingTo=void 0,this.emit("languageChanged",it),this.logger.log("languageChanged",it)):this.isLanguageChangingTo=void 0,_.resolve(function(){return a.t(...arguments)}),s&&s(st,function(){return a.t(...arguments)})},tt=st=>{var et,j;!o&&!st&&this.services.languageDetector&&(st=[]);const it=isString(st)?st:st&&st[0],nt=this.store.hasLanguageSomeTranslations(it)?it:this.services.languageUtils.getBestMatchFromCodes(isString(st)?[st]:st);nt&&(this.language||$(nt),this.translator.language||this.translator.changeLanguage(nt),(j=(et=this.services.languageDetector)==null?void 0:et.cacheUserLanguage)==null||j.call(et,nt)),this.loadResources(nt,rt=>{_e(rt,nt)})};return!o&&this.services.languageDetector&&!this.services.languageDetector.async?tt(this.services.languageDetector.detect()):!o&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(tt):this.services.languageDetector.detect(tt):tt(o),_}getFixedT(o,s,a){var _=this;const $=function(_e,tt){let st;if(typeof tt!="object"){for(var it=arguments.length,nt=new Array(it>2?it-2:0),et=2;et`${st.keyPrefix}${j}${ot}`):rt=st.keyPrefix?`${st.keyPrefix}${j}${_e}`:_e,_.t(rt,st)};return isString(o)?$.lng=o:$.lngs=o,$.ns=s,$.keyPrefix=a,$}t(){var _;for(var o=arguments.length,s=new Array(o),a=0;a1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const a=s.lng||this.resolvedLanguage||this.languages[0],_=this.options?this.options.fallbackLng:!1,$=this.languages[this.languages.length-1];if(a.toLowerCase()==="cimode")return!0;const _e=(tt,st)=>{const it=this.services.backendConnector.state[`${tt}|${st}`];return it===-1||it===0||it===2};if(s.precheck){const tt=s.precheck(this,_e);if(tt!==void 0)return tt}return!!(this.hasResourceBundle(a,o)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||_e(a,o)&&(!_||_e($,o)))}loadNamespaces(o,s){const a=defer();return this.options.ns?(isString(o)&&(o=[o]),o.forEach(_=>{this.options.ns.indexOf(_)<0&&this.options.ns.push(_)}),this.loadResources(_=>{a.resolve(),s&&s(_)}),a):(s&&s(),Promise.resolve())}loadLanguages(o,s){const a=defer();isString(o)&&(o=[o]);const _=this.options.preload||[],$=o.filter(_e=>_.indexOf(_e)<0&&this.services.languageUtils.isSupportedCode(_e));return $.length?(this.options.preload=_.concat($),this.loadResources(_e=>{a.resolve(),s&&s(_e)}),a):(s&&s(),Promise.resolve())}dir(o){var _,$;if(o||(o=this.resolvedLanguage||(((_=this.languages)==null?void 0:_.length)>0?this.languages[0]:this.language)),!o)return"rtl";const s=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],a=(($=this.services)==null?void 0:$.languageUtils)||new LanguageUtil(get$1());return s.indexOf(a.getLanguagePartFromCode(o))>-1||o.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0;return new I18n(o,s)}cloneInstance(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:noop$2;const a=o.forkResourceStore;a&&delete o.forkResourceStore;const _={...this.options,...o,isClone:!0},$=new I18n(_);if((o.debug!==void 0||o.prefix!==void 0)&&($.logger=$.logger.clone(o)),["store","services","language"].forEach(tt=>{$[tt]=this[tt]}),$.services={...this.services},$.services.utils={hasLoadedNamespace:$.hasLoadedNamespace.bind($)},a){const tt=Object.keys(this.store.data).reduce((st,it)=>(st[it]={...this.store.data[it]},Object.keys(st[it]).reduce((nt,et)=>(nt[et]={...st[it][et]},nt),{})),{});$.store=new ResourceStore(tt,_),$.services.resourceStore=$.store}return $.translator=new Translator($.services,_),$.translator.on("*",function(tt){for(var st=arguments.length,it=new Array(st>1?st-1:0),nt=1;nt{const i=localStorage.getItem(IMAGE_COMPRESSION_QUALITY_KEY);if(i){const o=parseFloat(i);if(!Number.isNaN(o)&&o>=.1&&o<=1)return o}return DEFAULT_IMAGE_COMPRESSION_QUALITY},loadInitialImageMaxWidth=()=>{const i=localStorage.getItem(IMAGE_MAX_WIDTH_KEY);if(i){const o=parseInt(i,10);if(!Number.isNaN(o)&&o>0)return o}return DEFAULT_IMAGE_MAX_WIDTH},useGeneralSettings=({bgUrlContext:i,confName:o,setConfName:s,baseUrl:a,wsUrl:_,onWsUrlChange:$,onBaseUrlChange:_e,onSave:tt,onCancel:st})=>{var It;const{showSubtitle:it,setShowSubtitle:nt}=useSubtitle(),{setUseCameraBackground:et}=i||{},{startBackgroundCamera:j,stopBackgroundCamera:rt}=useCamera(),{configFiles:ot,getFilenameByName:at}=useConfig(),{switchCharacter:lt}=useSwitchCharacter(),ut=()=>{if(!(i!=null&&i.backgroundUrl))return[];const St=i.backgroundUrl.replace(a,"");return St.startsWith("/bg/")?[St]:[]},ct=()=>{if(!o)return[];const Pt=at(o);return Pt?[Pt]:[]},dt={language:[instance.language||"en"],customBgUrl:(It=i==null?void 0:i.backgroundUrl)!=null&&It.includes("/bg/")?"":(i==null?void 0:i.backgroundUrl)||"",selectedBgUrl:ut(),backgroundUrl:(i==null?void 0:i.backgroundUrl)||"",selectedCharacterPreset:ct(),useCameraBackground:(i==null?void 0:i.useCameraBackground)||!1,wsUrl:_||defaultWsUrl,baseUrl:a||defaultBaseUrl,showSubtitle:it,imageCompressionQuality:loadInitialCompressionQuality(),imageMaxWidth:loadInitialImageMaxWidth()},[ft,ht]=reactExports.useState(dt),[bt,yt]=reactExports.useState(dt),mt=o;reactExports.useEffect(()=>{nt(ft.showSubtitle);const Pt=ft.customBgUrl||ft.selectedBgUrl[0];if(Pt&&i){const St=Pt.startsWith("http")?Pt:`${a}${Pt}`;i.setBackgroundUrl(St)}$(ft.wsUrl),_e(ft.baseUrl),ft.language&&ft.language[0]&&ft.language[0]!==instance.language&&instance.changeLanguage(ft.language[0]),localStorage.setItem(IMAGE_COMPRESSION_QUALITY_KEY,ft.imageCompressionQuality.toString()),localStorage.setItem(IMAGE_MAX_WIDTH_KEY,ft.imageMaxWidth.toString())},[ft,i,a,$,_e,nt]),reactExports.useEffect(()=>{if(o){const Pt=at(o);if(Pt){const St={...ft,selectedCharacterPreset:[Pt]};ht(St),yt(St)}}},[o]),reactExports.useEffect(()=>{if(!tt||!st)return;const Pt=tt(()=>{vt()}),St=st(()=>{wt()});return()=>{Pt==null||Pt(),St==null||St()}},[tt,st]);const gt=(Pt,St)=>{ht(Rt=>({...Rt,[Pt]:St})),Pt==="wsUrl"&&$(St),Pt==="baseUrl"&&_e(St),Pt==="language"&&Array.isArray(St)&&St.length>0&&instance.changeLanguage(St[0])},vt=()=>{yt(ft)},wt=()=>{ht(bt),nt(bt.showSubtitle),i&&(i.setBackgroundUrl(bt.backgroundUrl),i.setUseCameraBackground(bt.useCameraBackground)),$(bt.wsUrl),_e(bt.baseUrl),mt&&s(mt),bt.useCameraBackground?j():rt()};return{settings:ft,handleSettingChange:gt,handleSave:vt,handleCancel:wt,handleCameraToggle:async Pt=>{if(et)if(Pt)try{await j(),gt("useCameraBackground",!0),et(!0)}catch(St){console.error("Failed to start camera:",St),gt("useCameraBackground",!1),et(!1)}else rt(),gt("useCameraBackground",!1),et(!1)},handleCharacterPresetChange:Pt=>{const St=Pt[0],Rt=ot.find(Mt=>Mt.filename===St),At=o?at(o):"";gt("selectedCharacterPreset",Pt),At!==St&&Rt&<(St)},showSubtitle:it,setShowSubtitle:nt}};function HiQuestionMarkCircle(i){return GenIcon({attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-3a1 1 0 00-.867.5 1 1 0 11-1.731-1A3 3 0 0113 8a3.001 3.001 0 01-2 2.83V11a1 1 0 11-2 0v-1a1 1 0 011-1 1 1 0 100-2zm0 8a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"},child:[]}]})(i)}const Field=reactExports.forwardRef((i,o)=>{const{label:s,children:a,helperText:_,errorText:$,optionalText:_e,...tt}=i;return jsxRuntimeExports.jsxs(FieldRoot,{ref:o,...tt,children:[s&&jsxRuntimeExports.jsxs(FieldLabel,{children:[s,jsxRuntimeExports.jsx(FieldRequiredIndicator,{fallback:_e})]}),a,_&&jsxRuntimeExports.jsx(FieldHelperText,{children:_}),$&&jsxRuntimeExports.jsx(FieldErrorText,{children:$})]})}),Switch=reactExports.forwardRef((i,o)=>{const{inputProps:s,children:a,rootRef:_,trackLabel:$,thumbLabel:_e,...tt}=i;return jsxRuntimeExports.jsxs(SwitchRoot,{ref:_,...tt,children:[jsxRuntimeExports.jsx(SwitchHiddenInput,{ref:o,...s}),jsxRuntimeExports.jsxs(SwitchControl,{children:[jsxRuntimeExports.jsx(SwitchThumb,{children:_e&&jsxRuntimeExports.jsx(SwitchThumbIndicator,{fallback:_e==null?void 0:_e.off,children:_e==null?void 0:_e.on})}),$&&jsxRuntimeExports.jsx(SwitchIndicator,{fallback:$.off,children:$.on})]}),a!=null&&jsxRuntimeExports.jsx(SwitchLabel,{children:a})]})}),Tooltip=reactExports.forwardRef((i,o)=>{const{showArrow:s,children:a,disabled:_,portalled:$,content:_e,contentProps:tt,portalRef:st,...it}=i;return _?a:jsxRuntimeExports.jsxs(TooltipRoot,{...it,children:[jsxRuntimeExports.jsx(TooltipTrigger,{asChild:!0,children:a}),jsxRuntimeExports.jsx(Portal,{disabled:!$,container:st,children:jsxRuntimeExports.jsx(TooltipPositioner,{children:jsxRuntimeExports.jsxs(TooltipContent,{ref:o,...tt,children:[s&&jsxRuntimeExports.jsx(TooltipArrow,{children:jsxRuntimeExports.jsx(TooltipArrowTip,{})}),_e]})})})]})}),SelectTrigger=reactExports.forwardRef((i,o)=>{const{children:s,clearable:a,..._}=i;return jsxRuntimeExports.jsxs(SelectControl,{..._,children:[jsxRuntimeExports.jsx(SelectTrigger$1,{ref:o,children:s}),jsxRuntimeExports.jsxs(SelectIndicatorGroup,{children:[a&&jsxRuntimeExports.jsx(SelectClearTrigger,{}),jsxRuntimeExports.jsx(SelectIndicator,{})]})]})}),SelectClearTrigger=reactExports.forwardRef((i,o)=>jsxRuntimeExports.jsx(SelectClearTrigger$1,{asChild:!0,...i,ref:o,children:jsxRuntimeExports.jsx(CloseButton,{size:"xs",variant:"plain",focusVisibleRing:"inside",focusRingWidth:"2px",pointerEvents:"auto"})})),SelectContent=reactExports.forwardRef((i,o)=>{const{portalled:s=!0,portalRef:a,..._}=i;return jsxRuntimeExports.jsx(Portal,{disabled:!s,container:a,children:jsxRuntimeExports.jsx(SelectPositioner,{children:jsxRuntimeExports.jsx(SelectContent$1,{..._,ref:o})})})}),SelectItem=reactExports.forwardRef((i,o)=>{const{item:s,children:a,..._}=i;return jsxRuntimeExports.jsxs(SelectItem$1,{item:s,..._,ref:o,children:[a,jsxRuntimeExports.jsx(SelectItemIndicator,{})]},s.value)}),SelectValueText=reactExports.forwardRef((i,o)=>{const{children:s,...a}=i;return jsxRuntimeExports.jsx(SelectValueText$1,{...a,ref:o,children:jsxRuntimeExports.jsx(SelectContext,{children:_=>{const $=_.selectedItems;return $.length===0?i.placeholder:s?s($):$.length===1?_.collection.stringifyItem($[0]):`${$.length} selected`}})})}),SelectRoot=reactExports.forwardRef((i,o)=>jsxRuntimeExports.jsx(SelectRoot$1,{...i,ref:o,positioning:{sameWidth:!0,...i.positioning},children:i.asChild?i.children:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(SelectHiddenSelect,{}),i.children]})}));reactExports.forwardRef((i,o)=>{const{children:s,label:a,..._}=i;return jsxRuntimeExports.jsxs(SelectItemGroup,{..._,ref:o,children:[jsxRuntimeExports.jsx(SelectItemGroupLabel,{children:a}),s]})});function HelpIcon({content:i}){const[o,s]=reactExports.useState(!1),a=()=>s(!0),_=()=>s(!1);return jsxRuntimeExports.jsx(Tooltip,{showArrow:!0,content:jsxRuntimeExports.jsx(Text,{fontSize:"sm",maxW:"300px",lineHeight:"1.4",children:i}),open:o,children:jsxRuntimeExports.jsx(Box,{as:HiQuestionMarkCircle,color:"gray.400",_hover:{color:"gray.600"},cursor:"help",w:"16px",h:"16px",ml:"2",transition:"color 0.2s",onMouseEnter:a,onMouseLeave:_})})}function SelectField({label:i,value:o,onChange:s,collection:a,placeholder:_}){return jsxRuntimeExports.jsx(Field,{...settingStyles.general.field,label:jsxRuntimeExports.jsx(Text,{...settingStyles.general.field.label,children:i}),children:jsxRuntimeExports.jsxs(SelectRoot,{...settingStyles.general.select.root,collection:a,value:o,onValueChange:$=>s($.value),children:[jsxRuntimeExports.jsx(SelectTrigger,{...settingStyles.general.select.trigger,children:jsxRuntimeExports.jsx(SelectValueText,{placeholder:_})}),jsxRuntimeExports.jsx(SelectContent,{children:a.items.map($=>jsxRuntimeExports.jsx(SelectItem,{item:$,children:$.label},$.value))})]})})}function NumberField({label:i,value:o,onChange:s,min:a,max:_,step:$,allowMouseWheel:_e,help:tt}){return jsxRuntimeExports.jsx(Field,{...settingStyles.common.field,label:jsxRuntimeExports.jsxs(Flex,{align:"center",children:[jsxRuntimeExports.jsx(Text,{...settingStyles.common.fieldLabel,children:i}),tt&&jsxRuntimeExports.jsx(HelpIcon,{content:tt})]}),children:jsxRuntimeExports.jsxs(NumberInputRoot,{...settingStyles.common.numberInput.root,value:o.toString(),onValueChange:st=>s(st.value),min:a,max:_,step:$,allowMouseWheel:_e,children:[jsxRuntimeExports.jsx(NumberInputInput,{...settingStyles.common.numberInput.input}),jsxRuntimeExports.jsxs(NumberInputControl,{children:[jsxRuntimeExports.jsx(NumberInputIncrementTrigger,{}),jsxRuntimeExports.jsx(NumberInputDecrementTrigger,{})]})]})})}function SwitchField({label:i,checked:o,onChange:s,help:a}){return jsxRuntimeExports.jsx(Field,{...settingStyles.common.field,label:jsxRuntimeExports.jsxs(Flex,{align:"center",children:[jsxRuntimeExports.jsx(Text,{...settingStyles.common.fieldLabel,children:i}),a&&jsxRuntimeExports.jsx(HelpIcon,{content:a})]}),children:jsxRuntimeExports.jsx(Switch,{...settingStyles.common.switch,checked:o,onCheckedChange:_=>s(_.checked)})})}function InputField({label:i,value:o,onChange:s,placeholder:a}){return jsxRuntimeExports.jsx(Field,{...settingStyles.general.field,label:jsxRuntimeExports.jsx(Text,{...settingStyles.general.field.label,children:i}),children:jsxRuntimeExports.jsx(Input$1,{...settingStyles.general.input,placeholder:a,value:o,onChange:_=>s(_.target.value)})})}const useCollections=()=>{const{backgroundFiles:i}=useBgUrl()||{},{configFiles:o}=useConfig(),s=createListCollection({items:[{label:"English",value:"en"},{label:"中文",value:"zh"}]}),a=createListCollection({items:(i==null?void 0:i.map($=>({label:String($),value:`/bg/${$}`})))||[]}),_=createListCollection({items:o.map($=>({label:$.name,value:$.filename}))});return{languages:s,backgrounds:a,characterPresets:_}};function General({onSave:i,onCancel:o}){const{t:s,i18n:a}=useTranslation(),_=useBgUrl(),{confName:$,setConfName:_e}=useConfig(),{wsUrl:tt,setWsUrl:st,baseUrl:it,setBaseUrl:nt}=useWebSocket(),et=useCollections(),{settings:j,handleSettingChange:rt,handleCameraToggle:ot,handleCharacterPresetChange:at,showSubtitle:lt,setShowSubtitle:ut}=useGeneralSettings({bgUrlContext:_,confName:$,setConfName:_e,baseUrl:it,wsUrl:tt,onWsUrlChange:st,onBaseUrlChange:nt,onSave:i,onCancel:o});return j.language[0]!==a.language&&rt("language",[a.language]),jsxRuntimeExports.jsxs(Stack,{...settingStyles.common.container,children:[jsxRuntimeExports.jsx(SelectField,{label:s("settings.general.language"),value:j.language,onChange:ct=>rt("language",ct),collection:et.languages,placeholder:s("settings.general.language")}),jsxRuntimeExports.jsx(SwitchField,{label:s("settings.general.useCameraBackground"),checked:j.useCameraBackground,onChange:ot}),jsxRuntimeExports.jsx(SwitchField,{label:s("settings.general.showSubtitle"),checked:lt,onChange:ut}),!j.useCameraBackground&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(SelectField,{label:s("settings.general.backgroundImage"),value:j.selectedBgUrl,onChange:ct=>rt("selectedBgUrl",ct),collection:et.backgrounds,placeholder:s("settings.general.backgroundImage")}),jsxRuntimeExports.jsx(InputField,{label:s("settings.general.customBgUrl"),value:j.customBgUrl,onChange:ct=>rt("customBgUrl",ct),placeholder:s("settings.general.customBgUrlPlaceholder")})]}),jsxRuntimeExports.jsx(SelectField,{label:s("settings.general.characterPreset"),value:j.selectedCharacterPreset,onChange:at,collection:et.characterPresets,placeholder:$||s("settings.general.characterPreset")}),jsxRuntimeExports.jsx(InputField,{label:s("settings.general.wsUrl"),value:j.wsUrl,onChange:ct=>rt("wsUrl",ct),placeholder:"Enter WebSocket URL"}),jsxRuntimeExports.jsx(InputField,{label:s("settings.general.baseUrl"),value:j.baseUrl,onChange:ct=>rt("baseUrl",ct),placeholder:"Enter Base URL"}),jsxRuntimeExports.jsx(InputField,{label:s("settings.general.imageCompressionQuality"),value:j.imageCompressionQuality.toString(),onChange:ct=>{const dt=parseFloat(ct);!Number.isNaN(dt)&&dt>=.1&&dt<=1?rt("imageCompressionQuality",dt):ct===""&&rt("imageCompressionQuality",j.imageCompressionQuality)}}),jsxRuntimeExports.jsx(InputField,{label:s("settings.general.imageMaxWidth"),value:j.imageMaxWidth.toString(),onChange:ct=>{const dt=parseInt(ct,10);!Number.isNaN(dt)&&dt>0?rt("imageMaxWidth",dt):ct===""&&rt("imageMaxWidth",j.imageMaxWidth)}})]})}const useLive2dSettings=()=>{const i=useLive2DConfig(),o={url:"",kScale:.5,initialXshift:0,initialYshift:0,emotionMap:{},scrollToResize:!0},[s,a]=reactExports.useState((i==null?void 0:i.modelInfo)||o),[_,$]=reactExports.useState((i==null?void 0:i.modelInfo)||o);return reactExports.useEffect(()=>{i!=null&&i.modelInfo&&JSON.stringify(i.modelInfo)!==JSON.stringify(_)&&($(i.modelInfo),a(i.modelInfo))},[i==null?void 0:i.modelInfo]),reactExports.useEffect(()=>{i&&s&&i.setModelInfo(s)},[s.pointerInteractive,s.scrollToResize]),{modelInfo:s,handleInputChange:(it,nt)=>{a(et=>({...et,[it]:nt}))},handleSave:()=>{i&&s&&$(s)},handleCancel:()=>{a(_),i&&_&&i.setModelInfo(_)}}};function live2D({onSave:i,onCancel:o}){const{t:s}=useTranslation(),{modelInfo:a,handleInputChange:_,handleSave:$,handleCancel:_e}=useLive2dSettings();return reactExports.useEffect(()=>{if(!i||!o)return;const tt=i($),st=o(_e);return()=>{tt==null||tt(),st==null||st()}},[i,o]),jsxRuntimeExports.jsxs(Stack,{...settingStyles.common.container,children:[jsxRuntimeExports.jsx(SwitchField,{label:s("settings.live2d.pointerInteractive"),checked:a.pointerInteractive??!1,onChange:tt=>_("pointerInteractive",tt)}),jsxRuntimeExports.jsx(SwitchField,{label:s("settings.live2d.scrollToResize"),checked:a.scrollToResize??!0,onChange:tt=>_("scrollToResize",tt)})]})}const useASRSettings=()=>{const{settings:i,updateSettings:o,autoStopMic:s,setAutoStopMic:a,autoStartMicOn:_,setAutoStartMicOn:$,autoStartMicOnConvEnd:_e,setAutoStartMicOnConvEnd:tt}=useVAD(),st=reactExports.useRef(i),it=reactExports.useRef(i),nt=reactExports.useRef(s),et=reactExports.useRef(_),j=reactExports.useRef(_e),[rt,ot]=reactExports.useState(s),[at,lt]=reactExports.useState(_),[ut,ct]=reactExports.useState(_e),[,dt]=React.useReducer(vt=>vt+1,0);reactExports.useEffect(()=>{ot(s),lt(_),ct(_e)},[s,_,_e]);const ft=(vt,wt)=>{if(wt===""||wt==="-")st.current={...st.current,[vt]:wt};else{const Ct=Number(wt);isNaN(Ct)||(st.current={...st.current,[vt]:Ct})}dt()},ht=vt=>{ot(vt),a(vt)},bt=vt=>{lt(vt),$(vt)},yt=vt=>{ct(vt),tt(vt)},mt=()=>{o(st.current),it.current=st.current,nt.current=rt,et.current=at,j.current=ut},gt=()=>{st.current=it.current,ot(nt.current),lt(et.current),a(nt.current),$(et.current),ct(j.current),tt(j.current),dt()};return{localSettings:st.current,autoStopMic:rt,autoStartMicOn:at,autoStartMicOnConvEnd:ut,setAutoStopMic:ht,setAutoStartMicOn:bt,setAutoStartMicOnConvEnd:yt,handleInputChange:ft,handleSave:mt,handleCancel:gt}};function ASR({onSave:i,onCancel:o}){const{t:s}=useTranslation(),{localSettings:a,autoStopMic:_,autoStartMicOn:$,autoStartMicOnConvEnd:_e,setAutoStopMic:tt,setAutoStartMicOn:st,setAutoStartMicOnConvEnd:it,handleInputChange:nt,handleSave:et,handleCancel:j}=useASRSettings();return reactExports.useEffect(()=>{if(!i||!o)return;const rt=i(et),ot=o(j);return()=>{rt==null||rt(),ot==null||ot()}},[i,o,et,j]),jsxRuntimeExports.jsxs(Stack,{...settingStyles.common.container,children:[jsxRuntimeExports.jsx(SwitchField,{label:s("settings.asr.autoStopMic"),checked:_,onChange:tt}),jsxRuntimeExports.jsx(SwitchField,{label:s("settings.asr.autoStartMicOnConvEnd"),checked:_e,onChange:it}),jsxRuntimeExports.jsx(SwitchField,{label:s("settings.asr.autoStartMicOn"),checked:$,onChange:st}),jsxRuntimeExports.jsx(NumberField,{label:s("settings.asr.positiveSpeechThreshold"),help:s("settings.asr.positiveSpeechThresholdDesc"),value:a.positiveSpeechThreshold,onChange:rt=>nt("positiveSpeechThreshold",rt),min:1,max:100}),jsxRuntimeExports.jsx(NumberField,{label:s("settings.asr.negativeSpeechThreshold"),help:s("settings.asr.negativeSpeechThresholdDesc"),value:a.negativeSpeechThreshold,onChange:rt=>nt("negativeSpeechThreshold",rt),min:0,max:100}),jsxRuntimeExports.jsx(NumberField,{label:s("settings.asr.redemptionFrames"),help:s("settings.asr.redemptionFramesDesc"),value:a.redemptionFrames,onChange:rt=>nt("redemptionFrames",rt),min:1,max:100})]})}function TTS(){return jsxRuntimeExports.jsx(Box,{children:" "})}function useTriggerSpeak(){const{sendMessage:i}=useWebSocket(),{captureAllMedia:o}=useMediaCapture();return{sendTriggerSignal:reactExports.useCallback(async a=>{const _=await o();i({type:"ai-speak-signal",idle_time:a,images:_})},[i,o])}}const defaultSettings$1={allowProactiveSpeak:!1,idleSecondsToSpeak:5,allowButtonTrigger:!1},ProactiveSpeakContext=reactExports.createContext(null);function ProactiveSpeakProvider({children:i}){const[o,s]=useLocalStorage("proactiveSpeakSettings",defaultSettings$1),{aiState:a}=useAiState(),{sendTriggerSignal:_}=useTriggerSpeak(),$=reactExports.useRef(null),_e=reactExports.useRef(null),tt=reactExports.useCallback(()=>{$.current&&(clearTimeout($.current),$.current=null),_e.current=null},[]),st=reactExports.useCallback(()=>{tt(),o.allowProactiveSpeak&&(_e.current=Date.now(),$.current=setTimeout(()=>{const et=(Date.now()-_e.current)/1e3;_(et)},o.idleSecondsToSpeak*1e3))},[o.allowProactiveSpeak,o.idleSecondsToSpeak,_,tt]);reactExports.useEffect(()=>{a===AiStateEnum.IDLE?st():tt()},[a,st,tt]),reactExports.useEffect(()=>()=>{tt()},[tt]);const it=reactExports.useCallback(et=>{s(et)},[s]),nt=reactExports.useMemo(()=>({settings:o,updateSettings:it}),[o,it]);return jsxRuntimeExports.jsx(ProactiveSpeakContext.Provider,{value:nt,children:i})}function useProactiveSpeak(){const i=reactExports.useContext(ProactiveSpeakContext);if(!i)throw new Error("useProactiveSpeak must be used within a ProactiveSpeakProvider");return i}function useAgentSettings({onSave:i,onCancel:o}={}){const{settings:s,updateSettings:a}=useProactiveSpeak(),[_,$]=reactExports.useState({allowProactiveSpeak:s.allowProactiveSpeak,idleSecondsToSpeak:s.idleSecondsToSpeak,allowButtonTrigger:s.allowButtonTrigger}),[_e,tt]=reactExports.useState({...s});reactExports.useEffect(()=>{s&&(tt(s),$(s))},[s]);const st=reactExports.useCallback(rt=>{$(ot=>({...ot,allowProactiveSpeak:rt}))},[]),it=reactExports.useCallback(rt=>{$(ot=>({...ot,idleSecondsToSpeak:rt}))},[]),nt=reactExports.useCallback(rt=>{$(ot=>({...ot,allowButtonTrigger:rt}))},[]),et=reactExports.useCallback(()=>{a(_),tt(_)},[a,_]),j=reactExports.useCallback(()=>{$(_e),a(_e)},[_e,a]);return reactExports.useEffect(()=>{if(!i||!o)return;const rt=i(et),ot=o(j);return()=>{rt==null||rt(),ot==null||ot()}},[i,o,et,j]),{settings:_,handleAllowProactiveSpeakChange:st,handleIdleSecondsChange:it,handleAllowButtonTriggerChange:nt}}function Agent({onSave:i,onCancel:o}){const{t:s}=useTranslation(),{settings:a,handleAllowProactiveSpeakChange:_,handleIdleSecondsChange:$,handleAllowButtonTriggerChange:_e}=useAgentSettings({onSave:i,onCancel:o});return jsxRuntimeExports.jsxs(Stack,{...settingStyles.common.container,children:[jsxRuntimeExports.jsx(SwitchField,{label:s("settings.agent.allowProactiveSpeak"),checked:a.allowProactiveSpeak,onChange:_}),a.allowProactiveSpeak&&jsxRuntimeExports.jsx(NumberField,{label:s("settings.agent.idleSecondsToSpeak"),value:a.idleSecondsToSpeak,onChange:tt=>$(Number(tt)),min:0,step:.1,allowMouseWheel:!0}),jsxRuntimeExports.jsx(SwitchField,{label:s("settings.agent.allowButtonTrigger"),checked:a.allowButtonTrigger,onChange:_e})]})}function FaGithub(i){return GenIcon({attr:{viewBox:"0 0 496 512"},child:[{tag:"path",attr:{d:"M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"},child:[]}]})(i)}function FaBook(i){return GenIcon({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M448 360V24c0-13.3-10.7-24-24-24H96C43 0 0 43 0 96v320c0 53 43 96 96 96h328c13.3 0 24-10.7 24-24v-16c0-7.5-3.5-14.3-8.9-18.7-4.2-15.4-4.2-59.3 0-74.7 5.4-4.3 8.9-11.1 8.9-18.6zM128 134c0-3.3 2.7-6 6-6h212c3.3 0 6 2.7 6 6v20c0 3.3-2.7 6-6 6H134c-3.3 0-6-2.7-6-6v-20zm0 64c0-3.3 2.7-6 6-6h212c3.3 0 6 2.7 6 6v20c0 3.3-2.7 6-6 6H134c-3.3 0-6-2.7-6-6v-20zm253.4 250H96c-17.7 0-32-14.3-32-32 0-17.6 14.4-32 32-32h285.4c-1.9 17.1-1.9 46.9 0 64z"},child:[]}]})(i)}function FaCheck(i){return GenIcon({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"},child:[]}]})(i)}function FaTimes(i){return GenIcon({attr:{viewBox:"0 0 352 512"},child:[{tag:"path",attr:{d:"M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"},child:[]}]})(i)}function FaTools(i){return GenIcon({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M501.1 395.7L384 278.6c-23.1-23.1-57.6-27.6-85.4-13.9L192 158.1V96L64 0 0 64l96 128h62.1l106.6 106.6c-13.6 27.8-9.2 62.3 13.9 85.4l117.1 117.1c14.6 14.6 38.2 14.6 52.7 0l52.7-52.7c14.5-14.6 14.5-38.2 0-52.7zM331.7 225c28.3 0 54.9 11 74.9 31l19.4 19.4c15.8-6.9 30.8-16.5 43.8-29.5 37.1-37.1 49.7-89.3 37.9-136.7-2.2-9-13.5-12.1-20.1-5.5l-74.4 74.4-67.9-11.3L334 98.9l74.4-74.4c6.6-6.6 3.4-17.9-5.7-20.2-47.4-11.7-99.6.9-136.6 37.9-28.5 28.5-41.9 66.1-41.2 103.6l82.1 82.1c8.1-1.9 16.5-2.9 24.7-2.9zm-103.9 82l-56.7-56.7L18.7 402.8c-25 25-25 65.5 0 90.5s65.5 25 90.5 0l123.6-123.6c-7.6-19.9-9.9-41.6-5-62.7zM64 472c-13.2 0-24-10.8-24-24 0-13.3 10.7-24 24-24s24 10.7 24 24c0 13.2-10.7 24-24 24z"},child:[]}]})(i)}const Button$1=reactExports.forwardRef((i,o)=>{const{loading:s,disabled:a,loadingText:_,children:$,..._e}=i;return jsxRuntimeExports.jsx(Button$2,{disabled:s||a,ref:o,..._e,children:s&&!_?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(AbsoluteCenter,{display:"inline-flex",children:jsxRuntimeExports.jsx(Spinner,{size:"inherit",color:"inherit"})}),jsxRuntimeExports.jsx(Span,{opacity:0,children:$})]}):s&&_?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Spinner,{size:"inherit",color:"inherit"}),_]}):$})});function About(){const{t:i}=useTranslation(),o=a=>{window.open(a,"_blank")};return jsxRuntimeExports.jsxs(Stack,{...settingStyles.common.container,gap:3,children:[jsxRuntimeExports.jsx(Heading,{size:"md",mb:1,children:i("settings.about.title")}),jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(Text,{fontWeight:"bold",mb:0,children:i("settings.about.version")}),jsxRuntimeExports.jsx(Text,{children:"1.2.1"})]}),jsxRuntimeExports.jsx(Box,{borderTop:"1px solid",borderColor:"whiteAlpha.200",pt:2,mt:1}),jsxRuntimeExports.jsxs(Box,{mt:1,children:[jsxRuntimeExports.jsx(Text,{fontWeight:"bold",mb:1,children:i("settings.about.projectLinks")}),jsxRuntimeExports.jsxs(HStack,{mt:1,gap:2,children:[jsxRuntimeExports.jsxs(Button$1,{size:"sm",onClick:()=>o("https://github.com/Open-LLM-VTuber/Open-LLM-VTuber-Web"),children:[jsxRuntimeExports.jsx(Icon,{as:FaGithub,mr:2})," ",i("settings.about.github")]}),jsxRuntimeExports.jsxs(Button$1,{size:"sm",onClick:()=>o("https://docs.llmvtuber.com"),children:[jsxRuntimeExports.jsx(Icon,{as:FaBook,mr:2})," ",i("settings.about.documentation")]})]})]}),jsxRuntimeExports.jsx(Box,{borderTop:"1px solid",borderColor:"whiteAlpha.200",pt:2,mt:1}),jsxRuntimeExports.jsx(Box,{mt:1,children:jsxRuntimeExports.jsx(Button$1,{size:"xs",colorPalette:"blue",onClick:()=>o("https://github.com/Open-LLM-VTuber/Open-LLM-VTuber-Web/blob/main/LICENSE"),children:i("settings.about.viewLicense")})}),jsxRuntimeExports.jsxs(Box,{mt:1,children:[jsxRuntimeExports.jsx(Text,{fontWeight:"bold",mb:0,children:i("settings.about.copyright")}),jsxRuntimeExports.jsxs(Text,{children:["© ",new Date().getFullYear()," Open LLM VTuber Team"]})]})]})}function SettingUI({open:i,onClose:o}){const{t:s}=useTranslation(),[a,_]=reactExports.useState([]),[$,_e]=reactExports.useState([]),[tt,st]=reactExports.useState("general"),it=reactExports.useCallback(ot=>(_(at=>[...at,ot]),()=>{_(at=>at.filter(lt=>lt!==ot))}),[]),nt=reactExports.useCallback(ot=>(_e(at=>[...at,ot]),()=>{_e(at=>at.filter(lt=>lt!==ot))}),[]),et=reactExports.useCallback(()=>{a.forEach(ot=>ot()),o()},[a,o]),j=reactExports.useCallback(()=>{$.forEach(ot=>ot()),o()},[$,o]),rt=reactExports.useMemo(()=>jsxRuntimeExports.jsxs(TabsContentGroup,{children:[jsxRuntimeExports.jsx(TabsContent,{value:"general",...settingStyles.settingUI.tabs.content,children:jsxRuntimeExports.jsx(General,{onSave:it,onCancel:nt})}),jsxRuntimeExports.jsx(TabsContent,{value:"live2d",...settingStyles.settingUI.tabs.content,children:jsxRuntimeExports.jsx(live2D,{onSave:it,onCancel:nt})}),jsxRuntimeExports.jsx(TabsContent,{value:"asr",...settingStyles.settingUI.tabs.content,children:jsxRuntimeExports.jsx(ASR,{onSave:it,onCancel:nt})}),jsxRuntimeExports.jsx(TabsContent,{value:"tts",...settingStyles.settingUI.tabs.content,children:jsxRuntimeExports.jsx(TTS,{})}),jsxRuntimeExports.jsx(TabsContent,{value:"agent",...settingStyles.settingUI.tabs.content,children:jsxRuntimeExports.jsx(Agent,{onSave:it,onCancel:nt})}),jsxRuntimeExports.jsx(TabsContent,{value:"about",...settingStyles.settingUI.tabs.content,children:jsxRuntimeExports.jsx(About,{})})]}),[it,nt]);return jsxRuntimeExports.jsxs(DrawerRoot$1,{open:i,onOpenChange:ot=>ot.open?null:o(),placement:"start",children:[jsxRuntimeExports.jsx(DrawerBackdrop$1,{}),jsxRuntimeExports.jsxs(DrawerContent$1,{...settingStyles.settingUI.drawerContent,children:[jsxRuntimeExports.jsxs(DrawerHeader$1,{...settingStyles.settingUI.drawerHeader,children:[jsxRuntimeExports.jsx(DrawerTitle$1,{...settingStyles.settingUI.drawerTitle,children:s("common.settings")}),jsxRuntimeExports.jsx("div",{...settingStyles.settingUI.closeButton,children:jsxRuntimeExports.jsx(DrawerCloseTrigger$1,{asChild:!0,onClick:j,children:jsxRuntimeExports.jsx(CloseButton,{size:"sm",color:"white"})})})]}),jsxRuntimeExports.jsx(DrawerBody$1,{children:jsxRuntimeExports.jsxs(TabsRoot,{defaultValue:"general",value:tt,onValueChange:ot=>st(ot.value),...settingStyles.settingUI.tabs.root,children:[jsxRuntimeExports.jsxs(TabsList,{...settingStyles.settingUI.tabs.list,children:[jsxRuntimeExports.jsx(TabsTrigger,{value:"general",...settingStyles.settingUI.tabs.trigger,children:s("settings.tabs.general")}),jsxRuntimeExports.jsx(TabsTrigger,{value:"live2d",...settingStyles.settingUI.tabs.trigger,children:s("settings.tabs.live2d")}),jsxRuntimeExports.jsx(TabsTrigger,{value:"asr",...settingStyles.settingUI.tabs.trigger,children:s("settings.tabs.asr")}),jsxRuntimeExports.jsx(TabsTrigger,{value:"tts",...settingStyles.settingUI.tabs.trigger,children:s("settings.tabs.tts")}),jsxRuntimeExports.jsx(TabsTrigger,{value:"agent",...settingStyles.settingUI.tabs.trigger,children:s("settings.tabs.agent")}),jsxRuntimeExports.jsx(TabsTrigger,{value:"about",...settingStyles.settingUI.tabs.trigger,children:s("settings.tabs.about")})]}),rt]})}),jsxRuntimeExports.jsxs(DrawerFooter$1,{children:[jsxRuntimeExports.jsx(Button$2,{colorPalette:"red",onClick:j,children:s("common.cancel")}),jsxRuntimeExports.jsx(Button$2,{colorPalette:"blue",onClick:et,children:s("common.save")})]})]})]})}var propTypes={exports:{}},ReactPropTypesSecret$1="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",ReactPropTypesSecret_1=ReactPropTypesSecret$1,ReactPropTypesSecret=ReactPropTypesSecret_1;function emptyFunction(){}function emptyFunctionWithReset(){}emptyFunctionWithReset.resetWarningCache=emptyFunction;var factoryWithThrowingShims=function(){function i(a,_,$,_e,tt,st){if(st!==ReactPropTypesSecret){var it=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw it.name="Invariant Violation",it}}i.isRequired=i;function o(){return i}var s={array:i,bigint:i,bool:i,func:i,number:i,object:i,string:i,symbol:i,any:i,arrayOf:o,element:i,elementType:i,instanceOf:o,node:i,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:emptyFunctionWithReset,resetWarningCache:emptyFunction};return s.PropTypes=s,s};propTypes.exports=factoryWithThrowingShims();var propTypesExports=propTypes.exports;const PropTypes=getDefaultExportFromCjs(propTypesExports);var prefix="cs",classnames={exports:{}};/*! + Copyright (c) 2018 Jed Watson. + Licensed under the MIT License (MIT), see + http://jedwatson.github.io/classnames +*/(function(i){(function(){var o={}.hasOwnProperty;function s(){for(var $="",_e=0;_e=0)&&Object.prototype.propertyIsEnumerable.call(i,a)&&(s[a]=i[a])}return s}function _objectWithoutPropertiesLoose$w(i,o){if(i==null)return{};var s={},a=Object.keys(i),_,$;for($=0;$=0)&&(s[_]=i[_]);return s}var Status=function i(o){var s=o.status,a=o.size,_=a===void 0?"md":a,$=o.className,_e=o.name,tt=o.selected,st=o.children,it=_objectWithoutProperties$w(o,_excluded$w),nt="".concat(prefix,"-status"),et=React.createElement("div",{className:"".concat(nt,"__bullet")}),j=_e||st;return React.createElement("div",_extends$v({},it,{"aria-selected":tt===!0?"":null,className:classNames(nt,"".concat(nt,"--").concat(_),"".concat(nt,"--").concat(s),_defineProperty$f({},"".concat(nt,"--selected"),tt),_defineProperty$f({},"".concat(nt,"--named"),j),$)}),et,j&&React.createElement("div",{className:"".concat(nt,"__name")},_e||st))};function _typeof$g(i){"@babel/helpers - typeof";return _typeof$g=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof$g(i)}var _excluded$v=["name","src","size","status","className","active","children"];function _extends$u(){return _extends$u=Object.assign?Object.assign.bind():function(i){for(var o=1;o=0)&&Object.prototype.propertyIsEnumerable.call(i,a)&&(s[a]=i[a])}return s}function _objectWithoutPropertiesLoose$v(i,o){if(i==null)return{};var s={},a=Object.keys(i),_,$;for($=0;$=0)&&(s[_]=i[_]);return s}function AvatarInner(i,o){var s=i.name,a=s===void 0?"":s,_=i.src,$=_===void 0?"":_,_e=i.size,tt=_e===void 0?"md":_e,st=i.status,it=i.className,nt=i.active,et=nt===void 0?!1:nt,j=i.children,rt=_objectWithoutProperties$v(i,_excluded$v),ot="".concat(prefix,"-avatar"),at=typeof tt<"u"?" ".concat(ot,"--").concat(tt):"",lt=reactExports.useRef();return reactExports.useImperativeHandle(o,function(){return{focus:function(){return lt.current.focus()}}}),React.createElement("div",_extends$u({ref:lt},rt,{className:classNames("".concat(ot).concat(at),_defineProperty$e({},"".concat(ot,"--active"),et),it)}),j||React.createElement(React.Fragment,null,React.createElement("img",{src:$,alt:a}),typeof st=="string"&&React.createElement(Status,{status:st,size:tt})," "))}var Avatar=reactExports.forwardRef(AvatarInner);Avatar.displayName="Avatar";Avatar.propTypes={children:PropTypes.node,name:PropTypes.string,src:PropTypes.string,size:PropTypes.oneOf(SizeEnum),status:PropTypes.oneOf(StatusEnum),active:PropTypes.bool,className:PropTypes.string};function ownKeys$1(i,o){var s=Object.keys(i);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(i);o&&(a=a.filter(function(_){return Object.getOwnPropertyDescriptor(i,_).enumerable})),s.push.apply(s,a)}return s}function _objectSpread$1(i){for(var o=1;o=0)&&Object.prototype.propertyIsEnumerable.call(i,a)&&(s[a]=i[a])}return s}function _objectWithoutPropertiesLoose$u(i,o){if(i==null)return{};var s={},a=Object.keys(i),_,$;for($=0;$=0)&&(s[_]=i[_]);return s}var AvatarGroup=function i(o){var s=o.children,a=o.size,_=a===void 0?"md":a,$=o.className,_e=o.max,tt=o.activeIndex,st=o.hoverToFront,it=_objectWithoutProperties$u(o,_excluded$u),nt="".concat(prefix,"-avatar-group"),et=typeof _e=="number"&&React.Children.count(s)>_e?React.Children.toArray(s).reverse().slice(0,_e):React.Children.toArray(s).reverse(),j=typeof tt=="number"?et.length-tt-1:void 0;return React.createElement("div",_extends$t({},it,{className:classNames(nt,"".concat(nt,"--").concat(_),$)}),et.map(function(rt,ot){var at=typeof j=="number"?{active:j===ot}:{};return st===!0&&(at.className=classNames("".concat(prefix,"-avatar--active-on-hover"),rt.props.className)),React.cloneElement(rt,at)}))};AvatarGroup.displayName="AvatarGroup";var _excluded$t=["children","className","icon","border","labelPosition"];function _extends$s(){return _extends$s=Object.assign?Object.assign.bind():function(i){for(var o=1;o=0)&&Object.prototype.propertyIsEnumerable.call(i,a)&&(s[a]=i[a])}return s}function _objectWithoutPropertiesLoose$t(i,o){if(i==null)return{};var s={},a=Object.keys(i),_,$;for($=0;$=0)&&(s[_]=i[_]);return s}var Button=function i(o){var s=o.children,a=s===void 0?void 0:s,_=o.className,$=_===void 0?"":_,_e=o.icon,tt=_e===void 0?void 0:_e,st=o.border,it=st===void 0?!1:st,nt=o.labelPosition,et=nt===void 0?void 0:nt,j=_objectWithoutProperties$t(o,_excluded$t),rt="".concat(prefix,"-button"),ot=typeof et<"u"?et:"right",at=React.Children.count(a)>0?"".concat(rt,"--").concat(ot):"",lt=it===!0?"".concat(rt,"--border"):"";return React.createElement("button",_extends$s({},j,{className:classNames(rt,at,lt,$)}),ot==="left"&&a,tt,ot==="right"&&a)};/*! + * Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com + * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) + */function _typeof$e(i){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof$e=function(o){return typeof o}:_typeof$e=function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof$e(i)}function _classCallCheck$4(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")}function _defineProperties$4(i,o){for(var s=0;s"u"?setTimeout:setImmediate,asyncQueue=[],asyncTimer;function asyncFlush(){for(var i=0;i-1;_--){var $=s[_],_e=($.tagName||"").toUpperCase();["STYLE","LINK"].indexOf(_e)>-1&&(a=$)}return DOCUMENT.head.insertBefore(o,a),i}}var idPool="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";function nextUniqueId(){for(var i=12,o="";i-- >0;)o+=idPool[Math.random()*62|0];return o}function htmlEscape(i){return"".concat(i).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(//g,">")}function joinAttributes(i){return Object.keys(i||{}).reduce(function(o,s){return o+"".concat(s,'="').concat(htmlEscape(i[s]),'" ')},"").trim()}function joinStyles(i){return Object.keys(i||{}).reduce(function(o,s){return o+"".concat(s,": ").concat(i[s],";")},"")}function transformIsMeaningful(i){return i.size!==meaninglessTransform.size||i.x!==meaninglessTransform.x||i.y!==meaninglessTransform.y||i.rotate!==meaninglessTransform.rotate||i.flipX||i.flipY}function transformForSvg(i){var o=i.transform,s=i.containerWidth,a=i.iconWidth,_={transform:"translate(".concat(s/2," 256)")},$="translate(".concat(o.x*32,", ").concat(o.y*32,") "),_e="scale(".concat(o.size/16*(o.flipX?-1:1),", ").concat(o.size/16*(o.flipY?-1:1),") "),tt="rotate(".concat(o.rotate," 0 0)"),st={transform:"".concat($," ").concat(_e," ").concat(tt)},it={transform:"translate(".concat(a/2*-1," -256)")};return{outer:_,inner:st,path:it}}var ALL_SPACE={x:0,y:0,width:"100%",height:"100%"};function fillBlack(i){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return i.attributes&&(i.attributes.fill||o)&&(i.attributes.fill="black"),i}function deGroup(i){return i.tag==="g"?i.children:[i]}function makeIconMasking(i){var o=i.children,s=i.attributes,a=i.main,_=i.mask,$=i.maskId,_e=i.transform,tt=a.width,st=a.icon,it=_.width,nt=_.icon,et=transformForSvg({transform:_e,containerWidth:it,iconWidth:tt}),j={tag:"rect",attributes:_objectSpread({},ALL_SPACE,{fill:"white"})},rt=st.children?{children:st.children.map(fillBlack)}:{},ot={tag:"g",attributes:_objectSpread({},et.inner),children:[fillBlack(_objectSpread({tag:st.tag,attributes:_objectSpread({},st.attributes,et.path)},rt))]},at={tag:"g",attributes:_objectSpread({},et.outer),children:[ot]},lt="mask-".concat($||nextUniqueId()),ut="clip-".concat($||nextUniqueId()),ct={tag:"mask",attributes:_objectSpread({},ALL_SPACE,{id:lt,maskUnits:"userSpaceOnUse",maskContentUnits:"userSpaceOnUse"}),children:[j,at]},dt={tag:"defs",children:[{tag:"clipPath",attributes:{id:ut},children:deGroup(nt)},ct]};return o.push(dt,{tag:"rect",attributes:_objectSpread({fill:"currentColor","clip-path":"url(#".concat(ut,")"),mask:"url(#".concat(lt,")")},ALL_SPACE)}),{children:o,attributes:s}}function makeIconStandard(i){var o=i.children,s=i.attributes,a=i.main,_=i.transform,$=i.styles,_e=joinStyles($);if(_e.length>0&&(s.style=_e),transformIsMeaningful(_)){var tt=transformForSvg({transform:_,containerWidth:a.width,iconWidth:a.width});o.push({tag:"g",attributes:_objectSpread({},tt.outer),children:[{tag:"g",attributes:_objectSpread({},tt.inner),children:[{tag:a.icon.tag,children:a.icon.children,attributes:_objectSpread({},a.icon.attributes,tt.path)}]}]})}else o.push(a.icon);return{children:o,attributes:s}}function asIcon(i){var o=i.children,s=i.main,a=i.mask,_=i.attributes,$=i.styles,_e=i.transform;if(transformIsMeaningful(_e)&&s.found&&!a.found){var tt=s.width,st=s.height,it={x:tt/st/2,y:.5};_.style=joinStyles(_objectSpread({},$,{"transform-origin":"".concat(it.x+_e.x/16,"em ").concat(it.y+_e.y/16,"em")}))}return[{tag:"svg",attributes:_,children:o}]}function asSymbol(i){var o=i.prefix,s=i.iconName,a=i.children,_=i.attributes,$=i.symbol,_e=$===!0?"".concat(o,"-").concat(config.familyPrefix,"-").concat(s):$;return[{tag:"svg",attributes:{style:"display: none;"},children:[{tag:"symbol",attributes:_objectSpread({},_,{id:_e}),children:a}]}]}function makeInlineSvgAbstract(i){var o=i.icons,s=o.main,a=o.mask,_=i.prefix,$=i.iconName,_e=i.transform,tt=i.symbol,st=i.title,it=i.maskId,nt=i.titleId,et=i.extra,j=i.watchable,rt=j===void 0?!1:j,ot=a.found?a:s,at=ot.width,lt=ot.height,ut=_==="fak",ct=ut?"":"fa-w-".concat(Math.ceil(at/lt*16)),dt=[config.replacementClass,$?"".concat(config.familyPrefix,"-").concat($):"",ct].filter(function(vt){return et.classes.indexOf(vt)===-1}).filter(function(vt){return vt!==""||!!vt}).concat(et.classes).join(" "),ft={children:[],attributes:_objectSpread({},et.attributes,{"data-prefix":_,"data-icon":$,class:dt,role:et.attributes.role||"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 ".concat(at," ").concat(lt)})},ht=ut&&!~et.classes.indexOf("fa-fw")?{width:"".concat(at/lt*16*.0625,"em")}:{};rt&&(ft.attributes[DATA_FA_I2SVG]=""),st&&ft.children.push({tag:"title",attributes:{id:ft.attributes["aria-labelledby"]||"title-".concat(nt||nextUniqueId())},children:[st]});var bt=_objectSpread({},ft,{prefix:_,iconName:$,main:s,mask:a,maskId:it,transform:_e,symbol:tt,styles:_objectSpread({},ht,et.styles)}),yt=a.found&&s.found?makeIconMasking(bt):makeIconStandard(bt),mt=yt.children,gt=yt.attributes;return bt.children=mt,bt.attributes=gt,tt?asSymbol(bt):asIcon(bt)}config.measurePerformance&&PERFORMANCE&&PERFORMANCE.mark&&PERFORMANCE.measure;var reduce=function i(o,s,a,_){var $=Object.keys(o),_e=$.length,tt=s,st,it,nt;for(a===void 0?(st=1,nt=o[$[0]]):(st=0,nt=a);st<_e;st++)it=$[st],nt=tt(nt,o[it],it,o);return nt};function defineIcons(i,o){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=s.skipHooks,_=a===void 0?!1:a,$=Object.keys(o).reduce(function(_e,tt){var st=o[tt],it=!!st.icon;return it?_e[st.iconName]=st.icon:_e[tt]=st,_e},{});typeof namespace.hooks.addPack=="function"&&!_?namespace.hooks.addPack(i,$):namespace.styles[i]=_objectSpread({},namespace.styles[i]||{},$),i==="fas"&&defineIcons("fa",o)}var styles=namespace.styles,shims=namespace.shims,build=function i(){var o=function(_){return reduce(styles,function($,_e,tt){return $[tt]=reduce(_e,_,{}),$},{})};o(function(a,_,$){return _[3]&&(a[_[3]]=$),a}),o(function(a,_,$){var _e=_[2];return a[$]=$,_e.forEach(function(tt){a[tt]=$}),a});var s="far"in styles;reduce(shims,function(a,_){var $=_[0],_e=_[1],tt=_[2];return _e==="far"&&!s&&(_e="fas"),a[$]={prefix:_e,iconName:tt},a},{})};build();namespace.styles;function iconFromMapping(i,o,s){if(i&&i[o]&&i[o][s])return{prefix:o,iconName:s,icon:i[o][s]}}function toHtml(i){var o=i.tag,s=i.attributes,a=s===void 0?{}:s,_=i.children,$=_===void 0?[]:_;return typeof i=="string"?htmlEscape(i):"<".concat(o," ").concat(joinAttributes(a),">").concat($.map(toHtml).join(""),"")}var parseTransformString=function i(o){var s={size:16,x:0,y:0,flipX:!1,flipY:!1,rotate:0};return o?o.toLowerCase().split(" ").reduce(function(a,_){var $=_.toLowerCase().split("-"),_e=$[0],tt=$.slice(1).join("-");if(_e&&tt==="h")return a.flipX=!0,a;if(_e&&tt==="v")return a.flipY=!0,a;if(tt=parseFloat(tt),isNaN(tt))return a;switch(_e){case"grow":a.size=a.size+tt;break;case"shrink":a.size=a.size-tt;break;case"left":a.x=a.x-tt;break;case"right":a.x=a.x+tt;break;case"up":a.y=a.y-tt;break;case"down":a.y=a.y+tt;break;case"rotate":a.rotate=a.rotate+tt;break}return a},s):s};function MissingIcon(i){this.name="MissingIcon",this.message=i||"Icon unavailable",this.stack=new Error().stack}MissingIcon.prototype=Object.create(Error.prototype);MissingIcon.prototype.constructor=MissingIcon;var FILL={fill:"currentColor"},ANIMATION_BASE={attributeType:"XML",repeatCount:"indefinite",dur:"2s"};_objectSpread({},FILL,{d:"M156.5,447.7l-12.6,29.5c-18.7-9.5-35.9-21.2-51.5-34.9l22.7-22.7C127.6,430.5,141.5,440,156.5,447.7z M40.6,272H8.5 c1.4,21.2,5.4,41.7,11.7,61.1L50,321.2C45.1,305.5,41.8,289,40.6,272z M40.6,240c1.4-18.8,5.2-37,11.1-54.1l-29.5-12.6 C14.7,194.3,10,216.7,8.5,240H40.6z M64.3,156.5c7.8-14.9,17.2-28.8,28.1-41.5L69.7,92.3c-13.7,15.6-25.5,32.8-34.9,51.5 L64.3,156.5z M397,419.6c-13.9,12-29.4,22.3-46.1,30.4l11.9,29.8c20.7-9.9,39.8-22.6,56.9-37.6L397,419.6z M115,92.4 c13.9-12,29.4-22.3,46.1-30.4l-11.9-29.8c-20.7,9.9-39.8,22.6-56.8,37.6L115,92.4z M447.7,355.5c-7.8,14.9-17.2,28.8-28.1,41.5 l22.7,22.7c13.7-15.6,25.5-32.9,34.9-51.5L447.7,355.5z M471.4,272c-1.4,18.8-5.2,37-11.1,54.1l29.5,12.6 c7.5-21.1,12.2-43.5,13.6-66.8H471.4z M321.2,462c-15.7,5-32.2,8.2-49.2,9.4v32.1c21.2-1.4,41.7-5.4,61.1-11.7L321.2,462z M240,471.4c-18.8-1.4-37-5.2-54.1-11.1l-12.6,29.5c21.1,7.5,43.5,12.2,66.8,13.6V471.4z M462,190.8c5,15.7,8.2,32.2,9.4,49.2h32.1 c-1.4-21.2-5.4-41.7-11.7-61.1L462,190.8z M92.4,397c-12-13.9-22.3-29.4-30.4-46.1l-29.8,11.9c9.9,20.7,22.6,39.8,37.6,56.9 L92.4,397z M272,40.6c18.8,1.4,36.9,5.2,54.1,11.1l12.6-29.5C317.7,14.7,295.3,10,272,8.5V40.6z M190.8,50 c15.7-5,32.2-8.2,49.2-9.4V8.5c-21.2,1.4-41.7,5.4-61.1,11.7L190.8,50z M442.3,92.3L419.6,115c12,13.9,22.3,29.4,30.5,46.1 l29.8-11.9C470,128.5,457.3,109.4,442.3,92.3z M397,92.4l22.7-22.7c-15.6-13.7-32.8-25.5-51.5-34.9l-12.6,29.5 C370.4,72.1,384.4,81.5,397,92.4z"});var OPACITY_ANIMATE=_objectSpread({},ANIMATION_BASE,{attributeName:"opacity"});_objectSpread({},FILL,{cx:"256",cy:"364",r:"28"}),_objectSpread({},ANIMATION_BASE,{attributeName:"r",values:"28;14;28;28;14;28;"}),_objectSpread({},OPACITY_ANIMATE,{values:"1;0;1;1;0;1;"});_objectSpread({},FILL,{opacity:"1",d:"M263.7,312h-16c-6.6,0-12-5.4-12-12c0-71,77.4-63.9,77.4-107.8c0-20-17.8-40.2-57.4-40.2c-29.1,0-44.3,9.6-59.2,28.7 c-3.9,5-11.1,6-16.2,2.4l-13.1-9.2c-5.6-3.9-6.9-11.8-2.6-17.2c21.2-27.2,46.4-44.7,91.2-44.7c52.3,0,97.4,29.8,97.4,80.2 c0,67.6-77.4,63.5-77.4,107.8C275.7,306.6,270.3,312,263.7,312z"}),_objectSpread({},OPACITY_ANIMATE,{values:"1;0;0;0;0;1;"});_objectSpread({},FILL,{opacity:"0",d:"M232.5,134.5l7,168c0.3,6.4,5.6,11.5,12,11.5h9c6.4,0,11.7-5.1,12-11.5l7-168c0.3-6.8-5.2-12.5-12-12.5h-23 C237.7,122,232.2,127.7,232.5,134.5z"}),_objectSpread({},OPACITY_ANIMATE,{values:"0;0;1;1;0;0;"});namespace.styles;function asFoundIcon(i){var o=i[0],s=i[1],a=i.slice(4),_=_slicedToArray$7(a,1),$=_[0],_e=null;return Array.isArray($)?_e={tag:"g",attributes:{class:"".concat(config.familyPrefix,"-").concat(DUOTONE_CLASSES.GROUP)},children:[{tag:"path",attributes:{class:"".concat(config.familyPrefix,"-").concat(DUOTONE_CLASSES.SECONDARY),fill:"currentColor",d:$[0]}},{tag:"path",attributes:{class:"".concat(config.familyPrefix,"-").concat(DUOTONE_CLASSES.PRIMARY),fill:"currentColor",d:$[1]}}]}:_e={tag:"path",attributes:{fill:"currentColor",d:$}},{found:!0,width:o,height:s,icon:_e}}namespace.styles;var baseStyles=`svg:not(:root).svg-inline--fa { + overflow: visible; +} + +.svg-inline--fa { + display: inline-block; + font-size: inherit; + height: 1em; + overflow: visible; + vertical-align: -0.125em; +} +.svg-inline--fa.fa-lg { + vertical-align: -0.225em; +} +.svg-inline--fa.fa-w-1 { + width: 0.0625em; +} +.svg-inline--fa.fa-w-2 { + width: 0.125em; +} +.svg-inline--fa.fa-w-3 { + width: 0.1875em; +} +.svg-inline--fa.fa-w-4 { + width: 0.25em; +} +.svg-inline--fa.fa-w-5 { + width: 0.3125em; +} +.svg-inline--fa.fa-w-6 { + width: 0.375em; +} +.svg-inline--fa.fa-w-7 { + width: 0.4375em; +} +.svg-inline--fa.fa-w-8 { + width: 0.5em; +} +.svg-inline--fa.fa-w-9 { + width: 0.5625em; +} +.svg-inline--fa.fa-w-10 { + width: 0.625em; +} +.svg-inline--fa.fa-w-11 { + width: 0.6875em; +} +.svg-inline--fa.fa-w-12 { + width: 0.75em; +} +.svg-inline--fa.fa-w-13 { + width: 0.8125em; +} +.svg-inline--fa.fa-w-14 { + width: 0.875em; +} +.svg-inline--fa.fa-w-15 { + width: 0.9375em; +} +.svg-inline--fa.fa-w-16 { + width: 1em; +} +.svg-inline--fa.fa-w-17 { + width: 1.0625em; +} +.svg-inline--fa.fa-w-18 { + width: 1.125em; +} +.svg-inline--fa.fa-w-19 { + width: 1.1875em; +} +.svg-inline--fa.fa-w-20 { + width: 1.25em; +} +.svg-inline--fa.fa-pull-left { + margin-right: 0.3em; + width: auto; +} +.svg-inline--fa.fa-pull-right { + margin-left: 0.3em; + width: auto; +} +.svg-inline--fa.fa-border { + height: 1.5em; +} +.svg-inline--fa.fa-li { + width: 2em; +} +.svg-inline--fa.fa-fw { + width: 1.25em; +} + +.fa-layers svg.svg-inline--fa { + bottom: 0; + left: 0; + margin: auto; + position: absolute; + right: 0; + top: 0; +} + +.fa-layers { + display: inline-block; + height: 1em; + position: relative; + text-align: center; + vertical-align: -0.125em; + width: 1em; +} +.fa-layers svg.svg-inline--fa { + -webkit-transform-origin: center center; + transform-origin: center center; +} + +.fa-layers-counter, .fa-layers-text { + display: inline-block; + position: absolute; + text-align: center; +} + +.fa-layers-text { + left: 50%; + top: 50%; + -webkit-transform: translate(-50%, -50%); + transform: translate(-50%, -50%); + -webkit-transform-origin: center center; + transform-origin: center center; +} + +.fa-layers-counter { + background-color: #ff253a; + border-radius: 1em; + -webkit-box-sizing: border-box; + box-sizing: border-box; + color: #fff; + height: 1.5em; + line-height: 1; + max-width: 5em; + min-width: 1.5em; + overflow: hidden; + padding: 0.25em; + right: 0; + text-overflow: ellipsis; + top: 0; + -webkit-transform: scale(0.25); + transform: scale(0.25); + -webkit-transform-origin: top right; + transform-origin: top right; +} + +.fa-layers-bottom-right { + bottom: 0; + right: 0; + top: auto; + -webkit-transform: scale(0.25); + transform: scale(0.25); + -webkit-transform-origin: bottom right; + transform-origin: bottom right; +} + +.fa-layers-bottom-left { + bottom: 0; + left: 0; + right: auto; + top: auto; + -webkit-transform: scale(0.25); + transform: scale(0.25); + -webkit-transform-origin: bottom left; + transform-origin: bottom left; +} + +.fa-layers-top-right { + right: 0; + top: 0; + -webkit-transform: scale(0.25); + transform: scale(0.25); + -webkit-transform-origin: top right; + transform-origin: top right; +} + +.fa-layers-top-left { + left: 0; + right: auto; + top: 0; + -webkit-transform: scale(0.25); + transform: scale(0.25); + -webkit-transform-origin: top left; + transform-origin: top left; +} + +.fa-lg { + font-size: 1.3333333333em; + line-height: 0.75em; + vertical-align: -0.0667em; +} + +.fa-xs { + font-size: 0.75em; +} + +.fa-sm { + font-size: 0.875em; +} + +.fa-1x { + font-size: 1em; +} + +.fa-2x { + font-size: 2em; +} + +.fa-3x { + font-size: 3em; +} + +.fa-4x { + font-size: 4em; +} + +.fa-5x { + font-size: 5em; +} + +.fa-6x { + font-size: 6em; +} + +.fa-7x { + font-size: 7em; +} + +.fa-8x { + font-size: 8em; +} + +.fa-9x { + font-size: 9em; +} + +.fa-10x { + font-size: 10em; +} + +.fa-fw { + text-align: center; + width: 1.25em; +} + +.fa-ul { + list-style-type: none; + margin-left: 2.5em; + padding-left: 0; +} +.fa-ul > li { + position: relative; +} + +.fa-li { + left: -2em; + position: absolute; + text-align: center; + width: 2em; + line-height: inherit; +} + +.fa-border { + border: solid 0.08em #eee; + border-radius: 0.1em; + padding: 0.2em 0.25em 0.15em; +} + +.fa-pull-left { + float: left; +} + +.fa-pull-right { + float: right; +} + +.fa.fa-pull-left, +.fas.fa-pull-left, +.far.fa-pull-left, +.fal.fa-pull-left, +.fab.fa-pull-left { + margin-right: 0.3em; +} +.fa.fa-pull-right, +.fas.fa-pull-right, +.far.fa-pull-right, +.fal.fa-pull-right, +.fab.fa-pull-right { + margin-left: 0.3em; +} + +.fa-spin { + -webkit-animation: fa-spin 2s infinite linear; + animation: fa-spin 2s infinite linear; +} + +.fa-pulse { + -webkit-animation: fa-spin 1s infinite steps(8); + animation: fa-spin 1s infinite steps(8); +} + +@-webkit-keyframes fa-spin { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} + +@keyframes fa-spin { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} +.fa-rotate-90 { + -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=1)"; + -webkit-transform: rotate(90deg); + transform: rotate(90deg); +} + +.fa-rotate-180 { + -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2)"; + -webkit-transform: rotate(180deg); + transform: rotate(180deg); +} + +.fa-rotate-270 { + -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=3)"; + -webkit-transform: rotate(270deg); + transform: rotate(270deg); +} + +.fa-flip-horizontal { + -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)"; + -webkit-transform: scale(-1, 1); + transform: scale(-1, 1); +} + +.fa-flip-vertical { + -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)"; + -webkit-transform: scale(1, -1); + transform: scale(1, -1); +} + +.fa-flip-both, .fa-flip-horizontal.fa-flip-vertical { + -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)"; + -webkit-transform: scale(-1, -1); + transform: scale(-1, -1); +} + +:root .fa-rotate-90, +:root .fa-rotate-180, +:root .fa-rotate-270, +:root .fa-flip-horizontal, +:root .fa-flip-vertical, +:root .fa-flip-both { + -webkit-filter: none; + filter: none; +} + +.fa-stack { + display: inline-block; + height: 2em; + position: relative; + width: 2.5em; +} + +.fa-stack-1x, +.fa-stack-2x { + bottom: 0; + left: 0; + margin: auto; + position: absolute; + right: 0; + top: 0; +} + +.svg-inline--fa.fa-stack-1x { + height: 1em; + width: 1.25em; +} +.svg-inline--fa.fa-stack-2x { + height: 2em; + width: 2.5em; +} + +.fa-inverse { + color: #fff; +} + +.sr-only { + border: 0; + clip: rect(0, 0, 0, 0); + height: 1px; + margin: -1px; + overflow: hidden; + padding: 0; + position: absolute; + width: 1px; +} + +.sr-only-focusable:active, .sr-only-focusable:focus { + clip: auto; + height: auto; + margin: 0; + overflow: visible; + position: static; + width: auto; +} + +.svg-inline--fa .fa-primary { + fill: var(--fa-primary-color, currentColor); + opacity: 1; + opacity: var(--fa-primary-opacity, 1); +} + +.svg-inline--fa .fa-secondary { + fill: var(--fa-secondary-color, currentColor); + opacity: 0.4; + opacity: var(--fa-secondary-opacity, 0.4); +} + +.svg-inline--fa.fa-swap-opacity .fa-primary { + opacity: 0.4; + opacity: var(--fa-secondary-opacity, 0.4); +} + +.svg-inline--fa.fa-swap-opacity .fa-secondary { + opacity: 1; + opacity: var(--fa-primary-opacity, 1); +} + +.svg-inline--fa mask .fa-primary, +.svg-inline--fa mask .fa-secondary { + fill: black; +} + +.fad.fa-inverse { + color: #fff; +}`;function css(){var i=DEFAULT_FAMILY_PREFIX,o=DEFAULT_REPLACEMENT_CLASS,s=config.familyPrefix,a=config.replacementClass,_=baseStyles;if(s!==i||a!==o){var $=new RegExp("\\.".concat(i,"\\-"),"g"),_e=new RegExp("\\--".concat(i,"\\-"),"g"),tt=new RegExp("\\.".concat(o),"g");_=_.replace($,".".concat(s,"-")).replace(_e,"--".concat(s,"-")).replace(tt,".".concat(a))}return _}var Library=function(){function i(){_classCallCheck$4(this,i),this.definitions={}}return _createClass$4(i,[{key:"add",value:function(){for(var s=this,a=arguments.length,_=new Array(a),$=0;$1&&arguments[1]!==void 0?arguments[1]:{},a=(o||{}).icon?o:findIconDefinition(o||{}),_=s.mask;return _&&(_=(_||{}).icon?_:findIconDefinition(_||{})),i(a,_objectSpread({},s,{mask:_}))}}var library=new Library,_cssInserted=!1,parse={transform:function i(o){return parseTransformString(o)}},icon=resolveIcons(function(i){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=o.transform,a=s===void 0?meaninglessTransform:s,_=o.symbol,$=_===void 0?!1:_,_e=o.mask,tt=_e===void 0?null:_e,st=o.maskId,it=st===void 0?null:st,nt=o.title,et=nt===void 0?null:nt,j=o.titleId,rt=j===void 0?null:j,ot=o.classes,at=ot===void 0?[]:ot,lt=o.attributes,ut=lt===void 0?{}:lt,ct=o.styles,dt=ct===void 0?{}:ct;if(i){var ft=i.prefix,ht=i.iconName,bt=i.icon;return apiObject(_objectSpread({type:"icon"},i),function(){return ensureCss(),config.autoA11y&&(et?ut["aria-labelledby"]="".concat(config.replacementClass,"-title-").concat(rt||nextUniqueId()):(ut["aria-hidden"]="true",ut.focusable="false")),makeInlineSvgAbstract({icons:{main:asFoundIcon(bt),mask:tt?asFoundIcon(tt.icon):{found:!1,width:null,height:null,icon:{}}},prefix:ft,iconName:ht,transform:_objectSpread({},meaninglessTransform,a),symbol:$,title:et,maskId:it,titleId:rt,extra:{attributes:ut,styles:dt,classes:at}})})}});function ownKeys(i,o){var s=Object.keys(i);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(i);o&&(a=a.filter(function(_){return Object.getOwnPropertyDescriptor(i,_).enumerable})),s.push.apply(s,a)}return s}function _objectSpread2(i){for(var o=1;o=0)&&(s[_]=i[_]);return s}function _objectWithoutProperties$s(i,o){if(i==null)return{};var s=_objectWithoutPropertiesLoose$s(i,o),a,_;if(Object.getOwnPropertySymbols){var $=Object.getOwnPropertySymbols(i);for(_=0;_<$.length;_++)a=$[_],!(o.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(i,a)&&(s[a]=i[a])}return s}function _toConsumableArray(i){return _arrayWithoutHoles(i)||_iterableToArray(i)||_unsupportedIterableToArray$7(i)||_nonIterableSpread()}function _arrayWithoutHoles(i){if(Array.isArray(i))return _arrayLikeToArray$7(i)}function _iterableToArray(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function _unsupportedIterableToArray$7(i,o){if(i){if(typeof i=="string")return _arrayLikeToArray$7(i,o);var s=Object.prototype.toString.call(i).slice(8,-1);if(s==="Object"&&i.constructor&&(s=i.constructor.name),s==="Map"||s==="Set")return Array.from(i);if(s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return _arrayLikeToArray$7(i,o)}}function _arrayLikeToArray$7(i,o){(o==null||o>i.length)&&(o=i.length);for(var s=0,a=new Array(o);s2&&arguments[2]!==void 0?arguments[2]:{};if(typeof o=="string")return o;var a=(o.children||[]).map(function(st){return convert(i,st)}),_=Object.keys(o.attributes||{}).reduce(function(st,it){var nt=o.attributes[it];switch(it){case"class":st.attrs.className=nt,delete o.attributes.class;break;case"style":st.attrs.style=styleToObject(nt);break;default:it.indexOf("aria-")===0||it.indexOf("data-")===0?st.attrs[it.toLowerCase()]=nt:st.attrs[camelize(it)]=nt}return st},{attrs:{}}),$=s.style,_e=$===void 0?{}:$,tt=_objectWithoutProperties$s(s,_excluded$1$1);return _.attrs.style=_objectSpread2(_objectSpread2({},_.attrs.style),_e),i.apply(void 0,[o.tag,_objectSpread2(_objectSpread2({},_.attrs),tt)].concat(_toConsumableArray(a)))}var PRODUCTION=!1;try{PRODUCTION=!0}catch(i){}function log(){if(!PRODUCTION&&console&&typeof console.error=="function"){var i;(i=console).error.apply(i,arguments)}}function normalizeIconArgs(i){if(i&&_typeof$d(i)==="object"&&i.prefix&&i.iconName&&i.icon)return i;if(parse.icon)return parse.icon(i);if(i===null)return null;if(i&&_typeof$d(i)==="object"&&i.prefix&&i.iconName)return i;if(Array.isArray(i)&&i.length===2)return{prefix:i[0],iconName:i[1]};if(typeof i=="string")return{prefix:"fas",iconName:i}}function objectWithKey(i,o){return Array.isArray(o)&&o.length>0||!Array.isArray(o)&&o?_defineProperty$b({},i,o):{}}var _excluded$s=["forwardedRef"];function FontAwesomeIcon(i){var o=i.forwardedRef,s=_objectWithoutProperties$s(i,_excluded$s),a=s.icon,_=s.mask,$=s.symbol,_e=s.className,tt=s.title,st=s.titleId,it=s.maskId,nt=normalizeIconArgs(a),et=objectWithKey("classes",[].concat(_toConsumableArray(classList(s)),_toConsumableArray(_e.split(" ")))),j=objectWithKey("transform",typeof s.transform=="string"?parse.transform(s.transform):s.transform),rt=objectWithKey("mask",normalizeIconArgs(_)),ot=icon(nt,_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({},et),j),rt),{},{symbol:$,title:tt,titleId:st,maskId:it}));if(!ot)return log("Could not find icon",nt),null;var at=ot.abstract,lt={ref:o};return Object.keys(s).forEach(function(ut){FontAwesomeIcon.defaultProps.hasOwnProperty(ut)||(lt[ut]=s[ut])}),convertCurry(at[0],lt)}FontAwesomeIcon.displayName="FontAwesomeIcon";FontAwesomeIcon.propTypes={beat:PropTypes.bool,border:PropTypes.bool,beatFade:PropTypes.bool,bounce:PropTypes.bool,className:PropTypes.string,fade:PropTypes.bool,flash:PropTypes.bool,mask:PropTypes.oneOfType([PropTypes.object,PropTypes.array,PropTypes.string]),maskId:PropTypes.string,fixedWidth:PropTypes.bool,inverse:PropTypes.bool,flip:PropTypes.oneOf([!0,!1,"horizontal","vertical","both"]),icon:PropTypes.oneOfType([PropTypes.object,PropTypes.array,PropTypes.string]),listItem:PropTypes.bool,pull:PropTypes.oneOf(["right","left"]),pulse:PropTypes.bool,rotation:PropTypes.oneOf([0,90,180,270]),shake:PropTypes.bool,size:PropTypes.oneOf(["2xs","xs","sm","lg","xl","2xl","1x","2x","3x","4x","5x","6x","7x","8x","9x","10x"]),spin:PropTypes.bool,spinPulse:PropTypes.bool,spinReverse:PropTypes.bool,symbol:PropTypes.oneOfType([PropTypes.bool,PropTypes.string]),title:PropTypes.string,titleId:PropTypes.string,transform:PropTypes.oneOfType([PropTypes.string,PropTypes.object]),swapOpacity:PropTypes.bool};FontAwesomeIcon.defaultProps={border:!1,className:"",mask:null,maskId:null,fixedWidth:!1,inverse:!1,flip:!1,icon:null,listItem:!1,pull:null,pulse:!1,rotation:null,size:null,spin:!1,spinPulse:!1,spinReverse:!1,beat:!1,fade:!1,beatFade:!1,bounce:!1,shake:!1,symbol:!1,title:"",titleId:null,transform:null,swapOpacity:!1};var convertCurry=convert.bind(null,React.createElement),faArrowUp={};(function(i){Object.defineProperty(i,"__esModule",{value:!0});var o="fas",s="arrow-up",a=448,_=512,$=[],_e="f062",tt="M34.9 289.5l-22.2-22.2c-9.4-9.4-9.4-24.6 0-33.9L207 39c9.4-9.4 24.6-9.4 33.9 0l194.3 194.3c9.4 9.4 9.4 24.6 0 33.9L413 289.4c-9.5 9.5-25 9.3-34.3-.4L264 168.6V456c0 13.3-10.7 24-24 24h-32c-13.3 0-24-10.7-24-24V168.6L69.2 289.1c-9.3 9.8-24.8 10-34.3.4z";i.definition={prefix:o,iconName:s,icon:[a,_,$,_e,tt]},i.faArrowUp=i.definition,i.prefix=o,i.iconName=s,i.width=a,i.height=_,i.ligatures=$,i.unicode=_e,i.svgPathData=tt})(faArrowUp);var faArrowRight={};(function(i){Object.defineProperty(i,"__esModule",{value:!0});var o="fas",s="arrow-right",a=448,_=512,$=[],_e="f061",tt="M190.5 66.9l22.2-22.2c9.4-9.4 24.6-9.4 33.9 0L441 239c9.4 9.4 9.4 24.6 0 33.9L246.6 467.3c-9.4 9.4-24.6 9.4-33.9 0l-22.2-22.2c-9.5-9.5-9.3-25 .4-34.3L311.4 296H24c-13.3 0-24-10.7-24-24v-32c0-13.3 10.7-24 24-24h287.4L190.9 101.2c-9.8-9.3-10-24.8-.4-34.3z";i.definition={prefix:o,iconName:s,icon:[a,_,$,_e,tt]},i.faArrowRight=i.definition,i.prefix=o,i.iconName=s,i.width=a,i.height=_,i.ligatures=$,i.unicode=_e,i.svgPathData=tt})(faArrowRight);var faArrowDown={};(function(i){Object.defineProperty(i,"__esModule",{value:!0});var o="fas",s="arrow-down",a=448,_=512,$=[],_e="f063",tt="M413.1 222.5l22.2 22.2c9.4 9.4 9.4 24.6 0 33.9L241 473c-9.4 9.4-24.6 9.4-33.9 0L12.7 278.6c-9.4-9.4-9.4-24.6 0-33.9l22.2-22.2c9.5-9.5 25-9.3 34.3.4L184 343.4V56c0-13.3 10.7-24 24-24h32c13.3 0 24 10.7 24 24v287.4l114.8-120.5c9.3-9.8 24.8-10 34.3-.4z";i.definition={prefix:o,iconName:s,icon:[a,_,$,_e,tt]},i.faArrowDown=i.definition,i.prefix=o,i.iconName=s,i.width=a,i.height=_,i.ligatures=$,i.unicode=_e,i.svgPathData=tt})(faArrowDown);var faArrowLeft={};(function(i){Object.defineProperty(i,"__esModule",{value:!0});var o="fas",s="arrow-left",a=448,_=512,$=[],_e="f060",tt="M257.5 445.1l-22.2 22.2c-9.4 9.4-24.6 9.4-33.9 0L7 273c-9.4-9.4-9.4-24.6 0-33.9L201.4 44.7c9.4-9.4 24.6-9.4 33.9 0l22.2 22.2c9.5 9.5 9.3 25-.4 34.3L136.6 216H424c13.3 0 24 10.7 24 24v32c0 13.3-10.7 24-24 24H136.6l120.5 114.8c9.8 9.3 10 24.8.4 34.3z";i.definition={prefix:o,iconName:s,icon:[a,_,$,_e,tt]},i.faArrowLeft=i.definition,i.prefix=o,i.iconName=s,i.width=a,i.height=_,i.ligatures=$,i.unicode=_e,i.svgPathData=tt})(faArrowLeft);var _excluded$r=["className","direction","children"];function _extends$r(){return _extends$r=Object.assign?Object.assign.bind():function(i){for(var o=1;o=0)&&Object.prototype.propertyIsEnumerable.call(i,a)&&(s[a]=i[a])}return s}function _objectWithoutPropertiesLoose$r(i,o){if(i==null)return{};var s={},a=Object.keys(i),_,$;for($=0;$=0)&&(s[_]=i[_]);return s}var ArrowButton=function i(o){var s=o.className,a=s===void 0?"":s,_=o.direction,$=_===void 0?"right":_,_e=o.children,tt=_objectWithoutProperties$r(o,_excluded$r),st="".concat(prefix,"-button--arrow"),it=function(){if($==="up")return faArrowUp.faArrowUp;if($==="right")return faArrowRight.faArrowRight;if($==="down")return faArrowDown.faArrowDown;if($==="left")return faArrowLeft.faArrowLeft}();return React.createElement(Button,_extends$r({},tt,{className:classNames(st,a),icon:React.createElement(FontAwesomeIcon,{icon:it})}),_e)},faEllipsisV={};(function(i){Object.defineProperty(i,"__esModule",{value:!0});var o="fas",s="ellipsis-v",a=192,_=512,$=[],_e="f142",tt="M96 184c39.8 0 72 32.2 72 72s-32.2 72-72 72-72-32.2-72-72 32.2-72 72-72zM24 80c0 39.8 32.2 72 72 72s72-32.2 72-72S135.8 8 96 8 24 40.2 24 80zm0 352c0 39.8 32.2 72 72 72s72-32.2 72-72-32.2-72-72-72-72 32.2-72 72z";i.definition={prefix:o,iconName:s,icon:[a,_,$,_e,tt]},i.faEllipsisV=i.definition,i.prefix=o,i.iconName=s,i.width=a,i.height=_,i.ligatures=$,i.unicode=_e,i.svgPathData=tt})(faEllipsisV);var faPaperPlane={};(function(i){Object.defineProperty(i,"__esModule",{value:!0});var o="fas",s="paper-plane",a=512,_=512,$=[],_e="f1d8",tt="M476 3.2L12.5 270.6c-18.1 10.4-15.8 35.6 2.2 43.2L121 358.4l287.3-253.2c5.5-4.9 13.3 2.6 8.6 8.3L176 407v80.5c0 23.6 28.5 32.9 42.5 15.8L282 426l124.6 52.2c14.2 6 30.4-2.9 33-18.2l72-432C515 7.8 493.3-6.8 476 3.2z";i.definition={prefix:o,iconName:s,icon:[a,_,$,_e,tt]},i.faPaperPlane=i.definition,i.prefix=o,i.iconName=s,i.width=a,i.height=_,i.ligatures=$,i.unicode=_e,i.svgPathData=tt})(faPaperPlane);var _excluded$q=["className","children"];function _extends$q(){return _extends$q=Object.assign?Object.assign.bind():function(i){for(var o=1;o=0)&&Object.prototype.propertyIsEnumerable.call(i,a)&&(s[a]=i[a])}return s}function _objectWithoutPropertiesLoose$q(i,o){if(i==null)return{};var s={},a=Object.keys(i),_,$;for($=0;$=0)&&(s[_]=i[_]);return s}var SendButton=function i(o){var s=o.className,a=s===void 0?"":s,_=o.children,$=_objectWithoutProperties$q(o,_excluded$q),_e="".concat(prefix,"-button--send");return React.createElement(Button,_extends$q({},$,{className:classNames(_e,a),icon:React.createElement(FontAwesomeIcon,{icon:faPaperPlane.faPaperPlane})}),_)},faPaperclip={};(function(i){Object.defineProperty(i,"__esModule",{value:!0});var o="fas",s="paperclip",a=448,_=512,$=[],_e="f0c6",tt="M43.246 466.142c-58.43-60.289-57.341-157.511 1.386-217.581L254.392 34c44.316-45.332 116.351-45.336 160.671 0 43.89 44.894 43.943 117.329 0 162.276L232.214 383.128c-29.855 30.537-78.633 30.111-107.982-.998-28.275-29.97-27.368-77.473 1.452-106.953l143.743-146.835c6.182-6.314 16.312-6.422 22.626-.241l22.861 22.379c6.315 6.182 6.422 16.312.241 22.626L171.427 319.927c-4.932 5.045-5.236 13.428-.648 18.292 4.372 4.634 11.245 4.711 15.688.165l182.849-186.851c19.613-20.062 19.613-52.725-.011-72.798-19.189-19.627-49.957-19.637-69.154 0L90.39 293.295c-34.763 35.56-35.299 93.12-1.191 128.313 34.01 35.093 88.985 35.137 123.058.286l172.06-175.999c6.177-6.319 16.307-6.433 22.626-.256l22.877 22.364c6.319 6.177 6.434 16.307.256 22.626l-172.06 175.998c-59.576 60.938-155.943 60.216-214.77-.485z";i.definition={prefix:o,iconName:s,icon:[a,_,$,_e,tt]},i.faPaperclip=i.definition,i.prefix=o,i.iconName=s,i.width=a,i.height=_,i.ligatures=$,i.unicode=_e,i.svgPathData=tt})(faPaperclip);var _excluded$p=["className","children"];function _extends$p(){return _extends$p=Object.assign?Object.assign.bind():function(i){for(var o=1;o=0)&&Object.prototype.propertyIsEnumerable.call(i,a)&&(s[a]=i[a])}return s}function _objectWithoutPropertiesLoose$p(i,o){if(i==null)return{};var s={},a=Object.keys(i),_,$;for($=0;$=0)&&(s[_]=i[_]);return s}var AttachmentButton=function i(o){var s=o.className,a=s===void 0?"":s,_=o.children,$=_objectWithoutProperties$p(o,_excluded$p),_e="".concat(prefix,"-button--attachment");return React.createElement(Button,_extends$p({},$,{className:classNames(_e,a),icon:React.createElement(FontAwesomeIcon,{icon:faPaperclip.faPaperclip})}),_)},_excluded$o=["onClick","children","className"];function _extends$o(){return _extends$o=Object.assign?Object.assign.bind():function(i){for(var o=1;o=0)&&Object.prototype.propertyIsEnumerable.call(i,a)&&(s[a]=i[a])}return s}function _objectWithoutPropertiesLoose$o(i,o){if(i==null)return{};var s={},a=Object.keys(i),_,$;for($=0;$=0)&&(s[_]=i[_]);return s}var ConversationHeaderBack=function i(o){var s=o.onClick,a=s===void 0?function(){}:s,_=o.children,$=_===void 0?void 0:_,_e=o.className,tt=_objectWithoutProperties$o(o,_excluded$o),st="".concat(prefix,"-conversation-header__back");return React.createElement("div",_extends$o({},tt,{className:classNames(st,_e)}),typeof $<"u"?$:React.createElement(ArrowButton,{direction:"left",onClick:a}))};ConversationHeaderBack.displayName="ConversationHeader.Back";var _excluded$n=["children","className"];function _extends$n(){return _extends$n=Object.assign?Object.assign.bind():function(i){for(var o=1;o=0)&&Object.prototype.propertyIsEnumerable.call(i,a)&&(s[a]=i[a])}return s}function _objectWithoutPropertiesLoose$n(i,o){if(i==null)return{};var s={},a=Object.keys(i),_,$;for($=0;$=0)&&(s[_]=i[_]);return s}var ConversationHeaderActions=function i(o){var s=o.children,a=s===void 0?void 0:s,_=o.className,$=_objectWithoutProperties$n(o,_excluded$n),_e="".concat(prefix,"-conversation-header__actions");return React.createElement("section",_extends$n({},$,{className:classNames(_e,_)}),a)};ConversationHeaderActions.displayName="ConversationHeader.Actions";var _excluded$m=["userName","info","children","className"];function _extends$m(){return _extends$m=Object.assign?Object.assign.bind():function(i){for(var o=1;o=0)&&Object.prototype.propertyIsEnumerable.call(i,a)&&(s[a]=i[a])}return s}function _objectWithoutPropertiesLoose$m(i,o){if(i==null)return{};var s={},a=Object.keys(i),_,$;for($=0;$=0)&&(s[_]=i[_]);return s}var ConversationHeaderContent=function i(o){var s=o.userName,a=s===void 0?"":s,_=o.info,$=_===void 0?"":_,_e=o.children,tt=_e===void 0?void 0:_e,st=o.className,it=_objectWithoutProperties$m(o,_excluded$m),nt="".concat(prefix,"-conversation-header__content");return React.createElement("div",_extends$m({},it,{className:classNames(nt,st)}),typeof tt<"u"?tt:React.createElement(React.Fragment,null,React.createElement("div",{className:"".concat(prefix,"-conversation-header__user-name")},a),React.createElement("div",{className:"".concat(prefix,"-conversation-header__info")},$)))};ConversationHeaderContent.displayName="ConversationHeader.Content";var _excluded$l=["children","className"];function _extends$l(){return _extends$l=Object.assign?Object.assign.bind():function(i){for(var o=1;oi.length)&&(o=i.length);for(var s=0,a=new Array(o);s=0)&&Object.prototype.propertyIsEnumerable.call(i,a)&&(s[a]=i[a])}return s}function _objectWithoutPropertiesLoose$l(i,o){if(i==null)return{};var s={},a=Object.keys(i),_,$;for($=0;$=0)&&(s[_]=i[_]);return s}var ConversationHeader=function i(o){var s=o.children,a=s===void 0?void 0:s,_=o.className,$=_objectWithoutProperties$l(o,_excluded$l),_e="".concat(prefix,"-conversation-header"),tt=getChildren(a,[ConversationHeaderBack,Avatar,AvatarGroup,ConversationHeaderContent,ConversationHeaderActions]),st=_slicedToArray$6(tt,5),it=st[0],nt=st[1],et=st[2],j=st[3],rt=st[4];return React.createElement("div",_extends$l({},$,{className:classNames(_e,_)}),it,nt&&React.createElement("div",{className:"".concat(_e,"__avatar")},nt),!nt&&et&&React.createElement("div",{className:"".concat(_e,"__avatar")},et),j,rt)};ConversationHeader.displayName="ConversationHeader";ConversationHeader.Back=ConversationHeaderBack;ConversationHeader.Actions=ConversationHeaderActions;ConversationHeader.Content=ConversationHeaderContent;/*! + * perfect-scrollbar v1.5.0 + * Copyright 2020 Hyunje Jun, MDBootstrap and Contributors + * Licensed under MIT + */function get(i){return getComputedStyle(i)}function set(i,o){for(var s in o){var a=o[s];typeof a=="number"&&(a=a+"px"),i.style[s]=a}return i}function div(i){var o=document.createElement("div");return o.className=i,o}var elMatches=typeof Element<"u"&&(Element.prototype.matches||Element.prototype.webkitMatchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector);function matches(i,o){if(!elMatches)throw new Error("No element matching method supported");return elMatches.call(i,o)}function remove(i){i.remove?i.remove():i.parentNode&&i.parentNode.removeChild(i)}function queryChildren(i,o){return Array.prototype.filter.call(i.children,function(s){return matches(s,o)})}var cls={main:"ps",rtl:"ps__rtl",element:{thumb:function i(o){return"ps__thumb-"+o},rail:function i(o){return"ps__rail-"+o},consuming:"ps__child--consume"},state:{focus:"ps--focus",clicking:"ps--clicking",active:function i(o){return"ps--active-"+o},scrolling:function i(o){return"ps--scrolling-"+o}}},scrollingClassTimeout={x:null,y:null};function addScrollingClass(i,o){var s=i.element.classList,a=cls.state.scrolling(o);s.contains(a)?clearTimeout(scrollingClassTimeout[o]):s.add(a)}function removeScrollingClass(i,o){scrollingClassTimeout[o]=setTimeout(function(){return i.isAlive&&i.element.classList.remove(cls.state.scrolling(o))},i.settings.scrollingThreshold)}function setScrollingClassInstantly(i,o){addScrollingClass(i,o),removeScrollingClass(i,o)}var EventElement=function i(o){this.element=o,this.handlers={}},prototypeAccessors={isEmpty:{configurable:!0}};EventElement.prototype.bind=function i(o,s){typeof this.handlers[o]>"u"&&(this.handlers[o]=[]),this.handlers[o].push(s);var a=["touchstart","wheel","touchmove"];a.indexOf(o)!==-1?this.element.addEventListener(o,s,{passive:!1}):this.element.addEventListener(o,s,!1)};EventElement.prototype.unbind=function i(o,s){var a=this;this.handlers[o]=this.handlers[o].filter(function(_){return s&&_!==s?!0:(a.element.removeEventListener(o,_,!1),!1)})};EventElement.prototype.unbindAll=function i(){for(var o in this.handlers)this.unbind(o)};prototypeAccessors.isEmpty.get=function(){var i=this;return Object.keys(this.handlers).every(function(o){return i.handlers[o].length===0})};Object.defineProperties(EventElement.prototype,prototypeAccessors);var EventManager=function i(){this.eventElements=[]};EventManager.prototype.eventElement=function i(o){var s=this.eventElements.filter(function(a){return a.element===o})[0];return s||(s=new EventElement(o),this.eventElements.push(s)),s};EventManager.prototype.bind=function i(o,s,a){this.eventElement(o).bind(s,a)};EventManager.prototype.unbind=function i(o,s,a){var _=this.eventElement(o);_.unbind(s,a),_.isEmpty&&this.eventElements.splice(this.eventElements.indexOf(_),1)};EventManager.prototype.unbindAll=function i(){this.eventElements.forEach(function(o){return o.unbindAll()}),this.eventElements=[]};EventManager.prototype.once=function i(o,s,a){var _=this.eventElement(o),$=function _e(tt){_.unbind(s,_e),a(tt)};_.bind(s,$)};function createEvent(i){if(typeof window.CustomEvent=="function")return new CustomEvent(i);var o=document.createEvent("CustomEvent");return o.initCustomEvent(i,!1,!1,void 0),o}function processScrollDiff(i,o,s,a,_,$){a===void 0&&(a=!0),_===void 0&&(_=!1);var _e;if(o==="top")_e=["contentHeight","containerHeight","scrollTop","y","up","down"];else if(o==="left")_e=["contentWidth","containerWidth","scrollLeft","x","left","right"];else throw new Error("A proper axis should be provided");processScrollDiff$1(i,s,_e,a,_,$)}function processScrollDiff$1(i,o,s,a,_,$){var _e=s[0],tt=s[1],st=s[2],it=s[3],nt=s[4],et=s[5];a===void 0&&(a=!0),_===void 0&&(_=!1);var j=i.element;i.reach[it]=null;var rt=$===!0?i[_e]!==i[tt]:!0;rt&&j[st]<1&&(i.reach[it]="start"),rt&&j[st]>i[_e]-i[tt]-1&&(i.reach[it]="end"),o&&(j.dispatchEvent(createEvent("ps-scroll-"+it)),o<0?j.dispatchEvent(createEvent("ps-scroll-"+nt)):o>0&&j.dispatchEvent(createEvent("ps-scroll-"+et)),a&&setScrollingClassInstantly(i,it)),i.reach[it]&&(o||_)&&j.dispatchEvent(createEvent("ps-"+it+"-reach-"+i.reach[it]))}function toInt(i){return parseInt(i,10)||0}function isEditable(i){return matches(i,"input,[contenteditable]")||matches(i,"select,[contenteditable]")||matches(i,"textarea,[contenteditable]")||matches(i,"button,[contenteditable]")}function outerWidth(i){var o=get(i);return toInt(o.width)+toInt(o.paddingLeft)+toInt(o.paddingRight)+toInt(o.borderLeftWidth)+toInt(o.borderRightWidth)}var env={isWebKit:typeof document<"u"&&"WebkitAppearance"in document.documentElement.style,supportsTouch:typeof window<"u"&&("ontouchstart"in window||"maxTouchPoints"in window.navigator&&window.navigator.maxTouchPoints>0||window.DocumentTouch&&document instanceof window.DocumentTouch),supportsIePointer:typeof navigator<"u"&&navigator.msMaxTouchPoints};function updateGeometry(i){var o=i.element,s=Math.floor(o.scrollTop),a=o.getBoundingClientRect();i.containerWidth=Math.round(a.width),i.containerHeight=Math.round(a.height),i.contentWidth=o.scrollWidth,i.contentHeight=o.scrollHeight,o.contains(i.scrollbarXRail)||(queryChildren(o,cls.element.rail("x")).forEach(function(_){return remove(_)}),o.appendChild(i.scrollbarXRail)),o.contains(i.scrollbarYRail)||(queryChildren(o,cls.element.rail("y")).forEach(function(_){return remove(_)}),o.appendChild(i.scrollbarYRail)),!i.settings.suppressScrollX&&i.containerWidth+i.settings.scrollXMarginOffset=i.railXWidth-i.scrollbarXWidth&&(i.scrollbarXLeft=i.railXWidth-i.scrollbarXWidth),i.scrollbarYTop>=i.railYHeight-i.scrollbarYHeight&&(i.scrollbarYTop=i.railYHeight-i.scrollbarYHeight),updateCss(o,i),i.scrollbarXActive?o.classList.add(cls.state.active("x")):(o.classList.remove(cls.state.active("x")),i.scrollbarXWidth=0,i.scrollbarXLeft=0,o.scrollLeft=i.isRtl===!0?i.contentWidth:0),i.scrollbarYActive?o.classList.add(cls.state.active("y")):(o.classList.remove(cls.state.active("y")),i.scrollbarYHeight=0,i.scrollbarYTop=0,o.scrollTop=0)}function getThumbSize(i,o){return i.settings.minScrollbarLength&&(o=Math.max(o,i.settings.minScrollbarLength)),i.settings.maxScrollbarLength&&(o=Math.min(o,i.settings.maxScrollbarLength)),o}function updateCss(i,o){var s={width:o.railXWidth},a=Math.floor(i.scrollTop);o.isRtl?s.left=o.negativeScrollAdjustment+i.scrollLeft+o.containerWidth-o.contentWidth:s.left=i.scrollLeft,o.isScrollbarXUsingBottom?s.bottom=o.scrollbarXBottom-a:s.top=o.scrollbarXTop+a,set(o.scrollbarXRail,s);var _={top:a,height:o.railYHeight};o.isScrollbarYUsingRight?o.isRtl?_.right=o.contentWidth-(o.negativeScrollAdjustment+i.scrollLeft)-o.scrollbarYRight-o.scrollbarYOuterWidth-9:_.right=o.scrollbarYRight-i.scrollLeft:o.isRtl?_.left=o.negativeScrollAdjustment+i.scrollLeft+o.containerWidth*2-o.contentWidth-o.scrollbarYLeft-o.scrollbarYOuterWidth:_.left=o.scrollbarYLeft+i.scrollLeft,set(o.scrollbarYRail,_),set(o.scrollbarX,{left:o.scrollbarXLeft,width:o.scrollbarXWidth-o.railBorderXWidth}),set(o.scrollbarY,{top:o.scrollbarYTop,height:o.scrollbarYHeight-o.railBorderYWidth})}function clickRail(i){i.element,i.event.bind(i.scrollbarY,"mousedown",function(o){return o.stopPropagation()}),i.event.bind(i.scrollbarYRail,"mousedown",function(o){var s=o.pageY-window.pageYOffset-i.scrollbarYRail.getBoundingClientRect().top,a=s>i.scrollbarYTop?1:-1;i.element.scrollTop+=a*i.containerHeight,updateGeometry(i),o.stopPropagation()}),i.event.bind(i.scrollbarX,"mousedown",function(o){return o.stopPropagation()}),i.event.bind(i.scrollbarXRail,"mousedown",function(o){var s=o.pageX-window.pageXOffset-i.scrollbarXRail.getBoundingClientRect().left,a=s>i.scrollbarXLeft?1:-1;i.element.scrollLeft+=a*i.containerWidth,updateGeometry(i),o.stopPropagation()})}function dragThumb(i){bindMouseScrollHandler(i,["containerWidth","contentWidth","pageX","railXWidth","scrollbarX","scrollbarXWidth","scrollLeft","x","scrollbarXRail"]),bindMouseScrollHandler(i,["containerHeight","contentHeight","pageY","railYHeight","scrollbarY","scrollbarYHeight","scrollTop","y","scrollbarYRail"])}function bindMouseScrollHandler(i,o){var s=o[0],a=o[1],_=o[2],$=o[3],_e=o[4],tt=o[5],st=o[6],it=o[7],nt=o[8],et=i.element,j=null,rt=null,ot=null;function at(ct){ct.touches&&ct.touches[0]&&(ct[_]=ct.touches[0].pageY),et[st]=j+ot*(ct[_]-rt),addScrollingClass(i,it),updateGeometry(i),ct.stopPropagation(),ct.preventDefault()}function lt(){removeScrollingClass(i,it),i[nt].classList.remove(cls.state.clicking),i.event.unbind(i.ownerDocument,"mousemove",at)}function ut(ct,dt){j=et[st],dt&&ct.touches&&(ct[_]=ct.touches[0].pageY),rt=ct[_],ot=(i[a]-i[s])/(i[$]-i[tt]),dt?i.event.bind(i.ownerDocument,"touchmove",at):(i.event.bind(i.ownerDocument,"mousemove",at),i.event.once(i.ownerDocument,"mouseup",lt),ct.preventDefault()),i[nt].classList.add(cls.state.clicking),ct.stopPropagation()}i.event.bind(i[_e],"mousedown",function(ct){ut(ct)}),i.event.bind(i[_e],"touchstart",function(ct){ut(ct,!0)})}function keyboard(i){var o=i.element,s=function(){return matches(o,":hover")},a=function(){return matches(i.scrollbarX,":focus")||matches(i.scrollbarY,":focus")};function _($,_e){var tt=Math.floor(o.scrollTop);if($===0){if(!i.scrollbarYActive)return!1;if(tt===0&&_e>0||tt>=i.contentHeight-i.containerHeight&&_e<0)return!i.settings.wheelPropagation}var st=o.scrollLeft;if(_e===0){if(!i.scrollbarXActive)return!1;if(st===0&&$<0||st>=i.contentWidth-i.containerWidth&&$>0)return!i.settings.wheelPropagation}return!0}i.event.bind(i.ownerDocument,"keydown",function($){if(!($.isDefaultPrevented&&$.isDefaultPrevented()||$.defaultPrevented)&&!(!s()&&!a())){var _e=document.activeElement?document.activeElement:i.ownerDocument.activeElement;if(_e){if(_e.tagName==="IFRAME")_e=_e.contentDocument.activeElement;else for(;_e.shadowRoot;)_e=_e.shadowRoot.activeElement;if(isEditable(_e))return}var tt=0,st=0;switch($.which){case 37:$.metaKey?tt=-i.contentWidth:$.altKey?tt=-i.containerWidth:tt=-30;break;case 38:$.metaKey?st=i.contentHeight:$.altKey?st=i.containerHeight:st=30;break;case 39:$.metaKey?tt=i.contentWidth:$.altKey?tt=i.containerWidth:tt=30;break;case 40:$.metaKey?st=-i.contentHeight:$.altKey?st=-i.containerHeight:st=-30;break;case 32:$.shiftKey?st=i.containerHeight:st=-i.containerHeight;break;case 33:st=i.containerHeight;break;case 34:st=-i.containerHeight;break;case 36:st=i.contentHeight;break;case 35:st=-i.contentHeight;break;default:return}i.settings.suppressScrollX&&tt!==0||i.settings.suppressScrollY&&st!==0||(o.scrollTop-=st,o.scrollLeft+=tt,updateGeometry(i),_(tt,st)&&$.preventDefault())}})}function wheel(i){var o=i.element;function s(_e,tt){var st=Math.floor(o.scrollTop),it=o.scrollTop===0,nt=st+o.offsetHeight===o.scrollHeight,et=o.scrollLeft===0,j=o.scrollLeft+o.offsetWidth===o.scrollWidth,rt;return Math.abs(tt)>Math.abs(_e)?rt=it||nt:rt=et||j,rt?!i.settings.wheelPropagation:!0}function a(_e){var tt=_e.deltaX,st=-1*_e.deltaY;return(typeof tt>"u"||typeof st>"u")&&(tt=-1*_e.wheelDeltaX/6,st=_e.wheelDeltaY/6),_e.deltaMode&&_e.deltaMode===1&&(tt*=10,st*=10),tt!==tt&&st!==st&&(tt=0,st=_e.wheelDelta),_e.shiftKey?[-st,-tt]:[tt,st]}function _(_e,tt,st){if(!env.isWebKit&&o.querySelector("select:focus"))return!0;if(!o.contains(_e))return!1;for(var it=_e;it&&it!==o;){if(it.classList.contains(cls.element.consuming))return!0;var nt=get(it);if(st&&nt.overflowY.match(/(scroll|auto)/)){var et=it.scrollHeight-it.clientHeight;if(et>0&&(it.scrollTop>0&&st<0||it.scrollTop0))return!0}if(tt&&nt.overflowX.match(/(scroll|auto)/)){var j=it.scrollWidth-it.clientWidth;if(j>0&&(it.scrollLeft>0&&tt<0||it.scrollLeft0))return!0}it=it.parentNode}return!1}function $(_e){var tt=a(_e),st=tt[0],it=tt[1];if(!_(_e.target,st,it)){var nt=!1;i.settings.useBothWheelAxes?i.scrollbarYActive&&!i.scrollbarXActive?(it?o.scrollTop-=it*i.settings.wheelSpeed:o.scrollTop+=st*i.settings.wheelSpeed,nt=!0):i.scrollbarXActive&&!i.scrollbarYActive&&(st?o.scrollLeft+=st*i.settings.wheelSpeed:o.scrollLeft-=it*i.settings.wheelSpeed,nt=!0):(o.scrollTop-=it*i.settings.wheelSpeed,o.scrollLeft+=st*i.settings.wheelSpeed),updateGeometry(i),nt=nt||s(st,it),nt&&!_e.ctrlKey&&(_e.stopPropagation(),_e.preventDefault())}}typeof window.onwheel<"u"?i.event.bind(o,"wheel",$):typeof window.onmousewheel<"u"&&i.event.bind(o,"mousewheel",$)}function touch(i){if(!env.supportsTouch&&!env.supportsIePointer)return;var o=i.element;function s(ot,at){var lt=Math.floor(o.scrollTop),ut=Math.ceil(o.scrollLeft),ct=Math.abs(ot),dt=Math.abs(at);if(!i.settings.wheelPropagation)return!0;if(dt>ct){if(i.settings.suppressScrollY)return!1;if(at>0)return lt!==0;if(at<0)return ltdt){if(i.settings.suppressScrollX)return!1;if(ot>0)return ut!==0;if(at<0)return ut0&&(ut.scrollTop>0&<<0||ut.scrollTop0))return!0}if(at&&ct.overflowX.match(/(scroll|auto)/)){var ft=ut.scrollWidth-ut.clientWidth;if(ft>0&&(ut.scrollLeft>0&&at<0||ut.scrollLeft0))return!0}ut=ut.parentNode}return!1}function j(ot){if(it(ot)){var at=st(ot),lt={pageX:at.pageX,pageY:at.pageY},ut=lt.pageX-_.pageX,ct=lt.pageY-_.pageY;if(et(ot.target,ut,ct))return;a(ut,ct),_=lt;var dt=new Date().getTime(),ft=dt-$;ft>0&&(_e.x=ut/ft,_e.y=ct/ft,$=dt),ot.cancelable&&s(ut,ct)&&ot.preventDefault()}}function rt(){i.settings.swipeEasing&&(clearInterval(tt),tt=setInterval(function(){if(i.isInitialized){clearInterval(tt);return}if(!_e.x&&!_e.y){clearInterval(tt);return}if(Math.abs(_e.x)<.01&&Math.abs(_e.y)<.01){clearInterval(tt);return}a(_e.x*30,_e.y*30),_e.x*=.8,_e.y*=.8},10))}env.supportsTouch?(i.event.bind(o,"touchstart",nt),i.event.bind(o,"touchmove",j),i.event.bind(o,"touchend",rt)):env.supportsIePointer&&(window.PointerEvent?(i.event.bind(o,"pointerdown",nt),i.event.bind(o,"pointermove",j),i.event.bind(o,"pointerup",rt)):window.MSPointerEvent&&(i.event.bind(o,"MSPointerDown",nt),i.event.bind(o,"MSPointerMove",j),i.event.bind(o,"MSPointerUp",rt)))}var defaultSettings=function i(){return{handlers:["click-rail","drag-thumb","keyboard","wheel","touch"],maxScrollbarLength:null,minScrollbarLength:null,scrollingThreshold:1e3,scrollXMarginOffset:0,scrollYMarginOffset:0,suppressScrollX:!1,suppressScrollY:!1,swipeEasing:!0,useBothWheelAxes:!1,wheelPropagation:!0,wheelSpeed:1}},handlers={"click-rail":clickRail,"drag-thumb":dragThumb,keyboard,wheel,touch},PerfectScrollbar=function i(o,s){var a=this;if(s===void 0&&(s={}),typeof o=="string"&&(o=document.querySelector(o)),!o||!o.nodeName)throw new Error("no element is specified to initialize PerfectScrollbar");this.element=o,o.classList.add(cls.main),this.settings=defaultSettings();for(var _ in s)this.settings[_]=s[_];this.containerWidth=null,this.containerHeight=null,this.contentWidth=null,this.contentHeight=null;var $=function(){return o.classList.add(cls.state.focus)},_e=function(){return o.classList.remove(cls.state.focus)};this.isRtl=get(o).direction==="rtl",this.isRtl===!0&&o.classList.add(cls.rtl),this.isNegativeScroll=function(){var it=o.scrollLeft,nt=null;return o.scrollLeft=-1,nt=o.scrollLeft<0,o.scrollLeft=it,nt}(),this.negativeScrollAdjustment=this.isNegativeScroll?o.scrollWidth-o.clientWidth:0,this.event=new EventManager,this.ownerDocument=o.ownerDocument||document,this.scrollbarXRail=div(cls.element.rail("x")),o.appendChild(this.scrollbarXRail),this.scrollbarX=div(cls.element.thumb("x")),this.scrollbarXRail.appendChild(this.scrollbarX),this.scrollbarX.setAttribute("tabindex",0),this.event.bind(this.scrollbarX,"focus",$),this.event.bind(this.scrollbarX,"blur",_e),this.scrollbarXActive=null,this.scrollbarXWidth=null,this.scrollbarXLeft=null;var tt=get(this.scrollbarXRail);this.scrollbarXBottom=parseInt(tt.bottom,10),isNaN(this.scrollbarXBottom)?(this.isScrollbarXUsingBottom=!1,this.scrollbarXTop=toInt(tt.top)):this.isScrollbarXUsingBottom=!0,this.railBorderXWidth=toInt(tt.borderLeftWidth)+toInt(tt.borderRightWidth),set(this.scrollbarXRail,{display:"block"}),this.railXMarginWidth=toInt(tt.marginLeft)+toInt(tt.marginRight),set(this.scrollbarXRail,{display:""}),this.railXWidth=null,this.railXRatio=null,this.scrollbarYRail=div(cls.element.rail("y")),o.appendChild(this.scrollbarYRail),this.scrollbarY=div(cls.element.thumb("y")),this.scrollbarYRail.appendChild(this.scrollbarY),this.scrollbarY.setAttribute("tabindex",0),this.event.bind(this.scrollbarY,"focus",$),this.event.bind(this.scrollbarY,"blur",_e),this.scrollbarYActive=null,this.scrollbarYHeight=null,this.scrollbarYTop=null;var st=get(this.scrollbarYRail);this.scrollbarYRight=parseInt(st.right,10),isNaN(this.scrollbarYRight)?(this.isScrollbarYUsingRight=!1,this.scrollbarYLeft=toInt(st.left)):this.isScrollbarYUsingRight=!0,this.scrollbarYOuterWidth=this.isRtl?outerWidth(this.scrollbarY):null,this.railBorderYWidth=toInt(st.borderTopWidth)+toInt(st.borderBottomWidth),set(this.scrollbarYRail,{display:"block"}),this.railYMarginHeight=toInt(st.marginTop)+toInt(st.marginBottom),set(this.scrollbarYRail,{display:""}),this.railYHeight=null,this.railYRatio=null,this.reach={x:o.scrollLeft<=0?"start":o.scrollLeft>=this.contentWidth-this.containerWidth?"end":null,y:o.scrollTop<=0?"start":o.scrollTop>=this.contentHeight-this.containerHeight?"end":null},this.isAlive=!0,this.settings.handlers.forEach(function(it){return handlers[it](a)}),this.lastScrollTop=Math.floor(o.scrollTop),this.lastScrollLeft=o.scrollLeft,this.event.bind(this.element,"scroll",function(it){return a.onScroll(it)}),updateGeometry(this)};PerfectScrollbar.prototype.update=function i(o){this.isAlive&&(this.negativeScrollAdjustment=this.isNegativeScroll?this.element.scrollWidth-this.element.clientWidth:0,set(this.scrollbarXRail,{display:"block"}),set(this.scrollbarYRail,{display:"block"}),this.railXMarginWidth=toInt(get(this.scrollbarXRail).marginLeft)+toInt(get(this.scrollbarXRail).marginRight),this.railYMarginHeight=toInt(get(this.scrollbarYRail).marginTop)+toInt(get(this.scrollbarYRail).marginBottom),set(this.scrollbarXRail,{display:"none"}),set(this.scrollbarYRail,{display:"none"}),updateGeometry(this),processScrollDiff(this,"top",0,!1,!0,o),processScrollDiff(this,"left",0,!1,!0,o),set(this.scrollbarXRail,{display:""}),set(this.scrollbarYRail,{display:""}))};PerfectScrollbar.prototype.onScroll=function i(o){this.isAlive&&(updateGeometry(this),processScrollDiff(this,"top",this.element.scrollTop-this.lastScrollTop),processScrollDiff(this,"left",this.element.scrollLeft-this.lastScrollLeft),this.lastScrollTop=Math.floor(this.element.scrollTop),this.lastScrollLeft=this.element.scrollLeft)};PerfectScrollbar.prototype.destroy=function i(){this.isAlive&&(this.event.unbindAll(),remove(this.scrollbarX),remove(this.scrollbarY),remove(this.scrollbarXRail),remove(this.scrollbarYRail),this.removePsClasses(),this.element=null,this.scrollbarX=null,this.scrollbarY=null,this.scrollbarXRail=null,this.scrollbarYRail=null,this.isAlive=!1)};PerfectScrollbar.prototype.removePsClasses=function i(){this.element.className=this.element.className.split(" ").filter(function(o){return!o.match(/^ps([-_].+|)$/)}).join(" ")};function _typeof$c(i){"@babel/helpers - typeof";return _typeof$c=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof$c(i)}var _excluded$k=["className","style","option","options","containerRef","onScrollY","onScrollX","onScrollUp","onScrollDown","onScrollLeft","onScrollRight","onYReachStart","onYReachEnd","onXReachStart","onXReachEnd","component","onSync","children"];function _extends$k(){return _extends$k=Object.assign?Object.assign.bind():function(i){for(var o=1;o=0)&&Object.prototype.propertyIsEnumerable.call(i,a)&&(s[a]=i[a])}return s}function _objectWithoutPropertiesLoose$k(i,o){if(i==null)return{};var s={},a=Object.keys(i),_,$;for($=0;$=0)&&(s[_]=i[_]);return s}function _classCallCheck$3(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")}function _defineProperties$3(i,o){for(var s=0;s0&&arguments[0]!==void 0?arguments[0]:{};Object.keys(handlerNameByEvent).forEach(function($){var _e=a.props[handlerNameByEvent[$]],tt=_[handlerNameByEvent[$]];if(_e!==tt){if(tt){var st=a._handlerByEvent[$];a._container.removeEventListener($,st,!1),a._handlerByEvent[$]=null}if(_e){var it=function(){return _e(a._container)};a._container.addEventListener($,it,!1),a._handlerByEvent[$]=it}}})}},{key:"_updateClassName",value:function(){var a=this.props.className,_=this._container.className.split(" ").filter(function($){return $.match(/^ps([-_].+|)$/)}).join(" ");this._container&&(this._container.className="scrollbar-container".concat(a?" ".concat(a):"").concat(_?" ".concat(_):""))}},{key:"updateScroll",value:function(){var a=this.props.onSync;typeof a=="function"?a(this._ps):this._ps.update()}},{key:"handleRef",value:function(a){var _,$;this._container=a,(_=($=this.props).containerRef)===null||_===void 0||_.call($,a)}},{key:"render",value:function(){var a=this.props;a.className;var _=a.style;a.option,a.options,a.containerRef,a.onScrollY,a.onScrollX,a.onScrollUp,a.onScrollDown,a.onScrollLeft,a.onScrollRight,a.onYReachStart,a.onYReachEnd,a.onXReachStart,a.onXReachEnd;var $=a.component;a.onSync;var _e=a.children,tt=_objectWithoutProperties$k(a,_excluded$k),st=typeof $>"u"?"div":$;return React.createElement(st,_extends$k({style:_,ref:this.handleRef},tt),_e)}}]),o}(reactExports.Component);function _typeof$b(i){"@babel/helpers - typeof";return _typeof$b=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof$b(i)}var _excluded$j=["className","variant","children"];function _extends$j(){return _extends$j=Object.assign?Object.assign.bind():function(i){for(var o=1;o=0)&&Object.prototype.propertyIsEnumerable.call(i,a)&&(s[a]=i[a])}return s}function _objectWithoutPropertiesLoose$j(i,o){if(i==null)return{};var s={},a=Object.keys(i),_,$;for($=0;$=0)&&(s[_]=i[_]);return s}var Loader=function i(o){var s=o.className,a=s===void 0?void 0:s,_=o.variant,$=_===void 0?"default":_,_e=o.children,tt=_objectWithoutProperties$j(o,_excluded$j),st="".concat(prefix,"-loader"),it=React.Children.count(_e)>0?"".concat(st,"--content"):"";return React.createElement("div",_extends$j({},tt,{className:classNames(st,it,_defineProperty$a({},"".concat(st,"--variant-").concat($),$!=="default"),a),role:"status"}),_e)};function _typeof$a(i){"@babel/helpers - typeof";return _typeof$a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof$a(i)}var _excluded$i=["className","children","blur","grayscale"];function _extends$i(){return _extends$i=Object.assign?Object.assign.bind():function(i){for(var o=1;o=0)&&Object.prototype.propertyIsEnumerable.call(i,a)&&(s[a]=i[a])}return s}function _objectWithoutPropertiesLoose$i(i,o){if(i==null)return{};var s={},a=Object.keys(i),_,$;for($=0;$=0)&&(s[_]=i[_]);return s}var Overlay=function i(o){var s=o.className,a=s===void 0?"":s,_=o.children,$=_===void 0?void 0:_,_e=o.blur,tt=_e===void 0?!1:_e,st=o.grayscale,it=st===void 0?!1:st,nt=_objectWithoutProperties$i(o,_excluded$i),et="".concat(prefix,"-overlay"),j="".concat(et,"--blur"),rt="".concat(et,"--grayscale");return React.createElement("div",_extends$i({},nt,{className:classNames(et,_defineProperty$9({},j,tt),_defineProperty$9({},rt,it),a)}),React.createElement("div",{className:"".concat(et,"__content")},$))},_excluded$h=["sender","sentTime","children","className"];function _extends$h(){return _extends$h=Object.assign?Object.assign.bind():function(i){for(var o=1;o=0)&&Object.prototype.propertyIsEnumerable.call(i,a)&&(s[a]=i[a])}return s}function _objectWithoutPropertiesLoose$h(i,o){if(i==null)return{};var s={},a=Object.keys(i),_,$;for($=0;$=0)&&(s[_]=i[_]);return s}var MessageHeader=function i(o){var s=o.sender,a=s===void 0?"":s,_=o.sentTime,$=_===void 0?"":_,_e=o.children,tt=_e===void 0?void 0:_e,st=o.className,it=_objectWithoutProperties$h(o,_excluded$h),nt="".concat(prefix,"-message__header");return React.createElement("div",_extends$h({},it,{className:classNames(nt,st)}),typeof tt<"u"?tt:React.createElement(React.Fragment,null,React.createElement("div",{className:"".concat(prefix,"-message__sender-name")},a),React.createElement("div",{className:"".concat(prefix,"-message__sent-time")},$)))};MessageHeader.displayName="Message.Header";var _excluded$g=["sender","sentTime","children","className"];function _extends$g(){return _extends$g=Object.assign?Object.assign.bind():function(i){for(var o=1;o=0)&&Object.prototype.propertyIsEnumerable.call(i,a)&&(s[a]=i[a])}return s}function _objectWithoutPropertiesLoose$g(i,o){if(i==null)return{};var s={},a=Object.keys(i),_,$;for($=0;$=0)&&(s[_]=i[_]);return s}var MessageFooter=function i(o){var s=o.sender,a=s===void 0?"":s,_=o.sentTime,$=_===void 0?"":_,_e=o.children,tt=_e===void 0?void 0:_e,st=o.className,it=_objectWithoutProperties$g(o,_excluded$g),nt="".concat(prefix,"-message__footer");return React.createElement("div",_extends$g({},it,{className:classNames(nt,st)}),typeof tt<"u"?tt:React.createElement(React.Fragment,null,React.createElement("div",{className:"".concat(prefix,"-message__sender-name")},a),React.createElement("div",{className:"".concat(prefix,"-message__sent-time")},$)))};MessageFooter.displayName="Message.Footer";var MessageCustomContent=function i(o){var s=o.children,a=o.className,_="".concat(prefix,"-message__custom-content");return React.createElement("div",{className:classNames(_,a)},s)};MessageCustomContent.displayName="Message.CustomContent";var MessageImageContent=function i(o){var s=o.src,a=o.width,_=o.height,$=o.alt,_e=o.className,tt="".concat(prefix,"-message__image-content"),st={width:typeof a=="number"?"".concat(a,"px"):typeof a=="string"?a:void 0,height:typeof _=="number"?"".concat(_,"px"):typeof _=="string"?_:void 0};return React.createElement("div",{className:classNames(tt,_e)},React.createElement("img",{src:s,style:st,alt:$}))};MessageImageContent.displayName="Message.ImageContent";var MessageHtmlContent=function i(o){var s=o.html,a=o.className,_="".concat(prefix,"-message__html-content"),$=function(){return{__html:s}};return React.createElement("div",{className:classNames(_,a),dangerouslySetInnerHTML:$()})};MessageHtmlContent.displayName="Message.HtmlContent";var MessageTextContent=function i(o){var s=o.text,a=o.className,_=o.children,$="".concat(prefix,"-message__text-content"),_e=_??s;return React.createElement("div",{className:classNames($,a)},_e)};MessageTextContent.displayName="Message.TextContent";var _excluded$f=["model","avatarSpacer","avatarPosition","type","payload","children","className"];function _extends$f(){return _extends$f=Object.assign?Object.assign.bind():function(i){for(var o=1;oi.length)&&(o=i.length);for(var s=0,a=new Array(o);s=0)&&Object.prototype.propertyIsEnumerable.call(i,a)&&(s[a]=i[a])}return s}function _objectWithoutPropertiesLoose$f(i,o){if(i==null)return{};var s={},a=Object.keys(i),_,$;for($=0;$=0)&&(s[_]=i[_]);return s}var Message=function i(o){var s,a,_=o.model,$=_.message,_e=$===void 0?"":$,tt=_.sentTime,st=tt===void 0?"":tt,it=_.sender,nt=it===void 0?"":it,et=_.direction,j=et===void 0?1:et,rt=_.position,ot=_.type,at=_.payload,lt=o.avatarSpacer,ut=lt===void 0?!1:lt,ct=o.avatarPosition,dt=ct===void 0?void 0:ct,ft=o.type,ht=ft===void 0?"html":ft,bt=o.payload,yt=o.children,mt=o.className,gt=_objectWithoutProperties$f(o,_excluded$f),vt="".concat(prefix,"-message"),wt=getChildren(yt,[Avatar,MessageHeader,MessageFooter,MessageHtmlContent,MessageTextContent,MessageImageContent,MessageCustomContent]),Ct=_slicedToArray$5(wt,7),kt=Ct[0],It=Ct[1],Pt=Ct[2],St=Ct[3],Rt=Ct[4],At=Ct[5],Mt=Ct[6],jt=function(){if(j===0||j==="incoming")return"".concat(vt,"--incoming");if(j===1||j==="outgoing")return"".concat(vt,"--outgoing")}(),Yt=function(Qt){var tr="".concat(vt,"--avatar-");if(Qt===0||Qt==="top-left"||Qt==="tl")return"".concat(tr,"tl");if(Qt===1||Qt==="top-right"||Qt==="tr")return"".concat(tr,"tr");if(Qt===2||Qt==="bottom-right"||Qt==="br")return"".concat(tr,"br");if(Qt===3||Qt==="bottom-left"||Qt==="bl")return"".concat(tr,"bl");if(Qt===4||Qt==="center-left"||Qt==="cl")return"".concat(tr,"cl");if(Qt===5||Qt==="center-right"||Qt==="cr")return"".concat(tr,"cr")}(dt),Kt=function(Qt){var tr="".concat(prefix,"-message--");if(Qt==="single"||Qt===0)return"".concat(tr,"single");if(Qt==="first"||Qt===1)return"".concat(tr,"first");if(Qt==="normal"||Qt===2)return"";if(Qt==="last"||Qt===3)return"".concat(tr,"last")}(rt),sr=function(){return(nt==null?void 0:nt.length)>0&&(st==null?void 0:st.length)>0?"".concat(nt,": ").concat(st):(nt==null?void 0:nt.length)>0&&(typeof st>"u"||(st==null?void 0:st.length)===0)?nt:null}(),ar=(s=(a=St??Rt)!==null&&a!==void 0?a:At)!==null&&s!==void 0?s:Mt,Gt=ar??function(){var Qt=ot??ht,tr=at??_e,Vt=tr??bt,Xt=_typeof$9(Vt)==="object"?getComponentName(Vt):"";if(Qt==="html"&&Xt!=="Message.CustomContent")return React.createElement(MessageHtmlContent,{html:Vt});if(Qt==="text")return React.createElement(MessageTextContent,{text:Vt});if(Qt==="image")return React.createElement(MessageImageContent,Vt);if(Qt==="custom"||Xt==="Message.CustomContent")return Vt}();return React.createElement("section",_extends$f({},gt,{"aria-label":sr,className:classNames(vt,jt,_defineProperty$8({},"".concat(vt,"--avatar-spacer"),ut),Kt,Yt,mt)},_defineProperty$8({},"data-".concat(prefix,"-message"),"")),typeof kt<"u"&&React.createElement("div",{className:"".concat(vt,"__avatar")},kt),React.createElement("div",{className:"".concat(vt,"__content-wrapper")},It,React.createElement("div",{className:"".concat(vt,"__content")},Gt),Pt))};Message.Header=MessageHeader;Message.HtmlContent=MessageHtmlContent;Message.TextContent=MessageTextContent;Message.ImageContent=MessageImageContent;Message.CustomContent=MessageCustomContent;Message.Footer=MessageFooter;var _excluded$e=["children","className"];function _extends$e(){return _extends$e=Object.assign?Object.assign.bind():function(i){for(var o=1;o=0)&&Object.prototype.propertyIsEnumerable.call(i,a)&&(s[a]=i[a])}return s}function _objectWithoutPropertiesLoose$e(i,o){if(i==null)return{};var s={},a=Object.keys(i),_,$;for($=0;$=0)&&(s[_]=i[_]);return s}var MessageGroupHeader=function i(o){var s=o.children,a=s===void 0?void 0:s,_=o.className,$=_objectWithoutProperties$e(o,_excluded$e),_e="".concat(prefix,"-message-group__header");return React.createElement("div",_extends$e({},$,{className:classNames(_e,_)}),a)};MessageGroupHeader.displayName="MessageGroup.Header";var _excluded$d=["children","className"];function _extends$d(){return _extends$d=Object.assign?Object.assign.bind():function(i){for(var o=1;o=0)&&Object.prototype.propertyIsEnumerable.call(i,a)&&(s[a]=i[a])}return s}function _objectWithoutPropertiesLoose$d(i,o){if(i==null)return{};var s={},a=Object.keys(i),_,$;for($=0;$=0)&&(s[_]=i[_]);return s}var MessageGroupFooter=function i(o){var s=o.children,a=s===void 0?void 0:s,_=o.className,$=_objectWithoutProperties$d(o,_excluded$d),_e="".concat(prefix,"-message-group__footer");return React.createElement("div",_extends$d({},$,{className:classNames(_e,_)}),a)};MessageGroupFooter.displayName="MessageGroup.Footer";var _excluded$c=["children","className"];function _extends$c(){return _extends$c=Object.assign?Object.assign.bind():function(i){for(var o=1;o=0)&&Object.prototype.propertyIsEnumerable.call(i,a)&&(s[a]=i[a])}return s}function _objectWithoutPropertiesLoose$c(i,o){if(i==null)return{};var s={},a=Object.keys(i),_,$;for($=0;$=0)&&(s[_]=i[_]);return s}var MessageGroupMessages=function i(o){var s=o.children,a=s===void 0?void 0:s,_=o.className,$=_objectWithoutProperties$c(o,_excluded$c),_e="".concat(prefix,"-message-group");return React.createElement("div",_extends$c({},$,{className:classNames("".concat(_e,"__messages"),_)}),a)};MessageGroupMessages.displayName="MessageGroup.Messages";function _typeof$8(i){"@babel/helpers - typeof";return _typeof$8=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof$8(i)}var _excluded$b=["direction","avatarPosition","sender","sentTime","children","className"];function _extends$b(){return _extends$b=Object.assign?Object.assign.bind():function(i){for(var o=1;oi.length)&&(o=i.length);for(var s=0,a=new Array(o);s=0)&&Object.prototype.propertyIsEnumerable.call(i,a)&&(s[a]=i[a])}return s}function _objectWithoutPropertiesLoose$b(i,o){if(i==null)return{};var s={},a=Object.keys(i),_,$;for($=0;$=0)&&(s[_]=i[_]);return s}var MessageGroup=function i(o){var s=o.direction,a=s===void 0?"incoming":s,_=o.avatarPosition,$=_===void 0?void 0:_,_e=o.sender,tt=_e===void 0?"":_e,st=o.sentTime,it=st===void 0?"":st,nt=o.children,et=o.className,j=_objectWithoutProperties$b(o,_excluded$b),rt="".concat(prefix,"-message-group"),ot=function(){if(a===0||a==="incoming")return"".concat(rt,"--incoming");if(a===1||a==="outgoing")return"".concat(rt,"--outgoing")}(),at=function(){var yt="".concat(rt,"--avatar-");if(typeof $=="string"&&($==="tl"||$==="top-left"||$==="tr"||$==="top-right"||$==="bl"||$==="bottom-right"||$==="br"||$==="bottom-right"||$==="cl"||$==="center-left"||$==="cr"||$==="center-right"))return"".concat(yt).concat($)}(),lt=getChildren(nt,[Avatar,MessageGroupHeader,MessageGroupFooter,MessageGroupMessages]),ut=_slicedToArray$4(lt,4),ct=ut[0],dt=ut[1],ft=ut[2],ht=ut[3],bt=function(){return tt.length>0&&it.length>0?"".concat(tt,": ").concat(it):tt.length>0&&it.length===0?tt:null}();return React.createElement("section",_extends$b({"aria-label":bt},j,{className:classNames(rt,ot,at,et)},_defineProperty$7({},"data-".concat(prefix,"-message-group"),"")),typeof ct<"u"&&React.createElement("div",{className:"".concat(rt,"__avatar")},ct),React.createElement("div",{className:"".concat(rt,"__content")},dt,ht,ft))};MessageGroup.Header=MessageGroupHeader;MessageGroup.Footer=MessageGroupFooter;MessageGroup.Messages=MessageGroupMessages;var _excluded$a=["content","as","children","className"];function _extends$a(){return _extends$a=Object.assign?Object.assign.bind():function(i){for(var o=1;o=0)&&Object.prototype.propertyIsEnumerable.call(i,a)&&(s[a]=i[a])}return s}function _objectWithoutPropertiesLoose$a(i,o){if(i==null)return{};var s={},a=Object.keys(i),_,$;for($=0;$=0)&&(s[_]=i[_]);return s}var MessageSeparator=function i(o){var s=o.content,a=s===void 0?void 0:s,_=o.as,$=_===void 0?"div":_,_e=o.children,tt=_e===void 0?void 0:_e,st=o.className,it=_objectWithoutProperties$a(o,_excluded$a),nt="".concat(prefix,"-message-separator"),et=function(){return typeof $=="string"&&$.length>0?$:"div"}();return React.createElement(et,_extends$a({},it,{className:classNames(nt,st)}),isChildrenNil(tt)===!0?a:tt)},_excluded$9=["className","children"];function _extends$9(){return _extends$9=Object.assign?Object.assign.bind():function(i){for(var o=1;o=0)&&Object.prototype.propertyIsEnumerable.call(i,a)&&(s[a]=i[a])}return s}function _objectWithoutPropertiesLoose$9(i,o){if(i==null)return{};var s={},a=Object.keys(i),_,$;for($=0;$=0)&&(s[_]=i[_]);return s}var MessageListContent=function i(o){var s=o.className,a=o.children,_=_objectWithoutProperties$9(o,_excluded$9);return React.createElement("div",_extends$9({},_,{className:s}),a)};MessageListContent.displayName="MessageList.Content";var _excluded$8=["children","typingIndicator","loading","loadingMore","loadingMorePosition","onYReachStart","onYReachEnd","className","disableOnYReachWhenNoScroll","scrollBehavior","autoScrollToBottom","autoScrollToBottomOnMount"];function _typeof$7(i){"@babel/helpers - typeof";return _typeof$7=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof$7(i)}function _extends$8(){return _extends$8=Object.assign?Object.assign.bind():function(i){for(var o=1;oi.length)&&(o=i.length);for(var s=0,a=new Array(o);s=0)&&Object.prototype.propertyIsEnumerable.call(i,a)&&(s[a]=i[a])}return s}function _objectWithoutPropertiesLoose$8(i,o){if(i==null)return{};var s={},a=Object.keys(i),_,$;for($=0;$=0)&&(s[_]=i[_]);return s}function _classCallCheck$2(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")}function _defineProperties$2(i,o){for(var s=0;s=1?a.preventScrollTop===!1&&(_.scrollTop=Math.round(_.scrollTop)-_e):_.scrollTop=_.scrollTop-_e,a.lastClientHeight=_.clientHeight,a.scrollRef.current.updateScroll()}a.resizeTicking=!1}),a.resizeTicking=!0)}),_defineProperty$6(_assertThisInitialized$2(a),"isSticked",function(){var _=a.containerRef.current;return _.scrollHeight===Math.round(_.scrollTop+_.clientHeight)}),_defineProperty$6(_assertThisInitialized$2(a),"handleScroll",function(){a.scrollTicking===!1&&(window.requestAnimationFrame(function(){a.noScroll===!1?a.preventScrollTop=a.isSticked():a.noScroll=!1,a.scrollTicking=!1}),a.scrollTicking=!0)}),_defineProperty$6(_assertThisInitialized$2(a),"getLastMessageOrGroup",function(){var _=a.containerRef.current.querySelector("[data-".concat(prefix,"-message-list]>[data-").concat(prefix,"-message]:last-of-type,[data-").concat(prefix,"-message-list]>[data-").concat(prefix,"-message-group]:last-of-type")),$=_==null?void 0:_.querySelector("[data-".concat(prefix,"-message]:last-of-type"));return{lastElement:_,lastMessageInGroup:$}}),a.scrollPointRef=React.createRef(),a.containerRef=React.createRef(),a.scrollRef=React.createRef(),a.lastClientHeight=0,a.preventScrollTop=!1,a.resizeObserver=void 0,a.scrollTicking=!1,a.resizeTicking=!1,a.noScroll=void 0,a}return _createClass$2(o,[{key:"getSnapshotBeforeUpdate",value:function(){var a=this.containerRef.current,_=Math.round(a.scrollTop+a.clientHeight),$=a.scrollHeight===_||a.scrollHeight+1===_||a.scrollHeight-1===_;return{sticky:$,clientHeight:a.clientHeight,scrollHeight:a.scrollHeight,lastMessageOrGroup:this.getLastMessageOrGroup(),diff:a.scrollHeight-a.scrollTop}}},{key:"componentDidMount",value:function(){this.props.autoScrollToBottomOnMount===!0&&this.scrollToEnd(this.props.scrollBehavior),this.lastClientHeight=this.containerRef.current.clientHeight,window.addEventListener("resize",this.handleResize),typeof window.ResizeObserver=="function"&&(this.resizeObserver=new ResizeObserver(this.handleContainerResize),this.resizeObserver.observe(this.containerRef.current)),this.containerRef.current.addEventListener("scroll",this.handleScroll)}},{key:"componentDidUpdate",value:function(a,_,$){var _e=this.props.autoScrollToBottom;if(typeof $<"u"){var tt=this.containerRef.current,st=this.getLastMessageOrGroup(),it=st.lastElement,nt=st.lastMessageInGroup;if(it===$.lastMessageOrGroup.lastElement&&(typeof nt>"u"||nt===$.lastMessageOrGroup.lastMessageInGroup)&&(tt.scrollTop=tt.scrollHeight-$.diff+(this.lastClientHeight-tt.clientHeight)),$.sticky===!0)_e===!0&&this.scrollToEnd(this.props.scrollBehavior),this.preventScrollTop=!0;else if($.clientHeight"u"||nt===$.lastMessageOrGroup.lastMessageInGroup)&&tt.scrollTop===0&&tt.scrollHeight>$.scrollHeight&&(tt.scrollTop=tt.scrollHeight-$.scrollHeight);this.lastClientHeight=$.clientHeight}}},{key:"componentWillUnmount",value:function(){window.removeEventListener("resize",this.handleResize),typeof this.resizeObserver<"u"&&this.resizeObserver.disconnect(),this.containerRef.current.removeEventListener("scroll",this.handleScroll)}},{key:"scrollToEnd",value:function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.props.scrollBehavior,_=this.containerRef.current,$=this.scrollPointRef.current,_e=_.getBoundingClientRect(),tt=$.getBoundingClientRect(),st=tt.top+_.scrollTop-_e.top;_.scrollBy?_.scrollBy({top:st,behavior:a}):_.scrollTop=st,this.lastClientHeight=_.clientHeight,this.noScroll=!0}},{key:"render",value:function(){var a=this,_=this.props,$=_.children,_e=_.typingIndicator,tt=_.loading,st=_.loadingMore,it=_.loadingMorePosition,nt=_.onYReachStart,et=_.onYReachEnd,j=_.className,rt=_.disableOnYReachWhenNoScroll;_.scrollBehavior,_.autoScrollToBottom,_.autoScrollToBottomOnMount;var ot=_objectWithoutProperties$8(_,_excluded$8),at="".concat(prefix,"-message-list"),lt=getChildren($,[MessageListContent]),ut=_slicedToArray$3(lt,1),ct=ut[0];return React.createElement("div",_extends$8({},ot,{className:classNames(at,j)}),st&&React.createElement("div",{className:classNames("".concat(at,"__loading-more"),_defineProperty$6({},"".concat(at,"__loading-more--bottom"),it==="bottom"))},React.createElement(Loader,null)),tt&&React.createElement(Overlay,null,React.createElement(Loader,null)),React.createElement(ScrollBar,_extends$8({onYReachStart:nt,onYReachEnd:et,onSync:function(ft){return ft.update(rt)},className:"".concat(at,"__scroll-wrapper"),ref:this.scrollRef,containerRef:function(ft){return a.containerRef.current=ft},options:{suppressScrollX:!0}},_defineProperty$6({},"data-".concat(prefix,"-message-list"),""),{style:{overscrollBehaviorY:"none",overflowAnchor:"auto",touchAction:"none"}}),ct||$,React.createElement("div",{className:"".concat(at,"__scroll-to"),ref:this.scrollPointRef})),typeof _e<"u"&&React.createElement("div",{className:"".concat(at,"__typing-indicator-container")},_e))}}]),o}(React.Component);MessageListInner.displayName="MessageList";function MessageListFunc(i,o){var s=reactExports.useRef(),a=function($){return s.current.scrollToEnd($)};return reactExports.useImperativeHandle(o,function(){return{scrollToBottom:a}}),React.createElement(MessageListInner,_extends$8({ref:s},i))}var MessageList=reactExports.forwardRef(MessageListFunc);MessageList.propTypes={children:allowedChildren([Message,MessageGroup,MessageSeparator,MessageListContent]),typingIndicator:PropTypes.node,loading:PropTypes.bool,loadingMore:PropTypes.bool,loadingMorePosition:PropTypes.oneOf(["top","bottom"]),onYReachStart:PropTypes.func,onYReachEnd:PropTypes.func,disableOnYReachWhenNoScroll:PropTypes.bool,autoScrollToBottom:PropTypes.bool,autoScrollToBottomOnMount:PropTypes.bool,scrollBehavior:PropTypes.oneOf(["auto","smooth"]),className:PropTypes.string};MessageList.defaultProps={typingIndicator:void 0,loading:!1,loadingMore:!1,loadingMorePosition:"top",disableOnYReachWhenNoScroll:!1,autoScrollToBottom:!0,autoScrollToBottomOnMount:!0,scrollBehavior:"auto"};MessageListInner.defaultProps=MessageList.defaultProps;MessageList.Content=MessageListContent;function _typeof$6(i){"@babel/helpers - typeof";return _typeof$6=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof$6(i)}function _classCallCheck$1(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")}function _defineProperties$1(i,o){for(var s=0;s"u"||a.value!==_.current.innerHTML?!0:_e!==a.placeholder||tt!==a.disabled||st!==a.activateAfterChange}},{key:"componentDidUpdate",value:function(){var a=this.msgRef,_=this.props,$=_.value,_e=_.activateAfterChange;$!==a.current.innerHTML&&(a.current.innerHTML=typeof $=="string"?$:""),replaceCaret(a.current,_e)}},{key:"render",value:function(){var a=this.msgRef,_=this.handleInput,$=this.handleKeyPress,_e=this.innerHTML,tt=this.props,st=tt.placeholder,it=tt.disabled,nt=tt.className,et=typeof st=="string"?st:"";return React.createElement("div",{ref:a,className:nt,contentEditable:it===!1,disabled:it,"data-placeholder":et,onInput:_,onKeyPress:$,dangerouslySetInnerHTML:_e()})}}]),o}(reactExports.Component);function _typeof$5(i){"@babel/helpers - typeof";return _typeof$5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof$5(i)}var _excluded$7=["fancyScroll","children","forwardedRef"],_excluded2=["value","onSend","onChange","autoFocus","placeholder","fancyScroll","className","activateAfterChange","disabled","sendDisabled","sendOnReturnDisabled","attachDisabled","sendButton","attachButton","onAttachClick"];function _defineProperty$4(i,o,s){return o=_toPropertyKey$4(o),o in i?Object.defineProperty(i,o,{value:s,enumerable:!0,configurable:!0,writable:!0}):i[o]=s,i}function _slicedToArray$2(i,o){return _arrayWithHoles$2(i)||_iterableToArrayLimit$2(i,o)||_unsupportedIterableToArray$2(i,o)||_nonIterableRest$2()}function _nonIterableRest$2(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _unsupportedIterableToArray$2(i,o){if(i){if(typeof i=="string")return _arrayLikeToArray$2(i,o);var s=Object.prototype.toString.call(i).slice(8,-1);if(s==="Object"&&i.constructor&&(s=i.constructor.name),s==="Map"||s==="Set")return Array.from(i);if(s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return _arrayLikeToArray$2(i,o)}}function _arrayLikeToArray$2(i,o){(o==null||o>i.length)&&(o=i.length);for(var s=0,a=new Array(o);s=0)&&Object.prototype.propertyIsEnumerable.call(i,a)&&(s[a]=i[a])}return s}function _objectWithoutPropertiesLoose$7(i,o){if(i==null)return{};var s={},a=Object.keys(i),_,$;for($=0;$=0)&&(s[_]=i[_]);return s}function _classCallCheck(i,o){if(!(i instanceof o))throw new TypeError("Cannot call a class as a function")}function _defineProperties(i,o){for(var s=0;s0){a===void 0&&jt(""),typeof dt>"u"&&ar(!0);var ir=Qt();$(Mt,ir[0],ir[1],ir[2])}},Vt=function(ir){ir.key==="Enter"&&ir.shiftKey===!1&&ht===!1&&(ir.preventDefault(),tr())},Xt=function(ir,hr,Rr){jt(ir),typeof dt>"u"&&ar(hr.length===0),typeof Pt.current.updateScroll=="function"&&Pt.current.updateScroll();var Or=Qt();tt(ir,hr,Rr,Or[2])},Zt="".concat(prefix,"-message-input"),cr=typeof et=="string"?et:"";return React.createElement("div",_extends$7({},It,{className:classNames(Zt,_defineProperty$4({},"".concat(Zt,"--disabled"),ct),ot)}),wt===!0&&React.createElement("div",{className:"".concat(Zt,"__tools")},React.createElement(AttachmentButton,{onClick:kt,disabled:ct===!0||yt===!0})),React.createElement("div",{className:"".concat(Zt,"__content-editor-wrapper")},React.createElement(EditorContainer,{fancyScroll:rt,ref:Pt,className:"".concat(Zt,"__content-editor-container")},React.createElement(ContentEditable,{ref:St,className:"".concat(Zt,"__content-editor"),disabled:ct,placeholder:cr,onKeyPress:Vt,onChange:Xt,activateAfterChange:lt,value:Mt}))),gt===!0&&React.createElement("div",{className:"".concat(Zt,"__tools")},React.createElement(SendButton,{onClick:tr,disabled:ct===!0||sr===!0})))}var MessageInput$1=reactExports.forwardRef(MessageInputInner);MessageInput$1.displayName="MessageInput";MessageInput$1.propTypes={value:PropTypes.string,placeholder:PropTypes.string,disabled:PropTypes.bool,sendOnReturnDisabled:PropTypes.bool,sendDisabled:PropTypes.bool,fancyScroll:PropTypes.bool,activateAfterChange:PropTypes.bool,autoFocus:PropTypes.bool,onChange:PropTypes.func,onSend:PropTypes.func,className:PropTypes.string,sendButton:PropTypes.bool,attachButton:PropTypes.bool,attachDisabled:PropTypes.bool,onAttachClick:PropTypes.func};var _excluded$6=["className","children"];function _extends$6(){return _extends$6=Object.assign?Object.assign.bind():function(i){for(var o=1;o=0)&&Object.prototype.propertyIsEnumerable.call(i,a)&&(s[a]=i[a])}return s}function _objectWithoutPropertiesLoose$6(i,o){if(i==null)return{};var s={},a=Object.keys(i),_,$;for($=0;$=0)&&(s[_]=i[_]);return s}var InputToolbox=function i(o){var s=o.className,a=o.children,_=_objectWithoutProperties$6(o,_excluded$6),$="".concat(prefix,"-input-toolbox");return React.createElement("div",_extends$6({},_,{className:classNames($,s)}),a)};InputToolbox.displayName="InputToolbox";var _excluded$5=["children","className"];function _extends$5(){return _extends$5=Object.assign?Object.assign.bind():function(i){for(var o=1;oi.length)&&(o=i.length);for(var s=0,a=new Array(o);s=0)&&Object.prototype.propertyIsEnumerable.call(i,a)&&(s[a]=i[a])}return s}function _objectWithoutPropertiesLoose$5(i,o){if(i==null)return{};var s={},a=Object.keys(i),_,$;for($=0;$=0)&&(s[_]=i[_]);return s}var ChatContainer=function i(o){var s=o.children,a=s===void 0?void 0:s,_=o.className,$=_objectWithoutProperties$5(o,_excluded$5),_e="".concat(prefix,"-chat-container"),tt=getChildren(a,[ConversationHeader,MessageList,MessageInput$1,InputToolbox]),st=_slicedToArray$1(tt,4),it=st[0],nt=st[1],et=st[2],j=st[3];return React.createElement("div",_extends$5({},$,{className:classNames(_e,_)}),it,nt,et,j)},cName="".concat(prefix,"-conversation");function _typeof$4(i){"@babel/helpers - typeof";return _typeof$4=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof$4(i)}var _excluded$4=["children","className","visible"];function _extends$4(){return _extends$4=Object.assign?Object.assign.bind():function(i){for(var o=1;o=0)&&Object.prototype.propertyIsEnumerable.call(i,a)&&(s[a]=i[a])}return s}function _objectWithoutPropertiesLoose$4(i,o){if(i==null)return{};var s={},a=Object.keys(i),_,$;for($=0;$=0)&&(s[_]=i[_]);return s}var ConversationOperations=function i(o){var s=o.children,a=o.className,_=o.visible,$=_objectWithoutProperties$4(o,_excluded$4);return React.createElement("div",_extends$4({},$,{className:classNames("".concat(cName,"__operations"),_defineProperty$3({},"".concat(cName,"__operations--visible"),_),a)}),React.Children.count(s)>0?s:React.createElement(FontAwesomeIcon,{icon:faEllipsisV.faEllipsisV}))};ConversationOperations.displayName="Conversation.Operations";var _excluded$3=["lastSenderName","info","name","children","className"];function _extends$3(){return _extends$3=Object.assign?Object.assign.bind():function(i){for(var o=1;o=0)&&Object.prototype.propertyIsEnumerable.call(i,a)&&(s[a]=i[a])}return s}function _objectWithoutPropertiesLoose$3(i,o){if(i==null)return{};var s={},a=Object.keys(i),_,$;for($=0;$=0)&&(s[_]=i[_]);return s}var LastSenderName=function i(o){var s=o.name;return React.createElement(React.Fragment,null,React.createElement("div",{className:"".concat(cName,"__last-sender")},s),":")},InfoContent=function i(o){var s=o.info;return React.createElement("div",{className:"".concat(cName,"__info-content")},s)},ConversationContent=function i(o){var s=o.lastSenderName,a=o.info,_=o.name,$=o.children,_e=o.className,tt=_objectWithoutProperties$3(o,_excluded$3),st=_typeof$3(s);return React.createElement("div",_extends$3({},tt,{className:classNames("".concat(cName,"__content"),_e)}),React.Children.count($)>0?$:React.createElement(React.Fragment,null,React.createElement("div",{className:"".concat(cName,"__name")},_),React.createElement("div",{className:"".concat(cName,"__info")},st!=="undefined"?React.createElement(React.Fragment,null,st==="string"?React.createElement(LastSenderName,{name:s}):s," "):null,typeof a<"u"&&React.createElement(InfoContent,{info:a}))))};ConversationContent.displayName="Conversation.Content";function _typeof$2(i){"@babel/helpers - typeof";return _typeof$2=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof$2(i)}var _excluded$2=["responsive","children","className"];function _extends$2(){return _extends$2=Object.assign?Object.assign.bind():function(i){for(var o=1;o=0)&&Object.prototype.propertyIsEnumerable.call(i,a)&&(s[a]=i[a])}return s}function _objectWithoutPropertiesLoose$2(i,o){if(i==null)return{};var s={},a=Object.keys(i),_,$;for($=0;$=0)&&(s[_]=i[_]);return s}var MainContainer=function i(o){var s=o.responsive,a=s===void 0?!1:s,_=o.children,$=_===void 0?void 0:_,_e=o.className,tt=_objectWithoutProperties$2(o,_excluded$2),st="".concat(prefix,"-main-container");return React.createElement("div",_extends$2({},tt,{className:classNames(st,_defineProperty$2({},"".concat(st,"--responsive"),a),_e)}),$)};/*! + * Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com + * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) + */var faSearch={prefix:"fas",iconName:"search",icon:[512,512,[],"f002","M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"]},faTimes={prefix:"fas",iconName:"times",icon:[352,512,[],"f00d","M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"]};function _typeof$1(i){"@babel/helpers - typeof";return _typeof$1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof$1(i)}var _excluded$1=["placeholder","value","onChange","onClearClick","className","disabled"];function _extends$1(){return _extends$1=Object.assign?Object.assign.bind():function(i){for(var o=1;oi.length)&&(o=i.length);for(var s=0,a=new Array(o);s=0)&&Object.prototype.propertyIsEnumerable.call(i,a)&&(s[a]=i[a])}return s}function _objectWithoutPropertiesLoose$1(i,o){if(i==null)return{};var s={},a=Object.keys(i),_,$;for($=0;$=0)&&(s[_]=i[_]);return s}var useControlledOrNot=function i(o,s){return typeof s>"u"?reactExports.useState(o):[s,function(){}]};function SearchInner(i,o){var s=i.placeholder,a=s===void 0?"":s,_=i.value,$=_===void 0?void 0:_,_e=i.onChange,tt=_e===void 0?function(){}:_e,st=i.onClearClick,it=st===void 0?function(){}:st,nt=i.className,et=i.disabled,j=et===void 0?!1:et,rt=_objectWithoutProperties$1(i,_excluded$1),ot="".concat(prefix,"-search"),at=reactExports.useMemo(function(){return typeof $<"u"},[]),lt=useControlledOrNot("",$),ut=_slicedToArray(lt,2),ct=ut[0],dt=ut[1],ft=reactExports.useState(at?ct.length>0:!1),ht=_slicedToArray(ft,2),bt=ht[0],yt=ht[1];if(at!==typeof $<"u")throw"Search: Changing from controlled to uncontrolled component and vice versa is not allowed";var mt=reactExports.useRef(void 0),gt=function(){typeof mt.current<"u"&&mt.current.focus()};reactExports.useImperativeHandle(o,function(){return{focus:gt}});var vt=function(kt){var It=kt.target.value;yt(It.length>0),at===!1&&dt(It),tt(It)},wt=function(){at===!1&&dt(""),yt(!1),it()};return React.createElement("div",_extends$1({},rt,{className:classNames(ot,_defineProperty$1({},"".concat(ot,"--disabled"),j),nt)}),React.createElement(FontAwesomeIcon,{icon:faSearch,className:"".concat(ot,"__search-icon")}),React.createElement("input",{ref:mt,type:"text",className:"".concat(ot,"__input"),placeholder:a,onChange:vt,disabled:j,value:ct}),React.createElement(FontAwesomeIcon,{icon:faTimes,className:classNames("".concat(ot,"__clear-icon"),_defineProperty$1({},"".concat(ot,"__clear-icon--active"),bt)),onClick:wt}))}var Search=reactExports.forwardRef(SearchInner);Search.displayName="Search";Search.propTypes={placeholder:PropTypes.string,value:PropTypes.string,onChange:PropTypes.func,onClearClick:PropTypes.func,className:PropTypes.string,disabled:PropTypes.bool};function _typeof(i){"@babel/helpers - typeof";return _typeof=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(i)}var _excluded=["className","children","size","selected","onChange","itemsTabIndex"];function _extends(){return _extends=Object.assign?Object.assign.bind():function(i){for(var o=1;o=0)&&Object.prototype.propertyIsEnumerable.call(i,a)&&(s[a]=i[a])}return s}function _objectWithoutPropertiesLoose(i,o){if(i==null)return{};var s={},a=Object.keys(i),_,$;for($=0;$=0)&&(s[_]=i[_]);return s}function StatusListInner(i,o){var s=i.className,a=i.children,_=i.size,$=i.selected,_e=i.onChange,tt=_e===void 0?noop$1:_e,st=i.itemsTabIndex,it=_objectWithoutProperties(i,_excluded),nt="".concat(prefix,"-status-list"),et=reactExports.useRef();reactExports.useImperativeHandle(o,function(){return{focus:function(ot){var at=Array.from(et.current.querySelectorAll("li")),lt=at.filter(function(ut){return ut.parentNode===et.current});typeof lt[ot]<"u"&<[ot].focus()}}});var j=st;return React.createElement("ul",_extends({ref:et},it,{className:classNames(nt,s,_defineProperty({},"".concat(nt,"--").concat(_),_))}),React.Children.map(a,function(rt){var ot={};$&&(ot.selected=rt.props.status===$),tt&&(ot.onClick=function(ut){tt(rt.props.status),rt.onClick&&rt.onClick(ut)});var at=function(ct){tt&&ct.key==="Enter"&&ct.shiftKey===!1&&ct.altKey===!1&&tt(rt.props.status)},lt=function(){if(typeof j=="number")return j>0?j++:j}();return React.createElement("li",{tabIndex:lt,onKeyPress:at},React.cloneElement(rt,ot))}))}var StatusList=reactExports.forwardRef(StatusListInner);StatusList.displayName="StatusList";StatusList.propTypes={children:allowedChildren([Status]),selected:PropTypes.oneOf(StatusEnum),size:PropTypes.oneOf(SizeEnum),itemsTabIndex:PropTypes.number,className:PropTypes.string,onChange:PropTypes.func};function ChatHistoryPanel(){const{t:i}=useTranslation(),{messages:o}=useChatHistory(),{confName:s}=useConfig(),{baseUrl:a}=useWebSocket(),_="Me",$=o.filter(_e=>_e.content||_e.type==="tool_call_status"&&_e.status==="running"||_e.type==="tool_call_status"&&_e.status==="completed"||_e.type==="tool_call_status"&&_e.status==="error");return jsxRuntimeExports.jsxs(Box,{h:"full",overflow:"hidden",bg:"gray.900",children:[jsxRuntimeExports.jsx(Global,{styles:chatPanelStyles}),jsxRuntimeExports.jsx(MainContainer,{children:jsxRuntimeExports.jsx(ChatContainer,{children:jsxRuntimeExports.jsx(MessageList,{children:$.length===0?jsxRuntimeExports.jsx(Box,{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:"whiteAlpha.500",fontSize:"sm",children:i("sidebar.noMessages")}):$.map(_e=>_e.type==="tool_call_status"?jsxRuntimeExports.jsxs(Flex,{...sidebarStyles.toolCallIndicator.container,alignItems:"center",children:[jsxRuntimeExports.jsx(Icon,{as:FaTools,...sidebarStyles.toolCallIndicator.icon}),jsxRuntimeExports.jsx(Text,{...sidebarStyles.toolCallIndicator.text,children:_e.status==="running"?`${_e.name} is using tool ${_e.tool_name}`:`${_e.name} used tool ${_e.tool_name}`}),_e.status==="running"&&jsxRuntimeExports.jsx(Spinner,{size:"xs",color:sidebarStyles.toolCallIndicator.spinner.color,ml:sidebarStyles.toolCallIndicator.spinner.ml}),_e.status==="completed"&&jsxRuntimeExports.jsx(Icon,{as:FaCheck,...sidebarStyles.toolCallIndicator.completedIcon}),_e.status==="error"&&jsxRuntimeExports.jsx(Icon,{as:FaTimes,...sidebarStyles.toolCallIndicator.errorIcon})]},_e.id):jsxRuntimeExports.jsx(Message,{model:{message:_e.content,sentTime:_e.timestamp,sender:_e.role==="ai"?_e.name||s||"AI":_,direction:_e.role==="ai"?"incoming":"outgoing",position:"single"},avatarPosition:_e.role==="ai"?"tl":"tr",avatarSpacer:!1,children:jsxRuntimeExports.jsx(Avatar,{children:_e.role==="ai"?_e.avatar?jsxRuntimeExports.jsx("img",{src:`${a}/avatars/${_e.avatar}`,alt:"avatar",style:{width:"100%",height:"100%",borderRadius:"50%"},onError:tt=>{const st=tt.target,it=_e.name||s||"A";st.outerHTML=`
${it[0].toUpperCase()}
`}}):_e.name&&_e.name[0].toUpperCase()||s&&s[0].toUpperCase()||"A":_[0].toUpperCase()})},_e.id))})})})]})}const useCameraPanel=()=>{const i=reactExports.useRef(null),[o,s]=reactExports.useState(""),[a,_]=reactExports.useState(!1),{isStreaming:$,stream:_e,startCamera:tt,stopCamera:st}=useCamera();return{videoRef:i,error:o,isHovering:a,isStreaming:$,stream:_e,toggleCamera:async()=>{try{$?st():await tt(),s("")}catch(j){let rt="Unable to access camera";j instanceof Error&&(rt=j.message),s(rt)}},handleMouseEnter:()=>_(!0),handleMouseLeave:()=>_(!1)}};function LiveIndicator(){const{t:i}=useTranslation();return jsxRuntimeExports.jsxs(Box,{color:"red.500",display:"flex",alignItems:"center",gap:2,children:[jsxRuntimeExports.jsx(Box,{w:"8px",h:"8px",borderRadius:"full",bg:"red.500",animation:"pulse 2s infinite"}),jsxRuntimeExports.jsx(Text,{fontSize:"sm",children:i("sidebar.live")})]})}function CameraPlaceholder(){const{t:i}=useTranslation();return jsxRuntimeExports.jsxs(Box,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:2,children:[jsxRuntimeExports.jsx(FiCamera,{size:24}),jsxRuntimeExports.jsx(Text,{color:"whiteAlpha.600",fontSize:"sm",textAlign:"center",children:i("footer.cameraControl")})]})}function VideoStream$1({videoRef:i,isStreaming:o}){return jsxRuntimeExports.jsx("video",{ref:i,autoPlay:!0,playsInline:!0,muted:!0,style:sidebarStyles.cameraPanel.video,...o?{}:{display:"none"}})}function CameraPanel(){const{t:i}=useTranslation(),{videoRef:o,error:s,isHovering:a,isStreaming:_,stream:$,toggleCamera:_e,handleMouseEnter:tt,handleMouseLeave:st}=useCameraPanel();return reactExports.useEffect(()=>{o.current&&(o.current.srcObject=$)},[$]),jsxRuntimeExports.jsxs(Box,{...sidebarStyles.cameraPanel.container,children:[jsxRuntimeExports.jsx(Box,{...sidebarStyles.cameraPanel.header,children:_&&jsxRuntimeExports.jsx(LiveIndicator,{})}),jsxRuntimeExports.jsx(Tooltip,{showArrow:!0,content:i(_?"footer.cameraStopping":"footer.cameraControl"),open:a&&!s,children:jsxRuntimeExports.jsx(Box,{...sidebarStyles.cameraPanel.videoContainer,onClick:_e,onMouseEnter:tt,onMouseLeave:st,cursor:"pointer",position:"relative",_hover:{bg:"whiteAlpha.100"},children:s?jsxRuntimeExports.jsx(Text,{color:"red.300",fontSize:"sm",textAlign:"center",children:s}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(VideoStream$1,{videoRef:o,isStreaming:_}),!_&&jsxRuntimeExports.jsx(CameraPlaceholder,{})]})})})]})}function useCaptureScreen(){const i=reactExports.useRef(null),[o,s]=reactExports.useState(!1),{stream:a,isStreaming:_,error:$,startCapture:_e,stopCapture:tt}=useScreenCaptureContext(),st=()=>{_?tt():_e()},it=()=>s(!0),nt=()=>s(!1);return reactExports.useEffect(()=>{i.current&&(i.current.srcObject=a)},[a]),{videoRef:i,error:$,isHovering:o,isStreaming:_,stream:a,toggleCapture:st,handleMouseEnter:it,handleMouseLeave:nt}}function ScreenIndicator(){const{t:i}=useTranslation();return jsxRuntimeExports.jsxs(Box,{color:"red.500",display:"flex",alignItems:"center",gap:2,children:[jsxRuntimeExports.jsx(Box,{w:"8px",h:"8px",borderRadius:"full",bg:"red.500",animation:"pulse 2s infinite"}),jsxRuntimeExports.jsx(Text,{fontSize:"sm",children:i("sidebar.screen")})]})}function ScreenPlaceholder(){const{t:i}=useTranslation();return jsxRuntimeExports.jsxs(Box,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:2,children:[jsxRuntimeExports.jsx(FiMonitor,{size:24}),jsxRuntimeExports.jsx(Text,{color:"whiteAlpha.600",fontSize:"sm",textAlign:"center",children:i("footer.screenControl")})]})}function VideoStream({videoRef:i,isStreaming:o}){return jsxRuntimeExports.jsx("video",{ref:i,autoPlay:!0,playsInline:!0,muted:!0,style:sidebarStyles.screenPanel.video,...o?{}:{display:"none"}})}function ScreenPanel(){const{t:i}=useTranslation(),{videoRef:o,error:s,isHovering:a,isStreaming:_,toggleCapture:$,handleMouseEnter:_e,handleMouseLeave:tt}=useCaptureScreen();return jsxRuntimeExports.jsxs(Box,{...sidebarStyles.screenPanel.container,children:[jsxRuntimeExports.jsx(Box,{...sidebarStyles.screenPanel.header,children:_&&jsxRuntimeExports.jsx(ScreenIndicator,{})}),jsxRuntimeExports.jsx(Tooltip,{showArrow:!0,content:i(_?"footer.screenStopping":"footer.screenControl"),open:a&&!s,children:jsxRuntimeExports.jsx(Box,{...sidebarStyles.screenPanel.screenContainer,onClick:$,onMouseEnter:_e,onMouseLeave:tt,cursor:"pointer",position:"relative",_hover:{bg:"whiteAlpha.100"},children:s?jsxRuntimeExports.jsx(Text,{color:"red.300",fontSize:"sm",textAlign:"center",children:s}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(VideoStream,{videoRef:o,isStreaming:_}),!_&&jsxRuntimeExports.jsx(ScreenPlaceholder,{})]})})})]})}const BrowserContext=reactExports.createContext({browserViewData:null,setBrowserViewData:()=>{},clearBrowserViewData:()=>{}});function BrowserProvider({children:i}){const[o,s]=reactExports.useState(null),a=reactExports.useCallback($=>{s($)},[]),_=reactExports.useCallback(()=>{s(null)},[]);return jsxRuntimeExports.jsx(BrowserContext.Provider,{value:{browserViewData:o,setBrowserViewData:a,clearBrowserViewData:_},children:i})}function useBrowser(){const i=reactExports.useContext(BrowserContext);if(!i)throw new Error("useBrowser must be used within a BrowserProvider");return i}function BrowserPlaceholder(){const{t:i}=useTranslation();return jsxRuntimeExports.jsxs(Box,{position:"absolute",display:"flex",flexDirection:"column",alignItems:"center",gap:2,children:[jsxRuntimeExports.jsx(FiGlobe,{size:24}),jsxRuntimeExports.jsx(Text,{color:"whiteAlpha.600",fontSize:"sm",textAlign:"center",children:i("sidebar.noBrowserSession")})]})}function BrowserPanel(){const{t:i}=useTranslation(),{browserViewData:o}=useBrowser(),[s,a]=reactExports.useState(!1),_=()=>a(!0),$=()=>a(!1);return jsxRuntimeExports.jsxs(Box,{...sidebarStyles.browserPanel.container,children:[jsxRuntimeExports.jsx(Box,{...sidebarStyles.browserPanel.header,children:o&&jsxRuntimeExports.jsx(Text,{fontSize:"sm",color:"blue.300",children:i("sidebar.browserSession")})}),jsxRuntimeExports.jsx(Tooltip,{showArrow:!0,content:o?"Interactive browser view":i("sidebar.noBrowserSession"),open:s,children:jsxRuntimeExports.jsx(Box,{...sidebarStyles.browserPanel.browserContainer,onMouseEnter:_,onMouseLeave:$,position:"relative",children:o?jsxRuntimeExports.jsx("iframe",{src:o.debuggerFullscreenUrl,style:sidebarStyles.browserPanel.iframe,sandbox:"allow-same-origin allow-scripts",allow:"clipboard-read; clipboard-write"}):jsxRuntimeExports.jsx(BrowserPlaceholder,{})})})]})}function BottomTab(){const{t:i}=useTranslation();return jsxRuntimeExports.jsxs(TabsRoot,{defaultValue:"camera",variant:"plain",...sidebarStyles.bottomTab.container,children:[jsxRuntimeExports.jsxs(TabsList,{...sidebarStyles.bottomTab.list,children:[jsxRuntimeExports.jsxs(TabsTrigger,{value:"camera",...sidebarStyles.bottomTab.trigger,children:[jsxRuntimeExports.jsx(FiCamera,{}),i("sidebar.camera")]}),jsxRuntimeExports.jsxs(TabsTrigger,{value:"screen",...sidebarStyles.bottomTab.trigger,children:[jsxRuntimeExports.jsx(FiMonitor,{}),i("sidebar.screen")]}),jsxRuntimeExports.jsxs(TabsTrigger,{value:"browser",...sidebarStyles.bottomTab.trigger,children:[jsxRuntimeExports.jsx(FiGlobe,{}),i("sidebar.browser")]})]}),jsxRuntimeExports.jsx(TabsContent,{value:"camera",children:jsxRuntimeExports.jsx(CameraPanel,{})}),jsxRuntimeExports.jsx(TabsContent,{value:"screen",children:jsxRuntimeExports.jsx(ScreenPanel,{})}),jsxRuntimeExports.jsx(TabsContent,{value:"browser",children:jsxRuntimeExports.jsx(BrowserPanel,{})})]})}const minutesInMonth=43200,minutesInDay=1440,constructFromSymbol=Symbol.for("constructDateFrom");function constructFrom(i,o){return typeof i=="function"?i(o):i&&typeof i=="object"&&constructFromSymbol in i?i[constructFromSymbol](o):i instanceof Date?new i.constructor(o):new Date(o)}function toDate(i,o){return constructFrom(i,i)}let defaultOptions={};function getDefaultOptions(){return defaultOptions}function getTimezoneOffsetInMilliseconds(i){const o=toDate(i),s=new Date(Date.UTC(o.getFullYear(),o.getMonth(),o.getDate(),o.getHours(),o.getMinutes(),o.getSeconds(),o.getMilliseconds()));return s.setUTCFullYear(o.getFullYear()),+i-+s}function normalizeDates(i,...o){const s=constructFrom.bind(null,i||o.find(a=>typeof a=="object"));return o.map(s)}function compareAsc(i,o){const s=+toDate(i)-+toDate(o);return s<0?-1:s>0?1:s}function constructNow(i){return constructFrom(i,Date.now())}function differenceInCalendarMonths(i,o,s){const[a,_]=normalizeDates(s==null?void 0:s.in,i,o),$=a.getFullYear()-_.getFullYear(),_e=a.getMonth()-_.getMonth();return $*12+_e}function getRoundingMethod(i){return o=>{const a=(i?Math[i]:Math.trunc)(o);return a===0?0:a}}function differenceInMilliseconds(i,o){return+toDate(i)-+toDate(o)}function endOfDay(i,o){const s=toDate(i);return s.setHours(23,59,59,999),s}function endOfMonth(i,o){const s=toDate(i),a=s.getMonth();return s.setFullYear(s.getFullYear(),a+1,0),s.setHours(23,59,59,999),s}function isLastDayOfMonth(i,o){const s=toDate(i);return+endOfDay(s)==+endOfMonth(s)}function differenceInMonths(i,o,s){const[a,_,$]=normalizeDates(s==null?void 0:s.in,i,i,o),_e=compareAsc(_,$),tt=Math.abs(differenceInCalendarMonths(_,$));if(tt<1)return 0;_.getMonth()===1&&_.getDate()>27&&_.setDate(30),_.setMonth(_.getMonth()-_e*tt);let st=compareAsc(_,$)===-_e;isLastDayOfMonth(a)&&tt===1&&compareAsc(a,$)===1&&(st=!1);const it=_e*(tt-+st);return it===0?0:it}function differenceInSeconds(i,o,s){const a=differenceInMilliseconds(i,o)/1e3;return getRoundingMethod(s==null?void 0:s.roundingMethod)(a)}const formatDistanceLocale={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},formatDistance$1=(i,o,s)=>{let a;const _=formatDistanceLocale[i];return typeof _=="string"?a=_:o===1?a=_.one:a=_.other.replace("{{count}}",o.toString()),s!=null&&s.addSuffix?s.comparison&&s.comparison>0?"in "+a:a+" ago":a};function buildFormatLongFn(i){return(o={})=>{const s=o.width?String(o.width):i.defaultWidth;return i.formats[s]||i.formats[i.defaultWidth]}}const dateFormats={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},timeFormats={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},dateTimeFormats={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},formatLong={date:buildFormatLongFn({formats:dateFormats,defaultWidth:"full"}),time:buildFormatLongFn({formats:timeFormats,defaultWidth:"full"}),dateTime:buildFormatLongFn({formats:dateTimeFormats,defaultWidth:"full"})},formatRelativeLocale={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},formatRelative=(i,o,s,a)=>formatRelativeLocale[i];function buildLocalizeFn(i){return(o,s)=>{const a=s!=null&&s.context?String(s.context):"standalone";let _;if(a==="formatting"&&i.formattingValues){const _e=i.defaultFormattingWidth||i.defaultWidth,tt=s!=null&&s.width?String(s.width):_e;_=i.formattingValues[tt]||i.formattingValues[_e]}else{const _e=i.defaultWidth,tt=s!=null&&s.width?String(s.width):i.defaultWidth;_=i.values[tt]||i.values[_e]}const $=i.argumentCallback?i.argumentCallback(o):o;return _[$]}}const eraValues={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},quarterValues={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},monthValues={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},dayValues={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},dayPeriodValues={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},formattingDayPeriodValues={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},ordinalNumber=(i,o)=>{const s=Number(i),a=s%100;if(a>20||a<10)switch(a%10){case 1:return s+"st";case 2:return s+"nd";case 3:return s+"rd"}return s+"th"},localize={ordinalNumber,era:buildLocalizeFn({values:eraValues,defaultWidth:"wide"}),quarter:buildLocalizeFn({values:quarterValues,defaultWidth:"wide",argumentCallback:i=>i-1}),month:buildLocalizeFn({values:monthValues,defaultWidth:"wide"}),day:buildLocalizeFn({values:dayValues,defaultWidth:"wide"}),dayPeriod:buildLocalizeFn({values:dayPeriodValues,defaultWidth:"wide",formattingValues:formattingDayPeriodValues,defaultFormattingWidth:"wide"})};function buildMatchFn(i){return(o,s={})=>{const a=s.width,_=a&&i.matchPatterns[a]||i.matchPatterns[i.defaultMatchWidth],$=o.match(_);if(!$)return null;const _e=$[0],tt=a&&i.parsePatterns[a]||i.parsePatterns[i.defaultParseWidth],st=Array.isArray(tt)?findIndex(tt,et=>et.test(_e)):findKey(tt,et=>et.test(_e));let it;it=i.valueCallback?i.valueCallback(st):st,it=s.valueCallback?s.valueCallback(it):it;const nt=o.slice(_e.length);return{value:it,rest:nt}}}function findKey(i,o){for(const s in i)if(Object.prototype.hasOwnProperty.call(i,s)&&o(i[s]))return s}function findIndex(i,o){for(let s=0;s{const a=o.match(i.matchPattern);if(!a)return null;const _=a[0],$=o.match(i.parsePattern);if(!$)return null;let _e=i.valueCallback?i.valueCallback($[0]):$[0];_e=s.valueCallback?s.valueCallback(_e):_e;const tt=o.slice(_.length);return{value:_e,rest:tt}}}const matchOrdinalNumberPattern=/^(\d+)(th|st|nd|rd)?/i,parseOrdinalNumberPattern=/\d+/i,matchEraPatterns={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},parseEraPatterns={any:[/^b/i,/^(a|c)/i]},matchQuarterPatterns={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},parseQuarterPatterns={any:[/1/i,/2/i,/3/i,/4/i]},matchMonthPatterns={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},parseMonthPatterns={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},matchDayPatterns={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},parseDayPatterns={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},matchDayPeriodPatterns={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},parseDayPeriodPatterns={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},match={ordinalNumber:buildMatchPatternFn({matchPattern:matchOrdinalNumberPattern,parsePattern:parseOrdinalNumberPattern,valueCallback:i=>parseInt(i,10)}),era:buildMatchFn({matchPatterns:matchEraPatterns,defaultMatchWidth:"wide",parsePatterns:parseEraPatterns,defaultParseWidth:"any"}),quarter:buildMatchFn({matchPatterns:matchQuarterPatterns,defaultMatchWidth:"wide",parsePatterns:parseQuarterPatterns,defaultParseWidth:"any",valueCallback:i=>i+1}),month:buildMatchFn({matchPatterns:matchMonthPatterns,defaultMatchWidth:"wide",parsePatterns:parseMonthPatterns,defaultParseWidth:"any"}),day:buildMatchFn({matchPatterns:matchDayPatterns,defaultMatchWidth:"wide",parsePatterns:parseDayPatterns,defaultParseWidth:"any"}),dayPeriod:buildMatchFn({matchPatterns:matchDayPeriodPatterns,defaultMatchWidth:"any",parsePatterns:parseDayPeriodPatterns,defaultParseWidth:"any"})},enUS={code:"en-US",formatDistance:formatDistance$1,formatLong,formatRelative,localize,match,options:{weekStartsOn:0,firstWeekContainsDate:1}};function formatDistance(i,o,s){const a=getDefaultOptions(),_=(s==null?void 0:s.locale)??a.locale??enUS,$=2520,_e=compareAsc(i,o);if(isNaN(_e))throw new RangeError("Invalid time value");const tt=Object.assign({},s,{addSuffix:s==null?void 0:s.addSuffix,comparison:_e}),[st,it]=normalizeDates(s==null?void 0:s.in,..._e>0?[o,i]:[i,o]),nt=differenceInSeconds(it,st),et=(getTimezoneOffsetInMilliseconds(it)-getTimezoneOffsetInMilliseconds(st))/1e3,j=Math.round((nt-et)/60);let rt;if(j<2)return s!=null&&s.includeSeconds?nt<5?_.formatDistance("lessThanXSeconds",5,tt):nt<10?_.formatDistance("lessThanXSeconds",10,tt):nt<20?_.formatDistance("lessThanXSeconds",20,tt):nt<40?_.formatDistance("halfAMinute",0,tt):nt<60?_.formatDistance("lessThanXMinutes",1,tt):_.formatDistance("xMinutes",1,tt):j===0?_.formatDistance("lessThanXMinutes",1,tt):_.formatDistance("xMinutes",j,tt);if(j<45)return _.formatDistance("xMinutes",j,tt);if(j<90)return _.formatDistance("aboutXHours",1,tt);if(j{const{children:s,portalled:a=!0,portalRef:_,offset:$,..._e}=i;return jsxRuntimeExports.jsx(Portal,{disabled:!a,container:_,children:jsxRuntimeExports.jsx(DrawerPositioner,{padding:$,children:jsxRuntimeExports.jsx(DrawerContent$1,{ref:o,..._e,asChild:!1,children:s})})})}),DrawerCloseTrigger=reactExports.forwardRef((i,o)=>jsxRuntimeExports.jsx(DrawerCloseTrigger$1,{position:"absolute",top:"2",insetEnd:"2",...i,asChild:!0,children:jsxRuntimeExports.jsx(CloseButton,{size:"sm",ref:o})})),DrawerTrigger=DrawerTrigger$1,DrawerRoot=DrawerRoot$1,DrawerFooter=DrawerFooter$1,DrawerHeader=DrawerHeader$1,DrawerBody=DrawerBody$1,DrawerBackdrop=DrawerBackdrop$1,DrawerTitle=DrawerTitle$1,DrawerActionTrigger=DrawerActionTrigger$1,useHistoryDrawer=()=>{const{t:i}=useTranslation(),[o,s]=reactExports.useState(!1),{historyList:a,currentHistoryUid:_,setCurrentHistoryUid:$,setHistoryList:_e,messages:tt,updateHistoryList:st}=useChatHistory(),{sendMessage:it}=useWebSocket();return{open:o,setOpen:s,historyList:a,currentHistoryUid:_,fetchAndSetHistory:rt=>{if(!(!rt||rt===_)){if(_&&tt.length>0){const ot=tt[tt.length-1];st(_,ot)}$(rt),it({type:"fetch-and-set-history",history_uid:rt})}},deleteHistory:rt=>{if(rt===_){toaster.create({title:i("error.cannotDeleteCurrentHistory"),type:"warning",duration:2e3});return}it({type:"delete-history",history_uid:rt}),_e(a.filter(ot=>ot.uid!==rt))},getLatestMessageContent:rt=>{var ot;if(rt.uid===_&&tt.length>0){const at=tt[tt.length-1];return{content:at.content,timestamp:at.timestamp}}return{content:((ot=rt.latest_message)==null?void 0:ot.content)||"",timestamp:rt.timestamp}}}},HistoryItem=reactExports.memo(({isSelected:i,latestMessage:o,onSelect:s,onDelete:a,isDeleteDisabled:_})=>{const{t:$}=useTranslation();return jsxRuntimeExports.jsxs(Box,{...sidebarStyles.historyDrawer.historyItem,...i?sidebarStyles.historyDrawer.historyItemSelected:{},onClick:s,children:[jsxRuntimeExports.jsxs(Box,{...sidebarStyles.historyDrawer.historyHeader,children:[jsxRuntimeExports.jsx(Box,{...sidebarStyles.historyDrawer.timestamp,children:o.timestamp?formatDistanceToNow(new Date(o.timestamp),{addSuffix:!0}):$("history.noMessages")}),jsxRuntimeExports.jsx(Button$2,{onClick:a,disabled:_,...sidebarStyles.historyDrawer.deleteButton,children:jsxRuntimeExports.jsx(FiTrash2,{})})]}),o.content&&jsxRuntimeExports.jsx(Box,{...sidebarStyles.historyDrawer.messagePreview,children:o.content})]})});HistoryItem.displayName="HistoryItem";function HistoryDrawer({children:i}){const{t:o}=useTranslation(),{open:s,setOpen:a,historyList:_,currentHistoryUid:$,fetchAndSetHistory:_e,deleteHistory:tt,getLatestMessageContent:st}=useHistoryDrawer();return jsxRuntimeExports.jsxs(DrawerRoot,{open:s,onOpenChange:it=>a(it.open),placement:"start",children:[jsxRuntimeExports.jsx(DrawerBackdrop,{}),jsxRuntimeExports.jsx(DrawerTrigger,{asChild:!0,children:i}),jsxRuntimeExports.jsxs(DrawerContent,{style:sidebarStyles.historyDrawer.drawer.content,children:[jsxRuntimeExports.jsxs(DrawerHeader,{children:[jsxRuntimeExports.jsx(DrawerTitle,{style:sidebarStyles.historyDrawer.drawer.title,children:o("history.chatHistoryList")}),jsxRuntimeExports.jsx(DrawerCloseTrigger,{style:sidebarStyles.historyDrawer.drawer.closeButton})]}),jsxRuntimeExports.jsx(DrawerBody,{children:jsxRuntimeExports.jsx(Box,{...sidebarStyles.historyDrawer.listContainer,children:_.map(it=>jsxRuntimeExports.jsx(HistoryItem,{isSelected:$===it.uid,latestMessage:st(it),onSelect:()=>_e(it.uid),onDelete:nt=>{nt.stopPropagation(),tt(it.uid)},isDeleteDisabled:$===it.uid},it.uid))})}),jsxRuntimeExports.jsx(DrawerFooter,{children:jsxRuntimeExports.jsx(DrawerActionTrigger,{asChild:!0,children:jsxRuntimeExports.jsx(Button$2,{...sidebarStyles.historyDrawer.drawer.actionButton,children:o("common.close")})})})]})]})}const useSidebar=()=>{const i=useDisclosure(),{sendMessage:o}=useWebSocket(),{interrupt:s}=useInterrupt(),{currentHistoryUid:a,messages:_,updateHistoryList:$}=useChatHistory(),{setMode:_e,mode:tt,isElectron:st}=useMode(),it=()=>{if(a&&_.length>0){const nt=_[_.length-1];$(a,nt)}s(),o({type:"create-new-history"})};return{settingsOpen:i.open,onSettingsOpen:i.onOpen,onSettingsClose:i.onClose,createNewHistory:it,setMode:_e,currentMode:tt,isElectron:st}},ClipboardIcon=reactExports.forwardRef(function i(o,s){return jsxRuntimeExports.jsx(ClipboardIndicator,{copied:jsxRuntimeExports.jsx(LuCheck,{}),...o,ref:s,children:jsxRuntimeExports.jsx(LuClipboard,{})})}),ClipboardCopyText=reactExports.forwardRef(function i(o,s){return jsxRuntimeExports.jsx(ClipboardIndicator,{copied:"Copied",...o,ref:s,children:"Copy"})});reactExports.forwardRef(function i(o,s){return jsxRuntimeExports.jsx(ClipboardLabel,{textStyle:"sm",fontWeight:"medium",display:"inline-block",mb:"1",...o,ref:s})});const ClipboardButton=reactExports.forwardRef(function i(o,s){return jsxRuntimeExports.jsx(ClipboardTrigger,{asChild:!0,children:jsxRuntimeExports.jsxs(Button$2,{ref:s,size:"sm",variant:"surface",...o,children:[jsxRuntimeExports.jsx(ClipboardIcon,{}),jsxRuntimeExports.jsx(ClipboardCopyText,{})]})})});reactExports.forwardRef(function i(o,s){return jsxRuntimeExports.jsx(ClipboardTrigger,{asChild:!0,children:jsxRuntimeExports.jsxs(Button$2,{unstyled:!0,variant:"plain",size:"xs",display:"inline-flex",alignItems:"center",gap:"2",ref:s,...o,children:[jsxRuntimeExports.jsx(LuLink,{}),jsxRuntimeExports.jsx(ClipboardCopyText,{})]})})});reactExports.forwardRef(function i(o,s){return jsxRuntimeExports.jsx(ClipboardTrigger,{asChild:!0,children:jsxRuntimeExports.jsxs(IconButton,{ref:s,size:"xs",variant:"subtle",...o,children:[jsxRuntimeExports.jsx(ClipboardIcon,{}),jsxRuntimeExports.jsx(ClipboardCopyText,{srOnly:!0})]})})});reactExports.forwardRef(function i(o,s){return jsxRuntimeExports.jsx(ClipboardInput,{asChild:!0,children:jsxRuntimeExports.jsx(Input$1,{ref:s,...o})})});const ClipboardRoot=ClipboardRoot$1,useGroupDrawer=()=>{const{t:i}=useTranslation(),[o,s]=reactExports.useState(!1),[a,_]=reactExports.useState(""),{sendMessage:$}=useWebSocket(),_e=reactExports.useCallback(()=>{$({type:"request-group-info"})},[$]),tt=reactExports.useCallback(async()=>{if(!a.trim()){toaster.create({title:i("error.enterValidUuid"),type:"error",duration:2e3});return}$({type:"add-client-to-group",invitee_uid:a.trim()}),_(""),setTimeout(_e,100)},[a,$,_e,i]),st=reactExports.useCallback(nt=>{$({type:"remove-client-from-group",target_uid:nt}),setTimeout(_e,100)},[$,_e]),it=reactExports.useCallback(nt=>{$({type:"remove-client-from-group",target_uid:nt}),setTimeout(_e,100)},[$,_e]);return{isOpen:o,setIsOpen:s,inviteUid:a,setInviteUid:_,handleInvite:tt,handleRemove:st,handleLeaveGroup:it,requestGroupInfo:_e}},GroupContext=reactExports.createContext(null);function GroupProvider({children:i}){const[o,s]=reactExports.useState(""),[a,_]=reactExports.useState([]),[$,_e]=reactExports.useState(!1),tt=()=>{_([]),_e(!1)},st=reactExports.useMemo(()=>a.includes(o)?[o,...a.filter(it=>it!==o)]:a,[a,o]);return jsxRuntimeExports.jsx(GroupContext.Provider,{value:{selfUid:o,groupMembers:a,isOwner:$,setSelfUid:s,setGroupMembers:_,setIsOwner:_e,sortedGroupMembers:st,resetGroupState:tt},children:i})}function useGroup(){const i=reactExports.useContext(GroupContext);if(!i)throw new Error("useGroup must be used within a GroupProvider");return i}function GroupDrawer({children:i}){const{t:o}=useTranslation(),{selfUid:s,sortedGroupMembers:a,isOwner:_}=useGroup(),{isOpen:$,setIsOpen:_e,inviteUid:tt,setInviteUid:st,handleInvite:it,handleRemove:nt,handleLeaveGroup:et,requestGroupInfo:j}=useGroupDrawer();return jsxRuntimeExports.jsxs(DrawerRoot,{open:$,onOpenChange:rt=>{_e(rt.open),rt.open&&j()},placement:"start",children:[jsxRuntimeExports.jsx(DrawerBackdrop,{}),jsxRuntimeExports.jsx(DrawerTrigger,{asChild:!0,children:i}),jsxRuntimeExports.jsxs(DrawerContent,{style:sidebarStyles.historyDrawer.drawer.content,children:[jsxRuntimeExports.jsxs(DrawerHeader,{children:[jsxRuntimeExports.jsx(DrawerTitle,{style:sidebarStyles.historyDrawer.drawer.title,children:o("group.management")}),jsxRuntimeExports.jsx(DrawerCloseTrigger,{style:sidebarStyles.historyDrawer.drawer.closeButton})]}),jsxRuntimeExports.jsx(DrawerBody,{children:jsxRuntimeExports.jsxs(Box,{...sidebarStyles.historyDrawer.listContainer,children:[jsxRuntimeExports.jsxs(Box,{...sidebarStyles.groupDrawer.section,children:[jsxRuntimeExports.jsx(Text,{...sidebarStyles.groupDrawer.sectionTitle,children:o("group.yourUuid")}),jsxRuntimeExports.jsxs(Box,{...sidebarStyles.groupDrawer.memberItem,children:[jsxRuntimeExports.jsx(Text,{...sidebarStyles.groupDrawer.memberText,children:s}),jsxRuntimeExports.jsx(ClipboardRoot,{value:s,children:jsxRuntimeExports.jsx(ClipboardButton,{...sidebarStyles.groupDrawer.clipboardButton,size:"sm"})})]})]}),jsxRuntimeExports.jsxs(Box,{...sidebarStyles.groupDrawer.section,children:[jsxRuntimeExports.jsx(Text,{...sidebarStyles.groupDrawer.sectionTitle,children:o("group.inviteMember")}),jsxRuntimeExports.jsxs(Box,{...sidebarStyles.groupDrawer.inviteBox,children:[jsxRuntimeExports.jsx(Input$1,{value:tt,onChange:rt=>st(rt.target.value),placeholder:o("group.enterMemberUuid"),...sidebarStyles.groupDrawer.input}),jsxRuntimeExports.jsx(Button$2,{onClick:it,...sidebarStyles.groupDrawer.button,children:o("group.invite")})]})]}),jsxRuntimeExports.jsxs(Box,{...sidebarStyles.groupDrawer.section,children:[jsxRuntimeExports.jsx(Text,{...sidebarStyles.groupDrawer.sectionTitle,children:o("group.members")}),jsxRuntimeExports.jsx(Box,{...sidebarStyles.groupDrawer.memberList,children:a.map(rt=>jsxRuntimeExports.jsxs(Box,{...sidebarStyles.groupDrawer.memberItem,children:[jsxRuntimeExports.jsx(Text,{...sidebarStyles.groupDrawer.memberText,children:rt===s?`${rt} (${o("group.you")})`:rt}),(_&&rt!==s||!_&&rt===s)&&jsxRuntimeExports.jsx(IconButton,{"aria-label":o(rt===s?"group.leaveGroup":"group.removeMember"),onClick:()=>rt===s?et(s):nt(rt),...sidebarStyles.groupDrawer.removeButton,size:"sm",title:o(rt===s?"group.leaveGroup":"group.removeMember"),children:rt===s?o("group.leave"):jsxRuntimeExports.jsx(FiX,{})})]},rt))})]})]})}),jsxRuntimeExports.jsx(DrawerFooter,{children:jsxRuntimeExports.jsx(DrawerActionTrigger,{asChild:!0,children:jsxRuntimeExports.jsx(Button$2,{...sidebarStyles.historyDrawer.drawer.actionButton,children:o("common.close")})})})]})]})}const ToggleButton$1=reactExports.memo(({isCollapsed:i,onToggle:o})=>jsxRuntimeExports.jsx(Box,{...sidebarStyles.sidebar.toggleButton,style:{transform:i?"rotate(180deg)":"rotate(0deg)"},onClick:o,children:jsxRuntimeExports.jsx(FiChevronLeft,{})}));ToggleButton$1.displayName="ToggleButton";const ModeMenu=reactExports.memo(({setMode:i,currentMode:o,isElectron:s})=>jsxRuntimeExports.jsxs(MenuRoot,{children:[jsxRuntimeExports.jsx(MenuTrigger,{as:Button$2,"aria-label":"Mode Menu",title:"Change Mode",children:jsxRuntimeExports.jsx(FiLayers,{})}),jsxRuntimeExports.jsx(MenuPositioner,{children:jsxRuntimeExports.jsx(MenuContent,{children:jsxRuntimeExports.jsxs(MenuRadioItemGroup,{value:o,children:[jsxRuntimeExports.jsxs(MenuRadioItem,{value:"window",onClick:()=>i("window"),children:[jsxRuntimeExports.jsx(MenuItemIndicator,{}),"Live Mode"]}),jsxRuntimeExports.jsxs(MenuRadioItem,{value:"pet",onClick:()=>{s&&i("pet")},disabled:!s,title:s?void 0:"Pet mode is only available in desktop app",children:[jsxRuntimeExports.jsx(MenuItemIndicator,{}),"Pet Mode"]})]})})})]}));ModeMenu.displayName="ModeMenu";const HeaderButtons=reactExports.memo(({onSettingsOpen:i,onNewHistory:o,setMode:s,currentMode:a,isElectron:_})=>jsxRuntimeExports.jsxs(Box,{display:"flex",gap:1,children:[jsxRuntimeExports.jsx(Button$2,{onClick:i,children:jsxRuntimeExports.jsx(FiSettings,{})}),jsxRuntimeExports.jsx(GroupDrawer,{children:jsxRuntimeExports.jsx(Button$2,{children:jsxRuntimeExports.jsx(FiUsers,{})})}),jsxRuntimeExports.jsx(HistoryDrawer,{children:jsxRuntimeExports.jsx(Button$2,{children:jsxRuntimeExports.jsx(FiClock,{})})}),jsxRuntimeExports.jsx(Button$2,{onClick:o,children:jsxRuntimeExports.jsx(FiPlus,{})}),jsxRuntimeExports.jsx(ModeMenu,{setMode:s,currentMode:a,isElectron:_})]}));HeaderButtons.displayName="HeaderButtons";const SidebarContent=reactExports.memo(({onSettingsOpen:i,onNewHistory:o,setMode:s,currentMode:a,isElectron:_})=>jsxRuntimeExports.jsxs(Box,{...sidebarStyles.sidebar.content,children:[jsxRuntimeExports.jsx(Box,{...sidebarStyles.sidebar.header,children:jsxRuntimeExports.jsx(HeaderButtons,{onSettingsOpen:i,onNewHistory:o,setMode:s,currentMode:a,isElectron:_})}),jsxRuntimeExports.jsx(ChatHistoryPanel,{}),jsxRuntimeExports.jsx(BottomTab,{})]}));SidebarContent.displayName="SidebarContent";function Sidebar({isCollapsed:i=!1,onToggle:o}){const{settingsOpen:s,onSettingsOpen:a,onSettingsClose:_,createNewHistory:$,setMode:_e,currentMode:tt,isElectron:st}=useSidebar();return jsxRuntimeExports.jsxs(Box,{...sidebarStyles.sidebar.container(i),children:[jsxRuntimeExports.jsx(ToggleButton$1,{isCollapsed:i,onToggle:o}),!i&&!s&&jsxRuntimeExports.jsx(SidebarContent,{onSettingsOpen:a,onNewHistory:$,setMode:_e,currentMode:tt,isElectron:st}),!i&&s&&jsxRuntimeExports.jsx(SettingUI,{open:s,onClose:_,onToggle:o})]})}function BsMicFill(i){return GenIcon({attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M5 3a3 3 0 0 1 6 0v5a3 3 0 0 1-6 0z"},child:[]},{tag:"path",attr:{d:"M3.5 6.5A.5.5 0 0 1 4 7v1a4 4 0 0 0 8 0V7a.5.5 0 0 1 1 0v1a5 5 0 0 1-4.5 4.975V15h3a.5.5 0 0 1 0 1h-7a.5.5 0 0 1 0-1h3v-2.025A5 5 0 0 1 3 8V7a.5.5 0 0 1 .5-.5"},child:[]}]})(i)}function BsMicMuteFill(i){return GenIcon({attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M13 8c0 .564-.094 1.107-.266 1.613l-.814-.814A4 4 0 0 0 12 8V7a.5.5 0 0 1 1 0zm-5 4c.818 0 1.578-.245 2.212-.667l.718.719a5 5 0 0 1-2.43.923V15h3a.5.5 0 0 1 0 1h-7a.5.5 0 0 1 0-1h3v-2.025A5 5 0 0 1 3 8V7a.5.5 0 0 1 1 0v1a4 4 0 0 0 4 4m3-9v4.879L5.158 2.037A3.001 3.001 0 0 1 11 3"},child:[]},{tag:"path",attr:{d:"M9.486 10.607 5 6.12V8a3 3 0 0 0 4.486 2.607m-7.84-9.253 12 12 .708-.708-12-12z"},child:[]}]})(i)}function BsPaperclip(i){return GenIcon({attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M4.5 3a2.5 2.5 0 0 1 5 0v9a1.5 1.5 0 0 1-3 0V5a.5.5 0 0 1 1 0v7a.5.5 0 0 0 1 0V3a1.5 1.5 0 1 0-3 0v9a2.5 2.5 0 0 0 5 0V5a.5.5 0 0 1 1 0v7a3.5 3.5 0 1 1-7 0z"},child:[]}]})(i)}function IoHandRightSharp(i){return GenIcon({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M82.42 209.08c15.06-6.62 32.38 1.31 38.5 17.62L156 312h11.27V80c0-17.6 13.3-32 29.55-32 16.26 0 29.55 14.4 29.55 32v151.75l14.78.25V32c0-17.6 13.3-32 29.55-32 16.3 0 29.55 14.4 29.55 32v199.75L315 232V64c0-17.6 13.3-32 29.55-32 16.26 0 29.55 14.4 29.55 32v183.75l14.78.25V128c0-17.6 13.3-32 29.55-32C434.7 96 448 110.4 448 128v216c0 75.8-37.13 168-169 168-40.8 0-79.42-7-100.66-21a121.41 121.41 0 0 1-33.72-33.31 138 138 0 0 1-16-31.78L66.16 250.77c-6.11-16.31 1.2-35.06 16.26-41.69z"},child:[]}]})(i)}const InputGroup=reactExports.forwardRef((i,o)=>{const{startElement:s,startElementProps:a,endElement:_,endElementProps:$,children:_e,startOffset:tt="6px",endOffset:st="6px",...it}=i,nt=reactExports.Children.only(_e);return jsxRuntimeExports.jsxs(Group,{ref:o,...it,children:[s&&jsxRuntimeExports.jsx(InputElement,{pointerEvents:"none",...a,children:s}),reactExports.cloneElement(nt,{...s&&{ps:`calc(var(--input-height) - ${tt})`},..._&&{pe:`calc(var(--input-height) - ${st})`},..._e.props}),_&&jsxRuntimeExports.jsx(InputElement,{placement:"end",...$,children:_})]})}),footerStyles={footer:{container:i=>({bg:i?"transparent":"gray.800",borderTopRadius:i?"none":"lg",transform:i?"translateY(calc(100% - 24px))":"translateY(0)",transition:"all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",height:"100%",position:"relative",overflow:i?"visible":"hidden",pb:"4"}),toggleButton:{height:"24px",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",color:"whiteAlpha.700",_hover:{color:"white"},bg:"transparent",transition:"all 0.3s cubic-bezier(0.4, 0, 0.2, 1)"},actionButton:{borderRadius:"12px",width:"50px",height:"50px",minW:"50px"},input:{bg:"gray.700",border:"none",height:"80px",borderRadius:"12px",fontSize:"18px",pl:"12",pr:"4",color:"whiteAlpha.900",_placeholder:{color:"whiteAlpha.500"},_focus:{border:"none",bg:"gray.700"},resize:"none",minHeight:"80px",maxHeight:"80px",py:"0",display:"flex",alignItems:"center",paddingTop:"28px",lineHeight:"1.4"},attachButton:{position:"absolute",left:"1",top:"50%",transform:"translateY(-50%)",color:"whiteAlpha.700",zIndex:2,_hover:{bg:"transparent",color:"white"}}},aiIndicator:{container:{bg:"#7C5CFF",color:"white",width:"110px",height:"30px",borderRadius:"12px",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 2px 6px rgba(0,0,0,0.1)",overflow:"hidden"},text:{fontSize:"12px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}}};function AIStateIndicator(){const{t:i}=useTranslation(),{aiState:o}=useAiState(),s=footerStyles.aiIndicator;return jsxRuntimeExports.jsx(Box,{...s.container,children:jsxRuntimeExports.jsx(Text,{...s.text,children:i(`aiState.${o}`)})})}function useTextInput(){const[i,o]=reactExports.useState(""),[s,a]=reactExports.useState(!1),_=useWebSocket(),{aiState:$}=useAiState(),{interrupt:_e}=useInterrupt(),{appendHumanMessage:tt}=useChatHistory(),{stopMic:st,autoStopMic:it}=useVAD(),{captureAllMedia:nt}=useMediaCapture(),et=lt=>{o(lt.target.value)},j=async()=>{if(!i.trim()||!_)return;$==="thinking-speaking"&&_e();const lt=await nt();tt(i.trim()),_.sendMessage({type:"text-input",text:i.trim(),images:lt}),it&&st(),o("")};return{inputText:i,setInputText:et,handleSend:j,handleKeyPress:lt=>{s||lt.key==="Enter"&&!lt.shiftKey&&(lt.preventDefault(),j())},handleCompositionStart:()=>a(!0),handleCompositionEnd:()=>a(!1)}}const useFooter=()=>{const{inputText:i,setInputText:o,handleKeyPress:s,handleCompositionStart:a,handleCompositionEnd:_}=useTextInput(),{interrupt:$}=useInterrupt(),{startMic:_e,autoStartMicOn:tt}=useVAD(),{handleMicToggle:st,micOn:it}=useMicToggle(),{setAiState:nt,aiState:et}=useAiState(),{sendTriggerSignal:j}=useTriggerSpeak(),{settings:rt}=useProactiveSpeak();return{inputValue:i,handleInputChange:ut=>{o({target:{value:ut.target.value}}),nt(AiStateEnum.WAITING)},handleKeyPress:ut=>{s(ut)},handleCompositionStart:a,handleCompositionEnd:_,handleInterrupt:()=>{et===AiStateEnum.THINKING_SPEAKING?($(),tt&&_e()):rt.allowButtonTrigger&&j(-1)},handleMicToggle:st,micOn:it}},ToggleButton=reactExports.memo(({isCollapsed:i,onToggle:o})=>jsxRuntimeExports.jsx(Box,{...footerStyles.footer.toggleButton,onClick:o,color:"whiteAlpha.500",style:{transform:i?"rotate(180deg)":"rotate(0deg)"},children:jsxRuntimeExports.jsx(FiChevronDown,{})}));ToggleButton.displayName="ToggleButton";const ActionButtons=reactExports.memo(({micOn:i,onMicToggle:o,onInterrupt:s})=>jsxRuntimeExports.jsxs(HStack,{gap:2,children:[jsxRuntimeExports.jsx(IconButton,{bg:i?"green.500":"red.500",...footerStyles.footer.actionButton,onClick:o,children:i?jsxRuntimeExports.jsx(BsMicFill,{}):jsxRuntimeExports.jsx(BsMicMuteFill,{})}),jsxRuntimeExports.jsx(IconButton,{"aria-label":"Raise hand",bg:"yellow.500",...footerStyles.footer.actionButton,onClick:s,children:jsxRuntimeExports.jsx(IoHandRightSharp,{size:"24"})})]}));ActionButtons.displayName="ActionButtons";const MessageInput=reactExports.memo(({value:i,onChange:o,onKeyDown:s,onCompositionStart:a,onCompositionEnd:_})=>{const{t:$}=useTranslation();return jsxRuntimeExports.jsx(InputGroup,{flex:1,children:jsxRuntimeExports.jsxs(Box,{position:"relative",width:"100%",children:[jsxRuntimeExports.jsx(IconButton,{"aria-label":"Attach file",variant:"ghost",...footerStyles.footer.attachButton,children:jsxRuntimeExports.jsx(BsPaperclip,{size:"24"})}),jsxRuntimeExports.jsx(Textarea,{value:i,onChange:o,onKeyDown:s,onCompositionStart:a,onCompositionEnd:_,placeholder:$("footer.typeYourMessage"),...footerStyles.footer.input})]})})});MessageInput.displayName="MessageInput";function Footer({isCollapsed:i=!1,onToggle:o}){const{inputValue:s,handleInputChange:a,handleKeyPress:_,handleCompositionStart:$,handleCompositionEnd:_e,handleInterrupt:tt,handleMicToggle:st,micOn:it}=useFooter();return jsxRuntimeExports.jsxs(Box,{...footerStyles.footer.container(i),children:[jsxRuntimeExports.jsx(ToggleButton,{isCollapsed:i,onToggle:o}),jsxRuntimeExports.jsx(Box,{pt:"0",px:"4",children:jsxRuntimeExports.jsxs(HStack,{width:"100%",gap:4,children:[jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(Box,{mb:"1.5",children:jsxRuntimeExports.jsx(AIStateIndicator,{})}),jsxRuntimeExports.jsx(ActionButtons,{micOn:it,onMicToggle:st,onInterrupt:tt})]}),jsxRuntimeExports.jsx(MessageInput,{value:s,onChange:a,onKeyDown:_,onCompositionStart:$,onCompositionEnd:_e})]})})]})}const isElectron=window.api!==void 0,getAppHeight=()=>typeof window<"u"&&/Mobi|Android/i.test(navigator.userAgent)?`${window.innerHeight}px`:isElectron?"calc(100vh - 30px)":"100vh",layoutStyles={appContainer:{width:"100vw",height:getAppHeight(),bg:"gray.900",color:"white",overflow:"hidden",position:"relative",display:"flex",flexDirection:{base:"column",md:"row"},mt:isElectron?"30px":"0"},sidebar:{position:"relative",width:{base:"100%",md:"440px"},height:{base:"auto",md:"100%"},bg:"gray.800",borderRight:"1px solid",borderColor:"whiteAlpha.200",overflow:"hidden",flexShrink:0,transition:"all 0.2s"},mainContent:{flex:1,height:{base:"calc(100% - 120px)",md:"100%"},position:"relative",display:"flex",flexDirection:"column",transition:"all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",width:"100%",overflow:"hidden"},footer:{width:"100%",height:{base:"100px",md:"120px"},transition:"all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",willChange:"transform",position:"relative",zIndex:1},collapsedFooter:{height:{base:"20px",md:"24px"},transition:"all 0.3s cubic-bezier(0.4, 0, 0.2, 1)"},windowsTitleBar:{position:"fixed",top:0,left:0,width:"100vw",display:"flex",alignItems:"center",justifyContent:"space-between",height:"30px",backgroundColor:"gray.800",paddingX:"10px",zIndex:1e3,css:{"-webkit-app-region":"drag"}},macTitleBar:{position:"fixed",top:0,left:0,width:"100vw",display:"flex",alignItems:"center",justifyContent:"center",height:"30px",backgroundColor:"gray.800",zIndex:1e3,css:{"-webkit-app-region":"drag","-webkit-user-select":"none"}},titleBarTitle:{fontSize:"sm",color:"whiteAlpha.800",textAlign:"center"},titleBarButtons:{display:"flex",gap:"1"},titleBarButton:{size:"sm",variant:"ghost",color:"whiteAlpha.800",css:{"-webkit-app-region":"no-drag"},_hover:{backgroundColor:"whiteAlpha.200"}},closeButton:{size:"sm",variant:"ghost",color:"whiteAlpha.800",css:{"-webkit-app-region":"no-drag"},_hover:{backgroundColor:"red.500"}}};function WebSocketHandler({children:i}){const{t:o}=useTranslation(),[s,a]=reactExports.useState("CLOSED"),[_,$]=useLocalStorage("wsUrl",defaultWsUrl),[_e,tt]=useLocalStorage("baseUrl",defaultBaseUrl),{aiState:st,setAiState:it,backendSynthComplete:nt,setBackendSynthComplete:et}=useAiState(),{setModelInfo:j}=useLive2DConfig(),{setSubtitleText:rt}=useSubtitle(),{clearResponse:ot,setForceNewMessage:at,appendHumanMessage:lt,appendOrUpdateToolCallMessage:ut}=useChatHistory(),{addAudioTask:ct}=useAudioTask(),dt=useBgUrl(),{confUid:ft,setConfName:ht,setConfUid:bt,setConfigFiles:yt}=useConfig(),[mt,gt]=reactExports.useState(void 0),{setSelfUid:vt,setGroupMembers:wt,setIsOwner:Ct}=useGroup(),{startMic:kt,stopMic:It,autoStartMicOnConvEnd:Pt}=useVAD(),St=reactExports.useRef(Pt),{interrupt:Rt}=useInterrupt(),{setBrowserViewData:At}=useBrowser();reactExports.useEffect(()=>{St.current=Pt},[Pt]),reactExports.useEffect(()=>{mt&&ft&&(j(mt),gt(void 0))},[mt,j,ft]);const{setCurrentHistoryUid:Mt,setMessages:jt,setHistoryList:Yt}=useChatHistory(),Kt=reactExports.useCallback(Gt=>{switch(Gt){case"start-mic":console.log("Starting microphone..."),kt();break;case"stop-mic":console.log("Stopping microphone..."),It();break;case"conversation-chain-start":it("thinking-speaking"),audioTaskQueue.clearQueue(),ot();break;case"conversation-chain-end":audioTaskQueue.addTask(()=>new Promise(Qt=>{it(tr=>tr==="thinking-speaking"?(St.current&&kt(),"idle"):tr),Qt()}));break;default:console.warn("Unknown control command:",Gt)}},[it,ot,at,kt,It]),sr=reactExports.useCallback(Gt=>{var Qt,tr;switch(console.log("Received message from server:",Gt),Gt.type){case"control":Gt.text&&Kt(Gt.text);break;case"set-model-and-conf":if(it("loading"),Gt.conf_name&&ht(Gt.conf_name),Gt.conf_uid&&(bt(Gt.conf_uid),console.log("confUid",Gt.conf_uid)),Gt.client_uid&&vt(Gt.client_uid),gt(Gt.model_info),Gt.model_info&&!Gt.model_info.url.startsWith("http")){const Vt=_e+Gt.model_info.url;Gt.model_info.url=Vt}it("idle");break;case"full-text":Gt.text&&rt(Gt.text);break;case"config-files":Gt.configs&&yt(Gt.configs);break;case"config-switched":it("idle"),rt(o("notification.characterLoaded")),toaster.create({title:o("notification.characterSwitched"),type:"success",duration:2e3}),wsService.sendMessage({type:"fetch-history-list"}),wsService.sendMessage({type:"create-new-history"});break;case"background-files":Gt.files&&(dt==null||dt.setBackgroundFiles(Gt.files));break;case"audio":st==="interrupted"||st==="listening"?console.log("Audio playback intercepted. Sentence:",(Qt=Gt.display_text)==null?void 0:Qt.text):(console.log("actions",Gt.actions),ct({audioBase64:Gt.audio||"",volumes:Gt.volumes||[],sliceLength:Gt.slice_length||0,displayText:Gt.display_text||null,expressions:((tr=Gt.actions)==null?void 0:tr.expressions)||null,forwarded:Gt.forwarded||!1}));break;case"history-data":Gt.messages&&jt(Gt.messages),toaster.create({title:o("notification.historyLoaded"),type:"success",duration:2e3});break;case"new-history-created":if(it("idle"),rt(o("notification.newConversation")),Gt.history_uid){Mt(Gt.history_uid),jt([]);const Vt={uid:Gt.history_uid,latest_message:null,timestamp:new Date().toISOString()};Yt(Xt=>[Vt,...Xt]),toaster.create({title:o("notification.newChatHistory"),type:"success",duration:2e3})}break;case"history-deleted":toaster.create({title:Gt.success?o("notification.historyDeleteSuccess"):o("notification.historyDeleteFail"),type:Gt.success?"success":"error",duration:2e3});break;case"history-list":Gt.histories&&(Yt(Gt.histories),Gt.histories.length>0&&Mt(Gt.histories[0].uid));break;case"user-input-transcription":console.log("user-input-transcription: ",Gt.text),Gt.text&<(Gt.text);break;case"error":toaster.create({title:Gt.message,type:"error",duration:2e3});break;case"group-update":console.log("Received group-update:",Gt.members),Gt.members&&wt(Gt.members),Gt.is_owner!==void 0&&Ct(Gt.is_owner);break;case"group-operation-result":toaster.create({title:Gt.message,type:Gt.success?"success":"error",duration:2e3});break;case"backend-synth-complete":et(!0);break;case"conversation-chain-end":audioTaskQueue.hasTask()||it(Vt=>Vt==="thinking-speaking"?"idle":Vt);break;case"force-new-message":at(!0);break;case"interrupt-signal":Rt(!1);break;case"tool_call_status":Gt.tool_id&&Gt.tool_name&&Gt.status?(Gt.browser_view&&(console.log("Browser view data received:",Gt.browser_view),At(Gt.browser_view)),ut({id:Gt.tool_id,type:"tool_call_status",role:"ai",tool_id:Gt.tool_id,tool_name:Gt.tool_name,name:Gt.name,status:Gt.status,content:Gt.content||"",timestamp:Gt.timestamp||new Date().toISOString()})):console.warn("Received incomplete tool_call_status message:",Gt);break;default:console.warn("Unknown message type:",Gt.type)}},[st,ct,lt,_e,dt,it,ht,bt,yt,Mt,Yt,jt,j,rt,kt,It,vt,wt,Ct,nt,et,ot,Kt,ut,Rt,At,o]);reactExports.useEffect(()=>{wsService.connect(_)},[_]),reactExports.useEffect(()=>{const Gt=wsService.onStateChange(a),Qt=wsService.onMessage(sr);return()=>{Gt.unsubscribe(),Qt.unsubscribe()}},[_,sr]);const ar=reactExports.useMemo(()=>({sendMessage:wsService.sendMessage.bind(wsService),wsState:s,reconnect:()=>wsService.connect(_),wsUrl:_,setWsUrl:$,baseUrl:_e,setBaseUrl:tt}),[s,_,_e]);return jsxRuntimeExports.jsx(WebSocketContext.Provider,{value:ar,children:i})}function TitleBar(){var st;const[i,o]=reactExports.useState(!1),[s,a]=reactExports.useState(!1),_=((st=window.electron)==null?void 0:st.process.platform)==="darwin";reactExports.useEffect(()=>{var et,j;const it=(rt,ot)=>{o(ot)},nt=(rt,ot)=>{a(ot)};return(et=window.electron)==null||et.ipcRenderer.on("window-maximized-change",it),(j=window.electron)==null||j.ipcRenderer.on("window-fullscreen-change",nt),()=>{var rt,ot;(rt=window.electron)==null||rt.ipcRenderer.removeAllListeners("window-maximized-change"),(ot=window.electron)==null||ot.ipcRenderer.removeAllListeners("window-fullscreen-change")}},[]);const $=()=>{var it,nt;s?(it=window.electron)==null||it.ipcRenderer.send("window-unfullscreen"):(nt=window.electron)==null||nt.ipcRenderer.send("window-maximize")},_e=()=>s?"Exit Full Screen":i?"Restore":"Maximize",tt=()=>s?jsxRuntimeExports.jsx(FiChevronsDown,{}):i?jsxRuntimeExports.jsx(FiMinimize2,{}):jsxRuntimeExports.jsx(FiMaximize2,{});return _?jsxRuntimeExports.jsx(Box,{...layoutStyles.macTitleBar,children:jsxRuntimeExports.jsx(Box,{...layoutStyles.titleBarTitle,children:"Open LLM VTuber"})}):jsxRuntimeExports.jsxs(Box,{...layoutStyles.windowsTitleBar,children:[jsxRuntimeExports.jsx(Box,{...layoutStyles.titleBarTitle,children:"Open LLM VTuber"}),jsxRuntimeExports.jsxs(Box,{...layoutStyles.titleBarButtons,children:[jsxRuntimeExports.jsx(IconButton,{...layoutStyles.titleBarButton,onClick:()=>{var it;return(it=window.electron)==null?void 0:it.ipcRenderer.send("window-minimize")},"aria-label":"Minimize",children:jsxRuntimeExports.jsx(FiMinus,{})}),jsxRuntimeExports.jsx(IconButton,{...layoutStyles.titleBarButton,onClick:$,"aria-label":_e(),children:tt()}),jsxRuntimeExports.jsx(IconButton,{...layoutStyles.closeButton,onClick:()=>{var it;return(it=window.electron)==null?void 0:it.ipcRenderer.send("window-close")},"aria-label":"Close",children:jsxRuntimeExports.jsx(FiX,{})})]})]})}function useInputSubtitle(){const{inputText:i,setInputText:o,handleKeyPress:s,handleCompositionStart:a,handleCompositionEnd:_,handleSend:$}=useTextInput(),{messages:_e}=useChatHistory(),{startMic:tt,autoStartMicOn:st}=useVAD(),{handleMicToggle:it,micOn:nt}=useMicToggle(),{aiState:et,setAiState:j}=useAiState(),{interrupt:rt}=useInterrupt(),ot=_e.filter(dt=>dt.role==="ai").slice(-1).map(dt=>dt.content)[0],at=_e.some(dt=>dt.role==="ai");return{inputValue:i,handleInputChange:dt=>{o({target:{value:dt.target.value}}),j(AiStateEnum.WAITING)},handleKeyPress:dt=>{s(dt)},handleCompositionStart:a,handleCompositionEnd:_,handleInterrupt:()=>{rt(),st&&tt()},handleMicToggle:it,lastAIMessage:ot,hasAIMessages:at,aiState:et,micOn:nt,handleSend:$}}function useDraggable({componentId:i}){const{mode:o}=useMode(),s=o==="pet",[a,_]=reactExports.useState(!1),$=reactExports.useRef({x:0,y:0}),_e=reactExports.useRef({x:0,y:0}),tt=reactExports.useRef(null);return{elementRef:tt,isDragging:a,handleMouseDown:et=>{_(!0),_e.current={x:et.clientX-$.current.x,y:et.clientY-$.current.y};const j=ot=>{if(!tt.current)return;const at={x:ot.clientX-_e.current.x,y:ot.clientY-_e.current.y};$.current=at,tt.current.style.transform=`translateX(-50%) translate(${$.current.x}px, ${$.current.y}px)`},rt=()=>{_(!1),document.removeEventListener("mousemove",j,!0),document.removeEventListener("mouseup",rt,!0)};document.addEventListener("mousemove",j,!0),document.addEventListener("mouseup",rt,!0)},handleMouseEnter:()=>{var et;s&&((et=window.api)==null||et.updateComponentHover(i,!0))},handleMouseLeave:()=>{var et;s&&!a&&((et=window.api)==null||et.updateComponentHover(i,!1))}}}const inputSubtitleStyles={container:{display:"flex",alignItems:"flex-end",justifyContent:"center",maxW:"fit-content",position:"absolute",bottom:"120px",left:"50%",transform:"translateX(-50%)",zIndex:1e3,userSelect:"none",willChange:"transform",padding:0},box:{w:"400px",rounded:"xl",overflow:"hidden",boxShadow:"lg",bg:"blackAlpha.700",backdropFilter:"blur(8px)",css:{WebkitUserSelect:"none"}},messageStack:{p:"3",gap:1,alignItems:"stretch",justify:"flex-end"},messageText:{color:"white",fontSize:"sm",lineHeight:"1.5",transition:"all 0.3s"},statusBox:{bg:"blackAlpha.600",p:"3",borderTop:"1px",borderColor:"whiteAlpha.200"},statusText:{fontSize:"xs",color:"whiteAlpha.800",transition:"all 0.3s"},iconButton:{size:"xs",variant:"ghost",color:"whiteAlpha.800",_hover:{bg:"whiteAlpha.200"}},inputBox:{bg:"blackAlpha.600",borderTop:"1px",borderColor:"whiteAlpha.200"},input:{size:"sm",bg:"blackAlpha.500",color:"white",_placeholder:{color:"whiteAlpha.500"},borderColor:"whiteAlpha.300",_focus:{borderColor:"whiteAlpha.500",outline:"none"},flex:"1"},sendButton:{p:"1.5",bg:"blackAlpha.500",rounded:"lg",_hover:{bg:"blackAlpha.600"},transition:"colors",color:"whiteAlpha.800",size:"sm"},draggableContainer:i=>({cursor:i?"grabbing":"grab",transition:i?"none":"transform 0.1s ease",_active:{cursor:"grabbing"}}),closeButton:{position:"absolute",top:0,right:0,size:"2xs",minW:"6",height:"6",padding:0,variant:"ghost",color:"whiteAlpha.400",bg:"transparent",_hover:{bg:"blackAlpha.300",color:"whiteAlpha.800"},zIndex:10}};function InputSubtitle(){const{inputValue:i,handleInputChange:o,handleKeyPress:s,handleCompositionStart:a,handleCompositionEnd:_,handleInterrupt:$,handleMicToggle:_e,handleSend:tt,lastAIMessage:st,hasAIMessages:it,aiState:nt,micOn:et}=useInputSubtitle(),{mode:j}=useMode(),rt=j==="pet",{elementRef:ot,isDragging:at,handleMouseDown:lt,handleMouseEnter:ut,handleMouseLeave:ct}=useDraggable({componentId:"input-subtitle"}),[dt,ft]=reactExports.useState(!0),ht=reactExports.useCallback(()=>{var yt;rt&&((yt=window.api)==null||yt.updateComponentHover("input-subtitle",!1)),ft(!1)},[rt]),bt=()=>{ft(!0)};return reactExports.useEffect(()=>{var yt;if(rt){const mt=(yt=window.api)==null?void 0:yt.onToggleInputSubtitle(()=>{dt?ht():bt()});return()=>mt==null?void 0:mt()}return()=>{}},[ht,rt,dt]),reactExports.useEffect(()=>(window.inputSubtitle={open:bt,close:ht},()=>{delete window.inputSubtitle}),[rt,ht]),dt?jsxRuntimeExports.jsx(Box,{ref:ot,...inputSubtitleStyles.container,...inputSubtitleStyles.draggableContainer(at),onMouseDown:lt,onMouseEnter:ut,onMouseLeave:ct,children:jsxRuntimeExports.jsxs(Box,{...inputSubtitleStyles.box,children:[jsxRuntimeExports.jsx(IconButton,{"aria-label":"Close subtitle",onClick:ht,...inputSubtitleStyles.closeButton,children:jsxRuntimeExports.jsx(LuX,{size:12})}),it&&jsxRuntimeExports.jsx(VStack,{minH:st?"32px":"0px",...inputSubtitleStyles.messageStack,children:st&&jsxRuntimeExports.jsx(Text,{...inputSubtitleStyles.messageText,children:st})}),jsxRuntimeExports.jsx(Box,{...inputSubtitleStyles.statusBox,children:jsxRuntimeExports.jsxs(Flex,{align:"center",justify:"space-between",color:"whiteAlpha.700",children:[jsxRuntimeExports.jsxs(Flex,{align:"center",gap:"2",children:[jsxRuntimeExports.jsx(LuBell,{size:16}),jsxRuntimeExports.jsx(Text,{...inputSubtitleStyles.statusText,children:nt})]}),jsxRuntimeExports.jsxs(Flex,{gap:"2",children:[jsxRuntimeExports.jsx(IconButton,{"aria-label":"Toggle microphone",onClick:_e,...inputSubtitleStyles.iconButton,children:et?jsxRuntimeExports.jsx(LuMic,{size:16}):jsxRuntimeExports.jsx(LuMicOff,{size:16})}),jsxRuntimeExports.jsx(IconButton,{"aria-label":"Interrupt",onClick:$,...inputSubtitleStyles.iconButton,children:jsxRuntimeExports.jsx(LuHand,{size:16})})]})]})}),jsxRuntimeExports.jsx(Box,{...inputSubtitleStyles.inputBox,children:jsxRuntimeExports.jsxs(Stack,{direction:"row",gap:"2",p:"2",children:[jsxRuntimeExports.jsx(Input$1,{value:i,onChange:o,onKeyDown:s,onCompositionStart:a,onCompositionEnd:_,placeholder:"Type your message...",...inputSubtitleStyles.input}),jsxRuntimeExports.jsx(Button$2,{onClick:tt,...inputSubtitleStyles.sendButton,children:jsxRuntimeExports.jsx(LuSend,{size:16})})]})})]})}):null}const canvasStyles={background:{container:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:"auto"},image:{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",objectFit:"cover",zIndex:1},video:{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",objectFit:"cover",zIndex:1,transform:"scaleX(-1)"}},subtitle:{container:{backgroundColor:"rgba(0, 0, 0, 0.7)",padding:"15px 30px",borderRadius:"12px",minWidth:"60%",maxWidth:"95%"},text:{color:"white",fontSize:"1.5rem",textAlign:"center",lineHeight:"1.4",whiteSpace:"pre-wrap"}},wsStatus:{container:{position:"relative",zIndex:2,padding:"8px 16px",borderRadius:"20px",fontSize:"14px",fontWeight:"medium",color:"white",transition:"all 0.2s",cursor:"pointer",userSelect:"none",_hover:{opacity:.8}}}},Background=reactExports.memo(({children:i})=>{const o=reactExports.useRef(null),{backgroundStream:s,isBackgroundStreaming:a,startBackgroundCamera:_,stopBackgroundCamera:$}=useCamera(),{useCameraBackground:_e,backgroundUrl:tt}=useBgUrl();return reactExports.useEffect(()=>{_e?_():$()},[_e,_,$]),reactExports.useEffect(()=>{o.current&&s&&(o.current.srcObject=s)},[s]),jsxRuntimeExports.jsxs(Box,{...canvasStyles.background.container,children:[_e?jsxRuntimeExports.jsx("video",{ref:o,autoPlay:!0,playsInline:!0,muted:!0,style:{...canvasStyles.background.video,display:a?"block":"none",transform:"scaleX(-1)"}}):jsxRuntimeExports.jsx(Image$1,{...canvasStyles.background.image,src:tt,alt:"background"}),i]})});Background.displayName="Background";const useWSStatus=()=>{const{wsState:i,reconnect:o}=useWebSocket(),s=reactExports.useCallback(()=>{i!=="OPEN"&&i!=="CONNECTING"&&o()},[i,o]);return reactExports.useMemo(()=>{switch(i){case"OPEN":return{color:"green.500",textKey:"wsStatus.connected",isDisconnected:!1,handleClick:s};case"CONNECTING":return{color:"yellow.500",textKey:"wsStatus.connecting",isDisconnected:!1,handleClick:s};default:return{color:"red.500",textKey:"wsStatus.clickToReconnect",isDisconnected:!0,handleClick:s}}},[i,s])},StatusContent=({textKey:i})=>{const{t:o}=useTranslation();return o(i)},MemoizedStatusContent=reactExports.memo(StatusContent),WebSocketStatus=reactExports.memo(()=>{const{color:i,textKey:o,handleClick:s,isDisconnected:a}=useWSStatus();return jsxRuntimeExports.jsx(Box,{...canvasStyles.wsStatus.container,backgroundColor:i,onClick:s,cursor:a?"pointer":"default",_hover:{opacity:a?.8:1},children:jsxRuntimeExports.jsx(MemoizedStatusContent,{textKey:o})})});WebSocketStatus.displayName="WebSocketStatus";const useSubtitleDisplay=()=>{const i=useSubtitle();return{subtitleText:reactExports.useMemo(()=>i?i.subtitleText:null,[i==null?void 0:i.subtitleText]),isLoaded:!!i}},SubtitleText=reactExports.memo(({text:i})=>jsxRuntimeExports.jsx(Text,{...canvasStyles.subtitle.text,children:i}));SubtitleText.displayName="SubtitleText";const Subtitle=reactExports.memo(()=>{const{subtitleText:i,isLoaded:o}=useSubtitleDisplay(),{showSubtitle:s}=useSubtitle();return!o||!i||!s?null:jsxRuntimeExports.jsx(Box,{...canvasStyles.subtitle.container,children:jsxRuntimeExports.jsx(SubtitleText,{text:i})})});Subtitle.displayName="Subtitle";function AppContent(){const[i,o]=reactExports.useState(!0),[s,a]=reactExports.useState(!1),{mode:_}=useMode(),$=window.api!==void 0,_e=reactExports.useRef(null);reactExports.useEffect(()=>{const nt=()=>{const et=window.innerHeight*.01;document.documentElement.style.setProperty("--vh",`${et}px`)};return nt(),window.addEventListener("resize",nt),()=>window.removeEventListener("resize",nt)},[]),document.documentElement.style.overflow="hidden",document.body.style.overflow="hidden",document.documentElement.style.height="100%",document.body.style.height="100%",document.documentElement.style.position="fixed",document.body.style.position="fixed",document.documentElement.style.width="100%",document.body.style.width="100%";const tt={position:"absolute",overflow:"hidden",transition:"all 0.3s ease-in-out",pointerEvents:"auto"},st=nt=>({...tt,top:$?"30px":"0px",height:`calc(100% - ${$?"30px":"0px"})`,zIndex:5,left:{base:"0px",md:nt?"440px":"24px"},width:{base:"100%",md:`calc(100% - ${nt?"440px":"24px"})`}}),it={...tt,top:0,left:0,width:"100vw",height:"100vh",zIndex:15};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Box,{ref:_e,..._==="window"?st(i):it,children:jsxRuntimeExports.jsx(Live2D,{})}),_==="window"&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[$&&jsxRuntimeExports.jsx(TitleBar,{}),jsxRuntimeExports.jsxs(Flex,{...layoutStyles.appContainer,children:[jsxRuntimeExports.jsx(Box,{...layoutStyles.sidebar,...!i&&{width:"24px"},children:jsxRuntimeExports.jsx(Sidebar,{isCollapsed:!i,onToggle:()=>o(!i)})}),jsxRuntimeExports.jsxs(Box,{...layoutStyles.mainContent,children:[jsxRuntimeExports.jsx(Background,{}),jsxRuntimeExports.jsx(Box,{position:"absolute",top:"20px",left:"20px",zIndex:10,children:jsxRuntimeExports.jsx(WebSocketStatus,{})}),jsxRuntimeExports.jsx(Box,{position:"absolute",bottom:s?"39px":"135px",left:"50%",transform:"translateX(-50%)",zIndex:10,width:"60%",children:jsxRuntimeExports.jsx(Subtitle,{})}),jsxRuntimeExports.jsx(Box,{...layoutStyles.footer,zIndex:10,...s&&layoutStyles.collapsedFooter,children:jsxRuntimeExports.jsx(Footer,{isCollapsed:s,onToggle:()=>a(!s)})})]})]})]}),_==="pet"&&jsxRuntimeExports.jsx(InputSubtitle,{})]})}function App(){return jsxRuntimeExports.jsx(ChakraProvider,{value:defaultSystem,children:jsxRuntimeExports.jsx(ModeProvider,{children:jsxRuntimeExports.jsx(AppWithGlobalStyles,{})})})}function AppWithGlobalStyles(){return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(CameraProvider,{children:jsxRuntimeExports.jsx(ScreenCaptureProvider,{children:jsxRuntimeExports.jsx(CharacterConfigProvider,{children:jsxRuntimeExports.jsx(ChatHistoryProvider,{children:jsxRuntimeExports.jsx(AiStateProvider,{children:jsxRuntimeExports.jsx(ProactiveSpeakProvider,{children:jsxRuntimeExports.jsx(Live2DConfigProvider,{children:jsxRuntimeExports.jsx(SubtitleProvider,{children:jsxRuntimeExports.jsx(VADProvider,{children:jsxRuntimeExports.jsx(BgUrlProvider,{children:jsxRuntimeExports.jsx(GroupProvider,{children:jsxRuntimeExports.jsx(BrowserProvider,{children:jsxRuntimeExports.jsxs(WebSocketHandler,{children:[jsxRuntimeExports.jsx(Toaster,{}),jsxRuntimeExports.jsx(AppContent,{})]})})})})})})})})})})})})})})}let s_adapter_instance=null;class LAppAdapter{static getInstance(){return s_adapter_instance==null&&(s_adapter_instance=new LAppAdapter),s_adapter_instance}getMgr(){return LAppLive2DManager.getInstance()}getModel(){return this.getMgr().getModel(0)}getIdManager(){return CubismFramework.getIdManager()}getMotionGroups(){var s,a;let o=[];for(let _=0;_<((s=this.getModel())==null?void 0:s._modelSetting.getMotionGroupCount());_++)o.push(((a=this.getModel())==null?void 0:a._modelSetting.getMotionGroupName(_))??"");return o}getMotionCount(o){var s;return((s=this.getModel())==null?void 0:s._modelSetting.getMotionCount(o))??0}startMotion(o,s,a,_){var $;return(($=this.getModel())==null?void 0:$.startMotion(o,s,a,_))??InvalidMotionQueueEntryHandleValue}getExpressionCount(){var o;return((o=this.getModel())==null?void 0:o._expressions.getSize())??0}getExpressionName(o){var s,a;return((a=(s=this.getModel())==null?void 0:s._modelSetting)==null?void 0:a.getExpressionName(o))??""}setExpression(o){var s;(s=this.getModel())==null||s.setExpression(o)}nextChara(){this.getMgr().nextScene()}setChara(o,s){var $;const a=(o.endsWith("/")?o:o+"/")+s+"/",_=s+".model3.json";this.getMgr().releaseAllModel(),this.getMgr()._models.pushBack(new LAppModel),($=this.getMgr()._models.at(0))==null||$.loadAssets(a,_)}getModelPosition(){const o=this.getModel();if(o&&o._modelMatrix){const s=o._modelMatrix.getArray();return{x:s[12],y:s[13]}}return{x:0,y:0}}setModelPosition(o,s){const a=this.getModel();if(a&&a._modelMatrix){const $=[...a._modelMatrix.getArray()];$[12]=o,$[13]=s,a._modelMatrix.setMatrix($)}}}const{slice,forEach}=[];function defaults(i){return forEach.call(slice.call(arguments,1),o=>{if(o)for(const s in o)i[s]===void 0&&(i[s]=o[s])}),i}function hasXSS(i){return typeof i!="string"?!1:[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(s=>s.test(i))}const fieldContentRegExp=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,serializeCookie=function(i,o){const a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},_=encodeURIComponent(o);let $=`${i}=${_}`;if(a.maxAge>0){const _e=a.maxAge-0;if(Number.isNaN(_e))throw new Error("maxAge should be a Number");$+=`; Max-Age=${Math.floor(_e)}`}if(a.domain){if(!fieldContentRegExp.test(a.domain))throw new TypeError("option domain is invalid");$+=`; Domain=${a.domain}`}if(a.path){if(!fieldContentRegExp.test(a.path))throw new TypeError("option path is invalid");$+=`; Path=${a.path}`}if(a.expires){if(typeof a.expires.toUTCString!="function")throw new TypeError("option expires is invalid");$+=`; Expires=${a.expires.toUTCString()}`}if(a.httpOnly&&($+="; HttpOnly"),a.secure&&($+="; Secure"),a.sameSite)switch(typeof a.sameSite=="string"?a.sameSite.toLowerCase():a.sameSite){case!0:$+="; SameSite=Strict";break;case"lax":$+="; SameSite=Lax";break;case"strict":$+="; SameSite=Strict";break;case"none":$+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return $},cookie={create(i,o,s,a){let _=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};s&&(_.expires=new Date,_.expires.setTime(_.expires.getTime()+s*60*1e3)),a&&(_.domain=a),document.cookie=serializeCookie(i,encodeURIComponent(o),_)},read(i){const o=`${i}=`,s=document.cookie.split(";");for(let a=0;a-1&&(_=window.location.hash.substring(window.location.hash.indexOf("?")));const _e=_.substring(1).split("&");for(let tt=0;tt<_e.length;tt++){const st=_e[tt].indexOf("=");st>0&&_e[tt].substring(0,st)===o&&(s=_e[tt].substring(st+1))}}return s}};let hasLocalStorageSupport=null;const localStorageAvailable=()=>{if(hasLocalStorageSupport!==null)return hasLocalStorageSupport;try{if(hasLocalStorageSupport=typeof window<"u"&&window.localStorage!==null,!hasLocalStorageSupport)return!1;const i="i18next.translate.boo";window.localStorage.setItem(i,"foo"),window.localStorage.removeItem(i)}catch{hasLocalStorageSupport=!1}return hasLocalStorageSupport};var localStorage$1={name:"localStorage",lookup(i){let{lookupLocalStorage:o}=i;if(o&&localStorageAvailable())return window.localStorage.getItem(o)||void 0},cacheUserLanguage(i,o){let{lookupLocalStorage:s}=o;s&&localStorageAvailable()&&window.localStorage.setItem(s,i)}};let hasSessionStorageSupport=null;const sessionStorageAvailable=()=>{if(hasSessionStorageSupport!==null)return hasSessionStorageSupport;try{if(hasSessionStorageSupport=typeof window<"u"&&window.sessionStorage!==null,!hasSessionStorageSupport)return!1;const i="i18next.translate.boo";window.sessionStorage.setItem(i,"foo"),window.sessionStorage.removeItem(i)}catch{hasSessionStorageSupport=!1}return hasSessionStorageSupport};var sessionStorage={name:"sessionStorage",lookup(i){let{lookupSessionStorage:o}=i;if(o&&sessionStorageAvailable())return window.sessionStorage.getItem(o)||void 0},cacheUserLanguage(i,o){let{lookupSessionStorage:s}=o;s&&sessionStorageAvailable()&&window.sessionStorage.setItem(s,i)}},navigator$1={name:"navigator",lookup(i){const o=[];if(typeof navigator<"u"){const{languages:s,userLanguage:a,language:_}=navigator;if(s)for(let $=0;$0?o:void 0}},htmlTag={name:"htmlTag",lookup(i){let{htmlTag:o}=i,s;const a=o||(typeof document<"u"?document.documentElement:null);return a&&typeof a.getAttribute=="function"&&(s=a.getAttribute("lang")),s}},path={name:"path",lookup(i){var _;let{lookupFromPathIndex:o}=i;if(typeof window>"u")return;const s=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(s)?(_=s[typeof o=="number"?o:0])==null?void 0:_.replace("/",""):void 0}},subdomain={name:"subdomain",lookup(i){var _,$;let{lookupFromSubdomainIndex:o}=i;const s=typeof o=="number"?o+1:1,a=typeof window<"u"&&(($=(_=window.location)==null?void 0:_.hostname)==null?void 0:$.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i));if(a)return a[s]}};let canCookies=!1;try{document.cookie,canCookies=!0}catch(i){}const order=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];canCookies||order.splice(1,1);const getDefaults=()=>({order,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:i=>i});class Browser{constructor(o){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(o,s)}init(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=o,this.options=defaults(s,this.options||{},getDefaults()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=_=>_.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=a,this.addDetector(cookie$1),this.addDetector(querystring),this.addDetector(localStorage$1),this.addDetector(sessionStorage),this.addDetector(navigator$1),this.addDetector(htmlTag),this.addDetector(path),this.addDetector(subdomain)}addDetector(o){return this.detectors[o.name]=o,this}detect(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,s=[];return o.forEach(a=>{if(this.detectors[a]){let _=this.detectors[a].lookup(this.options);_&&typeof _=="string"&&(_=[_]),_&&(s=s.concat(_))}}),s=s.filter(a=>a!=null&&!hasXSS(a)).map(a=>this.options.convertDetectedLanguage(a)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?s:s.length>0?s[0]:null}cacheUserLanguage(o){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;s&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(o)>-1||s.forEach(a=>{this.detectors[a]&&this.detectors[a].cacheUserLanguage(o,this.options)}))}}Browser.type="languageDetector";const common$1={save:"Save",cancel:"Cancel",settings:"Settings",close:"Close",accept:"Accept"},settings$1={tabs:{general:"General",live2d:"Live2D",asr:"ASR",tts:"TTS",agent:"Agent",about:"About"},general:{language:"Language",useCameraBackground:"Use Camera Background",showSubtitle:"Show Subtitle",backgroundImage:"Background Image",customBgUrlPlaceholder:"Enter image URL",customBgUrl:"Or enter a custom background URL",characterPreset:"Character Preset",wsUrl:"WebSocket URL",baseUrl:"Base URL",imageCompressionQuality:"Image Compression Quality",imageCompressionQualityPlaceholder:"Enter compression quality (0-100)",imageMaxWidth:"Image Max Width",imageMaxWidthPlaceholder:"Enter maximum width in pixels"},live2d:{pointerInteractive:"Pointer Interactive",scrollToResize:"Enable Scroll to Resize"},asr:{autoStopMic:"Auto Stop Mic When AI Start Speaking",autoStopMicDesc:"Automatically stops microphone when AI begins speaking to prevent audio feedback",autoStartMicOnConvEnd:"Auto Start Mic When Conversation End",autoStartMicOnConvEndDesc:"Automatically restarts microphone when AI finishes speaking for seamless conversation",autoStartMicOn:"Auto Start Mic When AI Interrupted",autoStartMicOnDesc:"Automatically restarts microphone when you interrupt AI for continuous interaction",positiveSpeechThreshold:"Speech Prob Threshold",positiveSpeechThresholdDesc:"Minimum confidence level (1-100) required to detect speech. Higher values reduce false positives",negativeSpeechThreshold:"Negative Speech Threshold",negativeSpeechThresholdDesc:"Confidence level (0-100) below which speech detection stops. Lower values make detection less sensitive",redemptionFrames:"Redemption Frames",redemptionFramesDesc:"Number of consecutive frames (1-100) needed to confirm speech detection. Higher values reduce noise triggers"},agent:{allowProactiveSpeak:"Allow AI to Speak Proactively",idleSecondsToSpeak:"Idle seconds allow AI to speak",allowButtonTrigger:"Prompt AI to Speak via Raise Hand Button"},about:{title:"Open LLM VTuber Frontend",version:"Version",projectLinks:"Project Links",github:"GitHub",documentation:"Documentation",license:"License",copyright:"Copyright",viewLicense:"View License"}},footer$1={typeYourMessage:"Type your message...",cameraControl:"Click to start camera",cameraStopping:"Click to stop camera",screenControl:"Click to start screen capture",screenStopping:"Click to stop screen capture"},sidebar$1={camera:"Camera",screen:"Screen",browser:"Browser",live:"Live",noMessages:"No messages yet. Start a conversation!",noBrowserSession:"No active browser session",browserSession:"Browser Session"},group$1={management:"Group Management",yourUuid:"Your UUID",inviteMember:"Invite Member",enterMemberUuid:"Enter member UUID",invite:"Invite",members:"Members",you:"You",leaveGroup:"Leave Group",removeMember:"Remove Member",leave:"Leave"},history$1={chatHistoryList:"Chat History List",noMessages:"No messages"},notification$1={characterLoaded:"New Character Loaded",characterSwitched:"Character switched",historyLoaded:"History loaded",newConversation:"New Conversation Started",newChatHistory:"New chat history created",historyDeleteSuccess:"History deleted successfully",historyDeleteFail:"Failed to delete history"},error$1={cameraApiNotSupported:"Camera API is not supported on this device",noCameraFound:"No camera found on this device",failedStartCamera:"Failed to start camera",failedStartBackgroundCamera:"Failed to start background camera",failedStartScreenCapture:"Failed to start screen capture",failedStartVAD:"Failed to start VAD",llmCantHear:"The LLM can't hear you.",audioPlayback:"Audio playback error",enterValidUuid:"Please enter a valid UUID",cannotDeleteCurrentHistory:"Cannot delete current chat history",failedCapture:"Failed to capture {{source}} frame",failedParseWebSocket:"Failed to parse WebSocket message",websocketNotOpen:"WebSocket is not open.",vadMisfire:"Voice detected but too brief. Try speaking louder/longer, or adjust settings (lower speech threshold, lower negative threshold, reduce redemption frames)."},aiState$1={idle:"idle","thinking-speaking":"thinking/speaking",interrupted:"interrupted",loading:"loading",listening:"listening",waiting:"waiting"},wsStatus$1={connected:"Connected",connecting:"Connecting",clickToReconnect:"Click to Reconnect"},enTranslation={common:common$1,settings:settings$1,footer:footer$1,sidebar:sidebar$1,group:group$1,history:history$1,notification:notification$1,error:error$1,aiState:aiState$1,wsStatus:wsStatus$1},common={save:"保存",cancel:"取消",settings:"设置",close:"关闭",accept:"接受"},settings={tabs:{general:"常规",live2d:"Live2D",asr:"识别",tts:"合成",agent:"代理",about:"关于"},general:{language:"语言",useCameraBackground:"使用摄像头背景",showSubtitle:"显示字幕",backgroundImage:"背景图片",customBgUrlPlaceholder:"输入图片URL",customBgUrl:"或输入自定义背景URL",characterPreset:"角色预设",wsUrl:"WebSocket地址",baseUrl:"基础URL",imageCompressionQuality:"图片压缩质量",imageMaxWidth:"图片最大宽度"},live2d:{pointerInteractive:"鼠标交互",scrollToResize:"启用滚轮缩放"},asr:{autoStopMic:"AI开始说话时自动关闭麦克风",autoStopMicDesc:"当AI开始说话时自动关闭麦克风,防止音频反馈",autoStartMicOnConvEnd:"对话结束时自动开启麦克风",autoStartMicOnConvEndDesc:"AI说话结束时自动重新开启麦克风,实现无缝对话",autoStartMicOn:"AI被打断时自动开启麦克风",autoStartMicOnDesc:"当您打断AI时自动重新开启麦克风,保持连续交互",positiveSpeechThreshold:"语音识别阈值",positiveSpeechThresholdDesc:"检测语音所需的最低置信度(1-100),数值越高越能减少误检测",negativeSpeechThreshold:"负面语音阈值",negativeSpeechThresholdDesc:"停止语音检测的置信度下限(0-100),数值越低检测越不敏感",redemptionFrames:"验证帧数",redemptionFramesDesc:"确认语音检测所需的连续帧数(1-100),数值越高越能减少噪音触发"},agent:{allowProactiveSpeak:"允许AI主动发言",idleSecondsToSpeak:"空闲多少秒后AI可发言",allowButtonTrigger:"通过举手按钮提示AI发言"},about:{title:"Open LLM VTuber 前端",version:"版本",projectLinks:"项目链接",github:"GitHub",documentation:"文档",copyright:"版权",viewLicense:"查看许可证"}},footer={typeYourMessage:"输入您的消息...",cameraControl:"点击启动摄像头",cameraStopping:"点击停止摄像头",screenControl:"点击开始屏幕共享",screenStopping:"点击停止屏幕共享"},sidebar={camera:"摄像头",screen:"屏幕",browser:"浏览器",live:"直播",noMessages:"暂无消息。开始对话吧!",noBrowserSession:"无活跃浏览器会话",browserSession:"浏览器会话"},group={management:"群组管理",yourUuid:"您的UUID",inviteMember:"邀请成员",enterMemberUuid:"输入成员UUID",invite:"邀请",members:"成员",you:"您",leaveGroup:"离开群组",removeMember:"移除成员",leave:"离开"},history={chatHistoryList:"聊天历史列表",noMessages:"暂无消息"},notification={characterLoaded:"新角色已加载",characterSwitched:"角色已切换",historyLoaded:"历史记录已加载",newConversation:"新对话已开始",newChatHistory:"新聊天历史已创建",historyDeleteSuccess:"历史记录删除成功",historyDeleteFail:"删除历史记录失败"},error={cameraApiNotSupported:"此设备不支持摄像头API",noCameraFound:"未找到摄像头设备",failedStartCamera:"启动摄像头失败",failedStartBackgroundCamera:"启动背景摄像头失败",failedStartScreenCapture:"启动屏幕捕获失败",failedStartVAD:"启动语音活动检测失败",llmCantHear:"AI无法听到您的声音",audioPlayback:"音频播放错误",enterValidUuid:"请输入有效的UUID",cannotDeleteCurrentHistory:"无法删除当前聊天记录",failedCapture:"捕获{{source}}帧失败",failedParseWebSocket:"解析WebSocket消息失败",websocketNotOpen:"WebSocket未连接",vadMisfire:"检测到语音但过于简短,请尝试提高音量或说得更久一些,或调整识别设置(降低语音识别阈值、降低负面语音阈值、减少验证帧数)"},aiState={idle:"空闲","thinking-speaking":"思考/说话中",interrupted:"已打断",loading:"加载中",listening:"聆听中",waiting:"等待中"},wsStatus={connected:"已连接",connecting:"连接中",clickToReconnect:"点击重新连接"},zhTranslation={common,settings,footer,sidebar,group,history,notification,error,aiState,wsStatus};instance.use(Browser).use(initReactI18next).init({fallbackLng:"en",debug:!1,defaultNS:"translation",ns:["translation"],resources:{en:{translation:enTranslation},zh:{translation:zhTranslation}},detection:{order:["localStorage","navigator"],caches:["localStorage"],htmlTag:document.documentElement},interpolation:{escapeValue:!1},react:{useSuspense:!0}});instance.on("languageChanged",i=>{localStorage.setItem("i18nextLng",i),document.documentElement.lang=i});const originalConsoleWarn=console.warn;console.warn=(...i)=>{typeof i[0]=="string"&&i[0].includes("onnxruntime")||originalConsoleWarn.apply(console,i)};const originalConsoleError=console.error,errorMessagesToIgnore=["Warning: Failed"];console.error=(...i)=>{typeof i[0]=="string"&&errorMessagesToIgnore.some(s=>i[0].startsWith(s))||originalConsoleError.apply(console,i)};typeof window<"u"&&(window.getLAppAdapter=()=>LAppAdapter.getInstance(),new Promise((o,s)=>{const a=document.createElement("script");a.src="./libs/live2dcubismcore.js",a.onload=()=>{console.log("Live2D Cubism Core loaded successfully."),o()},a.onerror=_=>{console.error("Failed to load Live2D Cubism Core:",_),s(_)},document.head.appendChild(a)}).then(()=>{createRoot(document.getElementById("root")).render(jsxRuntimeExports.jsx(App,{}))}).catch(o=>{console.error("Application failed to start due to script loading error:",o);const s=document.getElementById("root");s&&(s.innerHTML="Error loading required components. Please check the console for details.")}));