@neocash/bnpl-widget 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,173 @@
1
+ "use strict";var __NCL_internal=(()=>{var Xoe=Object.create;var yy=Object.defineProperty;var Yoe=Object.getOwnPropertyDescriptor;var Qoe=Object.getOwnPropertyNames;var Joe=Object.getPrototypeOf,Zoe=Object.prototype.hasOwnProperty;var ene=(e,t,r)=>t in e?yy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Hf=(e,t)=>()=>(e&&(t=e(e=0)),t);var Be=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ot=(e,t)=>{for(var r in t)yy(e,r,{get:t[r],enumerable:!0})},t4=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Qoe(t))!Zoe.call(e,n)&&n!==r&&yy(e,n,{get:()=>t[n],enumerable:!(o=Yoe(t,n))||o.enumerable});return e};var Ie=(e,t,r)=>(r=e!=null?Xoe(Joe(e)):{},t4(t||!e||!e.__esModule?yy(r,"default",{value:e,enumerable:!0}):r,e)),tne=e=>t4(yy({},"__esModule",{value:!0}),e);var F=(e,t,r)=>ene(e,typeof t!="symbol"?t+"":t,r);var f4=Be(_t=>{"use strict";var vy=Symbol.for("react.element"),rne=Symbol.for("react.portal"),one=Symbol.for("react.fragment"),nne=Symbol.for("react.strict_mode"),ane=Symbol.for("react.profiler"),ine=Symbol.for("react.provider"),sne=Symbol.for("react.context"),lne=Symbol.for("react.forward_ref"),cne=Symbol.for("react.suspense"),pne=Symbol.for("react.memo"),une=Symbol.for("react.lazy"),r4=Symbol.iterator;function mne(e){return e===null||typeof e!="object"?null:(e=r4&&e[r4]||e["@@iterator"],typeof e=="function"?e:null)}var a4={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},i4=Object.assign,s4={};function Vf(e,t,r){this.props=e,this.context=t,this.refs=s4,this.updater=r||a4}Vf.prototype.isReactComponent={};Vf.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=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,e,t,"setState")};Vf.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function l4(){}l4.prototype=Vf.prototype;function jE(e,t,r){this.props=e,this.context=t,this.refs=s4,this.updater=r||a4}var GE=jE.prototype=new l4;GE.constructor=jE;i4(GE,Vf.prototype);GE.isPureReactComponent=!0;var o4=Array.isArray,c4=Object.prototype.hasOwnProperty,qE={current:null},p4={key:!0,ref:!0,__self:!0,__source:!0};function u4(e,t,r){var o,n={},a=null,i=null;if(t!=null)for(o in t.ref!==void 0&&(i=t.ref),t.key!==void 0&&(a=""+t.key),t)c4.call(t,o)&&!p4.hasOwnProperty(o)&&(n[o]=t[o]);var s=arguments.length-2;if(s===1)n.children=r;else if(1<s){for(var c=Array(s),l=0;l<s;l++)c[l]=arguments[l+2];n.children=c}if(e&&e.defaultProps)for(o in s=e.defaultProps,s)n[o]===void 0&&(n[o]=s[o]);return{$$typeof:vy,type:e,key:a,ref:i,props:n,_owner:qE.current}}function fne(e,t){return{$$typeof:vy,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function KE(e){return typeof e=="object"&&e!==null&&e.$$typeof===vy}function dne(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(r){return t[r]})}var n4=/\/+/g;function VE(e,t){return typeof e=="object"&&e!==null&&e.key!=null?dne(""+e.key):t.toString(36)}function Nx(e,t,r,o,n){var a=typeof e;(a==="undefined"||a==="boolean")&&(e=null);var i=!1;if(e===null)i=!0;else switch(a){case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case vy:case rne:i=!0}}if(i)return i=e,n=n(i),e=o===""?"."+VE(i,0):o,o4(n)?(r="",e!=null&&(r=e.replace(n4,"$&/")+"/"),Nx(n,t,r,"",function(l){return l})):n!=null&&(KE(n)&&(n=fne(n,r+(!n.key||i&&i.key===n.key?"":(""+n.key).replace(n4,"$&/")+"/")+e)),t.push(n)),1;if(i=0,o=o===""?".":o+":",o4(e))for(var s=0;s<e.length;s++){a=e[s];var c=o+VE(a,s);i+=Nx(a,t,r,c,n)}else if(c=mne(e),typeof c=="function")for(e=c.call(e),s=0;!(a=e.next()).done;)a=a.value,c=o+VE(a,s++),i+=Nx(a,t,r,c,n);else if(a==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return i}function Cx(e,t,r){if(e==null)return e;var o=[],n=0;return Nx(e,o,"","",function(a){return t.call(r,a,n++)}),o}function hne(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(r){(e._status===0||e._status===-1)&&(e._status=1,e._result=r)},function(r){(e._status===0||e._status===-1)&&(e._status=2,e._result=r)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Yo={current:null},Ax={transition:null},gne={ReactCurrentDispatcher:Yo,ReactCurrentBatchConfig:Ax,ReactCurrentOwner:qE};function m4(){throw Error("act(...) is not supported in production builds of React.")}_t.Children={map:Cx,forEach:function(e,t,r){Cx(e,function(){t.apply(this,arguments)},r)},count:function(e){var t=0;return Cx(e,function(){t++}),t},toArray:function(e){return Cx(e,function(t){return t})||[]},only:function(e){if(!KE(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};_t.Component=Vf;_t.Fragment=one;_t.Profiler=ane;_t.PureComponent=jE;_t.StrictMode=nne;_t.Suspense=cne;_t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=gne;_t.act=m4;_t.cloneElement=function(e,t,r){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var o=i4({},e.props),n=e.key,a=e.ref,i=e._owner;if(t!=null){if(t.ref!==void 0&&(a=t.ref,i=qE.current),t.key!==void 0&&(n=""+t.key),e.type&&e.type.defaultProps)var s=e.type.defaultProps;for(c in t)c4.call(t,c)&&!p4.hasOwnProperty(c)&&(o[c]=t[c]===void 0&&s!==void 0?s[c]:t[c])}var c=arguments.length-2;if(c===1)o.children=r;else if(1<c){s=Array(c);for(var l=0;l<c;l++)s[l]=arguments[l+2];o.children=s}return{$$typeof:vy,type:e.type,key:n,ref:a,props:o,_owner:i}};_t.createContext=function(e){return e={$$typeof:sne,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:ine,_context:e},e.Consumer=e};_t.createElement=u4;_t.createFactory=function(e){var t=u4.bind(null,e);return t.type=e,t};_t.createRef=function(){return{current:null}};_t.forwardRef=function(e){return{$$typeof:lne,render:e}};_t.isValidElement=KE;_t.lazy=function(e){return{$$typeof:une,_payload:{_status:-1,_result:e},_init:hne}};_t.memo=function(e,t){return{$$typeof:pne,type:e,compare:t===void 0?null:t}};_t.startTransition=function(e){var t=Ax.transition;Ax.transition={};try{e()}finally{Ax.transition=t}};_t.unstable_act=m4;_t.useCallback=function(e,t){return Yo.current.useCallback(e,t)};_t.useContext=function(e){return Yo.current.useContext(e)};_t.useDebugValue=function(){};_t.useDeferredValue=function(e){return Yo.current.useDeferredValue(e)};_t.useEffect=function(e,t){return Yo.current.useEffect(e,t)};_t.useId=function(){return Yo.current.useId()};_t.useImperativeHandle=function(e,t,r){return Yo.current.useImperativeHandle(e,t,r)};_t.useInsertionEffect=function(e,t){return Yo.current.useInsertionEffect(e,t)};_t.useLayoutEffect=function(e,t){return Yo.current.useLayoutEffect(e,t)};_t.useMemo=function(e,t){return Yo.current.useMemo(e,t)};_t.useReducer=function(e,t,r){return Yo.current.useReducer(e,t,r)};_t.useRef=function(e){return Yo.current.useRef(e)};_t.useState=function(e){return Yo.current.useState(e)};_t.useSyncExternalStore=function(e,t,r){return Yo.current.useSyncExternalStore(e,t,r)};_t.useTransition=function(){return Yo.current.useTransition()};_t.version="18.3.1"});var Me=Be((UCe,d4)=>{"use strict";d4.exports=f4()});var _4=Be(ir=>{"use strict";function JE(e,t){var r=e.length;e.push(t);e:for(;0<r;){var o=r-1>>>1,n=e[o];if(0<Rx(n,t))e[o]=t,e[r]=n,r=o;else break e}}function Wa(e){return e.length===0?null:e[0]}function Fx(e){if(e.length===0)return null;var t=e[0],r=e.pop();if(r!==t){e[0]=r;e:for(var o=0,n=e.length,a=n>>>1;o<a;){var i=2*(o+1)-1,s=e[i],c=i+1,l=e[c];if(0>Rx(s,r))c<n&&0>Rx(l,s)?(e[o]=l,e[c]=r,o=c):(e[o]=s,e[i]=r,o=i);else if(c<n&&0>Rx(l,r))e[o]=l,e[c]=r,o=c;else break e}}return t}function Rx(e,t){var r=e.sortIndex-t.sortIndex;return r!==0?r:e.id-t.id}typeof performance=="object"&&typeof performance.now=="function"?(h4=performance,ir.unstable_now=function(){return h4.now()}):(XE=Date,g4=XE.now(),ir.unstable_now=function(){return XE.now()-g4});var h4,XE,g4,hi=[],el=[],yne=1,sa=null,Fo=3,Mx=!1,Lc=!1,xy=!1,b4=typeof setTimeout=="function"?setTimeout:null,x4=typeof clearTimeout=="function"?clearTimeout:null,y4=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function ZE(e){for(var t=Wa(el);t!==null;){if(t.callback===null)Fx(el);else if(t.startTime<=e)Fx(el),t.sortIndex=t.expirationTime,JE(hi,t);else break;t=Wa(el)}}function eI(e){if(xy=!1,ZE(e),!Lc)if(Wa(hi)!==null)Lc=!0,rI(tI);else{var t=Wa(el);t!==null&&oI(eI,t.startTime-e)}}function tI(e,t){Lc=!1,xy&&(xy=!1,x4(wy),wy=-1),Mx=!0;var r=Fo;try{for(ZE(t),sa=Wa(hi);sa!==null&&(!(sa.expirationTime>t)||e&&!k4());){var o=sa.callback;if(typeof o=="function"){sa.callback=null,Fo=sa.priorityLevel;var n=o(sa.expirationTime<=t);t=ir.unstable_now(),typeof n=="function"?sa.callback=n:sa===Wa(hi)&&Fx(hi),ZE(t)}else Fx(hi);sa=Wa(hi)}if(sa!==null)var a=!0;else{var i=Wa(el);i!==null&&oI(eI,i.startTime-t),a=!1}return a}finally{sa=null,Fo=r,Mx=!1}}var Ox=!1,Dx=null,wy=-1,w4=5,S4=-1;function k4(){return!(ir.unstable_now()-S4<w4)}function YE(){if(Dx!==null){var e=ir.unstable_now();S4=e;var t=!0;try{t=Dx(!0,e)}finally{t?by():(Ox=!1,Dx=null)}}else Ox=!1}var by;typeof y4=="function"?by=function(){y4(YE)}:typeof MessageChannel<"u"?(QE=new MessageChannel,v4=QE.port2,QE.port1.onmessage=YE,by=function(){v4.postMessage(null)}):by=function(){b4(YE,0)};var QE,v4;function rI(e){Dx=e,Ox||(Ox=!0,by())}function oI(e,t){wy=b4(function(){e(ir.unstable_now())},t)}ir.unstable_IdlePriority=5;ir.unstable_ImmediatePriority=1;ir.unstable_LowPriority=4;ir.unstable_NormalPriority=3;ir.unstable_Profiling=null;ir.unstable_UserBlockingPriority=2;ir.unstable_cancelCallback=function(e){e.callback=null};ir.unstable_continueExecution=function(){Lc||Mx||(Lc=!0,rI(tI))};ir.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):w4=0<e?Math.floor(1e3/e):5};ir.unstable_getCurrentPriorityLevel=function(){return Fo};ir.unstable_getFirstCallbackNode=function(){return Wa(hi)};ir.unstable_next=function(e){switch(Fo){case 1:case 2:case 3:var t=3;break;default:t=Fo}var r=Fo;Fo=t;try{return e()}finally{Fo=r}};ir.unstable_pauseExecution=function(){};ir.unstable_requestPaint=function(){};ir.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var r=Fo;Fo=e;try{return t()}finally{Fo=r}};ir.unstable_scheduleCallback=function(e,t,r){var o=ir.unstable_now();switch(typeof r=="object"&&r!==null?(r=r.delay,r=typeof r=="number"&&0<r?o+r:o):r=o,e){case 1:var n=-1;break;case 2:n=250;break;case 5:n=1073741823;break;case 4:n=1e4;break;default:n=5e3}return n=r+n,e={id:yne++,callback:t,priorityLevel:e,startTime:r,expirationTime:n,sortIndex:-1},r>o?(e.sortIndex=r,JE(el,e),Wa(hi)===null&&e===Wa(el)&&(xy?(x4(wy),wy=-1):xy=!0,oI(eI,r-o))):(e.sortIndex=n,JE(hi,e),Lc||Mx||(Lc=!0,rI(tI))),e};ir.unstable_shouldYield=k4;ir.unstable_wrapCallback=function(e){var t=Fo;return function(){var r=Fo;Fo=t;try{return e.apply(this,arguments)}finally{Fo=r}}}});var I4=Be((HCe,E4)=>{"use strict";E4.exports=_4()});var AO=Be(Hn=>{"use strict";var vne=Me(),Un=I4();function fe(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var FF=new Set,Hy={};function Jc(e,t){ud(e,t),ud(e+"Capture",t)}function ud(e,t){for(Hy[e]=t,e=0;e<t.length;e++)FF.add(t[e])}var cs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),II=Object.prototype.hasOwnProperty,bne=/^[: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]*$/,T4={},C4={};function xne(e){return II.call(C4,e)?!0:II.call(T4,e)?!1:bne.test(e)?C4[e]=!0:(T4[e]=!0,!1)}function wne(e,t,r,o){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return o?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Sne(e,t,r,o){if(t===null||typeof t>"u"||wne(e,t,r,o))return!0;if(o)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Zo(e,t,r,o,n,a,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=o,this.attributeNamespace=n,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=i}var Io={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Io[e]=new Zo(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Io[t]=new Zo(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Io[e]=new Zo(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Io[e]=new Zo(e,2,!1,e,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(e){Io[e]=new Zo(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Io[e]=new Zo(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Io[e]=new Zo(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Io[e]=new Zo(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Io[e]=new Zo(e,5,!1,e.toLowerCase(),null,!1,!1)});var vT=/[\-:]([a-z])/g;function bT(e){return e[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(e){var t=e.replace(vT,bT);Io[t]=new Zo(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(vT,bT);Io[t]=new Zo(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(vT,bT);Io[t]=new Zo(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Io[e]=new Zo(e,1,!1,e.toLowerCase(),null,!1,!1)});Io.xlinkHref=new Zo("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Io[e]=new Zo(e,1,!1,e.toLowerCase(),null,!0,!0)});function xT(e,t,r,o){var n=Io.hasOwnProperty(t)?Io[t]:null;(n!==null?n.type!==0:o||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(Sne(t,r,n,o)&&(r=null),o||n===null?xne(t)&&(r===null?e.removeAttribute(t):e.setAttribute(t,""+r)):n.mustUseProperty?e[n.propertyName]=r===null?n.type===3?!1:"":r:(t=n.attributeName,o=n.attributeNamespace,r===null?e.removeAttribute(t):(n=n.type,r=n===3||n===4&&r===!0?"":""+r,o?e.setAttributeNS(o,t,r):e.setAttribute(t,r))))}var fs=vne.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Px=Symbol.for("react.element"),qf=Symbol.for("react.portal"),Kf=Symbol.for("react.fragment"),wT=Symbol.for("react.strict_mode"),TI=Symbol.for("react.profiler"),MF=Symbol.for("react.provider"),OF=Symbol.for("react.context"),ST=Symbol.for("react.forward_ref"),CI=Symbol.for("react.suspense"),NI=Symbol.for("react.suspense_list"),kT=Symbol.for("react.memo"),rl=Symbol.for("react.lazy");Symbol.for("react.scope");Symbol.for("react.debug_trace_mode");var PF=Symbol.for("react.offscreen");Symbol.for("react.legacy_hidden");Symbol.for("react.cache");Symbol.for("react.tracing_marker");var N4=Symbol.iterator;function Sy(e){return e===null||typeof e!="object"?null:(e=N4&&e[N4]||e["@@iterator"],typeof e=="function"?e:null)}var Nr=Object.assign,nI;function Ay(e){if(nI===void 0)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);nI=t&&t[1]||""}return`
2
+ `+nI+e}var aI=!1;function iI(e,t){if(!e||aI)return"";aI=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(l){var o=l}Reflect.construct(e,[],t)}else{try{t.call()}catch(l){o=l}e.call(t.prototype)}else{try{throw Error()}catch(l){o=l}e()}}catch(l){if(l&&o&&typeof l.stack=="string"){for(var n=l.stack.split(`
3
+ `),a=o.stack.split(`
4
+ `),i=n.length-1,s=a.length-1;1<=i&&0<=s&&n[i]!==a[s];)s--;for(;1<=i&&0<=s;i--,s--)if(n[i]!==a[s]){if(i!==1||s!==1)do if(i--,s--,0>s||n[i]!==a[s]){var c=`
5
+ `+n[i].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=i&&0<=s);break}}}finally{aI=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?Ay(e):""}function kne(e){switch(e.tag){case 5:return Ay(e.type);case 16:return Ay("Lazy");case 13:return Ay("Suspense");case 19:return Ay("SuspenseList");case 0:case 2:case 15:return e=iI(e.type,!1),e;case 11:return e=iI(e.type.render,!1),e;case 1:return e=iI(e.type,!0),e;default:return""}}function AI(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Kf:return"Fragment";case qf:return"Portal";case TI:return"Profiler";case wT:return"StrictMode";case CI:return"Suspense";case NI:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case OF:return(e.displayName||"Context")+".Consumer";case MF:return(e._context.displayName||"Context")+".Provider";case ST:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case kT:return t=e.displayName||null,t!==null?t:AI(e.type)||"Memo";case rl:t=e._payload,e=e._init;try{return AI(e(t))}catch{}}return null}function _ne(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return AI(t);case 8:return t===wT?"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 t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function gl(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function zF(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Ene(e){var t=zF(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),o=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var n=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return n.call(this)},set:function(i){o=""+i,a.call(this,i)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return o},setValue:function(i){o=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function zx(e){e._valueTracker||(e._valueTracker=Ene(e))}function $F(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),o="";return e&&(o=zF(e)?e.checked?"true":"false":e.value),e=o,e!==r?(t.setValue(e),!0):!1}function u0(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function RI(e,t){var r=t.checked;return Nr({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function A4(e,t){var r=t.defaultValue==null?"":t.defaultValue,o=t.checked!=null?t.checked:t.defaultChecked;r=gl(t.value!=null?t.value:r),e._wrapperState={initialChecked:o,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function LF(e,t){t=t.checked,t!=null&&xT(e,"checked",t,!1)}function DI(e,t){LF(e,t);var r=gl(t.value),o=t.type;if(r!=null)o==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(o==="submit"||o==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?FI(e,t.type,r):t.hasOwnProperty("defaultValue")&&FI(e,t.type,gl(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function R4(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var o=t.type;if(!(o!=="submit"&&o!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function FI(e,t,r){(t!=="number"||u0(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var Ry=Array.isArray;function ad(e,t,r,o){if(e=e.options,t){t={};for(var n=0;n<r.length;n++)t["$"+r[n]]=!0;for(r=0;r<e.length;r++)n=t.hasOwnProperty("$"+e[r].value),e[r].selected!==n&&(e[r].selected=n),n&&o&&(e[r].defaultSelected=!0)}else{for(r=""+gl(r),t=null,n=0;n<e.length;n++){if(e[n].value===r){e[n].selected=!0,o&&(e[n].defaultSelected=!0);return}t!==null||e[n].disabled||(t=e[n])}t!==null&&(t.selected=!0)}}function MI(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(fe(91));return Nr({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function D4(e,t){var r=t.value;if(r==null){if(r=t.children,t=t.defaultValue,r!=null){if(t!=null)throw Error(fe(92));if(Ry(r)){if(1<r.length)throw Error(fe(93));r=r[0]}t=r}t==null&&(t=""),r=t}e._wrapperState={initialValue:gl(r)}}function BF(e,t){var r=gl(t.value),o=gl(t.defaultValue);r!=null&&(r=""+r,r!==e.value&&(e.value=r),t.defaultValue==null&&e.defaultValue!==r&&(e.defaultValue=r)),o!=null&&(e.defaultValue=""+o)}function F4(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function UF(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function OI(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?UF(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var $x,WF=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,r,o,n){MSApp.execUnsafeLocalFunction(function(){return e(t,r,o,n)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for($x=$x||document.createElement("div"),$x.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=$x.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Vy(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var My={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},Ine=["Webkit","ms","Moz","O"];Object.keys(My).forEach(function(e){Ine.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),My[t]=My[e]})});function HF(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||My.hasOwnProperty(e)&&My[e]?(""+t).trim():t+"px"}function VF(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var o=r.indexOf("--")===0,n=HF(r,t[r],o);r==="float"&&(r="cssFloat"),o?e.setProperty(r,n):e[r]=n}}var Tne=Nr({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 PI(e,t){if(t){if(Tne[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(fe(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(fe(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(fe(61))}if(t.style!=null&&typeof t.style!="object")throw Error(fe(62))}}function zI(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 $I=null;function _T(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var LI=null,id=null,sd=null;function M4(e){if(e=lv(e)){if(typeof LI!="function")throw Error(fe(280));var t=e.stateNode;t&&(t=L0(t),LI(e.stateNode,e.type,t))}}function jF(e){id?sd?sd.push(e):sd=[e]:id=e}function GF(){if(id){var e=id,t=sd;if(sd=id=null,M4(e),t)for(e=0;e<t.length;e++)M4(t[e])}}function qF(e,t){return e(t)}function KF(){}var sI=!1;function XF(e,t,r){if(sI)return e(t,r);sI=!0;try{return qF(e,t,r)}finally{sI=!1,(id!==null||sd!==null)&&(KF(),GF())}}function jy(e,t){var r=e.stateNode;if(r===null)return null;var o=L0(r);if(o===null)return null;r=o[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(o=!o.disabled)||(e=e.type,o=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!o;break e;default:e=!1}if(e)return null;if(r&&typeof r!="function")throw Error(fe(231,t,typeof r));return r}var BI=!1;if(cs)try{jf={},Object.defineProperty(jf,"passive",{get:function(){BI=!0}}),window.addEventListener("test",jf,jf),window.removeEventListener("test",jf,jf)}catch{BI=!1}var jf;function Cne(e,t,r,o,n,a,i,s,c){var l=Array.prototype.slice.call(arguments,3);try{t.apply(r,l)}catch(p){this.onError(p)}}var Oy=!1,m0=null,f0=!1,UI=null,Nne={onError:function(e){Oy=!0,m0=e}};function Ane(e,t,r,o,n,a,i,s,c){Oy=!1,m0=null,Cne.apply(Nne,arguments)}function Rne(e,t,r,o,n,a,i,s,c){if(Ane.apply(this,arguments),Oy){if(Oy){var l=m0;Oy=!1,m0=null}else throw Error(fe(198));f0||(f0=!0,UI=l)}}function Zc(e){var t=e,r=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(r=t.return),e=t.return;while(e)}return t.tag===3?r:null}function YF(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function O4(e){if(Zc(e)!==e)throw Error(fe(188))}function Dne(e){var t=e.alternate;if(!t){if(t=Zc(e),t===null)throw Error(fe(188));return t!==e?null:e}for(var r=e,o=t;;){var n=r.return;if(n===null)break;var a=n.alternate;if(a===null){if(o=n.return,o!==null){r=o;continue}break}if(n.child===a.child){for(a=n.child;a;){if(a===r)return O4(n),e;if(a===o)return O4(n),t;a=a.sibling}throw Error(fe(188))}if(r.return!==o.return)r=n,o=a;else{for(var i=!1,s=n.child;s;){if(s===r){i=!0,r=n,o=a;break}if(s===o){i=!0,o=n,r=a;break}s=s.sibling}if(!i){for(s=a.child;s;){if(s===r){i=!0,r=a,o=n;break}if(s===o){i=!0,o=a,r=n;break}s=s.sibling}if(!i)throw Error(fe(189))}}if(r.alternate!==o)throw Error(fe(190))}if(r.tag!==3)throw Error(fe(188));return r.stateNode.current===r?e:t}function QF(e){return e=Dne(e),e!==null?JF(e):null}function JF(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=JF(e);if(t!==null)return t;e=e.sibling}return null}var ZF=Un.unstable_scheduleCallback,P4=Un.unstable_cancelCallback,Fne=Un.unstable_shouldYield,Mne=Un.unstable_requestPaint,Hr=Un.unstable_now,One=Un.unstable_getCurrentPriorityLevel,ET=Un.unstable_ImmediatePriority,eM=Un.unstable_UserBlockingPriority,d0=Un.unstable_NormalPriority,Pne=Un.unstable_LowPriority,tM=Un.unstable_IdlePriority,O0=null,bi=null;function zne(e){if(bi&&typeof bi.onCommitFiberRoot=="function")try{bi.onCommitFiberRoot(O0,e,void 0,(e.current.flags&128)===128)}catch{}}var qa=Math.clz32?Math.clz32:Bne,$ne=Math.log,Lne=Math.LN2;function Bne(e){return e>>>=0,e===0?32:31-($ne(e)/Lne|0)|0}var Lx=64,Bx=4194304;function Dy(e){switch(e&-e){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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function h0(e,t){var r=e.pendingLanes;if(r===0)return 0;var o=0,n=e.suspendedLanes,a=e.pingedLanes,i=r&268435455;if(i!==0){var s=i&~n;s!==0?o=Dy(s):(a&=i,a!==0&&(o=Dy(a)))}else i=r&~n,i!==0?o=Dy(i):a!==0&&(o=Dy(a));if(o===0)return 0;if(t!==0&&t!==o&&!(t&n)&&(n=o&-o,a=t&-t,n>=a||n===16&&(a&4194240)!==0))return t;if(o&4&&(o|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=o;0<t;)r=31-qa(t),n=1<<r,o|=e[r],t&=~n;return o}function Une(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Wne(e,t){for(var r=e.suspendedLanes,o=e.pingedLanes,n=e.expirationTimes,a=e.pendingLanes;0<a;){var i=31-qa(a),s=1<<i,c=n[i];c===-1?(!(s&r)||s&o)&&(n[i]=Une(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}}function WI(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function rM(){var e=Lx;return Lx<<=1,!(Lx&4194240)&&(Lx=64),e}function lI(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function iv(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-qa(t),e[t]=r}function Hne(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var o=e.eventTimes;for(e=e.expirationTimes;0<r;){var n=31-qa(r),a=1<<n;t[n]=0,o[n]=-1,e[n]=-1,r&=~a}}function IT(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var o=31-qa(r),n=1<<o;n&t|e[o]&t&&(e[o]|=t),r&=~n}}var Zt=0;function oM(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var nM,TT,aM,iM,sM,HI=!1,Ux=[],ll=null,cl=null,pl=null,Gy=new Map,qy=new Map,nl=[],Vne="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function z4(e,t){switch(e){case"focusin":case"focusout":ll=null;break;case"dragenter":case"dragleave":cl=null;break;case"mouseover":case"mouseout":pl=null;break;case"pointerover":case"pointerout":Gy.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":qy.delete(t.pointerId)}}function ky(e,t,r,o,n,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:r,eventSystemFlags:o,nativeEvent:a,targetContainers:[n]},t!==null&&(t=lv(t),t!==null&&TT(t)),e):(e.eventSystemFlags|=o,t=e.targetContainers,n!==null&&t.indexOf(n)===-1&&t.push(n),e)}function jne(e,t,r,o,n){switch(t){case"focusin":return ll=ky(ll,e,t,r,o,n),!0;case"dragenter":return cl=ky(cl,e,t,r,o,n),!0;case"mouseover":return pl=ky(pl,e,t,r,o,n),!0;case"pointerover":var a=n.pointerId;return Gy.set(a,ky(Gy.get(a)||null,e,t,r,o,n)),!0;case"gotpointercapture":return a=n.pointerId,qy.set(a,ky(qy.get(a)||null,e,t,r,o,n)),!0}return!1}function lM(e){var t=Wc(e.target);if(t!==null){var r=Zc(t);if(r!==null){if(t=r.tag,t===13){if(t=YF(r),t!==null){e.blockedOn=t,sM(e.priority,function(){aM(r)});return}}else if(t===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function t0(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var r=VI(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(r===null){r=e.nativeEvent;var o=new r.constructor(r.type,r);$I=o,r.target.dispatchEvent(o),$I=null}else return t=lv(r),t!==null&&TT(t),e.blockedOn=r,!1;t.shift()}return!0}function $4(e,t,r){t0(e)&&r.delete(t)}function Gne(){HI=!1,ll!==null&&t0(ll)&&(ll=null),cl!==null&&t0(cl)&&(cl=null),pl!==null&&t0(pl)&&(pl=null),Gy.forEach($4),qy.forEach($4)}function _y(e,t){e.blockedOn===t&&(e.blockedOn=null,HI||(HI=!0,Un.unstable_scheduleCallback(Un.unstable_NormalPriority,Gne)))}function Ky(e){function t(n){return _y(n,e)}if(0<Ux.length){_y(Ux[0],e);for(var r=1;r<Ux.length;r++){var o=Ux[r];o.blockedOn===e&&(o.blockedOn=null)}}for(ll!==null&&_y(ll,e),cl!==null&&_y(cl,e),pl!==null&&_y(pl,e),Gy.forEach(t),qy.forEach(t),r=0;r<nl.length;r++)o=nl[r],o.blockedOn===e&&(o.blockedOn=null);for(;0<nl.length&&(r=nl[0],r.blockedOn===null);)lM(r),r.blockedOn===null&&nl.shift()}var ld=fs.ReactCurrentBatchConfig,g0=!0;function qne(e,t,r,o){var n=Zt,a=ld.transition;ld.transition=null;try{Zt=1,CT(e,t,r,o)}finally{Zt=n,ld.transition=a}}function Kne(e,t,r,o){var n=Zt,a=ld.transition;ld.transition=null;try{Zt=4,CT(e,t,r,o)}finally{Zt=n,ld.transition=a}}function CT(e,t,r,o){if(g0){var n=VI(e,t,r,o);if(n===null)hI(e,t,o,y0,r),z4(e,o);else if(jne(n,e,t,r,o))o.stopPropagation();else if(z4(e,o),t&4&&-1<Vne.indexOf(e)){for(;n!==null;){var a=lv(n);if(a!==null&&nM(a),a=VI(e,t,r,o),a===null&&hI(e,t,o,y0,r),a===n)break;n=a}n!==null&&o.stopPropagation()}else hI(e,t,o,null,r)}}var y0=null;function VI(e,t,r,o){if(y0=null,e=_T(o),e=Wc(e),e!==null)if(t=Zc(e),t===null)e=null;else if(r=t.tag,r===13){if(e=YF(t),e!==null)return e;e=null}else if(r===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return y0=e,null}function cM(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(One()){case ET:return 1;case eM:return 4;case d0:case Pne:return 16;case tM:return 536870912;default:return 16}default:return 16}}var il=null,NT=null,r0=null;function pM(){if(r0)return r0;var e,t=NT,r=t.length,o,n="value"in il?il.value:il.textContent,a=n.length;for(e=0;e<r&&t[e]===n[e];e++);var i=r-e;for(o=1;o<=i&&t[r-o]===n[a-o];o++);return r0=n.slice(e,1<o?1-o:void 0)}function o0(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Wx(){return!0}function L4(){return!1}function Wn(e){function t(r,o,n,a,i){this._reactName=r,this._targetInst=n,this.type=o,this.nativeEvent=a,this.target=i,this.currentTarget=null;for(var s in e)e.hasOwnProperty(s)&&(r=e[s],this[s]=r?r(a):a[s]);return this.isDefaultPrevented=(a.defaultPrevented!=null?a.defaultPrevented:a.returnValue===!1)?Wx:L4,this.isPropagationStopped=L4,this}return Nr(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=Wx)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=Wx)},persist:function(){},isPersistent:Wx}),t}var vd={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},AT=Wn(vd),sv=Nr({},vd,{view:0,detail:0}),Xne=Wn(sv),cI,pI,Ey,P0=Nr({},sv,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:RT,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Ey&&(Ey&&e.type==="mousemove"?(cI=e.screenX-Ey.screenX,pI=e.screenY-Ey.screenY):pI=cI=0,Ey=e),cI)},movementY:function(e){return"movementY"in e?e.movementY:pI}}),B4=Wn(P0),Yne=Nr({},P0,{dataTransfer:0}),Qne=Wn(Yne),Jne=Nr({},sv,{relatedTarget:0}),uI=Wn(Jne),Zne=Nr({},vd,{animationName:0,elapsedTime:0,pseudoElement:0}),eae=Wn(Zne),tae=Nr({},vd,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),rae=Wn(tae),oae=Nr({},vd,{data:0}),U4=Wn(oae),nae={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},aae={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},iae={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function sae(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=iae[e])?!!t[e]:!1}function RT(){return sae}var lae=Nr({},sv,{key:function(e){if(e.key){var t=nae[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=o0(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?aae[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:RT,charCode:function(e){return e.type==="keypress"?o0(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?o0(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),cae=Wn(lae),pae=Nr({},P0,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),W4=Wn(pae),uae=Nr({},sv,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:RT}),mae=Wn(uae),fae=Nr({},vd,{propertyName:0,elapsedTime:0,pseudoElement:0}),dae=Wn(fae),hae=Nr({},P0,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),gae=Wn(hae),yae=[9,13,27,32],DT=cs&&"CompositionEvent"in window,Py=null;cs&&"documentMode"in document&&(Py=document.documentMode);var vae=cs&&"TextEvent"in window&&!Py,uM=cs&&(!DT||Py&&8<Py&&11>=Py),H4=" ",V4=!1;function mM(e,t){switch(e){case"keyup":return yae.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function fM(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Xf=!1;function bae(e,t){switch(e){case"compositionend":return fM(t);case"keypress":return t.which!==32?null:(V4=!0,H4);case"textInput":return e=t.data,e===H4&&V4?null:e;default:return null}}function xae(e,t){if(Xf)return e==="compositionend"||!DT&&mM(e,t)?(e=pM(),r0=NT=il=null,Xf=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return uM&&t.locale!=="ko"?null:t.data;default:return null}}var wae={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function j4(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!wae[e.type]:t==="textarea"}function dM(e,t,r,o){jF(o),t=v0(t,"onChange"),0<t.length&&(r=new AT("onChange","change",null,r,o),e.push({event:r,listeners:t}))}var zy=null,Xy=null;function Sae(e){EM(e,0)}function z0(e){var t=Jf(e);if($F(t))return e}function kae(e,t){if(e==="change")return t}var hM=!1;cs&&(cs?(Vx="oninput"in document,Vx||(mI=document.createElement("div"),mI.setAttribute("oninput","return;"),Vx=typeof mI.oninput=="function"),Hx=Vx):Hx=!1,hM=Hx&&(!document.documentMode||9<document.documentMode));var Hx,Vx,mI;function G4(){zy&&(zy.detachEvent("onpropertychange",gM),Xy=zy=null)}function gM(e){if(e.propertyName==="value"&&z0(Xy)){var t=[];dM(t,Xy,e,_T(e)),XF(Sae,t)}}function _ae(e,t,r){e==="focusin"?(G4(),zy=t,Xy=r,zy.attachEvent("onpropertychange",gM)):e==="focusout"&&G4()}function Eae(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return z0(Xy)}function Iae(e,t){if(e==="click")return z0(t)}function Tae(e,t){if(e==="input"||e==="change")return z0(t)}function Cae(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Xa=typeof Object.is=="function"?Object.is:Cae;function Yy(e,t){if(Xa(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(o=0;o<r.length;o++){var n=r[o];if(!II.call(t,n)||!Xa(e[n],t[n]))return!1}return!0}function q4(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function K4(e,t){var r=q4(e);e=0;for(var o;r;){if(r.nodeType===3){if(o=e+r.textContent.length,e<=t&&o>=t)return{node:r,offset:t-e};e=o}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=q4(r)}}function yM(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?yM(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function vM(){for(var e=window,t=u0();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=u0(e.document)}return t}function FT(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Nae(e){var t=vM(),r=e.focusedElem,o=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&yM(r.ownerDocument.documentElement,r)){if(o!==null&&FT(r)){if(t=o.start,e=o.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var n=r.textContent.length,a=Math.min(o.start,n);o=o.end===void 0?a:Math.min(o.end,n),!e.extend&&a>o&&(n=o,o=a,a=n),n=K4(r,a);var i=K4(r,o);n&&i&&(e.rangeCount!==1||e.anchorNode!==n.node||e.anchorOffset!==n.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(n.node,n.offset),e.removeAllRanges(),a>o?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r<t.length;r++)e=t[r],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Aae=cs&&"documentMode"in document&&11>=document.documentMode,Yf=null,jI=null,$y=null,GI=!1;function X4(e,t,r){var o=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;GI||Yf==null||Yf!==u0(o)||(o=Yf,"selectionStart"in o&&FT(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),$y&&Yy($y,o)||($y=o,o=v0(jI,"onSelect"),0<o.length&&(t=new AT("onSelect","select",null,t,r),e.push({event:t,listeners:o}),t.target=Yf)))}function jx(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var Qf={animationend:jx("Animation","AnimationEnd"),animationiteration:jx("Animation","AnimationIteration"),animationstart:jx("Animation","AnimationStart"),transitionend:jx("Transition","TransitionEnd")},fI={},bM={};cs&&(bM=document.createElement("div").style,"AnimationEvent"in window||(delete Qf.animationend.animation,delete Qf.animationiteration.animation,delete Qf.animationstart.animation),"TransitionEvent"in window||delete Qf.transitionend.transition);function $0(e){if(fI[e])return fI[e];if(!Qf[e])return e;var t=Qf[e],r;for(r in t)if(t.hasOwnProperty(r)&&r in bM)return fI[e]=t[r];return e}var xM=$0("animationend"),wM=$0("animationiteration"),SM=$0("animationstart"),kM=$0("transitionend"),_M=new Map,Y4="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function vl(e,t){_M.set(e,t),Jc(t,[e])}for(Gx=0;Gx<Y4.length;Gx++)qx=Y4[Gx],Q4=qx.toLowerCase(),J4=qx[0].toUpperCase()+qx.slice(1),vl(Q4,"on"+J4);var qx,Q4,J4,Gx;vl(xM,"onAnimationEnd");vl(wM,"onAnimationIteration");vl(SM,"onAnimationStart");vl("dblclick","onDoubleClick");vl("focusin","onFocus");vl("focusout","onBlur");vl(kM,"onTransitionEnd");ud("onMouseEnter",["mouseout","mouseover"]);ud("onMouseLeave",["mouseout","mouseover"]);ud("onPointerEnter",["pointerout","pointerover"]);ud("onPointerLeave",["pointerout","pointerover"]);Jc("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Jc("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Jc("onBeforeInput",["compositionend","keypress","textInput","paste"]);Jc("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Jc("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Jc("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Fy="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Rae=new Set("cancel close invalid load scroll toggle".split(" ").concat(Fy));function Z4(e,t,r){var o=e.type||"unknown-event";e.currentTarget=r,Rne(o,t,void 0,e),e.currentTarget=null}function EM(e,t){t=(t&4)!==0;for(var r=0;r<e.length;r++){var o=e[r],n=o.event;o=o.listeners;e:{var a=void 0;if(t)for(var i=o.length-1;0<=i;i--){var s=o[i],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&n.isPropagationStopped())break e;Z4(n,s,l),a=c}else for(i=0;i<o.length;i++){if(s=o[i],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&n.isPropagationStopped())break e;Z4(n,s,l),a=c}}}if(f0)throw e=UI,f0=!1,UI=null,e}function fr(e,t){var r=t[QI];r===void 0&&(r=t[QI]=new Set);var o=e+"__bubble";r.has(o)||(IM(t,e,2,!1),r.add(o))}function dI(e,t,r){var o=0;t&&(o|=4),IM(r,e,o,t)}var Kx="_reactListening"+Math.random().toString(36).slice(2);function Qy(e){if(!e[Kx]){e[Kx]=!0,FF.forEach(function(r){r!=="selectionchange"&&(Rae.has(r)||dI(r,!1,e),dI(r,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Kx]||(t[Kx]=!0,dI("selectionchange",!1,t))}}function IM(e,t,r,o){switch(cM(t)){case 1:var n=qne;break;case 4:n=Kne;break;default:n=CT}r=n.bind(null,t,r,e),n=void 0,!BI||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(n=!0),o?n!==void 0?e.addEventListener(t,r,{capture:!0,passive:n}):e.addEventListener(t,r,!0):n!==void 0?e.addEventListener(t,r,{passive:n}):e.addEventListener(t,r,!1)}function hI(e,t,r,o,n){var a=o;if(!(t&1)&&!(t&2)&&o!==null)e:for(;;){if(o===null)return;var i=o.tag;if(i===3||i===4){var s=o.stateNode.containerInfo;if(s===n||s.nodeType===8&&s.parentNode===n)break;if(i===4)for(i=o.return;i!==null;){var c=i.tag;if((c===3||c===4)&&(c=i.stateNode.containerInfo,c===n||c.nodeType===8&&c.parentNode===n))return;i=i.return}for(;s!==null;){if(i=Wc(s),i===null)return;if(c=i.tag,c===5||c===6){o=a=i;continue e}s=s.parentNode}}o=o.return}XF(function(){var l=a,p=_T(r),u=[];e:{var m=_M.get(e);if(m!==void 0){var f=AT,d=e;switch(e){case"keypress":if(o0(r)===0)break e;case"keydown":case"keyup":f=cae;break;case"focusin":d="focus",f=uI;break;case"focusout":d="blur",f=uI;break;case"beforeblur":case"afterblur":f=uI;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":f=B4;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":f=Qne;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":f=mae;break;case xM:case wM:case SM:f=eae;break;case kM:f=dae;break;case"scroll":f=Xne;break;case"wheel":f=gae;break;case"copy":case"cut":case"paste":f=rae;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":f=W4}var h=(t&4)!==0,y=!h&&e==="scroll",g=h?m!==null?m+"Capture":null:m;h=[];for(var b=l,x;b!==null;){x=b;var w=x.stateNode;if(x.tag===5&&w!==null&&(x=w,g!==null&&(w=jy(b,g),w!=null&&h.push(Jy(b,w,x)))),y)break;b=b.return}0<h.length&&(m=new f(m,d,null,r,p),u.push({event:m,listeners:h}))}}if(!(t&7)){e:{if(m=e==="mouseover"||e==="pointerover",f=e==="mouseout"||e==="pointerout",m&&r!==$I&&(d=r.relatedTarget||r.fromElement)&&(Wc(d)||d[ps]))break e;if((f||m)&&(m=p.window===p?p:(m=p.ownerDocument)?m.defaultView||m.parentWindow:window,f?(d=r.relatedTarget||r.toElement,f=l,d=d?Wc(d):null,d!==null&&(y=Zc(d),d!==y||d.tag!==5&&d.tag!==6)&&(d=null)):(f=null,d=l),f!==d)){if(h=B4,w="onMouseLeave",g="onMouseEnter",b="mouse",(e==="pointerout"||e==="pointerover")&&(h=W4,w="onPointerLeave",g="onPointerEnter",b="pointer"),y=f==null?m:Jf(f),x=d==null?m:Jf(d),m=new h(w,b+"leave",f,r,p),m.target=y,m.relatedTarget=x,w=null,Wc(p)===l&&(h=new h(g,b+"enter",d,r,p),h.target=x,h.relatedTarget=y,w=h),y=w,f&&d)t:{for(h=f,g=d,b=0,x=h;x;x=Gf(x))b++;for(x=0,w=g;w;w=Gf(w))x++;for(;0<b-x;)h=Gf(h),b--;for(;0<x-b;)g=Gf(g),x--;for(;b--;){if(h===g||g!==null&&h===g.alternate)break t;h=Gf(h),g=Gf(g)}h=null}else h=null;f!==null&&eF(u,m,f,h,!1),d!==null&&y!==null&&eF(u,y,d,h,!0)}}e:{if(m=l?Jf(l):window,f=m.nodeName&&m.nodeName.toLowerCase(),f==="select"||f==="input"&&m.type==="file")var I=kae;else if(j4(m))if(hM)I=Tae;else{I=Eae;var C=_ae}else(f=m.nodeName)&&f.toLowerCase()==="input"&&(m.type==="checkbox"||m.type==="radio")&&(I=Iae);if(I&&(I=I(e,l))){dM(u,I,r,p);break e}C&&C(e,m,l),e==="focusout"&&(C=m._wrapperState)&&C.controlled&&m.type==="number"&&FI(m,"number",m.value)}switch(C=l?Jf(l):window,e){case"focusin":(j4(C)||C.contentEditable==="true")&&(Yf=C,jI=l,$y=null);break;case"focusout":$y=jI=Yf=null;break;case"mousedown":GI=!0;break;case"contextmenu":case"mouseup":case"dragend":GI=!1,X4(u,r,p);break;case"selectionchange":if(Aae)break;case"keydown":case"keyup":X4(u,r,p)}var R;if(DT)e:{switch(e){case"compositionstart":var P="onCompositionStart";break e;case"compositionend":P="onCompositionEnd";break e;case"compositionupdate":P="onCompositionUpdate";break e}P=void 0}else Xf?mM(e,r)&&(P="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(P="onCompositionStart");P&&(uM&&r.locale!=="ko"&&(Xf||P!=="onCompositionStart"?P==="onCompositionEnd"&&Xf&&(R=pM()):(il=p,NT="value"in il?il.value:il.textContent,Xf=!0)),C=v0(l,P),0<C.length&&(P=new U4(P,e,null,r,p),u.push({event:P,listeners:C}),R?P.data=R:(R=fM(r),R!==null&&(P.data=R)))),(R=vae?bae(e,r):xae(e,r))&&(l=v0(l,"onBeforeInput"),0<l.length&&(p=new U4("onBeforeInput","beforeinput",null,r,p),u.push({event:p,listeners:l}),p.data=R))}EM(u,t)})}function Jy(e,t,r){return{instance:e,listener:t,currentTarget:r}}function v0(e,t){for(var r=t+"Capture",o=[];e!==null;){var n=e,a=n.stateNode;n.tag===5&&a!==null&&(n=a,a=jy(e,r),a!=null&&o.unshift(Jy(e,a,n)),a=jy(e,t),a!=null&&o.push(Jy(e,a,n))),e=e.return}return o}function Gf(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function eF(e,t,r,o,n){for(var a=t._reactName,i=[];r!==null&&r!==o;){var s=r,c=s.alternate,l=s.stateNode;if(c!==null&&c===o)break;s.tag===5&&l!==null&&(s=l,n?(c=jy(r,a),c!=null&&i.unshift(Jy(r,c,s))):n||(c=jy(r,a),c!=null&&i.push(Jy(r,c,s)))),r=r.return}i.length!==0&&e.push({event:t,listeners:i})}var Dae=/\r\n?/g,Fae=/\u0000|\uFFFD/g;function tF(e){return(typeof e=="string"?e:""+e).replace(Dae,`
6
+ `).replace(Fae,"")}function Xx(e,t,r){if(t=tF(t),tF(e)!==t&&r)throw Error(fe(425))}function b0(){}var qI=null,KI=null;function XI(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var YI=typeof setTimeout=="function"?setTimeout:void 0,Mae=typeof clearTimeout=="function"?clearTimeout:void 0,rF=typeof Promise=="function"?Promise:void 0,Oae=typeof queueMicrotask=="function"?queueMicrotask:typeof rF<"u"?function(e){return rF.resolve(null).then(e).catch(Pae)}:YI;function Pae(e){setTimeout(function(){throw e})}function gI(e,t){var r=t,o=0;do{var n=r.nextSibling;if(e.removeChild(r),n&&n.nodeType===8)if(r=n.data,r==="/$"){if(o===0){e.removeChild(n),Ky(t);return}o--}else r!=="$"&&r!=="$?"&&r!=="$!"||o++;r=n}while(r);Ky(t)}function ul(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function oF(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"){if(t===0)return e;t--}else r==="/$"&&t++}e=e.previousSibling}return null}var bd=Math.random().toString(36).slice(2),vi="__reactFiber$"+bd,Zy="__reactProps$"+bd,ps="__reactContainer$"+bd,QI="__reactEvents$"+bd,zae="__reactListeners$"+bd,$ae="__reactHandles$"+bd;function Wc(e){var t=e[vi];if(t)return t;for(var r=e.parentNode;r;){if(t=r[ps]||r[vi]){if(r=t.alternate,t.child!==null||r!==null&&r.child!==null)for(e=oF(e);e!==null;){if(r=e[vi])return r;e=oF(e)}return t}e=r,r=e.parentNode}return null}function lv(e){return e=e[vi]||e[ps],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Jf(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(fe(33))}function L0(e){return e[Zy]||null}var JI=[],Zf=-1;function bl(e){return{current:e}}function dr(e){0>Zf||(e.current=JI[Zf],JI[Zf]=null,Zf--)}function sr(e,t){Zf++,JI[Zf]=e.current,e.current=t}var yl={},zo=bl(yl),vn=bl(!1),qc=yl;function md(e,t){var r=e.type.contextTypes;if(!r)return yl;var o=e.stateNode;if(o&&o.__reactInternalMemoizedUnmaskedChildContext===t)return o.__reactInternalMemoizedMaskedChildContext;var n={},a;for(a in r)n[a]=t[a];return o&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=n),n}function bn(e){return e=e.childContextTypes,e!=null}function x0(){dr(vn),dr(zo)}function nF(e,t,r){if(zo.current!==yl)throw Error(fe(168));sr(zo,t),sr(vn,r)}function TM(e,t,r){var o=e.stateNode;if(t=t.childContextTypes,typeof o.getChildContext!="function")return r;o=o.getChildContext();for(var n in o)if(!(n in t))throw Error(fe(108,_ne(e)||"Unknown",n));return Nr({},r,o)}function w0(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||yl,qc=zo.current,sr(zo,e),sr(vn,vn.current),!0}function aF(e,t,r){var o=e.stateNode;if(!o)throw Error(fe(169));r?(e=TM(e,t,qc),o.__reactInternalMemoizedMergedChildContext=e,dr(vn),dr(zo),sr(zo,e)):dr(vn),sr(vn,r)}var as=null,B0=!1,yI=!1;function CM(e){as===null?as=[e]:as.push(e)}function Lae(e){B0=!0,CM(e)}function xl(){if(!yI&&as!==null){yI=!0;var e=0,t=Zt;try{var r=as;for(Zt=1;e<r.length;e++){var o=r[e];do o=o(!0);while(o!==null)}as=null,B0=!1}catch(n){throw as!==null&&(as=as.slice(e+1)),ZF(ET,xl),n}finally{Zt=t,yI=!1}}return null}var ed=[],td=0,S0=null,k0=0,la=[],ca=0,Kc=null,is=1,ss="";function Bc(e,t){ed[td++]=k0,ed[td++]=S0,S0=e,k0=t}function NM(e,t,r){la[ca++]=is,la[ca++]=ss,la[ca++]=Kc,Kc=e;var o=is;e=ss;var n=32-qa(o)-1;o&=~(1<<n),r+=1;var a=32-qa(t)+n;if(30<a){var i=n-n%5;a=(o&(1<<i)-1).toString(32),o>>=i,n-=i,is=1<<32-qa(t)+n|r<<n|o,ss=a+e}else is=1<<a|r<<n|o,ss=e}function MT(e){e.return!==null&&(Bc(e,1),NM(e,1,0))}function OT(e){for(;e===S0;)S0=ed[--td],ed[td]=null,k0=ed[--td],ed[td]=null;for(;e===Kc;)Kc=la[--ca],la[ca]=null,ss=la[--ca],la[ca]=null,is=la[--ca],la[ca]=null}var Bn=null,Ln=null,wr=!1,Ga=null;function AM(e,t){var r=pa(5,null,null,0);r.elementType="DELETED",r.stateNode=t,r.return=e,t=e.deletions,t===null?(e.deletions=[r],e.flags|=16):t.push(r)}function iF(e,t){switch(e.tag){case 5:var r=e.type;return t=t.nodeType!==1||r.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Bn=e,Ln=ul(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Bn=e,Ln=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(r=Kc!==null?{id:is,overflow:ss}:null,e.memoizedState={dehydrated:t,treeContext:r,retryLane:1073741824},r=pa(18,null,null,0),r.stateNode=t,r.return=e,e.child=r,Bn=e,Ln=null,!0):!1;default:return!1}}function ZI(e){return(e.mode&1)!==0&&(e.flags&128)===0}function eT(e){if(wr){var t=Ln;if(t){var r=t;if(!iF(e,t)){if(ZI(e))throw Error(fe(418));t=ul(r.nextSibling);var o=Bn;t&&iF(e,t)?AM(o,r):(e.flags=e.flags&-4097|2,wr=!1,Bn=e)}}else{if(ZI(e))throw Error(fe(418));e.flags=e.flags&-4097|2,wr=!1,Bn=e}}}function sF(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Bn=e}function Yx(e){if(e!==Bn)return!1;if(!wr)return sF(e),wr=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!XI(e.type,e.memoizedProps)),t&&(t=Ln)){if(ZI(e))throw RM(),Error(fe(418));for(;t;)AM(e,t),t=ul(t.nextSibling)}if(sF(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(fe(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"){if(t===0){Ln=ul(e.nextSibling);break e}t--}else r!=="$"&&r!=="$!"&&r!=="$?"||t++}e=e.nextSibling}Ln=null}}else Ln=Bn?ul(e.stateNode.nextSibling):null;return!0}function RM(){for(var e=Ln;e;)e=ul(e.nextSibling)}function fd(){Ln=Bn=null,wr=!1}function PT(e){Ga===null?Ga=[e]:Ga.push(e)}var Bae=fs.ReactCurrentBatchConfig;function Iy(e,t,r){if(e=r.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(r._owner){if(r=r._owner,r){if(r.tag!==1)throw Error(fe(309));var o=r.stateNode}if(!o)throw Error(fe(147,e));var n=o,a=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===a?t.ref:(t=function(i){var s=n.refs;i===null?delete s[a]:s[a]=i},t._stringRef=a,t)}if(typeof e!="string")throw Error(fe(284));if(!r._owner)throw Error(fe(290,e))}return e}function Qx(e,t){throw e=Object.prototype.toString.call(t),Error(fe(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function lF(e){var t=e._init;return t(e._payload)}function DM(e){function t(g,b){if(e){var x=g.deletions;x===null?(g.deletions=[b],g.flags|=16):x.push(b)}}function r(g,b){if(!e)return null;for(;b!==null;)t(g,b),b=b.sibling;return null}function o(g,b){for(g=new Map;b!==null;)b.key!==null?g.set(b.key,b):g.set(b.index,b),b=b.sibling;return g}function n(g,b){return g=hl(g,b),g.index=0,g.sibling=null,g}function a(g,b,x){return g.index=x,e?(x=g.alternate,x!==null?(x=x.index,x<b?(g.flags|=2,b):x):(g.flags|=2,b)):(g.flags|=1048576,b)}function i(g){return e&&g.alternate===null&&(g.flags|=2),g}function s(g,b,x,w){return b===null||b.tag!==6?(b=_I(x,g.mode,w),b.return=g,b):(b=n(b,x),b.return=g,b)}function c(g,b,x,w){var I=x.type;return I===Kf?p(g,b,x.props.children,w,x.key):b!==null&&(b.elementType===I||typeof I=="object"&&I!==null&&I.$$typeof===rl&&lF(I)===b.type)?(w=n(b,x.props),w.ref=Iy(g,b,x),w.return=g,w):(w=p0(x.type,x.key,x.props,null,g.mode,w),w.ref=Iy(g,b,x),w.return=g,w)}function l(g,b,x,w){return b===null||b.tag!==4||b.stateNode.containerInfo!==x.containerInfo||b.stateNode.implementation!==x.implementation?(b=EI(x,g.mode,w),b.return=g,b):(b=n(b,x.children||[]),b.return=g,b)}function p(g,b,x,w,I){return b===null||b.tag!==7?(b=Gc(x,g.mode,w,I),b.return=g,b):(b=n(b,x),b.return=g,b)}function u(g,b,x){if(typeof b=="string"&&b!==""||typeof b=="number")return b=_I(""+b,g.mode,x),b.return=g,b;if(typeof b=="object"&&b!==null){switch(b.$$typeof){case Px:return x=p0(b.type,b.key,b.props,null,g.mode,x),x.ref=Iy(g,null,b),x.return=g,x;case qf:return b=EI(b,g.mode,x),b.return=g,b;case rl:var w=b._init;return u(g,w(b._payload),x)}if(Ry(b)||Sy(b))return b=Gc(b,g.mode,x,null),b.return=g,b;Qx(g,b)}return null}function m(g,b,x,w){var I=b!==null?b.key:null;if(typeof x=="string"&&x!==""||typeof x=="number")return I!==null?null:s(g,b,""+x,w);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case Px:return x.key===I?c(g,b,x,w):null;case qf:return x.key===I?l(g,b,x,w):null;case rl:return I=x._init,m(g,b,I(x._payload),w)}if(Ry(x)||Sy(x))return I!==null?null:p(g,b,x,w,null);Qx(g,x)}return null}function f(g,b,x,w,I){if(typeof w=="string"&&w!==""||typeof w=="number")return g=g.get(x)||null,s(b,g,""+w,I);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Px:return g=g.get(w.key===null?x:w.key)||null,c(b,g,w,I);case qf:return g=g.get(w.key===null?x:w.key)||null,l(b,g,w,I);case rl:var C=w._init;return f(g,b,x,C(w._payload),I)}if(Ry(w)||Sy(w))return g=g.get(x)||null,p(b,g,w,I,null);Qx(b,w)}return null}function d(g,b,x,w){for(var I=null,C=null,R=b,P=b=0,z=null;R!==null&&P<x.length;P++){R.index>P?(z=R,R=null):z=R.sibling;var $=m(g,R,x[P],w);if($===null){R===null&&(R=z);break}e&&R&&$.alternate===null&&t(g,R),b=a($,b,P),C===null?I=$:C.sibling=$,C=$,R=z}if(P===x.length)return r(g,R),wr&&Bc(g,P),I;if(R===null){for(;P<x.length;P++)R=u(g,x[P],w),R!==null&&(b=a(R,b,P),C===null?I=R:C.sibling=R,C=R);return wr&&Bc(g,P),I}for(R=o(g,R);P<x.length;P++)z=f(R,g,P,x[P],w),z!==null&&(e&&z.alternate!==null&&R.delete(z.key===null?P:z.key),b=a(z,b,P),C===null?I=z:C.sibling=z,C=z);return e&&R.forEach(function(B){return t(g,B)}),wr&&Bc(g,P),I}function h(g,b,x,w){var I=Sy(x);if(typeof I!="function")throw Error(fe(150));if(x=I.call(x),x==null)throw Error(fe(151));for(var C=I=null,R=b,P=b=0,z=null,$=x.next();R!==null&&!$.done;P++,$=x.next()){R.index>P?(z=R,R=null):z=R.sibling;var B=m(g,R,$.value,w);if(B===null){R===null&&(R=z);break}e&&R&&B.alternate===null&&t(g,R),b=a(B,b,P),C===null?I=B:C.sibling=B,C=B,R=z}if($.done)return r(g,R),wr&&Bc(g,P),I;if(R===null){for(;!$.done;P++,$=x.next())$=u(g,$.value,w),$!==null&&(b=a($,b,P),C===null?I=$:C.sibling=$,C=$);return wr&&Bc(g,P),I}for(R=o(g,R);!$.done;P++,$=x.next())$=f(R,g,P,$.value,w),$!==null&&(e&&$.alternate!==null&&R.delete($.key===null?P:$.key),b=a($,b,P),C===null?I=$:C.sibling=$,C=$);return e&&R.forEach(function(V){return t(g,V)}),wr&&Bc(g,P),I}function y(g,b,x,w){if(typeof x=="object"&&x!==null&&x.type===Kf&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case Px:e:{for(var I=x.key,C=b;C!==null;){if(C.key===I){if(I=x.type,I===Kf){if(C.tag===7){r(g,C.sibling),b=n(C,x.props.children),b.return=g,g=b;break e}}else if(C.elementType===I||typeof I=="object"&&I!==null&&I.$$typeof===rl&&lF(I)===C.type){r(g,C.sibling),b=n(C,x.props),b.ref=Iy(g,C,x),b.return=g,g=b;break e}r(g,C);break}else t(g,C);C=C.sibling}x.type===Kf?(b=Gc(x.props.children,g.mode,w,x.key),b.return=g,g=b):(w=p0(x.type,x.key,x.props,null,g.mode,w),w.ref=Iy(g,b,x),w.return=g,g=w)}return i(g);case qf:e:{for(C=x.key;b!==null;){if(b.key===C)if(b.tag===4&&b.stateNode.containerInfo===x.containerInfo&&b.stateNode.implementation===x.implementation){r(g,b.sibling),b=n(b,x.children||[]),b.return=g,g=b;break e}else{r(g,b);break}else t(g,b);b=b.sibling}b=EI(x,g.mode,w),b.return=g,g=b}return i(g);case rl:return C=x._init,y(g,b,C(x._payload),w)}if(Ry(x))return d(g,b,x,w);if(Sy(x))return h(g,b,x,w);Qx(g,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,b!==null&&b.tag===6?(r(g,b.sibling),b=n(b,x),b.return=g,g=b):(r(g,b),b=_I(x,g.mode,w),b.return=g,g=b),i(g)):r(g,b)}return y}var dd=DM(!0),FM=DM(!1),_0=bl(null),E0=null,rd=null,zT=null;function $T(){zT=rd=E0=null}function LT(e){var t=_0.current;dr(_0),e._currentValue=t}function tT(e,t,r){for(;e!==null;){var o=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,o!==null&&(o.childLanes|=t)):o!==null&&(o.childLanes&t)!==t&&(o.childLanes|=t),e===r)break;e=e.return}}function cd(e,t){E0=e,zT=rd=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(yn=!0),e.firstContext=null)}function ma(e){var t=e._currentValue;if(zT!==e)if(e={context:e,memoizedValue:t,next:null},rd===null){if(E0===null)throw Error(fe(308));rd=e,E0.dependencies={lanes:0,firstContext:e}}else rd=rd.next=e;return t}var Hc=null;function BT(e){Hc===null?Hc=[e]:Hc.push(e)}function MM(e,t,r,o){var n=t.interleaved;return n===null?(r.next=r,BT(t)):(r.next=n.next,n.next=r),t.interleaved=r,us(e,o)}function us(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var ol=!1;function UT(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function OM(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function ls(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ml(e,t,r){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,Bt&2){var n=o.pending;return n===null?t.next=t:(t.next=n.next,n.next=t),o.pending=t,us(e,r)}return n=o.interleaved,n===null?(t.next=t,BT(o)):(t.next=n.next,n.next=t),o.interleaved=t,us(e,r)}function n0(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var o=t.lanes;o&=e.pendingLanes,r|=o,t.lanes=r,IT(e,r)}}function cF(e,t){var r=e.updateQueue,o=e.alternate;if(o!==null&&(o=o.updateQueue,r===o)){var n=null,a=null;if(r=r.firstBaseUpdate,r!==null){do{var i={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};a===null?n=a=i:a=a.next=i,r=r.next}while(r!==null);a===null?n=a=t:a=a.next=t}else n=a=t;r={baseState:o.baseState,firstBaseUpdate:n,lastBaseUpdate:a,shared:o.shared,effects:o.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function I0(e,t,r,o){var n=e.updateQueue;ol=!1;var a=n.firstBaseUpdate,i=n.lastBaseUpdate,s=n.shared.pending;if(s!==null){n.shared.pending=null;var c=s,l=c.next;c.next=null,i===null?a=l:i.next=l,i=c;var p=e.alternate;p!==null&&(p=p.updateQueue,s=p.lastBaseUpdate,s!==i&&(s===null?p.firstBaseUpdate=l:s.next=l,p.lastBaseUpdate=c))}if(a!==null){var u=n.baseState;i=0,p=l=c=null,s=a;do{var m=s.lane,f=s.eventTime;if((o&m)===m){p!==null&&(p=p.next={eventTime:f,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});e:{var d=e,h=s;switch(m=t,f=r,h.tag){case 1:if(d=h.payload,typeof d=="function"){u=d.call(f,u,m);break e}u=d;break e;case 3:d.flags=d.flags&-65537|128;case 0:if(d=h.payload,m=typeof d=="function"?d.call(f,u,m):d,m==null)break e;u=Nr({},u,m);break e;case 2:ol=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,m=n.effects,m===null?n.effects=[s]:m.push(s))}else f={eventTime:f,lane:m,tag:s.tag,payload:s.payload,callback:s.callback,next:null},p===null?(l=p=f,c=u):p=p.next=f,i|=m;if(s=s.next,s===null){if(s=n.shared.pending,s===null)break;m=s,s=m.next,m.next=null,n.lastBaseUpdate=m,n.shared.pending=null}}while(!0);if(p===null&&(c=u),n.baseState=c,n.firstBaseUpdate=l,n.lastBaseUpdate=p,t=n.shared.interleaved,t!==null){n=t;do i|=n.lane,n=n.next;while(n!==t)}else a===null&&(n.shared.lanes=0);Yc|=i,e.lanes=i,e.memoizedState=u}}function pF(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var o=e[t],n=o.callback;if(n!==null){if(o.callback=null,o=r,typeof n!="function")throw Error(fe(191,n));n.call(o)}}}var cv={},xi=bl(cv),ev=bl(cv),tv=bl(cv);function Vc(e){if(e===cv)throw Error(fe(174));return e}function WT(e,t){switch(sr(tv,t),sr(ev,e),sr(xi,cv),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:OI(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=OI(t,e)}dr(xi),sr(xi,t)}function hd(){dr(xi),dr(ev),dr(tv)}function PM(e){Vc(tv.current);var t=Vc(xi.current),r=OI(t,e.type);t!==r&&(sr(ev,e),sr(xi,r))}function HT(e){ev.current===e&&(dr(xi),dr(ev))}var Tr=bl(0);function T0(e){for(var t=e;t!==null;){if(t.tag===13){var r=t.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var vI=[];function VT(){for(var e=0;e<vI.length;e++)vI[e]._workInProgressVersionPrimary=null;vI.length=0}var a0=fs.ReactCurrentDispatcher,bI=fs.ReactCurrentBatchConfig,Xc=0,Cr=null,ro=null,fo=null,C0=!1,Ly=!1,rv=0,Uae=0;function Mo(){throw Error(fe(321))}function jT(e,t){if(t===null)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!Xa(e[r],t[r]))return!1;return!0}function GT(e,t,r,o,n,a){if(Xc=a,Cr=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,a0.current=e===null||e.memoizedState===null?jae:Gae,e=r(o,n),Ly){a=0;do{if(Ly=!1,rv=0,25<=a)throw Error(fe(301));a+=1,fo=ro=null,t.updateQueue=null,a0.current=qae,e=r(o,n)}while(Ly)}if(a0.current=N0,t=ro!==null&&ro.next!==null,Xc=0,fo=ro=Cr=null,C0=!1,t)throw Error(fe(300));return e}function qT(){var e=rv!==0;return rv=0,e}function yi(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return fo===null?Cr.memoizedState=fo=e:fo=fo.next=e,fo}function fa(){if(ro===null){var e=Cr.alternate;e=e!==null?e.memoizedState:null}else e=ro.next;var t=fo===null?Cr.memoizedState:fo.next;if(t!==null)fo=t,ro=e;else{if(e===null)throw Error(fe(310));ro=e,e={memoizedState:ro.memoizedState,baseState:ro.baseState,baseQueue:ro.baseQueue,queue:ro.queue,next:null},fo===null?Cr.memoizedState=fo=e:fo=fo.next=e}return fo}function ov(e,t){return typeof t=="function"?t(e):t}function xI(e){var t=fa(),r=t.queue;if(r===null)throw Error(fe(311));r.lastRenderedReducer=e;var o=ro,n=o.baseQueue,a=r.pending;if(a!==null){if(n!==null){var i=n.next;n.next=a.next,a.next=i}o.baseQueue=n=a,r.pending=null}if(n!==null){a=n.next,o=o.baseState;var s=i=null,c=null,l=a;do{var p=l.lane;if((Xc&p)===p)c!==null&&(c=c.next={lane:0,action:l.action,hasEagerState:l.hasEagerState,eagerState:l.eagerState,next:null}),o=l.hasEagerState?l.eagerState:e(o,l.action);else{var u={lane:p,action:l.action,hasEagerState:l.hasEagerState,eagerState:l.eagerState,next:null};c===null?(s=c=u,i=o):c=c.next=u,Cr.lanes|=p,Yc|=p}l=l.next}while(l!==null&&l!==a);c===null?i=o:c.next=s,Xa(o,t.memoizedState)||(yn=!0),t.memoizedState=o,t.baseState=i,t.baseQueue=c,r.lastRenderedState=o}if(e=r.interleaved,e!==null){n=e;do a=n.lane,Cr.lanes|=a,Yc|=a,n=n.next;while(n!==e)}else n===null&&(r.lanes=0);return[t.memoizedState,r.dispatch]}function wI(e){var t=fa(),r=t.queue;if(r===null)throw Error(fe(311));r.lastRenderedReducer=e;var o=r.dispatch,n=r.pending,a=t.memoizedState;if(n!==null){r.pending=null;var i=n=n.next;do a=e(a,i.action),i=i.next;while(i!==n);Xa(a,t.memoizedState)||(yn=!0),t.memoizedState=a,t.baseQueue===null&&(t.baseState=a),r.lastRenderedState=a}return[a,o]}function zM(){}function $M(e,t){var r=Cr,o=fa(),n=t(),a=!Xa(o.memoizedState,n);if(a&&(o.memoizedState=n,yn=!0),o=o.queue,KT(UM.bind(null,r,o,e),[e]),o.getSnapshot!==t||a||fo!==null&&fo.memoizedState.tag&1){if(r.flags|=2048,nv(9,BM.bind(null,r,o,n,t),void 0,null),ho===null)throw Error(fe(349));Xc&30||LM(r,t,n)}return n}function LM(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},t=Cr.updateQueue,t===null?(t={lastEffect:null,stores:null},Cr.updateQueue=t,t.stores=[e]):(r=t.stores,r===null?t.stores=[e]:r.push(e))}function BM(e,t,r,o){t.value=r,t.getSnapshot=o,WM(t)&&HM(e)}function UM(e,t,r){return r(function(){WM(t)&&HM(e)})}function WM(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!Xa(e,r)}catch{return!0}}function HM(e){var t=us(e,1);t!==null&&Ka(t,e,1,-1)}function uF(e){var t=yi();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ov,lastRenderedState:e},t.queue=e,e=e.dispatch=Vae.bind(null,Cr,e),[t.memoizedState,e]}function nv(e,t,r,o){return e={tag:e,create:t,destroy:r,deps:o,next:null},t=Cr.updateQueue,t===null?(t={lastEffect:null,stores:null},Cr.updateQueue=t,t.lastEffect=e.next=e):(r=t.lastEffect,r===null?t.lastEffect=e.next=e:(o=r.next,r.next=e,e.next=o,t.lastEffect=e)),e}function VM(){return fa().memoizedState}function i0(e,t,r,o){var n=yi();Cr.flags|=e,n.memoizedState=nv(1|t,r,void 0,o===void 0?null:o)}function U0(e,t,r,o){var n=fa();o=o===void 0?null:o;var a=void 0;if(ro!==null){var i=ro.memoizedState;if(a=i.destroy,o!==null&&jT(o,i.deps)){n.memoizedState=nv(t,r,a,o);return}}Cr.flags|=e,n.memoizedState=nv(1|t,r,a,o)}function mF(e,t){return i0(8390656,8,e,t)}function KT(e,t){return U0(2048,8,e,t)}function jM(e,t){return U0(4,2,e,t)}function GM(e,t){return U0(4,4,e,t)}function qM(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function KM(e,t,r){return r=r!=null?r.concat([e]):null,U0(4,4,qM.bind(null,t,e),r)}function XT(){}function XM(e,t){var r=fa();t=t===void 0?null:t;var o=r.memoizedState;return o!==null&&t!==null&&jT(t,o[1])?o[0]:(r.memoizedState=[e,t],e)}function YM(e,t){var r=fa();t=t===void 0?null:t;var o=r.memoizedState;return o!==null&&t!==null&&jT(t,o[1])?o[0]:(e=e(),r.memoizedState=[e,t],e)}function QM(e,t,r){return Xc&21?(Xa(r,t)||(r=rM(),Cr.lanes|=r,Yc|=r,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,yn=!0),e.memoizedState=r)}function Wae(e,t){var r=Zt;Zt=r!==0&&4>r?r:4,e(!0);var o=bI.transition;bI.transition={};try{e(!1),t()}finally{Zt=r,bI.transition=o}}function JM(){return fa().memoizedState}function Hae(e,t,r){var o=dl(e);if(r={lane:o,action:r,hasEagerState:!1,eagerState:null,next:null},ZM(e))eO(t,r);else if(r=MM(e,t,r,o),r!==null){var n=Jo();Ka(r,e,o,n),tO(r,t,o)}}function Vae(e,t,r){var o=dl(e),n={lane:o,action:r,hasEagerState:!1,eagerState:null,next:null};if(ZM(e))eO(t,n);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var i=t.lastRenderedState,s=a(i,r);if(n.hasEagerState=!0,n.eagerState=s,Xa(s,i)){var c=t.interleaved;c===null?(n.next=n,BT(t)):(n.next=c.next,c.next=n),t.interleaved=n;return}}catch{}finally{}r=MM(e,t,n,o),r!==null&&(n=Jo(),Ka(r,e,o,n),tO(r,t,o))}}function ZM(e){var t=e.alternate;return e===Cr||t!==null&&t===Cr}function eO(e,t){Ly=C0=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function tO(e,t,r){if(r&4194240){var o=t.lanes;o&=e.pendingLanes,r|=o,t.lanes=r,IT(e,r)}}var N0={readContext:ma,useCallback:Mo,useContext:Mo,useEffect:Mo,useImperativeHandle:Mo,useInsertionEffect:Mo,useLayoutEffect:Mo,useMemo:Mo,useReducer:Mo,useRef:Mo,useState:Mo,useDebugValue:Mo,useDeferredValue:Mo,useTransition:Mo,useMutableSource:Mo,useSyncExternalStore:Mo,useId:Mo,unstable_isNewReconciler:!1},jae={readContext:ma,useCallback:function(e,t){return yi().memoizedState=[e,t===void 0?null:t],e},useContext:ma,useEffect:mF,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,i0(4194308,4,qM.bind(null,t,e),r)},useLayoutEffect:function(e,t){return i0(4194308,4,e,t)},useInsertionEffect:function(e,t){return i0(4,2,e,t)},useMemo:function(e,t){var r=yi();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var o=yi();return t=r!==void 0?r(t):t,o.memoizedState=o.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},o.queue=e,e=e.dispatch=Hae.bind(null,Cr,e),[o.memoizedState,e]},useRef:function(e){var t=yi();return e={current:e},t.memoizedState=e},useState:uF,useDebugValue:XT,useDeferredValue:function(e){return yi().memoizedState=e},useTransition:function(){var e=uF(!1),t=e[0];return e=Wae.bind(null,e[1]),yi().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var o=Cr,n=yi();if(wr){if(r===void 0)throw Error(fe(407));r=r()}else{if(r=t(),ho===null)throw Error(fe(349));Xc&30||LM(o,t,r)}n.memoizedState=r;var a={value:r,getSnapshot:t};return n.queue=a,mF(UM.bind(null,o,a,e),[e]),o.flags|=2048,nv(9,BM.bind(null,o,a,r,t),void 0,null),r},useId:function(){var e=yi(),t=ho.identifierPrefix;if(wr){var r=ss,o=is;r=(o&~(1<<32-qa(o)-1)).toString(32)+r,t=":"+t+"R"+r,r=rv++,0<r&&(t+="H"+r.toString(32)),t+=":"}else r=Uae++,t=":"+t+"r"+r.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Gae={readContext:ma,useCallback:XM,useContext:ma,useEffect:KT,useImperativeHandle:KM,useInsertionEffect:jM,useLayoutEffect:GM,useMemo:YM,useReducer:xI,useRef:VM,useState:function(){return xI(ov)},useDebugValue:XT,useDeferredValue:function(e){var t=fa();return QM(t,ro.memoizedState,e)},useTransition:function(){var e=xI(ov)[0],t=fa().memoizedState;return[e,t]},useMutableSource:zM,useSyncExternalStore:$M,useId:JM,unstable_isNewReconciler:!1},qae={readContext:ma,useCallback:XM,useContext:ma,useEffect:KT,useImperativeHandle:KM,useInsertionEffect:jM,useLayoutEffect:GM,useMemo:YM,useReducer:wI,useRef:VM,useState:function(){return wI(ov)},useDebugValue:XT,useDeferredValue:function(e){var t=fa();return ro===null?t.memoizedState=e:QM(t,ro.memoizedState,e)},useTransition:function(){var e=wI(ov)[0],t=fa().memoizedState;return[e,t]},useMutableSource:zM,useSyncExternalStore:$M,useId:JM,unstable_isNewReconciler:!1};function Va(e,t){if(e&&e.defaultProps){t=Nr({},t),e=e.defaultProps;for(var r in e)t[r]===void 0&&(t[r]=e[r]);return t}return t}function rT(e,t,r,o){t=e.memoizedState,r=r(o,t),r=r==null?t:Nr({},t,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var W0={isMounted:function(e){return(e=e._reactInternals)?Zc(e)===e:!1},enqueueSetState:function(e,t,r){e=e._reactInternals;var o=Jo(),n=dl(e),a=ls(o,n);a.payload=t,r!=null&&(a.callback=r),t=ml(e,a,n),t!==null&&(Ka(t,e,n,o),n0(t,e,n))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var o=Jo(),n=dl(e),a=ls(o,n);a.tag=1,a.payload=t,r!=null&&(a.callback=r),t=ml(e,a,n),t!==null&&(Ka(t,e,n,o),n0(t,e,n))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=Jo(),o=dl(e),n=ls(r,o);n.tag=2,t!=null&&(n.callback=t),t=ml(e,n,o),t!==null&&(Ka(t,e,o,r),n0(t,e,o))}};function fF(e,t,r,o,n,a,i){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(o,a,i):t.prototype&&t.prototype.isPureReactComponent?!Yy(r,o)||!Yy(n,a):!0}function rO(e,t,r){var o=!1,n=yl,a=t.contextType;return typeof a=="object"&&a!==null?a=ma(a):(n=bn(t)?qc:zo.current,o=t.contextTypes,a=(o=o!=null)?md(e,n):yl),t=new t(r,a),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=W0,e.stateNode=t,t._reactInternals=e,o&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=n,e.__reactInternalMemoizedMaskedChildContext=a),t}function dF(e,t,r,o){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(r,o),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(r,o),t.state!==e&&W0.enqueueReplaceState(t,t.state,null)}function oT(e,t,r,o){var n=e.stateNode;n.props=r,n.state=e.memoizedState,n.refs={},UT(e);var a=t.contextType;typeof a=="object"&&a!==null?n.context=ma(a):(a=bn(t)?qc:zo.current,n.context=md(e,a)),n.state=e.memoizedState,a=t.getDerivedStateFromProps,typeof a=="function"&&(rT(e,t,a,r),n.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof n.getSnapshotBeforeUpdate=="function"||typeof n.UNSAFE_componentWillMount!="function"&&typeof n.componentWillMount!="function"||(t=n.state,typeof n.componentWillMount=="function"&&n.componentWillMount(),typeof n.UNSAFE_componentWillMount=="function"&&n.UNSAFE_componentWillMount(),t!==n.state&&W0.enqueueReplaceState(n,n.state,null),I0(e,r,n,o),n.state=e.memoizedState),typeof n.componentDidMount=="function"&&(e.flags|=4194308)}function gd(e,t){try{var r="",o=t;do r+=kne(o),o=o.return;while(o);var n=r}catch(a){n=`
7
+ Error generating stack: `+a.message+`
8
+ `+a.stack}return{value:e,source:t,stack:n,digest:null}}function SI(e,t,r){return{value:e,source:null,stack:r??null,digest:t??null}}function nT(e,t){try{console.error(t.value)}catch(r){setTimeout(function(){throw r})}}var Kae=typeof WeakMap=="function"?WeakMap:Map;function oO(e,t,r){r=ls(-1,r),r.tag=3,r.payload={element:null};var o=t.value;return r.callback=function(){R0||(R0=!0,dT=o),nT(e,t)},r}function nO(e,t,r){r=ls(-1,r),r.tag=3;var o=e.type.getDerivedStateFromError;if(typeof o=="function"){var n=t.value;r.payload=function(){return o(n)},r.callback=function(){nT(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch=="function"&&(r.callback=function(){nT(e,t),typeof o!="function"&&(fl===null?fl=new Set([this]):fl.add(this));var i=t.stack;this.componentDidCatch(t.value,{componentStack:i!==null?i:""})}),r}function hF(e,t,r){var o=e.pingCache;if(o===null){o=e.pingCache=new Kae;var n=new Set;o.set(t,n)}else n=o.get(t),n===void 0&&(n=new Set,o.set(t,n));n.has(r)||(n.add(r),e=lie.bind(null,e,t,r),t.then(e,e))}function gF(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function yF(e,t,r,o,n){return e.mode&1?(e.flags|=65536,e.lanes=n,e):(e===t?e.flags|=65536:(e.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(t=ls(-1,1),t.tag=2,ml(r,t,1))),r.lanes|=1),e)}var Xae=fs.ReactCurrentOwner,yn=!1;function Qo(e,t,r,o){t.child=e===null?FM(t,null,r,o):dd(t,e.child,r,o)}function vF(e,t,r,o,n){r=r.render;var a=t.ref;return cd(t,n),o=GT(e,t,r,o,a,n),r=qT(),e!==null&&!yn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n,ms(e,t,n)):(wr&&r&&MT(t),t.flags|=1,Qo(e,t,o,n),t.child)}function bF(e,t,r,o,n){if(e===null){var a=r.type;return typeof a=="function"&&!oC(a)&&a.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(t.tag=15,t.type=a,aO(e,t,a,o,n)):(e=p0(r.type,null,o,t,t.mode,n),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!(e.lanes&n)){var i=a.memoizedProps;if(r=r.compare,r=r!==null?r:Yy,r(i,o)&&e.ref===t.ref)return ms(e,t,n)}return t.flags|=1,e=hl(a,o),e.ref=t.ref,e.return=t,t.child=e}function aO(e,t,r,o,n){if(e!==null){var a=e.memoizedProps;if(Yy(a,o)&&e.ref===t.ref)if(yn=!1,t.pendingProps=o=a,(e.lanes&n)!==0)e.flags&131072&&(yn=!0);else return t.lanes=e.lanes,ms(e,t,n)}return aT(e,t,r,o,n)}function iO(e,t,r){var o=t.pendingProps,n=o.children,a=e!==null?e.memoizedState:null;if(o.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},sr(nd,$n),$n|=r;else{if(!(r&1073741824))return e=a!==null?a.baseLanes|r:r,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,sr(nd,$n),$n|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},o=a!==null?a.baseLanes:r,sr(nd,$n),$n|=o}else a!==null?(o=a.baseLanes|r,t.memoizedState=null):o=r,sr(nd,$n),$n|=o;return Qo(e,t,n,r),t.child}function sO(e,t){var r=t.ref;(e===null&&r!==null||e!==null&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function aT(e,t,r,o,n){var a=bn(r)?qc:zo.current;return a=md(t,a),cd(t,n),r=GT(e,t,r,o,a,n),o=qT(),e!==null&&!yn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n,ms(e,t,n)):(wr&&o&&MT(t),t.flags|=1,Qo(e,t,r,n),t.child)}function xF(e,t,r,o,n){if(bn(r)){var a=!0;w0(t)}else a=!1;if(cd(t,n),t.stateNode===null)s0(e,t),rO(t,r,o),oT(t,r,o,n),o=!0;else if(e===null){var i=t.stateNode,s=t.memoizedProps;i.props=s;var c=i.context,l=r.contextType;typeof l=="object"&&l!==null?l=ma(l):(l=bn(r)?qc:zo.current,l=md(t,l));var p=r.getDerivedStateFromProps,u=typeof p=="function"||typeof i.getSnapshotBeforeUpdate=="function";u||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(s!==o||c!==l)&&dF(t,i,o,l),ol=!1;var m=t.memoizedState;i.state=m,I0(t,o,i,n),c=t.memoizedState,s!==o||m!==c||vn.current||ol?(typeof p=="function"&&(rT(t,r,p,o),c=t.memoizedState),(s=ol||fF(t,r,s,o,m,c,l))?(u||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount()),typeof i.componentDidMount=="function"&&(t.flags|=4194308)):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=o,t.memoizedState=c),i.props=o,i.state=c,i.context=l,o=s):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),o=!1)}else{i=t.stateNode,OM(e,t),s=t.memoizedProps,l=t.type===t.elementType?s:Va(t.type,s),i.props=l,u=t.pendingProps,m=i.context,c=r.contextType,typeof c=="object"&&c!==null?c=ma(c):(c=bn(r)?qc:zo.current,c=md(t,c));var f=r.getDerivedStateFromProps;(p=typeof f=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(s!==u||m!==c)&&dF(t,i,o,c),ol=!1,m=t.memoizedState,i.state=m,I0(t,o,i,n);var d=t.memoizedState;s!==u||m!==d||vn.current||ol?(typeof f=="function"&&(rT(t,r,f,o),d=t.memoizedState),(l=ol||fF(t,r,l,o,m,d,c)||!1)?(p||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(o,d,c),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(o,d,c)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||s===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||s===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),t.memoizedProps=o,t.memoizedState=d),i.props=o,i.state=d,i.context=c,o=l):(typeof i.componentDidUpdate!="function"||s===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||s===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),o=!1)}return iT(e,t,r,o,a,n)}function iT(e,t,r,o,n,a){sO(e,t);var i=(t.flags&128)!==0;if(!o&&!i)return n&&aF(t,r,!1),ms(e,t,a);o=t.stateNode,Xae.current=t;var s=i&&typeof r.getDerivedStateFromError!="function"?null:o.render();return t.flags|=1,e!==null&&i?(t.child=dd(t,e.child,null,a),t.child=dd(t,null,s,a)):Qo(e,t,s,a),t.memoizedState=o.state,n&&aF(t,r,!0),t.child}function lO(e){var t=e.stateNode;t.pendingContext?nF(e,t.pendingContext,t.pendingContext!==t.context):t.context&&nF(e,t.context,!1),WT(e,t.containerInfo)}function wF(e,t,r,o,n){return fd(),PT(n),t.flags|=256,Qo(e,t,r,o),t.child}var sT={dehydrated:null,treeContext:null,retryLane:0};function lT(e){return{baseLanes:e,cachePool:null,transitions:null}}function cO(e,t,r){var o=t.pendingProps,n=Tr.current,a=!1,i=(t.flags&128)!==0,s;if((s=i)||(s=e!==null&&e.memoizedState===null?!1:(n&2)!==0),s?(a=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(n|=1),sr(Tr,n&1),e===null)return eT(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(i=o.children,e=o.fallback,a?(o=t.mode,a=t.child,i={mode:"hidden",children:i},!(o&1)&&a!==null?(a.childLanes=0,a.pendingProps=i):a=j0(i,o,0,null),e=Gc(e,o,r,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=lT(r),t.memoizedState=sT,e):YT(t,i));if(n=e.memoizedState,n!==null&&(s=n.dehydrated,s!==null))return Yae(e,t,i,o,s,n,r);if(a){a=o.fallback,i=t.mode,n=e.child,s=n.sibling;var c={mode:"hidden",children:o.children};return!(i&1)&&t.child!==n?(o=t.child,o.childLanes=0,o.pendingProps=c,t.deletions=null):(o=hl(n,c),o.subtreeFlags=n.subtreeFlags&14680064),s!==null?a=hl(s,a):(a=Gc(a,i,r,null),a.flags|=2),a.return=t,o.return=t,o.sibling=a,t.child=o,o=a,a=t.child,i=e.child.memoizedState,i=i===null?lT(r):{baseLanes:i.baseLanes|r,cachePool:null,transitions:i.transitions},a.memoizedState=i,a.childLanes=e.childLanes&~r,t.memoizedState=sT,o}return a=e.child,e=a.sibling,o=hl(a,{mode:"visible",children:o.children}),!(t.mode&1)&&(o.lanes=r),o.return=t,o.sibling=null,e!==null&&(r=t.deletions,r===null?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=o,t.memoizedState=null,o}function YT(e,t){return t=j0({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Jx(e,t,r,o){return o!==null&&PT(o),dd(t,e.child,null,r),e=YT(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Yae(e,t,r,o,n,a,i){if(r)return t.flags&256?(t.flags&=-257,o=SI(Error(fe(422))),Jx(e,t,i,o)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(a=o.fallback,n=t.mode,o=j0({mode:"visible",children:o.children},n,0,null),a=Gc(a,n,i,null),a.flags|=2,o.return=t,a.return=t,o.sibling=a,t.child=o,t.mode&1&&dd(t,e.child,null,i),t.child.memoizedState=lT(i),t.memoizedState=sT,a);if(!(t.mode&1))return Jx(e,t,i,null);if(n.data==="$!"){if(o=n.nextSibling&&n.nextSibling.dataset,o)var s=o.dgst;return o=s,a=Error(fe(419)),o=SI(a,o,void 0),Jx(e,t,i,o)}if(s=(i&e.childLanes)!==0,yn||s){if(o=ho,o!==null){switch(i&-i){case 4:n=2;break;case 16:n=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:n=32;break;case 536870912:n=268435456;break;default:n=0}n=n&(o.suspendedLanes|i)?0:n,n!==0&&n!==a.retryLane&&(a.retryLane=n,us(e,n),Ka(o,e,n,-1))}return rC(),o=SI(Error(fe(421))),Jx(e,t,i,o)}return n.data==="$?"?(t.flags|=128,t.child=e.child,t=cie.bind(null,e),n._reactRetry=t,null):(e=a.treeContext,Ln=ul(n.nextSibling),Bn=t,wr=!0,Ga=null,e!==null&&(la[ca++]=is,la[ca++]=ss,la[ca++]=Kc,is=e.id,ss=e.overflow,Kc=t),t=YT(t,o.children),t.flags|=4096,t)}function SF(e,t,r){e.lanes|=t;var o=e.alternate;o!==null&&(o.lanes|=t),tT(e.return,t,r)}function kI(e,t,r,o,n){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:o,tail:r,tailMode:n}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=o,a.tail=r,a.tailMode=n)}function pO(e,t,r){var o=t.pendingProps,n=o.revealOrder,a=o.tail;if(Qo(e,t,o.children,r),o=Tr.current,o&2)o=o&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&SF(e,r,t);else if(e.tag===19)SF(e,r,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}o&=1}if(sr(Tr,o),!(t.mode&1))t.memoizedState=null;else switch(n){case"forwards":for(r=t.child,n=null;r!==null;)e=r.alternate,e!==null&&T0(e)===null&&(n=r),r=r.sibling;r=n,r===null?(n=t.child,t.child=null):(n=r.sibling,r.sibling=null),kI(t,!1,n,r,a);break;case"backwards":for(r=null,n=t.child,t.child=null;n!==null;){if(e=n.alternate,e!==null&&T0(e)===null){t.child=n;break}e=n.sibling,n.sibling=r,r=n,n=e}kI(t,!0,r,null,a);break;case"together":kI(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function s0(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function ms(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),Yc|=t.lanes,!(r&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(fe(153));if(t.child!==null){for(e=t.child,r=hl(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=hl(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function Qae(e,t,r){switch(t.tag){case 3:lO(t),fd();break;case 5:PM(t);break;case 1:bn(t.type)&&w0(t);break;case 4:WT(t,t.stateNode.containerInfo);break;case 10:var o=t.type._context,n=t.memoizedProps.value;sr(_0,o._currentValue),o._currentValue=n;break;case 13:if(o=t.memoizedState,o!==null)return o.dehydrated!==null?(sr(Tr,Tr.current&1),t.flags|=128,null):r&t.child.childLanes?cO(e,t,r):(sr(Tr,Tr.current&1),e=ms(e,t,r),e!==null?e.sibling:null);sr(Tr,Tr.current&1);break;case 19:if(o=(r&t.childLanes)!==0,e.flags&128){if(o)return pO(e,t,r);t.flags|=128}if(n=t.memoizedState,n!==null&&(n.rendering=null,n.tail=null,n.lastEffect=null),sr(Tr,Tr.current),o)break;return null;case 22:case 23:return t.lanes=0,iO(e,t,r)}return ms(e,t,r)}var uO,cT,mO,fO;uO=function(e,t){for(var r=t.child;r!==null;){if(r.tag===5||r.tag===6)e.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};cT=function(){};mO=function(e,t,r,o){var n=e.memoizedProps;if(n!==o){e=t.stateNode,Vc(xi.current);var a=null;switch(r){case"input":n=RI(e,n),o=RI(e,o),a=[];break;case"select":n=Nr({},n,{value:void 0}),o=Nr({},o,{value:void 0}),a=[];break;case"textarea":n=MI(e,n),o=MI(e,o),a=[];break;default:typeof n.onClick!="function"&&typeof o.onClick=="function"&&(e.onclick=b0)}PI(r,o);var i;r=null;for(l in n)if(!o.hasOwnProperty(l)&&n.hasOwnProperty(l)&&n[l]!=null)if(l==="style"){var s=n[l];for(i in s)s.hasOwnProperty(i)&&(r||(r={}),r[i]="")}else l!=="dangerouslySetInnerHTML"&&l!=="children"&&l!=="suppressContentEditableWarning"&&l!=="suppressHydrationWarning"&&l!=="autoFocus"&&(Hy.hasOwnProperty(l)?a||(a=[]):(a=a||[]).push(l,null));for(l in o){var c=o[l];if(s=n?.[l],o.hasOwnProperty(l)&&c!==s&&(c!=null||s!=null))if(l==="style")if(s){for(i in s)!s.hasOwnProperty(i)||c&&c.hasOwnProperty(i)||(r||(r={}),r[i]="");for(i in c)c.hasOwnProperty(i)&&s[i]!==c[i]&&(r||(r={}),r[i]=c[i])}else r||(a||(a=[]),a.push(l,r)),r=c;else l==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,s=s?s.__html:void 0,c!=null&&s!==c&&(a=a||[]).push(l,c)):l==="children"?typeof c!="string"&&typeof c!="number"||(a=a||[]).push(l,""+c):l!=="suppressContentEditableWarning"&&l!=="suppressHydrationWarning"&&(Hy.hasOwnProperty(l)?(c!=null&&l==="onScroll"&&fr("scroll",e),a||s===c||(a=[])):(a=a||[]).push(l,c))}r&&(a=a||[]).push("style",r);var l=a;(t.updateQueue=l)&&(t.flags|=4)}};fO=function(e,t,r,o){r!==o&&(t.flags|=4)};function Ty(e,t){if(!wr)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var o=null;r!==null;)r.alternate!==null&&(o=r),r=r.sibling;o===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:o.sibling=null}}function Oo(e){var t=e.alternate!==null&&e.alternate.child===e.child,r=0,o=0;if(t)for(var n=e.child;n!==null;)r|=n.lanes|n.childLanes,o|=n.subtreeFlags&14680064,o|=n.flags&14680064,n.return=e,n=n.sibling;else for(n=e.child;n!==null;)r|=n.lanes|n.childLanes,o|=n.subtreeFlags,o|=n.flags,n.return=e,n=n.sibling;return e.subtreeFlags|=o,e.childLanes=r,t}function Jae(e,t,r){var o=t.pendingProps;switch(OT(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Oo(t),null;case 1:return bn(t.type)&&x0(),Oo(t),null;case 3:return o=t.stateNode,hd(),dr(vn),dr(zo),VT(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(e===null||e.child===null)&&(Yx(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ga!==null&&(yT(Ga),Ga=null))),cT(e,t),Oo(t),null;case 5:HT(t);var n=Vc(tv.current);if(r=t.type,e!==null&&t.stateNode!=null)mO(e,t,r,o,n),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!o){if(t.stateNode===null)throw Error(fe(166));return Oo(t),null}if(e=Vc(xi.current),Yx(t)){o=t.stateNode,r=t.type;var a=t.memoizedProps;switch(o[vi]=t,o[Zy]=a,e=(t.mode&1)!==0,r){case"dialog":fr("cancel",o),fr("close",o);break;case"iframe":case"object":case"embed":fr("load",o);break;case"video":case"audio":for(n=0;n<Fy.length;n++)fr(Fy[n],o);break;case"source":fr("error",o);break;case"img":case"image":case"link":fr("error",o),fr("load",o);break;case"details":fr("toggle",o);break;case"input":A4(o,a),fr("invalid",o);break;case"select":o._wrapperState={wasMultiple:!!a.multiple},fr("invalid",o);break;case"textarea":D4(o,a),fr("invalid",o)}PI(r,a),n=null;for(var i in a)if(a.hasOwnProperty(i)){var s=a[i];i==="children"?typeof s=="string"?o.textContent!==s&&(a.suppressHydrationWarning!==!0&&Xx(o.textContent,s,e),n=["children",s]):typeof s=="number"&&o.textContent!==""+s&&(a.suppressHydrationWarning!==!0&&Xx(o.textContent,s,e),n=["children",""+s]):Hy.hasOwnProperty(i)&&s!=null&&i==="onScroll"&&fr("scroll",o)}switch(r){case"input":zx(o),R4(o,a,!0);break;case"textarea":zx(o),F4(o);break;case"select":case"option":break;default:typeof a.onClick=="function"&&(o.onclick=b0)}o=n,t.updateQueue=o,o!==null&&(t.flags|=4)}else{i=n.nodeType===9?n:n.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=UF(r)),e==="http://www.w3.org/1999/xhtml"?r==="script"?(e=i.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof o.is=="string"?e=i.createElement(r,{is:o.is}):(e=i.createElement(r),r==="select"&&(i=e,o.multiple?i.multiple=!0:o.size&&(i.size=o.size))):e=i.createElementNS(e,r),e[vi]=t,e[Zy]=o,uO(e,t,!1,!1),t.stateNode=e;e:{switch(i=zI(r,o),r){case"dialog":fr("cancel",e),fr("close",e),n=o;break;case"iframe":case"object":case"embed":fr("load",e),n=o;break;case"video":case"audio":for(n=0;n<Fy.length;n++)fr(Fy[n],e);n=o;break;case"source":fr("error",e),n=o;break;case"img":case"image":case"link":fr("error",e),fr("load",e),n=o;break;case"details":fr("toggle",e),n=o;break;case"input":A4(e,o),n=RI(e,o),fr("invalid",e);break;case"option":n=o;break;case"select":e._wrapperState={wasMultiple:!!o.multiple},n=Nr({},o,{value:void 0}),fr("invalid",e);break;case"textarea":D4(e,o),n=MI(e,o),fr("invalid",e);break;default:n=o}PI(r,n),s=n;for(a in s)if(s.hasOwnProperty(a)){var c=s[a];a==="style"?VF(e,c):a==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&WF(e,c)):a==="children"?typeof c=="string"?(r!=="textarea"||c!=="")&&Vy(e,c):typeof c=="number"&&Vy(e,""+c):a!=="suppressContentEditableWarning"&&a!=="suppressHydrationWarning"&&a!=="autoFocus"&&(Hy.hasOwnProperty(a)?c!=null&&a==="onScroll"&&fr("scroll",e):c!=null&&xT(e,a,c,i))}switch(r){case"input":zx(e),R4(e,o,!1);break;case"textarea":zx(e),F4(e);break;case"option":o.value!=null&&e.setAttribute("value",""+gl(o.value));break;case"select":e.multiple=!!o.multiple,a=o.value,a!=null?ad(e,!!o.multiple,a,!1):o.defaultValue!=null&&ad(e,!!o.multiple,o.defaultValue,!0);break;default:typeof n.onClick=="function"&&(e.onclick=b0)}switch(r){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}}o&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Oo(t),null;case 6:if(e&&t.stateNode!=null)fO(e,t,e.memoizedProps,o);else{if(typeof o!="string"&&t.stateNode===null)throw Error(fe(166));if(r=Vc(tv.current),Vc(xi.current),Yx(t)){if(o=t.stateNode,r=t.memoizedProps,o[vi]=t,(a=o.nodeValue!==r)&&(e=Bn,e!==null))switch(e.tag){case 3:Xx(o.nodeValue,r,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Xx(o.nodeValue,r,(e.mode&1)!==0)}a&&(t.flags|=4)}else o=(r.nodeType===9?r:r.ownerDocument).createTextNode(o),o[vi]=t,t.stateNode=o}return Oo(t),null;case 13:if(dr(Tr),o=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(wr&&Ln!==null&&t.mode&1&&!(t.flags&128))RM(),fd(),t.flags|=98560,a=!1;else if(a=Yx(t),o!==null&&o.dehydrated!==null){if(e===null){if(!a)throw Error(fe(318));if(a=t.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(fe(317));a[vi]=t}else fd(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Oo(t),a=!1}else Ga!==null&&(yT(Ga),Ga=null),a=!0;if(!a)return t.flags&65536?t:null}return t.flags&128?(t.lanes=r,t):(o=o!==null,o!==(e!==null&&e.memoizedState!==null)&&o&&(t.child.flags|=8192,t.mode&1&&(e===null||Tr.current&1?oo===0&&(oo=3):rC())),t.updateQueue!==null&&(t.flags|=4),Oo(t),null);case 4:return hd(),cT(e,t),e===null&&Qy(t.stateNode.containerInfo),Oo(t),null;case 10:return LT(t.type._context),Oo(t),null;case 17:return bn(t.type)&&x0(),Oo(t),null;case 19:if(dr(Tr),a=t.memoizedState,a===null)return Oo(t),null;if(o=(t.flags&128)!==0,i=a.rendering,i===null)if(o)Ty(a,!1);else{if(oo!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=T0(e),i!==null){for(t.flags|=128,Ty(a,!1),o=i.updateQueue,o!==null&&(t.updateQueue=o,t.flags|=4),t.subtreeFlags=0,o=r,r=t.child;r!==null;)a=r,e=o,a.flags&=14680066,i=a.alternate,i===null?(a.childLanes=0,a.lanes=e,a.child=null,a.subtreeFlags=0,a.memoizedProps=null,a.memoizedState=null,a.updateQueue=null,a.dependencies=null,a.stateNode=null):(a.childLanes=i.childLanes,a.lanes=i.lanes,a.child=i.child,a.subtreeFlags=0,a.deletions=null,a.memoizedProps=i.memoizedProps,a.memoizedState=i.memoizedState,a.updateQueue=i.updateQueue,a.type=i.type,e=i.dependencies,a.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),r=r.sibling;return sr(Tr,Tr.current&1|2),t.child}e=e.sibling}a.tail!==null&&Hr()>yd&&(t.flags|=128,o=!0,Ty(a,!1),t.lanes=4194304)}else{if(!o)if(e=T0(i),e!==null){if(t.flags|=128,o=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),Ty(a,!0),a.tail===null&&a.tailMode==="hidden"&&!i.alternate&&!wr)return Oo(t),null}else 2*Hr()-a.renderingStartTime>yd&&r!==1073741824&&(t.flags|=128,o=!0,Ty(a,!1),t.lanes=4194304);a.isBackwards?(i.sibling=t.child,t.child=i):(r=a.last,r!==null?r.sibling=i:t.child=i,a.last=i)}return a.tail!==null?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=Hr(),t.sibling=null,r=Tr.current,sr(Tr,o?r&1|2:r&1),t):(Oo(t),null);case 22:case 23:return tC(),o=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==o&&(t.flags|=8192),o&&t.mode&1?$n&1073741824&&(Oo(t),t.subtreeFlags&6&&(t.flags|=8192)):Oo(t),null;case 24:return null;case 25:return null}throw Error(fe(156,t.tag))}function Zae(e,t){switch(OT(t),t.tag){case 1:return bn(t.type)&&x0(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return hd(),dr(vn),dr(zo),VT(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return HT(t),null;case 13:if(dr(Tr),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(fe(340));fd()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return dr(Tr),null;case 4:return hd(),null;case 10:return LT(t.type._context),null;case 22:case 23:return tC(),null;case 24:return null;default:return null}}var Zx=!1,Po=!1,eie=typeof WeakSet=="function"?WeakSet:Set,Ce=null;function od(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(o){Pr(e,t,o)}else r.current=null}function pT(e,t,r){try{r()}catch(o){Pr(e,t,o)}}var kF=!1;function tie(e,t){if(qI=g0,e=vM(),FT(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var o=r.getSelection&&r.getSelection();if(o&&o.rangeCount!==0){r=o.anchorNode;var n=o.anchorOffset,a=o.focusNode;o=o.focusOffset;try{r.nodeType,a.nodeType}catch{r=null;break e}var i=0,s=-1,c=-1,l=0,p=0,u=e,m=null;t:for(;;){for(var f;u!==r||n!==0&&u.nodeType!==3||(s=i+n),u!==a||o!==0&&u.nodeType!==3||(c=i+o),u.nodeType===3&&(i+=u.nodeValue.length),(f=u.firstChild)!==null;)m=u,u=f;for(;;){if(u===e)break t;if(m===r&&++l===n&&(s=i),m===a&&++p===o&&(c=i),(f=u.nextSibling)!==null)break;u=m,m=u.parentNode}u=f}r=s===-1||c===-1?null:{start:s,end:c}}else r=null}r=r||{start:0,end:0}}else r=null;for(KI={focusedElem:e,selectionRange:r},g0=!1,Ce=t;Ce!==null;)if(t=Ce,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ce=e;else for(;Ce!==null;){t=Ce;try{var d=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(d!==null){var h=d.memoizedProps,y=d.memoizedState,g=t.stateNode,b=g.getSnapshotBeforeUpdate(t.elementType===t.type?h:Va(t.type,h),y);g.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var x=t.stateNode.containerInfo;x.nodeType===1?x.textContent="":x.nodeType===9&&x.documentElement&&x.removeChild(x.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(fe(163))}}catch(w){Pr(t,t.return,w)}if(e=t.sibling,e!==null){e.return=t.return,Ce=e;break}Ce=t.return}return d=kF,kF=!1,d}function By(e,t,r){var o=t.updateQueue;if(o=o!==null?o.lastEffect:null,o!==null){var n=o=o.next;do{if((n.tag&e)===e){var a=n.destroy;n.destroy=void 0,a!==void 0&&pT(t,r,a)}n=n.next}while(n!==o)}}function H0(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var o=r.create;r.destroy=o()}r=r.next}while(r!==t)}}function uT(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function dO(e){var t=e.alternate;t!==null&&(e.alternate=null,dO(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[vi],delete t[Zy],delete t[QI],delete t[zae],delete t[$ae])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function hO(e){return e.tag===5||e.tag===3||e.tag===4}function _F(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||hO(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function mT(e,t,r){var o=e.tag;if(o===5||o===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=b0));else if(o!==4&&(e=e.child,e!==null))for(mT(e,t,r),e=e.sibling;e!==null;)mT(e,t,r),e=e.sibling}function fT(e,t,r){var o=e.tag;if(o===5||o===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(o!==4&&(e=e.child,e!==null))for(fT(e,t,r),e=e.sibling;e!==null;)fT(e,t,r),e=e.sibling}var _o=null,ja=!1;function tl(e,t,r){for(r=r.child;r!==null;)gO(e,t,r),r=r.sibling}function gO(e,t,r){if(bi&&typeof bi.onCommitFiberUnmount=="function")try{bi.onCommitFiberUnmount(O0,r)}catch{}switch(r.tag){case 5:Po||od(r,t);case 6:var o=_o,n=ja;_o=null,tl(e,t,r),_o=o,ja=n,_o!==null&&(ja?(e=_o,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):_o.removeChild(r.stateNode));break;case 18:_o!==null&&(ja?(e=_o,r=r.stateNode,e.nodeType===8?gI(e.parentNode,r):e.nodeType===1&&gI(e,r),Ky(e)):gI(_o,r.stateNode));break;case 4:o=_o,n=ja,_o=r.stateNode.containerInfo,ja=!0,tl(e,t,r),_o=o,ja=n;break;case 0:case 11:case 14:case 15:if(!Po&&(o=r.updateQueue,o!==null&&(o=o.lastEffect,o!==null))){n=o=o.next;do{var a=n,i=a.destroy;a=a.tag,i!==void 0&&(a&2||a&4)&&pT(r,t,i),n=n.next}while(n!==o)}tl(e,t,r);break;case 1:if(!Po&&(od(r,t),o=r.stateNode,typeof o.componentWillUnmount=="function"))try{o.props=r.memoizedProps,o.state=r.memoizedState,o.componentWillUnmount()}catch(s){Pr(r,t,s)}tl(e,t,r);break;case 21:tl(e,t,r);break;case 22:r.mode&1?(Po=(o=Po)||r.memoizedState!==null,tl(e,t,r),Po=o):tl(e,t,r);break;default:tl(e,t,r)}}function EF(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new eie),t.forEach(function(o){var n=pie.bind(null,e,o);r.has(o)||(r.add(o),o.then(n,n))})}}function Ha(e,t){var r=t.deletions;if(r!==null)for(var o=0;o<r.length;o++){var n=r[o];try{var a=e,i=t,s=i;e:for(;s!==null;){switch(s.tag){case 5:_o=s.stateNode,ja=!1;break e;case 3:_o=s.stateNode.containerInfo,ja=!0;break e;case 4:_o=s.stateNode.containerInfo,ja=!0;break e}s=s.return}if(_o===null)throw Error(fe(160));gO(a,i,n),_o=null,ja=!1;var c=n.alternate;c!==null&&(c.return=null),n.return=null}catch(l){Pr(n,t,l)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)yO(t,e),t=t.sibling}function yO(e,t){var r=e.alternate,o=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Ha(t,e),gi(e),o&4){try{By(3,e,e.return),H0(3,e)}catch(h){Pr(e,e.return,h)}try{By(5,e,e.return)}catch(h){Pr(e,e.return,h)}}break;case 1:Ha(t,e),gi(e),o&512&&r!==null&&od(r,r.return);break;case 5:if(Ha(t,e),gi(e),o&512&&r!==null&&od(r,r.return),e.flags&32){var n=e.stateNode;try{Vy(n,"")}catch(h){Pr(e,e.return,h)}}if(o&4&&(n=e.stateNode,n!=null)){var a=e.memoizedProps,i=r!==null?r.memoizedProps:a,s=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{s==="input"&&a.type==="radio"&&a.name!=null&&LF(n,a),zI(s,i);var l=zI(s,a);for(i=0;i<c.length;i+=2){var p=c[i],u=c[i+1];p==="style"?VF(n,u):p==="dangerouslySetInnerHTML"?WF(n,u):p==="children"?Vy(n,u):xT(n,p,u,l)}switch(s){case"input":DI(n,a);break;case"textarea":BF(n,a);break;case"select":var m=n._wrapperState.wasMultiple;n._wrapperState.wasMultiple=!!a.multiple;var f=a.value;f!=null?ad(n,!!a.multiple,f,!1):m!==!!a.multiple&&(a.defaultValue!=null?ad(n,!!a.multiple,a.defaultValue,!0):ad(n,!!a.multiple,a.multiple?[]:"",!1))}n[Zy]=a}catch(h){Pr(e,e.return,h)}}break;case 6:if(Ha(t,e),gi(e),o&4){if(e.stateNode===null)throw Error(fe(162));n=e.stateNode,a=e.memoizedProps;try{n.nodeValue=a}catch(h){Pr(e,e.return,h)}}break;case 3:if(Ha(t,e),gi(e),o&4&&r!==null&&r.memoizedState.isDehydrated)try{Ky(t.containerInfo)}catch(h){Pr(e,e.return,h)}break;case 4:Ha(t,e),gi(e);break;case 13:Ha(t,e),gi(e),n=e.child,n.flags&8192&&(a=n.memoizedState!==null,n.stateNode.isHidden=a,!a||n.alternate!==null&&n.alternate.memoizedState!==null||(ZT=Hr())),o&4&&EF(e);break;case 22:if(p=r!==null&&r.memoizedState!==null,e.mode&1?(Po=(l=Po)||p,Ha(t,e),Po=l):Ha(t,e),gi(e),o&8192){if(l=e.memoizedState!==null,(e.stateNode.isHidden=l)&&!p&&e.mode&1)for(Ce=e,p=e.child;p!==null;){for(u=Ce=p;Ce!==null;){switch(m=Ce,f=m.child,m.tag){case 0:case 11:case 14:case 15:By(4,m,m.return);break;case 1:od(m,m.return);var d=m.stateNode;if(typeof d.componentWillUnmount=="function"){o=m,r=m.return;try{t=o,d.props=t.memoizedProps,d.state=t.memoizedState,d.componentWillUnmount()}catch(h){Pr(o,r,h)}}break;case 5:od(m,m.return);break;case 22:if(m.memoizedState!==null){TF(u);continue}}f!==null?(f.return=m,Ce=f):TF(u)}p=p.sibling}e:for(p=null,u=e;;){if(u.tag===5){if(p===null){p=u;try{n=u.stateNode,l?(a=n.style,typeof a.setProperty=="function"?a.setProperty("display","none","important"):a.display="none"):(s=u.stateNode,c=u.memoizedProps.style,i=c!=null&&c.hasOwnProperty("display")?c.display:null,s.style.display=HF("display",i))}catch(h){Pr(e,e.return,h)}}}else if(u.tag===6){if(p===null)try{u.stateNode.nodeValue=l?"":u.memoizedProps}catch(h){Pr(e,e.return,h)}}else if((u.tag!==22&&u.tag!==23||u.memoizedState===null||u===e)&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===e)break e;for(;u.sibling===null;){if(u.return===null||u.return===e)break e;p===u&&(p=null),u=u.return}p===u&&(p=null),u.sibling.return=u.return,u=u.sibling}}break;case 19:Ha(t,e),gi(e),o&4&&EF(e);break;case 21:break;default:Ha(t,e),gi(e)}}function gi(e){var t=e.flags;if(t&2){try{e:{for(var r=e.return;r!==null;){if(hO(r)){var o=r;break e}r=r.return}throw Error(fe(160))}switch(o.tag){case 5:var n=o.stateNode;o.flags&32&&(Vy(n,""),o.flags&=-33);var a=_F(e);fT(e,a,n);break;case 3:case 4:var i=o.stateNode.containerInfo,s=_F(e);mT(e,s,i);break;default:throw Error(fe(161))}}catch(c){Pr(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function rie(e,t,r){Ce=e,vO(e,t,r)}function vO(e,t,r){for(var o=(e.mode&1)!==0;Ce!==null;){var n=Ce,a=n.child;if(n.tag===22&&o){var i=n.memoizedState!==null||Zx;if(!i){var s=n.alternate,c=s!==null&&s.memoizedState!==null||Po;s=Zx;var l=Po;if(Zx=i,(Po=c)&&!l)for(Ce=n;Ce!==null;)i=Ce,c=i.child,i.tag===22&&i.memoizedState!==null?CF(n):c!==null?(c.return=i,Ce=c):CF(n);for(;a!==null;)Ce=a,vO(a,t,r),a=a.sibling;Ce=n,Zx=s,Po=l}IF(e,t,r)}else n.subtreeFlags&8772&&a!==null?(a.return=n,Ce=a):IF(e,t,r)}}function IF(e){for(;Ce!==null;){var t=Ce;if(t.flags&8772){var r=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Po||H0(5,t);break;case 1:var o=t.stateNode;if(t.flags&4&&!Po)if(r===null)o.componentDidMount();else{var n=t.elementType===t.type?r.memoizedProps:Va(t.type,r.memoizedProps);o.componentDidUpdate(n,r.memoizedState,o.__reactInternalSnapshotBeforeUpdate)}var a=t.updateQueue;a!==null&&pF(t,a,o);break;case 3:var i=t.updateQueue;if(i!==null){if(r=null,t.child!==null)switch(t.child.tag){case 5:r=t.child.stateNode;break;case 1:r=t.child.stateNode}pF(t,i,r)}break;case 5:var s=t.stateNode;if(r===null&&t.flags&4){r=s;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&r.focus();break;case"img":c.src&&(r.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var l=t.alternate;if(l!==null){var p=l.memoizedState;if(p!==null){var u=p.dehydrated;u!==null&&Ky(u)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(fe(163))}Po||t.flags&512&&uT(t)}catch(m){Pr(t,t.return,m)}}if(t===e){Ce=null;break}if(r=t.sibling,r!==null){r.return=t.return,Ce=r;break}Ce=t.return}}function TF(e){for(;Ce!==null;){var t=Ce;if(t===e){Ce=null;break}var r=t.sibling;if(r!==null){r.return=t.return,Ce=r;break}Ce=t.return}}function CF(e){for(;Ce!==null;){var t=Ce;try{switch(t.tag){case 0:case 11:case 15:var r=t.return;try{H0(4,t)}catch(c){Pr(t,r,c)}break;case 1:var o=t.stateNode;if(typeof o.componentDidMount=="function"){var n=t.return;try{o.componentDidMount()}catch(c){Pr(t,n,c)}}var a=t.return;try{uT(t)}catch(c){Pr(t,a,c)}break;case 5:var i=t.return;try{uT(t)}catch(c){Pr(t,i,c)}}}catch(c){Pr(t,t.return,c)}if(t===e){Ce=null;break}var s=t.sibling;if(s!==null){s.return=t.return,Ce=s;break}Ce=t.return}}var oie=Math.ceil,A0=fs.ReactCurrentDispatcher,QT=fs.ReactCurrentOwner,ua=fs.ReactCurrentBatchConfig,Bt=0,ho=null,Xr=null,Eo=0,$n=0,nd=bl(0),oo=0,av=null,Yc=0,V0=0,JT=0,Uy=null,gn=null,ZT=0,yd=1/0,ns=null,R0=!1,dT=null,fl=null,e0=!1,sl=null,D0=0,Wy=0,hT=null,l0=-1,c0=0;function Jo(){return Bt&6?Hr():l0!==-1?l0:l0=Hr()}function dl(e){return e.mode&1?Bt&2&&Eo!==0?Eo&-Eo:Bae.transition!==null?(c0===0&&(c0=rM()),c0):(e=Zt,e!==0||(e=window.event,e=e===void 0?16:cM(e.type)),e):1}function Ka(e,t,r,o){if(50<Wy)throw Wy=0,hT=null,Error(fe(185));iv(e,r,o),(!(Bt&2)||e!==ho)&&(e===ho&&(!(Bt&2)&&(V0|=r),oo===4&&al(e,Eo)),xn(e,o),r===1&&Bt===0&&!(t.mode&1)&&(yd=Hr()+500,B0&&xl()))}function xn(e,t){var r=e.callbackNode;Wne(e,t);var o=h0(e,e===ho?Eo:0);if(o===0)r!==null&&P4(r),e.callbackNode=null,e.callbackPriority=0;else if(t=o&-o,e.callbackPriority!==t){if(r!=null&&P4(r),t===1)e.tag===0?Lae(NF.bind(null,e)):CM(NF.bind(null,e)),Oae(function(){!(Bt&6)&&xl()}),r=null;else{switch(oM(o)){case 1:r=ET;break;case 4:r=eM;break;case 16:r=d0;break;case 536870912:r=tM;break;default:r=d0}r=IO(r,bO.bind(null,e))}e.callbackPriority=t,e.callbackNode=r}}function bO(e,t){if(l0=-1,c0=0,Bt&6)throw Error(fe(327));var r=e.callbackNode;if(pd()&&e.callbackNode!==r)return null;var o=h0(e,e===ho?Eo:0);if(o===0)return null;if(o&30||o&e.expiredLanes||t)t=F0(e,o);else{t=o;var n=Bt;Bt|=2;var a=wO();(ho!==e||Eo!==t)&&(ns=null,yd=Hr()+500,jc(e,t));do try{iie();break}catch(s){xO(e,s)}while(!0);$T(),A0.current=a,Bt=n,Xr!==null?t=0:(ho=null,Eo=0,t=oo)}if(t!==0){if(t===2&&(n=WI(e),n!==0&&(o=n,t=gT(e,n))),t===1)throw r=av,jc(e,0),al(e,o),xn(e,Hr()),r;if(t===6)al(e,o);else{if(n=e.current.alternate,!(o&30)&&!nie(n)&&(t=F0(e,o),t===2&&(a=WI(e),a!==0&&(o=a,t=gT(e,a))),t===1))throw r=av,jc(e,0),al(e,o),xn(e,Hr()),r;switch(e.finishedWork=n,e.finishedLanes=o,t){case 0:case 1:throw Error(fe(345));case 2:Uc(e,gn,ns);break;case 3:if(al(e,o),(o&130023424)===o&&(t=ZT+500-Hr(),10<t)){if(h0(e,0)!==0)break;if(n=e.suspendedLanes,(n&o)!==o){Jo(),e.pingedLanes|=e.suspendedLanes&n;break}e.timeoutHandle=YI(Uc.bind(null,e,gn,ns),t);break}Uc(e,gn,ns);break;case 4:if(al(e,o),(o&4194240)===o)break;for(t=e.eventTimes,n=-1;0<o;){var i=31-qa(o);a=1<<i,i=t[i],i>n&&(n=i),o&=~a}if(o=n,o=Hr()-o,o=(120>o?120:480>o?480:1080>o?1080:1920>o?1920:3e3>o?3e3:4320>o?4320:1960*oie(o/1960))-o,10<o){e.timeoutHandle=YI(Uc.bind(null,e,gn,ns),o);break}Uc(e,gn,ns);break;case 5:Uc(e,gn,ns);break;default:throw Error(fe(329))}}}return xn(e,Hr()),e.callbackNode===r?bO.bind(null,e):null}function gT(e,t){var r=Uy;return e.current.memoizedState.isDehydrated&&(jc(e,t).flags|=256),e=F0(e,t),e!==2&&(t=gn,gn=r,t!==null&&yT(t)),e}function yT(e){gn===null?gn=e:gn.push.apply(gn,e)}function nie(e){for(var t=e;;){if(t.flags&16384){var r=t.updateQueue;if(r!==null&&(r=r.stores,r!==null))for(var o=0;o<r.length;o++){var n=r[o],a=n.getSnapshot;n=n.value;try{if(!Xa(a(),n))return!1}catch{return!1}}}if(r=t.child,t.subtreeFlags&16384&&r!==null)r.return=t,t=r;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function al(e,t){for(t&=~JT,t&=~V0,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var r=31-qa(t),o=1<<r;e[r]=-1,t&=~o}}function NF(e){if(Bt&6)throw Error(fe(327));pd();var t=h0(e,0);if(!(t&1))return xn(e,Hr()),null;var r=F0(e,t);if(e.tag!==0&&r===2){var o=WI(e);o!==0&&(t=o,r=gT(e,o))}if(r===1)throw r=av,jc(e,0),al(e,t),xn(e,Hr()),r;if(r===6)throw Error(fe(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Uc(e,gn,ns),xn(e,Hr()),null}function eC(e,t){var r=Bt;Bt|=1;try{return e(t)}finally{Bt=r,Bt===0&&(yd=Hr()+500,B0&&xl())}}function Qc(e){sl!==null&&sl.tag===0&&!(Bt&6)&&pd();var t=Bt;Bt|=1;var r=ua.transition,o=Zt;try{if(ua.transition=null,Zt=1,e)return e()}finally{Zt=o,ua.transition=r,Bt=t,!(Bt&6)&&xl()}}function tC(){$n=nd.current,dr(nd)}function jc(e,t){e.finishedWork=null,e.finishedLanes=0;var r=e.timeoutHandle;if(r!==-1&&(e.timeoutHandle=-1,Mae(r)),Xr!==null)for(r=Xr.return;r!==null;){var o=r;switch(OT(o),o.tag){case 1:o=o.type.childContextTypes,o!=null&&x0();break;case 3:hd(),dr(vn),dr(zo),VT();break;case 5:HT(o);break;case 4:hd();break;case 13:dr(Tr);break;case 19:dr(Tr);break;case 10:LT(o.type._context);break;case 22:case 23:tC()}r=r.return}if(ho=e,Xr=e=hl(e.current,null),Eo=$n=t,oo=0,av=null,JT=V0=Yc=0,gn=Uy=null,Hc!==null){for(t=0;t<Hc.length;t++)if(r=Hc[t],o=r.interleaved,o!==null){r.interleaved=null;var n=o.next,a=r.pending;if(a!==null){var i=a.next;a.next=n,o.next=i}r.pending=o}Hc=null}return e}function xO(e,t){do{var r=Xr;try{if($T(),a0.current=N0,C0){for(var o=Cr.memoizedState;o!==null;){var n=o.queue;n!==null&&(n.pending=null),o=o.next}C0=!1}if(Xc=0,fo=ro=Cr=null,Ly=!1,rv=0,QT.current=null,r===null||r.return===null){oo=1,av=t,Xr=null;break}e:{var a=e,i=r.return,s=r,c=t;if(t=Eo,s.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var l=c,p=s,u=p.tag;if(!(p.mode&1)&&(u===0||u===11||u===15)){var m=p.alternate;m?(p.updateQueue=m.updateQueue,p.memoizedState=m.memoizedState,p.lanes=m.lanes):(p.updateQueue=null,p.memoizedState=null)}var f=gF(i);if(f!==null){f.flags&=-257,yF(f,i,s,a,t),f.mode&1&&hF(a,l,t),t=f,c=l;var d=t.updateQueue;if(d===null){var h=new Set;h.add(c),t.updateQueue=h}else d.add(c);break e}else{if(!(t&1)){hF(a,l,t),rC();break e}c=Error(fe(426))}}else if(wr&&s.mode&1){var y=gF(i);if(y!==null){!(y.flags&65536)&&(y.flags|=256),yF(y,i,s,a,t),PT(gd(c,s));break e}}a=c=gd(c,s),oo!==4&&(oo=2),Uy===null?Uy=[a]:Uy.push(a),a=i;do{switch(a.tag){case 3:a.flags|=65536,t&=-t,a.lanes|=t;var g=oO(a,c,t);cF(a,g);break e;case 1:s=c;var b=a.type,x=a.stateNode;if(!(a.flags&128)&&(typeof b.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(fl===null||!fl.has(x)))){a.flags|=65536,t&=-t,a.lanes|=t;var w=nO(a,s,t);cF(a,w);break e}}a=a.return}while(a!==null)}kO(r)}catch(I){t=I,Xr===r&&r!==null&&(Xr=r=r.return);continue}break}while(!0)}function wO(){var e=A0.current;return A0.current=N0,e===null?N0:e}function rC(){(oo===0||oo===3||oo===2)&&(oo=4),ho===null||!(Yc&268435455)&&!(V0&268435455)||al(ho,Eo)}function F0(e,t){var r=Bt;Bt|=2;var o=wO();(ho!==e||Eo!==t)&&(ns=null,jc(e,t));do try{aie();break}catch(n){xO(e,n)}while(!0);if($T(),Bt=r,A0.current=o,Xr!==null)throw Error(fe(261));return ho=null,Eo=0,oo}function aie(){for(;Xr!==null;)SO(Xr)}function iie(){for(;Xr!==null&&!Fne();)SO(Xr)}function SO(e){var t=EO(e.alternate,e,$n);e.memoizedProps=e.pendingProps,t===null?kO(e):Xr=t,QT.current=null}function kO(e){var t=e;do{var r=t.alternate;if(e=t.return,t.flags&32768){if(r=Zae(r,t),r!==null){r.flags&=32767,Xr=r;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{oo=6,Xr=null;return}}else if(r=Jae(r,t,$n),r!==null){Xr=r;return}if(t=t.sibling,t!==null){Xr=t;return}Xr=t=e}while(t!==null);oo===0&&(oo=5)}function Uc(e,t,r){var o=Zt,n=ua.transition;try{ua.transition=null,Zt=1,sie(e,t,r,o)}finally{ua.transition=n,Zt=o}return null}function sie(e,t,r,o){do pd();while(sl!==null);if(Bt&6)throw Error(fe(327));r=e.finishedWork;var n=e.finishedLanes;if(r===null)return null;if(e.finishedWork=null,e.finishedLanes=0,r===e.current)throw Error(fe(177));e.callbackNode=null,e.callbackPriority=0;var a=r.lanes|r.childLanes;if(Hne(e,a),e===ho&&(Xr=ho=null,Eo=0),!(r.subtreeFlags&2064)&&!(r.flags&2064)||e0||(e0=!0,IO(d0,function(){return pd(),null})),a=(r.flags&15990)!==0,r.subtreeFlags&15990||a){a=ua.transition,ua.transition=null;var i=Zt;Zt=1;var s=Bt;Bt|=4,QT.current=null,tie(e,r),yO(r,e),Nae(KI),g0=!!qI,KI=qI=null,e.current=r,rie(r,e,n),Mne(),Bt=s,Zt=i,ua.transition=a}else e.current=r;if(e0&&(e0=!1,sl=e,D0=n),a=e.pendingLanes,a===0&&(fl=null),zne(r.stateNode,o),xn(e,Hr()),t!==null)for(o=e.onRecoverableError,r=0;r<t.length;r++)n=t[r],o(n.value,{componentStack:n.stack,digest:n.digest});if(R0)throw R0=!1,e=dT,dT=null,e;return D0&1&&e.tag!==0&&pd(),a=e.pendingLanes,a&1?e===hT?Wy++:(Wy=0,hT=e):Wy=0,xl(),null}function pd(){if(sl!==null){var e=oM(D0),t=ua.transition,r=Zt;try{if(ua.transition=null,Zt=16>e?16:e,sl===null)var o=!1;else{if(e=sl,sl=null,D0=0,Bt&6)throw Error(fe(331));var n=Bt;for(Bt|=4,Ce=e.current;Ce!==null;){var a=Ce,i=a.child;if(Ce.flags&16){var s=a.deletions;if(s!==null){for(var c=0;c<s.length;c++){var l=s[c];for(Ce=l;Ce!==null;){var p=Ce;switch(p.tag){case 0:case 11:case 15:By(8,p,a)}var u=p.child;if(u!==null)u.return=p,Ce=u;else for(;Ce!==null;){p=Ce;var m=p.sibling,f=p.return;if(dO(p),p===l){Ce=null;break}if(m!==null){m.return=f,Ce=m;break}Ce=f}}}var d=a.alternate;if(d!==null){var h=d.child;if(h!==null){d.child=null;do{var y=h.sibling;h.sibling=null,h=y}while(h!==null)}}Ce=a}}if(a.subtreeFlags&2064&&i!==null)i.return=a,Ce=i;else e:for(;Ce!==null;){if(a=Ce,a.flags&2048)switch(a.tag){case 0:case 11:case 15:By(9,a,a.return)}var g=a.sibling;if(g!==null){g.return=a.return,Ce=g;break e}Ce=a.return}}var b=e.current;for(Ce=b;Ce!==null;){i=Ce;var x=i.child;if(i.subtreeFlags&2064&&x!==null)x.return=i,Ce=x;else e:for(i=b;Ce!==null;){if(s=Ce,s.flags&2048)try{switch(s.tag){case 0:case 11:case 15:H0(9,s)}}catch(I){Pr(s,s.return,I)}if(s===i){Ce=null;break e}var w=s.sibling;if(w!==null){w.return=s.return,Ce=w;break e}Ce=s.return}}if(Bt=n,xl(),bi&&typeof bi.onPostCommitFiberRoot=="function")try{bi.onPostCommitFiberRoot(O0,e)}catch{}o=!0}return o}finally{Zt=r,ua.transition=t}}return!1}function AF(e,t,r){t=gd(r,t),t=oO(e,t,1),e=ml(e,t,1),t=Jo(),e!==null&&(iv(e,1,t),xn(e,t))}function Pr(e,t,r){if(e.tag===3)AF(e,e,r);else for(;t!==null;){if(t.tag===3){AF(t,e,r);break}else if(t.tag===1){var o=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(fl===null||!fl.has(o))){e=gd(r,e),e=nO(t,e,1),t=ml(t,e,1),e=Jo(),t!==null&&(iv(t,1,e),xn(t,e));break}}t=t.return}}function lie(e,t,r){var o=e.pingCache;o!==null&&o.delete(t),t=Jo(),e.pingedLanes|=e.suspendedLanes&r,ho===e&&(Eo&r)===r&&(oo===4||oo===3&&(Eo&130023424)===Eo&&500>Hr()-ZT?jc(e,0):JT|=r),xn(e,t)}function _O(e,t){t===0&&(e.mode&1?(t=Bx,Bx<<=1,!(Bx&130023424)&&(Bx=4194304)):t=1);var r=Jo();e=us(e,t),e!==null&&(iv(e,t,r),xn(e,r))}function cie(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),_O(e,r)}function pie(e,t){var r=0;switch(e.tag){case 13:var o=e.stateNode,n=e.memoizedState;n!==null&&(r=n.retryLane);break;case 19:o=e.stateNode;break;default:throw Error(fe(314))}o!==null&&o.delete(t),_O(e,r)}var EO;EO=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||vn.current)yn=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return yn=!1,Qae(e,t,r);yn=!!(e.flags&131072)}else yn=!1,wr&&t.flags&1048576&&NM(t,k0,t.index);switch(t.lanes=0,t.tag){case 2:var o=t.type;s0(e,t),e=t.pendingProps;var n=md(t,zo.current);cd(t,r),n=GT(null,t,o,e,n,r);var a=qT();return t.flags|=1,typeof n=="object"&&n!==null&&typeof n.render=="function"&&n.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,bn(o)?(a=!0,w0(t)):a=!1,t.memoizedState=n.state!==null&&n.state!==void 0?n.state:null,UT(t),n.updater=W0,t.stateNode=n,n._reactInternals=t,oT(t,o,e,r),t=iT(null,t,o,!0,a,r)):(t.tag=0,wr&&a&&MT(t),Qo(null,t,n,r),t=t.child),t;case 16:o=t.elementType;e:{switch(s0(e,t),e=t.pendingProps,n=o._init,o=n(o._payload),t.type=o,n=t.tag=mie(o),e=Va(o,e),n){case 0:t=aT(null,t,o,e,r);break e;case 1:t=xF(null,t,o,e,r);break e;case 11:t=vF(null,t,o,e,r);break e;case 14:t=bF(null,t,o,Va(o.type,e),r);break e}throw Error(fe(306,o,""))}return t;case 0:return o=t.type,n=t.pendingProps,n=t.elementType===o?n:Va(o,n),aT(e,t,o,n,r);case 1:return o=t.type,n=t.pendingProps,n=t.elementType===o?n:Va(o,n),xF(e,t,o,n,r);case 3:e:{if(lO(t),e===null)throw Error(fe(387));o=t.pendingProps,a=t.memoizedState,n=a.element,OM(e,t),I0(t,o,null,r);var i=t.memoizedState;if(o=i.element,a.isDehydrated)if(a={element:o,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){n=gd(Error(fe(423)),t),t=wF(e,t,o,r,n);break e}else if(o!==n){n=gd(Error(fe(424)),t),t=wF(e,t,o,r,n);break e}else for(Ln=ul(t.stateNode.containerInfo.firstChild),Bn=t,wr=!0,Ga=null,r=FM(t,null,o,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(fd(),o===n){t=ms(e,t,r);break e}Qo(e,t,o,r)}t=t.child}return t;case 5:return PM(t),e===null&&eT(t),o=t.type,n=t.pendingProps,a=e!==null?e.memoizedProps:null,i=n.children,XI(o,n)?i=null:a!==null&&XI(o,a)&&(t.flags|=32),sO(e,t),Qo(e,t,i,r),t.child;case 6:return e===null&&eT(t),null;case 13:return cO(e,t,r);case 4:return WT(t,t.stateNode.containerInfo),o=t.pendingProps,e===null?t.child=dd(t,null,o,r):Qo(e,t,o,r),t.child;case 11:return o=t.type,n=t.pendingProps,n=t.elementType===o?n:Va(o,n),vF(e,t,o,n,r);case 7:return Qo(e,t,t.pendingProps,r),t.child;case 8:return Qo(e,t,t.pendingProps.children,r),t.child;case 12:return Qo(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(o=t.type._context,n=t.pendingProps,a=t.memoizedProps,i=n.value,sr(_0,o._currentValue),o._currentValue=i,a!==null)if(Xa(a.value,i)){if(a.children===n.children&&!vn.current){t=ms(e,t,r);break e}}else for(a=t.child,a!==null&&(a.return=t);a!==null;){var s=a.dependencies;if(s!==null){i=a.child;for(var c=s.firstContext;c!==null;){if(c.context===o){if(a.tag===1){c=ls(-1,r&-r),c.tag=2;var l=a.updateQueue;if(l!==null){l=l.shared;var p=l.pending;p===null?c.next=c:(c.next=p.next,p.next=c),l.pending=c}}a.lanes|=r,c=a.alternate,c!==null&&(c.lanes|=r),tT(a.return,r,t),s.lanes|=r;break}c=c.next}}else if(a.tag===10)i=a.type===t.type?null:a.child;else if(a.tag===18){if(i=a.return,i===null)throw Error(fe(341));i.lanes|=r,s=i.alternate,s!==null&&(s.lanes|=r),tT(i,r,t),i=a.sibling}else i=a.child;if(i!==null)i.return=a;else for(i=a;i!==null;){if(i===t){i=null;break}if(a=i.sibling,a!==null){a.return=i.return,i=a;break}i=i.return}a=i}Qo(e,t,n.children,r),t=t.child}return t;case 9:return n=t.type,o=t.pendingProps.children,cd(t,r),n=ma(n),o=o(n),t.flags|=1,Qo(e,t,o,r),t.child;case 14:return o=t.type,n=Va(o,t.pendingProps),n=Va(o.type,n),bF(e,t,o,n,r);case 15:return aO(e,t,t.type,t.pendingProps,r);case 17:return o=t.type,n=t.pendingProps,n=t.elementType===o?n:Va(o,n),s0(e,t),t.tag=1,bn(o)?(e=!0,w0(t)):e=!1,cd(t,r),rO(t,o,n),oT(t,o,n,r),iT(null,t,o,!0,e,r);case 19:return pO(e,t,r);case 22:return iO(e,t,r)}throw Error(fe(156,t.tag))};function IO(e,t){return ZF(e,t)}function uie(e,t,r,o){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function pa(e,t,r,o){return new uie(e,t,r,o)}function oC(e){return e=e.prototype,!(!e||!e.isReactComponent)}function mie(e){if(typeof e=="function")return oC(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ST)return 11;if(e===kT)return 14}return 2}function hl(e,t){var r=e.alternate;return r===null?(r=pa(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function p0(e,t,r,o,n,a){var i=2;if(o=e,typeof e=="function")oC(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case Kf:return Gc(r.children,n,a,t);case wT:i=8,n|=8;break;case TI:return e=pa(12,r,t,n|2),e.elementType=TI,e.lanes=a,e;case CI:return e=pa(13,r,t,n),e.elementType=CI,e.lanes=a,e;case NI:return e=pa(19,r,t,n),e.elementType=NI,e.lanes=a,e;case PF:return j0(r,n,a,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case MF:i=10;break e;case OF:i=9;break e;case ST:i=11;break e;case kT:i=14;break e;case rl:i=16,o=null;break e}throw Error(fe(130,e==null?e:typeof e,""))}return t=pa(i,r,t,n),t.elementType=e,t.type=o,t.lanes=a,t}function Gc(e,t,r,o){return e=pa(7,e,o,t),e.lanes=r,e}function j0(e,t,r,o){return e=pa(22,e,o,t),e.elementType=PF,e.lanes=r,e.stateNode={isHidden:!1},e}function _I(e,t,r){return e=pa(6,e,null,t),e.lanes=r,e}function EI(e,t,r){return t=pa(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function fie(e,t,r,o,n){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=lI(0),this.expirationTimes=lI(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=lI(0),this.identifierPrefix=o,this.onRecoverableError=n,this.mutableSourceEagerHydrationData=null}function nC(e,t,r,o,n,a,i,s,c){return e=new fie(e,t,r,s,c),t===1?(t=1,a===!0&&(t|=8)):t=0,a=pa(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:o,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},UT(a),e}function die(e,t,r){var o=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:qf,key:o==null?null:""+o,children:e,containerInfo:t,implementation:r}}function TO(e){if(!e)return yl;e=e._reactInternals;e:{if(Zc(e)!==e||e.tag!==1)throw Error(fe(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(bn(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(fe(171))}if(e.tag===1){var r=e.type;if(bn(r))return TM(e,r,t)}return t}function CO(e,t,r,o,n,a,i,s,c){return e=nC(r,o,!0,e,n,a,i,s,c),e.context=TO(null),r=e.current,o=Jo(),n=dl(r),a=ls(o,n),a.callback=t??null,ml(r,a,n),e.current.lanes=n,iv(e,n,o),xn(e,o),e}function G0(e,t,r,o){var n=t.current,a=Jo(),i=dl(n);return r=TO(r),t.context===null?t.context=r:t.pendingContext=r,t=ls(a,i),t.payload={element:e},o=o===void 0?null:o,o!==null&&(t.callback=o),e=ml(n,t,i),e!==null&&(Ka(e,n,i,a),n0(e,n,i)),i}function M0(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function RF(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<t?r:t}}function aC(e,t){RF(e,t),(e=e.alternate)&&RF(e,t)}function hie(){return null}var NO=typeof reportError=="function"?reportError:function(e){console.error(e)};function iC(e){this._internalRoot=e}q0.prototype.render=iC.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(fe(409));G0(e,t,null,null)};q0.prototype.unmount=iC.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Qc(function(){G0(null,e,null,null)}),t[ps]=null}};function q0(e){this._internalRoot=e}q0.prototype.unstable_scheduleHydration=function(e){if(e){var t=iM();e={blockedOn:null,target:e,priority:t};for(var r=0;r<nl.length&&t!==0&&t<nl[r].priority;r++);nl.splice(r,0,e),r===0&&lM(e)}};function sC(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function K0(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function DF(){}function gie(e,t,r,o,n){if(n){if(typeof o=="function"){var a=o;o=function(){var l=M0(i);a.call(l)}}var i=CO(t,o,e,0,null,!1,!1,"",DF);return e._reactRootContainer=i,e[ps]=i.current,Qy(e.nodeType===8?e.parentNode:e),Qc(),i}for(;n=e.lastChild;)e.removeChild(n);if(typeof o=="function"){var s=o;o=function(){var l=M0(c);s.call(l)}}var c=nC(e,0,!1,null,null,!1,!1,"",DF);return e._reactRootContainer=c,e[ps]=c.current,Qy(e.nodeType===8?e.parentNode:e),Qc(function(){G0(t,c,r,o)}),c}function X0(e,t,r,o,n){var a=r._reactRootContainer;if(a){var i=a;if(typeof n=="function"){var s=n;n=function(){var c=M0(i);s.call(c)}}G0(t,i,e,n)}else i=gie(r,t,e,n,o);return M0(i)}nM=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var r=Dy(t.pendingLanes);r!==0&&(IT(t,r|1),xn(t,Hr()),!(Bt&6)&&(yd=Hr()+500,xl()))}break;case 13:Qc(function(){var o=us(e,1);if(o!==null){var n=Jo();Ka(o,e,1,n)}}),aC(e,1)}};TT=function(e){if(e.tag===13){var t=us(e,134217728);if(t!==null){var r=Jo();Ka(t,e,134217728,r)}aC(e,134217728)}};aM=function(e){if(e.tag===13){var t=dl(e),r=us(e,t);if(r!==null){var o=Jo();Ka(r,e,t,o)}aC(e,t)}};iM=function(){return Zt};sM=function(e,t){var r=Zt;try{return Zt=e,t()}finally{Zt=r}};LI=function(e,t,r){switch(t){case"input":if(DI(e,r),t=r.name,r.type==="radio"&&t!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<r.length;t++){var o=r[t];if(o!==e&&o.form===e.form){var n=L0(o);if(!n)throw Error(fe(90));$F(o),DI(o,n)}}}break;case"textarea":BF(e,r);break;case"select":t=r.value,t!=null&&ad(e,!!r.multiple,t,!1)}};qF=eC;KF=Qc;var yie={usingClientEntryPoint:!1,Events:[lv,Jf,L0,jF,GF,eC]},Cy={findFiberByHostInstance:Wc,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},vie={bundleType:Cy.bundleType,version:Cy.version,rendererPackageName:Cy.rendererPackageName,rendererConfig:Cy.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:fs.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=QF(e),e===null?null:e.stateNode},findFiberByHostInstance:Cy.findFiberByHostInstance||hie,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(Ny=__REACT_DEVTOOLS_GLOBAL_HOOK__,!Ny.isDisabled&&Ny.supportsFiber))try{O0=Ny.inject(vie),bi=Ny}catch{}var Ny;Hn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=yie;Hn.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!sC(t))throw Error(fe(200));return die(e,t,null,r)};Hn.createRoot=function(e,t){if(!sC(e))throw Error(fe(299));var r=!1,o="",n=NO;return t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(o=t.identifierPrefix),t.onRecoverableError!==void 0&&(n=t.onRecoverableError)),t=nC(e,1,!1,null,null,r,!1,o,n),e[ps]=t.current,Qy(e.nodeType===8?e.parentNode:e),new iC(t)};Hn.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(fe(188)):(e=Object.keys(e).join(","),Error(fe(268,e)));return e=QF(t),e=e===null?null:e.stateNode,e};Hn.flushSync=function(e){return Qc(e)};Hn.hydrate=function(e,t,r){if(!K0(t))throw Error(fe(200));return X0(null,e,t,!0,r)};Hn.hydrateRoot=function(e,t,r){if(!sC(e))throw Error(fe(405));var o=r!=null&&r.hydratedSources||null,n=!1,a="",i=NO;if(r!=null&&(r.unstable_strictMode===!0&&(n=!0),r.identifierPrefix!==void 0&&(a=r.identifierPrefix),r.onRecoverableError!==void 0&&(i=r.onRecoverableError)),t=CO(t,null,e,1,r??null,n,!1,a,i),e[ps]=t.current,Qy(e),o)for(e=0;e<o.length;e++)r=o[e],n=r._getVersion,n=n(r._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[r,n]:t.mutableSourceEagerHydrationData.push(r,n);return new q0(t)};Hn.render=function(e,t,r){if(!K0(t))throw Error(fe(200));return X0(null,e,t,!1,r)};Hn.unmountComponentAtNode=function(e){if(!K0(e))throw Error(fe(40));return e._reactRootContainer?(Qc(function(){X0(null,null,e,!1,function(){e._reactRootContainer=null,e[ps]=null})}),!0):!1};Hn.unstable_batchedUpdates=eC;Hn.unstable_renderSubtreeIntoContainer=function(e,t,r,o){if(!K0(r))throw Error(fe(200));if(e==null||e._reactInternals===void 0)throw Error(fe(38));return X0(e,t,r,!1,o)};Hn.version="18.3.1-next-f1338f8080-20240426"});var FO=Be((jCe,DO)=>{"use strict";function RO(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(RO)}catch(e){console.error(e)}}RO(),DO.exports=AO()});var OO=Be(lC=>{"use strict";var MO=FO();lC.createRoot=MO.createRoot,lC.hydrateRoot=MO.hydrateRoot;var GCe});var zO=Be(PO=>{"use strict";var xd=Me();function bie(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var xie=typeof Object.is=="function"?Object.is:bie,wie=xd.useState,Sie=xd.useEffect,kie=xd.useLayoutEffect,_ie=xd.useDebugValue;function Eie(e,t){var r=t(),o=wie({inst:{value:r,getSnapshot:t}}),n=o[0].inst,a=o[1];return kie(function(){n.value=r,n.getSnapshot=t,cC(n)&&a({inst:n})},[e,r,t]),Sie(function(){return cC(n)&&a({inst:n}),e(function(){cC(n)&&a({inst:n})})},[e]),_ie(r),r}function cC(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!xie(e,r)}catch{return!0}}function Iie(e,t){return t()}var Tie=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Iie:Eie;PO.useSyncExternalStore=xd.useSyncExternalStore!==void 0?xd.useSyncExternalStore:Tie});var LO=Be((XCe,$O)=>{"use strict";$O.exports=zO()});var UO=Be(BO=>{"use strict";var Y0=Me(),Cie=LO();function Nie(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Aie=typeof Object.is=="function"?Object.is:Nie,Rie=Cie.useSyncExternalStore,Die=Y0.useRef,Fie=Y0.useEffect,Mie=Y0.useMemo,Oie=Y0.useDebugValue;BO.useSyncExternalStoreWithSelector=function(e,t,r,o,n){var a=Die(null);if(a.current===null){var i={hasValue:!1,value:null};a.current=i}else i=a.current;a=Mie(function(){function c(f){if(!l){if(l=!0,p=f,f=o(f),n!==void 0&&i.hasValue){var d=i.value;if(n(d,f))return u=d}return u=f}if(d=u,Aie(p,f))return d;var h=o(f);return n!==void 0&&n(d,h)?(p=f,d):(p=f,u=h)}var l=!1,p,u,m=r===void 0?null:r;return[function(){return c(t())},m===null?void 0:function(){return c(m())}]},[t,r,o,n]);var s=Rie(e,a[0],a[1]);return Fie(function(){i.hasValue=!0,i.value=s},[s]),Oie(s),s}});var pC=Be((QCe,WO)=>{"use strict";WO.exports=UO()});var A5=Be((p5e,N5)=>{function Dle(e,t,r,o){var n=-1,a=e==null?0:e.length;for(o&&a&&(r=e[++n]);++n<a;)r=t(r,e[n],n,e);return r}N5.exports=Dle});var D5=Be((u5e,R5)=>{function Fle(e){return function(t){return e?.[t]}}R5.exports=Fle});var M5=Be((m5e,F5)=>{var Mle=D5(),Ole={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},Ple=Mle(Ole);F5.exports=Ple});var P5=Be((f5e,O5)=>{var zle=typeof global=="object"&&global&&global.Object===Object&&global;O5.exports=zle});var $5=Be((d5e,z5)=>{var $le=P5(),Lle=typeof self=="object"&&self&&self.Object===Object&&self,Ble=$le||Lle||Function("return this")();z5.exports=Ble});var Jw=Be((h5e,L5)=>{var Ule=$5(),Wle=Ule.Symbol;L5.exports=Wle});var U5=Be((g5e,B5)=>{function Hle(e,t){for(var r=-1,o=e==null?0:e.length,n=Array(o);++r<o;)n[r]=t(e[r],r,e);return n}B5.exports=Hle});var H5=Be((y5e,W5)=>{var Vle=Array.isArray;W5.exports=Vle});var q5=Be((v5e,G5)=>{var V5=Jw(),j5=Object.prototype,jle=j5.hasOwnProperty,Gle=j5.toString,Lv=V5?V5.toStringTag:void 0;function qle(e){var t=jle.call(e,Lv),r=e[Lv];try{e[Lv]=void 0;var o=!0}catch{}var n=Gle.call(e);return o&&(t?e[Lv]=r:delete e[Lv]),n}G5.exports=qle});var X5=Be((b5e,K5)=>{var Kle=Object.prototype,Xle=Kle.toString;function Yle(e){return Xle.call(e)}K5.exports=Yle});var Z5=Be((x5e,J5)=>{var Y5=Jw(),Qle=q5(),Jle=X5(),Zle="[object Null]",ece="[object Undefined]",Q5=Y5?Y5.toStringTag:void 0;function tce(e){return e==null?e===void 0?ece:Zle:Q5&&Q5 in Object(e)?Qle(e):Jle(e)}J5.exports=tce});var t$=Be((w5e,e$)=>{function rce(e){return e!=null&&typeof e=="object"}e$.exports=rce});var o$=Be((S5e,r$)=>{var oce=Z5(),nce=t$(),ace="[object Symbol]";function ice(e){return typeof e=="symbol"||nce(e)&&oce(e)==ace}r$.exports=ice});var c$=Be((k5e,l$)=>{var n$=Jw(),sce=U5(),lce=H5(),cce=o$(),pce=1/0,a$=n$?n$.prototype:void 0,i$=a$?a$.toString:void 0;function s$(e){if(typeof e=="string")return e;if(lce(e))return sce(e,s$)+"";if(cce(e))return i$?i$.call(e):"";var t=e+"";return t=="0"&&1/e==-pce?"-0":t}l$.exports=s$});var FN=Be((_5e,p$)=>{var uce=c$();function mce(e){return e==null?"":uce(e)}p$.exports=mce});var m$=Be((E5e,u$)=>{var fce=M5(),dce=FN(),hce=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,gce="\\u0300-\\u036f",yce="\\ufe20-\\ufe2f",vce="\\u20d0-\\u20ff",bce=gce+yce+vce,xce="["+bce+"]",wce=RegExp(xce,"g");function Sce(e){return e=dce(e),e&&e.replace(hce,fce).replace(wce,"")}u$.exports=Sce});var d$=Be((I5e,f$)=>{var kce=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function _ce(e){return e.match(kce)||[]}f$.exports=_ce});var g$=Be((T5e,h$)=>{var Ece=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function Ice(e){return Ece.test(e)}h$.exports=Ice});var O$=Be((C5e,M$)=>{var w$="\\ud800-\\udfff",Tce="\\u0300-\\u036f",Cce="\\ufe20-\\ufe2f",Nce="\\u20d0-\\u20ff",Ace=Tce+Cce+Nce,S$="\\u2700-\\u27bf",k$="a-z\\xdf-\\xf6\\xf8-\\xff",Rce="\\xac\\xb1\\xd7\\xf7",Dce="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Fce="\\u2000-\\u206f",Mce=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",_$="A-Z\\xc0-\\xd6\\xd8-\\xde",Oce="\\ufe0e\\ufe0f",E$=Rce+Dce+Fce+Mce,I$="['\u2019]",y$="["+E$+"]",Pce="["+Ace+"]",T$="\\d+",zce="["+S$+"]",C$="["+k$+"]",N$="[^"+w$+E$+T$+S$+k$+_$+"]",$ce="\\ud83c[\\udffb-\\udfff]",Lce="(?:"+Pce+"|"+$ce+")",Bce="[^"+w$+"]",A$="(?:\\ud83c[\\udde6-\\uddff]){2}",R$="[\\ud800-\\udbff][\\udc00-\\udfff]",Bd="["+_$+"]",Uce="\\u200d",v$="(?:"+C$+"|"+N$+")",Wce="(?:"+Bd+"|"+N$+")",b$="(?:"+I$+"(?:d|ll|m|re|s|t|ve))?",x$="(?:"+I$+"(?:D|LL|M|RE|S|T|VE))?",D$=Lce+"?",F$="["+Oce+"]?",Hce="(?:"+Uce+"(?:"+[Bce,A$,R$].join("|")+")"+F$+D$+")*",Vce="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",jce="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Gce=F$+D$+Hce,qce="(?:"+[zce,A$,R$].join("|")+")"+Gce,Kce=RegExp([Bd+"?"+C$+"+"+b$+"(?="+[y$,Bd,"$"].join("|")+")",Wce+"+"+x$+"(?="+[y$,Bd+v$,"$"].join("|")+")",Bd+"?"+v$+"+"+b$,Bd+"+"+x$,jce,Vce,T$,qce].join("|"),"g");function Xce(e){return e.match(Kce)||[]}M$.exports=Xce});var z$=Be((N5e,P$)=>{var Yce=d$(),Qce=g$(),Jce=FN(),Zce=O$();function epe(e,t,r){return e=Jce(e),t=r?void 0:t,t===void 0?Qce(e)?Zce(e):Yce(e):e.match(t)||[]}P$.exports=epe});var L$=Be((A5e,$$)=>{var tpe=A5(),rpe=m$(),ope=z$(),npe="['\u2019]",ape=RegExp(npe,"g");function ipe(e){return function(t){return tpe(ope(rpe(t).replace(ape,"")),e,"")}}$$.exports=ipe});var U$=Be((R5e,B$)=>{var spe=L$(),lpe=spe(function(e,t,r){return e+(r?"-":"")+t.toLowerCase()});B$.exports=lpe});var I8=Be(g1=>{"use strict";var $pe=Me(),Lpe=Symbol.for("react.element"),Bpe=Symbol.for("react.fragment"),Upe=Object.prototype.hasOwnProperty,Wpe=$pe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Hpe={key:!0,ref:!0,__self:!0,__source:!0};function E8(e,t,r){var o,n={},a=null,i=null;r!==void 0&&(a=""+r),t.key!==void 0&&(a=""+t.key),t.ref!==void 0&&(i=t.ref);for(o in t)Upe.call(t,o)&&!Hpe.hasOwnProperty(o)&&(n[o]=t[o]);if(e&&e.defaultProps)for(o in t=e.defaultProps,t)n[o]===void 0&&(n[o]=t[o]);return{$$typeof:Lpe,type:e,key:a,ref:i,props:n,_owner:Wpe.current}}g1.Fragment=Bpe;g1.jsx=E8;g1.jsxs=E8});var y1=Be((TLe,T8)=>{"use strict";T8.exports=I8()});var mL=Be((RBe,uL)=>{uL.exports=cr;var ba=null;try{ba=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 cr(e,t,r){this.low=e|0,this.high=t|0,this.unsigned=!!r}cr.prototype.__isLong__;Object.defineProperty(cr.prototype,"__isLong__",{value:!0});function An(e){return(e&&e.__isLong__)===!0}cr.isLong=An;var rL={},oL={};function hm(e,t){var r,o,n;return t?(e>>>=0,(n=0<=e&&e<256)&&(o=oL[e],o)?o:(r=pr(e,(e|0)<0?-1:0,!0),n&&(oL[e]=r),r)):(e|=0,(n=-128<=e&&e<128)&&(o=rL[e],o)?o:(r=pr(e,e<0?-1:0,!1),n&&(rL[e]=r),r))}cr.fromInt=hm;function xa(e,t){if(isNaN(e))return t?dm:wa;if(t){if(e<0)return dm;if(e>=sL)return pL}else{if(e<=-aL)return Nn;if(e+1>=aL)return cL}return e<0?xa(-e,t).neg():pr(e%Ph|0,e/Ph|0,t)}cr.fromNumber=xa;function pr(e,t,r){return new cr(e,t,r)}cr.fromBits=pr;var j1=Math.pow;function b3(e,t,r){if(e.length===0)throw Error("empty string");if(e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return wa;if(typeof t=="number"?(r=t,t=!1):t=!!t,r=r||10,r<2||36<r)throw RangeError("radix");var o;if((o=e.indexOf("-"))>0)throw Error("interior hyphen");if(o===0)return b3(e.substring(1),t,r).neg();for(var n=xa(j1(r,8)),a=wa,i=0;i<e.length;i+=8){var s=Math.min(8,e.length-i),c=parseInt(e.substring(i,i+s),r);if(s<8){var l=xa(j1(r,s));a=a.mul(l).add(xa(c))}else a=a.mul(n),a=a.add(xa(c))}return a.unsigned=t,a}cr.fromString=b3;function ri(e,t){return typeof e=="number"?xa(e,t):typeof e=="string"?b3(e,t):pr(e.low,e.high,typeof t=="boolean"?t:e.unsigned)}cr.fromValue=ri;var nL=65536,kue=1<<24,Ph=nL*nL,sL=Ph*Ph,aL=sL/2,iL=hm(kue),wa=hm(0);cr.ZERO=wa;var dm=hm(0,!0);cr.UZERO=dm;var Oh=hm(1);cr.ONE=Oh;var lL=hm(1,!0);cr.UONE=lL;var v3=hm(-1);cr.NEG_ONE=v3;var cL=pr(-1,2147483647,!1);cr.MAX_VALUE=cL;var pL=pr(-1,-1,!0);cr.MAX_UNSIGNED_VALUE=pL;var Nn=pr(0,-2147483648,!1);cr.MIN_VALUE=Nn;var ye=cr.prototype;ye.toInt=function(){return this.unsigned?this.low>>>0:this.low};ye.toNumber=function(){return this.unsigned?(this.high>>>0)*Ph+(this.low>>>0):this.high*Ph+(this.low>>>0)};ye.toString=function(t){if(t=t||10,t<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(Nn)){var r=xa(t),o=this.div(r),n=o.mul(r).sub(this);return o.toString(t)+n.toInt().toString(t)}else return"-"+this.neg().toString(t);for(var a=xa(j1(t,6),this.unsigned),i=this,s="";;){var c=i.div(a),l=i.sub(c.mul(a)).toInt()>>>0,p=l.toString(t);if(i=c,i.isZero())return p+s;for(;p.length<6;)p="0"+p;s=""+p+s}};ye.getHighBits=function(){return this.high};ye.getHighBitsUnsigned=function(){return this.high>>>0};ye.getLowBits=function(){return this.low};ye.getLowBitsUnsigned=function(){return this.low>>>0};ye.getNumBitsAbs=function(){if(this.isNegative())return this.eq(Nn)?64:this.neg().getNumBitsAbs();for(var t=this.high!=0?this.high:this.low,r=31;r>0&&!(t&1<<r);r--);return this.high!=0?r+33:r+1};ye.isZero=function(){return this.high===0&&this.low===0};ye.eqz=ye.isZero;ye.isNegative=function(){return!this.unsigned&&this.high<0};ye.isPositive=function(){return this.unsigned||this.high>=0};ye.isOdd=function(){return(this.low&1)===1};ye.isEven=function(){return(this.low&1)===0};ye.equals=function(t){return An(t)||(t=ri(t)),this.unsigned!==t.unsigned&&this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low};ye.eq=ye.equals;ye.notEquals=function(t){return!this.eq(t)};ye.neq=ye.notEquals;ye.ne=ye.notEquals;ye.lessThan=function(t){return this.comp(t)<0};ye.lt=ye.lessThan;ye.lessThanOrEqual=function(t){return this.comp(t)<=0};ye.lte=ye.lessThanOrEqual;ye.le=ye.lessThanOrEqual;ye.greaterThan=function(t){return this.comp(t)>0};ye.gt=ye.greaterThan;ye.greaterThanOrEqual=function(t){return this.comp(t)>=0};ye.gte=ye.greaterThanOrEqual;ye.ge=ye.greaterThanOrEqual;ye.compare=function(t){if(An(t)||(t=ri(t)),this.eq(t))return 0;var r=this.isNegative(),o=t.isNegative();return r&&!o?-1:!r&&o?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1};ye.comp=ye.compare;ye.negate=function(){return!this.unsigned&&this.eq(Nn)?Nn:this.not().add(Oh)};ye.neg=ye.negate;ye.add=function(t){An(t)||(t=ri(t));var r=this.high>>>16,o=this.high&65535,n=this.low>>>16,a=this.low&65535,i=t.high>>>16,s=t.high&65535,c=t.low>>>16,l=t.low&65535,p=0,u=0,m=0,f=0;return f+=a+l,m+=f>>>16,f&=65535,m+=n+c,u+=m>>>16,m&=65535,u+=o+s,p+=u>>>16,u&=65535,p+=r+i,p&=65535,pr(m<<16|f,p<<16|u,this.unsigned)};ye.subtract=function(t){return An(t)||(t=ri(t)),this.add(t.neg())};ye.sub=ye.subtract;ye.multiply=function(t){if(this.isZero())return wa;if(An(t)||(t=ri(t)),ba){var r=ba.mul(this.low,this.high,t.low,t.high);return pr(r,ba.get_high(),this.unsigned)}if(t.isZero())return wa;if(this.eq(Nn))return t.isOdd()?Nn:wa;if(t.eq(Nn))return this.isOdd()?Nn:wa;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(iL)&&t.lt(iL))return xa(this.toNumber()*t.toNumber(),this.unsigned);var o=this.high>>>16,n=this.high&65535,a=this.low>>>16,i=this.low&65535,s=t.high>>>16,c=t.high&65535,l=t.low>>>16,p=t.low&65535,u=0,m=0,f=0,d=0;return d+=i*p,f+=d>>>16,d&=65535,f+=a*p,m+=f>>>16,f&=65535,f+=i*l,m+=f>>>16,f&=65535,m+=n*p,u+=m>>>16,m&=65535,m+=a*l,u+=m>>>16,m&=65535,m+=i*c,u+=m>>>16,m&=65535,u+=o*p+n*l+a*c+i*s,u&=65535,pr(f<<16|d,u<<16|m,this.unsigned)};ye.mul=ye.multiply;ye.divide=function(t){if(An(t)||(t=ri(t)),t.isZero())throw Error("division by zero");if(ba){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var r=(this.unsigned?ba.div_u:ba.div_s)(this.low,this.high,t.low,t.high);return pr(r,ba.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?dm:wa;var o,n,a;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return dm;if(t.gt(this.shru(1)))return lL;a=dm}else{if(this.eq(Nn)){if(t.eq(Oh)||t.eq(v3))return Nn;if(t.eq(Nn))return Oh;var i=this.shr(1);return o=i.div(t).shl(1),o.eq(wa)?t.isNegative()?Oh:v3:(n=this.sub(t.mul(o)),a=o.add(n.div(t)),a)}else if(t.eq(Nn))return this.unsigned?dm:wa;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();a=wa}for(n=this;n.gte(t);){o=Math.max(1,Math.floor(n.toNumber()/t.toNumber()));for(var s=Math.ceil(Math.log(o)/Math.LN2),c=s<=48?1:j1(2,s-48),l=xa(o),p=l.mul(t);p.isNegative()||p.gt(n);)o-=c,l=xa(o,this.unsigned),p=l.mul(t);l.isZero()&&(l=Oh),a=a.add(l),n=n.sub(p)}return a};ye.div=ye.divide;ye.modulo=function(t){if(An(t)||(t=ri(t)),ba){var r=(this.unsigned?ba.rem_u:ba.rem_s)(this.low,this.high,t.low,t.high);return pr(r,ba.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))};ye.mod=ye.modulo;ye.rem=ye.modulo;ye.not=function(){return pr(~this.low,~this.high,this.unsigned)};ye.and=function(t){return An(t)||(t=ri(t)),pr(this.low&t.low,this.high&t.high,this.unsigned)};ye.or=function(t){return An(t)||(t=ri(t)),pr(this.low|t.low,this.high|t.high,this.unsigned)};ye.xor=function(t){return An(t)||(t=ri(t)),pr(this.low^t.low,this.high^t.high,this.unsigned)};ye.shiftLeft=function(t){return An(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?pr(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):pr(0,this.low<<t-32,this.unsigned)};ye.shl=ye.shiftLeft;ye.shiftRight=function(t){return An(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?pr(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):pr(this.high>>t-32,this.high>=0?0:-1,this.unsigned)};ye.shr=ye.shiftRight;ye.shiftRightUnsigned=function(t){if(An(t)&&(t=t.toInt()),t&=63,t===0)return this;var r=this.high;if(t<32){var o=this.low;return pr(o>>>t|r<<32-t,r>>>t,this.unsigned)}else return t===32?pr(r,0,this.unsigned):pr(r>>>t-32,0,this.unsigned)};ye.shru=ye.shiftRightUnsigned;ye.shr_u=ye.shiftRightUnsigned;ye.toSigned=function(){return this.unsigned?pr(this.low,this.high,!1):this};ye.toUnsigned=function(){return this.unsigned?this:pr(this.low,this.high,!0)};ye.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()};ye.toBytesLE=function(){var t=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]};ye.toBytesBE=function(){var t=this.high,r=this.low;return[t>>>24,t>>>16&255,t>>>8&255,t&255,r>>>24,r>>>16&255,r>>>8&255,r&255]};cr.fromBytes=function(t,r,o){return o?cr.fromBytesLE(t,r):cr.fromBytesBE(t,r)};cr.fromBytesLE=function(t,r){return new cr(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,r)};cr.fromBytesBE=function(t,r){return new cr(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],r)}});var XL=Be(()=>{});var YL=Be(()=>{});var IU=Be((EU,G3)=>{(function(e,t,r){function o(s){var c=this,l=i();c.next=function(){var p=2091639*c.s0+c.c*23283064365386963e-26;return c.s0=c.s1,c.s1=c.s2,c.s2=p-(c.c=p|0)},c.c=1,c.s0=l(" "),c.s1=l(" "),c.s2=l(" "),c.s0-=l(s),c.s0<0&&(c.s0+=1),c.s1-=l(s),c.s1<0&&(c.s1+=1),c.s2-=l(s),c.s2<0&&(c.s2+=1),l=null}function n(s,c){return c.c=s.c,c.s0=s.s0,c.s1=s.s1,c.s2=s.s2,c}function a(s,c){var l=new o(s),p=c&&c.state,u=l.next;return u.int32=function(){return l.next()*4294967296|0},u.double=function(){return u()+(u()*2097152|0)*11102230246251565e-32},u.quick=u,p&&(typeof p=="object"&&n(p,l),u.state=function(){return n(l,{})}),u}function i(){var s=4022871197,c=function(l){l=String(l);for(var p=0;p<l.length;p++){s+=l.charCodeAt(p);var u=.02519603282416938*s;s=u>>>0,u-=s,u*=s,s=u>>>0,u-=s,s+=u*4294967296}return(s>>>0)*23283064365386963e-26};return c}t&&t.exports?t.exports=a:r&&r.amd?r(function(){return a}):this.alea=a})(EU,typeof G3=="object"&&G3,typeof define=="function"&&define)});var CU=Be((TU,q3)=>{(function(e,t,r){function o(i){var s=this,c="";s.x=0,s.y=0,s.z=0,s.w=0,s.next=function(){var p=s.x^s.x<<11;return s.x=s.y,s.y=s.z,s.z=s.w,s.w^=s.w>>>19^p^p>>>8},i===(i|0)?s.x=i:c+=i;for(var l=0;l<c.length+64;l++)s.x^=c.charCodeAt(l)|0,s.next()}function n(i,s){return s.x=i.x,s.y=i.y,s.z=i.z,s.w=i.w,s}function a(i,s){var c=new o(i),l=s&&s.state,p=function(){return(c.next()>>>0)/4294967296};return p.double=function(){do var u=c.next()>>>11,m=(c.next()>>>0)/4294967296,f=(u+m)/(1<<21);while(f===0);return f},p.int32=c.next,p.quick=p,l&&(typeof l=="object"&&n(l,c),p.state=function(){return n(c,{})}),p}t&&t.exports?t.exports=a:r&&r.amd?r(function(){return a}):this.xor128=a})(TU,typeof q3=="object"&&q3,typeof define=="function"&&define)});var AU=Be((NU,K3)=>{(function(e,t,r){function o(i){var s=this,c="";s.next=function(){var p=s.x^s.x>>>2;return s.x=s.y,s.y=s.z,s.z=s.w,s.w=s.v,(s.d=s.d+362437|0)+(s.v=s.v^s.v<<4^(p^p<<1))|0},s.x=0,s.y=0,s.z=0,s.w=0,s.v=0,i===(i|0)?s.x=i:c+=i;for(var l=0;l<c.length+64;l++)s.x^=c.charCodeAt(l)|0,l==c.length&&(s.d=s.x<<10^s.x>>>4),s.next()}function n(i,s){return s.x=i.x,s.y=i.y,s.z=i.z,s.w=i.w,s.v=i.v,s.d=i.d,s}function a(i,s){var c=new o(i),l=s&&s.state,p=function(){return(c.next()>>>0)/4294967296};return p.double=function(){do var u=c.next()>>>11,m=(c.next()>>>0)/4294967296,f=(u+m)/(1<<21);while(f===0);return f},p.int32=c.next,p.quick=p,l&&(typeof l=="object"&&n(l,c),p.state=function(){return n(c,{})}),p}t&&t.exports?t.exports=a:r&&r.amd?r(function(){return a}):this.xorwow=a})(NU,typeof K3=="object"&&K3,typeof define=="function"&&define)});var DU=Be((RU,X3)=>{(function(e,t,r){function o(i){var s=this;s.next=function(){var l=s.x,p=s.i,u,m,f;return u=l[p],u^=u>>>7,m=u^u<<24,u=l[p+1&7],m^=u^u>>>10,u=l[p+3&7],m^=u^u>>>3,u=l[p+4&7],m^=u^u<<7,u=l[p+7&7],u=u^u<<13,m^=u^u<<9,l[p]=m,s.i=p+1&7,m};function c(l,p){var u,m,f=[];if(p===(p|0))m=f[0]=p;else for(p=""+p,u=0;u<p.length;++u)f[u&7]=f[u&7]<<15^p.charCodeAt(u)+f[u+1&7]<<13;for(;f.length<8;)f.push(0);for(u=0;u<8&&f[u]===0;++u);for(u==8?m=f[7]=-1:m=f[u],l.x=f,l.i=0,u=256;u>0;--u)l.next()}c(s,i)}function n(i,s){return s.x=i.x.slice(),s.i=i.i,s}function a(i,s){i==null&&(i=+new Date);var c=new o(i),l=s&&s.state,p=function(){return(c.next()>>>0)/4294967296};return p.double=function(){do var u=c.next()>>>11,m=(c.next()>>>0)/4294967296,f=(u+m)/(1<<21);while(f===0);return f},p.int32=c.next,p.quick=p,l&&(l.x&&n(l,c),p.state=function(){return n(c,{})}),p}t&&t.exports?t.exports=a:r&&r.amd?r(function(){return a}):this.xorshift7=a})(RU,typeof X3=="object"&&X3,typeof define=="function"&&define)});var MU=Be((FU,Y3)=>{(function(e,t,r){function o(i){var s=this;s.next=function(){var l=s.w,p=s.X,u=s.i,m,f;return s.w=l=l+1640531527|0,f=p[u+34&127],m=p[u=u+1&127],f^=f<<13,m^=m<<17,f^=f>>>15,m^=m>>>12,f=p[u]=f^m,s.i=u,f+(l^l>>>16)|0};function c(l,p){var u,m,f,d,h,y=[],g=128;for(p===(p|0)?(m=p,p=null):(p=p+"\0",m=0,g=Math.max(g,p.length)),f=0,d=-32;d<g;++d)p&&(m^=p.charCodeAt((d+32)%p.length)),d===0&&(h=m),m^=m<<10,m^=m>>>15,m^=m<<4,m^=m>>>13,d>=0&&(h=h+1640531527|0,u=y[d&127]^=m+h,f=u==0?f+1:0);for(f>=128&&(y[(p&&p.length||0)&127]=-1),f=127,d=4*128;d>0;--d)m=y[f+34&127],u=y[f=f+1&127],m^=m<<13,u^=u<<17,m^=m>>>15,u^=u>>>12,y[f]=m^u;l.w=h,l.X=y,l.i=f}c(s,i)}function n(i,s){return s.i=i.i,s.w=i.w,s.X=i.X.slice(),s}function a(i,s){i==null&&(i=+new Date);var c=new o(i),l=s&&s.state,p=function(){return(c.next()>>>0)/4294967296};return p.double=function(){do var u=c.next()>>>11,m=(c.next()>>>0)/4294967296,f=(u+m)/(1<<21);while(f===0);return f},p.int32=c.next,p.quick=p,l&&(l.X&&n(l,c),p.state=function(){return n(c,{})}),p}t&&t.exports?t.exports=a:r&&r.amd?r(function(){return a}):this.xor4096=a})(FU,typeof Y3=="object"&&Y3,typeof define=="function"&&define)});var PU=Be((OU,Q3)=>{(function(e,t,r){function o(i){var s=this,c="";s.next=function(){var p=s.b,u=s.c,m=s.d,f=s.a;return p=p<<25^p>>>7^u,u=u-m|0,m=m<<24^m>>>8^f,f=f-p|0,s.b=p=p<<20^p>>>12^u,s.c=u=u-m|0,s.d=m<<16^u>>>16^f,s.a=f-p|0},s.a=0,s.b=0,s.c=-1640531527,s.d=1367130551,i===Math.floor(i)?(s.a=i/4294967296|0,s.b=i|0):c+=i;for(var l=0;l<c.length+20;l++)s.b^=c.charCodeAt(l)|0,s.next()}function n(i,s){return s.a=i.a,s.b=i.b,s.c=i.c,s.d=i.d,s}function a(i,s){var c=new o(i),l=s&&s.state,p=function(){return(c.next()>>>0)/4294967296};return p.double=function(){do var u=c.next()>>>11,m=(c.next()>>>0)/4294967296,f=(u+m)/(1<<21);while(f===0);return f},p.int32=c.next,p.quick=p,l&&(typeof l=="object"&&n(l,c),p.state=function(){return n(c,{})}),p}t&&t.exports?t.exports=a:r&&r.amd?r(function(){return a}):this.tychei=a})(OU,typeof Q3=="object"&&Q3,typeof define=="function"&&define)});var zU=Be(()=>{});var LU=Be(($U,FS)=>{(function(e,t,r){var o=256,n=6,a=52,i="random",s=r.pow(o,n),c=r.pow(2,a),l=c*2,p=o-1,u;function m(x,w,I){var C=[];w=w==!0?{entropy:!0}:w||{};var R=y(h(w.entropy?[x,b(t)]:x??g(),3),C),P=new f(C),z=function(){for(var $=P.g(n),B=s,V=0;$<c;)$=($+V)*o,B*=o,V=P.g(1);for(;$>=l;)$/=2,B/=2,V>>>=1;return($+V)/B};return z.int32=function(){return P.g(4)|0},z.quick=function(){return P.g(4)/4294967296},z.double=z,y(b(P.S),t),(w.pass||I||function($,B,V,H){return H&&(H.S&&d(H,P),$.state=function(){return d(P,{})}),V?(r[i]=$,B):$})(z,R,"global"in w?w.global:this==r,w.state)}function f(x){var w,I=x.length,C=this,R=0,P=C.i=C.j=0,z=C.S=[];for(I||(x=[I++]);R<o;)z[R]=R++;for(R=0;R<o;R++)z[R]=z[P=p&P+x[R%I]+(w=z[R])],z[P]=w;(C.g=function($){for(var B,V=0,H=C.i,G=C.j,X=C.S;$--;)B=X[H=p&H+1],V=V*o+X[p&(X[H]=X[G=p&G+B])+(X[G]=B)];return C.i=H,C.j=G,V})(o)}function d(x,w){return w.i=x.i,w.j=x.j,w.S=x.S.slice(),w}function h(x,w){var I=[],C=typeof x,R;if(w&&C=="object")for(R in x)try{I.push(h(x[R],w-1))}catch{}return I.length?I:C=="string"?x:x+"\0"}function y(x,w){for(var I=x+"",C,R=0;R<I.length;)w[p&R]=p&(C^=w[p&R]*19)+I.charCodeAt(R++);return b(w)}function g(){try{var x;return u&&(x=u.randomBytes)?x=x(o):(x=new Uint8Array(o),(e.crypto||e.msCrypto).getRandomValues(x)),b(x)}catch{var w=e.navigator,I=w&&w.plugins;return[+new Date,e,I,e.screen,b(t)]}}function b(x){return String.fromCharCode.apply(0,x)}if(y(r.random(),t),typeof FS=="object"&&FS.exports){FS.exports=m;try{u=zU()}catch{}}else typeof define=="function"&&define.amd?define(function(){return m}):r["seed"+i]=m})(typeof self<"u"?self:$U,[],Math)});var J3=Be((ftt,BU)=>{var jde=IU(),Gde=CU(),qde=AU(),Kde=DU(),Xde=MU(),Yde=PU(),Cm=LU();Cm.alea=jde;Cm.xor128=Gde;Cm.xorwow=qde;Cm.xorshift7=Kde;Cm.xor4096=Xde;Cm.tychei=Yde;BU.exports=Cm});var eR=Be(()=>{});var tR=Be(()=>{});var Bq=Be(()=>{});var Uq=Be(()=>{});var Wq=Be(()=>{});var Hq=Be((zk,oR)=>{var rR=(()=>{var e=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(e=e||__filename),function(t){t=t||{};function r(){return Y.buffer!=Je&&xt(Y.buffer),yt}function o(){return Y.buffer!=Je&&xt(Y.buffer),lt}function n(){return Y.buffer!=Je&&xt(Y.buffer),Nt}function a(){return Y.buffer!=Je&&xt(Y.buffer),zt}function i(){return Y.buffer!=Je&&xt(Y.buffer),Lt}function s(){return Y.buffer!=Je&&xt(Y.buffer),Kr}function c(){return Y.buffer!=Je&&xt(Y.buffer),tr}var l=typeof t<"u"?t:{},p,u;l.ready=new Promise(function(L,q){p=L,u=q});var m;typeof process<"u"&&process.listeners&&(m={uncaughtException:process.listeners("uncaughtException"),unhandledRejection:process.listeners("unhandledRejection")});var f=Object.assign({},l),d=[],h="./this.program",y=(L,q)=>{throw q},g=typeof window=="object",b=typeof importScripts=="function",x=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",w=l.ENVIRONMENT_IS_PTHREAD||!1,I="";function C(L){return l.locateFile?l.locateFile(L,I):I+L}var R,P,z,$;function B(L){if(L instanceof mi)return;Z("exiting due to exception: "+L)}if(x){var V=eR(),H=tR();b?I=H.dirname(I)+"/":I=__dirname+"/",R=(q,he)=>(q=So(q)?new URL(q):H.normalize(q),V.readFileSync(q,he?void 0:"utf8")),z=q=>{var he=R(q,!0);return he.buffer||(he=new Uint8Array(he)),he},P=(q,he,qe)=>{q=So(q)?new URL(q):H.normalize(q),V.readFile(q,function(at,tt){at?qe(at):he(tt.buffer)})},process.argv.length>1&&(h=process.argv[1].replace(/\\/g,"/")),d=process.argv.slice(2),process.on("uncaughtException",function(q){if(!(q instanceof mi))throw q}),process.on("unhandledRejection",function(q){throw q}),y=(q,he)=>{if(On())throw process.exitCode=q,he;B(he),process.exit(q)},l.inspect=function(){return"[Emscripten Module object]"};let L;try{L=Bq()}catch(q){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),q}global.Worker=L.Worker}else(g||b)&&(b?I=self.location.href:typeof document<"u"&&document.currentScript&&(I=document.currentScript.src),typeof e<"u"&&e&&(I=e),I.indexOf("blob:")!==0?I=I.substr(0,I.replace(/[?#].*/,"").lastIndexOf("/")+1):I="",x||(R=L=>{var q=new XMLHttpRequest;return q.open("GET",L,!1),q.send(null),q.responseText},b&&(z=L=>{var q=new XMLHttpRequest;return q.open("GET",L,!1),q.responseType="arraybuffer",q.send(null),new Uint8Array(q.response)}),P=(L,q,he)=>{var qe=new XMLHttpRequest;qe.open("GET",L,!0),qe.responseType="arraybuffer",qe.onload=()=>{if(qe.status==200||qe.status==0&&qe.response){q(qe.response);return}he()},qe.onerror=he,qe.send(null)}),$=L=>document.title=L);x&&typeof performance>"u"&&(global.performance=Uq().performance);var G=console.log.bind(console),X=console.warn.bind(console);x&&(G=L=>V.writeSync(1,L+`
9
+ `),X=L=>V.writeSync(2,L+`
10
+ `));var ee=l.print||G,Z=l.printErr||X;Object.assign(l,f),f=null,l.arguments&&(d=l.arguments),l.thisProgram&&(h=l.thisProgram),l.quit&&(y=l.quit);var te=4,re=Atomics.load,se=Atomics.store,ae=Atomics.compareExchange,pe;l.wasmBinary&&(pe=l.wasmBinary);var ie=l.noExitRuntime||!0;typeof WebAssembly!="object"&&to("no native wasm support detected");var Y,le,ge=!1,ve;function Ee(L,q){L||to(q)}var Se=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function Ve(L,q,he){q>>>=0;for(var qe=q+he,at=q;L[at]&&!(at>=qe);)++at;if(at-q>16&&L.buffer&&Se)return Se.decode(L.buffer instanceof SharedArrayBuffer?L.slice(q,at):L.subarray(q,at));for(var tt="";q<at;){var ke=L[q++];if(!(ke&128)){tt+=String.fromCharCode(ke);continue}var ze=L[q++]&63;if((ke&224)==192){tt+=String.fromCharCode((ke&31)<<6|ze);continue}var xr=L[q++]&63;if((ke&240)==224?ke=(ke&15)<<12|ze<<6|xr:ke=(ke&7)<<18|ze<<12|xr<<6|L[q++]&63,ke<65536)tt+=String.fromCharCode(ke);else{var zn=ke-65536;tt+=String.fromCharCode(55296|zn>>10,56320|zn&1023)}}return tt}function Ge(L,q){return L>>>=0,L?Ve(o(),L,q):""}function Ye(L,q,he,qe){if(he>>>=0,!(qe>0))return 0;for(var at=he,tt=he+qe-1,ke=0;ke<L.length;++ke){var ze=L.charCodeAt(ke);if(ze>=55296&&ze<=57343){var xr=L.charCodeAt(++ke);ze=65536+((ze&1023)<<10)|xr&1023}if(ze<=127){if(he>=tt)break;q[he++>>>0]=ze}else if(ze<=2047){if(he+1>=tt)break;q[he++>>>0]=192|ze>>6,q[he++>>>0]=128|ze&63}else if(ze<=65535){if(he+2>=tt)break;q[he++>>>0]=224|ze>>12,q[he++>>>0]=128|ze>>6&63,q[he++>>>0]=128|ze&63}else{if(he+3>=tt)break;q[he++>>>0]=240|ze>>18,q[he++>>>0]=128|ze>>12&63,q[he++>>>0]=128|ze>>6&63,q[he++>>>0]=128|ze&63}}return q[he>>>0]=0,he-at}function Ze(L,q,he){return Ye(L,o(),q,he)}var Je,yt,lt,Nt,St,zt,Lt,Kr,tr;w&&(Je=l.buffer);function xt(L){Je=L,l.HEAP8=yt=new Int8Array(L),l.HEAP16=Nt=new Int16Array(L),l.HEAP32=zt=new Int32Array(L),l.HEAPU8=lt=new Uint8Array(L),l.HEAPU16=St=new Uint16Array(L),l.HEAPU32=Lt=new Uint32Array(L),l.HEAPF32=Kr=new Float32Array(L),l.HEAPF64=tr=new Float64Array(L)}var Qt=l.INITIAL_MEMORY||16777216;if(w)Y=l.wasmMemory,Je=l.buffer;else if(l.wasmMemory)Y=l.wasmMemory;else if(Y=new WebAssembly.Memory({initial:Qt/65536,maximum:65536,shared:!0}),!(Y.buffer instanceof SharedArrayBuffer))throw Z("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"),x&&Z("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and/or recent version)"),Error("bad memory");Y&&(Je=Y.buffer),Qt=Je.byteLength,xt(Je);var Ht,_r=[],br=[],Br=[],Ao=!1;function On(){return ie}function Xo(){if(l.preRun)for(typeof l.preRun=="function"&&(l.preRun=[l.preRun]);l.preRun.length;)Pa(l.preRun.shift());Nc(_r)}function Mr(){Ao=!0,!w&&Nc(br)}function na(){if(!w){if(l.postRun)for(typeof l.postRun=="function"&&(l.postRun=[l.postRun]);l.postRun.length;)sf(l.postRun.shift());Nc(Br)}}function Pa(L){_r.unshift(L)}function za(L){br.unshift(L)}function sf(L){Br.unshift(L)}var $a=0,La=null,aa=null;function lf(L){$a++,l.monitorRunDependencies&&l.monitorRunDependencies($a)}function _c(L){if($a--,l.monitorRunDependencies&&l.monitorRunDependencies($a),$a==0&&(La!==null&&(clearInterval(La),La=null),aa)){var q=aa;aa=null,q()}}function to(L){l.onAbort&&l.onAbort(L),L="Aborted("+L+")",Z(L),ge=!0,ve=1,L+=". Build with -sASSERTIONS for more info.";var q=new WebAssembly.RuntimeError(L);throw u(q),q}var Er="data:application/octet-stream;base64,";function Ec(L){return L.startsWith(Er)}function So(L){return L.startsWith("file://")}var Or;Or="tfjs-backend-wasm-threaded-simd.wasm",Ec(Or)||(Or=C(Or));function Ic(L){try{if(L==Or&&pe)return new Uint8Array(pe);if(z)return z(L);throw"both async and sync fetching of the wasm failed"}catch(q){to(q)}}function cf(){if(!pe&&(g||b)){if(typeof fetch=="function"&&!So(Or))return fetch(Or,{credentials:"same-origin"}).then(function(L){if(!L.ok)throw"failed to load wasm binary file at '"+Or+"'";return L.arrayBuffer()}).catch(function(){return Ic(Or)});if(P)return new Promise(function(L,q){P(Or,function(he){L(new Uint8Array(he))},q)})}return Promise.resolve().then(function(){return Ic(Or)})}function pf(){var L={env:Pc,wasi_snapshot_preview1:Pc};function q(ke,ze){var xr=ke.exports;if(l.asm=xr,gf(l.asm._emscripten_tls_init),Ht=l.asm.__indirect_function_table,za(l.asm.__wasm_call_ctors),le=ze,!w){var zn=Qe.unusedWorkers.length;Qe.unusedWorkers.forEach(function(os){Qe.loadWasmModuleToWorker(os,function(){--zn||_c("wasm-instantiate")})})}}w||lf("wasm-instantiate");function he(ke){q(ke.instance,ke.module)}function qe(ke){return cf().then(function(ze){return WebAssembly.instantiate(ze,L)}).then(function(ze){return ze}).then(ke,function(ze){Z("failed to asynchronously prepare wasm: "+ze),to(ze)})}function at(){return!pe&&typeof WebAssembly.instantiateStreaming=="function"&&!Ec(Or)&&!So(Or)&&!x&&typeof fetch=="function"?fetch(Or,{credentials:"same-origin"}).then(function(ke){var ze=WebAssembly.instantiateStreaming(ke,L);return ze.then(he,function(xr){return Z("wasm streaming compile failed: "+xr),Z("falling back to ArrayBuffer instantiation"),qe(he)})}):qe(he)}if(l.instantiateWasm)try{var tt=l.instantiateWasm(L,q);return tt}catch(ke){Z("Module.instantiateWasm callback failed with error: "+ke),u(ke)}return at().catch(u),{}}var gx,Ug,Tc={};function mi(L){this.name="ExitStatus",this.message="Program terminated with exit("+L+")",this.status=L}function Wg(L){var q=Qe.pthreads[L];delete Qe.pthreads[L],q.terminate(),UE(L),Qe.runningWorkers.splice(Qe.runningWorkers.indexOf(q),1),q.pthread_ptr=0}function Hg(L){var q=Qe.pthreads[L];q.postMessage({cmd:"cancel"})}function fi(L){var q=Qe.pthreads[L];Ee(q),Qe.returnWorkerToPool(q)}function uf(L){var q=Qe.getNewWorker();if(!q)return 6;Qe.runningWorkers.push(q),Qe.pthreads[L.pthread_ptr]=q,q.pthread_ptr=L.pthread_ptr;var he={cmd:"run",start_routine:L.startRoutine,arg:L.arg,pthread_ptr:L.pthread_ptr};return q.runPthread=()=>{x&&q.ref(),q.postMessage(he,L.transferList),delete q.runPthread},q.loaded&&q.runPthread(),0}var Ji={varargs:void 0,get:function(){Ji.varargs+=4;var L=a()[Ji.varargs-4>>>2];return L},getStr:function(L){var q=Ge(L);return q}};function Cc(L){if(w)return Ua(1,1,L);ve=L,On()||(Qe.terminateAllThreads(),l.onExit&&l.onExit(L),ge=!0),y(L,new mi(L))}function mf(L,q){if(ve=L,!q&&w)throw Ac(L),"unwind";Cc(L)}var Zi=mf;function ff(L){if(L instanceof mi||L=="unwind")return ve;y(1,L)}var Qe={unusedWorkers:[],runningWorkers:[],tlsInitFunctions:[],pthreads:{},init:function(){w?Qe.initWorker():Qe.initMainThread()},initMainThread:function(){for(var L=8;L--;)Qe.allocateUnusedWorker()},initWorker:function(){ie=!1},setExitStatus:function(L){ve=L},terminateAllThreads:function(){for(var L of Object.values(Qe.pthreads))Qe.returnWorkerToPool(L);for(var L of Qe.unusedWorkers)L.terminate();Qe.unusedWorkers=[]},returnWorkerToPool:function(L){var q=L.pthread_ptr;delete Qe.pthreads[q],Qe.unusedWorkers.push(L),Qe.runningWorkers.splice(Qe.runningWorkers.indexOf(L),1),L.pthread_ptr=0,x&&L.unref(),UE(q)},receiveObjectTransfer:function(L){},threadInitTLS:function(){Qe.tlsInitFunctions.forEach(L=>L())},loadWasmModuleToWorker:function(L,q){L.onmessage=tt=>{var ke=tt.data,ze=ke.cmd;if(L.pthread_ptr&&(Qe.currentProxiedOperationCallerThread=L.pthread_ptr),ke.targetThread&&ke.targetThread!=Sx()){var xr=Qe.pthreads[ke.targetThread];xr?xr.postMessage(ke,ke.transferList):Z('Internal error! Worker sent a message "'+ze+'" to target pthread '+ke.targetThread+", but that thread no longer exists!"),Qe.currentProxiedOperationCallerThread=void 0;return}ze==="processProxyingQueue"?Rc(ke.queue):ze==="spawnThread"?uf(ke):ze==="cleanupThread"?fi(ke.thread):ze==="killThread"?Wg(ke.thread):ze==="cancelThread"?Hg(ke.thread):ze==="loaded"?(L.loaded=!0,x&&L.unref(),q&&q(L),L.runPthread&&L.runPthread()):ze==="print"?ee("Thread "+ke.threadId+": "+ke.text):ze==="printErr"?Z("Thread "+ke.threadId+": "+ke.text):ze==="alert"?alert("Thread "+ke.threadId+": "+ke.text):ke.target==="setimmediate"?L.postMessage(ke):ze==="callHandler"?l[ke.handler](...ke.args):ze&&Z("worker sent an unknown command "+ze),Qe.currentProxiedOperationCallerThread=void 0},L.onerror=tt=>{var ke="worker sent an error!";throw Z(ke+" "+tt.filename+":"+tt.lineno+": "+tt.message),tt},x&&(L.on("message",function(tt){L.onmessage({data:tt})}),L.on("error",function(tt){L.onerror(tt)}),L.on("detachedExit",function(){}));var he=[],qe=["onExit","onAbort","print","printErr"];for(var at of qe)l.hasOwnProperty(at)&&he.push(at);L.postMessage({cmd:"load",handlers:he,urlOrBlob:l.mainScriptUrlOrBlob||e,wasmMemory:Y,wasmModule:le})},allocateUnusedWorker:function(){var L,q=C("tfjs-backend-wasm-threaded-simd.worker.js");L=new Worker(q),Qe.unusedWorkers.push(L)},getNewWorker:function(){return Qe.unusedWorkers.length==0&&(Qe.allocateUnusedWorker(),Qe.loadWasmModuleToWorker(Qe.unusedWorkers[0])),Qe.unusedWorkers.pop()}};l.PThread=Qe;function Nc(L){for(;L.length>0;)L.shift()(l)}function Vg(){var L=Sx(),q=a()[L+52>>>2],he=a()[L+56>>>2],qe=q-he;QD(q,qe),kx(q)}l.establishStackSpace=Vg;function Ac(L){if(w)return Ua(2,0,L);try{Zi(L)}catch(q){ff(q)}}var Ba=[];function df(L){var q=Ba[L];return q||(L>=Ba.length&&(Ba.length=L+1),Ba[L]=q=Ht.get(L)),q}function hf(L,q){var he=df(L)(q);On()?Qe.setExitStatus(he):YD(he)}l.invokeEntryPoint=hf;function gf(L){Qe.tlsInitFunctions.push(L)}function jg(L){qD(L,!b,1,!g),Qe.threadInitTLS()}function Gg(L){w?postMessage({cmd:"cleanupThread",thread:L}):fi(L)}function yf(L,q,he,qe){return w?Ua(3,1,L,q,he,qe):vf(L,q,he,qe)}function vf(L,q,he,qe){if(typeof SharedArrayBuffer>"u")return Z("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var at=[],tt=0;if(w&&(at.length===0||tt))return yf(L,q,he,qe);if(tt)return tt;var ke={startRoutine:he,pthread_ptr:L,arg:qe,transferList:at};return w?(ke.cmd="spawnThread",postMessage(ke,at),0):uf(ke)}function bf(){return 65536}var xf=!0;function qg(){return xf}function Rc(L){Atomics.store(a(),L>>2,1),Sx()&&XD(L),Atomics.compareExchange(a(),L>>2,1,0)}l.executeNotifiedProxyingQueue=Rc;function Kg(L,q,he,qe){if(L==q)setTimeout(()=>Rc(qe));else if(w)postMessage({targetThread:L,cmd:"processProxyingQueue",queue:qe});else{var at=Qe.pthreads[L];if(!at)return;at.postMessage({cmd:"processProxyingQueue",queue:qe})}return 1}function Xg(L,q,he){return-1}function wf(){to("")}function di(L){di.shown||(di.shown={}),di.shown[L]||(di.shown[L]=1,x&&(L="warning: "+L),Z(L))}function Dc(){x||b||di("Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread")}function Sf(){return Date.now()}function Ys(){return 4294901760}function es(){return Ys()}var ko;x?ko=()=>{var L=process.hrtime();return L[0]*1e3+L[1]/1e6}:ko=()=>performance.timeOrigin+performance.now();function Yg(L,q,he){o().copyWithin(L>>>0,q>>>0,q+he>>>0)}function Qg(){return x?Wq().cpus().length:navigator.hardwareConcurrency}function kf(L){var q=WE(),he=L();return kx(q),he}function Ua(L,q){var he=arguments.length-2,qe=arguments;return kf(()=>{for(var at=he,tt=_x(at*8),ke=tt>>3,ze=0;ze<he;ze++){var xr=qe[2+ze];c()[ke+ze>>>0]=xr}return KD(L,at,tt,q)})}var uo=[];function _f(L,q,he){uo.length=q;for(var qe=he>>3,at=0;at<q;at++)uo[at]=c()[qe+at>>>0];var tt=L<0,ke=tt?Tc[-L-1]:Rf[L];return ke.apply(null,uo)}function ts(L){try{return Y.grow(L-Je.byteLength+65535>>>16),xt(Y.buffer),1}catch{}}function Ef(L){var q=o().length;if(L=L>>>0,L<=q)return!1;var he=Ys();if(L>he)return!1;let qe=(xr,zn)=>xr+(zn-xr%zn)%zn;for(var at=1;at<=4;at*=2){var tt=q*(1+.2/at);tt=Math.min(tt,L+100663296);var ke=Math.min(he,qe(Math.max(L,tt),65536)),ze=ts(ke);if(ze)return!0}return!1}function Fc(){throw"unwind"}function If(L){return w?Ua(4,1,L):52}function Tf(L,q,he,qe,at){return w?Ua(5,1,L,q,he,qe,at):70}var Qs=[null,[],[]];function Cf(L,q){var he=Qs[L];q===0||q===10?((L===1?ee:Z)(Ve(he,0)),he.length=0):he.push(q)}function Mc(L,q,he,qe){if(w)return Ua(6,1,L,q,he,qe);for(var at=0,tt=0;tt<he;tt++){var ke=i()[q>>>2],ze=i()[q+4>>>2];q+=8;for(var xr=0;xr<ze;xr++)Cf(L,o()[ke+xr>>>0]);at+=ze}return i()[qe>>>2]=at,0}function Nf(L){var q=l["_"+L];return q}function Jg(L,q){r().set(L,q>>>0)}function Oc(L,q,he,qe,at){var tt={string:hn=>{var Wf=0;if(hn!=null&&hn!==0){var e4=(hn.length<<2)+1;Wf=_x(e4),Ze(hn,Wf,e4)}return Wf},array:hn=>{var Wf=_x(hn.length);return Jg(hn,Wf),Wf}};function ke(hn){return q==="string"?Ge(hn):q==="boolean"?!!hn:hn}var ze=Nf(L),xr=[],zn=0;if(qe)for(var os=0;os<qe.length;os++){var ZD=tt[he[os]];ZD?(zn===0&&(zn=WE()),xr[os]=ZD(qe[os])):xr[os]=qe[os]}var HE=ze.apply(null,xr);function Koe(hn){return zn!==0&&kx(zn),ke(hn)}return HE=Koe(HE),HE}function Af(L,q,he,qe){he=he||[];var at=he.every(ke=>ke==="number"||ke==="boolean"),tt=q!=="string";return tt&&at&&!qe?Nf(L):function(){return Oc(L,q,he,arguments,qe)}}Qe.init();var Rf=[null,Cc,Ac,yf,If,Tf,Mc],Pc={__emscripten_init_main_thread_js:jg,__emscripten_thread_cleanup:Gg,__pthread_create_js:vf,_emscripten_default_pthread_stack_size:bf,_emscripten_get_now_is_monotonic:qg,_emscripten_notify_task_queue:Kg,_emscripten_set_offscreencanvas_size:Xg,abort:wf,emscripten_check_blocking_allowed:Dc,emscripten_date_now:Sf,emscripten_get_heap_max:es,emscripten_get_now:ko,emscripten_memcpy_big:Yg,emscripten_num_logical_cores:Qg,emscripten_receive_on_main_thread_js:_f,emscripten_resize_heap:Ef,emscripten_unwind_to_js_event_loop:Fc,exit:Zi,fd_close:If,fd_seek:Tf,fd_write:Mc,memory:Y||l.wasmMemory},Zg=pf(),Df=l.___wasm_call_ctors=function(){return(Df=l.___wasm_call_ctors=l.asm.__wasm_call_ctors).apply(null,arguments)},Ff=l._init=function(){return(Ff=l._init=l.asm.init).apply(null,arguments)},Mf=l._init_with_threads_count=function(){return(Mf=l._init_with_threads_count=l.asm.init_with_threads_count).apply(null,arguments)},ey=l._get_threads_count=function(){return(ey=l._get_threads_count=l.asm.get_threads_count).apply(null,arguments)},Of=l._register_tensor=function(){return(Of=l._register_tensor=l.asm.register_tensor).apply(null,arguments)},ty=l._dispose_data=function(){return(ty=l._dispose_data=l.asm.dispose_data).apply(null,arguments)},ry=l._dispose=function(){return(ry=l._dispose=l.asm.dispose).apply(null,arguments)},zc=l._Abs=function(){return(zc=l._Abs=l.asm.Abs).apply(null,arguments)},Pf=l._Acos=function(){return(Pf=l._Acos=l.asm.Acos).apply(null,arguments)},oy=l._Acosh=function(){return(oy=l._Acosh=l.asm.Acosh).apply(null,arguments)},ny=l._Add=function(){return(ny=l._Add=l.asm.Add).apply(null,arguments)},ay=l._AddN=function(){return(ay=l._AddN=l.asm.AddN).apply(null,arguments)},iy=l._All=function(){return(iy=l._All=l.asm.All).apply(null,arguments)},zf=l._Any=function(){return(zf=l._Any=l.asm.Any).apply(null,arguments)},sy=l._ArgMax=function(){return(sy=l._ArgMax=l.asm.ArgMax).apply(null,arguments)},ly=l._ArgMin=function(){return(ly=l._ArgMin=l.asm.ArgMin).apply(null,arguments)},$c=l._Asin=function(){return($c=l._Asin=l.asm.Asin).apply(null,arguments)},cy=l._Asinh=function(){return(cy=l._Asinh=l.asm.Asinh).apply(null,arguments)},py=l._Atan=function(){return(py=l._Atan=l.asm.Atan).apply(null,arguments)},uy=l._Atan2=function(){return(uy=l._Atan2=l.asm.Atan2).apply(null,arguments)},Js=l._Atanh=function(){return(Js=l._Atanh=l.asm.Atanh).apply(null,arguments)},my=l._AvgPool=function(){return(my=l._AvgPool=l.asm.AvgPool).apply(null,arguments)},fy=l._AvgPool3D=function(){return(fy=l._AvgPool3D=l.asm.AvgPool3D).apply(null,arguments)},dy=l._AvgPool3DGrad=function(){return(dy=l._AvgPool3DGrad=l.asm.AvgPool3DGrad).apply(null,arguments)},$f=l._AvgPoolGrad=function(){return($f=l._AvgPoolGrad=l.asm.AvgPoolGrad).apply(null,arguments)},v=l._BatchMatMul=function(){return(v=l._BatchMatMul=l.asm.BatchMatMul).apply(null,arguments)},E=l._Bincount=function(){return(E=l._Bincount=l.asm.Bincount).apply(null,arguments)},N=l._BitwiseAnd=function(){return(N=l._BitwiseAnd=l.asm.BitwiseAnd).apply(null,arguments)},O=l._Ceil=function(){return(O=l._Ceil=l.asm.Ceil).apply(null,arguments)},U=l._ClipByValue=function(){return(U=l._ClipByValue=l.asm.ClipByValue).apply(null,arguments)},j=l._Conv2D=function(){return(j=l._Conv2D=l.asm.Conv2D).apply(null,arguments)},W=l._Conv2DBackpropInput=function(){return(W=l._Conv2DBackpropInput=l.asm.Conv2DBackpropInput).apply(null,arguments)},Q=l._Conv3D=function(){return(Q=l._Conv3D=l.asm.Conv3D).apply(null,arguments)},oe=l._Conv3DBackpropFilterV2=function(){return(oe=l._Conv3DBackpropFilterV2=l.asm.Conv3DBackpropFilterV2).apply(null,arguments)},de=l._Conv3DBackpropInputV2=function(){return(de=l._Conv3DBackpropInputV2=l.asm.Conv3DBackpropInputV2).apply(null,arguments)},Te=l._Cos=function(){return(Te=l._Cos=l.asm.Cos).apply(null,arguments)},Ke=l._Cosh=function(){return(Ke=l._Cosh=l.asm.Cosh).apply(null,arguments)},Xe=l._CropAndResize=function(){return(Xe=l._CropAndResize=l.asm.CropAndResize).apply(null,arguments)},De=l._Cumprod=function(){return(De=l._Cumprod=l.asm.Cumprod).apply(null,arguments)},et=l._Cumsum=function(){return(et=l._Cumsum=l.asm.Cumsum).apply(null,arguments)},kt=l._DenseBincount=function(){return(kt=l._DenseBincount=l.asm.DenseBincount).apply(null,arguments)},Jt=l._DepthToSpace=function(){return(Jt=l._DepthToSpace=l.asm.DepthToSpace).apply(null,arguments)},qt=l._DepthwiseConv2dNative=function(){return(qt=l._DepthwiseConv2dNative=l.asm.DepthwiseConv2dNative).apply(null,arguments)},Ur=l._Diag=function(){return(Ur=l._Diag=l.asm.Diag).apply(null,arguments)},Ro=l._Dilation2D=function(){return(Ro=l._Dilation2D=l.asm.Dilation2D).apply(null,arguments)},mo=l._Dilation2DBackpropFilter=function(){return(mo=l._Dilation2DBackpropFilter=l.asm.Dilation2DBackpropFilter).apply(null,arguments)},At=l._Dilation2DBackpropInput=function(){return(At=l._Dilation2DBackpropInput=l.asm.Dilation2DBackpropInput).apply(null,arguments)},Ir=l._Elu=function(){return(Ir=l._Elu=l.asm.Elu).apply(null,arguments)},ia=l._EluGrad=function(){return(ia=l._EluGrad=l.asm.EluGrad).apply(null,arguments)},j2=l._Equal=function(){return(j2=l._Equal=l.asm.Equal).apply(null,arguments)},G2=l._Erf=function(){return(G2=l._Erf=l.asm.Erf).apply(null,arguments)},q2=l._Exp=function(){return(q2=l._Exp=l.asm.Exp).apply(null,arguments)},K2=l._Expm1=function(){return(K2=l._Expm1=l.asm.Expm1).apply(null,arguments)},X2=l._FlipLeftRight=function(){return(X2=l._FlipLeftRight=l.asm.FlipLeftRight).apply(null,arguments)},Y2=l._Floor=function(){return(Y2=l._Floor=l.asm.Floor).apply(null,arguments)},Q2=l._FloorDiv=function(){return(Q2=l._FloorDiv=l.asm.FloorDiv).apply(null,arguments)},J2=l._FusedBatchNorm=function(){return(J2=l._FusedBatchNorm=l.asm.FusedBatchNorm).apply(null,arguments)},Z2=l._FusedConv2D=function(){return(Z2=l._FusedConv2D=l.asm.FusedConv2D).apply(null,arguments)},eE=l._FusedDepthwiseConv2D=function(){return(eE=l._FusedDepthwiseConv2D=l.asm.FusedDepthwiseConv2D).apply(null,arguments)},tE=l._Gather=function(){return(tE=l._Gather=l.asm.Gather).apply(null,arguments)},rE=l._GatherNd=function(){return(rE=l._GatherNd=l.asm.GatherNd).apply(null,arguments)},oE=l._Greater=function(){return(oE=l._Greater=l.asm.Greater).apply(null,arguments)},nE=l._GreaterEqual=function(){return(nE=l._GreaterEqual=l.asm.GreaterEqual).apply(null,arguments)},aE=l._IsFinite=function(){return(aE=l._IsFinite=l.asm.IsFinite).apply(null,arguments)},iE=l._IsInf=function(){return(iE=l._IsInf=l.asm.IsInf).apply(null,arguments)},sE=l._IsNan=function(){return(sE=l._IsNan=l.asm.IsNan).apply(null,arguments)},lE=l._LRN=function(){return(lE=l._LRN=l.asm.LRN).apply(null,arguments)},cE=l._LRNGrad=function(){return(cE=l._LRNGrad=l.asm.LRNGrad).apply(null,arguments)},pE=l._LeakyRelu=function(){return(pE=l._LeakyRelu=l.asm.LeakyRelu).apply(null,arguments)},uE=l._Less=function(){return(uE=l._Less=l.asm.Less).apply(null,arguments)},mE=l._LessEqual=function(){return(mE=l._LessEqual=l.asm.LessEqual).apply(null,arguments)},fE=l._LinSpace=function(){return(fE=l._LinSpace=l.asm.LinSpace).apply(null,arguments)},dE=l._Log=function(){return(dE=l._Log=l.asm.Log).apply(null,arguments)},hE=l._Log1p=function(){return(hE=l._Log1p=l.asm.Log1p).apply(null,arguments)},gE=l._LogicalAnd=function(){return(gE=l._LogicalAnd=l.asm.LogicalAnd).apply(null,arguments)},yE=l._LogicalNot=function(){return(yE=l._LogicalNot=l.asm.LogicalNot).apply(null,arguments)},vE=l._LogicalOr=function(){return(vE=l._LogicalOr=l.asm.LogicalOr).apply(null,arguments)},bE=l._LogicalXor=function(){return(bE=l._LogicalXor=l.asm.LogicalXor).apply(null,arguments)},xE=l._Max=function(){return(xE=l._Max=l.asm.Max).apply(null,arguments)},wE=l._MaxPool=function(){return(wE=l._MaxPool=l.asm.MaxPool).apply(null,arguments)},SE=l._MaxPool3D=function(){return(SE=l._MaxPool3D=l.asm.MaxPool3D).apply(null,arguments)},kE=l._MaxPool3DGrad=function(){return(kE=l._MaxPool3DGrad=l.asm.MaxPool3DGrad).apply(null,arguments)},_E=l._MaxPoolGrad=function(){return(_E=l._MaxPoolGrad=l.asm.MaxPoolGrad).apply(null,arguments)},EE=l._MaxPoolWithArgmax=function(){return(EE=l._MaxPoolWithArgmax=l.asm.MaxPoolWithArgmax).apply(null,arguments)},IE=l._Maximum=function(){return(IE=l._Maximum=l.asm.Maximum).apply(null,arguments)},TE=l._Mean=function(){return(TE=l._Mean=l.asm.Mean).apply(null,arguments)},CE=l._Min=function(){return(CE=l._Min=l.asm.Min).apply(null,arguments)},NE=l._Minimum=function(){return(NE=l._Minimum=l.asm.Minimum).apply(null,arguments)},AE=l._MirrorPad=function(){return(AE=l._MirrorPad=l.asm.MirrorPad).apply(null,arguments)},RE=l._Mod=function(){return(RE=l._Mod=l.asm.Mod).apply(null,arguments)},DE=l._Multinomial=function(){return(DE=l._Multinomial=l.asm.Multinomial).apply(null,arguments)},FE=l._Multiply=function(){return(FE=l._Multiply=l.asm.Multiply).apply(null,arguments)},ME=l._Neg=function(){return(ME=l._Neg=l.asm.Neg).apply(null,arguments)},OE=l._NonMaxSuppressionV3=function(){return(OE=l._NonMaxSuppressionV3=l.asm.NonMaxSuppressionV3).apply(null,arguments)},PE=l._NonMaxSuppressionV4=function(){return(PE=l._NonMaxSuppressionV4=l.asm.NonMaxSuppressionV4).apply(null,arguments)},yx=l._NonMaxSuppressionV5=function(){return(yx=l._NonMaxSuppressionV5=l.asm.NonMaxSuppressionV5).apply(null,arguments)},vx=l._NotEqual=function(){return(vx=l._NotEqual=l.asm.NotEqual).apply(null,arguments)},hy=l._OneHot=function(){return(hy=l._OneHot=l.asm.OneHot).apply(null,arguments)},zE=l._PadV2=function(){return(zE=l._PadV2=l.asm.PadV2).apply(null,arguments)},$E=l._Pow=function(){return($E=l._Pow=l.asm.Pow).apply(null,arguments)},Lf=l._Prelu=function(){return(Lf=l._Prelu=l.asm.Prelu).apply(null,arguments)},bx=l._Prod=function(){return(bx=l._Prod=l.asm.Prod).apply(null,arguments)},Bf=l._RealDiv=function(){return(Bf=l._RealDiv=l.asm.RealDiv).apply(null,arguments)},Uf=l._Reciprocal=function(){return(Uf=l._Reciprocal=l.asm.Reciprocal).apply(null,arguments)},LE=l._Relu=function(){return(LE=l._Relu=l.asm.Relu).apply(null,arguments)},J=l._Relu6=function(){return(J=l._Relu6=l.asm.Relu6).apply(null,arguments)},me=l._ResizeBilinear=function(){return(me=l._ResizeBilinear=l.asm.ResizeBilinear).apply(null,arguments)},Le=l._ResizeBilinearGrad=function(){return(Le=l._ResizeBilinearGrad=l.asm.ResizeBilinearGrad).apply(null,arguments)},Mt=l._ResizeNearestNeighbor=function(){return(Mt=l._ResizeNearestNeighbor=l.asm.ResizeNearestNeighbor).apply(null,arguments)},ur=l._ResizeNearestNeighborGrad=function(){return(ur=l._ResizeNearestNeighborGrad=l.asm.ResizeNearestNeighborGrad).apply(null,arguments)},mr=l._Reverse=function(){return(mr=l._Reverse=l.asm.Reverse).apply(null,arguments)},vt=l._RotateWithOffset=function(){return(vt=l._RotateWithOffset=l.asm.RotateWithOffset).apply(null,arguments)},ft=l._Round=function(){return(ft=l._Round=l.asm.Round).apply(null,arguments)},Wr=l._Rsqrt=function(){return(Wr=l._Rsqrt=l.asm.Rsqrt).apply(null,arguments)},Pn=l._ScatterNd=function(){return(Pn=l._ScatterNd=l.asm.ScatterNd).apply(null,arguments)},rs=l._SearchSorted=function(){return(rs=l._SearchSorted=l.asm.SearchSorted).apply(null,arguments)},xx=l._SelectV2=function(){return(xx=l._SelectV2=l.asm.SelectV2).apply(null,arguments)},gy=l._Selu=function(){return(gy=l._Selu=l.asm.Selu).apply(null,arguments)},BE=l._Sigmoid=function(){return(BE=l._Sigmoid=l.asm.Sigmoid).apply(null,arguments)},Do=l._Sign=function(){return(Do=l._Sign=l.asm.Sign).apply(null,arguments)},Zs=l._Sin=function(){return(Zs=l._Sin=l.asm.Sin).apply(null,arguments)},wx=l._Sinh=function(){return(wx=l._Sinh=l.asm.Sinh).apply(null,arguments)},goe=l._Softmax=function(){return(goe=l._Softmax=l.asm.Softmax).apply(null,arguments)},yoe=l._Softplus=function(){return(yoe=l._Softplus=l.asm.Softplus).apply(null,arguments)},voe=l._SparseFillEmptyRows=function(){return(voe=l._SparseFillEmptyRows=l.asm.SparseFillEmptyRows).apply(null,arguments)},boe=l._SparseReshape=function(){return(boe=l._SparseReshape=l.asm.SparseReshape).apply(null,arguments)},xoe=l._SparseSegmentReduction=function(){return(xoe=l._SparseSegmentReduction=l.asm.SparseSegmentReduction).apply(null,arguments)},woe=l._SparseToDense=function(){return(woe=l._SparseToDense=l.asm.SparseToDense).apply(null,arguments)},Soe=l._Sqrt=function(){return(Soe=l._Sqrt=l.asm.Sqrt).apply(null,arguments)},koe=l._Square=function(){return(koe=l._Square=l.asm.Square).apply(null,arguments)},_oe=l._SquaredDifference=function(){return(_oe=l._SquaredDifference=l.asm.SquaredDifference).apply(null,arguments)},Eoe=l._Step=function(){return(Eoe=l._Step=l.asm.Step).apply(null,arguments)},Ioe=l._StridedSlice=function(){return(Ioe=l._StridedSlice=l.asm.StridedSlice).apply(null,arguments)},Toe=l._Sub=function(){return(Toe=l._Sub=l.asm.Sub).apply(null,arguments)},Coe=l._Sum=function(){return(Coe=l._Sum=l.asm.Sum).apply(null,arguments)},Noe=l._Tan=function(){return(Noe=l._Tan=l.asm.Tan).apply(null,arguments)},Aoe=l._Tanh=function(){return(Aoe=l._Tanh=l.asm.Tanh).apply(null,arguments)},Roe=l._TensorScatterUpdate=function(){return(Roe=l._TensorScatterUpdate=l.asm.TensorScatterUpdate).apply(null,arguments)},Doe=l._Tile=function(){return(Doe=l._Tile=l.asm.Tile).apply(null,arguments)},Foe=l._TopK=function(){return(Foe=l._TopK=l.asm.TopK).apply(null,arguments)},Moe=l._Transform=function(){return(Moe=l._Transform=l.asm.Transform).apply(null,arguments)},Ooe=l._Transpose=function(){return(Ooe=l._Transpose=l.asm.Transpose).apply(null,arguments)},Poe=l.__FusedMatMul=function(){return(Poe=l.__FusedMatMul=l.asm._FusedMatMul).apply(null,arguments)},zoe=l._malloc=function(){return(zoe=l._malloc=l.asm.malloc).apply(null,arguments)},$oe=l._free=function(){return($oe=l._free=l.asm.free).apply(null,arguments)},Loe=l.__emscripten_tls_init=function(){return(Loe=l.__emscripten_tls_init=l.asm._emscripten_tls_init).apply(null,arguments)},Sx=l._pthread_self=function(){return(Sx=l._pthread_self=l.asm.pthread_self).apply(null,arguments)},Boe=l.___errno_location=function(){return(Boe=l.___errno_location=l.asm.__errno_location).apply(null,arguments)},qD=l.__emscripten_thread_init=function(){return(qD=l.__emscripten_thread_init=l.asm._emscripten_thread_init).apply(null,arguments)},Uoe=l.__emscripten_thread_crashed=function(){return(Uoe=l.__emscripten_thread_crashed=l.asm._emscripten_thread_crashed).apply(null,arguments)},Woe=l._emscripten_main_thread_process_queued_calls=function(){return(Woe=l._emscripten_main_thread_process_queued_calls=l.asm.emscripten_main_thread_process_queued_calls).apply(null,arguments)},Hoe=l._emscripten_main_browser_thread_id=function(){return(Hoe=l._emscripten_main_browser_thread_id=l.asm.emscripten_main_browser_thread_id).apply(null,arguments)},KD=l._emscripten_run_in_main_runtime_thread_js=function(){return(KD=l._emscripten_run_in_main_runtime_thread_js=l.asm.emscripten_run_in_main_runtime_thread_js).apply(null,arguments)},Voe=l._emscripten_dispatch_to_thread_=function(){return(Voe=l._emscripten_dispatch_to_thread_=l.asm.emscripten_dispatch_to_thread_).apply(null,arguments)},XD=l.__emscripten_proxy_execute_task_queue=function(){return(XD=l.__emscripten_proxy_execute_task_queue=l.asm._emscripten_proxy_execute_task_queue).apply(null,arguments)},UE=l.__emscripten_thread_free_data=function(){return(UE=l.__emscripten_thread_free_data=l.asm._emscripten_thread_free_data).apply(null,arguments)},YD=l.__emscripten_thread_exit=function(){return(YD=l.__emscripten_thread_exit=l.asm._emscripten_thread_exit).apply(null,arguments)},QD=l._emscripten_stack_set_limits=function(){return(QD=l._emscripten_stack_set_limits=l.asm.emscripten_stack_set_limits).apply(null,arguments)},WE=l.stackSave=function(){return(WE=l.stackSave=l.asm.stackSave).apply(null,arguments)},kx=l.stackRestore=function(){return(kx=l.stackRestore=l.asm.stackRestore).apply(null,arguments)},_x=l.stackAlloc=function(){return(_x=l.stackAlloc=l.asm.stackAlloc).apply(null,arguments)},joe=l.dynCall_iijjiiii=function(){return(joe=l.dynCall_iijjiiii=l.asm.dynCall_iijjiiii).apply(null,arguments)},Goe=l.dynCall_jiji=function(){return(Goe=l.dynCall_jiji=l.asm.dynCall_jiji).apply(null,arguments)};l.keepRuntimeAlive=On,l.wasmMemory=Y,l.cwrap=Af,l.ExitStatus=mi,l.PThread=Qe;var Ex;aa=function L(){Ex||JD(),Ex||(aa=L)};function JD(L){if(L=L||d,$a>0)return;if(w){p(l),Mr(),startWorker(l);return}if(Xo(),$a>0)return;function q(){Ex||(Ex=!0,l.calledRun=!0,!ge&&(Mr(),p(l),l.onRuntimeInitialized&&l.onRuntimeInitialized(),na()))}l.setStatus?(l.setStatus("Running..."),setTimeout(function(){setTimeout(function(){l.setStatus("")},1),q()},1)):q()}if(l.preInit)for(typeof l.preInit=="function"&&(l.preInit=[l.preInit]);l.preInit.length>0;)l.preInit.pop()();JD();var Ix;m&&(Ix={uncaughtException:process.listeners("uncaughtException").filter(function(L){return!m.uncaughtException.indexOf(L)>-1}),unhandledRejection:process.listeners("unhandledRejection").filter(function(L){return!m.unhandledRejection.indexOf(L)>-1})});var Tx;if(typeof WasmBackendModule<"u")Tx=WasmBackendModule;else if(typeof t<"u")Tx=t;else throw new Error("Could not find wasm module in post.js");if(Ix){var qoe=Tx._dispose;Tx._dispose=function(){qoe(),Ix.uncaughtException.forEach(function(L){process.removeListener("uncaughtException",L)}),Ix.unhandledRejection.forEach(function(L){process.removeListener("unhandledRejection",L)})}}return t.ready}})();typeof zk=="object"&&typeof oR=="object"?oR.exports=rR:typeof define=="function"&&define.amd?define([],function(){return rR}):typeof zk=="object"&&(zk.WasmBackendModuleThreadedSimd=rR)});var jq=Be((VMt,Vq)=>{Vq.exports.wasmWorkerContents=`"use strict";var Module={};var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";if(ENVIRONMENT_IS_NODE){var nodeWorkerThreads=require("worker_threads");var parentPort=nodeWorkerThreads.parentPort;parentPort.on("message",data=>onmessage({data:data}));var fs=require("fs");Object.assign(global,{self:global,require:require,Module:Module,location:{href:__filename},Worker:nodeWorkerThreads.Worker,importScripts:function(f){(0,eval)(fs.readFileSync(f,"utf8")+"//# sourceURL="+f)},postMessage:function(msg){parentPort.postMessage(msg)},performance:global.performance||{now:function(){return Date.now()}}})}var initializedJS=false;var pendingNotifiedProxyingQueues=[];function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");if(ENVIRONMENT_IS_NODE){fs.writeSync(2,text+"
11
+ ");return}console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:Module["_pthread_self"]()})}var err=threadPrintErr;self.alert=threadAlert;Module["instantiateWasm"]=(info,receiveInstance)=>{var instance=new WebAssembly.Instance(Module["wasmModule"],info);receiveInstance(instance);Module["wasmModule"]=null;return instance.exports};self.onunhandledrejection=e=>{throw e.reason??e};self.startWorker=instance=>{Module=instance;postMessage({"cmd":"loaded"})};self.onmessage=e=>{try{if(e.data.cmd==="load"){Module["wasmModule"]=e.data.wasmModule;for(const handler of e.data.handlers){Module[handler]=function(){postMessage({cmd:"callHandler",handler:handler,args:[...arguments]})}}Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;if(typeof e.data.urlOrBlob=="string"){importScripts(e.data.urlOrBlob)}else{var objectUrl=URL.createObjectURL(e.data.urlOrBlob);importScripts(objectUrl);URL.revokeObjectURL(objectUrl)}WasmBackendModuleThreadedSimd(Module)}else if(e.data.cmd==="run"){Module["__emscripten_thread_init"](e.data.pthread_ptr,0,0,1);Module["establishStackSpace"]();Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].threadInitTLS();if(!initializedJS){pendingNotifiedProxyingQueues.forEach(queue=>{Module["executeNotifiedProxyingQueue"](queue)});pendingNotifiedProxyingQueues=[];initializedJS=true}try{Module["invokeEntryPoint"](e.data.start_routine,e.data.arg)}catch(ex){if(ex!="unwind"){if(ex instanceof Module["ExitStatus"]){if(Module["keepRuntimeAlive"]()){}else{Module["__emscripten_thread_exit"](ex.status)}}else{throw ex}}}}else if(e.data.cmd==="cancel"){if(Module["_pthread_self"]()){Module["__emscripten_thread_exit"](-1)}}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="processProxyingQueue"){if(initializedJS){Module["executeNotifiedProxyingQueue"](e.data.queue)}else{pendingNotifiedProxyingQueues.push(e.data.queue)}}else if(e.data.cmd){err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){if(Module["__emscripten_thread_crashed"]){Module["__emscripten_thread_crashed"]()}throw ex}};`});var Gq=Be(($k,aR)=>{var nR=(()=>{var e=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(e=e||__filename),function(t){t=t||{};var r=typeof t<"u"?t:{},o,n;r.ready=new Promise(function(J,me){o=J,n=me});var a;typeof process<"u"&&process.listeners&&(a={uncaughtException:process.listeners("uncaughtException"),unhandledRejection:process.listeners("unhandledRejection")});var i=Object.assign({},r),s=[],c="./this.program",l=(J,me)=>{throw me},p=typeof window=="object",u=typeof importScripts=="function",m=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",f="";function d(J){return r.locateFile?r.locateFile(J,f):f+J}var h,y,g,b;function x(J){if(J instanceof La)return;R("exiting due to exception: "+J)}if(m){var w=eR(),I=tR();u?f=I.dirname(f)+"/":f=__dirname+"/",h=(J,me)=>(J=Xo(J)?new URL(J):I.normalize(J),w.readFileSync(J,me?void 0:"utf8")),g=J=>{var me=h(J,!0);return me.buffer||(me=new Uint8Array(me)),me},y=(J,me,Le)=>{J=Xo(J)?new URL(J):I.normalize(J),w.readFile(J,function(Mt,ur){Mt?Le(Mt):me(ur.buffer)})},process.argv.length>1&&(c=process.argv[1].replace(/\\/g,"/")),s=process.argv.slice(2),process.on("uncaughtException",function(J){if(!(J instanceof La))throw J}),process.on("unhandledRejection",function(J){throw J}),l=(J,me)=>{if(lt())throw process.exitCode=J,me;x(me),process.exit(J)},r.inspect=function(){return"[Emscripten Module object]"}}else(p||u)&&(u?f=self.location.href:typeof document<"u"&&document.currentScript&&(f=document.currentScript.src),e&&(f=e),f.indexOf("blob:")!==0?f=f.substr(0,f.replace(/[?#].*/,"").lastIndexOf("/")+1):f="",h=J=>{var me=new XMLHttpRequest;return me.open("GET",J,!1),me.send(null),me.responseText},u&&(g=J=>{var me=new XMLHttpRequest;return me.open("GET",J,!1),me.responseType="arraybuffer",me.send(null),new Uint8Array(me.response)}),y=(J,me,Le)=>{var Mt=new XMLHttpRequest;Mt.open("GET",J,!0),Mt.responseType="arraybuffer",Mt.onload=()=>{if(Mt.status==200||Mt.status==0&&Mt.response){me(Mt.response);return}Le()},Mt.onerror=Le,Mt.send(null)},b=J=>document.title=J);var C=r.print||console.log.bind(console),R=r.printErr||console.warn.bind(console);Object.assign(r,i),i=null,r.arguments&&(s=r.arguments),r.thisProgram&&(c=r.thisProgram),r.quit&&(l=r.quit);var P=4,z;r.wasmBinary&&(z=r.wasmBinary);var $=r.noExitRuntime||!0;typeof WebAssembly!="object"&&Br("no native wasm support detected");var B,V=!1,H;function G(J,me){J||Br(me)}var X=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function ee(J,me,Le){me>>>=0;for(var Mt=me+Le,ur=me;J[ur]&&!(ur>=Mt);)++ur;if(ur-me>16&&J.buffer&&X)return X.decode(J.subarray(me,ur));for(var mr="";me<ur;){var vt=J[me++];if(!(vt&128)){mr+=String.fromCharCode(vt);continue}var ft=J[me++]&63;if((vt&224)==192){mr+=String.fromCharCode((vt&31)<<6|ft);continue}var Wr=J[me++]&63;if((vt&240)==224?vt=(vt&15)<<12|ft<<6|Wr:vt=(vt&7)<<18|ft<<12|Wr<<6|J[me++]&63,vt<65536)mr+=String.fromCharCode(vt);else{var Pn=vt-65536;mr+=String.fromCharCode(55296|Pn>>10,56320|Pn&1023)}}return mr}function Z(J,me){return J>>>=0,J?ee(pe,J,me):""}function te(J,me,Le,Mt){if(Le>>>=0,!(Mt>0))return 0;for(var ur=Le,mr=Le+Mt-1,vt=0;vt<J.length;++vt){var ft=J.charCodeAt(vt);if(ft>=55296&&ft<=57343){var Wr=J.charCodeAt(++vt);ft=65536+((ft&1023)<<10)|Wr&1023}if(ft<=127){if(Le>=mr)break;me[Le++>>>0]=ft}else if(ft<=2047){if(Le+1>=mr)break;me[Le++>>>0]=192|ft>>6,me[Le++>>>0]=128|ft&63}else if(ft<=65535){if(Le+2>=mr)break;me[Le++>>>0]=224|ft>>12,me[Le++>>>0]=128|ft>>6&63,me[Le++>>>0]=128|ft&63}else{if(Le+3>=mr)break;me[Le++>>>0]=240|ft>>18,me[Le++>>>0]=128|ft>>12&63,me[Le++>>>0]=128|ft>>6&63,me[Le++>>>0]=128|ft&63}}return me[Le>>>0]=0,Le-ur}function re(J,me,Le){return te(J,pe,me,Le)}var se,ae,pe,ie,Y,le,ge,ve,Ee;function Se(J){se=J,r.HEAP8=ae=new Int8Array(J),r.HEAP16=ie=new Int16Array(J),r.HEAP32=le=new Int32Array(J),r.HEAPU8=pe=new Uint8Array(J),r.HEAPU16=Y=new Uint16Array(J),r.HEAPU32=ge=new Uint32Array(J),r.HEAPF32=ve=new Float32Array(J),r.HEAPF64=Ee=new Float64Array(J)}var Ve=r.INITIAL_MEMORY||16777216,Ge,Ye=[],Ze=[],Je=[],yt=!1;function lt(){return $}function Nt(){if(r.preRun)for(typeof r.preRun=="function"&&(r.preRun=[r.preRun]);r.preRun.length;)Lt(r.preRun.shift());aa(Ye)}function St(){yt=!0,aa(Ze)}function zt(){if(r.postRun)for(typeof r.postRun=="function"&&(r.postRun=[r.postRun]);r.postRun.length;)tr(r.postRun.shift());aa(Je)}function Lt(J){Ye.unshift(J)}function Kr(J){Ze.unshift(J)}function tr(J){Je.unshift(J)}var xt=0,Qt=null,Ht=null;function _r(J){xt++,r.monitorRunDependencies&&r.monitorRunDependencies(xt)}function br(J){if(xt--,r.monitorRunDependencies&&r.monitorRunDependencies(xt),xt==0&&(Qt!==null&&(clearInterval(Qt),Qt=null),Ht)){var me=Ht;Ht=null,me()}}function Br(J){r.onAbort&&r.onAbort(J),J="Aborted("+J+")",R(J),V=!0,H=1,J+=". Build with -sASSERTIONS for more info.";var me=new WebAssembly.RuntimeError(J);throw n(me),me}var Ao="data:application/octet-stream;base64,";function On(J){return J.startsWith(Ao)}function Xo(J){return J.startsWith("file://")}var Mr;Mr="tfjs-backend-wasm.wasm",On(Mr)||(Mr=d(Mr));function na(J){try{if(J==Mr&&z)return new Uint8Array(z);if(g)return g(J);throw"both async and sync fetching of the wasm failed"}catch(me){Br(me)}}function Pa(){if(!z&&(p||u)){if(typeof fetch=="function"&&!Xo(Mr))return fetch(Mr,{credentials:"same-origin"}).then(function(J){if(!J.ok)throw"failed to load wasm binary file at '"+Mr+"'";return J.arrayBuffer()}).catch(function(){return na(Mr)});if(y)return new Promise(function(J,me){y(Mr,function(Le){J(new Uint8Array(Le))},me)})}return Promise.resolve().then(function(){return na(Mr)})}function za(){var J={env:fi,wasi_snapshot_preview1:fi};function me(vt,ft){var Wr=vt.exports;r.asm=Wr,B=r.asm.memory,Se(B.buffer),Ge=r.asm.__indirect_function_table,Kr(r.asm.__wasm_call_ctors),br("wasm-instantiate")}_r("wasm-instantiate");function Le(vt){me(vt.instance)}function Mt(vt){return Pa().then(function(ft){return WebAssembly.instantiate(ft,J)}).then(function(ft){return ft}).then(vt,function(ft){R("failed to asynchronously prepare wasm: "+ft),Br(ft)})}function ur(){return!z&&typeof WebAssembly.instantiateStreaming=="function"&&!On(Mr)&&!Xo(Mr)&&!m&&typeof fetch=="function"?fetch(Mr,{credentials:"same-origin"}).then(function(vt){var ft=WebAssembly.instantiateStreaming(vt,J);return ft.then(Le,function(Wr){return R("wasm streaming compile failed: "+Wr),R("falling back to ArrayBuffer instantiation"),Mt(Le)})}):Mt(Le)}if(r.instantiateWasm)try{var mr=r.instantiateWasm(J,me);return mr}catch(vt){R("Module.instantiateWasm callback failed with error: "+vt),n(vt)}return ur().catch(n),{}}var sf,$a;function La(J){this.name="ExitStatus",this.message="Program terminated with exit("+J+")",this.status=J}function aa(J){for(;J.length>0;)J.shift()(r)}function lf(){Br("")}function _c(){return 4294901760}function to(){return _c()}function Er(J,me,Le){pe.copyWithin(J>>>0,me>>>0,me+Le>>>0)}function Ec(J){try{return B.grow(J-se.byteLength+65535>>>16),Se(B.buffer),1}catch{}}function So(J){var me=pe.length;J=J>>>0;var Le=_c();if(J>Le)return!1;let Mt=(Wr,Pn)=>Wr+(Pn-Wr%Pn)%Pn;for(var ur=1;ur<=4;ur*=2){var mr=me*(1+.2/ur);mr=Math.min(mr,J+100663296);var vt=Math.min(Le,Mt(Math.max(J,mr),65536)),ft=Ec(vt);if(ft)return!0}return!1}var Or={varargs:void 0,get:function(){Or.varargs+=4;var J=le[Or.varargs-4>>>2];return J},getStr:function(J){var me=Z(J);return me}};function Ic(J){return 52}function cf(J,me,Le,Mt,ur){return 70}var pf=[null,[],[]];function gx(J,me){var Le=pf[J];me===0||me===10?((J===1?C:R)(ee(Le,0)),Le.length=0):Le.push(me)}function Ug(J,me,Le,Mt){for(var ur=0,mr=0;mr<Le;mr++){var vt=ge[me>>>2],ft=ge[me+4>>>2];me+=8;for(var Wr=0;Wr<ft;Wr++)gx(J,pe[vt+Wr>>>0]);ur+=ft}return ge[Mt>>>2]=ur,0}function Tc(J){var me=r["_"+J];return me}function mi(J,me){ae.set(J,me>>>0)}function Wg(J,me,Le,Mt,ur){var mr={string:Do=>{var Zs=0;if(Do!=null&&Do!==0){var wx=(Do.length<<2)+1;Zs=hy(wx),re(Do,Zs,wx)}return Zs},array:Do=>{var Zs=hy(Do.length);return mi(Do,Zs),Zs}};function vt(Do){return me==="string"?Z(Do):me==="boolean"?!!Do:Do}var ft=Tc(J),Wr=[],Pn=0;if(Mt)for(var rs=0;rs<Mt.length;rs++){var xx=mr[Le[rs]];xx?(Pn===0&&(Pn=yx()),Wr[rs]=xx(Mt[rs])):Wr[rs]=Mt[rs]}var gy=ft.apply(null,Wr);function BE(Do){return Pn!==0&&vx(Pn),vt(Do)}return gy=BE(gy),gy}function Hg(J,me,Le,Mt){Le=Le||[];var ur=Le.every(vt=>vt==="number"||vt==="boolean"),mr=me!=="string";return mr&&ur&&!Mt?Tc(J):function(){return Wg(J,me,Le,arguments,Mt)}}var fi={abort:lf,emscripten_get_heap_max:to,emscripten_memcpy_big:Er,emscripten_resize_heap:So,fd_close:Ic,fd_seek:cf,fd_write:Ug},uf=za(),Ji=r.___wasm_call_ctors=function(){return(Ji=r.___wasm_call_ctors=r.asm.__wasm_call_ctors).apply(null,arguments)},Cc=r._init=function(){return(Cc=r._init=r.asm.init).apply(null,arguments)},mf=r._init_with_threads_count=function(){return(mf=r._init_with_threads_count=r.asm.init_with_threads_count).apply(null,arguments)},Zi=r._get_threads_count=function(){return(Zi=r._get_threads_count=r.asm.get_threads_count).apply(null,arguments)},ff=r._register_tensor=function(){return(ff=r._register_tensor=r.asm.register_tensor).apply(null,arguments)},Qe=r._dispose_data=function(){return(Qe=r._dispose_data=r.asm.dispose_data).apply(null,arguments)},Nc=r._dispose=function(){return(Nc=r._dispose=r.asm.dispose).apply(null,arguments)},Vg=r._Abs=function(){return(Vg=r._Abs=r.asm.Abs).apply(null,arguments)},Ac=r._Acos=function(){return(Ac=r._Acos=r.asm.Acos).apply(null,arguments)},Ba=r._Acosh=function(){return(Ba=r._Acosh=r.asm.Acosh).apply(null,arguments)},df=r._Add=function(){return(df=r._Add=r.asm.Add).apply(null,arguments)},hf=r._AddN=function(){return(hf=r._AddN=r.asm.AddN).apply(null,arguments)},gf=r._All=function(){return(gf=r._All=r.asm.All).apply(null,arguments)},jg=r._Any=function(){return(jg=r._Any=r.asm.Any).apply(null,arguments)},Gg=r._ArgMax=function(){return(Gg=r._ArgMax=r.asm.ArgMax).apply(null,arguments)},yf=r._ArgMin=function(){return(yf=r._ArgMin=r.asm.ArgMin).apply(null,arguments)},vf=r._Asin=function(){return(vf=r._Asin=r.asm.Asin).apply(null,arguments)},bf=r._Asinh=function(){return(bf=r._Asinh=r.asm.Asinh).apply(null,arguments)},xf=r._Atan=function(){return(xf=r._Atan=r.asm.Atan).apply(null,arguments)},qg=r._Atan2=function(){return(qg=r._Atan2=r.asm.Atan2).apply(null,arguments)},Rc=r._Atanh=function(){return(Rc=r._Atanh=r.asm.Atanh).apply(null,arguments)},Kg=r._AvgPool=function(){return(Kg=r._AvgPool=r.asm.AvgPool).apply(null,arguments)},Xg=r._AvgPool3D=function(){return(Xg=r._AvgPool3D=r.asm.AvgPool3D).apply(null,arguments)},wf=r._AvgPool3DGrad=function(){return(wf=r._AvgPool3DGrad=r.asm.AvgPool3DGrad).apply(null,arguments)},di=r._AvgPoolGrad=function(){return(di=r._AvgPoolGrad=r.asm.AvgPoolGrad).apply(null,arguments)},Dc=r._BatchMatMul=function(){return(Dc=r._BatchMatMul=r.asm.BatchMatMul).apply(null,arguments)},Sf=r._Bincount=function(){return(Sf=r._Bincount=r.asm.Bincount).apply(null,arguments)},Ys=r._BitwiseAnd=function(){return(Ys=r._BitwiseAnd=r.asm.BitwiseAnd).apply(null,arguments)},es=r._Ceil=function(){return(es=r._Ceil=r.asm.Ceil).apply(null,arguments)},ko=r._ClipByValue=function(){return(ko=r._ClipByValue=r.asm.ClipByValue).apply(null,arguments)},Yg=r._Conv2D=function(){return(Yg=r._Conv2D=r.asm.Conv2D).apply(null,arguments)},Qg=r._Conv2DBackpropInput=function(){return(Qg=r._Conv2DBackpropInput=r.asm.Conv2DBackpropInput).apply(null,arguments)},kf=r._Conv3D=function(){return(kf=r._Conv3D=r.asm.Conv3D).apply(null,arguments)},Ua=r._Conv3DBackpropFilterV2=function(){return(Ua=r._Conv3DBackpropFilterV2=r.asm.Conv3DBackpropFilterV2).apply(null,arguments)},uo=r._Conv3DBackpropInputV2=function(){return(uo=r._Conv3DBackpropInputV2=r.asm.Conv3DBackpropInputV2).apply(null,arguments)},_f=r._Cos=function(){return(_f=r._Cos=r.asm.Cos).apply(null,arguments)},ts=r._Cosh=function(){return(ts=r._Cosh=r.asm.Cosh).apply(null,arguments)},Ef=r._CropAndResize=function(){return(Ef=r._CropAndResize=r.asm.CropAndResize).apply(null,arguments)},Fc=r._Cumprod=function(){return(Fc=r._Cumprod=r.asm.Cumprod).apply(null,arguments)},If=r._Cumsum=function(){return(If=r._Cumsum=r.asm.Cumsum).apply(null,arguments)},Tf=r._DenseBincount=function(){return(Tf=r._DenseBincount=r.asm.DenseBincount).apply(null,arguments)},Qs=r._DepthToSpace=function(){return(Qs=r._DepthToSpace=r.asm.DepthToSpace).apply(null,arguments)},Cf=r._DepthwiseConv2dNative=function(){return(Cf=r._DepthwiseConv2dNative=r.asm.DepthwiseConv2dNative).apply(null,arguments)},Mc=r._Diag=function(){return(Mc=r._Diag=r.asm.Diag).apply(null,arguments)},Nf=r._Dilation2D=function(){return(Nf=r._Dilation2D=r.asm.Dilation2D).apply(null,arguments)},Jg=r._Dilation2DBackpropFilter=function(){return(Jg=r._Dilation2DBackpropFilter=r.asm.Dilation2DBackpropFilter).apply(null,arguments)},Oc=r._Dilation2DBackpropInput=function(){return(Oc=r._Dilation2DBackpropInput=r.asm.Dilation2DBackpropInput).apply(null,arguments)},Af=r._Elu=function(){return(Af=r._Elu=r.asm.Elu).apply(null,arguments)},Rf=r._EluGrad=function(){return(Rf=r._EluGrad=r.asm.EluGrad).apply(null,arguments)},Pc=r._Equal=function(){return(Pc=r._Equal=r.asm.Equal).apply(null,arguments)},Zg=r._Erf=function(){return(Zg=r._Erf=r.asm.Erf).apply(null,arguments)},Df=r._Exp=function(){return(Df=r._Exp=r.asm.Exp).apply(null,arguments)},Ff=r._Expm1=function(){return(Ff=r._Expm1=r.asm.Expm1).apply(null,arguments)},Mf=r._FlipLeftRight=function(){return(Mf=r._FlipLeftRight=r.asm.FlipLeftRight).apply(null,arguments)},ey=r._Floor=function(){return(ey=r._Floor=r.asm.Floor).apply(null,arguments)},Of=r._FloorDiv=function(){return(Of=r._FloorDiv=r.asm.FloorDiv).apply(null,arguments)},ty=r._FusedBatchNorm=function(){return(ty=r._FusedBatchNorm=r.asm.FusedBatchNorm).apply(null,arguments)},ry=r._FusedConv2D=function(){return(ry=r._FusedConv2D=r.asm.FusedConv2D).apply(null,arguments)},zc=r._FusedDepthwiseConv2D=function(){return(zc=r._FusedDepthwiseConv2D=r.asm.FusedDepthwiseConv2D).apply(null,arguments)},Pf=r._Gather=function(){return(Pf=r._Gather=r.asm.Gather).apply(null,arguments)},oy=r._GatherNd=function(){return(oy=r._GatherNd=r.asm.GatherNd).apply(null,arguments)},ny=r._Greater=function(){return(ny=r._Greater=r.asm.Greater).apply(null,arguments)},ay=r._GreaterEqual=function(){return(ay=r._GreaterEqual=r.asm.GreaterEqual).apply(null,arguments)},iy=r._IsFinite=function(){return(iy=r._IsFinite=r.asm.IsFinite).apply(null,arguments)},zf=r._IsInf=function(){return(zf=r._IsInf=r.asm.IsInf).apply(null,arguments)},sy=r._IsNan=function(){return(sy=r._IsNan=r.asm.IsNan).apply(null,arguments)},ly=r._LRN=function(){return(ly=r._LRN=r.asm.LRN).apply(null,arguments)},$c=r._LRNGrad=function(){return($c=r._LRNGrad=r.asm.LRNGrad).apply(null,arguments)},cy=r._LeakyRelu=function(){return(cy=r._LeakyRelu=r.asm.LeakyRelu).apply(null,arguments)},py=r._Less=function(){return(py=r._Less=r.asm.Less).apply(null,arguments)},uy=r._LessEqual=function(){return(uy=r._LessEqual=r.asm.LessEqual).apply(null,arguments)},Js=r._LinSpace=function(){return(Js=r._LinSpace=r.asm.LinSpace).apply(null,arguments)},my=r._Log=function(){return(my=r._Log=r.asm.Log).apply(null,arguments)},fy=r._Log1p=function(){return(fy=r._Log1p=r.asm.Log1p).apply(null,arguments)},dy=r._LogicalAnd=function(){return(dy=r._LogicalAnd=r.asm.LogicalAnd).apply(null,arguments)},$f=r._LogicalNot=function(){return($f=r._LogicalNot=r.asm.LogicalNot).apply(null,arguments)},v=r._LogicalOr=function(){return(v=r._LogicalOr=r.asm.LogicalOr).apply(null,arguments)},E=r._LogicalXor=function(){return(E=r._LogicalXor=r.asm.LogicalXor).apply(null,arguments)},N=r._Max=function(){return(N=r._Max=r.asm.Max).apply(null,arguments)},O=r._MaxPool=function(){return(O=r._MaxPool=r.asm.MaxPool).apply(null,arguments)},U=r._MaxPool3D=function(){return(U=r._MaxPool3D=r.asm.MaxPool3D).apply(null,arguments)},j=r._MaxPool3DGrad=function(){return(j=r._MaxPool3DGrad=r.asm.MaxPool3DGrad).apply(null,arguments)},W=r._MaxPoolGrad=function(){return(W=r._MaxPoolGrad=r.asm.MaxPoolGrad).apply(null,arguments)},Q=r._MaxPoolWithArgmax=function(){return(Q=r._MaxPoolWithArgmax=r.asm.MaxPoolWithArgmax).apply(null,arguments)},oe=r._Maximum=function(){return(oe=r._Maximum=r.asm.Maximum).apply(null,arguments)},de=r._Mean=function(){return(de=r._Mean=r.asm.Mean).apply(null,arguments)},Te=r._Min=function(){return(Te=r._Min=r.asm.Min).apply(null,arguments)},Ke=r._Minimum=function(){return(Ke=r._Minimum=r.asm.Minimum).apply(null,arguments)},Xe=r._MirrorPad=function(){return(Xe=r._MirrorPad=r.asm.MirrorPad).apply(null,arguments)},De=r._Mod=function(){return(De=r._Mod=r.asm.Mod).apply(null,arguments)},et=r._Multinomial=function(){return(et=r._Multinomial=r.asm.Multinomial).apply(null,arguments)},kt=r._Multiply=function(){return(kt=r._Multiply=r.asm.Multiply).apply(null,arguments)},Jt=r._Neg=function(){return(Jt=r._Neg=r.asm.Neg).apply(null,arguments)},qt=r._NonMaxSuppressionV3=function(){return(qt=r._NonMaxSuppressionV3=r.asm.NonMaxSuppressionV3).apply(null,arguments)},Ur=r._NonMaxSuppressionV4=function(){return(Ur=r._NonMaxSuppressionV4=r.asm.NonMaxSuppressionV4).apply(null,arguments)},Ro=r._NonMaxSuppressionV5=function(){return(Ro=r._NonMaxSuppressionV5=r.asm.NonMaxSuppressionV5).apply(null,arguments)},mo=r._NotEqual=function(){return(mo=r._NotEqual=r.asm.NotEqual).apply(null,arguments)},At=r._OneHot=function(){return(At=r._OneHot=r.asm.OneHot).apply(null,arguments)},Ir=r._PadV2=function(){return(Ir=r._PadV2=r.asm.PadV2).apply(null,arguments)},ia=r._Pow=function(){return(ia=r._Pow=r.asm.Pow).apply(null,arguments)},j2=r._Prelu=function(){return(j2=r._Prelu=r.asm.Prelu).apply(null,arguments)},G2=r._Prod=function(){return(G2=r._Prod=r.asm.Prod).apply(null,arguments)},q2=r._RealDiv=function(){return(q2=r._RealDiv=r.asm.RealDiv).apply(null,arguments)},K2=r._Reciprocal=function(){return(K2=r._Reciprocal=r.asm.Reciprocal).apply(null,arguments)},X2=r._Relu=function(){return(X2=r._Relu=r.asm.Relu).apply(null,arguments)},Y2=r._Relu6=function(){return(Y2=r._Relu6=r.asm.Relu6).apply(null,arguments)},Q2=r._ResizeBilinear=function(){return(Q2=r._ResizeBilinear=r.asm.ResizeBilinear).apply(null,arguments)},J2=r._ResizeBilinearGrad=function(){return(J2=r._ResizeBilinearGrad=r.asm.ResizeBilinearGrad).apply(null,arguments)},Z2=r._ResizeNearestNeighbor=function(){return(Z2=r._ResizeNearestNeighbor=r.asm.ResizeNearestNeighbor).apply(null,arguments)},eE=r._ResizeNearestNeighborGrad=function(){return(eE=r._ResizeNearestNeighborGrad=r.asm.ResizeNearestNeighborGrad).apply(null,arguments)},tE=r._Reverse=function(){return(tE=r._Reverse=r.asm.Reverse).apply(null,arguments)},rE=r._RotateWithOffset=function(){return(rE=r._RotateWithOffset=r.asm.RotateWithOffset).apply(null,arguments)},oE=r._Round=function(){return(oE=r._Round=r.asm.Round).apply(null,arguments)},nE=r._Rsqrt=function(){return(nE=r._Rsqrt=r.asm.Rsqrt).apply(null,arguments)},aE=r._ScatterNd=function(){return(aE=r._ScatterNd=r.asm.ScatterNd).apply(null,arguments)},iE=r._SearchSorted=function(){return(iE=r._SearchSorted=r.asm.SearchSorted).apply(null,arguments)},sE=r._SelectV2=function(){return(sE=r._SelectV2=r.asm.SelectV2).apply(null,arguments)},lE=r._Selu=function(){return(lE=r._Selu=r.asm.Selu).apply(null,arguments)},cE=r._Sigmoid=function(){return(cE=r._Sigmoid=r.asm.Sigmoid).apply(null,arguments)},pE=r._Sign=function(){return(pE=r._Sign=r.asm.Sign).apply(null,arguments)},uE=r._Sin=function(){return(uE=r._Sin=r.asm.Sin).apply(null,arguments)},mE=r._Sinh=function(){return(mE=r._Sinh=r.asm.Sinh).apply(null,arguments)},fE=r._Softmax=function(){return(fE=r._Softmax=r.asm.Softmax).apply(null,arguments)},dE=r._Softplus=function(){return(dE=r._Softplus=r.asm.Softplus).apply(null,arguments)},hE=r._SparseFillEmptyRows=function(){return(hE=r._SparseFillEmptyRows=r.asm.SparseFillEmptyRows).apply(null,arguments)},gE=r._SparseReshape=function(){return(gE=r._SparseReshape=r.asm.SparseReshape).apply(null,arguments)},yE=r._SparseSegmentReduction=function(){return(yE=r._SparseSegmentReduction=r.asm.SparseSegmentReduction).apply(null,arguments)},vE=r._SparseToDense=function(){return(vE=r._SparseToDense=r.asm.SparseToDense).apply(null,arguments)},bE=r._Sqrt=function(){return(bE=r._Sqrt=r.asm.Sqrt).apply(null,arguments)},xE=r._Square=function(){return(xE=r._Square=r.asm.Square).apply(null,arguments)},wE=r._SquaredDifference=function(){return(wE=r._SquaredDifference=r.asm.SquaredDifference).apply(null,arguments)},SE=r._Step=function(){return(SE=r._Step=r.asm.Step).apply(null,arguments)},kE=r._StridedSlice=function(){return(kE=r._StridedSlice=r.asm.StridedSlice).apply(null,arguments)},_E=r._Sub=function(){return(_E=r._Sub=r.asm.Sub).apply(null,arguments)},EE=r._Sum=function(){return(EE=r._Sum=r.asm.Sum).apply(null,arguments)},IE=r._Tan=function(){return(IE=r._Tan=r.asm.Tan).apply(null,arguments)},TE=r._Tanh=function(){return(TE=r._Tanh=r.asm.Tanh).apply(null,arguments)},CE=r._TensorScatterUpdate=function(){return(CE=r._TensorScatterUpdate=r.asm.TensorScatterUpdate).apply(null,arguments)},NE=r._Tile=function(){return(NE=r._Tile=r.asm.Tile).apply(null,arguments)},AE=r._TopK=function(){return(AE=r._TopK=r.asm.TopK).apply(null,arguments)},RE=r._Transform=function(){return(RE=r._Transform=r.asm.Transform).apply(null,arguments)},DE=r._Transpose=function(){return(DE=r._Transpose=r.asm.Transpose).apply(null,arguments)},FE=r.__FusedMatMul=function(){return(FE=r.__FusedMatMul=r.asm._FusedMatMul).apply(null,arguments)},ME=r._malloc=function(){return(ME=r._malloc=r.asm.malloc).apply(null,arguments)},OE=r._free=function(){return(OE=r._free=r.asm.free).apply(null,arguments)},PE=r.___errno_location=function(){return(PE=r.___errno_location=r.asm.__errno_location).apply(null,arguments)},yx=r.stackSave=function(){return(yx=r.stackSave=r.asm.stackSave).apply(null,arguments)},vx=r.stackRestore=function(){return(vx=r.stackRestore=r.asm.stackRestore).apply(null,arguments)},hy=r.stackAlloc=function(){return(hy=r.stackAlloc=r.asm.stackAlloc).apply(null,arguments)},zE=r.dynCall_iijjiiii=function(){return(zE=r.dynCall_iijjiiii=r.asm.dynCall_iijjiiii).apply(null,arguments)},$E=r.dynCall_jiji=function(){return($E=r.dynCall_jiji=r.asm.dynCall_jiji).apply(null,arguments)};r.cwrap=Hg;var Lf;Ht=function J(){Lf||bx(),Lf||(Ht=J)};function bx(J){if(J=J||s,xt>0||(Nt(),xt>0))return;function me(){Lf||(Lf=!0,r.calledRun=!0,!V&&(St(),o(r),r.onRuntimeInitialized&&r.onRuntimeInitialized(),zt()))}r.setStatus?(r.setStatus("Running..."),setTimeout(function(){setTimeout(function(){r.setStatus("")},1),me()},1)):me()}if(r.preInit)for(typeof r.preInit=="function"&&(r.preInit=[r.preInit]);r.preInit.length>0;)r.preInit.pop()();bx();var Bf;a&&(Bf={uncaughtException:process.listeners("uncaughtException").filter(function(J){return!a.uncaughtException.indexOf(J)>-1}),unhandledRejection:process.listeners("unhandledRejection").filter(function(J){return!a.unhandledRejection.indexOf(J)>-1})});var Uf;if(typeof t<"u")Uf=t;else if(typeof WasmBackendModuleThreadedSimd<"u")Uf=WasmBackendModuleThreadedSimd;else throw new Error("Could not find wasm module in post.js");if(Bf){var LE=Uf._dispose;Uf._dispose=function(){LE(),Bf.uncaughtException.forEach(function(J){process.removeListener("uncaughtException",J)}),Bf.unhandledRejection.forEach(function(J){process.removeListener("unhandledRejection",J)})}}return t.ready}})();typeof $k=="object"&&typeof aR=="object"?aR.exports=nR:typeof define=="function"&&define.amd?define([],function(){return nR}):typeof $k=="object"&&($k.WasmBackendModule=nR)});var i_,qQ=Hf(()=>{i_=e=>new TextEncoder().encode(e)});var KQ=Hf(()=>{});var xg,XQ=Hf(()=>{xg=e=>{if(typeof e=="string")return e;if(typeof e!="object"||typeof e.byteOffset!="number"||typeof e.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(e)}});var s_=Hf(()=>{qQ();KQ();XQ()});var WR,YQ=Hf(()=>{s_();WR=class{constructor({marshaller:t,serializer:r,deserializer:o,serdeContext:n,defaultContentType:a}){F(this,"marshaller");F(this,"serializer");F(this,"deserializer");F(this,"serdeContext");F(this,"defaultContentType");this.marshaller=t,this.serializer=r,this.deserializer=o,this.serdeContext=n,this.defaultContentType=a}async serializeEventStream({eventStream:t,requestSchema:r,initialRequest:o}){let n=this.marshaller,a=r.getEventStreamMember(),i=r.getMemberSchema(a),s=this.serializer,c=this.defaultContentType,l=Symbol("initialRequestMarker"),p={async*[Symbol.asyncIterator](){if(o){let u={":event-type":{type:"string",value:"initial-request"},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:c}};s.write(r,o);let m=s.flush();yield{[l]:!0,headers:u,body:m}}for await(let u of t)yield u}};return n.serialize(p,u=>{if(u[l])return{headers:u.headers,body:u.body};let m="";for(let b in u)if(b!=="__type"){m=b;break}let{additionalHeaders:f,body:d,eventType:h,explicitPayloadContentType:y}=this.writeEventBody(m,i,u);return{headers:{":event-type":{type:"string",value:h},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:y??c},...f},body:d}})}async deserializeEventStream({response:t,responseSchema:r,initialResponseContainer:o}){let n=this.marshaller,a=r.getEventStreamMember(),s=r.getMemberSchema(a).getMemberSchemas(),c=Symbol("initialResponseMarker"),l=n.deserialize(t.body,async m=>{let f="";for(let h in m)if(h!=="__type"){f=h;break}let d=m[f].body;if(f==="initial-response"){let h=await this.deserializer.read(r,d);return delete h[a],{[c]:!0,...h}}else if(f in s){let h=s[f];if(h.isStructSchema()){let y={},g=!1;for(let[b,x]of h.structIterator()){let{eventHeader:w,eventPayload:I}=x.getMergedTraits();if(g=g||!!(w||I),I)x.isBlobSchema()?y[b]=d:x.isStringSchema()?y[b]=(this.serdeContext?.utf8Encoder??xg)(d):x.isStructSchema()&&(y[b]=await this.deserializer.read(x,d));else if(w){let C=m[f].headers[b]?.value;C!=null&&(x.isNumericSchema()?C&&typeof C=="object"&&"bytes"in C?y[b]=BigInt(C.toString()):y[b]=Number(C):y[b]=C)}}if(g)return{[f]:y};if(d.byteLength===0)return{[f]:{}}}return{[f]:await this.deserializer.read(h,d)}}else return{$unknown:m}}),p=l[Symbol.asyncIterator](),u=await p.next();if(u.done)return l;if(u.value?.[c]){if(!r)throw new Error("@smithy::core/protocols - initial-response event encountered in event stream but no response schema given.");for(let m in u.value)o[m]=u.value[m]}return{async*[Symbol.asyncIterator](){for(u?.value?.[c]||(yield u.value);;){let{done:m,value:f}=await p.next();if(m)break;yield f}}}}writeEventBody(t,r,o){let n=this.serializer,a=t,i=null,s,c=r.getSchema()[4].includes(t),l={};if(c){let m=r.getMemberSchema(t);if(m.isStructSchema()){for(let[f,d]of m.structIterator()){let{eventHeader:h,eventPayload:y}=d.getMergedTraits();if(y)i=f;else if(h){let g=o[t][f],b="binary";d.isNumericSchema()?(-2)**31<=g&&g<=2**31-1?b="integer":b="long":d.isTimestampSchema()?b="timestamp":d.isStringSchema()?b="string":d.isBooleanSchema()&&(b="boolean"),g!=null&&(l[f]={type:b,value:g},delete o[t][f])}}if(i!==null){let f=m.getMemberSchema(i);f.isBlobSchema()?s="application/octet-stream":f.isStringSchema()&&(s="text/plain"),n.write(f,o[t][i])}else n.write(m,o[t])}else if(m.isUnitSchema())n.write(m,{});else throw new Error("@smithy/core/event-streams - non-struct member not supported in event stream union.")}else{let[m,f]=o[t];a=m,n.write(15,f)}let p=n.flush()??new Uint8Array;return{body:typeof p=="string"?(this.serdeContext?.utf8Decoder??i_)(p):p,eventType:a,explicitPayloadContentType:s,additionalHeaders:l}}}});var QQ={};Ot(QQ,{EventStreamSerde:()=>WR});var JQ=Hf(()=>{YQ()});var $Ce={};Ot($Ce,{mount:()=>hoe});var doe=Ie(OO());var ys={};Ot(ys,{actionTypes:()=>hC,after:()=>SC,assign:()=>wC,cancel:()=>lw,choose:()=>mP,done:()=>Cd,doneInvoke:()=>kl,error:()=>_l,escalate:()=>Hie,forwardTo:()=>uP,getActionFunction:()=>yv,initEvent:()=>Si,isActionObject:()=>Wie,log:()=>sP,pure:()=>pP,raise:()=>iw,resolveActions:()=>ap,resolveLog:()=>lP,resolveRaise:()=>oP,resolveSend:()=>nP,resolveStop:()=>cP,respond:()=>Bie,send:()=>Sl,sendParent:()=>sw,sendTo:()=>aP,sendUpdate:()=>iP,start:()=>xC,stop:()=>cw,toActionObject:()=>ip,toActionObjects:()=>Qa,toActivityDefinition:()=>vv});var ue=function(){return ue=Object.assign||function(t){for(var r,o=1,n=arguments.length;o<n;o++){r=arguments[o];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},ue.apply(this,arguments)};function wd(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]]);return r}function dt(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],o=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function bt(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var o=r.call(e),n,a=[],i;try{for(;(t===void 0||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(s){i={error:s}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function Vt(e,t,r){if(r||arguments.length===2)for(var o=0,n=t.length,a;o<n;o++)(a||!(o in t))&&(a||(a=Array.prototype.slice.call(t,0,o)),a[o]=t[o]);return e.concat(a||Array.prototype.slice.call(t))}var Ut;(function(e){e.Start="xstate.start",e.Stop="xstate.stop",e.Raise="xstate.raise",e.Send="xstate.send",e.Cancel="xstate.cancel",e.NullEvent="",e.Assign="xstate.assign",e.After="xstate.after",e.DoneState="done.state",e.DoneInvoke="done.invoke",e.Log="xstate.log",e.Init="xstate.init",e.Invoke="xstate.invoke",e.ErrorExecution="error.execution",e.ErrorCommunication="error.communication",e.ErrorPlatform="error.platform",e.ErrorCustom="xstate.error",e.Update="xstate.update",e.Pure="xstate.pure",e.Choose="xstate.choose"})(Ut||(Ut={}));var Ya;(function(e){e.Parent="#_parent",e.Internal="#_internal"})(Ya||(Ya={}));var hC={};Ot(hC,{after:()=>Pie,assign:()=>uv,cancel:()=>pv,choose:()=>fC,doneState:()=>zie,error:()=>mv,errorExecution:()=>$ie,errorPlatform:()=>Q0,init:()=>mC,invoke:()=>_d,log:()=>kd,nullEvent:()=>uC,pure:()=>dC,raise:()=>ds,send:()=>wl,start:()=>Sd,stop:()=>ep,update:()=>tp});var Sd=Ut.Start,ep=Ut.Stop,ds=Ut.Raise,wl=Ut.Send,pv=Ut.Cancel,uC=Ut.NullEvent,uv=Ut.Assign,Pie=Ut.After,zie=Ut.DoneState,kd=Ut.Log,mC=Ut.Init,_d=Ut.Invoke,$ie=Ut.ErrorExecution,Q0=Ut.ErrorPlatform,mv=Ut.ErrorCustom,tp=Ut.Update,fC=Ut.Choose,dC=Ut.Pure;var J0=".",gC={},Z0="xstate.guard",HO="";var Kt=!0;var ew;function Id(e,t,r){r===void 0&&(r=J0);var o=Ed(e,r),n=Ed(t,r);return Et(n)?Et(o)?n===o:!1:Et(o)?o in n:Object.keys(o).every(function(a){return a in n?Id(o[a],n[a]):!1})}function tw(e){try{return Et(e)||typeof e=="number"?"".concat(e):e.type}catch{throw new Error("Events must be strings or objects with a string event.type property.")}}function rw(e,t){try{return hs(e)?e:e.toString().split(t)}catch{throw new Error("'".concat(e,"' is not a valid state path."))}}function Lie(e){return typeof e=="object"&&"value"in e&&"context"in e&&"event"in e&&"_event"in e}function Ed(e,t){if(Lie(e))return e.value;if(hs(e))return fv(e);if(typeof e!="string")return e;var r=rw(e,t);return fv(r)}function fv(e){if(e.length===1)return e[0];for(var t={},r=t,o=0;o<e.length-1;o++)o===e.length-2?r[e[o]]=e[o+1]:(r[e[o]]={},r=r[e[o]]);return t}function Td(e,t){for(var r={},o=Object.keys(e),n=0;n<o.length;n++){var a=o[n];r[a]=t(e[a],a,e,n)}return r}function yC(e,t,r){var o,n,a={};try{for(var i=dt(Object.keys(e)),s=i.next();!s.done;s=i.next()){var c=s.value,l=e[c];r(l)&&(a[c]=t(l,c,e))}}catch(p){o={error:p}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}var VO=function(e){return function(t){var r,o,n=t;try{for(var a=dt(e),i=a.next();!i.done;i=a.next()){var s=i.value;n=n[s]}}catch(c){r={error:c}}finally{try{i&&!i.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}return n}};function jO(e,t){return function(r){var o,n,a=r;try{for(var i=dt(e),s=i.next();!s.done;s=i.next()){var c=s.value;a=a[t][c]}}catch(l){o={error:l}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}}function dv(e){if(!e)return[[]];if(Et(e))return[[e]];var t=rr(Object.keys(e).map(function(r){var o=e[r];return typeof o!="string"&&(!o||!Object.keys(o).length)?[[r]]:dv(e[r]).map(function(n){return[r].concat(n)})}));return t}function rr(e){var t;return(t=[]).concat.apply(t,Vt([],bt(e),!1))}function GO(e){return hs(e)?e:[e]}function Vn(e){return e===void 0?[]:GO(e)}function rp(e,t,r){var o,n;if(Rt(e))return e(t,r.data);var a={};try{for(var i=dt(Object.keys(e)),s=i.next();!s.done;s=i.next()){var c=s.value,l=e[c];Rt(l)?a[c]=l(t,r.data):a[c]=l}}catch(p){o={error:p}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function qO(e){return/^(done|error)\./.test(e)}function vC(e){return!!(e instanceof Promise||e!==null&&(Rt(e)||typeof e=="object")&&Rt(e.then))}function KO(e){return e!==null&&typeof e=="object"&&"transition"in e&&typeof e.transition=="function"}function XO(e,t){var r,o,n=bt([[],[]],2),a=n[0],i=n[1];try{for(var s=dt(e),c=s.next();!c.done;c=s.next()){var l=c.value;t(l)?a.push(l):i.push(l)}}catch(p){r={error:p}}finally{try{c&&!c.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}return[a,i]}function YO(e,t){return Td(e.states,function(r,o){if(r){var n=(Et(t)?void 0:t[o])||(r?r.current:void 0);if(n)return{current:n,states:YO(r,n)}}})}function QO(e,t){return{current:t,states:YO(e,t)}}function bC(e,t,r,o){Kt||zr(!!e,"Attempting to update undefined context");var n=e&&r.reduce(function(a,i){var s,c,l=i.assignment,p={state:o,action:i,_event:t},u={};if(Rt(l))u=l(a,t.data,p);else try{for(var m=dt(Object.keys(l)),f=m.next();!f.done;f=m.next()){var d=f.value,h=l[d];u[d]=Rt(h)?h(a,t.data,p):h}}catch(y){s={error:y}}finally{try{f&&!f.done&&(c=m.return)&&c.call(m)}finally{if(s)throw s.error}}return Object.assign({},a,u)},e);return n}var zr=function(){};Kt||(zr=function(e,t){var r=e instanceof Error?e:void 0;if(!(!r&&e)&&console!==void 0){var o=["Warning: ".concat(t)];r&&o.push(r),console.warn.apply(console,o)}});function hs(e){return Array.isArray(e)}function Rt(e){return typeof e=="function"}function Et(e){return typeof e=="string"}function ow(e,t){if(e)return Et(e)?{type:Z0,name:e,predicate:t?t[e]:void 0}:Rt(e)?{type:Z0,name:e.name,predicate:e}:e}function JO(e){try{return"subscribe"in e&&Rt(e.subscribe)}catch{return!1}}var wi=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),lNe=(ew={},ew[wi]=function(){return this},ew[Symbol.observable]=function(){return this},ew);function da(e){return!!e&&"__xstatenode"in e}function ZO(e){return!!e&&typeof e.send=="function"}var eP=function(){var e=0;return function(){return e++,e.toString(16)}}();function op(e,t){return Et(e)||typeof e=="number"?ue({type:e},t):e}function Vr(e,t){if(!Et(e)&&"$$type"in e&&e.$$type==="scxml")return e;var r=op(e);return ue({name:r.type,data:r,$$type:"scxml",type:"external"},t)}function np(e,t){var r=GO(t).map(function(o){return typeof o>"u"||typeof o=="string"||da(o)?{target:o,event:e}:ue(ue({},o),{event:e})});return r}function tP(e){if(!(e===void 0||e===HO))return Vn(e)}function rP(e,t,r){if(!Kt){var o=e.stack?" Stacktrace was '".concat(e.stack,"'"):"";if(e===t)console.error("Missing onError handler for invocation '".concat(r,"', error was '").concat(e,"'.").concat(o));else{var n=t.stack?" Stacktrace was '".concat(t.stack,"'"):"";console.error("Missing onError handler and/or unhandled exception/promise rejection for invocation '".concat(r,"'. ")+"Original error: '".concat(e,"'. ").concat(o," Current error is '").concat(t,"'.").concat(n))}}}function nw(e,t,r,o,n){var a=e.options.guards,i={state:n,cond:t,_event:o};if(t.type===Z0)return(a?.[t.name]||t.predicate)(r,o.data,i);var s=a?.[t.type];if(!s)throw new Error("Guard '".concat(t.type,"' is not implemented on machine '").concat(e.id,"'."));return s(r,o.data,i)}function aw(e){return typeof e=="string"?{type:e}:e}function gs(e,t,r){var o=function(){},n=typeof e=="object",a=n?e:null;return{next:((n?e.next:e)||o).bind(a),error:((n?e.error:t)||o).bind(a),complete:((n?e.complete:r)||o).bind(a)}}function hv(e,t){return"".concat(e,":invocation[").concat(t,"]")}function gv(e){return(e.type===ds||e.type===wl&&e.to===Ya.Internal)&&typeof e.delay!="number"}var Si=Vr({type:mC});function yv(e,t){return t&&t[e]||void 0}function ip(e,t){var r;if(Et(e)||typeof e=="number"){var o=yv(e,t);Rt(o)?r={type:e,exec:o}:o?r=o:r={type:e,exec:void 0}}else if(Rt(e))r={type:e.name||e.toString(),exec:e};else{var o=yv(e.type,t);if(Rt(o))r=ue(ue({},e),{exec:o});else if(o){var n=o.type||e.type;r=ue(ue(ue({},o),e),{type:n})}else r=e}return r}var Qa=function(e,t){if(!e)return[];var r=hs(e)?e:[e];return r.map(function(o){return ip(o,t)})};function vv(e){var t=ip(e);return ue(ue({id:Et(e)?e:t.id},t),{type:t.type})}function iw(e,t){return{type:ds,event:typeof e=="function"?e:op(e),delay:t?t.delay:void 0,id:t?.id}}function oP(e,t,r,o){var n={_event:r},a=Vr(Rt(e.event)?e.event(t,r.data,n):e.event),i;if(Et(e.delay)){var s=o&&o[e.delay];i=Rt(s)?s(t,r.data,n):s}else i=Rt(e.delay)?e.delay(t,r.data,n):e.delay;return ue(ue({},e),{type:ds,_event:a,delay:i})}function Sl(e,t){return{to:t?t.to:void 0,type:wl,event:Rt(e)?e:op(e),delay:t?t.delay:void 0,id:t&&t.id!==void 0?t.id:Rt(e)?e.name:tw(e)}}function nP(e,t,r,o){var n={_event:r},a=Vr(Rt(e.event)?e.event(t,r.data,n):e.event),i;if(Et(e.delay)){var s=o&&o[e.delay];i=Rt(s)?s(t,r.data,n):s}else i=Rt(e.delay)?e.delay(t,r.data,n):e.delay;var c=Rt(e.to)?e.to(t,r.data,n):e.to;return ue(ue({},e),{to:c,_event:a,event:a.data,delay:i})}function sw(e,t){return Sl(e,ue(ue({},t),{to:Ya.Parent}))}function aP(e,t,r){return Sl(t,ue(ue({},r),{to:e}))}function iP(){return sw(tp)}function Bie(e,t){return Sl(e,ue(ue({},t),{to:function(r,o,n){var a=n._event;return a.origin}}))}var Uie=function(e,t){return{context:e,event:t}};function sP(e,t){return e===void 0&&(e=Uie),{type:kd,label:t,expr:e}}var lP=function(e,t,r){return ue(ue({},e),{value:Et(e.expr)?e.expr:e.expr(t,r.data,{_event:r})})},lw=function(e){return{type:pv,sendId:e}};function xC(e){var t=vv(e);return{type:Ut.Start,activity:t,exec:void 0}}function cw(e){var t=Rt(e)?e:vv(e);return{type:Ut.Stop,activity:t,exec:void 0}}function cP(e,t,r){var o=Rt(e.activity)?e.activity(t,r.data):e.activity,n=typeof o=="string"?{id:o}:o,a={type:Ut.Stop,activity:n};return a}var wC=function(e){return{type:uv,assignment:e}};function Wie(e){return typeof e=="object"&&"type"in e}function SC(e,t){var r=t?"#".concat(t):"";return"".concat(Ut.After,"(").concat(e,")").concat(r)}function Cd(e,t){var r="".concat(Ut.DoneState,".").concat(e),o={type:r,data:t};return o.toString=function(){return r},o}function kl(e,t){var r="".concat(Ut.DoneInvoke,".").concat(e),o={type:r,data:t};return o.toString=function(){return r},o}function _l(e,t){var r="".concat(Ut.ErrorPlatform,".").concat(e),o={type:r,data:t};return o.toString=function(){return r},o}function pP(e){return{type:Ut.Pure,get:e}}function uP(e,t){if(!Kt&&(!e||typeof e=="function")){var r=e;e=function(){for(var o=[],n=0;n<arguments.length;n++)o[n]=arguments[n];var a=typeof r=="function"?r.apply(void 0,Vt([],bt(o),!1)):r;if(!a)throw new Error("Attempted to forward event to undefined actor. This risks an infinite loop in the sender.");return a}}return Sl(function(o,n){return n},ue(ue({},t),{to:e}))}function Hie(e,t){return sw(function(r,o,n){return{type:mv,data:Rt(e)?e(r,o,n):e}},ue(ue({},t),{to:Ya.Parent}))}function mP(e){return{type:Ut.Choose,conds:e}}var Vie=function(e){var t,r,o=[];try{for(var n=dt(e),a=n.next();!a.done;a=n.next())for(var i=a.value,s=0;s<i.actions.length;){if(i.actions[s].type===uv){o.push(i.actions[s]),i.actions.splice(s,1);continue}s++}}catch(c){t={error:c}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return o};function ap(e,t,r,o,n,a,i){i===void 0&&(i=!1);var s=i?[]:Vie(n),c=s.length?bC(r,o,s,t):r,l=i?[r]:void 0,p=[];function u(d,h){var y;switch(h.type){case ds:{var g=oP(h,c,o,e.options.delays);return a&&typeof g.delay=="number"&&a(g,c,o),g}case wl:var b=nP(h,c,o,e.options.delays);if(!Kt){var x=h.delay;zr(!Et(x)||typeof b.delay=="number","No delay reference for delay expression '".concat(x,"' was found on machine '").concat(e.id,"'"))}return a&&b.to!==Ya.Internal&&(d==="entry"?p.push(b):a(b,c,o)),b;case kd:{var w=lP(h,c,o);return a?.(w,c,o),w}case fC:{var I=h,C=(y=I.conds.find(function(Z){var te=ow(Z.cond,e.options.guards);return!te||nw(e,te,c,o,a?void 0:t)}))===null||y===void 0?void 0:y.actions;if(!C)return[];var R=bt(ap(e,t,c,o,[{type:d,actions:Qa(Vn(C),e.options.actions)}],a,i),2),P=R[0],z=R[1];return c=z,l?.push(c),P}case dC:{var C=h.get(c,o.data);if(!C)return[];var $=bt(ap(e,t,c,o,[{type:d,actions:Qa(Vn(C),e.options.actions)}],a,i),2),B=$[0],V=$[1];return c=V,l?.push(c),B}case ep:{var w=cP(h,c,o);return a?.(w,r,o),w}case uv:{c=bC(c,o,[h],a?void 0:t),l?.push(c);break}default:var H=ip(h,e.options.actions),G=H.exec;if(a)a(H,c,o);else if(G&&l){var X=l.length-1,ee=ue(ue({},H),{exec:function(Z){for(var te=[],re=1;re<arguments.length;re++)te[re-1]=arguments[re];G.apply(void 0,Vt([l[X]],bt(te),!1))}});H=ee}return H}}function m(d){var h,y,g=[];try{for(var b=dt(d.actions),x=b.next();!x.done;x=b.next()){var w=x.value,I=u(d.type,w);I&&(g=g.concat(I))}}catch(C){h={error:C}}finally{try{x&&!x.done&&(y=b.return)&&y.call(b)}finally{if(h)throw h.error}}return p.forEach(function(C){a(C,c,o)}),p.length=0,g}var f=rr(n.map(m));return[f,c]}var pw=[],El=function(e,t){pw.push(e);var r=t(e);return pw.pop(),r},fP=function(e){return e(pw[pw.length-1])};function dP(e){var t;return t={id:e,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},getSnapshot:function(){},toJSON:function(){return{id:e}}},t[wi]=function(){return this},t}function hP(e,t,r,o){var n,a=aw(e.src),i=(n=t?.options.services)===null||n===void 0?void 0:n[a.type],s=e.data?rp(e.data,r,o):void 0,c=i?uw(i,e.id,s):dP(e.id);return c.meta=e,c}function uw(e,t,r){var o=dP(t);if(o.deferred=!0,da(e)){var n=o.state=El(void 0,function(){return(r?e.withContext(r):e).initialState});o.getSnapshot=function(){return n}}return o}function jie(e){try{return typeof e.send=="function"}catch{return!1}}function gP(e){return jie(e)&&"id"in e}function yP(e){var t;return ue((t={subscribe:function(){return{unsubscribe:function(){}}},id:"anonymous",getSnapshot:function(){}},t[wi]=function(){return this},t),e)}var bv=function(e){return e.type==="atomic"||e.type==="final"};function _C(e){return Object.keys(e.states).map(function(t){return e.states[t]})}function Nd(e){return _C(e).filter(function(t){return t.type!=="history"})}function EC(e){var t=[e];return bv(e)?t:t.concat(rr(Nd(e).map(EC)))}function Ad(e,t){var r,o,n,a,i,s,c,l,p=new Set(e),u=kC(p),m=new Set(t);try{for(var f=dt(m),d=f.next();!d.done;d=f.next())for(var h=d.value,y=h.parent;y&&!m.has(y);)m.add(y),y=y.parent}catch(z){r={error:z}}finally{try{d&&!d.done&&(o=f.return)&&o.call(f)}finally{if(r)throw r.error}}var g=kC(m);try{for(var b=dt(m),x=b.next();!x.done;x=b.next()){var h=x.value;if(h.type==="compound"&&(!g.get(h)||!g.get(h).length))u.get(h)?u.get(h).forEach(function($){return m.add($)}):h.initialStateNodes.forEach(function($){return m.add($)});else if(h.type==="parallel")try{for(var w=(i=void 0,dt(Nd(h))),I=w.next();!I.done;I=w.next()){var C=I.value;m.has(C)||(m.add(C),u.get(C)?u.get(C).forEach(function($){return m.add($)}):C.initialStateNodes.forEach(function($){return m.add($)}))}}catch($){i={error:$}}finally{try{I&&!I.done&&(s=w.return)&&s.call(w)}finally{if(i)throw i.error}}}}catch(z){n={error:z}}finally{try{x&&!x.done&&(a=b.return)&&a.call(b)}finally{if(n)throw n.error}}try{for(var R=dt(m),P=R.next();!P.done;P=R.next())for(var h=P.value,y=h.parent;y&&!m.has(y);)m.add(y),y=y.parent}catch(z){c={error:z}}finally{try{P&&!P.done&&(l=R.return)&&l.call(R)}finally{if(c)throw c.error}}return m}function vP(e,t){var r=t.get(e);if(!r)return{};if(e.type==="compound"){var o=r[0];if(o){if(bv(o))return o.key}else return{}}var n={};return r.forEach(function(a){n[a.key]=vP(a,t)}),n}function kC(e){var t,r,o=new Map;try{for(var n=dt(e),a=n.next();!a.done;a=n.next()){var i=a.value;o.has(i)||o.set(i,[]),i.parent&&(o.has(i.parent)||o.set(i.parent,[]),o.get(i.parent).push(i))}}catch(s){t={error:s}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return o}function bP(e,t){var r=Ad([e],t);return vP(e,kC(r))}function Rd(e,t){return Array.isArray(e)?e.some(function(r){return r===t}):e instanceof Set?e.has(t):!1}function xP(e){return Vt([],bt(new Set(rr(Vt([],bt(e.map(function(t){return t.ownEvents})),!1)))),!1)}function xv(e,t){return t.type==="compound"?Nd(t).some(function(r){return r.type==="final"&&Rd(e,r)}):t.type==="parallel"?Nd(t).every(function(r){return xv(e,r)}):!1}function wP(e){return e===void 0&&(e=[]),e.reduce(function(t,r){return r.meta!==void 0&&(t[r.id]=r.meta),t},{})}function IC(e){return new Set(rr(e.map(function(t){return t.tags})))}function TC(e,t){if(e===t)return!0;if(e===void 0||t===void 0)return!1;if(Et(e)||Et(t))return e===t;var r=Object.keys(e),o=Object.keys(t);return r.length===o.length&&r.every(function(n){return TC(e[n],t[n])})}function SP(e){return typeof e!="object"||e===null?!1:"value"in e&&"_event"in e}function kP(e,t){var r=e.exec,o=ue(ue({},e),{exec:r!==void 0?function(){return r(t.context,t.event,{action:e,state:t,_event:t._event})}:void 0});return o}var en=function(){function e(t){var r=this,o;this.actions=[],this.activities=gC,this.meta={},this.events=[],this.value=t.value,this.context=t.context,this._event=t._event,this._sessionid=t._sessionid,this.event=this._event.data,this.historyValue=t.historyValue,this.history=t.history,this.actions=t.actions||[],this.activities=t.activities||gC,this.meta=wP(t.configuration),this.events=t.events||[],this.matches=this.matches.bind(this),this.toStrings=this.toStrings.bind(this),this.configuration=t.configuration,this.transitions=t.transitions,this.children=t.children,this.done=!!t.done,this.tags=(o=Array.isArray(t.tags)?new Set(t.tags):t.tags)!==null&&o!==void 0?o:new Set,this.machine=t.machine,Object.defineProperty(this,"nextEvents",{get:function(){return xP(r.configuration)}})}return e.from=function(t,r){if(t instanceof e)return t.context!==r?new e({value:t.value,context:r,_event:t._event,_sessionid:null,historyValue:t.historyValue,history:t.history,actions:[],activities:t.activities,meta:{},events:[],configuration:[],transitions:[],children:{}}):t;var o=Si;return new e({value:t,context:r,_event:o,_sessionid:null,historyValue:void 0,history:void 0,actions:[],activities:void 0,meta:void 0,events:[],configuration:[],transitions:[],children:{}})},e.create=function(t){return new e(t)},e.inert=function(t,r){if(t instanceof e){if(!t.actions.length)return t;var o=Si;return new e({value:t.value,context:r,_event:o,_sessionid:null,historyValue:t.historyValue,history:t.history,activities:t.activities,configuration:t.configuration,transitions:[],children:{}})}return e.from(t,r)},e.prototype.toStrings=function(t,r){var o=this;if(t===void 0&&(t=this.value),r===void 0&&(r="."),Et(t))return[t];var n=Object.keys(t);return n.concat.apply(n,Vt([],bt(n.map(function(a){return o.toStrings(t[a],r).map(function(i){return a+r+i})})),!1))},e.prototype.toJSON=function(){var t=this;t.configuration,t.transitions;var r=t.tags;t.machine;var o=wd(t,["configuration","transitions","tags","machine"]);return ue(ue({},o),{tags:Array.from(r)})},e.prototype.matches=function(t){return Id(t,this.value)},e.prototype.hasTag=function(t){return this.tags.has(t)},e.prototype.can=function(t){var r;Kt&&zr(!!this.machine,"state.can(...) used outside of a machine-created State object; this will always return false.");var o=(r=this.machine)===null||r===void 0?void 0:r.getTransitionData(this,t);return!!o?.transitions.length&&o.transitions.some(function(n){return n.target!==void 0||n.actions.length})},e}();var Gie={deferEvents:!1},CC=function(){function e(t){this.processingEvent=!1,this.queue=[],this.initialized=!1,this.options=ue(ue({},Gie),t)}return e.prototype.initialize=function(t){if(this.initialized=!0,t){if(!this.options.deferEvents){this.schedule(t);return}this.process(t)}this.flushEvents()},e.prototype.schedule=function(t){if(!this.initialized||this.processingEvent){this.queue.push(t);return}if(this.queue.length!==0)throw new Error("Event queue should be empty when it is not processing events");this.process(t),this.flushEvents()},e.prototype.clear=function(){this.queue=[]},e.prototype.flushEvents=function(){for(var t=this.queue.shift();t;)this.process(t),t=this.queue.shift()},e.prototype.process=function(t){this.processingEvent=!0;try{t()}catch(r){throw this.clear(),r}finally{this.processingEvent=!1}},e}();var NC=new Map,qie=0,Dd={bookId:function(){return"x:".concat(qie++)},register:function(e,t){return NC.set(e,t),e},get:function(e){return NC.get(e)},free:function(e){NC.delete(e)}};function mw(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;Kt||console.warn("XState could not find a global object in this environment. Please let the maintainers know and raise an issue here: https://github.com/statelyai/xstate/issues")}function Kie(){var e=mw();if(e&&"__xstate__"in e)return e.__xstate__}function _P(e){if(mw()){var t=Kie();t&&t.register(e)}}function EP(e,t){t===void 0&&(t={});var r=e.initialState,o=new Set,n=[],a=!1,i=function(){if(!a){for(a=!0;n.length>0;){var l=n.shift();r=e.transition(r,l,c),o.forEach(function(p){return p.next(r)})}a=!1}},s=yP({id:t.id,send:function(l){n.push(l),i()},getSnapshot:function(){return r},subscribe:function(l,p,u){var m=gs(l,p,u);return o.add(m),m.next(r),{unsubscribe:function(){o.delete(m)}}}}),c={parent:t.parent,self:s,id:t.id||"anonymous",observers:o};return r=e.start?e.start(c):r,s}var AC={sync:!1,autoForward:!1},Sr;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(Sr||(Sr={}));var IP=function(){function e(t,r){r===void 0&&(r=e.defaultOptions);var o=this;this.machine=t,this.delayedEventsMap={},this.listeners=new Set,this.contextListeners=new Set,this.stopListeners=new Set,this.doneListeners=new Set,this.eventListeners=new Set,this.sendListeners=new Set,this.initialized=!1,this.status=Sr.NotStarted,this.children=new Map,this.forwardTo=new Set,this._outgoingQueue=[],this.init=this.start,this.send=function(p,u){if(hs(p))return o.batch(p),o.state;var m=Vr(op(p,u));if(o.status===Sr.Stopped)return Kt||zr(!1,'Event "'.concat(m.name,'" was sent to stopped service "').concat(o.machine.id,`". This service has already reached its final state, and will not transition.
12
+ Event: `).concat(JSON.stringify(m.data))),o.state;if(o.status!==Sr.Running&&!o.options.deferEvents)throw new Error('Event "'.concat(m.name,'" was sent to uninitialized service "').concat(o.machine.id,`". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.
13
+ Event: `).concat(JSON.stringify(m.data)));return o.scheduler.schedule(function(){o.forward(m);var f=o._nextState(m);o.update(f,m)}),o._state},this.sendTo=function(p,u,m){var f=o.parent&&(u===Ya.Parent||o.parent.id===u),d=f?o.parent:Et(u)?u===Ya.Internal?o:o.children.get(u)||Dd.get(u):ZO(u)?u:void 0;if(!d){if(!f)throw new Error("Unable to send event to child '".concat(u,"' from service '").concat(o.id,"'."));Kt||zr(!1,"Service '".concat(o.id,"' has no parent: unable to send event ").concat(p.type));return}if("machine"in d){if(o.status!==Sr.Stopped||o.parent!==d||o.state.done){var h=ue(ue({},p),{name:p.name===mv?"".concat(_l(o.id)):p.name,origin:o.sessionId});!m&&o.machine.config.predictableActionArguments?o._outgoingQueue.push([d,h]):d.send(h)}}else!m&&o.machine.config.predictableActionArguments?o._outgoingQueue.push([d,p.data]):d.send(p.data)},this._exec=function(p,u,m,f){f===void 0&&(f=o.machine.options.actions);var d=p.exec||yv(p.type,f),h=Rt(d)?d:d?d.exec:p.exec;if(h)try{return h(u,m.data,o.machine.config.predictableActionArguments?{action:p,_event:m}:{action:p,state:o.state,_event:m})}catch(G){throw o.parent&&o.parent.send({type:"xstate.error",data:G}),G}switch(p.type){case ds:{var y=p;o.defer(y);break}case wl:var g=p;if(typeof g.delay=="number"){o.defer(g);return}else g.to?o.sendTo(g._event,g.to,m===Si):o.send(g._event);break;case pv:o.cancel(p.sendId);break;case Sd:{if(o.status!==Sr.Running)return;var b=p.activity;if(!o.machine.config.predictableActionArguments&&!o.state.activities[b.id||b.type])break;if(b.type===Ut.Invoke){var x=aw(b.src),w=o.machine.options.services?o.machine.options.services[x.type]:void 0,I=b.id,C=b.data;Kt||zr(!("forward"in b),"`forward` property is deprecated (found in invocation of '".concat(b.src,"' in in machine '").concat(o.machine.id,"'). ")+"Please use `autoForward` instead.");var R="autoForward"in b?b.autoForward:!!b.forward;if(!w){Kt||zr(!1,"No service found for invocation '".concat(b.src,"' in machine '").concat(o.machine.id,"'."));return}var P=C?rp(C,u,m):void 0;if(typeof w=="string")return;var z=Rt(w)?w(u,m.data,{data:P,src:x,meta:b.meta}):w;if(!z)return;var $=void 0;da(z)&&(z=P?z.withContext(P):z,$={autoForward:R}),o.spawn(z,I,$)}else o.spawnActivity(b);break}case ep:{o.stopChild(p.activity.id);break}case kd:var B=p,V=B.label,H=B.value;V?o.logger(V,H):o.logger(H);break;default:Kt||zr(!1,"No implementation found for action type '".concat(p.type,"'"));break}};var n=ue(ue({},e.defaultOptions),r),a=n.clock,i=n.logger,s=n.parent,c=n.id,l=c!==void 0?c:t.id;this.id=l,this.logger=i,this.clock=a,this.parent=s,this.options=n,this.scheduler=new CC({deferEvents:this.options.deferEvents}),this.sessionId=Dd.bookId()}return Object.defineProperty(e.prototype,"initialState",{get:function(){var t=this;return this._initialState?this._initialState:El(this,function(){return t._initialState=t.machine.initialState,t._initialState})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"state",{get:function(){return Kt||zr(this.status!==Sr.NotStarted,"Attempted to read state from uninitialized service '".concat(this.id,"'. Make sure the service is started first.")),this._state},enumerable:!1,configurable:!0}),e.prototype.execute=function(t,r){var o,n;try{for(var a=dt(t.actions),i=a.next();!i.done;i=a.next()){var s=i.value;this.exec(s,t,r)}}catch(c){o={error:c}}finally{try{i&&!i.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}},e.prototype.update=function(t,r){var o,n,a,i,s,c,l,p,u=this;if(t._sessionid=this.sessionId,this._state=t,(!this.machine.config.predictableActionArguments||r===Si)&&this.options.execute)this.execute(this.state);else for(var m=void 0;m=this._outgoingQueue.shift();)m[0].send(m[1]);if(this.children.forEach(function(z){u.state.children[z.id]=z}),this.devTools&&this.devTools.send(r.data,t),t.event)try{for(var f=dt(this.eventListeners),d=f.next();!d.done;d=f.next()){var h=d.value;h(t.event)}}catch(z){o={error:z}}finally{try{d&&!d.done&&(n=f.return)&&n.call(f)}finally{if(o)throw o.error}}try{for(var y=dt(this.listeners),g=y.next();!g.done;g=y.next()){var h=g.value;h(t,t.event)}}catch(z){a={error:z}}finally{try{g&&!g.done&&(i=y.return)&&i.call(y)}finally{if(a)throw a.error}}try{for(var b=dt(this.contextListeners),x=b.next();!x.done;x=b.next()){var w=x.value;w(this.state.context,this.state.history?this.state.history.context:void 0)}}catch(z){s={error:z}}finally{try{x&&!x.done&&(c=b.return)&&c.call(b)}finally{if(s)throw s.error}}if(this.state.done){var I=t.configuration.find(function(z){return z.type==="final"&&z.parent===u.machine}),C=I&&I.doneData?rp(I.doneData,t.context,r):void 0;this._doneEvent=kl(this.id,C);try{for(var R=dt(this.doneListeners),P=R.next();!P.done;P=R.next()){var h=P.value;h(this._doneEvent)}}catch(z){l={error:z}}finally{try{P&&!P.done&&(p=R.return)&&p.call(R)}finally{if(l)throw l.error}}this._stop(),this._stopChildren(),Dd.free(this.sessionId)}},e.prototype.onTransition=function(t){return this.listeners.add(t),this.status===Sr.Running&&t(this.state,this.state.event),this},e.prototype.subscribe=function(t,r,o){var n=this,a=gs(t,r,o);this.listeners.add(a.next),this.status!==Sr.NotStarted&&a.next(this.state);var i=function(){n.doneListeners.delete(i),n.stopListeners.delete(i),a.complete()};return this.status===Sr.Stopped?a.complete():(this.onDone(i),this.onStop(i)),{unsubscribe:function(){n.listeners.delete(a.next),n.doneListeners.delete(i),n.stopListeners.delete(i)}}},e.prototype.onEvent=function(t){return this.eventListeners.add(t),this},e.prototype.onSend=function(t){return this.sendListeners.add(t),this},e.prototype.onChange=function(t){return this.contextListeners.add(t),this},e.prototype.onStop=function(t){return this.stopListeners.add(t),this},e.prototype.onDone=function(t){return this.status===Sr.Stopped&&this._doneEvent?t(this._doneEvent):this.doneListeners.add(t),this},e.prototype.off=function(t){return this.listeners.delete(t),this.eventListeners.delete(t),this.sendListeners.delete(t),this.stopListeners.delete(t),this.doneListeners.delete(t),this.contextListeners.delete(t),this},e.prototype.start=function(t){var r=this;if(this.status===Sr.Running)return this;this.machine._init(),Dd.register(this.sessionId,this),this.initialized=!0,this.status=Sr.Running;var o=t===void 0?this.initialState:El(this,function(){return SP(t)?r.machine.resolveState(t):r.machine.resolveState(en.from(t,r.machine.context))});return this.options.devTools&&this.attachDev(),this.scheduler.initialize(function(){r.update(o,Si)}),this},e.prototype._stopChildren=function(){this.children.forEach(function(t){Rt(t.stop)&&t.stop()}),this.children.clear()},e.prototype._stop=function(){var t,r,o,n,a,i,s,c,l,p;try{for(var u=dt(this.listeners),m=u.next();!m.done;m=u.next()){var f=m.value;this.listeners.delete(f)}}catch(R){t={error:R}}finally{try{m&&!m.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}try{for(var d=dt(this.stopListeners),h=d.next();!h.done;h=d.next()){var f=h.value;f(),this.stopListeners.delete(f)}}catch(R){o={error:R}}finally{try{h&&!h.done&&(n=d.return)&&n.call(d)}finally{if(o)throw o.error}}try{for(var y=dt(this.contextListeners),g=y.next();!g.done;g=y.next()){var f=g.value;this.contextListeners.delete(f)}}catch(R){a={error:R}}finally{try{g&&!g.done&&(i=y.return)&&i.call(y)}finally{if(a)throw a.error}}try{for(var b=dt(this.doneListeners),x=b.next();!x.done;x=b.next()){var f=x.value;this.doneListeners.delete(f)}}catch(R){s={error:R}}finally{try{x&&!x.done&&(c=b.return)&&c.call(b)}finally{if(s)throw s.error}}if(!this.initialized)return this;this.initialized=!1,this.status=Sr.Stopped,this._initialState=void 0;try{for(var w=dt(Object.keys(this.delayedEventsMap)),I=w.next();!I.done;I=w.next()){var C=I.value;this.clock.clearTimeout(this.delayedEventsMap[C])}}catch(R){l={error:R}}finally{try{I&&!I.done&&(p=w.return)&&p.call(w)}finally{if(l)throw l.error}}this.scheduler.clear(),this.scheduler=new CC({deferEvents:this.options.deferEvents})},e.prototype.stop=function(){var t=this,r=this.scheduler;return this._stop(),r.schedule(function(){var o;if(!(!((o=t._state)===null||o===void 0)&&o.done)){var n=Vr({type:"xstate.stop"}),a=El(t,function(){var i=rr(Vt([],bt(t.state.configuration),!1).sort(function(u,m){return m.order-u.order}).map(function(u){return Qa(u.onExit,t.machine.options.actions)})),s=bt(ap(t.machine,t.state,t.state.context,n,[{type:"exit",actions:i}],t.machine.config.predictableActionArguments?t._exec:void 0,t.machine.config.predictableActionArguments||t.machine.config.preserveActionOrder),2),c=s[0],l=s[1],p=new en({value:t.state.value,context:l,_event:n,_sessionid:t.sessionId,historyValue:void 0,history:t.state,actions:c.filter(function(u){return!gv(u)}),activities:{},events:[],configuration:[],transitions:[],children:{},done:t.state.done,tags:t.state.tags,machine:t.machine});return p.changed=!0,p});t.update(a,n),t._stopChildren(),Dd.free(t.sessionId)}}),this},e.prototype.batch=function(t){var r=this;if(this.status===Sr.NotStarted&&this.options.deferEvents)Kt||zr(!1,"".concat(t.length,' event(s) were sent to uninitialized service "').concat(this.machine.id,`" and are deferred. Make sure .start() is called for this service.
14
+ Event: `).concat(JSON.stringify(event)));else if(this.status!==Sr.Running)throw new Error("".concat(t.length,' event(s) were sent to uninitialized service "').concat(this.machine.id,'". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.'));if(t.length){var o=!!this.machine.config.predictableActionArguments&&this._exec;this.scheduler.schedule(function(){var n,a,i=r.state,s=!1,c=[],l=function(f){var d=Vr(f);r.forward(d),i=El(r,function(){return r.machine.transition(i,d,void 0,o||void 0)}),c.push.apply(c,Vt([],bt(r.machine.config.predictableActionArguments?i.actions:i.actions.map(function(h){return kP(h,i)})),!1)),s=s||!!i.changed};try{for(var p=dt(t),u=p.next();!u.done;u=p.next()){var m=u.value;l(m)}}catch(f){n={error:f}}finally{try{u&&!u.done&&(a=p.return)&&a.call(p)}finally{if(n)throw n.error}}i.changed=s,i.actions=c,r.update(i,Vr(t[t.length-1]))})}},e.prototype.sender=function(t){return this.send.bind(this,t)},e.prototype._nextState=function(t,r){var o=this;r===void 0&&(r=!!this.machine.config.predictableActionArguments&&this._exec);var n=Vr(t);if(n.name.indexOf(Q0)===0&&!this.state.nextEvents.some(function(i){return i.indexOf(Q0)===0}))throw n.data.data;var a=El(this,function(){return o.machine.transition(o.state,n,void 0,r||void 0)});return a},e.prototype.nextState=function(t){return this._nextState(t,!1)},e.prototype.forward=function(t){var r,o;try{for(var n=dt(this.forwardTo),a=n.next();!a.done;a=n.next()){var i=a.value,s=this.children.get(i);if(!s)throw new Error("Unable to forward event '".concat(t,"' from interpreter '").concat(this.id,"' to nonexistant child '").concat(i,"'."));s.send(t)}}catch(c){r={error:c}}finally{try{a&&!a.done&&(o=n.return)&&o.call(n)}finally{if(r)throw r.error}}},e.prototype.defer=function(t){var r=this,o=this.clock.setTimeout(function(){"to"in t&&t.to?r.sendTo(t._event,t.to,!0):r.send(t._event)},t.delay);t.id&&(this.delayedEventsMap[t.id]=o)},e.prototype.cancel=function(t){this.clock.clearTimeout(this.delayedEventsMap[t]),delete this.delayedEventsMap[t]},e.prototype.exec=function(t,r,o){o===void 0&&(o=this.machine.options.actions),this._exec(t,r.context,r._event,o)},e.prototype.removeChild=function(t){var r;this.children.delete(t),this.forwardTo.delete(t),(r=this.state)===null||r===void 0||delete r.children[t]},e.prototype.stopChild=function(t){var r=this.children.get(t);r&&(this.removeChild(t),Rt(r.stop)&&r.stop())},e.prototype.spawn=function(t,r,o){if(this.status!==Sr.Running)return uw(t,r);if(vC(t))return this.spawnPromise(Promise.resolve(t),r);if(Rt(t))return this.spawnCallback(t,r);if(gP(t))return this.spawnActor(t,r);if(JO(t))return this.spawnObservable(t,r);if(da(t))return this.spawnMachine(t,ue(ue({},o),{id:r}));if(KO(t))return this.spawnBehavior(t,r);throw new Error('Unable to spawn entity "'.concat(r,'" of type "').concat(typeof t,'".'))},e.prototype.spawnMachine=function(t,r){var o=this;r===void 0&&(r={});var n=new e(t,ue(ue({},this.options),{parent:this,id:r.id||t.id})),a=ue(ue({},AC),r);a.sync&&n.onTransition(function(s){o.send(tp,{state:s,id:n.id})});var i=n;return this.children.set(n.id,i),a.autoForward&&this.forwardTo.add(n.id),n.onDone(function(s){o.removeChild(n.id),o.send(Vr(s,{origin:n.id}))}).start(),i},e.prototype.spawnBehavior=function(t,r){var o=EP(t,{id:r,parent:this});return this.children.set(r,o),o},e.prototype.spawnPromise=function(t,r){var o,n=this,a=!1,i;t.then(function(c){a||(i=c,n.removeChild(r),n.send(Vr(kl(r,c),{origin:r})))},function(c){if(!a){n.removeChild(r);var l=_l(r,c);try{n.send(Vr(l,{origin:r}))}catch(p){rP(c,p,r),n.devTools&&n.devTools.send(l,n.state),n.machine.strict&&n.stop()}}});var s=(o={id:r,send:function(){},subscribe:function(c,l,p){var u=gs(c,l,p),m=!1;return t.then(function(f){m||(u.next(f),!m&&u.complete())},function(f){m||u.error(f)}),{unsubscribe:function(){return m=!0}}},stop:function(){a=!0},toJSON:function(){return{id:r}},getSnapshot:function(){return i}},o[wi]=function(){return this},o);return this.children.set(r,s),s},e.prototype.spawnCallback=function(t,r){var o,n=this,a=!1,i=new Set,s=new Set,c,l=function(m){c=m,s.forEach(function(f){return f(m)}),!a&&n.send(Vr(m,{origin:r}))},p;try{p=t(l,function(m){i.add(m)})}catch(m){this.send(_l(r,m))}if(vC(p))return this.spawnPromise(p,r);var u=(o={id:r,send:function(m){return i.forEach(function(f){return f(m)})},subscribe:function(m){var f=gs(m);return s.add(f.next),{unsubscribe:function(){s.delete(f.next)}}},stop:function(){a=!0,Rt(p)&&p()},toJSON:function(){return{id:r}},getSnapshot:function(){return c}},o[wi]=function(){return this},o);return this.children.set(r,u),u},e.prototype.spawnObservable=function(t,r){var o,n=this,a,i=t.subscribe(function(c){a=c,n.send(Vr(c,{origin:r}))},function(c){n.removeChild(r),n.send(Vr(_l(r,c),{origin:r}))},function(){n.removeChild(r),n.send(Vr(kl(r),{origin:r}))}),s=(o={id:r,send:function(){},subscribe:function(c,l,p){return t.subscribe(c,l,p)},stop:function(){return i.unsubscribe()},getSnapshot:function(){return a},toJSON:function(){return{id:r}}},o[wi]=function(){return this},o);return this.children.set(r,s),s},e.prototype.spawnActor=function(t,r){return this.children.set(r,t),t},e.prototype.spawnActivity=function(t){var r=this.machine.options&&this.machine.options.activities?this.machine.options.activities[t.type]:void 0;if(!r){Kt||zr(!1,"No implementation found for activity '".concat(t.type,"'"));return}var o=r(this.state.context,t);this.spawnEffect(t.id,o)},e.prototype.spawnEffect=function(t,r){var o;this.children.set(t,(o={id:t,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},stop:r||void 0,getSnapshot:function(){},toJSON:function(){return{id:t}}},o[wi]=function(){return this},o))},e.prototype.attachDev=function(){var t=mw();if(this.options.devTools&&t){if(t.__REDUX_DEVTOOLS_EXTENSION__){var r=typeof this.options.devTools=="object"?this.options.devTools:void 0;this.devTools=t.__REDUX_DEVTOOLS_EXTENSION__.connect(ue(ue({name:this.id,autoPause:!0,stateSanitizer:function(o){return{value:o.value,context:o.context,actions:o.actions}}},r),{features:ue({jump:!1,skip:!1},r?r.features:void 0)}),this.machine),this.devTools.init(this.state)}_P(this)}},e.prototype.toJSON=function(){return{id:this.id}},e.prototype[wi]=function(){return this},e.prototype.getSnapshot=function(){return this.status===Sr.NotStarted?this.initialState:this._state},e.defaultOptions={execute:!0,deferEvents:!0,clock:{setTimeout:function(t,r){return setTimeout(t,r)},clearTimeout:function(t){return clearTimeout(t)}},logger:console.log.bind(console),devTools:!1},e.interpret=fw,e}(),Xie=function(e){return Et(e)?ue(ue({},AC),{name:e}):ue(ue(ue({},AC),{name:eP()}),e)};function RC(e,t){var r=Xie(t);return fP(function(o){if(!Kt){var n=da(e)||Rt(e);zr(!!o||n,'Attempted to spawn an Actor (ID: "'.concat(da(e)?e.id:"undefined",'") outside of a service. This will have no effect.'))}return o?o.spawn(e,r.name,r):uw(e,r.name)})}function fw(e,t){var r=new IP(e,t);return r}function Yie(e){if(typeof e=="string"){var t={type:e};return t.toString=function(){return e},t}return e}function wv(e){return ue(ue({type:_d},e),{toJSON:function(){e.onDone,e.onError;var t=wd(e,["onDone","onError"]);return ue(ue({},t),{type:_d,src:Yie(e.src)})}})}var Od="",DC="#",Sv="*",Fd={},Md=function(e){return e[0]===DC},Qie=function(){return{actions:{},guards:{},services:{},activities:{},delays:{}}},Jie=function(e,t,r){var o=r.slice(0,-1).some(function(a){return!("cond"in a)&&!("in"in a)&&(Et(a.target)||da(a.target))}),n=t===Od?"the transient event":"event '".concat(t,"'");zr(!o,"One or more transitions for ".concat(n," on state '").concat(e.id,"' are unreachable. ")+"Make sure that the default transition is the last one defined.")},TP=function(){function e(t,r,o,n){o===void 0&&(o="context"in t?t.context:void 0);var a=this,i;this.config=t,this._context=o,this.order=-1,this.__xstatenode=!0,this.__cache={events:void 0,relativeValue:new Map,initialStateValue:void 0,initialState:void 0,on:void 0,transitions:void 0,candidates:{},delayedTransitions:void 0},this.idMap={},this.tags=[],this.options=Object.assign(Qie(),r),this.parent=n?.parent,this.key=this.config.key||n?.key||this.config.id||"(machine)",this.machine=this.parent?this.parent.machine:this,this.path=this.parent?this.parent.path.concat(this.key):[],this.delimiter=this.config.delimiter||(this.parent?this.parent.delimiter:J0),this.id=this.config.id||Vt([this.machine.key],bt(this.path),!1).join(this.delimiter),this.version=this.parent?this.parent.version:this.config.version,this.type=this.config.type||(this.config.parallel?"parallel":this.config.states&&Object.keys(this.config.states).length?"compound":this.config.history?"history":"atomic"),this.schema=this.parent?this.machine.schema:(i=this.config.schema)!==null&&i!==void 0?i:{},this.description=this.config.description,Kt||zr(!("parallel"in this.config),'The "parallel" property is deprecated and will be removed in version 4.1. '.concat(this.config.parallel?"Replace with `type: 'parallel'`":"Use `type: '".concat(this.type,"'`")," in the config for state node '").concat(this.id,"' instead.")),this.initial=this.config.initial,this.states=this.config.states?Td(this.config.states,function(l,p){var u,m=new e(l,{},void 0,{parent:a,key:p});return Object.assign(a.idMap,ue((u={},u[m.id]=m,u),m.idMap)),m}):Fd;var s=0;function c(l){var p,u;l.order=s++;try{for(var m=dt(_C(l)),f=m.next();!f.done;f=m.next()){var d=f.value;c(d)}}catch(h){p={error:h}}finally{try{f&&!f.done&&(u=m.return)&&u.call(m)}finally{if(p)throw p.error}}}c(this),this.history=this.config.history===!0?"shallow":this.config.history||!1,this._transient=!!this.config.always||(this.config.on?Array.isArray(this.config.on)?this.config.on.some(function(l){var p=l.event;return p===Od}):Od in this.config.on:!1),this.strict=!!this.config.strict,this.onEntry=Vn(this.config.entry||this.config.onEntry).map(function(l){return ip(l)}),this.onExit=Vn(this.config.exit||this.config.onExit).map(function(l){return ip(l)}),this.meta=this.config.meta,this.doneData=this.type==="final"?this.config.data:void 0,this.invoke=Vn(this.config.invoke).map(function(l,p){var u,m;if(da(l)){var f=hv(a.id,p);return a.machine.options.services=ue((u={},u[f]=l,u),a.machine.options.services),wv({src:f,id:f})}else if(Et(l.src)){var f=l.id||hv(a.id,p);return wv(ue(ue({},l),{id:f,src:l.src}))}else if(da(l.src)||Rt(l.src)){var f=l.id||hv(a.id,p);return a.machine.options.services=ue((m={},m[f]=l.src,m),a.machine.options.services),wv(ue(ue({id:f},l),{src:f}))}else{var d=l.src;return wv(ue(ue({id:hv(a.id,p)},l),{src:d}))}}),this.activities=Vn(this.config.activities).concat(this.invoke).map(function(l){return vv(l)}),this.transition=this.transition.bind(this),this.tags=Vn(this.config.tags)}return e.prototype._init=function(){this.__cache.transitions||EC(this).forEach(function(t){return t.on})},e.prototype.withConfig=function(t,r){var o=this.options,n=o.actions,a=o.activities,i=o.guards,s=o.services,c=o.delays;return new e(this.config,{actions:ue(ue({},n),t.actions),activities:ue(ue({},a),t.activities),guards:ue(ue({},i),t.guards),services:ue(ue({},s),t.services),delays:ue(ue({},c),t.delays)},r??this.context)},e.prototype.withContext=function(t){return new e(this.config,this.options,t)},Object.defineProperty(e.prototype,"context",{get:function(){return Rt(this._context)?this._context():this._context},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"definition",{get:function(){return{id:this.id,key:this.key,version:this.version,context:this.context,type:this.type,initial:this.initial,history:this.history,states:Td(this.states,function(t){return t.definition}),on:this.on,transitions:this.transitions,entry:this.onEntry,exit:this.onExit,activities:this.activities||[],meta:this.meta,order:this.order||-1,data:this.doneData,invoke:this.invoke,description:this.description,tags:this.tags}},enumerable:!1,configurable:!0}),e.prototype.toJSON=function(){return this.definition},Object.defineProperty(e.prototype,"on",{get:function(){if(this.__cache.on)return this.__cache.on;var t=this.transitions;return this.__cache.on=t.reduce(function(r,o){return r[o.eventType]=r[o.eventType]||[],r[o.eventType].push(o),r},{})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"after",{get:function(){return this.__cache.delayedTransitions||(this.__cache.delayedTransitions=this.getDelayedTransitions(),this.__cache.delayedTransitions)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transitions",{get:function(){return this.__cache.transitions||(this.__cache.transitions=this.formatTransitions(),this.__cache.transitions)},enumerable:!1,configurable:!0}),e.prototype.getCandidates=function(t){if(this.__cache.candidates[t])return this.__cache.candidates[t];var r=t===Od,o=this.transitions.filter(function(n){var a=n.eventType===t;return r?a:a||n.eventType===Sv});return this.__cache.candidates[t]=o,o},e.prototype.getDelayedTransitions=function(){var t=this,r=this.config.after;if(!r)return[];var o=function(a,i){var s=Rt(a)?"".concat(t.id,":delay[").concat(i,"]"):a,c=SC(s,t.id);return t.onEntry.push(Sl(c,{delay:a})),t.onExit.push(lw(c)),c},n=hs(r)?r.map(function(a,i){var s=o(a.delay,i);return ue(ue({},a),{event:s})}):rr(Object.keys(r).map(function(a,i){var s=r[a],c=Et(s)?{target:s}:s,l=isNaN(+a)?a:+a,p=o(l,i);return Vn(c).map(function(u){return ue(ue({},u),{event:p,delay:l})})}));return n.map(function(a){var i=a.delay;return ue(ue({},t.formatTransition(a)),{delay:i})})},e.prototype.getStateNodes=function(t){var r,o=this;if(!t)return[];var n=t instanceof en?t.value:Ed(t,this.delimiter);if(Et(n)){var a=this.getStateNode(n).initial;return a!==void 0?this.getStateNodes((r={},r[n]=a,r)):[this,this.states[n]]}var i=Object.keys(n),s=[this];return s.push.apply(s,Vt([],bt(rr(i.map(function(c){return o.getStateNode(c).getStateNodes(n[c])}))),!1)),s},e.prototype.handles=function(t){var r=tw(t);return this.events.includes(r)},e.prototype.resolveState=function(t){var r=t instanceof en?t:en.create(t),o=Array.from(Ad([],this.getStateNodes(r.value)));return new en(ue(ue({},r),{value:this.resolve(r.value),configuration:o,done:xv(o,this),tags:IC(o),machine:this.machine}))},e.prototype.transitionLeafNode=function(t,r,o){var n=this.getStateNode(t),a=n.next(r,o);return!a||!a.transitions.length?this.next(r,o):a},e.prototype.transitionCompoundNode=function(t,r,o){var n=Object.keys(t),a=this.getStateNode(n[0]),i=a._transition(t[n[0]],r,o);return!i||!i.transitions.length?this.next(r,o):i},e.prototype.transitionParallelNode=function(t,r,o){var n,a,i={};try{for(var s=dt(Object.keys(t)),c=s.next();!c.done;c=s.next()){var l=c.value,p=t[l];if(p){var u=this.getStateNode(l),m=u._transition(p,r,o);m&&(i[l]=m)}}}catch(g){n={error:g}}finally{try{c&&!c.done&&(a=s.return)&&a.call(s)}finally{if(n)throw n.error}}var f=Object.keys(i).map(function(g){return i[g]}),d=rr(f.map(function(g){return g.transitions})),h=f.some(function(g){return g.transitions.length>0});if(!h)return this.next(r,o);var y=rr(Object.keys(i).map(function(g){return i[g].configuration}));return{transitions:d,exitSet:rr(f.map(function(g){return g.exitSet})),configuration:y,source:r,actions:rr(Object.keys(i).map(function(g){return i[g].actions}))}},e.prototype._transition=function(t,r,o){return Et(t)?this.transitionLeafNode(t,r,o):Object.keys(t).length===1?this.transitionCompoundNode(t,r,o):this.transitionParallelNode(t,r,o)},e.prototype.getTransitionData=function(t,r){return this._transition(t.value,t,Vr(r))},e.prototype.next=function(t,r){var o,n,a=this,i=r.name,s=[],c=[],l;try{for(var p=dt(this.getCandidates(i)),u=p.next();!u.done;u=p.next()){var m=u.value,f=m.cond,d=m.in,h=t.context,y=d?Et(d)&&Md(d)?t.matches(Ed(this.getStateNodeById(d).path,this.delimiter)):Id(Ed(d,this.delimiter),VO(this.path.slice(0,-2))(t.value)):!0,g=!1;try{g=!f||nw(this.machine,f,h,r,t)}catch(w){throw new Error("Unable to evaluate guard '".concat(f.name||f.type,"' in transition for event '").concat(i,"' in state node '").concat(this.id,`':
15
+ `).concat(w.message))}if(g&&y){m.target!==void 0&&(c=m.target),s.push.apply(s,Vt([],bt(m.actions),!1)),l=m;break}}}catch(w){o={error:w}}finally{try{u&&!u.done&&(n=p.return)&&n.call(p)}finally{if(o)throw o.error}}if(l){if(!c.length)return{transitions:[l],exitSet:[],configuration:t.value?[this]:[],source:t,actions:s};var b=rr(c.map(function(w){return a.getRelativeStateNodes(w,t.historyValue)})),x=!!l.internal;return{transitions:[l],exitSet:x?[]:rr(c.map(function(w){return a.getPotentiallyReenteringNodes(w)})),configuration:b,source:t,actions:s}}},e.prototype.getPotentiallyReenteringNodes=function(t){if(this.order<t.order)return[this];for(var r=[],o=this,n=t;o&&o!==n;)r.push(o),o=o.parent;return o!==n?[]:(r.push(n),r)},e.prototype.getActions=function(t,r,o,n,a,i,s){var c,l,p,u,m=this,f=i?Ad([],this.getStateNodes(i.value)):[],d=new Set;try{for(var h=dt(Array.from(t).sort(function(B,V){return B.order-V.order})),y=h.next();!y.done;y=h.next()){var g=y.value;(!Rd(f,g)||Rd(o.exitSet,g)||g.parent&&d.has(g.parent))&&d.add(g)}}catch(B){c={error:B}}finally{try{y&&!y.done&&(l=h.return)&&l.call(h)}finally{if(c)throw c.error}}try{for(var b=dt(f),x=b.next();!x.done;x=b.next()){var g=x.value;(!Rd(t,g)||Rd(o.exitSet,g.parent))&&o.exitSet.push(g)}}catch(B){p={error:B}}finally{try{x&&!x.done&&(u=b.return)&&u.call(b)}finally{if(p)throw p.error}}o.exitSet.sort(function(B,V){return V.order-B.order});var w=Array.from(d).sort(function(B,V){return B.order-V.order}),I=new Set(o.exitSet),C=rr(w.map(function(B){var V=[];if(B.type!=="final")return V;var H=B.parent;if(!H.parent)return V;V.push(Cd(B.id,B.doneData),Cd(H.id,B.doneData?rp(B.doneData,n,a):void 0));var G=H.parent;return G.type==="parallel"&&Nd(G).every(function(X){return xv(o.configuration,X)})&&V.push(Cd(G.id)),V})),R=w.map(function(B){var V=B.onEntry,H=B.activities.map(function(G){return xC(G)});return{type:"entry",actions:Qa(s?Vt(Vt([],bt(V),!1),bt(H),!1):Vt(Vt([],bt(H),!1),bt(V),!1),m.machine.options.actions)}}).concat({type:"state_done",actions:C.map(function(B){return iw(B)})}),P=Array.from(I).map(function(B){return{type:"exit",actions:Qa(Vt(Vt([],bt(B.onExit),!1),bt(B.activities.map(function(V){return cw(V)})),!1),m.machine.options.actions)}}),z=P.concat({type:"transition",actions:Qa(o.actions,this.machine.options.actions)}).concat(R);if(r){var $=Qa(rr(Vt([],bt(t),!1).sort(function(B,V){return V.order-B.order}).map(function(B){return B.onExit})),this.machine.options.actions).filter(function(B){return!gv(B)});return z.concat({type:"stop",actions:$})}return z},e.prototype.transition=function(t,r,o,n){t===void 0&&(t=this.initialState);var a=Vr(r),i;if(t instanceof en)i=o===void 0?t:this.resolveState(en.from(t,o));else{var s=Et(t)?this.resolve(fv(this.getResolvedPath(t))):this.resolve(t),c=o??this.machine.context;i=this.resolveState(en.from(s,c))}if(!Kt&&a.name===Sv)throw new Error("An event cannot have the wildcard type ('".concat(Sv,"')"));if(this.strict&&!this.events.includes(a.name)&&!qO(a.name))throw new Error("Machine '".concat(this.id,"' does not accept event '").concat(a.name,"'"));var l=this._transition(i.value,i,a)||{transitions:[],configuration:[],exitSet:[],source:i,actions:[]},p=Ad([],this.getStateNodes(i.value)),u=l.configuration.length?Ad(p,l.configuration):p;return l.configuration=Vt([],bt(u),!1),this.resolveTransition(l,i,i.context,n,a)},e.prototype.resolveRaisedTransition=function(t,r,o,n){var a,i=t.actions;return t=this.transition(t,r,void 0,n),t._event=o,t.event=o.data,(a=t.actions).unshift.apply(a,Vt([],bt(i),!1)),t},e.prototype.resolveTransition=function(t,r,o,n,a){var i,s,c,l,p=this;a===void 0&&(a=Si);var u=t.configuration,m=!r||t.transitions.length>0,f=m?t.configuration:r?r.configuration:[],d=xv(f,this),h=m?bP(this.machine,u):void 0,y=r?r.historyValue?r.historyValue:t.source?this.machine.historyValue(r.value):void 0:void 0,g=this.getActions(new Set(f),d,t,o,a,r,n),b=r?ue({},r.activities):{};try{for(var x=dt(g),w=x.next();!w.done;w=x.next()){var I=w.value;try{for(var C=(c=void 0,dt(I.actions)),R=C.next();!R.done;R=C.next()){var P=R.value;P.type===Sd?b[P.activity.id||P.activity.type]=P:P.type===ep&&(b[P.activity.id||P.activity.type]=!1)}}catch(Y){c={error:Y}}finally{try{R&&!R.done&&(l=C.return)&&l.call(C)}finally{if(c)throw c.error}}}}catch(Y){i={error:Y}}finally{try{w&&!w.done&&(s=x.return)&&s.call(x)}finally{if(i)throw i.error}}var z=bt(ap(this,r,o,a,g,n,this.machine.config.predictableActionArguments||this.machine.config.preserveActionOrder),2),$=z[0],B=z[1],V=bt(XO($,gv),2),H=V[0],G=V[1],X=$.filter(function(Y){var le;return Y.type===Sd&&((le=Y.activity)===null||le===void 0?void 0:le.type)===_d}),ee=X.reduce(function(Y,le){return Y[le.activity.id]=hP(le.activity,p.machine,B,a),Y},r?ue({},r.children):{}),Z=new en({value:h||r.value,context:B,_event:a,_sessionid:r?r._sessionid:null,historyValue:h?y?QO(y,h):void 0:r?r.historyValue:void 0,history:!h||t.source?r:void 0,actions:h?G:[],activities:h?b:r?r.activities:{},events:[],configuration:f,transitions:t.transitions,children:ee,done:d,tags:IC(f),machine:this}),te=o!==B;Z.changed=a.name===tp||te;var re=Z.history;re&&delete re.history;var se=!d&&(this._transient||u.some(function(Y){return Y._transient}));if(!m&&(!se||a.name===Od))return Z;var ae=Z;if(!d)for(se&&(ae=this.resolveRaisedTransition(ae,{type:uC},a,n));H.length;){var pe=H.shift();ae=this.resolveRaisedTransition(ae,pe._event,a,n)}var ie=ae.changed||(re?!!ae.actions.length||te||typeof re.value!=typeof ae.value||!TC(ae.value,re.value):void 0);return ae.changed=ie,ae.history=re,ae},e.prototype.getStateNode=function(t){if(Md(t))return this.machine.getStateNodeById(t);if(!this.states)throw new Error("Unable to retrieve child state '".concat(t,"' from '").concat(this.id,"'; no child states exist."));var r=this.states[t];if(!r)throw new Error("Child state '".concat(t,"' does not exist on '").concat(this.id,"'"));return r},e.prototype.getStateNodeById=function(t){var r=Md(t)?t.slice(DC.length):t;if(r===this.id)return this;var o=this.machine.idMap[r];if(!o)throw new Error("Child state node '#".concat(r,"' does not exist on machine '").concat(this.id,"'"));return o},e.prototype.getStateNodeByPath=function(t){if(typeof t=="string"&&Md(t))try{return this.getStateNodeById(t.slice(1))}catch{}for(var r=rw(t,this.delimiter).slice(),o=this;r.length;){var n=r.shift();if(!n.length)break;o=o.getStateNode(n)}return o},e.prototype.resolve=function(t){var r,o=this;if(!t)return this.initialStateValue||Fd;switch(this.type){case"parallel":return Td(this.initialStateValue,function(a,i){return a?o.getStateNode(i).resolve(t[i]||a):Fd});case"compound":if(Et(t)){var n=this.getStateNode(t);return n.type==="parallel"||n.type==="compound"?(r={},r[t]=n.initialStateValue,r):t}return Object.keys(t).length?Td(t,function(a,i){return a?o.getStateNode(i).resolve(a):Fd}):this.initialStateValue||{};default:return t||Fd}},e.prototype.getResolvedPath=function(t){if(Md(t)){var r=this.machine.idMap[t.slice(DC.length)];if(!r)throw new Error("Unable to find state node '".concat(t,"'"));return r.path}return rw(t,this.delimiter)},Object.defineProperty(e.prototype,"initialStateValue",{get:function(){var t;if(this.__cache.initialStateValue)return this.__cache.initialStateValue;var r;if(this.type==="parallel")r=yC(this.states,function(o){return o.initialStateValue||Fd},function(o){return o.type!=="history"});else if(this.initial!==void 0){if(!this.states[this.initial])throw new Error("Initial state '".concat(this.initial,"' not found on '").concat(this.key,"'"));r=bv(this.states[this.initial])?this.initial:(t={},t[this.initial]=this.states[this.initial].initialStateValue,t)}else r={};return this.__cache.initialStateValue=r,this.__cache.initialStateValue},enumerable:!1,configurable:!0}),e.prototype.getInitialState=function(t,r){this._init();var o=this.getStateNodes(t);return this.resolveTransition({configuration:o,exitSet:[],transitions:[],source:void 0,actions:[]},void 0,r??this.machine.context,void 0)},Object.defineProperty(e.prototype,"initialState",{get:function(){var t=this.initialStateValue;if(!t)throw new Error("Cannot retrieve initial state from simple state '".concat(this.id,"'."));return this.getInitialState(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){var t;if(this.type==="history"){var r=this.config;Et(r.target)?t=Md(r.target)?fv(this.machine.getStateNodeById(r.target).path.slice(this.path.length-1)):r.target:t=r.target}return t},enumerable:!1,configurable:!0}),e.prototype.getRelativeStateNodes=function(t,r,o){return o===void 0&&(o=!0),o?t.type==="history"?t.resolveHistory(r):t.initialStateNodes:[t]},Object.defineProperty(e.prototype,"initialStateNodes",{get:function(){var t=this;if(bv(this))return[this];if(this.type==="compound"&&!this.initial)return Kt||zr(!1,"Compound state node '".concat(this.id,"' has no initial state.")),[this];var r=dv(this.initialStateValue);return rr(r.map(function(o){return t.getFromRelativePath(o)}))},enumerable:!1,configurable:!0}),e.prototype.getFromRelativePath=function(t){if(!t.length)return[this];var r=bt(t),o=r[0],n=r.slice(1);if(!this.states)throw new Error("Cannot retrieve subPath '".concat(o,"' from node with no states"));var a=this.getStateNode(o);if(a.type==="history")return a.resolveHistory();if(!this.states[o])throw new Error("Child state '".concat(o,"' does not exist on '").concat(this.id,"'"));return this.states[o].getFromRelativePath(n)},e.prototype.historyValue=function(t){if(Object.keys(this.states).length)return{current:t||this.initialStateValue,states:yC(this.states,function(r,o){if(!t)return r.historyValue();var n=Et(t)?void 0:t[o];return r.historyValue(n||r.initialStateValue)},function(r){return!r.history})}},e.prototype.resolveHistory=function(t){var r=this;if(this.type!=="history")return[this];var o=this.parent;if(!t){var n=this.target;return n?rr(dv(n).map(function(i){return o.getFromRelativePath(i)})):o.initialStateNodes}var a=jO(o.path,"states")(t).current;return Et(a)?[o.getStateNode(a)]:rr(dv(a).map(function(i){return r.history==="deep"?o.getFromRelativePath(i):[o.states[i[0]]]}))},Object.defineProperty(e.prototype,"stateIds",{get:function(){var t=this,r=rr(Object.keys(this.states).map(function(o){return t.states[o].stateIds}));return[this.id].concat(r)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"events",{get:function(){var t,r,o,n;if(this.__cache.events)return this.__cache.events;var a=this.states,i=new Set(this.ownEvents);if(a)try{for(var s=dt(Object.keys(a)),c=s.next();!c.done;c=s.next()){var l=c.value,p=a[l];if(p.states)try{for(var u=(o=void 0,dt(p.events)),m=u.next();!m.done;m=u.next()){var f=m.value;i.add("".concat(f))}}catch(d){o={error:d}}finally{try{m&&!m.done&&(n=u.return)&&n.call(u)}finally{if(o)throw o.error}}}}catch(d){t={error:d}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return this.__cache.events=Array.from(i)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ownEvents",{get:function(){var t=new Set(this.transitions.filter(function(r){return!(!r.target&&!r.actions.length&&r.internal)}).map(function(r){return r.eventType}));return Array.from(t)},enumerable:!1,configurable:!0}),e.prototype.resolveTarget=function(t){var r=this;if(t!==void 0)return t.map(function(o){if(!Et(o))return o;var n=o[0]===r.delimiter;if(n&&!r.parent)return r.getStateNodeByPath(o.slice(1));var a=n?r.key+o:o;if(r.parent)try{var i=r.parent.getStateNodeByPath(a);return i}catch(s){throw new Error("Invalid transition definition for state node '".concat(r.id,`':
16
+ `).concat(s.message))}else return r.getStateNodeByPath(a)})},e.prototype.formatTransition=function(t){var r=this,o=tP(t.target),n="internal"in t?t.internal:o?o.some(function(c){return Et(c)&&c[0]===r.delimiter}):!0,a=this.machine.options.guards,i=this.resolveTarget(o),s=ue(ue({},t),{actions:Qa(Vn(t.actions)),cond:ow(t.cond,a),target:i,source:this,internal:n,eventType:t.event,toJSON:function(){return ue(ue({},s),{target:s.target?s.target.map(function(c){return"#".concat(c.id)}):void 0,source:"#".concat(r.id)})}});return s},e.prototype.formatTransitions=function(){var t,r,o=this,n;if(!this.config.on)n=[];else if(Array.isArray(this.config.on))n=this.config.on;else{var a=this.config.on,i=Sv,s=a[i],c=s===void 0?[]:s,l=wd(a,[typeof i=="symbol"?i:i+""]);n=rr(Object.keys(l).map(function(b){!Kt&&b===Od&&zr(!1,"Empty string transition configs (e.g., `{ on: { '': ... }}`) for transient transitions are deprecated. Specify the transition in the `{ always: ... }` property instead. "+'Please check the `on` configuration for "#'.concat(o.id,'".'));var x=np(b,l[b]);return Kt||Jie(o,b,x),x}).concat(np(Sv,c)))}var p=this.config.always?np("",this.config.always):[],u=this.config.onDone?np(String(Cd(this.id)),this.config.onDone):[];Kt||zr(!(this.config.onDone&&!this.parent),'Root nodes cannot have an ".onDone" transition. Please check the config of "'.concat(this.id,'".'));var m=rr(this.invoke.map(function(b){var x=[];return b.onDone&&x.push.apply(x,Vt([],bt(np(String(kl(b.id)),b.onDone)),!1)),b.onError&&x.push.apply(x,Vt([],bt(np(String(_l(b.id)),b.onError)),!1)),x})),f=this.after,d=rr(Vt(Vt(Vt(Vt([],bt(u),!1),bt(m),!1),bt(n),!1),bt(p),!1).map(function(b){return Vn(b).map(function(x){return o.formatTransition(x)})}));try{for(var h=dt(f),y=h.next();!y.done;y=h.next()){var g=y.value;d.push(g)}}catch(b){t={error:b}}finally{try{y&&!y.done&&(r=h.return)&&r.call(h)}finally{if(t)throw t.error}}return d},e}();var CP=!1;function FC(e,t){return!Kt&&!("predictableActionArguments"in e)&&!CP&&(CP=!0,console.warn("It is highly recommended to set `predictableActionArguments` to `true` when using `createMachine`. https://xstate.js.org/docs/guides/actions.html")),new TP(e,t)}var Xt=wC;var MC=Ie(Me());var NP=Ie(Me()),dw=NP.useLayoutEffect;var AP=Ie(Me());function Pd(e){var t=AP.useRef();return t.current||(t.current={v:e()}),t.current.v}var hw=function(){return hw=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++){t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},hw.apply(this,arguments)},Zie=function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]]);return r},ese=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var o=r.call(e),n,a=[],i;try{for(;(t===void 0||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(s){i={error:s}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a};function tse(e,t){var r=Pd(function(){return typeof e=="function"?e():e});if(0)var o,n;var a=t.context,i=t.guards,s=t.actions,c=t.activities,l=t.services,p=t.delays,u=t.state,m=Zie(t,["context","guards","actions","activities","services","delays","state"]),f=Pd(function(){var d={context:a,guards:i,actions:s,activities:c,services:l,delays:p},h=r.withConfig(d,function(){return hw(hw({},r.context),a)});return fw(h,m)});return dw(function(){Object.assign(f.machine.options.actions,s),Object.assign(f.machine.options.guards,i),Object.assign(f.machine.options.activities,c),Object.assign(f.machine.options.services,l),Object.assign(f.machine.options.delays,p)},[s,i,c,l,p]),f}function OC(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var o=ese(t,2),n=o[0],a=n===void 0?{}:n,i=o[1],s=tse(e,a);return(0,MC.useEffect)(function(){if(i){var c=s.subscribe(gs(i));return function(){c.unsubscribe()}}},[i]),(0,MC.useEffect)(function(){var c=a.state;return s.start(c?en.create(c):void 0),function(){s.stop(),s.status=Sr.NotStarted}},[]),s}function gw(e){return e.status!==0?e.getSnapshot():e.machine.initialState}function kv(e){return"state"in e&&"machine"in e}function RP(e,t,r){if(e.status===Sr.NotStarted)return!0;var o=r.changed===void 0&&(Object.keys(r.children).length>0||typeof t.changed=="boolean");return!(r.changed||o)}var sp=Ie(Me());var DP=Ie(pC());function rse(e){return e}function PC(e){return"state"in e}function ose(e){return"deferred"in e}function nse(e){return"getSnapshot"in e?kv(e)?gw(e):e.getSnapshot():PC(e)?e.state:void 0}function zC(e,t){t===void 0&&(t=nse);var r=(0,sp.useRef)(e),o=(0,sp.useRef)([]),n=(0,sp.useCallback)(function(l){var p=e.subscribe(l).unsubscribe;return p},[e]),a=(0,sp.useCallback)(function(){return t(e)},[e,t]),i=(0,sp.useCallback)(function(l,p){return kv(e)?RP(e,l,p):l===p},[e]),s=(0,DP.useSyncExternalStoreWithSelector)(n,a,a,rse,i),c=Pd(function(){return function(){for(var l=[],p=0;p<arguments.length;p++)l[p]=arguments[p];var u=l[0],m=r.current;ose(m)&&m.deferred?o.current.push(u):m.send(u)}});return dw(function(){for(r.current=e;o.current.length>0;){var l=o.current.shift();e.send(l)}},[e]),[s,c]}var _v=Ie(Me()),FP=Ie(pC());var ase=function(e,t){return e===t},ise=function(e,t){if(kv(e)){if(e.status===0&&t.current)return t.current;var r=gw(e);return t.current=e.status===0?r:null,r}return PC(e)?e.state:void 0};function $C(e,t,r,o){r===void 0&&(r=ase);var n=(0,_v.useRef)(null),a=(0,_v.useCallback)(function(c){var l=e.subscribe(c).unsubscribe;return l},[e]),i=(0,_v.useCallback)(function(){return o?o(e):ise(e,n)},[e,o]),s=(0,FP.useSyncExternalStoreWithSelector)(a,i,i,t,r);return s}var MP="Logging",LC="x-amz-user-agent",OP="NoHubcallbackProvidedException";var wn;(function(e){e.DEBUG="DEBUG",e.ERROR="ERROR",e.INFO="INFO",e.WARN="WARN",e.VERBOSE="VERBOSE",e.NONE="NONE"})(wn||(wn={}));var PP={VERBOSE:1,DEBUG:2,INFO:3,WARN:4,ERROR:5,NONE:6},hr=class e{constructor(t,r=wn.WARN){this.name=t,this.level=r,this._pluggables=[]}_padding(t){return t<10?"0"+t:""+t}_ts(){let t=new Date;return[this._padding(t.getMinutes()),this._padding(t.getSeconds())].join(":")+"."+t.getMilliseconds()}configure(t){return t?(this._config=t,this._config):this._config}_log(t,...r){let o=this.level;e.LOG_LEVEL&&(o=e.LOG_LEVEL),typeof window<"u"&&window.LOG_LEVEL&&(o=window.LOG_LEVEL);let n=PP[o];if(!(PP[t]>=n))return;let i=console.log.bind(console);t===wn.ERROR&&console.error&&(i=console.error.bind(console)),t===wn.WARN&&console.warn&&(i=console.warn.bind(console)),e.BIND_ALL_LOG_LEVELS&&(t===wn.INFO&&console.info&&(i=console.info.bind(console)),t===wn.DEBUG&&console.debug&&(i=console.debug.bind(console)));let s=`[${t}] ${this._ts()} ${this.name}`,c="";if(r.length===1&&typeof r[0]=="string")c=`${s} - ${r[0]}`,i(c);else if(r.length===1)c=`${s} ${r[0]}`,i(s,r[0]);else if(typeof r[0]=="string"){let l=r.slice(1);l.length===1&&(l=l[0]),c=`${s} - ${r[0]} ${l}`,i(`${s} - ${r[0]}`,l)}else c=`${s} ${r}`,i(s,r);for(let l of this._pluggables){let p={message:c,timestamp:Date.now()};l.pushLogs([p])}}log(...t){this._log(wn.INFO,...t)}info(...t){this._log(wn.INFO,...t)}warn(...t){this._log(wn.WARN,...t)}error(...t){this._log(wn.ERROR,...t)}debug(...t){this._log(wn.DEBUG,...t)}verbose(...t){this._log(wn.VERBOSE,...t)}addPluggable(t){t&&t.getCategoryName()===MP&&(this._pluggables.push(t),t.configure(this._config))}listPluggables(){return this._pluggables}};hr.LOG_LEVEL=null;hr.BIND_ALL_LOG_LEVELS=!1;var no=class e extends Error{constructor({message:t,name:r,recoverySuggestion:o,underlyingError:n,metadata:a}){if(super(t),this.name=r,this.underlyingError=n,this.recoverySuggestion=o,a){let{extendedRequestId:i,httpStatusCode:s,requestId:c}=a;this.metadata={extendedRequestId:i,httpStatusCode:s,requestId:c}}this.constructor=e,Object.setPrototypeOf(this,e.prototype)}};var Ja;(function(e){e.NoEndpointId="NoEndpointId",e.PlatformNotSupported="PlatformNotSupported",e.Unknown="Unknown",e.NetworkError="NetworkError"})(Ja||(Ja={}));var vs=(e,t=no)=>(r,o,n)=>{let{message:a,recoverySuggestion:i}=e[o];if(!r)throw new t({name:o,message:n?`${a} ${n}`:a,recoverySuggestion:i})};var Sn=typeof Symbol<"u"?Symbol("amplify_default"):"@@amplify_default",Ev=new hr("Hub"),yw=class{constructor(t){this.listeners=new Map,this.protectedChannels=["core","auth","api","analytics","interactions","pubsub","storage","ui","xr"],this.name=t}_remove(t,r){let o=this.listeners.get(t);if(!o){Ev.warn(`No listeners for ${t}`);return}this.listeners.set(t,[...o.filter(({callback:n})=>n!==r)])}dispatch(t,r,o,n){typeof t=="string"&&this.protectedChannels.indexOf(t)>-1&&(n===Sn||Ev.warn(`WARNING: ${t} is protected and dispatching on it can have unintended consequences`));let a={channel:t,payload:{...r},source:o,patternInfo:[]};try{this._toListeners(a)}catch(i){Ev.error(i)}}listen(t,r,o="noname"){let n;if(typeof r!="function")throw new no({name:OP,message:"No callback supplied to Hub"});n=r;let a=this.listeners.get(t);return a||(a=[],this.listeners.set(t,a)),a.push({name:o,callback:n}),()=>{this._remove(t,n)}}_toListeners(t){let{channel:r,payload:o}=t,n=this.listeners.get(r);n&&n.forEach(a=>{Ev.debug(`Dispatching to ${r} with `,o);try{a.callback(t)}catch(i){Ev.error(i)}})}},jn=new yw("__default__"),sse=new yw("internal-hub");var zP=()=>{if(typeof window<"u"&&typeof window.atob=="function")return window.atob;if(typeof atob=="function")return atob;throw new no({name:"Base64EncoderError",message:"Cannot resolve the `atob` function from the environment."})};var $P={convert(e,t){let r=e;return t?.urlSafe&&(r=r.replace(/-/g,"+").replace(/_/g,"/")),zP()(r)}};var ki;(function(e){e.AuthTokenConfigException="AuthTokenConfigException",e.AuthUserPoolAndIdentityPoolException="AuthUserPoolAndIdentityPoolException",e.AuthUserPoolException="AuthUserPoolException",e.InvalidIdentityPoolIdException="InvalidIdentityPoolIdException",e.OAuthNotConfigureException="OAuthNotConfigureException"})(ki||(ki={}));var lse={[ki.AuthTokenConfigException]:{message:"Auth Token Provider not configured.",recoverySuggestion:"Make sure to call Amplify.configure in your app."},[ki.AuthUserPoolAndIdentityPoolException]:{message:"Auth UserPool or IdentityPool not configured.",recoverySuggestion:"Make sure to call Amplify.configure in your app with UserPoolId and IdentityPoolId."},[ki.AuthUserPoolException]:{message:"Auth UserPool not configured.",recoverySuggestion:"Make sure to call Amplify.configure in your app with userPoolId and userPoolClientId."},[ki.InvalidIdentityPoolIdException]:{message:"Invalid identity pool id provided.",recoverySuggestion:"Make sure a valid identityPoolId is given in the config."},[ki.OAuthNotConfigureException]:{message:"oauth param not configured.",recoverySuggestion:"Make sure to call Amplify.configure with oauth parameter in your app."}},BC=vs(lse);function Ar(e){let t=!0;e?t=!!e.userPoolId&&!!e.userPoolClientId:t=!1,BC(t,ki.AuthUserPoolException)}function UC(e){let t=!!e?.loginWith?.oauth?.domain&&!!e?.loginWith?.oauth?.redirectSignOut&&!!e?.loginWith?.oauth?.redirectSignIn&&!!e?.loginWith?.oauth?.responseType;BC(t,ki.OAuthNotConfigureException)}function tn(e){let t=e.split(".");if(t.length!==3)throw new Error("Invalid token");try{let o=t[1].replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent($P.convert(o).split("").map(i=>`%${`00${i.charCodeAt(0).toString(16)}`.slice(-2)}`).join("")),a=JSON.parse(n);return{toString:()=>e,payload:a}}catch{throw new Error("Invalid token payload")}}var LP=e=>e&&e["nonRetryable"];var vw=new hr("retryUtil");async function BP(e,t,r,o){if(typeof e!="function")throw Error("functionToRetry must be a function");return new Promise(async(n,a)=>{let i=0,s=!1,c,l=()=>{},p;for(o&&o.then(()=>{s=!0,clearTimeout(c),l()});!s;){i++,vw.debug(`${e.name} attempt #${i} with this vars: ${JSON.stringify(t)}`);try{n(await e(...t));return}catch(u){if(p=u,vw.debug(`error on ${e.name}`,u),LP(u)){vw.debug(`${e.name} non retryable error`,u),a(u);return}let m=r(i,t,u);if(vw.debug(`${e.name} retrying in ${m} ms`),m===!1||s){a(u);return}else await new Promise(f=>{l=f,c=setTimeout(l,m)})}}a(p)})}var WC=e=>{let t=Reflect.ownKeys(e);for(let r of t){let o=e[r];(o&&typeof o=="object"||typeof o=="function")&&WC(o)}return Object.freeze(e)};var cse=new hr("parseAWSExports"),pse={API_KEY:"apiKey",AWS_IAM:"iam",AMAZON_COGNITO_USER_POOLS:"userPool",OPENID_CONNECT:"oidc",NONE:"none",AWS_LAMBDA:"lambda",LAMBDA:"lambda"},WP=(e={})=>{if(!Object.prototype.hasOwnProperty.call(e,"aws_project_region"))throw new no({name:"InvalidParameterException",message:"Invalid config parameter.",recoverySuggestion:"Ensure passing the config object imported from `amplifyconfiguration.json`."});let{aws_appsync_apiKey:t,aws_appsync_authenticationType:r,aws_appsync_graphqlEndpoint:o,aws_appsync_region:n,aws_bots_config:a,aws_cognito_identity_pool_id:i,aws_cognito_sign_up_verification_method:s,aws_cognito_mfa_configuration:c,aws_cognito_mfa_types:l,aws_cognito_password_protection_settings:p,aws_cognito_verification_mechanisms:u,aws_cognito_signup_attributes:m,aws_cognito_social_providers:f,aws_cognito_username_attributes:d,aws_mandatory_sign_in:h,aws_mobile_analytics_app_id:y,aws_mobile_analytics_app_region:g,aws_user_files_s3_bucket:b,aws_user_files_s3_bucket_region:x,aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing:w,aws_user_pools_id:I,aws_user_pools_web_client_id:C,geo:R,oauth:P,predictions:z,aws_cloud_logic_custom:$,Notifications:B,modelIntrospection:V}=e,H={};y&&(H.Analytics={Pinpoint:{appId:y,region:g}});let{InAppMessaging:G,Push:X}=B??{};if(G?.AWSPinpoint||X?.AWSPinpoint){if(G?.AWSPinpoint){let{appId:Y,region:le}=G.AWSPinpoint;H.Notifications={InAppMessaging:{Pinpoint:{appId:Y,region:le}}}}if(X?.AWSPinpoint){let{appId:Y,region:le}=X.AWSPinpoint;H.Notifications={...H.Notifications,PushNotification:{Pinpoint:{appId:Y,region:le}}}}}if(Array.isArray(a)&&(H.Interactions={LexV1:Object.fromEntries(a.map(Y=>[Y.name,Y]))}),o){let Y=pse[r];Y||cse.debug(`Invalid authentication type ${r}. Falling back to IAM.`),H.API={GraphQL:{endpoint:o,apiKey:t,region:n,defaultAuthMode:Y??"iam"}},V&&(H.API.GraphQL.modelIntrospection=V)}let ee=c?{status:c&&c.toLowerCase(),totpEnabled:l?.includes("TOTP")??!1,smsEnabled:l?.includes("SMS")??!1}:void 0,Z=p?{minLength:p.passwordPolicyMinLength,requireLowercase:p.passwordPolicyCharacters?.includes("REQUIRES_LOWERCASE")??!1,requireUppercase:p.passwordPolicyCharacters?.includes("REQUIRES_UPPERCASE")??!1,requireNumbers:p.passwordPolicyCharacters?.includes("REQUIRES_NUMBERS")??!1,requireSpecialCharacters:p.passwordPolicyCharacters?.includes("REQUIRES_SYMBOLS")??!1}:void 0,re=Array.from(new Set([...u??[],...m??[]])).reduce((Y,le)=>({...Y,[le.toLowerCase()]:{required:!0}}),{}),se=d?.includes("EMAIL")??!1,ae=d?.includes("PHONE_NUMBER")??!1;(i||I)&&(H.Auth={Cognito:{identityPoolId:i,allowGuestAccess:h!=="enable",signUpVerificationMethod:s,userAttributes:re,userPoolClientId:C,userPoolId:I,mfa:ee,passwordFormat:Z,loginWith:{username:!(se||ae),email:se,phone:ae}}});let pe=P?Object.keys(P).length>0:!1,ie=f?f.length>0:!1;if(H.Auth&&pe&&(H.Auth.Cognito.loginWith={...H.Auth.Cognito.loginWith,oauth:{...use(P),...ie&&{providers:mse(f)}}}),b&&(H.Storage={S3:{bucket:b,region:x,dangerouslyConnectToHttpEndpointForTesting:w}}),R){let{amazon_location_service:Y}=R;H.Geo={LocationService:{maps:Y.maps,geofenceCollections:Y.geofenceCollections,searchIndices:Y.search_indices,region:Y.region}}}if($&&(H.API={...H.API,REST:$.reduce((Y,le)=>{let{name:ge,endpoint:ve,region:Ee,service:Se}=le;return{...Y,[ge]:{endpoint:ve,...Se?{service:Se}:void 0,...Ee?{region:Ee}:void 0}}},{})}),z){let{VoiceId:Y}=z?.convert?.speechGenerator?.defaults??{};H.Predictions=Y?{...z,convert:{...z.convert,speechGenerator:{...z.convert.speechGenerator,defaults:{voiceId:Y}}}}:z}return H},UP=e=>e?.split(",")??[],use=({domain:e,scope:t,redirectSignIn:r,redirectSignOut:o,responseType:n})=>({domain:e,scopes:t,redirectSignIn:UP(r),redirectSignOut:UP(o),responseType:n}),mse=e=>e.map(t=>{let r=t.toLowerCase();return r.charAt(0).toUpperCase()+r.slice(1)});var Iv=Symbol("oauth-listener");var To=[];for(let e=0;e<256;++e)To.push((e+256).toString(16).slice(1));function HP(e,t=0){return(To[e[t+0]]+To[e[t+1]]+To[e[t+2]]+To[e[t+3]]+"-"+To[e[t+4]]+To[e[t+5]]+"-"+To[e[t+6]]+To[e[t+7]]+"-"+To[e[t+8]]+To[e[t+9]]+"-"+To[e[t+10]]+To[e[t+11]]+To[e[t+12]]+To[e[t+13]]+To[e[t+14]]+To[e[t+15]]).toLowerCase()}var HC,fse=new Uint8Array(16);function VC(){if(!HC){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");HC=crypto.getRandomValues.bind(crypto)}return HC(fse)}var dse=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),jC={randomUUID:dse};function hse(e,t,r){if(jC.randomUUID&&!t&&!e)return jC.randomUUID();e=e||{};let o=e.random??e.rng?.()??VC();if(o.length<16)throw new Error("Random bytes length must be >= 16");if(o[6]=o[6]&15|64,o[8]=o[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let n=0;n<16;++n)t[r+n]=o[n];return t}return HP(o)}var zd=hse;function jP(e){let{version:t}=e;return t?t.startsWith("1"):!1}function gse(e){if(!e)return;let{bucket_name:t,aws_region:r,buckets:o}=e;return{S3:{bucket:t,region:r,buckets:o&&Ise(o)}}}function yse(e){if(!e)return;let{user_pool_id:t,user_pool_client_id:r,identity_pool_id:o,password_policy:n,mfa_configuration:a,mfa_methods:i,unauthenticated_identities_enabled:s,oauth:c,username_attributes:l,standard_required_attributes:p,groups:u,passwordless:m}=e,f={Cognito:{userPoolId:t,userPoolClientId:r,groups:u}};return o&&(f.Cognito={...f.Cognito,identityPoolId:o}),n&&(f.Cognito.passwordFormat={requireLowercase:n.require_lowercase,requireNumbers:n.require_numbers,requireUppercase:n.require_uppercase,requireSpecialCharacters:n.require_symbols,minLength:n.min_length??6}),a&&(f.Cognito.mfa={status:Ese(a),smsEnabled:i?.includes("SMS"),totpEnabled:i?.includes("TOTP")}),s&&(f.Cognito.allowGuestAccess=s),c&&(f.Cognito.loginWith={oauth:{domain:c.domain,redirectSignIn:c.redirect_sign_in_uri,redirectSignOut:c.redirect_sign_out_uri,responseType:c.response_type==="token"?"token":"code",scopes:c.scopes,providers:_se(c.identity_providers)}}),l&&(f.Cognito.loginWith={...f.Cognito.loginWith,email:l.includes("email"),phone:l.includes("phone_number"),username:l.includes("username")}),p&&(f.Cognito.userAttributes=p.reduce((d,h)=>({...d,[h]:{required:!0}}),{})),m&&(f.Cognito.passwordless={emailOtpEnabled:m.email_otp_enabled,smsOtpEnabled:m.sms_otp_enabled,webAuthn:m.web_authn?{relyingPartyId:m.web_authn.relying_party_id,userVerification:m.web_authn.user_verification}:void 0,preferredChallenge:m.preferred_challenge}),f}function vse(e){if(!e?.amazon_pinpoint)return;let{amazon_pinpoint:t}=e;return{Pinpoint:{appId:t.app_id,region:t.aws_region}}}function bse(e){if(!e)return;let{aws_region:t,geofence_collections:r,maps:o,search_indices:n}=e;return{LocationService:{region:t,searchIndices:n,geofenceCollections:r,maps:o}}}function xse(e){if(!e)return;let{aws_region:t,default_authorization_type:r,url:o,api_key:n,model_introspection:a}=e;return{GraphQL:{endpoint:o,defaultAuthMode:qP(r),region:t,apiKey:n,modelIntrospection:a}}}function wse(e){if(!e?.events)return;let{url:t,aws_region:r,api_key:o,default_authorization_type:n}=e.events;return{Events:{endpoint:t,defaultAuthMode:qP(n),region:r,apiKey:o}}}function Sse(e){if(!e)return;let{aws_region:t,channels:r,amazon_pinpoint_app_id:o}=e,n=r.includes("IN_APP_MESSAGING"),a=r.includes("APNS")||r.includes("FCM");if(!(n||a))return;let i={};return n&&(i.InAppMessaging={Pinpoint:{appId:o,region:t}}),a&&(i.PushNotification={Pinpoint:{appId:o,region:t}}),i}function GP(e){let t={};if(e.storage&&(t.Storage=gse(e.storage)),e.auth&&(t.Auth=yse(e.auth)),e.analytics&&(t.Analytics=vse(e.analytics)),e.geo&&(t.Geo=bse(e.geo)),e.data&&(t.API=xse(e.data)),e.custom){let r=wse(e.custom);r&&"Events"in r&&(t.API={...t.API,...r})}return e.notifications&&(t.Notifications=Sse(e.notifications)),t}var kse={AMAZON_COGNITO_USER_POOLS:"userPool",API_KEY:"apiKey",AWS_IAM:"iam",AWS_LAMBDA:"lambda",OPENID_CONNECT:"oidc"};function qP(e){return kse[e]}var VP={GOOGLE:"Google",LOGIN_WITH_AMAZON:"Amazon",FACEBOOK:"Facebook",SIGN_IN_WITH_APPLE:"Apple"};function _se(e=[]){return e.reduce((t,r)=>(VP[r]!==void 0&&t.push(VP[r]),t),[])}function Ese(e){return e==="OPTIONAL"?"optional":e==="REQUIRED"?"on":"off"}function Ise(e){let t={};return e.forEach(({name:r,bucket_name:o,aws_region:n,paths:a})=>{if(r in t)throw new Error(`Duplicate friendly name found: ${r}. Name must be unique.`);let i=a?Object.entries(a).reduce((s,[c,l])=>(l!==void 0&&(s[c]=l),s),{}):void 0;t[r]={bucketName:o,region:n,paths:i}}),t}var KP=e=>Object.keys(e).some(t=>t.startsWith("aws_"))?WP(e):jP(e)?GP(e):e;function bw(e,t,r,o){function n(a){return a instanceof r?a:new r(function(i){i(a)})}return new(r||(r=Promise))(function(a,i){function s(p){try{l(o.next(p))}catch(u){i(u)}}function c(p){try{l(o.throw(p))}catch(u){i(u)}}function l(p){p.done?a(p.value):n(p.value).then(s,c)}l((o=o.apply(e,t||[])).next())})}function xw(e,t){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},o,n,a,i=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return i.next=s(0),i.throw=s(1),i.return=s(2),typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function s(l){return function(p){return c([l,p])}}function c(l){if(o)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(r=0)),r;)try{if(o=1,n&&(a=l[0]&2?n.return:l[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,l[1])).done)return a;switch(n=0,a&&(l=[l[0]&2,a.value]),l[0]){case 0:case 1:a=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,n=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!a||l[1]>a[0]&&l[1]<a[3])){r.label=l[1];break}if(l[0]===6&&r.label<a[1]){r.label=a[1],a=l;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(l);break}a[2]&&r.ops.pop(),r.trys.pop();continue}l=t.call(e,r)}catch(p){l=[6,p],n=0}finally{o=a=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function XP(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],o=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function xe(e,t,r,o){if(r==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?o:r==="a"?o.call(e):o?o.value:t.get(e)}function er(e,t,r,o,n){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?n.call(e,r):n?n.value=r:t.set(e,r),r}var kn=64,YP=32,QP=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),JP=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],ZP=Math.pow(2,53)-1;var Tv=function(){function e(){this.state=Int32Array.from(JP),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return e.prototype.update=function(t){if(this.finished)throw new Error("Attempted to update an already finished hash.");var r=0,o=t.byteLength;if(this.bytesHashed+=o,this.bytesHashed*8>ZP)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;o>0;)this.buffer[this.bufferLength++]=t[r++],o--,this.bufferLength===kn&&(this.hashBuffer(),this.bufferLength=0)},e.prototype.digest=function(){if(!this.finished){var t=this.bytesHashed*8,r=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),o=this.bufferLength;if(r.setUint8(this.bufferLength++,128),o%kn>=kn-8){for(var n=this.bufferLength;n<kn;n++)r.setUint8(n,0);this.hashBuffer(),this.bufferLength=0}for(var n=this.bufferLength;n<kn-8;n++)r.setUint8(n,0);r.setUint32(kn-8,Math.floor(t/4294967296),!0),r.setUint32(kn-4,t),this.hashBuffer(),this.finished=!0}for(var a=new Uint8Array(YP),n=0;n<8;n++)a[n*4]=this.state[n]>>>24&255,a[n*4+1]=this.state[n]>>>16&255,a[n*4+2]=this.state[n]>>>8&255,a[n*4+3]=this.state[n]>>>0&255;return a},e.prototype.hashBuffer=function(){for(var t=this,r=t.buffer,o=t.state,n=o[0],a=o[1],i=o[2],s=o[3],c=o[4],l=o[5],p=o[6],u=o[7],m=0;m<kn;m++){if(m<16)this.temp[m]=(r[m*4]&255)<<24|(r[m*4+1]&255)<<16|(r[m*4+2]&255)<<8|r[m*4+3]&255;else{var f=this.temp[m-2],d=(f>>>17|f<<15)^(f>>>19|f<<13)^f>>>10;f=this.temp[m-15];var h=(f>>>7|f<<25)^(f>>>18|f<<14)^f>>>3;this.temp[m]=(d+this.temp[m-7]|0)+(h+this.temp[m-16]|0)}var y=(((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))+(c&l^~c&p)|0)+(u+(QP[m]+this.temp[m]|0)|0)|0,g=((n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10))+(n&a^n&i^a&i)|0;u=p,p=l,l=c,c=s+y|0,s=i,i=a,a=n,n=y+g|0}o[0]+=n,o[1]+=a,o[2]+=i,o[3]+=s,o[4]+=c,o[5]+=l,o[6]+=p,o[7]+=u},e}();var GC=e=>new TextEncoder().encode(e);var Tse=typeof Buffer<"u"&&Buffer.from?function(e){return Buffer.from(e,"utf8")}:GC;function Za(e){return e instanceof Uint8Array?e:typeof e=="string"?Tse(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}function Il(e){return typeof e=="string"?e.length===0:e.byteLength===0}function qC(e){return new Uint8Array([(e&4278190080)>>24,(e&16711680)>>16,(e&65280)>>8,e&255])}function KC(e){if(!Uint32Array.from){for(var t=new Uint32Array(e.length),r=0;r<e.length;)t[r]=e[r],r+=1;return t}return Uint32Array.from(e)}var ez=function(){function e(t){this.secret=t,this.hash=new Tv,this.reset()}return e.prototype.update=function(t){if(!(Il(t)||this.error))try{this.hash.update(Za(t))}catch(r){this.error=r}},e.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},e.prototype.digest=function(){return bw(this,void 0,void 0,function(){return xw(this,function(t){return[2,this.digestSync()]})})},e.prototype.reset=function(){if(this.hash=new Tv,this.secret){this.outer=new Tv;var t=Cse(this.secret),r=new Uint8Array(kn);r.set(t);for(var o=0;o<kn;o++)t[o]^=54,r[o]^=92;this.hash.update(t),this.outer.update(r);for(var o=0;o<t.byteLength;o++)t[o]=0}},e}();function Cse(e){var t=Za(e);if(t.byteLength>kn){var r=new Tv;r.update(t),t=r.digest()}var o=new Uint8Array(kn);return o.set(t),o}var Nse={},Ase={};for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();t.length===1&&(t=`0${t}`),Nse[e]=t,Ase[t]=e}var lr;(function(e){e.WebUnknown="0",e.React="1",e.NextJs="2",e.Angular="3",e.VueJs="4",e.Nuxt="5",e.Svelte="6",e.ServerSideUnknown="100",e.ReactSSR="101",e.NextJsSSR="102",e.AngularSSR="103",e.VueJsSSR="104",e.NuxtSSR="105",e.SvelteSSR="106",e.ReactNative="201",e.Expo="202"})(lr||(lr={}));var Cv;(function(e){e.AI="ai",e.API="api",e.Auth="auth",e.Analytics="analytics",e.DataStore="datastore",e.Geo="geo",e.InAppMessaging="inappmessaging",e.Interactions="interactions",e.Predictions="predictions",e.PubSub="pubsub",e.PushNotification="pushnotification",e.Storage="storage"})(Cv||(Cv={}));var XC;(function(e){e.CreateConversation="1",e.GetConversation="2",e.ListConversations="3",e.DeleteConversation="4",e.SendMessage="5",e.ListMessages="6",e.OnMessage="7",e.Generation="8",e.UpdateConversation="9"})(XC||(XC={}));var YC;(function(e){e.Record="1",e.IdentifyUser="2"})(YC||(YC={}));var QC;(function(e){e.GraphQl="1",e.Get="2",e.Post="3",e.Put="4",e.Patch="5",e.Del="6",e.Head="7"})(QC||(QC={}));var Nv;(function(e){e.SignUp="1",e.ConfirmSignUp="2",e.ResendSignUpCode="3",e.SignIn="4",e.FetchMFAPreference="6",e.UpdateMFAPreference="7",e.SetUpTOTP="10",e.VerifyTOTPSetup="11",e.ConfirmSignIn="12",e.DeleteUserAttributes="15",e.DeleteUser="16",e.UpdateUserAttributes="17",e.FetchUserAttributes="18",e.ConfirmUserAttribute="22",e.SignOut="26",e.UpdatePassword="27",e.ResetPassword="28",e.ConfirmResetPassword="29",e.FederatedSignIn="30",e.RememberDevice="32",e.ForgetDevice="33",e.FetchDevices="34",e.SendUserAttributeVerificationCode="35",e.SignInWithRedirect="36",e.StartWebAuthnRegistration="37",e.CompleteWebAuthnRegistration="38",e.ListWebAuthnCredentials="39",e.DeleteWebAuthnCredential="40"})(Nv||(Nv={}));var JC;(function(e){e.Subscribe="1",e.GraphQl="2"})(JC||(JC={}));var ZC;(function(e){e.SearchByText="0",e.SearchByCoordinates="1",e.SearchForSuggestions="2",e.SearchByPlaceId="3",e.SaveGeofences="4",e.GetGeofence="5",e.ListGeofences="6",e.DeleteGeofences="7"})(ZC||(ZC={}));var eN;(function(e){e.SyncMessages="1",e.IdentifyUser="2",e.NotifyMessageInteraction="3"})(eN||(eN={}));var tN;(function(e){e.None="0"})(tN||(tN={}));var rN;(function(e){e.Convert="1",e.Identify="2",e.Interpret="3"})(rN||(rN={}));var oN;(function(e){e.Subscribe="1"})(oN||(oN={}));var nN;(function(e){e.InitializePushNotifications="1",e.IdentifyUser="2"})(nN||(nN={}));var aN;(function(e){e.UploadData="1",e.DownloadData="2",e.List="3",e.Copy="4",e.Remove="5",e.GetProperties="6",e.GetUrl="7",e.GetDataAccess="8",e.ListCallerAccessGrants="9"})(aN||(aN={}));var iN="6.17.0";var Tl=()=>typeof global<"u";var ha=()=>typeof window<"u",ww=()=>typeof document<"u",$d=()=>typeof process<"u",Cl=(e,t)=>!!Object.keys(e).find(r=>r.startsWith(t));function tz(){let e=o=>o.startsWith("_react")||o.startsWith("__react"),t=o=>Object.keys(o).find(e),r=()=>Array.from(document.querySelectorAll("[id]"));return ww()&&r().some(t)}function rz(){return $d()&&typeof process.env<"u"&&!!Object.keys(process.env).find(e=>e.includes("react"))}function oz(){return ha()&&Cl(window,"__VUE")}function nz(){return Tl()&&Cl(global,"__VUE")}function az(){return ha()&&Cl(window,"__SVELTE")}function iz(){return $d()&&typeof process.env<"u"&&!!Object.keys(process.env).find(e=>e.includes("svelte"))}function sz(){return ha()&&window.next&&typeof window.next=="object"}function lz(){return Tl()&&(Cl(global,"__next")||Cl(global,"__NEXT"))}function cz(){return ha()&&(window.__NUXT__!==void 0||window.$nuxt!==void 0)}function pz(){return Tl()&&typeof global.__NUXT_PATHS__<"u"}function uz(){let e=!!(ww()&&document.querySelector("[ng-version]")),t=!!(ha()&&typeof window.ng<"u");return e||t}function mz(){return $d()&&typeof process.env=="object"&&process.env.npm_lifecycle_script?.startsWith("ng ")||!1}function fz(){return typeof navigator<"u"&&typeof navigator.product<"u"&&navigator.product==="ReactNative"}function dz(){return Tl()&&typeof global.expo<"u"}function hz(){return ha()}var Rse=[{platform:lr.Expo,detectionMethod:dz},{platform:lr.ReactNative,detectionMethod:fz},{platform:lr.NextJs,detectionMethod:sz},{platform:lr.Nuxt,detectionMethod:cz},{platform:lr.Angular,detectionMethod:uz},{platform:lr.React,detectionMethod:tz},{platform:lr.VueJs,detectionMethod:oz},{platform:lr.Svelte,detectionMethod:az},{platform:lr.WebUnknown,detectionMethod:hz},{platform:lr.NextJsSSR,detectionMethod:lz},{platform:lr.NuxtSSR,detectionMethod:pz},{platform:lr.ReactSSR,detectionMethod:rz},{platform:lr.VueJsSSR,detectionMethod:nz},{platform:lr.AngularSSR,detectionMethod:mz},{platform:lr.SvelteSSR,detectionMethod:iz}];function gz(){return Rse.find(e=>e.detectionMethod())?.platform||lr.ServerSideUnknown}var Av,Sw=[],kw=!1,Dse=10,Fse=10,Mse=1e3,_w=()=>{if(!Av){if(Av=gz(),kw)for(;Sw.length;)Sw.pop()?.();else Sw.forEach(e=>{e()});yz(lr.ServerSideUnknown,Dse),yz(lr.WebUnknown,Fse)}return Av},vz=e=>{kw||Sw.push(e)};function Ose(){Av=void 0}function yz(e,t){Av===e&&!kw&&setTimeout(()=>{Ose(),kw=!0,setTimeout(_w,Mse)},t)}var Pse={};var bz=(e,t)=>Pse[e]?.[t]?.additionalDetails;var xz="aws-amplify",wz=e=>e.replace(/\+.*/,""),sN=class{constructor(){this.userAgent=`${xz}/${wz(iN)}`}get framework(){return _w()}get isReactNative(){return this.framework===lr.ReactNative||this.framework===lr.Expo}observeFrameworkChanges(t){vz(t)}},zse=new sN,Sz=({category:e,action:t}={})=>{let r=[[xz,wz(iN)]];if(e&&r.push([e,t]),r.push(["framework",_w()]),e&&t){let o=bz(e,t);o&&o.forEach(n=>{r.push(n)})}return r},lp=e=>Sz(e).map(([o,n])=>o&&n?`${o}/${n}`:o).join(" ");var Rv=()=>typeof window<"u"&&typeof window.document<"u";var kz=new hr("Auth"),Ew=class{configure(t,r){this.authConfig=t,this.authOptions=r,t&&t.Cognito?.userPoolEndpoint&&kz.warn(_z("Amazon Cognito User Pool")),t&&t.Cognito?.identityPoolEndpoint&&kz.warn(_z("Amazon Cognito Identity Pool"))}async fetchAuthSession(t={}){let r,o,n=await this.getTokens(t);return n?(o=n.accessToken?.payload?.sub,r=await this.authOptions?.credentialsProvider?.getCredentialsAndIdentityId({authConfig:this.authConfig,tokens:n,authenticated:!0,forceRefresh:t.forceRefresh})):r=await this.authOptions?.credentialsProvider?.getCredentialsAndIdentityId({authConfig:this.authConfig,authenticated:!1,forceRefresh:t.forceRefresh}),{tokens:n,credentials:r?.credentials,identityId:r?.identityId,userSub:o}}async clearCredentials(){await this.authOptions?.credentialsProvider?.clearCredentialsAndIdentityId()}async getTokens(t){return await this.authOptions?.tokenProvider?.getTokens(t)??void 0}},_z=e=>`You are using a custom Amazon ${e} endpoint, ensure the endpoint is correct.`;var Iw=class{constructor(){this.oAuthListener=void 0,this.isConfigured=!1,this.resourcesConfig={},this.libraryOptions={},this.Auth=new Ew}configure(t,r){let o=KP(t);this.resourcesConfig=o,r&&(this.libraryOptions=r),this.resourcesConfig=WC(this.resourcesConfig),this.Auth.configure(this.resourcesConfig.Auth,this.libraryOptions.Auth),(this.resourcesConfig.Analytics?.Pinpoint||this.resourcesConfig.Notifications?.InAppMessaging?.Pinpoint||this.resourcesConfig.Notifications?.PushNotification?.Pinpoint)&&console.warn("AWS will end support for Amazon Pinpoint on October 30, 2026. The guidance is to use AWS End User Messaging for push notifications and SMS, Amazon Simple Email Service for sending emails, Amazon Connect for campaigns, journeys, endpoints, and engagement analytics. Pinpoint recommends Amazon Kinesis for event collection and mobile analytics."),jn.dispatch("core",{event:"configure",data:this.resourcesConfig},"Configure",Sn),this.notifyOAuthListener(),this.isConfigured=!0}getConfig(){return this.isConfigured||console.warn("Amplify has not been configured. Please call Amplify.configure() before using this service."),this.resourcesConfig}[Iv](t){this.resourcesConfig.Auth?.Cognito.loginWith?.oauth?t(this.resourcesConfig.Auth?.Cognito):this.oAuthListener=t}notifyOAuthListener(){!this.resourcesConfig.Auth?.Cognito.loginWith?.oauth||!this.oAuthListener||(this.oAuthListener(this.resourcesConfig.Auth?.Cognito),this.oAuthListener=void 0)}},bs=new Iw;var Ez=(e,t)=>e.Auth.fetchAuthSession(t);var Tw=e=>Ez(bs,e);var lN=e=>{let{headers:t,statusCode:r}=e;return{...$se(e)?e.$metadata:{},httpStatusCode:r,requestId:t["x-amzn-requestid"]??t["x-amzn-request-id"]??t["x-amz-request-id"],extendedRequestId:t["x-amz-id-2"],cfId:t["x-amz-cf-id"]}},$se=e=>typeof e?.$metadata=="object";var Dv=async e=>{if(!e||e.statusCode<300)return;let t=await Cw(e),o=(i=>{let[s]=i.toString().split(/[,:]+/);return s.includes("#")?s.split("#")[1]:s})(e.headers["x-amzn-errortype"]??t.code??t.__type??"UnknownError"),n=t.message??t.Message??"Unknown error",a=new Error(n);return Object.assign(a,{name:o,$metadata:lN(e)})},Cw=async e=>{if(!e.body)throw new Error("Missing response payload");let t=await e.body.json();return Object.assign(t,{$metadata:lN(e)})};var cN=(e,t,r,o)=>async(n,a)=>{let i={...o,...n},s=await i.endpointResolver(i,a),c=await t(a,s),l=await e(c,{...i});return r(l)};function Nw(e=3e5){return o=>{let n=2**o*100+100*Math.random();return n>e?!1:n}}var pN="amz-sdk-invocation-id",Iz="amz-sdk-request";var uN=e=>{let r=Nw(3e5)(e);return r===!1?3e5:r};var Use=["AuthFailure","InvalidSignatureException","RequestExpired","RequestInTheFuture","RequestTimeTooSkewed","SignatureDoesNotMatch","BadRequestException"],Tz=e=>!!e&&Use.includes(e);var mN=e=>async(t,r)=>{let o=r??await e(t)??void 0,n=o?.code||o?.name,a=t?.statusCode;return{retryable:jse(r)||Vse(a,n)||Tz(n)||Gse(a,n)}},Wse=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException"],Hse=["TimeoutError","RequestTimeout","RequestTimeoutException"],Vse=(e,t)=>e===429||!!t&&Wse.includes(t),jse=e=>[Ja.NetworkError,"ERR_NETWORK"].includes(e?.name),Gse=(e,t)=>!!e&&[500,502,503,504].includes(e)||!!t&&Hse.includes(t);var Az=({maxAttempts:e=3,retryDecider:t,computeDelay:r,abortSignal:o})=>{if(e<1)throw new Error("maxAttempts must be greater than 0");return(n,a)=>async function(s){let c,l=a.attemptsCount??0,p,u=()=>{if(p)return Cz(p,l),p;throw Cz(c,l),c};for(;!o?.aborted&&l<e;){try{p=await n(s),c=void 0}catch(d){c=d,p=void 0}l=(a.attemptsCount??0)>l?a.attemptsCount??0:l+1,a.attemptsCount=l;let{isCredentialsExpiredError:m,retryable:f}=await t(p,c,a);if(f){if(a.isCredentialsExpired=!!m,!o?.aborted&&l<e){let d=r(l);await qse(d,o)}continue}else return u()}if(o?.aborted)throw new Error("Request aborted.");return u()}},qse=(e,t)=>{if(t?.aborted)return Promise.resolve();let r,o,n=new Promise(a=>{o=a,r=setTimeout(a,e)});return t?.addEventListener("abort",function a(i){clearTimeout(r),t?.removeEventListener("abort",a),o()}),n},Cz=(e,t)=>{Object.prototype.toString.call(e)==="[object Object]"&&(e.$metadata={...e.$metadata??{},attempts:t})};var Rz=zd;var Dz=()=>e=>async function(r){return r.headers[pN]||(r.headers[pN]=Rz()),e(r)};var Fz=({maxAttempts:e=3})=>(t,r)=>async function(n){let a=r.attemptsCount??0;return n.headers[Iz]=`attempt=${a+1}; max=${e}`,t(n)};var Mz=({userAgentHeader:e="x-amz-user-agent",userAgentValue:t=""})=>r=>async function(n){if(t.trim().length===0)return await r(n);{let a=e.toLowerCase();return n.headers[a]=n.headers[a]?`${n.headers[a]} ${t}`:t,await r(n)}};var Fv=(e,t)=>(r,o)=>{let n={},a=i=>e(i,o);for(let i=t.length-1;i>=0;i--){let s=t[i];a=s(o)(a,n)}return a(r)};var Aw=e=>{let t;return()=>(t||(t=e()),t)};var Kse=e=>!["HEAD","GET"].includes(e.toUpperCase()),Oz=async({url:e,method:t,headers:r,body:o},{abortSignal:n,cache:a,withCrossDomainCredentials:i})=>{let s;try{s=await fetch(e,{method:t,headers:r,body:Kse(t)?o:void 0,signal:n,cache:a,credentials:i?"include":"same-origin"})}catch(u){throw u instanceof TypeError?new no({name:Ja.NetworkError,message:"A network error has occurred.",underlyingError:u}):u}let c={};s.headers?.forEach((u,m)=>{c[m.toLowerCase()]=u});let l={statusCode:s.status,headers:c,body:null},p=Object.assign(s.body??{},{text:Aw(()=>s.text()),blob:Aw(()=>s.blob()),json:Aw(()=>s.json())});return{...l,body:p}};var fN=Fv(Oz,[Mz,Dz,Az,Fz]);var dN={id:"aws",outputs:{dnsSuffix:"amazonaws.com"},regionRegex:"^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$",regions:["aws-global"]},Pz={partitions:[dN,{id:"aws-cn",outputs:{dnsSuffix:"amazonaws.com.cn"},regionRegex:"^cn\\-\\w+\\-\\d+$",regions:["aws-cn-global"]}]};var hN=e=>{let{partitions:t}=Pz;for(let{regions:r,outputs:o,regionRegex:n}of t){let a=new RegExp(n);if(r.includes(e)||a.test(e))return o.dnsSuffix}return dN.outputs.dnsSuffix};var xs=URL;var ws=class extends no{constructor(){super({name:Ja.PlatformNotSupported,message:"Function not supported on current platform"})}};var _i=class{constructor(t){this.storage=t}async setItem(t,r){if(!this.storage)throw new ws;this.storage.setItem(t,r)}async getItem(t){if(!this.storage)throw new ws;return this.storage.getItem(t)}async removeItem(t){if(!this.storage)throw new ws;this.storage.removeItem(t)}async clear(){if(!this.storage)throw new ws;this.storage.clear()}};var cp=class{constructor(){this.storage=new Map}get length(){return this.storage.size}key(t){return t>this.length-1?null:Array.from(this.storage.keys())[t]}setItem(t,r){this.storage.set(t,r)}getItem(t){return this.storage.get(t)??null}removeItem(t){this.storage.delete(t)}clear(){this.storage.clear()}};var zz=new hr("CoreStorageUtils"),Rw=()=>{try{if(typeof window<"u"&&window.localStorage)return window.localStorage}catch{zz.info("localStorage not found. InMemoryStorage is used as a fallback.")}return new cp},Dw=()=>{try{if(typeof window<"u"&&window.sessionStorage)return window.sessionStorage.getItem("test"),window.sessionStorage;throw new Error("sessionStorage is not defined")}catch{return zz.info("sessionStorage not found. InMemoryStorage is used as a fallback."),new cp}};var Fw=class extends _i{constructor(){super(Rw())}};var Mw=class extends _i{constructor(){super(Dw())}};var Ow=class{constructor(t){this._storage=t}get storage(){if(!this._storage)throw new ws;return this._storage}setItem(t,r){this.storage.setItem(t,r)}getItem(t){return this.storage.getItem(t)}removeItem(t){this.storage.removeItem(t)}clear(){this.storage.clear()}};var Pw=class extends Ow{constructor(){super(Dw())}};var Mv=new Fw,Xse=new Mw,Yse=new Pw,Qse=new _i(new cp);var Nl={keyPrefix:"aws-amplify-cache",capacityInBytes:1048576,itemMaxSize:21e4,defaultTTL:2592e5,defaultPriority:5,warningThreshold:.8},Ss="CurSize";function gN(e){let t=0;t=e.length;for(let r=e.length;r>=0;r-=1){let o=e.charCodeAt(r);o>127&&o<=2047?t+=1:o>2047&&o<=65535&&(t+=2),o>=56320&&o<=57343&&(r-=1)}return t}function Al(){return new Date().getTime()}var pp=e=>`${e}${Ss}`;var Rl;(function(e){e.NoCacheItem="NoCacheItem",e.NullNextNode="NullNextNode",e.NullPreviousNode="NullPreviousNode"})(Rl||(Rl={}));var Jse={[Rl.NoCacheItem]:{message:"Item not found in the cache storage."},[Rl.NullNextNode]:{message:"Next node is null."},[Rl.NullPreviousNode]:{message:"Previous node is null."}},yN=vs(Jse);var $r=new hr("StorageCache"),zw=class{constructor({config:t,keyValueStorage:r}){this.config={...Nl,...t},this.keyValueStorage=r,this.sanitizeConfig()}getModuleName(){return"Cache"}configure(t){return t&&(t.keyPrefix&&$r.warn("keyPrefix can not be re-configured on an existing Cache instance."),this.config={...this.config,...t}),this.sanitizeConfig(),this.config}async getCurrentCacheSize(){let t=await this.getStorage().getItem(pp(this.config.keyPrefix));return t||(await this.getStorage().setItem(pp(this.config.keyPrefix),"0"),t="0"),Number(t)}async setItem(t,r,o){if($r.debug(`Set item: key is ${t}, value is ${r} with options: ${o}`),!t||t===Ss){$r.warn(`Invalid key: should not be empty or reserved key: '${Ss}'`);return}if(typeof r>"u"){$r.warn("The value of item should not be undefined!");return}let n={priority:o?.priority!==void 0?o.priority:this.config.defaultPriority,expires:o?.expires!==void 0?o.expires:this.config.defaultTTL+Al()};if(n.priority<1||n.priority>5){$r.warn("Invalid parameter: priority due to out or range. It should be within 1 and 5.");return}let a=`${this.config.keyPrefix}${t}`,i=this.fillCacheItem(a,r,n);if(i.byteSize>this.config.itemMaxSize){$r.warn(`Item with key: ${t} you are trying to put into is too big!`);return}try{let s=await this.getStorage().getItem(a);if(s&&await this.removeCacheItem(a,JSON.parse(s).byteSize),await this.isCacheFull(i.byteSize)){let c=await this.clearInvalidAndGetRemainingKeys();if(await this.isCacheFull(i.byteSize)){let l=await this.sizeToPop(i.byteSize);await this.popOutItems(c,l)}}return this.setCacheItem(a,i)}catch(s){$r.warn(`setItem failed! ${s}`)}}async getItem(t,r){$r.debug(`Get item: key is ${t} with options ${r}`);let o;if(!t||t===Ss)return $r.warn(`Invalid key: should not be empty or reserved key: '${Ss}'`),null;let n=`${this.config.keyPrefix}${t}`;try{if(o=await this.getStorage().getItem(n),o!=null)if(await this.isExpired(n))await this.removeCacheItem(n,JSON.parse(o).byteSize);else return(await this.updateVisitedTime(JSON.parse(o),n)).data;if(r?.callback){let a=r.callback();return a!==null&&await this.setItem(t,a,r),a}return null}catch(a){return $r.warn(`getItem failed! ${a}`),null}}async removeItem(t){if($r.debug(`Remove item: key is ${t}`),!t||t===Ss){$r.warn(`Invalid key: should not be empty or reserved key: '${Ss}'`);return}let r=`${this.config.keyPrefix}${t}`;try{let o=await this.getStorage().getItem(r);o&&await this.removeCacheItem(r,JSON.parse(o).byteSize)}catch(o){$r.warn(`removeItem failed! ${o}`)}}async getAllKeys(){try{return await this.getAllCacheKeys()}catch(t){return $r.warn(`getAllkeys failed! ${t}`),[]}}getStorage(){return this.keyValueStorage}async isExpired(t){let r=await this.getStorage().getItem(t);yN(r!==null,Rl.NoCacheItem,`Key: ${t}`);let o=JSON.parse(r);return Al()>=o.expires}async removeCacheItem(t,r){let o=await this.getStorage().getItem(t);yN(o!==null,Rl.NoCacheItem,`Key: ${t}`);let n=r??JSON.parse(o).byteSize;await this.decreaseCurrentSizeInBytes(n);try{await this.getStorage().removeItem(t)}catch(a){await this.increaseCurrentSizeInBytes(n),$r.error(`Failed to remove item: ${a}`)}}fillCacheItem(t,r,o){let n={key:t,data:r,timestamp:Al(),visitedTime:Al(),priority:o.priority??0,expires:o.expires??0,type:typeof r,byteSize:0};return n.byteSize=gN(JSON.stringify(n)),n.byteSize=gN(JSON.stringify(n)),n}sanitizeConfig(){this.config.itemMaxSize>this.config.capacityInBytes&&($r.error("Invalid parameter: itemMaxSize. It should be smaller than capacityInBytes. Setting back to default."),this.config.itemMaxSize=Nl.itemMaxSize),(this.config.defaultPriority>5||this.config.defaultPriority<1)&&($r.error("Invalid parameter: defaultPriority. It should be between 1 and 5. Setting back to default."),this.config.defaultPriority=Nl.defaultPriority),(Number(this.config.warningThreshold)>1||Number(this.config.warningThreshold)<0)&&($r.error("Invalid parameter: warningThreshold. It should be between 0 and 1. Setting back to default."),this.config.warningThreshold=Nl.warningThreshold);let t=5*1024*1024;this.config.capacityInBytes>t&&($r.error("Cache Capacity should be less than 5MB. Setting back to default. Setting back to default."),this.config.capacityInBytes=Nl.capacityInBytes)}async increaseCurrentSizeInBytes(t){let r=await this.getCurrentCacheSize();await this.getStorage().setItem(pp(this.config.keyPrefix),(r+t).toString())}async decreaseCurrentSizeInBytes(t){let r=await this.getCurrentCacheSize();await this.getStorage().setItem(pp(this.config.keyPrefix),(r-t).toString())}async updateVisitedTime(t,r){return t.visitedTime=Al(),await this.getStorage().setItem(r,JSON.stringify(t)),t}async setCacheItem(t,r){await this.increaseCurrentSizeInBytes(r.byteSize);try{await this.getStorage().setItem(t,JSON.stringify(r))}catch(o){await this.decreaseCurrentSizeInBytes(r.byteSize),$r.error(`Failed to set item ${o}`)}}async sizeToPop(t){let o=await this.getCurrentCacheSize()+t-this.config.capacityInBytes,n=(1-this.config.warningThreshold)*this.config.capacityInBytes;return o>n?o:n}async isCacheFull(t){let r=await this.getCurrentCacheSize();return t+r>this.config.capacityInBytes}async popOutItems(t,r){let o=[],n=r;for(let a of t){let i=await this.getStorage().getItem(a);if(i!=null){let s=JSON.parse(i);o.push(s)}}o.sort((a,i)=>a.priority>i.priority?-1:a.priority<i.priority?1:a.visitedTime<i.visitedTime?-1:1);for(let a of o)if(await this.removeCacheItem(a.key,a.byteSize),n-=a.byteSize,n<=0)return}async clearInvalidAndGetRemainingKeys(){let t=[],r=await this.getAllCacheKeys({omitSizeKey:!0});for(let o of r)await this.isExpired(o)?await this.removeCacheItem(o):t.push(o);return t}async clear(){$r.debug("Clear Cache");try{let t=await this.getAllKeys();for(let r of t){let o=`${this.config.keyPrefix}${r}`;await this.getStorage().removeItem(o)}}catch(t){$r.warn(`clear failed! ${t}`)}}};var Zse=new hr("StorageCache"),$w=class e extends zw{constructor(t){let r=Rw();super({config:t,keyValueStorage:new _i(r)}),this.storage=r,this.getItem=this.getItem.bind(this),this.setItem=this.setItem.bind(this),this.removeItem=this.removeItem.bind(this)}async getAllCacheKeys(t){let{omitSizeKey:r}=t??{},o=[];for(let n=0;n<this.storage.length;n++){let a=this.storage.key(n);r&&a===pp(this.config.keyPrefix)||a?.startsWith(this.config.keyPrefix)&&o.push(a.substring(this.config.keyPrefix.length))}return o}createInstance(t){return(!t.keyPrefix||t.keyPrefix===Nl.keyPrefix)&&(Zse.error("invalid keyPrefix, setting keyPrefix with timeStamp"),t.keyPrefix=Al.toString()),new e(t)}};var ele=new $w;var tle=new hr("I18n"),$z=class{constructor(){this._options=null,this._lang=null,this._dict={}}setDefaultLanguage(){!this._lang&&typeof window<"u"&&window&&window.navigator&&(this._lang=window.navigator.language),tle.debug(this._lang)}setLanguage(t){this._lang=t}get(t,r=void 0){if(this.setDefaultLanguage(),!this._lang)return typeof r<"u"?r:t;let o=this._lang,n=this.getByLanguage(t,o);return n||(o.indexOf("-")>0&&(n=this.getByLanguage(t,o.split("-")[0])),n)?n:typeof r<"u"?r:t}getByLanguage(t,r,o=null){if(!r)return o;let n=this._dict[r];return n?n[t]:o}putVocabulariesForLanguage(t,r){let o=this._dict[t];o||(o=this._dict[t]={}),this._dict[t]={...o,...r}}putVocabularies(t){Object.keys(t).forEach(r=>{this.putVocabulariesForLanguage(r,t[r])})}};var Dl;(function(e){e.NotConfigured="NotConfigured"})(Dl||(Dl={}));var rle={[Dl.NotConfigured]:{message:"i18n is not configured."}},Ov=vs(rle);var Lz=new hr("I18n"),Lw={language:null},ei=null,Bw=class e{static configure(t){return Lz.debug("configure I18n"),t&&(Lw=Object.assign({},Lw,t.I18n||t),e.createInstance()),Lw}static getModuleName(){return"I18n"}static createInstance(){Lz.debug("create I18n instance"),!ei&&(ei=new $z)}static setLanguage(t){e.checkConfig(),Ov(!!ei,Dl.NotConfigured),ei.setLanguage(t)}static get(t,r){return e.checkConfig()?(Ov(!!ei,Dl.NotConfigured),ei.get(t,r)):typeof r>"u"?t:r}static putVocabulariesForLanguage(t,r){e.checkConfig(),Ov(!!ei,Dl.NotConfigured),ei.putVocabulariesForLanguage(t,r)}static putVocabularies(t){e.checkConfig(),Ov(!!ei,Dl.NotConfigured),ei.putVocabularies(t)}static checkConfig(){return ei||e.createInstance(),!0}};Bw.createInstance();var vN=(e,t,r=3e5,o)=>BP(e,t,Nw(r),o);function bN(e){return(e.match(/.{2}/g)||[]).map(r=>String.fromCharCode(parseInt(r,16))).join("")}var xN=e=>{let t;return async(...r)=>t||(t=new Promise((o,n)=>{e(...r).then(a=>{o(a)}).catch(a=>{n(a)}).finally(()=>{t=void 0})}),t)};function Uw({expiresAt:e,clockDrift:t,tolerance:r=5e3}){return Date.now()+t+r>e}var jr;(function(e){e.EmptySignInUsername="EmptySignInUsername",e.EmptySignInPassword="EmptySignInPassword",e.CustomAuthSignInPassword="CustomAuthSignInPassword",e.EmptySignUpUsername="EmptySignUpUsername",e.EmptySignUpPassword="EmptySignUpPassword",e.EmptyConfirmSignUpUsername="EmptyConfirmSignUpUsername",e.EmptyConfirmSignUpCode="EmptyConfirmSignUpCode",e.EmptyResendSignUpCodeUsername="EmptyresendSignUpCodeUsername",e.EmptyChallengeResponse="EmptyChallengeResponse",e.EmptyConfirmResetPasswordUsername="EmptyConfirmResetPasswordUsername",e.EmptyConfirmResetPasswordNewPassword="EmptyConfirmResetPasswordNewPassword",e.EmptyConfirmResetPasswordConfirmationCode="EmptyConfirmResetPasswordConfirmationCode",e.EmptyResetPasswordUsername="EmptyResetPasswordUsername",e.EmptyVerifyTOTPSetupCode="EmptyVerifyTOTPSetupCode",e.EmptyConfirmUserAttributeCode="EmptyConfirmUserAttributeCode",e.IncorrectMFAMethod="IncorrectMFAMethod",e.EmptyUpdatePassword="EmptyUpdatePassword",e.InvalidPreferredChallenge="InvalidPreferredChallenge"})(jr||(jr={}));var AFe={[jr.EmptyChallengeResponse]:{message:"challengeResponse is required to confirmSignIn"},[jr.EmptyConfirmResetPasswordUsername]:{message:"username is required to confirmResetPassword"},[jr.EmptyConfirmSignUpCode]:{message:"code is required to confirmSignUp"},[jr.EmptyConfirmSignUpUsername]:{message:"username is required to confirmSignUp"},[jr.EmptyConfirmResetPasswordConfirmationCode]:{message:"confirmationCode is required to confirmResetPassword"},[jr.EmptyConfirmResetPasswordNewPassword]:{message:"newPassword is required to confirmResetPassword"},[jr.EmptyResendSignUpCodeUsername]:{message:"username is required to confirmSignUp"},[jr.EmptyResetPasswordUsername]:{message:"username is required to resetPassword"},[jr.EmptySignInPassword]:{message:"password is required to signIn"},[jr.EmptySignInUsername]:{message:"username is required to signIn"},[jr.EmptySignUpPassword]:{message:"password is required to signUp"},[jr.EmptySignUpUsername]:{message:"username is required to signUp"},[jr.CustomAuthSignInPassword]:{message:"A password is not needed when signing in with CUSTOM_WITHOUT_SRP",recoverySuggestion:"Do not include a password in your signIn call."},[jr.IncorrectMFAMethod]:{message:"Incorrect MFA method was chosen. It should be either SMS, TOTP, or EMAIL",recoverySuggestion:"Try to pass SMS, TOTP, or EMAIL as the challengeResponse"},[jr.EmptyVerifyTOTPSetupCode]:{message:"code is required to verifyTotpSetup"},[jr.EmptyUpdatePassword]:{message:"oldPassword and newPassword are required to changePassword"},[jr.EmptyConfirmUserAttributeCode]:{message:"confirmation code is required to confirmUserAttribute"},[jr.InvalidPreferredChallenge]:{message:"The preferred challenge is not enabled in your backend configuration",recoverySuggestion:"Ensure the authentication method is enabled in your Amplify backend configuration"}},ao;(function(e){e.DEFAULT_MSG="Authentication Error",e.EMPTY_EMAIL="Email cannot be empty",e.EMPTY_PHONE="Phone number cannot be empty",e.EMPTY_USERNAME="Username cannot be empty",e.INVALID_USERNAME="The username should either be a string or one of the sign in types",e.EMPTY_PASSWORD="Password cannot be empty",e.EMPTY_CODE="Confirmation code cannot be empty",e.SIGN_UP_ERROR="Error creating account",e.NO_MFA="No valid MFA method provided",e.INVALID_MFA="Invalid MFA type",e.EMPTY_CHALLENGE="Challenge response cannot be empty",e.NO_USER_SESSION="Failed to get the session because the user is empty",e.NETWORK_ERROR="Network Error",e.DEVICE_CONFIG="Device tracking has not been configured in this User Pool",e.AUTOSIGNIN_ERROR="Please use your credentials to sign in",e.OAUTH_ERROR="Couldn't finish OAuth flow, check your User Pool HostedUI settings"})(ao||(ao={}));var Ww;(function(e){e.SignInException="SignInException",e.OAuthSignInError="OAuthSignInException"})(Ww||(Ww={}));var jt=class e extends no{constructor(t){super(t),this.constructor=e,Object.setPrototypeOf(this,e.prototype)}};function Bz(e){let t=e?.split("_")[0];if(!e||e.indexOf("_")<0||!t||typeof t!="string")throw new jt({name:"InvalidUserPoolId",message:"Invalid user pool id provided."});return t}var Pv="UserUnAuthenticatedException";var ole="InvalidRedirectException",nle="InvalidAppSchemeException",ale="InvalidPreferredRedirectUrlException",Uz=new jt({name:ole,message:"signInRedirect or signOutRedirect had an invalid format or was not found.",recoverySuggestion:"Please make sure the signIn/Out redirect in your oauth config is valid."}),zFe=new jt({name:nle,message:"A valid non-http app scheme was not found in the config.",recoverySuggestion:"Please make sure a valid custom app scheme is present in the config."}),Wz=new jt({name:ale,message:"The given preferredRedirectUrl does not match any items in the redirectSignOutUrls array from the config.",recoverySuggestion:"Please make sure a matching preferredRedirectUrl is provided."}),ile="InvalidOriginException",Hz=new jt({name:ile,message:"redirect is coming from a different origin. The oauth flow needs to be initiated from the same origin",recoverySuggestion:"Please call signInWithRedirect from the same origin."});var Vz="TokenRefreshException",jz="UnexpectedSignInInterruptionException";function Gz(e){if(!e||!e.accessToken)throw new jt({name:Pv,message:"User needs to be authenticated to call this API.",recoverySuggestion:"Sign in before calling this API again."})}var sle=new jt({name:Vz,message:`Token refresh is not supported when authenticated with the 'implicit grant' (token) oauth flow.
17
+ Please change your oauth configuration to use 'code grant' flow.`,recoverySuggestion:`Please logout and change your Amplify configuration to use "code grant" flow.
18
+ E.g { responseType: 'code' }`}),lle=new jt({name:Pv,message:"User needs to be authenticated to call this API.",recoverySuggestion:"Sign in before calling this API again."});function qz(e){if(ple(e))throw sle;if(!cle(e))throw lle}var Kz={inflightOAuth:"inflightOAuth",oauthSignIn:"oauthSignIn",oauthPKCE:"oauthPKCE",oauthState:"oauthState"};function Xz(e){return e?.accessToken||e?.idToken}function cle(e){return Xz(e)&&e?.refreshToken}function ple(e){return Xz(e)&&!e?.refreshToken}var Yz=async e=>{let t=e.getConfig().Auth?.Cognito;Ar(t);let r=await e.Auth.getTokens({forceRefresh:!1});Gz(r);let{"cognito:username":o,sub:n}=r.idToken?.payload??{},a={username:o,userId:n},i=ule(r);return i&&(a.signInDetails=i),a};function ule(e){return e?.signInDetails}var Qz=async()=>Yz(bs);var Jz=(e,t)=>lp({category:Cv.Auth,action:e,...t});var Zz=e=>(t,r)=>{let o=mle(e),n=JSON.stringify(t);return fle(r,o,n)},mle=e=>({"content-type":"application/x-amz-json-1.1","x-amz-target":`AWSCognitoIdentityProviderService.${e}`}),fle=({url:e},t,r)=>({headers:t,url:e,body:r,method:"POST"});function Hw(e){if(!e||e.name==="Error"||e instanceof TypeError)throw new jt({name:Ja.Unknown,message:"An unknown error has occurred.",underlyingError:e})}var e6=()=>async e=>{if(e.statusCode>=300){let t=await Dv(e);throw Hw(t),new jt({name:t.name,message:t.message,metadata:t.$metadata})}return Cw(e)};var dle=()=>(e,t)=>async function(o){return o.headers={...o.headers,"cache-control":"no-store",...await bs.libraryOptions?.Auth?.headers?.()},e(o)},t6=Fv(fN,[dle]);var Vw="cognito-idp";var r6={service:Vw,retryDecider:mN(Dv),computeDelay:uN,get userAgentValue(){return lp()},cache:"no-store"};var o6=({region:e})=>({url:new xs(`https://${Vw}.${e}.${hN(e)}`)});var n6=({endpointOverride:e})=>t=>e?{url:new xs(e)}:o6(t);var a6=e=>cN(t6,Zz("GetTokensFromRefreshToken"),e6(),{...r6,...e});var hle=async({tokens:e,authConfig:t,username:r,clientMetadata:o})=>{Ar(t?.Cognito);let{userPoolId:n,userPoolClientId:a,userPoolEndpoint:i}=t.Cognito,s=Bz(n);qz(e);let c=a6({endpointResolver:n6({endpointOverride:i})}),{AuthenticationResult:l}=await c({region:s},{ClientId:a,RefreshToken:e.refreshToken,DeviceKey:e.deviceMetadata?.deviceKey,ClientMetadata:o}),p=tn(l?.AccessToken??""),u=l?.IdToken?tn(l.IdToken):void 0,{iat:m}=p.payload;if(!m)throw new jt({name:"iatNotFoundException",message:"iat not found in access token"});let f=m*1e3-new Date().getTime();return{accessToken:p,idToken:u,clockDrift:f,refreshToken:l?.RefreshToken??e.refreshToken,username:r}},i6=xN(hle);var s6={accessToken:"accessToken",idToken:"idToken",oidcProvider:"oidcProvider",clockDrift:"clockDrift",refreshToken:"refreshToken",deviceKey:"deviceKey",randomPasswordKey:"randomPasswordKey",deviceGroupKey:"deviceGroupKey",signInDetails:"signInDetails",oauthMetadata:"oauthMetadata"};var zv;(function(e){e.InvalidAuthTokens="InvalidAuthTokens"})(zv||(zv={}));var gle={[zv.InvalidAuthTokens]:{message:"Invalid tokens.",recoverySuggestion:"Make sure the tokens are valid."}},l6=vs(gle);var wN="CognitoIdentityServiceProvider";var jw=class{getKeyValueStorage(){if(!this.keyValueStorage)throw new jt({name:"KeyValueStorageNotFoundException",message:"KeyValueStorage was not found in TokenStore"});return this.keyValueStorage}setKeyValueStorage(t){this.keyValueStorage=t}setAuthConfig(t){this.authConfig=t}async loadTokens(){try{let t=await this.getAuthKeys(),r=await this.getKeyValueStorage().getItem(t.accessToken);if(!r)throw new jt({name:"NoSessionFoundException",message:"Auth session was not found. Make sure to call signIn."});let o=tn(r),n=await this.getKeyValueStorage().getItem(t.idToken),a=n?tn(n):void 0,i=await this.getKeyValueStorage().getItem(t.refreshToken)??void 0,s=await this.getKeyValueStorage().getItem(t.clockDrift)??"0",c=Number.parseInt(s),l=await this.getKeyValueStorage().getItem(t.signInDetails),p={accessToken:o,idToken:a,refreshToken:i,deviceMetadata:await this.getDeviceMetadata()??void 0,clockDrift:c,username:await this.getLastAuthUser()};return l&&(p.signInDetails=JSON.parse(l)),p}catch{return null}}async storeTokens(t){l6(t!==void 0,zv.InvalidAuthTokens);let r=t.username;await this.getKeyValueStorage().setItem(this.getLastAuthUserKey(),r);let o=await this.getAuthKeys();await this.getKeyValueStorage().setItem(o.accessToken,t.accessToken.toString()),t.idToken?await this.getKeyValueStorage().setItem(o.idToken,t.idToken.toString()):await this.getKeyValueStorage().removeItem(o.idToken),t.refreshToken?await this.getKeyValueStorage().setItem(o.refreshToken,t.refreshToken):await this.getKeyValueStorage().removeItem(o.refreshToken),t.deviceMetadata&&(t.deviceMetadata.deviceKey&&await this.getKeyValueStorage().setItem(o.deviceKey,t.deviceMetadata.deviceKey),t.deviceMetadata.deviceGroupKey&&await this.getKeyValueStorage().setItem(o.deviceGroupKey,t.deviceMetadata.deviceGroupKey),await this.getKeyValueStorage().setItem(o.randomPasswordKey,t.deviceMetadata.randomPassword)),t.signInDetails?await this.getKeyValueStorage().setItem(o.signInDetails,JSON.stringify(t.signInDetails)):await this.getKeyValueStorage().removeItem(o.signInDetails),await this.getKeyValueStorage().setItem(o.clockDrift,`${t.clockDrift}`)}async clearTokens(){let t=await this.getAuthKeys();await Promise.all([this.getKeyValueStorage().removeItem(t.accessToken),this.getKeyValueStorage().removeItem(t.idToken),this.getKeyValueStorage().removeItem(t.clockDrift),this.getKeyValueStorage().removeItem(t.refreshToken),this.getKeyValueStorage().removeItem(t.signInDetails),this.getKeyValueStorage().removeItem(this.getLastAuthUserKey()),this.getKeyValueStorage().removeItem(t.oauthMetadata)])}async getDeviceMetadata(t){let r=await this.getAuthKeys(t),o=await this.getKeyValueStorage().getItem(r.deviceKey),n=await this.getKeyValueStorage().getItem(r.deviceGroupKey),a=await this.getKeyValueStorage().getItem(r.randomPasswordKey);return a&&n&&o?{deviceKey:o,deviceGroupKey:n,randomPassword:a}:null}async clearDeviceMetadata(t){let r=await this.getAuthKeys(t);await Promise.all([this.getKeyValueStorage().removeItem(r.deviceKey),this.getKeyValueStorage().removeItem(r.deviceGroupKey),this.getKeyValueStorage().removeItem(r.randomPasswordKey)])}async getAuthKeys(t){Ar(this.authConfig?.Cognito);let r=t??await this.getLastAuthUser();return yle(wN,`${this.authConfig.Cognito.userPoolClientId}.${r}`)}getLastAuthUserKey(){Ar(this.authConfig?.Cognito);let t=this.authConfig.Cognito.userPoolClientId;return`${wN}.${t}.LastAuthUser`}async getLastAuthUser(){return await this.getKeyValueStorage().getItem(this.getLastAuthUserKey())??"username"}async setOAuthMetadata(t){let{oauthMetadata:r}=await this.getAuthKeys();await this.getKeyValueStorage().setItem(r,JSON.stringify(t))}async getOAuthMetadata(){let{oauthMetadata:t}=await this.getAuthKeys(),r=await this.getKeyValueStorage().getItem(t);return r&&JSON.parse(r)}},yle=(e,t)=>SN(s6)(`${e}`,t);function SN(e){let t=Object.values({...e});return(r,o)=>t.reduce((n,a)=>({...n,[a]:`${r}.${o}.${a}`}),{})}var c6="amplify-signin-with-hostedUI",Ei="CognitoIdentityServiceProvider",Gw=class{constructor(t){this.keyValueStorage=t}async clearOAuthInflightData(){Ar(this.cognitoConfig);let t=Ii(Ei,this.cognitoConfig.userPoolClientId);await Promise.all([this.keyValueStorage.removeItem(t.inflightOAuth),this.keyValueStorage.removeItem(t.oauthPKCE),this.keyValueStorage.removeItem(t.oauthState)])}async clearOAuthData(){Ar(this.cognitoConfig);let t=Ii(Ei,this.cognitoConfig.userPoolClientId);return await this.clearOAuthInflightData(),await this.keyValueStorage.removeItem(c6),this.keyValueStorage.removeItem(t.oauthSignIn)}loadOAuthState(){Ar(this.cognitoConfig);let t=Ii(Ei,this.cognitoConfig.userPoolClientId);return this.keyValueStorage.getItem(t.oauthState)}storeOAuthState(t){Ar(this.cognitoConfig);let r=Ii(Ei,this.cognitoConfig.userPoolClientId);return this.keyValueStorage.setItem(r.oauthState,t)}loadPKCE(){Ar(this.cognitoConfig);let t=Ii(Ei,this.cognitoConfig.userPoolClientId);return this.keyValueStorage.getItem(t.oauthPKCE)}storePKCE(t){Ar(this.cognitoConfig);let r=Ii(Ei,this.cognitoConfig.userPoolClientId);return this.keyValueStorage.setItem(r.oauthPKCE,t)}setAuthConfig(t){this.cognitoConfig=t}async loadOAuthInFlight(){Ar(this.cognitoConfig);let t=Ii(Ei,this.cognitoConfig.userPoolClientId);return await this.keyValueStorage.getItem(t.inflightOAuth)==="true"}async storeOAuthInFlight(t){Ar(this.cognitoConfig);let r=Ii(Ei,this.cognitoConfig.userPoolClientId);await this.keyValueStorage.setItem(r.inflightOAuth,`${t}`)}async loadOAuthSignIn(){Ar(this.cognitoConfig);let t=Ii(Ei,this.cognitoConfig.userPoolClientId),r=await this.keyValueStorage.getItem(c6),[o,n]=(await this.keyValueStorage.getItem(t.oauthSignIn))?.split(",")??[];return{isOAuthSignIn:o==="true"||r==="true",preferPrivateSession:n==="true"}}async storeOAuthSignIn(t,r=!1){Ar(this.cognitoConfig);let o=Ii(Ei,this.cognitoConfig.userPoolClientId);await this.keyValueStorage.setItem(o.oauthSignIn,`${t},${r}`)}},Ii=(e,t)=>SN(Kz)(e,t);var _n=new Gw(Mv);var kN=[],p6=e=>{kN.push(e)},qw=()=>{for(;kN.length;)kN.pop()?.()};var Kw=class{constructor(){this.waitForInflightOAuth=Rv()?async()=>{if(await _n.loadOAuthInFlight())return this.inflightPromise?this.inflightPromise:(this.inflightPromise=new Promise((t,r)=>{p6(t)}),this.inflightPromise)}:async()=>{}}setAuthConfig(t){_n.setAuthConfig(t.Cognito),this.authConfig=t}setTokenRefresher(t){this.tokenRefresher=t}setAuthTokenStore(t){this.tokenStore=t}getTokenStore(){if(!this.tokenStore)throw new jt({name:"EmptyTokenStoreException",message:"TokenStore not set"});return this.tokenStore}getTokenRefresher(){if(!this.tokenRefresher)throw new jt({name:"EmptyTokenRefresherException",message:"TokenRefresher not set"});return this.tokenRefresher}setClientMetadataProvider(t){this.clientMetadataProvider=t}async getTokens(t){let r;try{Ar(this.authConfig?.Cognito)}catch{return null}await this.waitForInflightOAuth(),this.inflightPromise=void 0,r=await this.getTokenStore().loadTokens();let o=await this.getTokenStore().getLastAuthUser();if(r===null)return null;let n=!!r?.idToken&&Uw({expiresAt:(r.idToken?.payload?.exp??0)*1e3,clockDrift:r.clockDrift??0}),a=Uw({expiresAt:(r.accessToken?.payload?.exp??0)*1e3,clockDrift:r.clockDrift??0});return(t?.forceRefresh||n||a)&&(r=await this.refreshTokens({tokens:r,username:o,clientMetadata:t?.clientMetadata??await this.clientMetadataProvider?.()}),r===null)?null:{accessToken:r?.accessToken,idToken:r?.idToken,signInDetails:r?.signInDetails}}async refreshTokens({tokens:t,username:r,clientMetadata:o}){try{let{signInDetails:n}=t,a=await this.getTokenRefresher()({tokens:t,authConfig:this.authConfig,username:r,clientMetadata:o});return a.signInDetails=n,await this.setTokens({tokens:a}),jn.dispatch("auth",{event:"tokenRefresh"},"Auth",Sn),a}catch(n){return this.handleErrors(n)}}handleErrors(t){if(Hw(t),this.isAuthenticationError(t)&&this.clearTokens(),jn.dispatch("auth",{event:"tokenRefresh_failure",data:{error:t}},"Auth",Sn),t.name.startsWith("NotAuthorizedException"))return null;throw t}isAuthenticationError(t){return["NotAuthorizedException","TokenRevokedException","UserNotFoundException","PasswordResetRequiredException","UserNotConfirmedException","RefreshTokenReuseException"].some(o=>t?.name?.startsWith?.(o))}async setTokens({tokens:t}){return this.getTokenStore().storeTokens(t)}async clearTokens(){return this.getTokenStore().clearTokens()}getDeviceMetadata(t){return this.getTokenStore().getDeviceMetadata(t)}clearDeviceMetadata(t){return this.getTokenStore().clearDeviceMetadata(t)}setOAuthMetadata(t){return this.getTokenStore().setOAuthMetadata(t)}getOAuthMetadata(){return this.getTokenStore().getOAuthMetadata()}};var Xw=class{constructor(){this.authTokenStore=new jw,this.authTokenStore.setKeyValueStorage(Mv),this.tokenOrchestrator=new Kw,this.tokenOrchestrator.setAuthTokenStore(this.authTokenStore),this.tokenOrchestrator.setTokenRefresher(i6)}getTokens(t={}){return this.tokenOrchestrator.getTokens(t)}setKeyValueStorage(t){this.authTokenStore.setKeyValueStorage(t)}setClientMetadataProvider(t){this.tokenOrchestrator.setClientMetadataProvider(t)}setAuthConfig(t){this.authTokenStore.setAuthConfig(t),this.tokenOrchestrator.setAuthConfig(t)}};var vle=new Xw,{tokenOrchestrator:Yw}=vle;async function _N(e){if(e.AccessToken){let t=tn(e.AccessToken),r=(t.payload.iat||0)*1e3,o=new Date().getTime(),n=r>0?r-o:0,a,i,s;e.RefreshToken&&(i=e.RefreshToken),e.IdToken&&(a=tn(e.IdToken)),e?.NewDeviceMetadata&&(s=e.NewDeviceMetadata);let c={accessToken:t,idToken:a,refreshToken:i,clockDrift:n,deviceMetadata:s,username:e.username};e?.signInDetails&&(c.signInDetails=e.signInDetails),await Yw.setTokens({tokens:c})}else throw new no({message:"Invalid tokens",name:"InvalidTokens",recoverySuggestion:"Check Cognito UserPool settings"})}var ble="Unable to get user session following successful sign-in.",u6=async()=>{try{jn.dispatch("auth",{event:"signedIn",data:await Qz()},"Auth",Sn)}catch(e){throw e.name===Pv?new jt({name:jz,message:ble,recoverySuggestion:"This most likely is due to auth tokens not being persisted. If you are using cookie store, please ensure cookies can be correctly set from your server."}):e}};var DOe=new hr("AuthError");var m6={oauthSignInError:{message:ao.OAUTH_ERROR,log:"Make sure Cognito Hosted UI has been configured correctly"},noConfig:{message:ao.DEFAULT_MSG,log:`
19
+ Error: Amplify has not been configured correctly.
20
+ This error is typically caused by one of the following scenarios:
21
+
22
+ 1. Make sure you're passing the awsconfig object to Amplify.configure() in your app's entry point
23
+ See https://aws-amplify.github.io/docs/js/authentication#configure-your-app for more information
24
+
25
+ 2. There might be multiple conflicting versions of amplify packages in your node_modules.
26
+ Refer to our docs site for help upgrading Amplify packages (https://docs.amplify.aws/lib/troubleshooting/upgrading/q/platform/js)
27
+ `},missingAuthConfig:{message:ao.DEFAULT_MSG,log:`
28
+ Error: Amplify has not been configured correctly.
29
+ The configuration object is missing required auth properties.
30
+ This error is typically caused by one of the following scenarios:
31
+
32
+ 1. Did you run \`amplify push\` after adding auth via \`amplify add auth\`?
33
+ See https://aws-amplify.github.io/docs/js/authentication#amplify-project-setup for more information
34
+
35
+ 2. This could also be caused by multiple conflicting versions of amplify packages, see (https://docs.amplify.aws/lib/troubleshooting/upgrading/q/platform/js) for help upgrading Amplify packages.
36
+ `},emptyUsername:{message:ao.EMPTY_USERNAME},invalidUsername:{message:ao.INVALID_USERNAME},emptyPassword:{message:ao.EMPTY_PASSWORD},emptyCode:{message:ao.EMPTY_CODE},signUpError:{message:ao.SIGN_UP_ERROR,log:"The first parameter should either be non-null string or object"},noMFA:{message:ao.NO_MFA},invalidMFA:{message:ao.INVALID_MFA},emptyChallengeResponse:{message:ao.EMPTY_CHALLENGE},noUserSession:{message:ao.NO_USER_SESSION},deviceConfig:{message:ao.DEVICE_CONFIG},networkError:{message:ao.NETWORK_ERROR},autoSignInError:{message:ao.AUTOSIGNIN_ERROR},default:{message:ao.DEFAULT_MSG}};var Ld=(e,t)=>new jt({message:e??"An error has occurred during the oauth process.",name:Ww.OAuthSignInError,recoverySuggestion:t??m6.oauthSignInError.log});var Qw;(function(e){e.NoConfig="noConfig",e.MissingAuthConfig="missingAuthConfig",e.EmptyUsername="emptyUsername",e.InvalidUsername="invalidUsername",e.EmptyPassword="emptyPassword",e.EmptyCode="emptyCode",e.SignUpError="signUpError",e.NoMFA="noMFA",e.InvalidMFA="invalidMFA",e.EmptyChallengeResponse="emptyChallengeResponse",e.NoUserSession="noUserSession",e.Default="default",e.DeviceConfig="deviceConfig",e.NetworkError="networkError",e.AutoSignInError="autoSignInError",e.OAuthSignInError="oauthSignInError"})(Qw||(Qw={}));var xle="`signInWithRedirect` has been canceled.",wle="An error occurred while validating the state.",Sle="Try to initiate an OAuth flow from Amplify",EN=async e=>{let t=await _n.loadOAuthState(),r=e===t?t:void 0;if(!r)throw new jt({name:Qw.OAuthSignInError,message:e===null?xle:wle,recoverySuggestion:e===null?void 0:Sle});return r};var f6=async({currentUrl:e,userAgentValue:t,clientId:r,redirectUri:o,responseType:n,domain:a,preferPrivateSession:i})=>{let s=new xs(e),c=s.searchParams.get("error"),l=s.searchParams.get("error_description");if(c)throw Ld(l??c);return n==="code"?kle({currentUrl:e,userAgentValue:t,clientId:r,redirectUri:o,domain:a,preferPrivateSession:i}):_le({currentUrl:e,redirectUri:o,preferPrivateSession:i})},kle=async({currentUrl:e,userAgentValue:t,clientId:r,redirectUri:o,domain:n,preferPrivateSession:a})=>{let i=new xs(e),s=i.searchParams.get("code"),c=i.searchParams.get("state");if(!s||!c)throw Ld("User cancelled OAuth flow.");let l=await EN(c),p="https://"+n+"/oauth2/token",u=await _n.loadPKCE(),m={grant_type:"authorization_code",code:s,client_id:r,redirect_uri:o,...u?{code_verifier:u}:{}},f=Object.entries(m).map(([C,R])=>`${encodeURIComponent(C)}=${encodeURIComponent(R)}`).join("&"),{access_token:d,refresh_token:h,id_token:y,error:g,error_message:b,token_type:x,expires_in:w}=await(await fetch(p,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",[LC]:t},body:f})).json();if(g)throw Ld(b??g);let I=(d&&tn(d).payload.username)??"username";return await _N({username:I,AccessToken:d,IdToken:y,RefreshToken:h}),d6({redirectUri:o,state:l,preferPrivateSession:a})},_le=async({currentUrl:e,redirectUri:t,preferPrivateSession:r})=>{let o=new xs(e),{id_token:n,access_token:a,state:i,token_type:s,expires_in:c,error_description:l,error:p}=(o.hash??"#").substring(1).split("&").map(f=>f.split("=")).reduce((f,[d,h])=>({...f,[d]:h}),{id_token:void 0,access_token:void 0,state:void 0,token_type:void 0,expires_in:void 0,error_description:void 0,error:void 0});if(p)throw Ld(l??p);if(!a)throw Ld("No access token returned from OAuth flow.");let u=await EN(i),m=(a&&tn(a).payload.username)??"username";return await _N({username:m,AccessToken:a,IdToken:n}),d6({redirectUri:t,state:u,preferPrivateSession:r})},d6=async({redirectUri:e,state:t,preferPrivateSession:r})=>{await Yw.setOAuthMetadata({oauthSignIn:!0}),await _n.clearOAuthData(),await _n.storeOAuthSignIn(!0,r),qw(),Tle(e),Ele(t)&&jn.dispatch("auth",{event:"customOAuthState",data:bN(Ile(t))},"Auth",Sn),jn.dispatch("auth",{event:"signInWithRedirect"},"Auth",Sn),await u6()},Ele=e=>/-/.test(e),Ile=e=>e.split("-").splice(1).join("-"),Tle=e=>{typeof window<"u"&&typeof window.history<"u"&&window.history.replaceState(window.history.state,"",e)};function h6(e,t){if(t){let r=e?.find(o=>o===t);if(!r)throw Wz;return r}else{let r=e?.find(Cle)??e?.find(Nle),o=e?.find(Rle)??e?.find(Ale);if(r)return r;throw o?Hz:Uz}}var Cle=e=>e.startsWith(String(window.location.origin+(window.location.pathname||"/"))),Nle=e=>e.includes(String(window.location.hostname)),Ale=e=>e.startsWith("http://"),Rle=e=>e.startsWith("https://");var g6=async e=>{qw(),await _n.clearOAuthInflightData(),jn.dispatch("auth",{event:"signInWithRedirect_failure",data:{error:e}},"Auth",Sn)};var y6=async e=>{try{Ar(e),UC(e),_n.setAuthConfig(e)}catch{return}if(await _n.loadOAuthInFlight())try{let t=window.location.href,{loginWith:r,userPoolClientId:o}=e,{domain:n,redirectSignIn:a,responseType:i}=r.oauth,s=h6(a);await f6({currentUrl:t,clientId:o,domain:n,redirectUri:s,responseType:i,userAgentValue:Jz(Nv.SignInWithRedirect)})}catch(t){await g6(t)}};Rv()&&bs[Iv](y6);function Gn(e){return e!=null&&!Array.isArray(e)&&typeof e=="object"}function qn(e){return typeof e=="string"||typeof e=="object"&&Object.prototype.toString.call(e)==="[object String]"}function Fl(e){return e===void 0}function ga(e,t){return e!=null&&Object.prototype.hasOwnProperty.call(e,t)}function En(e){return typeof e=="function"}var $o=(e,t)=>t?`${e}--${t}`:"",ya=(e,t,r)=>r?`${e}--${t}`:"";function IN(e,t){let r={},o={};return Object.entries(e).forEach(([n,a])=>{t(n)?r[n]=a:o[n]=a}),[r,o]}var TN={small:{value:"1px"},medium:{value:"2px"},large:{value:"3px"}};var CN={red:{10:{value:"hsl(0, 75%, 95%)"},20:{value:"hsl(0, 75%, 85%)"},40:{value:"hsl(0, 75%, 75%)"},60:{value:"hsl(0, 50%, 50%)"},80:{value:"hsl(0, 95%, 30%)"},90:{value:"hsl(0, 100%, 20%)"},100:{value:"hsl(0, 100%, 15%)"}},orange:{10:{value:"hsl(30, 75%, 95%)"},20:{value:"hsl(30, 75%, 85%)"},40:{value:"hsl(30, 75%, 75%)"},60:{value:"hsl(30, 50%, 50%)"},80:{value:"hsl(30, 95%, 30%)"},90:{value:"hsl(30, 100%, 20%)"},100:{value:"hsl(30, 100%, 15%)"}},yellow:{10:{value:"hsl(60, 75%, 95%)"},20:{value:"hsl(60, 75%, 85%)"},40:{value:"hsl(60, 75%, 75%)"},60:{value:"hsl(60, 50%, 50%)"},80:{value:"hsl(60, 95%, 30%)"},90:{value:"hsl(60, 100%, 20%)"},100:{value:"hsl(60, 100%, 15%)"}},green:{10:{value:"hsl(130, 60%, 95%)"},20:{value:"hsl(130, 60%, 90%)"},40:{value:"hsl(130, 44%, 63%)"},60:{value:"hsl(130, 43%, 46%)"},80:{value:"hsl(130, 33%, 37%)"},90:{value:"hsl(130, 27%, 29%)"},100:{value:"hsl(130, 22%, 23%)"}},teal:{10:{value:"hsl(190, 75%, 95%)"},20:{value:"hsl(190, 75%, 85%)"},40:{value:"hsl(190, 70%, 70%)"},60:{value:"hsl(190, 50%, 50%)"},80:{value:"hsl(190, 95%, 30%)"},90:{value:"hsl(190, 100%, 20%)"},100:{value:"hsl(190, 100%, 15%)"}},blue:{10:{value:"hsl(220, 95%, 95%)"},20:{value:"hsl(220, 85%, 85%)"},40:{value:"hsl(220, 70%, 70%)"},60:{value:"hsl(220, 50%, 50%)"},80:{value:"hsl(220, 95%, 30%)"},90:{value:"hsl(220, 100%, 20%)"},100:{value:"hsl(220, 100%, 15%)"}},purple:{10:{value:"hsl(300, 95%, 95%)"},20:{value:"hsl(300, 85%, 85%)"},40:{value:"hsl(300, 70%, 70%)"},60:{value:"hsl(300, 50%, 50%)"},80:{value:"hsl(300, 95%, 30%)"},90:{value:"hsl(300, 100%, 20%)"},100:{value:"hsl(300, 100%, 15%)"}},pink:{10:{value:"hsl(340, 95%, 95%)"},20:{value:"hsl(340, 90%, 85%)"},40:{value:"hsl(340, 70%, 70%)"},60:{value:"hsl(340, 50%, 50%)"},80:{value:"hsl(340, 95%, 30%)"},90:{value:"hsl(340, 100%, 20%)"},100:{value:"hsl(340, 100%, 15%)"}},neutral:{10:{value:"hsl(210, 5%, 98%)"},20:{value:"hsl(210, 5%, 94%)"},40:{value:"hsl(210, 5%, 87%)"},60:{value:"hsl(210, 10%, 58%)"},80:{value:"hsl(210, 10%, 40%)"},90:{value:"hsl(210, 25%, 25%)"},100:{value:"hsl(210, 50%, 10%)"}},primary:{10:{value:"{colors.teal.10.value}"},20:{value:"{colors.teal.20.value}"},40:{value:"{colors.teal.40.value}"},60:{value:"{colors.teal.60.value}"},80:{value:"{colors.teal.80.value}"},90:{value:"{colors.teal.90.value}"},100:{value:"{colors.teal.100.value}"}},secondary:{10:{value:"{colors.purple.10.value}"},20:{value:"{colors.purple.20.value}"},40:{value:"{colors.purple.40.value}"},60:{value:"{colors.purple.60.value}"},80:{value:"{colors.purple.80.value}"},90:{value:"{colors.purple.90.value}"},100:{value:"{colors.purple.100.value}"}},font:{primary:{value:"{colors.neutral.100.value}"},secondary:{value:"{colors.neutral.90.value}"},tertiary:{value:"{colors.neutral.80.value}"},disabled:{value:"{colors.neutral.60.value}"},inverse:{value:"{colors.white.value}"},interactive:{value:"{colors.primary.80.value}"},hover:{value:"{colors.primary.90.value}"},focus:{value:"{colors.primary.100.value}"},active:{value:"{colors.primary.100.value}"},info:{value:"{colors.blue.90.value}"},warning:{value:"{colors.orange.90.value}"},error:{value:"{colors.red.90.value}"},success:{value:"{colors.green.90.value}"}},background:{primary:{value:"{colors.white.value}"},secondary:{value:"{colors.neutral.10.value}"},tertiary:{value:"{colors.neutral.20.value}"},quaternary:{value:"{colors.neutral.60.value}"},disabled:{value:"{colors.background.tertiary.value}"},info:{value:"{colors.blue.10.value}"},warning:{value:"{colors.orange.10.value}"},error:{value:"{colors.red.10.value}"},success:{value:"{colors.green.10.value}"}},border:{primary:{value:"{colors.neutral.60.value}"},secondary:{value:"{colors.neutral.40.value}"},tertiary:{value:"{colors.neutral.20.value}"},disabled:{value:"{colors.border.tertiary.value}"},pressed:{value:"{colors.primary.100.value}"},focus:{value:"{colors.primary.100.value}"},error:{value:"{colors.red.80.value}"},info:{value:"{colors.blue.80.value}"},success:{value:"{colors.green.80.value}"},warning:{value:"{colors.orange.80.value}"}},shadow:{primary:{value:"hsla(210, 50%, 10%, 0.25)"},secondary:{value:"hsla(210, 50%, 10%, 0.15)"},tertiary:{value:"hsla(210, 50%, 10%, 0.05)"}},overlay:{5:{value:"hsla(0, 0%, 0%, 0.05)"},10:{value:"hsla(0, 0%, 0%, 0.1)"},20:{value:"hsla(0, 0%, 0%, 0.2)"},30:{value:"hsla(0, 0%, 0%, 0.3)"},40:{value:"hsla(0, 0%, 0%, 0.4)"},50:{value:"hsla(0, 0%, 0%, 0.5)"},60:{value:"hsla(0, 0%, 0%, 0.6)"},70:{value:"hsla(0, 0%, 0%, 0.7)"},80:{value:"hsla(0, 0%, 0%, 0.8)"},90:{value:"hsla(0, 0%, 0%, 0.9)"}},black:{value:"hsl(0, 0%, 0%)"},white:{value:"hsl(0, 0%, 100%)"},transparent:{value:"transparent"}};var v6={alignItems:{value:"center"},justifyContent:{value:"space-between"},color:{value:"{colors.font.primary.value}"},backgroundColor:{value:"{colors.background.tertiary.value}"},paddingBlock:{value:"{space.small.value}"},paddingInline:{value:"{space.medium.value}"},icon:{size:{value:"{fontSizes.xl.value}"}},heading:{fontSize:{value:"{fontSizes.medium.value}"},fontWeight:{value:"{fontWeights.bold.value}"}},info:{color:{value:"{colors.font.info.value}"},backgroundColor:{value:"{colors.background.info.value}"}},error:{color:{value:"{colors.font.error.value}"},backgroundColor:{value:"{colors.background.error.value}"}},warning:{color:{value:"{colors.font.warning.value}"},backgroundColor:{value:"{colors.background.warning.value}"}},success:{color:{value:"{colors.font.success.value}"},backgroundColor:{value:"{colors.background.success.value}"}}};var b6={message:{backgroundColor:{value:"{colors.background.secondary.value}"},borderRadius:{value:"{radii.large.value}"},gap:{value:"{space.small.value}"},paddingBlock:{value:"{space.small.value}"},paddingInline:{value:"{space.small.value}"},user:{backgroundColor:{value:"{colors.background.secondary.value}"}},assistant:{backgroundColor:{value:"{colors.primary.10.value}"}},sender:{gap:{value:"{space.small.value}"},username:{color:{value:"{colors.font.primary.value}"},fontSize:{value:"inherit"},fontWeight:{value:"{fontWeights.bold.value}"}},timestamp:{color:{value:"{colors.font.tertiary.value}"},fontSize:{value:"inherit"},fontWeight:{value:"inherit"}}},body:{gap:{value:"{space.xs.value}"}},actions:{gap:{value:"{space.xs.value}"}}},form:{gap:{value:"{space.small.value}"},padding:{value:"{space.small.value}"}},attachment:{borderColor:{value:"{colors.border.secondary.value}"},borderWidth:{value:"{borderWidths.small.value}"},borderRadius:{value:"{radii.small.value}"},fontSize:{value:"{fontSizes.small.value}"},paddingBlock:{value:"{space.xxxs.value}"},paddingInline:{value:"{space.xs.value}"},gap:{value:"{space.xs.value}"},list:{padding:{value:"{space.xs.value}"},paddingBlockStart:{value:"0"},gap:{value:"{space.xxs.value}"}},name:{color:{value:"{colors.font.primary.value}"},fontSize:{value:"{fontSizes.small.value}"},fontWeight:{value:"{fontWeights.normal.value}"}},size:{color:{value:"{colors.font.tertiary.value}"},fontSize:{value:"{fontSizes.small.value}"},fontWeight:{value:"{fontWeights.normal.value}"}},remove:{padding:{value:"{space.xxs.value}"}},image:{width:{value:"{fontSizes.medium.value}"},height:{value:"{fontSizes.medium.value}"}}}};var x6={menu:{width:{value:"100%"},marginBlockStart:{value:"{space.xxxs}"},backgroundColor:{value:"{colors.background.primary}"},borderColor:{value:"{colors.border.primary}"},borderWidth:{value:"{borderWidths.small}"},borderStyle:{value:"solid"},borderRadius:{value:"{radii.small}"},options:{display:{value:"flex"},flexDirection:{value:"column"},maxHeight:{value:"300px"}},option:{backgroundColor:{value:"{colors.background.primary}"},color:{value:"currentcolor"},cursor:{value:"pointer"},transitionDuration:{value:"{time.short}"},transitionProperty:{value:"background-color, color"},transitionTimingFunction:{value:"ease"},_active:{backgroundColor:{value:"{colors.primary.80}"},color:{value:"{colors.white}"}}},_empty:{display:{value:"flex"}},_loading:{alignItems:{value:"center"},display:{value:"flex"},gap:{value:"{space.xxxs}"}},spaceShared:{paddingBlock:{value:"{space.xs}"},paddingInline:{value:"{space.small}"}}}};var w6={maxWidth:{value:"60rem"},modal:{width:{value:"{space.relative.full}"},height:{value:"{space.relative.full}"},backgroundColor:{value:"{colors.overlay.50.value}"},top:{value:"{space.zero}"},left:{value:"{space.zero}"}},container:{widthMax:{value:"30rem"}},router:{borderWidth:{value:"{borderWidths.small.value}"},borderStyle:{value:"solid"},borderColor:{value:"{colors.border.primary.value}"},backgroundColor:{value:"{colors.background.primary.value}"},boxShadow:{value:"{shadows.medium.value}"}},footer:{paddingBottom:{value:"{space.medium.value}"}},form:{padding:{value:"{space.xl.value}"}},state:{inactive:{backgroundColor:{value:"{colors.background.secondary.value}"}}},orContainer:{color:{value:"{colors.neutral.80.value}"},orLine:{backgroundColor:{value:"{colors.background.primary.value}"}}}};var S6={color:{value:"{colors.font.tertiary.value}"},lineHeight:{value:1},fontWeight:{value:"{fontWeights.semibold.value}"},fontSize:{value:"{fontSizes.small.value}"},textAlign:{value:"center"},width:{value:"{fontSizes.xxl.value}"},height:{value:"{fontSizes.xxl.value}"},backgroundColor:{value:"{colors.background.tertiary}"},borderRadius:{value:"100%"},borderColor:{value:"{colors.border.primary.value}"},borderWidth:{value:"{borderWidths.medium.value}"},info:{color:{value:"{colors.font.info.value}"},backgroundColor:{value:"{colors.background.info.value}"},borderColor:{value:"{colors.border.info.value}"}},warning:{color:{value:"{colors.font.warning.value}"},backgroundColor:{value:"{colors.background.warning.value}"},borderColor:{value:"{colors.border.warning.value}"}},success:{color:{value:"{colors.font.success.value}"},backgroundColor:{value:"{colors.background.success.value}"},borderColor:{value:"{colors.border.success.value}"}},error:{color:{value:"{colors.font.error.value}"},backgroundColor:{value:"{colors.background.error.value}"},borderColor:{value:"{colors.border.error.value}"}},small:{fontSize:{value:"{fontSizes.xs.value}"},width:{value:"{fontSizes.xl.value}"},height:{value:"{fontSizes.xl.value}"}},large:{fontSize:{value:"{fontSizes.medium.value}"},width:{value:"{fontSizes.xxxl.value}"},height:{value:"{fontSizes.xxxl.value}"}}};var k6={color:{value:"{colors.font.primary.value}"},lineHeight:{value:1},fontWeight:{value:"{fontWeights.semibold.value}"},fontSize:{value:"{fontSizes.small.value}"},textAlign:{value:"center"},paddingVertical:{value:"{space.xs.value}"},paddingHorizontal:{value:"{space.small.value}"},backgroundColor:{value:"{colors.background.tertiary.value}"},borderRadius:{value:"{radii.xl.value}"},info:{color:{value:"{colors.font.info.value}"},backgroundColor:{value:"{colors.background.info.value}"}},warning:{color:{value:"{colors.font.warning.value}"},backgroundColor:{value:"{colors.background.warning.value}"}},success:{color:{value:"{colors.font.success.value}"},backgroundColor:{value:"{colors.background.success.value}"}},error:{color:{value:"{colors.font.error.value}"},backgroundColor:{value:"{colors.background.error.value}"}},small:{fontSize:{value:"{fontSizes.xs.value}"},paddingVertical:{value:"{space.xxs.value}"},paddingHorizontal:{value:"{space.xs.value}"}},large:{fontSize:{value:"{fontSizes.medium.value}"},paddingVertical:{value:"{space.small.value}"},paddingHorizontal:{value:"{space.medium.value}"}}};var _6={flexDirection:{value:"row"},flexWrap:{value:"wrap"},gap:{value:"0"},color:{value:"{colors.font.tertiary}"},item:{flexDirection:{value:"row"},color:{value:"inherit"},fontSize:{value:"inherit"},alignItems:{value:"center"},lineHeight:{value:"1"}},separator:{color:{value:"inherit"},fontSize:{value:"inherit"},paddingInline:{value:"{space.xxs}"}},link:{color:{value:"{components.link.color}"},fontSize:{value:"inherit"},fontWeight:{value:"normal"},textDecoration:{value:"none"},paddingInline:{value:"{space.xs}"},paddingBlock:{value:"{space.xxs}"},current:{color:{value:"inherit"},fontSize:{value:"inherit"},fontWeight:{value:"normal"},textDecoration:{value:"none"}}}};var E6={fontWeight:{value:"{fontWeights.bold.value}"},transitionDuration:{value:"{components.fieldcontrol.transitionDuration.value}"},fontSize:{value:"{components.fieldcontrol.fontSize.value}"},lineHeight:{value:"{components.fieldcontrol.lineHeight.value}"},paddingBlockStart:{value:"{components.fieldcontrol.paddingBlockStart.value}"},paddingBlockEnd:{value:"{components.fieldcontrol.paddingBlockEnd.value}"},paddingInlineStart:{value:"{components.fieldcontrol.paddingInlineStart.value}"},paddingInlineEnd:{value:"{components.fieldcontrol.paddingInlineEnd.value}"},backgroundColor:{value:"transparent"},borderColor:{value:"{components.fieldcontrol.borderColor.value}"},borderWidth:{value:"{components.fieldcontrol.borderWidth.value}"},borderStyle:{value:"{components.fieldcontrol.borderStyle.value}"},borderRadius:{value:"{components.fieldcontrol.borderRadius.value}"},color:{value:"{colors.font.primary.value}"},_hover:{color:{value:"{colors.font.focus.value}"},backgroundColor:{value:"{colors.primary.10.value}"},borderColor:{value:"{colors.primary.60.value}"}},_focus:{color:{value:"{colors.font.focus.value}"},backgroundColor:{value:"{colors.primary.10.value}"},borderColor:{value:"{colors.border.focus.value}"},boxShadow:{value:"{components.fieldcontrol._focus.boxShadow.value}"}},_active:{color:{value:"{colors.font.active.value}"},backgroundColor:{value:"{colors.primary.20.value}"},borderColor:{value:"{colors.primary.100.value}"}},_loading:{color:{value:"{colors.font.disabled.value}"},backgroundColor:{value:"transparent"},borderColor:{value:"{colors.border.tertiary.value}"}},_disabled:{color:{value:"{colors.font.disabled.value}"},backgroundColor:{value:"transparent"},borderColor:{value:"{colors.border.tertiary.value}"}},outlined:{info:{borderColor:{value:"{colors.blue.60.value}"},backgroundColor:{value:"transparent"},color:{value:"{colors.blue.100}"},_hover:{borderColor:{value:"{colors.blue.60.value}"},backgroundColor:{value:"{colors.blue.10.value}"},color:{value:"{colors.blue.100.value}"}},_focus:{borderColor:{value:"{colors.blue.100.value}"},backgroundColor:{value:"{colors.blue.10.value}"},color:{value:"{colors.blue.100.value}"},boxShadow:{value:"{components.fieldcontrol.info._focus.boxShadow.value}"}},_active:{borderColor:{value:"{colors.blue.100.value}"},backgroundColor:{value:"{colors.blue.20.value}"},color:{value:"{colors.blue.100.value}"}}},warning:{borderColor:{value:"{colors.orange.60.value}"},backgroundColor:{value:"transparent"},color:{value:"{colors.orange.100}"},_hover:{borderColor:{value:"{colors.orange.60.value}"},backgroundColor:{value:"{colors.orange.10.value}"},color:{value:"{colors.orange.100.value}"}},_focus:{borderColor:{value:"{colors.orange.100.value}"},backgroundColor:{value:"{colors.orange.10.value}"},color:{value:"{colors.orange.100.value}"},boxShadow:{value:"{components.fieldcontrol.warning._focus.boxShadow.value}"}},_active:{borderColor:{value:"{colors.orange.100.value}"},backgroundColor:{value:"{colors.orange.20.value}"},color:{value:"{colors.orange.100.value}"}}},success:{borderColor:{value:"{colors.green.60.value}"},backgroundColor:{value:"transparent"},color:{value:"{colors.green.100}"},_hover:{borderColor:{value:"{colors.green.60.value}"},backgroundColor:{value:"{colors.green.10.value}"},color:{value:"{colors.green.100.value}"}},_focus:{borderColor:{value:"{colors.green.100.value}"},backgroundColor:{value:"{colors.green.10.value}"},color:{value:"{colors.green.100.value}"},boxShadow:{value:"{components.fieldcontrol.success._focus.boxShadow.value}"}},_active:{borderColor:{value:"{colors.green.100.value}"},backgroundColor:{value:"{colors.green.20.value}"},color:{value:"{colors.green.100.value}"}}},error:{borderColor:{value:"{colors.red.80.value}"},backgroundColor:{value:"transparent"},color:{value:"{colors.red.100}"},_hover:{borderColor:{value:"{colors.red.80.value}"},backgroundColor:{value:"{colors.red.10.value}"},color:{value:"{colors.red.100.value}"}},_focus:{borderColor:{value:"{colors.red.100.value}"},backgroundColor:{value:"{colors.red.10.value}"},color:{value:"{colors.red.100.value}"},boxShadow:{value:"{components.fieldcontrol._error._focus.boxShadow.value}"}},_active:{borderColor:{value:"{colors.red.100.value}"},backgroundColor:{value:"{colors.red.20.value}"},color:{value:"{colors.red.100.value}"}}},overlay:{borderColor:{value:"{colors.overlay.60.value}"},backgroundColor:{value:"transparent"},color:{value:"{colors.font.primary.value}"},_hover:{borderColor:{value:"{colors.overlay.60.value}"},backgroundColor:{value:"{colors.overlay.5.value}"},color:{value:"{colors.neutral.90.value}"}},_focus:{borderColor:{value:"{colors.overlay.90.value}"},backgroundColor:{value:"{colors.overlay.5.value}"},color:{value:"{colors.neutral.90.value}"},boxShadow:{value:"{components.fieldcontrol.overlay._focus.boxShadow.value}"}},_active:{borderColor:{value:"{colors.overlay.90.value}"},backgroundColor:{value:"{colors.overlay.10.value}"},color:{value:"{colors.neutral.100.value}"}}}},primary:{borderColor:{value:"transparent"},borderWidth:{value:"{borderWidths.small.value}"},borderStyle:{value:"solid"},backgroundColor:{value:"{colors.primary.80.value}"},color:{value:"{colors.font.inverse.value}"},_disabled:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.background.disabled.value}"},color:{value:"{colors.font.disabled.value}"}},_loading:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.background.disabled.value}"},color:{value:"{colors.font.disabled.value}"}},_hover:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.primary.90.value}"},color:{value:"{colors.font.inverse.value}"}},_focus:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.primary.90.value}"},color:{value:"{colors.font.inverse.value}"},boxShadow:{value:"{components.fieldcontrol._focus.boxShadow.value}"}},_active:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.primary.100.value}"},color:{value:"{colors.font.inverse.value}"}},info:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.blue.80}"},color:{value:"{colors.font.inverse.value}"},_hover:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.blue.90.value}"},color:{value:"{colors.font.inverse.value}"}},_focus:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.blue.90.value}"},color:{value:"{colors.font.inverse.value}"},boxShadow:{value:"{components.fieldcontrol.info._focus.boxShadow.value}"}},_active:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.blue.100.value}"},color:{value:"{colors.font.inverse.value}"}}},warning:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.orange.80}"},color:{value:"{colors.font.inverse.value}"},_hover:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.orange.90.value}"},color:{value:"{colors.font.inverse.value}"}},_focus:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.orange.90.value}"},color:{value:"{colors.font.inverse.value}"},boxShadow:{value:"{components.fieldcontrol.overlay._focus.boxShadow.value}"}},_active:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.orange.100.value}"},color:{value:"{colors.font.inverse.value}"}}},error:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.red.80}"},color:{value:"{colors.font.inverse.value}"},_hover:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.red.90.value}"},color:{value:"{colors.font.inverse.value}"}},_focus:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.red.90.value}"},color:{value:"{colors.font.inverse.value}"},boxShadow:{value:"{components.fieldcontrol._error._focus.boxShadow.value}"}},_active:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.red.100.value}"},color:{value:"{colors.font.inverse.value}"}}},success:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.green.80}"},color:{value:"{colors.font.inverse.value}"},_hover:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.green.90.value}"},color:{value:"{colors.font.inverse.value}"}},_focus:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.green.90.value}"},color:{value:"{colors.font.inverse.value}"},boxShadow:{value:"{components.fieldcontrol.success._focus.boxShadow.value}"}},_active:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.green.100.value}"},color:{value:"{colors.font.inverse.value}"}}},overlay:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.overlay.70}"},color:{value:"{colors.font.inverse.value}"},_hover:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.overlay.90.value}"},color:{value:"{colors.font.inverse.value}"}},_focus:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.overlay.90.value}"},color:{value:"{colors.font.inverse.value}"},boxShadow:{value:"{components.fieldcontrol.overlay._focus.boxShadow.value}"}},_active:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.overlay.90.value}"},color:{value:"{colors.font.inverse.value}"}}}},menu:{borderWidth:{value:"{space.zero.value}"},backgroundColor:{value:"transparent"},justifyContent:{value:"start"},_hover:{color:{value:"{colors.font.inverse.value}"},backgroundColor:{value:"{colors.primary.80.value}"}},_focus:{color:{value:"{colors.font.inverse.value}"},backgroundColor:{value:"{colors.primary.80.value}"}},_active:{color:{value:"{colors.font.inverse.value}"},backgroundColor:{value:"{colors.primary.90.value}"}},_disabled:{color:{value:"{colors.font.disabled.value}"}}},link:{backgroundColor:{value:"transparent"},borderColor:{value:"transparent"},borderWidth:{value:"{borderWidths.small.value}"},color:{value:"{colors.font.interactive.value}"},_hover:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.primary.10.value}"},color:{value:"{colors.font.hover.value}"}},_focus:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.primary.10.value}"},color:{value:"{colors.font.focus.value}"},boxShadow:{value:"{components.fieldcontrol._focus.boxShadow.value}"}},_active:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.primary.20.value}"},color:{value:"{colors.font.active.value}"}},_disabled:{borderColor:{value:"transparent"},backgroundColor:{value:"transparent"},color:{value:"{colors.font.disabled.value}"}},_loading:{borderColor:{value:"transparent"},backgroundColor:{value:"transparent"},color:{value:"{colors.font.disabled.value}"}},info:{borderColor:{value:"transparent"},backgroundColor:{value:"transparent"},color:{value:"{colors.blue.100}"},_hover:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.blue.10.value}"},color:{value:"{colors.blue.90.value}"}},_focus:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.blue.10.value}"},color:{value:"{colors.blue.100.value}"},boxShadow:{value:"{components.fieldcontrol.info._focus.boxShadow.value}"}},_active:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.blue.20.value}"},color:{value:"{colors.blue.100.value}"}}},warning:{borderColor:{value:"transparent"},backgroundColor:{value:"transparent"},color:{value:"{colors.orange.100}"},_hover:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.orange.10.value}"},color:{value:"{colors.orange.90.value}"}},_focus:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.orange.10.value}"},color:{value:"{colors.orange.100.value}"},boxShadow:{value:"{components.fieldcontrol.warning._focus.boxShadow.value}"}},_active:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.orange.20.value}"},color:{value:"{colors.orange.100.value}"}}},success:{borderColor:{value:"transparent"},backgroundColor:{value:"transparent"},color:{value:"{colors.green.100}"},_hover:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.green.10.value}"},color:{value:"{colors.green.90.value}"}},_focus:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.green.10.value}"},color:{value:"{colors.green.100.value}"},boxShadow:{value:"{components.fieldcontrol.success._focus.boxShadow.value}"}},_active:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.green.20.value}"},color:{value:"{colors.green.100.value}"}}},error:{borderColor:{value:"transparent"},backgroundColor:{value:"transparent"},color:{value:"{colors.red.100}"},_hover:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.red.10.value}"},color:{value:"{colors.red.90.value}"}},_focus:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.red.10.value}"},color:{value:"{colors.red.100.value}"},boxShadow:{value:"{components.fieldcontrol._error._focus.boxShadow.value}"}},_active:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.red.20.value}"},color:{value:"{colors.red.100.value}"}}},overlay:{borderColor:{value:"transparent"},backgroundColor:{value:"transparent"},color:{value:"{colors.neutral.100}"},_hover:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.overlay.5.value}"},color:{value:"{colors.overlay.80.value}"}},_focus:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.overlay.5.value}"},color:{value:"{colors.overlay.90.value}"},boxShadow:{value:"{components.fieldcontrol.overlay._focus.boxShadow.value}"}},_active:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.overlay.10.value}"},color:{value:"{colors.overlay.90.value}"}}}},warning:{backgroundColor:{value:"transparent"},borderColor:{value:"{colors.red.60}"},borderWidth:{value:"{borderWidths.small}"},color:{value:"{colors.red.60}"},_hover:{borderColor:{value:"{colors.red.80}"},backgroundColor:{value:"{colors.red.10}"},color:{value:"{colors.font.error}"}},_focus:{borderColor:{value:"{colors.red.80}"},backgroundColor:{value:"{colors.red.10}"},color:{value:"{colors.red.80}"},boxShadow:{value:"{components.fieldcontrol._error._focus.boxShadow}"}},_active:{borderColor:{value:"{colors.red.100}"},backgroundColor:{value:"{colors.red.20}"},color:{value:"{colors.red.100}"}},_disabled:{borderColor:{value:"{colors.border.tertiary}"},backgroundColor:{value:"transparent"},color:{value:"{colors.font.disabled}"}},_loading:{borderColor:{value:"{colors.border.tertiary}"},backgroundColor:{value:"transparent"},color:{value:"{colors.font.disabled}"}}},destructive:{borderColor:{value:"transparent"},borderWidth:{value:"{borderWidths.small}"},borderStyle:{value:"solid"},backgroundColor:{value:"{colors.red.60}"},color:{value:"{colors.font.inverse}"},_disabled:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.background.disabled}"},color:{value:"{colors.font.disabled}"}},_loading:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.background.disabled}"},color:{value:"{colors.font.disabled}"}},_hover:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.red.80}"},color:{value:"{colors.font.inverse}"}},_focus:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.red.80}"},color:{value:"{colors.font.inverse}"},boxShadow:{value:"{components.fieldcontrol._error._focus.boxShadow}"}},_active:{borderColor:{value:"transparent"},backgroundColor:{value:"{colors.red.100}"},color:{value:"{colors.font.inverse}"}}},small:{fontSize:{value:"{components.fieldcontrol.small.fontSize.value}"},paddingBlockStart:{value:"{components.fieldcontrol.small.paddingBlockStart.value}"},paddingBlockEnd:{value:"{components.fieldcontrol.small.paddingBlockEnd.value}"},paddingInlineStart:{value:"{components.fieldcontrol.small.paddingInlineStart.value}"},paddingInlineEnd:{value:"{components.fieldcontrol.small.paddingInlineEnd.value}"}},large:{fontSize:{value:"{components.fieldcontrol.large.fontSize.value}"},paddingBlockStart:{value:"{components.fieldcontrol.large.paddingBlockStart.value}"},paddingBlockEnd:{value:"{components.fieldcontrol.large.paddingBlockEnd.value}"},paddingInlineStart:{value:"{components.fieldcontrol.large.paddingInlineStart.value}"},paddingInlineEnd:{value:"{components.fieldcontrol.large.paddingInlineEnd.value}"}},loaderWrapper:{alignItems:{value:"center"},gap:{value:"{space.xs.value}"}}};var I6={backgroundColor:{value:"{colors.background.primary.value}"},borderRadius:{value:"{radii.xs.value}"},borderWidth:{value:"0"},borderStyle:{value:"solid"},borderColor:{value:"transparent"},boxShadow:{value:"none"},padding:{value:"{space.medium.value}"},outlined:{backgroundColor:{value:"{components.card.backgroundColor.value}"},borderRadius:{value:"{radii.xs.value}"},borderWidth:{value:"{borderWidths.small.value}"},borderStyle:{value:"solid"},borderColor:{value:"{colors.border.primary.value}"},boxShadow:{value:"{components.card.boxShadow.value}"}},elevated:{backgroundColor:{value:"{components.card.backgroundColor.value}"},borderRadius:{value:"{radii.xs.value}"},borderWidth:{value:"0"},borderStyle:{value:"solid"},borderColor:{value:"transparent"},boxShadow:{value:"{shadows.medium.value}"}}};var T6={cursor:{value:"pointer"},alignItems:{value:"center"},_disabled:{cursor:{value:"not-allowed"}},button:{position:{value:"relative"},alignItems:{value:"center"},justifyContent:{value:"center"},color:{value:"{colors.font.inverse.value}"},before:{width:{value:"100%"},height:{value:"100%"},borderWidth:{value:"{borderWidths.medium.value}"},borderRadius:{value:"20%"},borderStyle:{value:"solid"},borderColor:{value:"{colors.border.primary.value}"}},_focus:{outlineColor:{value:"{colors.transparent.value}"},outlineStyle:{value:"solid"},outlineWidth:{value:"{outlineWidths.medium.value}"},outlineOffset:{value:"{outlineOffsets.medium.value}"},borderColor:{value:"{colors.border.focus.value}"},boxShadow:{value:"{components.fieldcontrol._focus.boxShadow.value}"}},_disabled:{borderColor:{value:"{colors.border.disabled.value}"}},_error:{borderColor:{value:"{colors.border.error.value}"},_focus:{borderColor:{value:"{colors.border.error.value}"},boxShadow:{value:"{components.fieldcontrol._error._focus.boxShadow.value}"}}}},icon:{backgroundColor:{value:"{colors.primary.80.value}"},borderRadius:{value:"20%"},opacity:{value:"{opacities.0.value}"},transform:{value:"scale(0)"},transitionProperty:{value:"all"},transitionDuration:{value:"{time.short.value}"},transitionTimingFunction:{value:"ease-in-out"},_checked:{opacity:{value:"{opacities.100.value}"},transform:{value:"scale(1)"},_disabled:{backgroundColor:{value:"{colors.background.disabled.value}"}}},_indeterminate:{opacity:{value:"{opacities.100.value}"},transform:{value:"scale(1)"},_disabled:{backgroundColor:{value:"{colors.background.disabled.value}"}}}},label:{color:{value:"{components.text.color.value}"},_disabled:{color:{value:"{colors.font.disabled.value}"}}}};var C6={alignItems:{value:"flex-start"},alignContent:{value:"center"},flexDirection:{value:"column"},justifyContent:{value:"center"}};var N6={pagination:{current:{color:{value:"{components.pagination.current.color}"},backgroundColor:{value:"{components.pagination.current.backgroundColor}"}},button:{color:{value:"{components.pagination.button.color}"},_hover:{backgroundColor:{value:"{components.pagination.button.hover.backgroundColor}"},color:{value:"{components.pagination.button.hover.color}"}},_disabled:{color:{value:"{components.pagination.button.disabled.color}"}}}},search:{input:{color:{value:"{components.searchfield.color}"}},button:{color:{value:"{components.searchfield.button.color}"},_active:{backgroundColor:{value:"{components.searchfield.button._active.backgroundColor}"},borderColor:{value:"{components.searchfield.button._active.borderColor}"},color:{value:"{components.searchfield.button._active.color}"}},_disabled:{backgroundColor:{value:"{components.searchfield.button._disabled.backgroundColor}"},borderColor:{value:"{components.searchfield.button._disabled.borderColor}"},color:{value:"{components.searchfield.button._disabled.color}"}},_focus:{backgroundColor:{value:"{components.searchfield.button._focus.backgroundColor}"},borderColor:{value:"{components.searchfield.button._focus.borderColor}"},color:{value:"{components.searchfield.button._focus.color}"}},_hover:{backgroundColor:{value:"{components.searchfield.button._hover.backgroundColor}"},borderColor:{value:"{components.searchfield.button._hover.borderColor}"},color:{value:"{components.searchfield.button._hover.color}"}}}}};var A6={fontSize:{value:"{fontSizes.xs}"},gap:{value:"{space.relative.medium}"},svg:{path:{fill:{value:"{colors.font.primary}"}}},toolTip:{bottom:{value:"{space.large}"},color:{value:"{colors.teal.100}"},fontSize:{value:"{fontSizes.xxs}"}}};var R6={height:{value:"{space.relative.full.value}"}};var D6={borderStyle:{value:"solid"},borderColor:{value:"{colors.border.primary.value}"},borderWidth:{value:"{borderWidths.medium.value}"},label:{color:{value:"{colors.font.tertiary.value}"},paddingInline:{value:"{space.medium.value}"},fontSize:{value:"{fontSizes.small.value}"},backgroundColor:{value:"{colors.background.primary.value}"}},small:{borderWidth:{value:"{borderWidths.small.value}"}},large:{borderWidth:{value:"{borderWidths.large.value}"}},opacity:{value:"{opacities.60.value}"}};var F6={backgroundColor:{value:"{colors.background.primary}"},borderRadius:{value:"{radii.small}"},borderColor:{value:"{colors.border.primary}"},borderStyle:{value:"dashed"},borderWidth:{value:"{borderWidths.small}"},color:{value:"{colors.font.primary}"},gap:{value:"{space.small}"},paddingBlock:{value:"{space.xl}"},paddingInline:{value:"{space.large}"},textAlign:{value:"center"},_active:{backgroundColor:{value:"{colors.primary.10}"},borderRadius:{value:"{components.dropzone.borderRadius}"},borderColor:{value:"{colors.border.pressed}"},borderStyle:{value:"{components.dropzone.borderStyle}"},borderWidth:{value:"{components.dropzone.borderWidth}"},color:{value:"{colors.font.primary}"}},_disabled:{backgroundColor:{value:"{colors.background.disabled}"},borderRadius:{value:"{components.dropzone.borderRadius}"},borderColor:{value:"{colors.border.disabled}"},borderStyle:{value:"{components.dropzone.borderStyle}"},borderWidth:{value:"{components.dropzone.borderWidth}"},color:{value:"{colors.font.disabled}"}},accepted:{backgroundColor:{value:"{colors.background.success}"},borderRadius:{value:"{components.dropzone.borderRadius}"},borderColor:{value:"{colors.border.success}"},borderStyle:{value:"{components.dropzone.borderStyle}"},borderWidth:{value:"{components.dropzone.borderWidth}"},color:{value:"{colors.font.success}"}},rejected:{backgroundColor:{value:"{colors.background.error}"},borderRadius:{value:"{components.dropzone.borderRadius}"},borderColor:{value:"{colors.border.pressed}"},borderStyle:{value:"{components.dropzone.borderStyle}"},borderWidth:{value:"{components.dropzone.borderWidth}"},color:{value:"{colors.font.error}"}}};var M6={backgroundColor:{value:"{colors.background.primary.value}"},item:{borderColor:{value:"{colors.border.secondary.value}"},borderWidth:{value:"{borderWidths.small.value}"},borderStyle:{value:"solid"},borderRadius:{value:"{radii.small.value}"},trigger:{alignItems:{value:"center"},backgroundColor:{value:"{colors.background.primary.value}"},color:{value:"inherit"},gap:{value:"{space.small.value}"},justifyContent:{value:"space-between"},paddingBlock:{value:"{space.xs.value}"},paddingInline:{value:"{space.small.value}"},_hover:{color:{value:"inherit"},backgroundColor:{value:"{colors.overlay.5.value}"}},_focus:{borderColor:{value:"{colors.border.focus.value}"},boxShadow:{value:{offsetX:"0",offsetY:"0",blurRadius:"0",spreadRadius:"2px",color:"{colors.border.focus.value}"}}}},content:{color:{value:"inherit"},paddingInline:{value:"{space.small.value}"},paddingBlockEnd:{value:"{space.small.value}"},paddingBlockStart:{value:"{space.xxxs.value}"}},icon:{color:{value:"{colors.font.tertiary.value}"},transitionDuration:{value:"{time.medium.value}"},transitionTimingFunction:{value:"cubic-bezier(0.87, 0, 0.13, 1)"}}}};var O6={gap:{value:"{space.xs.value}"},fontSize:{value:"{fontSizes.medium.value}"},flexDirection:{value:"column"},small:{gap:{value:"{space.xxxs.value}"},fontSize:{value:"{fontSizes.small.value}"}},large:{gap:{value:"{space.small.value}"},fontSize:{value:"{fontSizes.large.value}"}},label:{color:{value:"{colors.font.secondary.value}"}}};var P6={borderStyle:{value:"solid"},borderColor:{value:"{colors.border.primary.value}"},borderWidth:{value:"{borderWidths.small.value}"},borderRadius:{value:"{radii.small.value}"},color:{value:"{colors.font.primary.value}"},paddingBlockStart:{value:"{space.xs.value}"},paddingBlockEnd:{value:"{space.xs.value}"},paddingInlineStart:{value:"{space.medium.value}"},paddingInlineEnd:{value:"{space.medium.value}"},fontSize:{value:"{components.field.fontSize.value}"},lineHeight:{value:"{lineHeights.medium.value}"},transitionDuration:{value:"{time.medium.value}"},outlineColor:{value:"{colors.transparent.value}"},outlineStyle:{value:"solid"},outlineWidth:{value:"{outlineWidths.medium.value}"},outlineOffset:{value:"{outlineOffsets.medium.value}"},small:{fontSize:{value:"{components.field.small.fontSize.value}"},paddingBlockStart:{value:"{space.xxs.value}"},paddingBlockEnd:{value:"{space.xxs.value}"},paddingInlineStart:{value:"{space.small.value}"},paddingInlineEnd:{value:"{space.small.value}"}},large:{fontSize:{value:"{components.field.large.fontSize.value}"},paddingBlockStart:{value:"{space.xs.value}"},paddingBlockEnd:{value:"{space.xs.value}"},paddingInlineStart:{value:"{space.medium.value}"},paddingInlineEnd:{value:"{space.medium.value}"}},quiet:{borderStyle:{value:"none"},borderInlineStart:{value:"none"},borderInlineEnd:{value:"none"},borderBlockStart:{value:"none"},borderRadius:{value:"0"},_focus:{borderBlockEndColor:{value:"transparent"},boxShadow:{value:"{components.fieldcontrol._focus.boxShadow.value}"}},_error:{borderBlockEndColor:{value:"{colors.border.error.value}"},_focus:{borderBlockEndColor:{value:"transparent"},boxShadow:{value:"{components.fieldcontrol._error._focus.boxShadow.value}"}}}},_focus:{borderColor:{value:"{colors.border.focus.value}"},boxShadow:{value:{offsetX:"0px",offsetY:"0px",blurRadius:"0px",spreadRadius:"2px",color:"{colors.border.focus.value}"}}},_disabled:{color:{value:"{colors.font.disabled.value}"},cursor:{value:"not-allowed"},borderColor:{value:"{colors.transparent.value}"},backgroundColor:{value:"{colors.background.disabled.value}"}},_error:{borderColor:{value:"{colors.border.error.value}"},color:{value:"{colors.font.error.value}"},_focus:{boxShadow:{value:{offsetX:"0px",offsetY:"0px",blurRadius:"0px",spreadRadius:"2px",color:"{colors.border.error.value}"}}}},info:{_focus:{boxShadow:{value:{offsetX:"0px",offsetY:"0px",blurRadius:"0px",spreadRadius:"2px",color:"{colors.blue.100.value}"}}}},warning:{_focus:{boxShadow:{value:{offsetX:"0px",offsetY:"0px",blurRadius:"0px",spreadRadius:"2px",color:"{colors.orange.100.value}"}}}},success:{_focus:{boxShadow:{value:{offsetX:"0px",offsetY:"0px",blurRadius:"0px",spreadRadius:"2px",color:"{colors.green.100.value}"}}}},overlay:{_focus:{boxShadow:{value:{offsetX:"0px",offsetY:"0px",blurRadius:"0px",spreadRadius:"2px",color:"{colors.overlay.90.value}"}}}}};var z6={gap:{value:"{space.zero.value}"},vertical:{alignItems:{value:"center"}},outer:{alignItems:{value:"center"}}};var $6={backgroundColor:{value:"transparent"},borderRadius:{value:"{radii.xs.value}"},flexDirection:{value:"column"},gap:{value:"{components.field.gap.value}"},legend:{color:{value:"{colors.font.primary.value}"},fontSize:{value:"{components.field.fontSize.value}"},fontWeight:{value:"{fontWeights.bold.value}"},lineHeight:{value:"{lineHeights.medium.value}"},small:{fontSize:"{components.field.small.fontSize.value}"},large:{fontSize:"{components.field.large.fontSize.value}"}},outlined:{padding:"{space.medium.value}",borderColor:"{colors.neutral.40.value}",borderWidth:"{borderWidths.small.value}",borderStyle:"solid",small:{padding:"{space.small.value}"},large:{padding:"{space.large.value}"}},small:{gap:"{components.field.small.gap.value}"},large:{gap:"{components.field.large.gap.value}"}};var L6={error:{color:{value:"{colors.font.error.value}"},fontSize:{value:"{fontSizes.small.value}"}},description:{color:{value:"{colors.font.secondary.value}"},fontStyle:{value:"italic"},fontSize:{value:"{fontSizes.small.value}"}}};var B6={dropzone:{backgroundColor:{value:"{colors.background.primary}"},borderRadius:{value:"{radii.small}"},borderColor:{value:"{colors.border.primary}"},borderStyle:{value:"dashed"},borderWidth:{value:"{borderWidths.small}"},gap:{value:"{space.small}"},paddingBlock:{value:"{space.xl}"},paddingInline:{value:"{space.large}"},textAlign:{value:"center"},_active:{backgroundColor:{value:"{colors.primary.10}"},borderRadius:{value:"{components.fileuploader.dropzone.borderRadius}"},borderColor:{value:"{colors.border.pressed}"},borderStyle:{value:"{components.fileuploader.dropzone.borderStyle}"},borderWidth:{value:"{borderWidths.medium}"}},icon:{color:{value:"{colors.border.primary}"},fontSize:{value:"{fontSizes.xxl}"}},text:{color:{value:"{colors.font.tertiary}"},fontSize:{value:"{fontSizes.medium}"},fontWeight:{value:"{fontWeights.bold}"}}},file:{backgroundColor:{value:"{colors.background.primary}"},borderRadius:{value:"{radii.small}"},borderColor:{value:"{colors.border.primary}"},borderStyle:{value:"solid"},borderWidth:{value:"{borderWidths.small}"},paddingBlock:{value:"{space.xs}"},paddingInline:{value:"{space.small}"},gap:{value:"{space.small}"},alignItems:{value:"baseline"},name:{fontSize:{value:"{fontSizes.medium}"},fontWeight:{value:"{fontWeights.bold}"},color:{value:"{colors.font.primary}"}},size:{fontSize:{value:"{fontSizes.small}"},fontWeight:{value:"{fontWeights.normal}"},color:{value:"{colors.font.tertiary}"}},image:{width:{value:"{space.xxl}"},height:{value:"{space.xxl}"},backgroundColor:{value:"{colors.background.secondary}"},color:{value:"{colors.font.tertiary}"},borderRadius:{value:"{radii.small}"}}},filelist:{flexDirection:{value:"column"},gap:{value:"{space.small}"}},loader:{strokeLinecap:{value:"round"},strokeEmpty:{value:"{colors.border.secondary}"},strokeFilled:{value:"{components.loader.strokeFilled}"},strokeWidth:{value:"{borderWidths.large}"}},previewer:{backgroundColor:{value:"{colors.background.primary}"},borderColor:{value:"{colors.border.primary}"},borderStyle:{value:"solid"},borderWidth:{value:"{borderWidths.small}"},borderRadius:{value:"{radii.small}"},paddingBlock:{value:"{space.zero}"},paddingInline:{value:"{space.zero}"},maxHeight:{value:"40rem"},maxWidth:{value:"auto"},text:{fontSize:{value:"{fontSizes.medium}"},fontWeight:{value:"{fontWeights.bold}"},color:{value:"{colors.font.primary}"}},body:{paddingBlock:{value:"{space.medium}"},paddingInline:{value:"{space.medium}"},gap:{value:"{space.small}"}},footer:{justifyContent:{value:"flex-end"}}}};var U6={gap:{value:"{space.medium.value}"},justifyContent:{value:"normal"},alignItems:{value:"stretch"},alignContent:{value:"normal"},flexWrap:{value:"nowrap"}};var W6={color:{value:"{colors.font.primary.value}"},lineHeight:{value:"{lineHeights.small.value}"},1:{fontSize:{value:"{fontSizes.xxxxl.value}"},fontWeight:{value:"{fontWeights.light.value}"}},2:{fontSize:{value:"{fontSizes.xxxl.value}"},fontWeight:{value:"{fontWeights.normal.value}"}},3:{fontSize:{value:"{fontSizes.xxl.value}"},fontWeight:{value:"{fontWeights.medium.value}"}},4:{fontSize:{value:"{fontSizes.xl.value}"},fontWeight:{value:"{fontWeights.semibold.value}"}},5:{fontSize:{value:"{fontSizes.large.value}"},fontWeight:{value:"{fontWeights.bold.value}"}},6:{fontSize:{value:"{fontSizes.medium.value}"},fontWeight:{value:"{fontWeights.extrabold.value}"}}};var H6={highlighted:{fontWeight:{value:"{fontWeights.bold}"}}};var V6={lineHeight:{value:1},height:{value:"1em"}};var j6={color:{value:"{components.fieldcontrol.color.value}"},borderColor:{value:"{components.fieldcontrol.borderColor.value}"},fontSize:{value:"{components.fieldcontrol.fontSize.value}"},_focus:{borderColor:{value:"{components.fieldcontrol._focus.borderColor.value}"}}};var G6={maxWidth:{value:"100%"},height:{value:"auto"},objectFit:{value:"initial"},objectPosition:{value:"initial"}};var q6={banner:{height:{value:"150px "},width:{value:"400px "}},button:{backgroundColor:{value:"#e8e8e8"},borderRadius:{value:"5px"},color:{value:"black"}},dialog:{height:{value:"50vh"},minHeight:{value:"400px"},minWidth:{value:"400px"},width:{value:"30vw"}},header:{fontSize:{value:"{fontSizes.medium.value}"},fontWeight:{value:"{fontWeights.extrabold.value}"}}};var K6={active:{color:{value:"{colors.font.active.value}"}},color:{value:"{colors.font.interactive.value}"},focus:{color:{value:"{colors.font.focus.value}"}},hover:{color:{value:"{colors.font.hover.value}"}},visited:{color:{value:"{colors.font.interactive.value}"}}};var X6={cameraModule:{backgroundColor:{value:"{colors.background.primary.value}"}}};var Y6={width:{value:"{fontSizes.medium.value}"},height:{value:"{fontSizes.medium.value}"},fontSize:{value:"{fontSizes.xs.value}"},strokeEmpty:{value:"{colors.neutral.20.value}"},strokeFilled:{value:"{colors.primary.80.value}"},strokeLinecap:{value:"round"},animationDuration:{value:"1s"},small:{width:{value:"{fontSizes.small.value}"},height:{value:"{fontSizes.small.value}"},fontSize:{value:"{fontSizes.xxs.value}"}},large:{width:{value:"{fontSizes.large.value}"},height:{value:"{fontSizes.large.value}"},fontSize:{value:"{fontSizes.small.value}"}},linear:{width:{value:"100%"},minWidth:{value:"5rem"},fontSize:{value:"{fontSizes.xxs.value}"},strokeWidth:{value:"{fontSizes.xxs.value}"},strokeFilled:{value:"{colors.primary.80.value}"},strokeEmpty:{value:"{colors.neutral.20.value}"},strokeLinecap:{value:"round"},animationDuration:{value:"1s"},small:{strokeWidth:{value:"{fontSizes.xxxs.value}"},fontSize:{value:"{fontSizes.xxxs.value}"}},large:{strokeWidth:{value:"{fontSizes.xs.value}"},fontSize:{value:"{fontSizes.xs.value}"}}},text:{fill:{value:"{colors.font.primary.value}"}}};var Q6={backgroundColor:{value:"{colors.background.primary.value}"},borderRadius:{value:"{radii.medium.value}"},borderWidth:{value:"{borderWidths.small.value}"},borderStyle:{value:"solid"},borderColor:{value:"{colors.border.primary.value}"},boxShadow:{value:"{shadows.large.value}"},flexDirection:{value:"column"},gap:{value:"{space.zero.value}"},maxWidth:{value:"30rem"},minWidth:{value:"14rem"},small:{width:{value:"{fontSizes.medium.value}"},height:{value:"{fontSizes.medium.value}"}},large:{width:{value:"{fontSizes.xxxl.value}"},height:{value:"{fontSizes.xxxl.value}"}},item:{minHeight:{value:"2.5rem"},paddingInlineStart:{value:"{space.medium.value}"},paddingInlineEnd:{value:"{space.medium.value}"}}};var J6={alignItems:{value:"center"},backgroundColor:{value:"{colors.background.tertiary.value}"},borderColor:{value:"transparent"},borderStyle:{value:"solid"},borderWidth:{value:"{borderWidths.small.value}"},borderRadius:{value:"{radii.xs.value}"},color:{value:"{colors.font.primary.value}"},justifyContent:{value:"flex-start"},paddingBlock:{value:"{space.small.value}"},paddingInline:{value:"{space.medium.value}"},lineHeight:{value:"{lineHeights.small.value}"},icon:{size:{value:"{fontSizes.xl.value}"}},heading:{fontSize:{value:"{fontSizes.medium.value}"},fontWeight:{value:"{fontWeights.bold.value}"}},dismiss:{gap:{value:"{space.xxs.value}"}},plain:{color:{value:"{colors.font.primary.value}"},backgroundColor:{value:"{colors.background.primary.value}"},borderColor:{value:"transparent"},info:{color:{value:"{colors.font.info.value}"},backgroundColor:{value:"{colors.background.primary.value}"},borderColor:{value:"transparent"}},error:{color:{value:"{colors.font.error.value}"},backgroundColor:{value:"{colors.background.primary.value}"},borderColor:{value:"transparent"}},success:{color:{value:"{colors.font.success.value}"},backgroundColor:{value:"{colors.background.primary.value}"},borderColor:{value:"transparent"}},warning:{color:{value:"{colors.font.warning.value}"},backgroundColor:{value:"{colors.background.primary.value}"},borderColor:{value:"transparent"}}},outlined:{color:{value:"{colors.font.primary.value}"},backgroundColor:{value:"{colors.background.primary.value}"},borderColor:{value:"{colors.border.primary.value}"},info:{color:{value:"{colors.font.info.value}"},backgroundColor:{value:"{colors.background.primary.value}"},borderColor:{value:"{colors.border.info.value}"}},error:{color:{value:"{colors.font.error.value}"},backgroundColor:{value:"{colors.background.primary.value}"},borderColor:{value:"{colors.border.error.value}"}},success:{color:{value:"{colors.font.success.value}"},backgroundColor:{value:"{colors.background.primary.value}"},borderColor:{value:"{colors.border.success.value}"}},warning:{color:{value:"{colors.font.warning.value}"},backgroundColor:{value:"{colors.background.primary.value}"},borderColor:{value:"{colors.border.warning.value}"}}},filled:{color:{value:"{colors.font.primary.value}"},backgroundColor:{value:"{colors.background.secondary.value}"},borderColor:{value:"transparent"},info:{color:{value:"{colors.font.info.value}"},backgroundColor:{value:"{colors.background.info.value}"},borderColor:{value:"transparent"}},error:{color:{value:"{colors.font.error.value}"},backgroundColor:{value:"{colors.background.error.value}"},borderColor:{value:"transparent"}},success:{color:{value:"{colors.font.success.value}"},backgroundColor:{value:"{colors.background.success.value}"},borderColor:{value:"transparent"}},warning:{color:{value:"{colors.font.warning.value}"},backgroundColor:{value:"{colors.background.warning.value}"},borderColor:{value:"transparent"}}}};var Z6={current:{alignItems:{value:"center"},justifyContent:{value:"center"},color:{value:"{colors.font.inverse.value}"},fontSize:{value:"{fontSizes.small.value}"},backgroundColor:{value:"{colors.overlay.40.value}"}},button:{color:{value:"{colors.font.primary.value}"},paddingInlineStart:{value:"{space.xxs.value}"},paddingInlineEnd:{value:"{space.xxs.value}"},transitionProperty:{value:"background-color"},transitionDuration:{value:"{time.medium.value}"},hover:{backgroundColor:{value:"{colors.overlay.10.value}"},color:{value:"{colors.font.primary.value}"}},disabled:{color:{value:"{colors.font.disabled.value}"}}},ellipsis:{alignItems:{value:"baseline"},justifyContent:{value:"center"},paddingInlineStart:{value:"{space.xs.value}"},paddingInlineEnd:{value:"{space.xs.value}"}},itemContainer:{marginLeft:{value:"{space.xxxs.value}"},marginRight:{value:"{space.xxxs.value}"}},itemShared:{height:{value:"{fontSizes.xxl.value}"},minWidth:{value:"{fontSizes.xxl.value}"},borderRadius:{value:"{fontSizes.medium.value}"}}};var e5={color:{value:"{components.fieldcontrol.color.value}"},button:{color:{value:"{components.button.color.value}"},_active:{backgroundColor:{value:"{components.button._active.backgroundColor.value}"},borderColor:{value:"{components.button._active.borderColor.value}"},color:{value:"{components.button._active.color.value}"}},_disabled:{backgroundColor:{value:"{components.button._disabled.backgroundColor.value}"},borderColor:{value:"{components.button._disabled.borderColor.value}"},color:{value:"{components.button._disabled.color.value}"}},_error:{color:{value:"{components.button.outlined.error.color.value}"},backgroundColor:{value:"{components.button.outlined.error.backgroundColor.value}"},borderColor:{value:"{components.button.outlined.error.borderColor.value}"},_active:{borderColor:{value:"{components.button.outlined.error._active.borderColor.value}"},backgroundColor:{value:"{components.button.outlined.error._active.backgroundColor.value}"},color:{value:"{components.button.outlined.error._active.color.value}"}},_focus:{borderColor:{value:"{components.button.outlined.error._focus.borderColor.value}"},backgroundColor:{value:"{components.button.outlined.error._focus.backgroundColor.value}"},color:{value:"{components.button.outlined.error._focus.color.value}"},boxShadow:{value:"{components.button.outlined.error._focus.boxShadow.value}"}},_hover:{borderColor:{value:"{components.button.outlined.error._hover.borderColor.value}"},backgroundColor:{value:"{components.button.outlined.error._hover.backgroundColor.value}"},color:{value:"{components.button.outlined.error._hover.color.value}"}}},_focus:{backgroundColor:{value:"{components.button._focus.backgroundColor.value}"},borderColor:{value:"{components.button._focus.borderColor.value}"},color:{value:"{components.button._focus.color.value}"}},_hover:{backgroundColor:{value:"{components.button._hover.backgroundColor.value}"},borderColor:{value:"{components.button._hover.borderColor.value}"},color:{value:"{components.button._hover.color.value}"}}}};var t5={color:{value:"{components.fieldcontrol.color}"},borderColor:{value:"{components.fieldcontrol.borderColor}"},fontSize:{value:"{components.fieldcontrol.fontSize}"},_focus:{borderColor:{value:"{components.fieldcontrol._focus.borderColor}"}}};var r5={borderRadius:{value:"{radii.small.value}"},transitionDuration:{value:"{time.long.value}"},startColor:{value:"{colors.background.secondary.value}"},endColor:{value:"{colors.background.tertiary.value}"},small:{height:{value:"{space.small.value}"}},default:{height:{value:"{space.medium.value}"}},large:{height:{value:"{space.large.value}"}}};var o5={alignItems:{value:"center"},justifyContent:{value:"flex-start"},gap:{value:"inherit"},_disabled:{cursor:{value:"not-allowed"}},button:{alignItems:{value:"center"},justifyContent:{value:"center"},width:{value:"{fontSizes.medium.value}"},height:{value:"{fontSizes.medium.value}"},boxSizing:{value:"border-box"},borderWidth:{value:"{borderWidths.medium.value}"},borderStyle:{value:"solid"},borderRadius:{value:"50%"},borderColor:{value:"{colors.border.primary.value}"},color:{value:"{colors.background.primary.value}"},backgroundColor:{value:"{colors.background.primary.value}"},transitionProperty:{value:"all"},transitionDuration:{value:"{time.medium.value}"},outlineColor:{value:"{colors.transparent.value}"},outlineStyle:{value:"solid"},outlineWidth:{value:"{outlineWidths.medium.value}"},outlineOffset:{value:"{outlineOffsets.medium.value}"},padding:{value:"{borderWidths.medium.value}"},small:{width:{value:"{fontSizes.small.value}"},height:{value:"{fontSizes.small.value}"}},large:{width:{value:"{fontSizes.large.value}"},height:{value:"{fontSizes.large.value}"}},_checked:{color:{value:"{colors.primary.80.value}"},_disabled:{color:{value:"{colors.background.disabled.value}"}}},_focus:{borderColor:{value:"{colors.border.focus.value}"},boxShadow:{value:"{components.fieldcontrol._focus.boxShadow.value}"}},_error:{borderColor:{value:"{colors.border.error.value}"},_focus:{boxShadow:{value:"{components.fieldcontrol._error._focus.boxShadow.value}"}}},_disabled:{borderColor:{value:"{colors.border.disabled.value}"},backgroundColor:{value:"{colors.background.primary.value}"}}},label:{color:{value:"{components.text.color.value}"},_disabled:{color:{value:"{colors.font.disabled.value}"}}}};var n5={radio:{borderWidth:{value:"{components.radio.button.borderWidth}"},borderColor:{value:"{components.radio.button.borderColor}"},backgroundColor:{value:"{components.radio.button.backgroundColor}"},_checked:{color:{value:"{components.radio.button._checked.color}"}},label:{color:{value:"{components.radio.label.color}"}}},legend:{color:{value:"{components.fieldset.legend.color}"},fontWeight:{value:"{fontWeights.normal}"}}};var a5={large:{size:{value:"{fontSizes.xxxl.value}"}},default:{size:{value:"{fontSizes.xl.value}"}},small:{size:{value:"{fontSizes.small.value}"}},filled:{color:{value:"{colors.secondary.80.value}"}},empty:{color:{value:"{colors.background.tertiary.value}"}}};var i5={color:{value:"{components.fieldcontrol.color.value}"},button:{color:{value:"{components.button.color.value}"},backgroundColor:{value:"{colors.background.primary.value}"},_active:{backgroundColor:{value:"{components.button._active.backgroundColor.value}"},borderColor:{value:"{components.button._active.borderColor.value}"},color:{value:"{components.button._active.color.value}"}},_disabled:{backgroundColor:{value:"{components.button._disabled.backgroundColor.value}"},borderColor:{value:"{components.button._disabled.borderColor.value}"},color:{value:"{components.button._disabled.color.value}"}},_focus:{backgroundColor:{value:"{components.button._focus.backgroundColor.value}"},borderColor:{value:"{components.button._focus.borderColor.value}"},color:{value:"{components.button._focus.color.value}"}},_hover:{backgroundColor:{value:"{components.button._hover.backgroundColor.value}"},borderColor:{value:"{components.button._hover.borderColor.value}"},color:{value:"{components.button._hover.color.value}"}}}};var s5={color:{value:"{components.fieldcontrol.color}"},backgroundColor:{value:"{colors.background.primary.value}"},paddingInlineEnd:{value:"{space.xxl.value}"},_disabled:{color:{value:"{colors.font.disabled.value}"},backgroundColor:{value:"{colors.background.disabled.value}"}},wrapper:{flex:{value:"1"},display:{value:"block"},position:{value:"relative"},cursor:{value:"pointer"}},iconWrapper:{alignItems:{value:"center"},position:{value:"absolute"},top:{value:"50%"},right:{value:"{space.medium.value}"},transform:{value:"translateY(-50%)"},pointerEvents:{value:"none"},small:{right:{value:"{space.xs.value}"}},large:{right:{value:"{space.medium.value}"}}},option:{backgroundColor:{value:"transparent"},color:{value:"{colors.font.primary.value}"},_disabled:{color:{value:"{colors.font.disabled.value}"},backgroundColor:{value:"transparent"}}},whiteSpace:{value:"nowrap"},minWidth:{value:"6.5rem"},small:{minWidth:{value:"5.5rem"},paddingInlineEnd:{value:"{space.xl.value}"}},large:{minWidth:{value:"7.5rem"},paddingInlineEnd:{value:"{space.xxl.value}"}},expanded:{paddingBlock:{value:"{space.xs.value}"},paddingInline:{value:"{space.small.value}"},option:{paddingBlock:{value:"{space.xs.value}"},paddingInline:{value:"{space.small.value}"}}}};var l5={borderColor:{value:"{components.fieldcontrol.borderColor}"},color:{value:"{components.fieldcontrol.color}"},flexDirection:{value:"column"},fontSize:{value:"{components.fieldcontrol.fontSize}"},_focus:{borderColor:{value:"{components.fieldcontrol._focus.borderColor}"}},label:{color:{value:"{components.field.label.color}"}}};var c5={paddingBlock:{value:"{space.xs.value}"},track:{backgroundColor:{value:"{colors.background.quaternary.value}"},borderRadius:{value:"9999px"},height:{value:"0.375rem"},minWidth:{value:"10rem"}},range:{backgroundColor:{value:"{colors.primary.80.value}"},borderRadius:{value:"9999px"},_disabled:{backgroundColor:{value:"{colors.background.disabled.value}"}}},thumb:{width:{value:"1.25rem"},height:{value:"1.25rem"},backgroundColor:{value:"{colors.background.primary.value}"},boxShadow:{value:"{shadows.small.value}"},borderRadius:{value:"50%"},borderWidth:{value:"{borderWidths.medium.value}"},borderColor:{value:"{colors.border.primary.value}"},borderStyle:{value:"solid"},_disabled:{backgroundColor:{value:"{colors.background.disabled.value}"},borderColor:{value:"transparent"},boxShadow:{value:"none"}},_hover:{backgroundColor:{value:"{colors.background.primary.value}"},borderColor:{value:"{colors.border.focus.value}"}},_focus:{borderColor:{value:"{colors.border.focus.value}"},boxShadow:{value:"{components.fieldcontrol._focus.boxShadow.value}"}}},small:{track:{height:{value:"0.25rem"}},thumb:{width:{value:"1rem"},height:{value:"1rem"}}},large:{track:{height:{value:"0.625rem"}},thumb:{width:{value:"1.5rem"},height:{value:"1.5rem"}}}};var p5={borderColor:{value:"{components.fieldcontrol.borderColor}"},flexDirection:{value:"column"},input:{color:{value:"{components.fieldcontrol.color}"},fontSize:{value:"{components.fieldcontrol.fontSize}"},textAlign:{value:"center"}},button:{color:{value:"{components.button.color}"},backgroundColor:{value:"{colors.transparent}"},_active:{color:{value:"{components.button._active.color}"},backgroundColor:{value:"{components.button._active.backgroundColor}"}},_focus:{color:{value:"{components.button._focus.color}"},backgroundColor:{value:"{components.button._focus.backgroundColor}"}},_disabled:{color:{value:"{components.button._disabled.color}"},backgroundColor:{value:"{components.fieldcontrol._disabled.backgroundColor}"}},_hover:{color:{value:"{components.button._hover.color}"},backgroundColor:{value:"{components.button._hover.backgroundColor}"}}}};var u5={dropzone:{backgroundColor:{value:"{colors.background.primary}"},borderRadius:{value:"{radii.small}"},borderColor:{value:"{colors.border.primary}"},borderStyle:{value:"dashed"},borderWidth:{value:"{borderWidths.small}"},gap:{value:"{space.small}"},paddingBlock:{value:"{space.xl}"},paddingInline:{value:"{space.large}"},textAlign:{value:"center"},_active:{backgroundColor:{value:"{colors.primary.10}"},borderRadius:{value:"{components.storagemanager.dropzone.borderRadius}"},borderColor:{value:"{colors.border.pressed}"},borderStyle:{value:"{components.storagemanager.dropzone.borderStyle}"},borderWidth:{value:"{borderWidths.medium}"}},icon:{color:{value:"{colors.border.primary}"},fontSize:{value:"{fontSizes.xxl}"}},text:{color:{value:"{colors.font.tertiary}"},fontSize:{value:"{fontSizes.medium}"},fontWeight:{value:"{fontWeights.bold}"}}},file:{backgroundColor:{value:"{colors.background.primary}"},borderRadius:{value:"{radii.small}"},borderColor:{value:"{colors.border.primary}"},borderStyle:{value:"solid"},borderWidth:{value:"{borderWidths.small}"},paddingBlock:{value:"{space.xs}"},paddingInline:{value:"{space.small}"},gap:{value:"{space.small}"},alignItems:{value:"baseline"},name:{fontSize:{value:"{fontSizes.medium}"},fontWeight:{value:"{fontWeights.bold}"},color:{value:"{colors.font.primary}"}},size:{fontSize:{value:"{fontSizes.small}"},fontWeight:{value:"{fontWeights.normal}"},color:{value:"{colors.font.tertiary}"}},image:{width:{value:"{space.xxl}"},height:{value:"{space.xxl}"},backgroundColor:{value:"{colors.background.secondary}"},color:{value:"{colors.font.tertiary}"},borderRadius:{value:"{radii.small}"}}},filelist:{flexDirection:{value:"column"},gap:{value:"{space.small}"}},loader:{strokeLinecap:{value:"round"},strokeEmpty:{value:"{colors.border.secondary}"},strokeFilled:{value:"{components.loader.strokeFilled}"},strokeWidth:{value:"{borderWidths.large}"}},previewer:{backgroundColor:{value:"{colors.background.primary}"},borderColor:{value:"{colors.border.primary}"},borderStyle:{value:"solid"},borderWidth:{value:"{borderWidths.small}"},borderRadius:{value:"{radii.small}"},paddingBlock:{value:"{space.zero}"},paddingInline:{value:"{space.zero}"},maxHeight:{value:"40rem"},maxWidth:{value:"auto"},text:{fontSize:{value:"{fontSizes.medium}"},fontWeight:{value:"{fontWeights.bold}"},color:{value:"{colors.font.primary}"}},body:{paddingBlock:{value:"{space.medium}"},paddingInline:{value:"{space.medium}"},gap:{value:"{space.small}"}},footer:{justifyContent:{value:"flex-end"}}}};var m5={_disabled:{opacity:{value:"{opacities.60.value}"}},_focused:{shadow:{value:"{components.fieldcontrol._focus.boxShadow.value}"}},fontSize:{value:"{fontSizes.medium.value}"},large:{fontSize:{value:"{fontSizes.large.value}"}},small:{fontSize:{value:"{fontSizes.small.value}"}},label:{padding:{value:"{space.xs.value}"}},thumb:{backgroundColor:{value:"{colors.background.primary.value}"},borderColor:{value:"transparent"},borderWidth:{value:"{borderWidths.small.value}"},borderStyle:{value:"solid"},borderRadius:{value:"{radii.xxxl.value}"},checked:{transform:{value:"{transforms.slideX.medium.value}"}},transition:{duration:{value:"{time.medium.value}"}},width:{value:"{space.relative.medium.value}"}},track:{backgroundColor:{value:"{colors.background.quaternary.value}"},borderRadius:{value:"{radii.xxxl.value}"},checked:{backgroundColor:{value:"{colors.primary.80.value}"}},height:{value:"{space.relative.medium.value}"},padding:{value:"{outlineWidths.medium.value}"},transition:{duration:{value:"{time.short.value}"}},width:{value:"{space.relative.xl.value}"},_error:{backgroundColor:{value:"{colors.background.error.value}"}}}};var f5={borderCollapse:{value:"collapse"},display:{value:"table"},width:{value:"100%"},head:{display:{value:"table-header-group"},verticalAlign:{value:"middle"}},body:{display:{value:"table-row-group"},verticalAlign:{value:"middle"}},foot:{display:{value:"table-footer-group"},verticalAlign:{value:"middle"}},row:{display:{value:"table-row"},verticalAlign:{value:"middle"},hover:{backgroundColor:{value:"{colors.background.tertiary.value}"}},striped:{backgroundColor:{value:"{colors.background.secondary.value}"}}},header:{borderColor:{value:"{colors.border.tertiary.value}"},borderStyle:{value:"solid"},borderWidth:{value:"{borderWidths.small.value}"},color:{value:"{colors.font.primary.value}"},display:{value:"table-cell"},fontSize:{value:"{fontSizes.medium.value}"},fontWeight:{value:"{fontWeights.bold.value}"},padding:{value:"{space.medium.value}"},verticalAlign:{value:"middle"},large:{fontSize:{value:"{fontSizes.large.value}"},padding:{value:"{space.large.value}"}},small:{fontSize:{value:"{fontSizes.small.value}"},padding:{value:"{space.xs.value}"}}},data:{borderColor:{value:"{colors.border.tertiary.value}"},borderStyle:{value:"solid"},borderWidth:{value:"{borderWidths.small.value}"},color:{value:"{colors.font.primary.value}"},display:{value:"table-cell"},fontSize:{value:"{fontSizes.medium.value}"},fontWeight:{value:"{fontWeights.normal.value}"},padding:{value:"{space.medium.value}"},verticalAlign:{value:"middle"},large:{fontSize:{value:"{fontSizes.large.value}"},padding:{value:"{space.large.value}"}},small:{fontSize:{value:"{fontSizes.small.value}"},padding:{value:"{space.xs.value}"}}},caption:{captionSide:{value:"bottom"},color:{value:"{colors.font.primary.value}"},display:{value:"table-caption"},fontSize:{value:"{fontSizes.medium.value}"},textAlign:{value:"center"},wordBreak:{value:"break-all"},large:{fontSize:{value:"{fontSizes.large.value}"}},small:{fontSize:{value:"{fontSizes.small.value}"}}}};var d5={backgroundColor:{value:"transparent"},borderColor:{value:"{colors.border.secondary.value}"},borderStyle:{value:"solid"},borderWidth:{value:"{borderWidths.medium.value}"},gap:{value:"0"},item:{backgroundColor:{value:"transparent"},borderColor:{value:"{colors.border.secondary.value}"},borderStyle:{value:"solid"},borderWidth:{value:"{borderWidths.medium.value}"},color:{value:"{colors.font.secondary.value}"},fontSize:{value:"{fontSizes.medium.value}"},fontWeight:{value:"{fontWeights.bold.value}"},paddingVertical:{value:"{space.small.value}"},paddingHorizontal:{value:"{space.medium.value}"},textAlign:{value:"center"},transitionDuration:{value:"{time.medium.value}"},_hover:{backgroundColor:{value:"transparent"},borderColor:{value:"{colors.border.focus.value}"},boxShadow:{value:"none"},color:{value:"{colors.font.hover.value}"}},_focus:{backgroundColor:{value:"transparent"},borderColor:{value:"{colors.border.focus.value}"},boxShadow:{value:{offsetX:"0px",offsetY:"0px",blurRadius:"0px",spreadRadius:"{borderWidths.medium}",color:"{colors.border.focus.value}"}},color:{value:"{colors.font.focus.value}"}},_active:{backgroundColor:{value:"transparent"},borderColor:{value:"{colors.font.interactive.value}"},boxShadow:{value:"none"},color:{value:"{colors.font.interactive.value}"}},_disabled:{backgroundColor:{value:"transparent"},borderColor:{value:"{colors.border.tertiary.value}"},boxShadow:{value:"none"},color:{value:"{colors.font.disabled.value}"}}},panel:{backgroundColor:{value:"transparent"},paddingInline:{value:"0"},paddingBlock:{value:"{space.small.value}"}}};var h5={color:{value:"{colors.font.primary.value}"},primary:{color:{value:"{colors.font.primary.value}"}},secondary:{color:{value:"{colors.font.secondary.value}"}},tertiary:{color:{value:"{colors.font.tertiary.value}"}},error:{color:{value:"{colors.font.error.value}"}},warning:{color:{value:"{colors.font.warning.value}"}},success:{color:{value:"{colors.font.success.value}"}},info:{color:{value:"{colors.font.info.value}"}}};var g5={color:{value:"{components.fieldcontrol.color.value}"},borderColor:{value:"{components.fieldcontrol.borderColor.value}"},_focus:{borderColor:{value:"{components.fieldcontrol._focus.borderColor.value}"}}};var y5={color:{value:"{components.fieldcontrol.color.value}"},borderColor:{value:"{components.fieldcontrol.borderColor.value}"},fontSize:{value:"{components.fieldcontrol.fontSize.value}"},_focus:{borderColor:{value:"{components.fieldcontrol._focus.borderColor.value}"}}};var v5={borderColor:{value:"{colors.border.primary.value}"},color:{value:"{colors.font.primary.value}"},_hover:{backgroundColor:{value:"{colors.overlay.10.value}"}},_focus:{borderColor:{value:"{colors.border.focus.value}"},color:{value:"{colors.font.primary.value}"}},_active:{backgroundColor:{value:"{colors.transparent.value}"}},_disabled:{backgroundColor:{value:"{colors.transparent.value}"},borderColor:{value:"{colors.border.disabled.value}"},color:{value:"{colors.font.disabled.value}"}},_pressed:{borderColor:{value:"{colors.border.pressed.value}"},color:{value:"{colors.font.primary.value}"},backgroundColor:{value:"{colors.overlay.20.value}"},_hover:{backgroundColor:{value:"{colors.overlay.30.value}"}}},primary:{backgroundColor:{value:"{colors.transparent.value}"},borderWidth:{value:"{borderWidths.small.value}"},_focus:{borderColor:{value:"{colors.border.focus.value}"},backgroundColor:{value:"{colors.transparent.value}"},boxShadow:{value:"{components.fieldcontrol._focus.boxShadow.value}"},color:{value:"{colors.font.primary.value}"}},_hover:{backgroundColor:{value:"{colors.overlay.10.value}"},color:{value:"{colors.font.primary.value}"}},_disabled:{borderColor:{value:"{colors.border.disabled.value}"},backgroundColor:{value:"{colors.background.disabled.value}"},color:{value:"{colors.font.disabled.value}"}},_pressed:{backgroundColor:{value:"{colors.primary.80.value}"},borderColor:{value:"{colors.primary.80.value}"},color:{value:"{colors.background.primary.value}"},_focus:{backgroundColor:{value:"{colors.border.focus.value}"},borderColor:{value:"{colors.border.focus.value}"},color:{value:"{colors.background.primary.value}"}},_hover:{borderColor:{value:"{colors.primary.60.value}"},backgroundColor:{value:"{colors.primary.60.value}"},boxShadow:{value:"{colors.primary.60.value}"},color:{value:"{colors.background.primary.value}"}}}},link:{backgroundColor:{value:"{colors.transparent.value}"},color:{value:"{colors.overlay.50.value}"},_hover:{backgroundColor:{value:"{colors.transparent.value}"},color:{value:"{colors.overlay.50.value}"}},_focus:{backgroundColor:{value:"{colors.transparent.value}"},color:{value:"{colors.overlay.50.value}"}},_disabled:{backgroundColor:{value:"{colors.transparent.value}"},color:{value:"{colors.font.disabled.value}"}},_pressed:{backgroundColor:{value:"{colors.transparent.value}"},color:{value:"{colors.overlay.90.value}"},_focus:{backgroundColor:{value:"{colors.transparent.value}"},color:{value:"{colors.overlay.90.value}"}},_hover:{color:{value:"{colors.overlay.90.value}"},backgroundColor:{value:"{colors.transparent.value}"}}}}};var b5={alignItems:{value:"center"},alignContent:{value:"center"},justifyContent:{value:"flex-start"}};var x5={accordion:M6,aiConversation:b6,alert:v6,authenticator:w6,autocomplete:x6,avatar:S6,badge:k6,breadcrumbs:_6,button:E6,card:I6,checkbox:T6,checkboxfield:C6,collection:N6,copy:A6,countrycodeselect:R6,divider:D6,dropzone:F6,field:O6,fieldcontrol:P6,fieldgroup:z6,fieldmessages:L6,fieldset:$6,fileuploader:B6,flex:U6,heading:W6,icon:V6,highlightmatch:H6,image:G6,inappmessaging:q6,input:j6,link:K6,liveness:X6,loader:Y6,menu:Q6,message:J6,pagination:Z6,passwordfield:e5,phonenumberfield:t5,placeholder:r5,radio:o5,radiogroup:n5,rating:a5,searchfield:i5,select:s5,selectfield:l5,sliderfield:c5,stepperfield:p5,storagemanager:u5,switchfield:m5,table:f5,tabs:d5,text:h5,textareafield:g5,textfield:y5,togglebutton:v5,togglebuttongroup:b5};var w5={default:{variable:{value:`'InterVariable', 'Inter var', 'Inter', -apple-system, BlinkMacSystemFont,
37
+ 'Helvetica Neue', 'Segoe UI', Oxygen, Ubuntu, Cantarell, 'Open Sans',
38
+ sans-serif`},static:{value:`'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue',
39
+ 'Segoe UI', Oxygen, Ubuntu, Cantarell, 'Open Sans', sans-serif`}}};var Ti={xxxs:{value:"0.375rem"},xxs:{value:"0.5rem"},xs:{value:"0.75rem"},small:{value:"0.875rem"},medium:{value:"1rem"},large:{value:"1.25rem"},xl:{value:"1.5rem"},xxl:{value:"2rem"},xxxl:{value:"2.5rem"},xxxxl:{value:"3rem"}};var NN={hairline:{value:100},thin:{value:200},light:{value:300},normal:{value:400},medium:{value:500},semibold:{value:600},bold:{value:700},extrabold:{value:800},black:{value:900}};var S5={small:{value:"1.25"},medium:{value:"1.5"},large:{value:"2"}};var AN={0:{value:"0"},10:{value:"0.1"},20:{value:"0.2"},30:{value:"0.3"},40:{value:"0.4"},50:{value:"0.5"},60:{value:"0.6"},70:{value:"0.7"},80:{value:"0.8"},90:{value:"0.9"},100:{value:"1"}};var k5={small:{value:"1px"},medium:{value:"2px"},large:{value:"3px"}};var _5={small:{value:"1px"},medium:{value:"2px"},large:{value:"3px"}};var RN={xs:{value:"0.125rem"},small:{value:"0.25rem"},medium:{value:"0.5rem"},large:{value:"1rem"},xl:{value:"2rem"},xxl:{value:"4rem"},xxxl:{value:"8rem"}};var E5={small:{value:{offsetX:"0px",offsetY:"2px",blurRadius:"4px",color:"{colors.shadow.tertiary.value}"}},medium:{value:{offsetX:"0px",offsetY:"2px",blurRadius:"6px",color:"{colors.shadow.secondary.value}"}},large:{value:{offsetX:"0px",offsetY:"4px",blurRadius:"12px",color:"{colors.shadow.primary.value}"}}};var Ci={zero:{value:"0"},xxxs:{value:"0.25rem"},xxs:{value:"0.375rem"},xs:{value:"0.5rem"},small:{value:"0.75rem"},medium:{value:"1rem"},large:{value:"1.5rem"},xl:{value:"2.0rem"},xxl:{value:"3.0rem"},xxxl:{value:"4.5rem"},relative:{xxxs:{value:"0.25em"},xxs:{value:"0.375em"},xs:{value:"0.5em"},small:{value:"0.75em"},medium:{value:"1em"},large:{value:"1.5em"},xl:{value:"2.0em"},xxl:{value:"3.0em"},xxxl:{value:"4.5em"},full:{value:"100%"}}};var DN={short:{value:"100ms"},medium:{value:"250ms"},long:{value:"500ms"}};var I5={slideX:{small:{value:"translateX(0.5em)"},medium:{value:"translateX(1em)"},large:{value:"translateX(2em)"}}};var T5={components:x5,borderWidths:TN,colors:CN,fonts:w5,fontSizes:Ti,fontWeights:NN,lineHeights:S5,opacities:AN,outlineOffsets:k5,outlineWidths:_5,radii:RN,shadows:E5,space:Ci,time:DN,transforms:I5},n5e={colors:CN,borderWidths:TN,fontSizes:{xxs:Ti.xxs,xs:Ti.xs,small:Ti.small,medium:Ti.medium,large:Ti.large,xl:Ti.xl,xxl:Ti.xxl,xxxl:Ti.xxxl},fontWeights:NN,opacities:AN,space:{xxs:Ci.xxxs,xs:Ci.xs,small:Ci.small,medium:Ci.medium,large:Ci.large,xl:Ci.xl,xxl:Ci.xxl,xxxl:Ci.xxxl},radii:RN,time:DN};var C5={values:{base:0,small:480,medium:768,large:992,xl:1280,xxl:1536},defaultBreakpoint:"base"};var $v={tokens:T5,breakpoints:C5,name:"default-theme"};var ON=Ie(U$(),1);var W$=/\{([^}]+)\}/g;function MN(e){let t=new RegExp(W$);if(typeof e=="string")return t.test(e);if(typeof e=="object"){let r=!1;for(let o in e)if(ga(e,o)){let n=e[o];if(MN(n)){r=!0;break}}return r}return!1}var cpe="amplify";function Bv(e){return Object.entries(e).map(([t,r])=>{let o=Ml(r)?r.toString():j$({value:r});return`${(0,ON.default)(t)}:${o}; `}).join(" ")}function Uv({path:e=[]}){return`${(0,ON.default)([cpe,...e].join(" "))}`}var ppe=["offsetX","offsetY","blurRadius","spreadRadius","color"];function j$(e){let{value:t}=e;return qn(t)?V$(t):H$(t)?ppe.map(r=>V$(H$(e)?e[r]:t[r])).join(" "):t}function Ml(e){return Gn(e)&&ga(e,"value")}function H$(e){return Gn(e)&&ga(e,"offsetX")}function V$(e){if(!e)return"";if(MN(e)){let t=e.replace(/\{|\}/g,"").replace(".value","").split(".");return`var(--${Uv({path:t})})`}return e}var PN=({token:e,path:t})=>{let r=`--${Uv({path:t})}`,{value:o}=e,n=j$(e);return{name:r,original:o,path:t,value:n,toString:()=>`var(${r})`}};function Wv({tokens:e,path:t=[],setupToken:r}){if(ga(e,"value"))return r({token:e,path:t});let o={};for(let n in e)if(ga(e,n)){let a=e[n],i=Gn(a)?a:{value:a};o[n]=Wv({tokens:i,path:t.concat(n),setupToken:r})}return o}function Zw(e,t){t=t||[];for(var r in e)ga(e,r)&&(Gn(e[r])&&"value"in e[r]?t.push(e[r]):Gn(e[r])&&Zw(e[r],t));return t}function e1(e,t,r){if(e==null)return{};var o,n,a,i,s,c,l=e[0]||{},p=1,u=e.length;for(r=r||[],typeof l!="object"&&(l={});p<u;p++)if((s=e[p])!=null){for(i in s)if(ga(s,i)&&i!=="__proto__"&&(o=l[i],a=s[i],l!==a))if(a&&(Gn(a)||(n=Array.isArray(a)))){n?(n=!1,c=o&&Array.isArray(o)?o:[]):c=o&&Gn(o)?o:{};var m=r.slice(0);m.push(i),l[i]=e1([c,a],t,m)}else a!==void 0&&(o!=null&&typeof t=="function"&&t({target:l,copy:s,path:r,key:i}),l[i]=a)}return l}function G$(e,t){return t?`${e} { ${Object.entries(t).map(([r,o])=>`--${r}:${o}; `).join(" ")}}
40
+ `:""}function Ol(e,t){let r="",{_modifiers:o={},_element:n={},_vars:a,...i}=t;if(Object.keys(i).length){let[s,c]=IN(i,l=>l.startsWith(":")||l.startsWith("["));Object.entries(s).forEach(([l,p])=>{let{_modifiers:u={},_element:m={},_vars:f,...d}=p;r+=`${e}${l} { ${Bv(d)} }
41
+ `,r+=G$(`${e}${l}`,f)}),r+=`${e} { ${Bv(c)} }
42
+ `}return r+=G$(e,a),Object.entries(o).forEach(([s,c])=>{c&&Object.keys(c).length&&(r+=Ol(`${e}--${s}`,c))}),Object.entries(n).forEach(([s,c])=>{c&&Object.keys(c).length&&(r+=Ol(`${e}__${s}`,c))}),r}function q$({theme:e,components:t}){let r="",{tokens:o,name:n,breakpoints:a}=e;return t.forEach(({name:i,theme:s,overrides:c})=>{let l=`amplify-${i}`,p=`[data-amplify-theme="${n}"] .${l}`,u=En(s)?s(o):s;r+=Ol(p,u),c&&c.forEach(m=>{let f=En(m.theme)?m.theme(o):m.theme;if("mediaQuery"in m&&(r+=`@media (${m.mediaQuery}) {
43
+ ${Ol(p,f)}
44
+ }`),"breakpoint"in m){let d=a.values[m.breakpoint];r+=`
45
+ @media (min-width: ${d}px) {
46
+ ${Ol(p,f)}
47
+ }`}"selector"in m&&(r+=Ol(`${m.selector} .${l}`,f)),"colorMode"in m&&(r+=`
48
+ @media (prefers-color-scheme: ${m.colorMode}) {
49
+ ${Ol(`[data-amplify-theme="${n}"][data-amplify-color-mode="system"] .${l}`,f)}
50
+ }
51
+ `,r+=Ol(`[data-amplify-theme="${n}"][data-amplify-color-mode="${m.colorMode}"] .${l}`,f))})}),r}function zN({keys:e,value:t}){return e.reduce((r,o)=>({...r,[o]:{value:`{colors.${t}.${o}.value}`}}),{})}function K$({animations:e,tokens:t}){let r="";return Object.entries(e).forEach(([o,n])=>{r+=`
52
+ @keyframes ${o} {`,Object.entries(n).forEach(([a,i])=>{r+=`
53
+ ${a} {
54
+ `;let s=En(i)?i(t):i;r+=Bv(s),r+=`
55
+ }`}),r+=`
56
+ }`}),r}function up(e,t=$v){let r=e1([{},t,{...e,components:{}}]),{primaryColor:o,secondaryColor:n}=r;qn(o)&&(r.tokens.colors.primary=zN({keys:Object.keys(r.tokens.colors[o]),value:o})),qn(n)&&(r.tokens.colors.secondary=zN({keys:Object.keys(r.tokens.colors[n]),value:n}));let a=Wv({tokens:r.tokens,setupToken:PN}),{breakpoints:i,name:s}=r,c=`[data-amplify-theme="${s}"] {
57
+ `+Zw(a).map(p=>`${p.name}: ${p.value};`).join(`
58
+ `)+`
59
+ }
60
+ `;e?.components&&(c+=q$({theme:{...r,tokens:a},components:e.components}));let l=[];return r.animations&&(c+=K$({animations:r.animations,tokens:a})),r.overrides&&(l=r.overrides.map(p=>{let u=Wv({tokens:p.tokens,setupToken:PN}),m=Zw(u).map(f=>`${f.name}: ${f.value};`).join(`
61
+ `);if("selector"in p&&(c+=`
62
+ ${p.selector} {
63
+ ${m}
64
+ }
65
+ `),"mediaQuery"in p&&(c+=`
66
+ @media (${p.mediaQuery}) {
67
+ [data-amplify-theme="${s}"] {
68
+ ${m}
69
+ }
70
+ }
71
+ `),"breakpoint"in p){let f=r.breakpoints.values[p.breakpoint];c+=`
72
+ @media (min-width: ${f}px) {
73
+ [data-amplify-theme="${s}"] {
74
+ ${m}
75
+ }
76
+ }
77
+ `}return"colorMode"in p&&(c+=`
78
+ @media (prefers-color-scheme: ${p.colorMode}) {
79
+ [data-amplify-theme="${s}"][data-amplify-color-mode="system"] {
80
+ ${m}
81
+ color-scheme: ${p.colorMode};
82
+ }
83
+ }
84
+ `,c+=`
85
+ [data-amplify-theme="${s}"][data-amplify-color-mode="${p.colorMode}"] {
86
+ ${m}
87
+ color-scheme: ${p.colorMode};
88
+ }
89
+ `),{...p,tokens:u}})),{tokens:a,breakpoints:i,name:s,cssText:c,containerProps:({colorMode:p}={})=>({"data-amplify-theme":s,"data-amplify-color-mode":p}),overrides:l}}var ct=(...e)=>{let t=[];for(let r of e)if(r){if(qn(r)){t.push(r);continue}if(typeof r=="number"){t.push(r.toString());continue}if(Array.isArray(r)){t.push(ct(...r));continue}if(Gn(r)){if(r.toString!==Object.prototype.toString&&r.toString()!=="[object Object]"){t.push(r.toString());continue}for(let o in r)ga(r,o)&&r[o]&&t.push(o)}}return t.join(" ")};var _e={Accordion:"amplify-accordion",AccordionItem:"amplify-accordion__item",AccordionItemTrigger:"amplify-accordion__item__trigger",AccordionItemContent:"amplify-accordion__item__content",AccordionItemIcon:"amplify-accordion__item__icon",Alert:"amplify-alert",AlertIcon:"amplify-alert__icon",AlertHeading:"amplify-alert__heading",AlertBody:"amplify-alert__body",AlertDismiss:"amplify-alert__dismiss",Autocomplete:"amplify-autocomplete",AutocompleteMenu:"amplify-autocomplete__menu",AutocompleteMenuEmpty:"amplify-autocomplete__menu--empty",AutocompleteMenuFooter:"amplify-autocomplete__menu__footer",AutocompleteMenuHeader:"amplify-autocomplete__menu__header",AutocompleteMenuLoading:"amplify-autocomplete__menu--loading",AutocompleteMenuOption:"amplify-autocomplete__menu__option",AutocompleteMenuOptions:"amplify-autocomplete__menu__options",Avatar:"amplify-avatar",AvatarIcon:"amplify-avatar__icon",AvatarImage:"amplify-avatar__image",AvatarLoader:"amplify-avatar__loader",AIConversation:"amplify-ai-conversation",AIConversationScrollView:"amplify-ai-conversation__scrollview",AIConversationAttachment:"amplify-ai-conversation__attachment",AIConversationAttachmentList:"amplify-ai-conversation__attachment__list",AIConversationAttachmentImage:"amplify-ai-conversation__attachment__image",AIConversationAttachmentName:"amplify-ai-conversation__attachment__name",AIConversationAttachmentSize:"amplify-ai-conversation__attachment__size",AIConversationAttachmentRemove:"amplify-ai-conversation__attachment__remove",AIConversationForm:"amplify-ai-conversation__form",AIConversationFormAttach:"amplify-ai-conversation__form__attach",AIConversationFormError:"amplify-ai-conversation__form__error",AIConversationFormSend:"amplify-ai-conversation__form__send",AIConversationFormField:"amplify-ai-conversation__form__field",AIConversationFormDropzone:"amplify-ai-conversation__form__dropzone",AIConversationMessage:"amplify-ai-conversation__message",AIConversationMessageAvatar:"amplify-ai-conversation__message__avatar",AIConversationMessageSender:"amplify-ai-conversation__message__sender",AIConversationMessageSenderUsername:"amplify-ai-conversation__message__sender__username",AIConversationMessageSenderTimestamp:"amplify-ai-conversation__message__sender__timestamp",AIConversationMessageBody:"amplify-ai-conversation__message__body",AIConversationMessageContent:"amplify-ai-conversation__message__content",AIConversationMessageActions:"amplify-ai-conversation__message__actions",AIConversationMessageList:"amplify-ai-conversation__message__list",AIConversationPrompt:"amplify-ai-conversation__prompt",Badge:"amplify-badge",Breadcrumbs:"amplify-breadcrumbs",BreadcrumbsList:"amplify-breadcrumbs__list",BreadcrumbsItem:"amplify-breadcrumbs__item",BreadcrumbsSeparator:"amplify-breadcrumbs__separator",BreadcrumbsLink:"amplify-breadcrumbs__link",Button:"amplify-button",ButtonGroup:"amplify-buttongroup",ButtonLoaderWrapper:"amplify-button__loader-wrapper",Card:"amplify-card",Checkbox:"amplify-checkbox",CheckboxButton:"amplify-checkbox__button",CheckboxIcon:"amplify-checkbox__icon",CheckboxInput:"amplify-checkbox__input",CheckboxLabel:"amplify-checkbox__label",CheckboxField:"amplify-checkboxfield",Collection:"amplify-collection",CollectionItems:"amplify-collection-items",CollectionSearch:"amplify-collection-search",CollectionPagination:"amplify-collection-pagination",CountryCodeSelect:"amplify-countrycodeselect",DialCodeSelect:"amplify-dialcodeselect",Divider:"amplify-divider",DividerLabel:"amplify-divider--label",DropZone:"amplify-dropzone",Field:"amplify-field",FieldDescription:"amplify-field__description",FieldErrorMessage:"amplify-field__error-message",FieldGroup:"amplify-field-group",FieldGroupControl:"amplify-field-group__control",FieldGroupOuterEnd:"amplify-field-group__outer-end",FieldGroupOuterStart:"amplify-field-group__outer-start",FieldGroupInnerEnd:"amplify-field-group__inner-end",FieldGroupInnerStart:"amplify-field-group__inner-start",FieldGroupIcon:"amplify-field-group__icon",FieldGroupIconButton:"amplify-field-group__icon-button",FieldGroupHasInnerEnd:"amplify-field-group--has-inner-end",FieldGroupHasInnerStart:"amplify-field-group--has-inner-start",FieldShowPassword:"amplify-field__show-password",FieldGroupFieldWrapper:"amplify-field-group__field-wrapper",Fieldset:"amplify-fieldset",FieldsetLegend:"amplify-fieldset__legend",FileUploader:"amplify-fileuploader",FileUploaderDropZone:"amplify-fileuploader__dropzone",FileUploaderDropZoneIcon:"amplify-fileuploader__dropzone__icon",FileUploaderDropZoneText:"amplify-fileuploader__dropzone__text",FileUploaderFilePicker:"amplify-fileuploader__file__picker",FileUploaderFile:"amplify-fileuploader__file",FileUploaderFileWrapper:"amplify-fileuploader__file__wrapper",FileUploaderFileList:"amplify-fileuploader__file__list",FileUploaderFileName:"amplify-fileuploader__file__name",FileUploaderFileSize:"amplify-fileuploader__file__size",FileUploaderFileInfo:"amplify-fileuploader__file__info",FileUploaderFileImage:"amplify-fileuploader__file__image",FileUploaderFileMain:"amplify-fileuploader__file__main",FileUploaderFileStatus:"amplify-fileuploader__file__status",FileUploaderLoader:"amplify-fileuploader__loader",FileUploaderPreviewer:"amplify-fileuploader__previewer",FileUploaderPreviewerText:"amplify-fileuploader__previewer__text",FileUploaderPreviewerActions:"amplify-fileuploader__previewer__actions",FileUploaderPreviewerFooter:"amplify-fileuploader__previewer__footer",Flex:"amplify-flex",Grid:"amplify-grid",Heading:"amplify-heading",HighlightMatch:"amplify-highlightmatch",HighlightMatchHighlighted:"amplify-highlightmatch__highlighted",Icon:"amplify-icon",Image:"amplify-image",Input:"amplify-input",Label:"amplify-label",Link:"amplify-link",Loader:"amplify-loader",LoaderLabel:"amplify-loader__label",MenuContent:"amplify-menu__content",MenuItem:"amplify-menu__content__item",MenuTrigger:"amplify-menu__trigger",MenuWrapper:"amplify-menu__wrapper",Message:"amplify-message",MessageIcon:"amplify-message__icon",MessageHeading:"amplify-message__heading",MessageBody:"amplify-message__body",MessageContent:"amplify-message__content",MessageDismiss:"amplify-message__dismiss",Pagination:"amplify-pagination",PaginationItem:"amplify-pagination__item",PasswordField:"amplify-passwordfield",PhoneNumberField:"amplify-phonenumberfield",Placeholder:"amplify-placeholder",Radio:"amplify-radio",RadioButton:"amplify-radio__button",RadioInput:"amplify-radio__input",RadioLabel:"amplify-radio__label",RadioGroupField:"amplify-radiogroupfield",RadioGroup:"amplify-radiogroup",Rating:"amplify-rating",RatingItem:"amplify-rating__item",RatingIcon:"amplify-rating__icon",RatingLabel:"amplify-rating__label",ScrollView:"amplify-scrollview",SearchField:"amplify-searchfield",SearchFieldClear:"amplify-searchfield__clear",SearchFieldSearch:"amplify-searchfield__search",Select:"amplify-select",SelectField:"amplify-selectfield",SelectWrapper:"amplify-select__wrapper",SelectIcon:"amplify-select__icon",SliderField:"amplify-sliderfield",SliderFieldGroup:"amplify-sliderfield__group",SliderFieldLabel:"amplify-sliderfield__label",SliderFieldRange:"amplify-sliderfield__range",SliderFieldRoot:"amplify-sliderfield__root",SliderFieldThumb:"amplify-sliderfield__thumb",SliderFieldTrack:"amplify-sliderfield__track",StepperField:"amplify-stepperfield",StepperFieldButtonDecrease:"amplify-stepperfield__button--decrease",StepperFieldButtonIncrease:"amplify-stepperfield__button--increase",StepperFieldInput:"amplify-stepperfield__input",StorageImage:"amplify-storageimage",StorageManager:"amplify-storagemanager",StorageManagerDropZone:"amplify-storagemanager__dropzone",StorageManagerDropZoneIcon:"amplify-storagemanager__dropzone__icon",StorageManagerDropZoneText:"amplify-storagemanager__dropzone__text",StorageManagerFilePicker:"amplify-storagemanager__file__picker",StorageManagerFile:"amplify-storagemanager__file",StorageManagerFileWrapper:"amplify-storagemanager__file__wrapper",StorageManagerFileList:"amplify-storagemanager__file__list",StorageManagerFileName:"amplify-storagemanager__file__name",StorageManagerFileSize:"amplify-storagemanager__file__size",StorageManagerFileInfo:"amplify-storagemanager__file__info",StorageManagerFileImage:"amplify-storagemanager__file__image",StorageManagerFileMain:"amplify-storagemanager__file__main",StorageManagerFileStatus:"amplify-storagemanager__file__status",StorageManagerLoader:"amplify-storagemanager__loader",StorageManagerPreviewer:"amplify-storagemanager__previewer",StorageManagerPreviewerText:"amplify-storagemanager__previewer__text",StorageManagerPreviewerActions:"amplify-storagemanager__previewer__actions",StorageManagerPreviewerFooter:"amplify-storagemanager__previewer__footer",SwitchField:"amplify-switchfield",SwitchLabel:"amplify-switch__label",SwitchThumb:"amplify-switch__thumb",SwitchTrack:"amplify-switch__track",SwitchWrapper:"amplify-switch__wrapper",Table:"amplify-table",TableCaption:"amplify-table__caption",TableBody:"amplify-table__body",TableTd:"amplify-table__td",TableTh:"amplify-table__th",TableFoot:"amplify-table__foot",TableHead:"amplify-table__head",TableRow:"amplify-table__row",Tabs:"amplify-tabs",TabsList:"amplify-tabs__list",TabsItem:"amplify-tabs__item",TabsPanel:"amplify-tabs__panel",Text:"amplify-text",Textarea:"amplify-textarea",TextAreaField:"amplify-textareafield",TextField:"amplify-textfield",ToggleButton:"amplify-togglebutton",ToggleButtonGroup:"amplify-togglebuttongroup",VisuallyHidden:"amplify-visually-hidden"};var X$=Ie(Me(),1);var Hv=X$.createContext({theme:up(),colorMode:void 0});var Hd=Ie(Me(),1);var r1=Ie(Me(),1);var o8=Ie(Me(),1);var HN=Ie(Me(),1);var Ud={alignContent:"alignContent",alignItems:"alignItems",alignSelf:"alignSelf",area:"gridArea",aspectRatio:"aspectRatio",autoColumns:"gridAutoColumns",autoFlow:"gridAutoFlow",autoRows:"gridAutoRows",backgroundColor:"backgroundColor",backgroundImage:"backgroundImage",basis:"flexBasis",border:"border",borderRadius:"borderRadius",borderColor:"borderColor",borderWidth:"borderWidth",borderStyle:"borderStyle",bottom:"bottom",boxShadow:"boxShadow",color:"color",column:"gridColumn",columnEnd:"gridColumnEnd",columnGap:"columnGap",columnSpan:"gridColumn",columnStart:"gridColumnStart",direction:"flexDirection",display:"display",flex:"flex",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",gap:"gap",grow:"flexGrow",height:"height",justifyContent:"justifyContent",left:"left",letterSpacing:"letterSpacing",lineHeight:"lineHeight",margin:"margin",marginBlock:"marginBlock",marginBlockEnd:"marginBlockEnd",marginBlockStart:"marginBlockStart",marginBottom:"marginBlockEnd",marginInline:"marginInline",marginInlineEnd:"marginInlineEnd",marginInlineStart:"marginInlineStart",marginLeft:"marginInlineStart",marginRight:"marginInlineEnd",marginTop:"marginBlockStart",maxHeight:"maxHeight",maxWidth:"maxWidth",minHeight:"minHeight",minWidth:"minWidth",objectFit:"objectFit",objectPosition:"objectPosition",opacity:"opacity",order:"order",overflow:"overflow",padding:"padding",paddingBlock:"paddingBlock",paddingBlockEnd:"paddingBlockEnd",paddingBlockStart:"paddingBlockStart",paddingBottom:"paddingBlockEnd",paddingInline:"paddingInline",paddingInlineEnd:"paddingInlineEnd",paddingInlineStart:"paddingInlineStart",paddingLeft:"paddingInlineStart",paddingRight:"paddingInlineEnd",paddingTop:"paddingBlockStart",position:"position",resize:"resize",right:"right",row:"gridRow",rowEnd:"gridRowEnd",rowGap:"rowGap",rowSpan:"gridRow",rowStart:"gridRowStart",shrink:"flexShrink",templateAreas:"gridTemplateAreas",templateColumns:"gridTemplateColumns",templateRows:"gridTemplateRows",textAlign:"textAlign",textDecoration:"textDecoration",textTransform:"textTransform",top:"top",transform:"transform",transformOrigin:"transformOrigin",width:"width",whiteSpace:"whiteSpace",wrap:"flexWrap"},E$e=Object.keys(Ud);var Vv={backgroundColor:"colors",borderColor:"colors",borderWidth:"borderWidths",color:"colors",borderRadius:"radii",fontSize:"fontSizes",fontWeight:"fontWeights",fontFamily:"fonts",lineHeight:"lineHeights",opacity:"opacities",boxShadow:"shadows",transform:"transforms",left:"space",right:"space",top:"space",bottom:"space",height:"space",width:"space",letterSpacing:"space",margin:"space",marginBlock:"space",marginBlockEnd:"space",marginBlockStart:"space",marginInline:"space",marginInlineEnd:"space",marginInlineStart:"space",marginLeft:"space",marginRight:"space",marginTop:"space",marginBottom:"space",maxHeight:"space",maxWidth:"space",minHeight:"space",minWidth:"space",padding:"space",paddingBlock:"space",paddingBlockEnd:"space",paddingBlockStart:"space",paddingInline:"space",paddingInlineEnd:"space",paddingInlineStart:"space",paddingLeft:"space",paddingRight:"space",paddingTop:"space",paddingBottom:"space",gap:"space",columnGap:"space",rowGap:"space"};var Y$=e=>e in Vv;var $N=e=>typeof e=="string"&&e.length===0,LN=e=>e==null||$N(e);var Wd=e=>Object.keys(e),jv=(e,t,r)=>{if(typeof t!="string")return t;if(t.includes(" "))return t.split(" ").map(o=>jv(e,o,r)).join(" ");if(Y$(e)){let o=t.split("."),n=Vv[e],a=r[n];for(let i=0;i<o.length;i++){if(a){a=a[o[i]];continue}break}return Ml(a)?`var(--${Uv({path:[Vv[e],...o]})})`:t}return t};var upe=({breakpoint:e,breakpoints:t,values:r})=>{let o=r[e];if(o!==void 0)return o;let n=Wd(t).sort((i,s)=>t[s]-t[i]),a=n.slice(n.indexOf(e));for(let i of a){let s=r[i];if(s!==void 0)return s}return null},mpe=e=>Wd(e).reduce((t,r)=>r in $v.breakpoints.values?{...t,[r]:e[r]}:t,{}),Q$=({breakpoint:e,breakpoints:t,values:r})=>{let o={},n=Wd(t).sort((a,i)=>t[a]-t[i]);return Array.isArray(r)?r.forEach((a,i)=>{o[n[i]]=a}):typeof r=="object"&&(o=mpe(r)),upe({breakpoint:e,breakpoints:t,values:o})};var va=Ie(Me(),1);var J$=({breakpoints:e})=>{let t=Wd(e).sort((r,o)=>e[o]-e[r]);return t.map((r,o)=>{let n="",a=e[r],i=t[o-1],s=i?e[i]-1:null;return a>=0&&(n=`(min-width: ${a}px)`),s!==null&&(n&&(n+=" and "),n+=`(max-width: ${s}px)`),{breakpoint:r,query:n,maxWidth:s,minWidth:a}})};var fpe=typeof window>"u"?va.useEffect:va.useLayoutEffect,t1=({breakpoints:e,defaultBreakpoint:t})=>{let o=typeof window<"u"&&typeof window.matchMedia<"u"?window.matchMedia:null,n=va.useMemo(()=>J$({breakpoints:e}),[e]),[a,i]=va.useState(t),s=va.useCallback((c,l)=>{c&&i(l)},[i]);return fpe(()=>{if(!o)return;let c=n.map(({query:l,breakpoint:p})=>{let u=o(l);s(u.matches,p);let m=f=>{f.matches&&i(p)};return u.addEventListener("change",m),()=>u.removeEventListener("change",m)});return()=>{c.forEach(l=>l())}},[e,i,o,n]),va.useDebugValue(a,c=>c),a};var BN=Ie(Me(),1);var dpe=e=>typeof e>"u"||typeof e.theme>"u"?up():e.theme,mp=()=>{let e=BN.useContext(Hv);return dpe(e)},UN=()=>BN.useContext(Hv).colorMode;var Z$=({value:e,propKey:t,tokens:r})=>Ml(e)?e.toString():qn(e)?qn(t)?jv(t,e,r):e:null;var hpe=e=>e==="auto"||typeof e=="number"&&!isNaN(e)||typeof e=="string"&&!isNaN(parseFloat(e)),WN=e=>e==="auto"?"auto":`span ${e}`,e8=e=>hpe(e)?WN(e):Array.isArray(e)?e.map(t=>WN(t)):typeof e=="object"&&e!=null?Object.entries(e).reduce((t,[r,o])=>({...t,[r]:WN(o)}),{}):null,gpe=e=>{let{rowSpan:t,columnSpan:r,row:o,column:n,...a}=e,{rowFromSpanValue:i,columnFromSpanValue:s}=HN.useMemo(()=>({rowFromSpanValue:e8(t),columnFromSpanValue:e8(r)}),[t,r]);return{row:LN(o)?i:o,column:LN(n)?s:n,...a}},ype=e=>e in Ud,vpe=({props:e={},style:t={},breakpoint:r,breakpoints:o,tokens:n})=>{let a={};return Object.keys(e).filter(i=>e[i]!==null).forEach(i=>{if(ype(i)){let s=e[i];if(s==null||$N(s))return;let c=Ud[i],l="";Ml(s)?l=s.toString():typeof s=="string"?l=jv(i,s,n):typeof s=="number"?l=s:typeof s=="object"&&(l=Z$({propKey:i,tokens:n,value:Q$({values:s,breakpoint:r,breakpoints:o})})),t={...t,[c]:l}}else typeof e[i]<"u"&&(a[i]=e[i])}),{propStyles:t,nonStyleProps:a}},t8=(e,t)=>{let{breakpoints:{values:r,defaultBreakpoint:o},tokens:n}=mp(),a=t1({breakpoints:r,defaultBreakpoint:o}),i=gpe(e);return HN.useMemo(()=>vpe({props:i,style:t,breakpoint:a,breakpoints:r,tokens:n}),[i,t,r,a,n])};var r8=Ie(Me(),1),Yr=e=>r8.forwardRef(e);var bpe=({as:e="div",children:t,testId:r,ariaLabel:o,isDisabled:n,style:a,inert:i,...s},c)=>{let{propStyles:l,nonStyleProps:p}=t8(s,a);return o8.createElement(e,{"aria-label":o,"data-testid":r,disabled:n,ref:c,inert:i?"":null,style:l,...p},t)},Ue=Yr(bpe);Ue.displayName="View";var Gv={minX:0,minY:0,width:24,height:24},xpe=({className:e,as:t="svg",fill:r="currentColor",pathData:o,viewBox:n=Gv,children:a,paths:i,...s},c)=>{let l=n.minX??Gv.minX,p=n.minY??Gv.minY,u=n.width??Gv.width,m=n.height??Gv.height,f;return a&&(f=a),i&&(f=i.map((d,h)=>r1.createElement("path",{...d,key:h}))),o&&(f=r1.createElement("path",{d:o,fill:r})),r1.createElement(Ue,{as:t,className:ct(_e.Icon,e),ref:c,viewBox:`${l} ${p} ${u} ${m}`,...s},f)},o1=Yr(xpe);o1.displayName="Icon";var n8=Ie(Me(),1),a8=n8.createContext({});var i8=Ie(Me(),1);function n1(e){let t=i8.useContext(a8);if(e&&t)return t[e]}var a1=Ie(Me(),1);var s8=e=>{let{className:t,...r}=e;return a1.createElement(Ue,{as:"span",width:"1em",height:"1em",className:ct(_e.Icon,t),...r},a1.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a1.createElement("path",{d:"M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM12 20C7.59 20 4 16.41 4 12C4 7.59 7.59 4 12 4C16.41 4 20 7.59 20 12C20 16.41 16.41 20 12 20ZM16.59 7.58L10 14.17L7.41 11.59L6 13L10 17L18 9L16.59 7.58Z",fill:"currentColor"})))};var i1=Ie(Me(),1);var l8=e=>{let{className:t,...r}=e;return i1.createElement(Ue,{as:"span",width:"1em",height:"1em",className:ct(_e.Icon,t),...r},i1.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i1.createElement("path",{d:"M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM13 17H11V15H13V17ZM13 13H11V7H13V13Z",fill:"currentColor"})))};var s1=Ie(Me(),1);var c8=e=>{let{className:t,...r}=e;return s1.createElement(Ue,{as:"span",width:"1em",height:"1em",className:ct(_e.Icon,t),...r},s1.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s1.createElement("path",{d:"M11 7H13V9H11V7ZM11 11H13V17H11V11ZM12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM12 20C7.59 20 4 16.41 4 12C4 7.59 7.59 4 12 4C16.41 4 20 7.59 20 12C20 16.41 16.41 20 12 20Z",fill:"currentColor"})))};var l1=Ie(Me(),1);var p8=e=>{let{className:t,...r}=e;return l1.createElement(Ue,{as:"span",width:"1em",height:"1em",className:ct(_e.Icon,t),...r},l1.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l1.createElement("path",{d:"M1 21H23L12 2L1 21ZM13 18H11V16H13V18ZM13 14H11V10H13V14Z",fill:"currentColor"})))};var Vd=({variation:e,ariaHidden:t,ariaLabel:r,role:o})=>{let n=n1("alert"),a;switch(e){case"info":a=n?.info??Hd.createElement(c8,{"aria-hidden":t,"aria-label":r,role:o});break;case"error":a=n?.error??Hd.createElement(l8,{"aria-hidden":t,"aria-label":r,role:o});break;case"warning":a=n?.warning??Hd.createElement(p8,{"aria-hidden":t,"aria-label":r,role:o});break;case"success":a=n?.success??Hd.createElement(s8,{"aria-hidden":t,"aria-label":r,role:o});break}return a?Hd.createElement("span",{className:_e.AlertIcon},a):null};Vd.displayName="AlertIcon";var c1=Ie(Me(),1);var u8=Ie(Me(),1),m8=globalThis?.document?u8.useLayoutEffect:()=>{};var wpe="amplify-id",Spe=c1.useId||(()=>{}),kpe=0,VN=e=>{let[t,r]=c1.useState(Spe());return m8(()=>{e||r(o=>o??String(kpe++))},[e]),e??(t?`${wpe}-${t}`:"")};var f1=Ie(Me(),1);var p1=Ie(Me(),1),_pe=p1.createContext({isFieldsetDisabled:!1}),u1=e=>{let r=p1.useContext(_pe).isFieldsetDisabled;return(r===void 0||r===!1)&&(r=e),{isFieldsetDisabled:r}};var f8=Ie(Me(),1);var Epe=({className:e,children:t,...r},o)=>f8.createElement(Ue,{className:ct(_e.Flex,e),ref:o,...r},t),rt=Yr(Epe);rt.displayName="Flex";var Ni=Ie(Me(),1);var Ipe="linear-empty",Tpe="linear-filled",Cpe="circular-empty",Npe="circular-filled",d8=8,jN=42,m1=2*jN*Math.PI,Ape=({className:e,filledColor:t,emptyColor:r,size:o,variation:n,isDeterminate:a=!1,isPercentageTextHidden:i=!1,percentage:s=0,...c},l)=>{s=Math.min(s,100),s=Math.max(s,0);let p=`${s}%`,u=ct(_e.Loader,$o(_e.Loader,o),$o(_e.Loader,n),ya(_e.Loader,"determinate",a),e),m=Ni.createElement("g",null,Ni.createElement("line",{x1:"0",x2:"100%",y1:"50%",y2:"50%",style:{stroke:String(r)},"data-testid":Ipe}),Ni.createElement("line",{x1:"0",x2:a?p:"100%",y1:"50%",y2:"50%",style:{stroke:a&&s===0?"none":t?String(t):void 0},"data-testid":Tpe}),a?Ni.createElement("text",{"aria-live":"polite",className:ct(_e.LoaderLabel,i?_e.VisuallyHidden:null),x:`${-1+s}%`,y:"200%"},p):null),f=Ni.createElement("g",null,Ni.createElement("circle",{cx:"50%",cy:"50%",r:`${jN}%`,strokeWidth:`${d8}%`,style:{stroke:String(r)},"data-testid":Cpe}),Ni.createElement("circle",{cx:"50%",cy:"50%",r:`${jN}%`,strokeWidth:`${d8}%`,style:{stroke:String(t),strokeDasharray:a?`${m1}% ${m1}%`:void 0,strokeDashoffset:a?`${m1-m1*s/100}%`:void 0},"data-testid":Npe}),a?Ni.createElement("text",{"aria-live":"polite",className:ct(_e.LoaderLabel,i?_e.VisuallyHidden:null),x:"130%",y:"80%"},p):null);return Ni.createElement(Ue,{as:"svg","aria-valuenow":a?s:void 0,className:u,ref:l,role:"progressbar",...c},n==="linear"?m:f)},ks=Yr(Ape);ks.displayName="Loader";var Rpe=["link","primary",void 0],Dpe=({className:e,children:t,colorTheme:r,isFullWidth:o=!1,isDisabled:n,isLoading:a,loadingText:i="",size:s,type:c="button",variation:l,...p},u)=>{let m=Rpe.includes(l)&&r?`${l??"outlined"}--${r}`:void 0,{isFieldsetDisabled:f}=u1(n??a??p.disabled),d=ct(_e.Button,_e.FieldGroupControl,$o(_e.Button,l),$o(_e.Button,m),$o(_e.Button,s),ya(_e.Button,"disabled",f),ya(_e.Button,"loading",a),ya(_e.Button,"fullwidth",o),e);return f1.createElement(Ue,{ref:u,as:"button",className:d,isDisabled:f,type:c,...p},a?f1.createElement(rt,{as:"span",className:_e.ButtonLoaderWrapper},f1.createElement(ks,{size:s}),i||null):t)},In=Yr(Dpe);In.displayName="Button";var d1=Ie(Me(),1);var GN=e=>{let{className:t,size:r,...o}=e;return d1.createElement(Ue,{as:"span",width:r??"1em",height:r??"1em",className:ct(_e.Icon,t),...o},d1.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:r?{width:r,height:r}:void 0},d1.createElement("path",{d:"M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12L19 6.41Z",fill:"currentColor"})))};var g8=Ie(Me(),1);var h8=Ie(Me(),1);var Fpe=({as:e="p",className:t,children:r,isTruncated:o,variation:n,...a},i)=>{let s=ct(_e.Text,$o(_e.Text,n),ya(_e.Text,"truncated",o),t);return h8.createElement(Ue,{as:e,className:s,ref:i,...a},r)},Qr=Yr(Fpe);Qr.displayName="Text";var Mpe="qa-field-description",qN=({descriptiveText:e,labelHidden:t,...r})=>e?g8.createElement(Qr,{"data-testid":Mpe,className:ct(_e.FieldDescription,{[_e.VisuallyHidden]:t}),...r},e):null;qN.displayName="FieldDescription";var y8=Ie(Me(),1);var KN=({errorMessage:e,hasError:t,...r})=>t&&e?y8.createElement(Qr,{className:_e.FieldErrorMessage,...r},e):null;KN.displayName="FieldErrorMessage";var v8=Ie(Me(),1);var Ope=({children:e,className:t,visuallyHidden:r,...o},n)=>v8.createElement(Ue,{as:"label",className:ct(_e.Label,t,{[_e.VisuallyHidden]:r}),ref:n,...o},e),jd=Yr(Ope);jd.displayName="Label";var XN=(e,t)=>e&&t?`${e}-${t}`:void 0;var Ppe=e=>e in Ud,b8=e=>{let t={styleProps:{},rest:{}};return Object.keys(e).forEach(r=>{Ppe(r)?t.styleProps={...t.styleProps,[r]:e[r]}:t.rest={...t.rest,[r]:e[r]}}),t};var x8=e=>{let t=e.filter(r=>r!==void 0).join(" ");return t.length>0?t:void 0};typeof Symbol<"u"&&En(Symbol.for)&&Symbol.for("amplify_default");var w8="error",S8="description";var k8=Ie(Me(),1);var zpe=({as:e="span",children:t,className:r,...o},n)=>k8.createElement(Ue,{as:e,className:ct(_e.VisuallyHidden,r),ref:n,...o},t),Gd=Yr(zpe);Gd.displayName="VisuallyHidden";var h1=Ie(Me(),1);var _8=e=>{let{className:t,...r}=e;return h1.createElement(Ue,{as:"span",width:"1em",height:"1em",className:ct(_e.Icon,t),...r},h1.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},h1.createElement("path",{d:"M16.59 8.58984L12 13.1698L7.41 8.58984L6 9.99984L12 15.9998L18 9.99984L16.59 8.58984Z",fill:"currentColor"})))};var YN=Ie(Me(),1),C8=Ie(y1(),1),Vpe=YN.createContext(void 0),N8=e=>{let{dir:t,children:r}=e;return(0,C8.jsx)(Vpe.Provider,{value:t,children:r})};var fp=Ie(Me(),1);var qd=Ie(Me(),1);var jpe=({autoComplete:e,className:t,size:r,variation:o,value:n,defaultValue:a,hasError:i,icon:s,iconColor:c,children:l,placeholder:p,isDisabled:u,isRequired:m,isMultiple:f=!1,selectSize:d=1,...h},y)=>{let g="",b=n===void 0&&a===void 0&&p,x=f||d>1,w=ct(_e.Select,_e.FieldGroupControl,$o(_e.Select,r),$o(_e.Select,o),ya(_e.Select,"error",i),ya(_e.Select,"expanded",x),t),I=n1("select"),{isFieldsetDisabled:C}=u1(u);return qd.createElement(Ue,{className:_e.SelectWrapper},qd.createElement(Ue,{"aria-invalid":i,as:"select",autoComplete:e,value:n,defaultValue:b?g:a,isDisabled:C,multiple:f,size:d,required:m,className:w,ref:y,...h},p&&qd.createElement("option",{value:""},p),l),x?null:qd.createElement(rt,{className:ct(_e.SelectIcon,$o(_e.SelectIcon,r)),color:c,"aria-hidden":"true"},s??I?.expand??qd.createElement(_8,null)))},QN=Yr(jpe);QN.displayName="Select";var Gpe=({children:e,options:t})=>e?(t?.length&&console.warn("Amplify UI: <SelectField> component defaults to rendering children over `options`. When using the `options` prop, omit children."),e):t?.map((r,o)=>fp.createElement("option",{label:r,value:r,key:`${r}-${o}`},r)),qpe=(e,t)=>{let{children:r,className:o,descriptiveText:n,errorMessage:a,hasError:i=!1,id:s,label:c,labelHidden:l=!1,options:p,size:u,testId:m,inputStyles:f,...d}=e,h=VN(s),y=VN(),g=n?XN(y,S8):void 0,b=i?XN(y,w8):void 0,x=x8([b,g]),{styleProps:w,rest:I}=b8(d);return fp.createElement(rt,{className:ct(_e.Field,$o(_e.Field,u),_e.SelectField,o),testId:m,...w},fp.createElement(jd,{htmlFor:h,visuallyHidden:l},c),fp.createElement(qN,{id:g,labelHidden:l,descriptiveText:n}),fp.createElement(QN,{"aria-describedby":x,hasError:i,id:h,ref:t,size:u,...I,...f},Gpe({children:r,options:p})),fp.createElement(KN,{id:b,hasError:i,errorMessage:a}))},v1=Yr(qpe);v1.displayName="SelectField";var dp=Ie(Me(),1);var R8=Ie(Me(),1);var A8=Ie(Me(),1),JN=({cssText:e,...t})=>e===void 0||/<\/style/i.test(e)?null:A8.createElement("style",{...t,dangerouslySetInnerHTML:{__html:e}});JN.displayName="Style";var ZN=({theme:e,...t})=>{if(!e)return null;let{name:r,cssText:o}=e;return R8.createElement(JN,{...t,cssText:o,id:`amplify-theme-${r}`})};ZN.displayName="ThemeStyle";function e3({children:e,colorMode:t,direction:r="ltr",nonce:o,theme:n}){let a=dp.useMemo(()=>({theme:up(n),colorMode:t}),[n,t]);return dp.createElement(Hv.Provider,{value:a},dp.createElement(N8,{dir:r},dp.createElement("div",{"data-amplify-theme":a.theme.name,"data-amplify-color-mode":t,dir:r},e),n?dp.createElement(ZN,{theme:a.theme,nonce:o}):null))}var af=Ie(Me(),1);var ti;(function(e){e.DARK="dark",e.BRIGHT="bright",e.NORMAL="normal"})(ti||(ti={}));var It;(function(e){e.MATCHED="MATCHED",e.TOO_FAR="TOO FAR",e.CANT_IDENTIFY="CANNOT IDENTIFY",e.FACE_IDENTIFIED="ONE FACE IDENTIFIED",e.TOO_MANY="TOO MANY FACES",e.OFF_CENTER="OFF CENTER"})(It||(It={}));var Wt={CONNECTION_TIMEOUT:"CONNECTION_TIMEOUT",TIMEOUT:"TIMEOUT",RUNTIME_ERROR:"RUNTIME_ERROR",SERVER_ERROR:"SERVER_ERROR",CAMERA_FRAMERATE_ERROR:"CAMERA_FRAMERATE_ERROR",CAMERA_ACCESS_ERROR:"CAMERA_ACCESS_ERROR",FACE_DISTANCE_ERROR:"FACE_DISTANCE_ERROR",MOBILE_LANDSCAPE_ERROR:"MOBILE_LANDSCAPE_ERROR",MULTIPLE_FACES_ERROR:"MULTIPLE_FACES_ERROR",DEFAULT_CAMERA_NOT_FOUND_ERROR:"DEFAULT_CAMERA_NOT_FOUND_ERROR"};var Pl={SUCCESS_CODE:1e3,DEFAULT_ERROR_CODE:4e3,FACE_FIT_TIMEOUT:4001,USER_CANCEL:4003,RUNTIME_ERROR:4005,USER_ERROR_DURING_CONNECTION:4007},D8=1e3,F8=10,M8=299,O8=1e4,qv={type:"FaceMovementAndLightChallenge",version:"2.0.0"},hp={type:"FaceMovementChallenge",version:"1.0.0"},Kpe=[qv,hp],P8=Kpe.map(e=>`${e.type}_${e.version}`).join(",");function $8(e,t,r){return e*(r-t)+t}function b1(e){let t=e.flippedCenterX-e.width/2,r=e.flippedCenterX+e.width/2,o=e.centerY-e.height/2,n=e.centerY+e.height/2;return{ovalBoundingBox:{left:t,top:o,right:r,bottom:n},minOvalX:t,maxOvalX:r,minOvalY:o,maxOvalY:n}}function x1(e,t){let r=Math.max(e.left,t.left),o=Math.max(e.top,t.top),n=Math.min(e.right,t.right),a=Math.min(e.bottom,t.bottom),i=Math.abs(Math.max(0,n-r)*Math.max(0,a-o));if(i===0)return 0;let s=Math.abs((e.right-e.left)*(e.bottom-e.top)),c=Math.abs((t.right-t.left)*(t.bottom-t.top));return i/(s+c-i)}function L8({parsedSessionInformation:e,videoWidth:t}){let r=e.Challenge.OvalParameters;if(!r||!r.CenterX||!r.CenterY||!r.Width||!r.Height)throw new Error("Oval parameters not returned from session information.");return{flippedCenterX:t-r.CenterX,centerX:r.CenterX,centerY:r.CenterY,width:r.Width,height:r.Height}}function r3({width:e,height:t,widthSeed:r=1,centerXSeed:o=.5,centerYSeed:n=.5,ratioMultiplier:a=.8,ovalHeightWidthRatio:i=1.618}){let s=t,c=e,l=r*a,p=Math.floor(7*e/16),u=Math.floor(9*e/16),m=Math.floor(7*t/16),f=Math.floor(9*t/16),d=$8(o,p,u),h=$8(n,m,f);e>=t&&(c=3/4*s);let y=l*c,g=i*y;return{flippedCenterX:Math.floor(c-d),centerX:Math.floor(d),centerY:Math.floor(h),width:Math.floor(y),height:Math.floor(g)}}function o3({canvas:e,oval:t,scaleFactor:r,videoEl:o,isStartScreen:n}){let{flippedCenterX:a,centerY:i,width:s,height:c}=t,{width:l,height:p}=e.getBoundingClientRect(),u=e.getContext("2d");if(u){u.restore(),u.clearRect(0,0,l,p),u.fillStyle=n?getComputedStyle(e).getPropertyValue("--amplify-colors-background-primary"):"#fff",u.fillRect(0,0,l,p);let m={width:o.videoWidth,height:o.videoHeight},f={x:(l-m.width*r)/2,y:(p-m.height*r)/2};u.setTransform(r,0,0,r,f.x,f.y),u.beginPath(),u.ellipse(a,i,s/2,c/2,0,0,2*Math.PI),u.strokeStyle=getComputedStyle(e).getPropertyValue("--amplify-colors-border-secondary"),u.lineWidth=3,u.stroke(),u.save(),u.clip(),u.setTransform(1,0,0,1,0,0),u.clearRect(0,0,l,p)}else throw new Error("Cannot find Canvas.")}function n3(e,t,r){let{width:o,height:n}=r.getTracks()[0].getSettings(),{width:a,height:i}=t.getBoundingClientRect();e.width=Math.ceil(a),e.height=Math.ceil(i);let s=r3({width:o,height:n,ratioMultiplier:.5});s.flippedCenterX=o-s.centerX;let c=a/t.videoWidth;o3({canvas:e,oval:s,scaleFactor:c,videoEl:t,isStartScreen:!0})}function B8({canvas:e}){let t=e.getContext("2d");if(t)t.restore(),t.clearRect(0,0,Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER);else throw new Error("Cannot find Canvas.")}function U8(e){let{leftEye:t,rightEye:r,mouth:o}=e,n=[];n[0]=(t[0]+r[0])/2,n[1]=(t[1]+r[1])/2;let a=Math.sqrt((t[0]-r[0])**2+(t[1]-r[1])**2),i=Math.sqrt((n[0]-o[0])**2+(n[1]-o[1])**2);return{pupilDistance:a,faceHeight:i}}function Kv({ovalHeightWidthRatio:e=1.618,face:t,oval:r,frameHeight:o}){let{leftEye:n,rightEye:a,nose:i,leftEar:s,rightEar:c}=t,{height:l,centerY:p}=r,u=p-l/2,m=[];m[0]=(n[0]+a[0])/2,m[1]=(n[1]+a[1])/2;let{pupilDistance:f,faceHeight:d}=U8(t),h=(2*f+1.8*d)/2,y,g;m[1]<=(u+l)/2?(y=(m[0]+i[0])/2,g=(m[1]+i[1])/2):(y=m[0],g=m[1]);let x=e*h,w=Math.max(g-x/2,0),I=Math.min(g+x/2,o),C=Math.min(y-h/2,c[0]),R=Math.max(y+h/2,s[0]);return{bottom:I,left:C,right:R,top:w}}function a3(e){let t=document.createElement("canvas");t.width=e.videoWidth,t.height=e.videoHeight;let r=t.getContext("2d");if(r){r.drawImage(e,0,0,t.width,t.height);let o=r.getImageData(0,0,t.width,t.height).data,n=8,a=new Array(n).fill(0);for(let c=0;c<o.length;c++){let l=Math.round(o[c++]*.2126+o[c++]*.7152+o[c++]*.0722);a[l%32]++}let i=-1,s=0;for(let c=0;c<n;c++)a[c]>s&&(s=a[c],i=c);return t.remove(),i===0?ti.DARK:i===n?ti.BRIGHT:ti.NORMAL}else throw new Error("Cannot find Video Element.")}function W8(e){return e.label.toLowerCase().includes("virtual")}var Qpe=.9,Jpe=.75;function t3({ctx:e,prevColor:t,nextColor:r,fraction:o}){let n=e.canvas.width,a=e.canvas.height;e.fillStyle=r,e.fillRect(0,0,n,a*o),o!==1&&(e.fillStyle=t,e.fillRect(0,a*o,n,a*(1-o)))}function H8({overlayCanvas:e,prevColor:t,nextColor:r,videoEl:o,ovalDetails:n,heightFraction:a,scaleFactor:i}){let{x:s,y:c}=o.getBoundingClientRect(),{flippedCenterX:l,centerY:p,width:u,height:m}=n,f=l*i+s,d=p*i+c,h=e.width,y=e.height,g=e.getContext("2d");if(g)g.canvas.width=window.innerWidth,g.canvas.height=window.innerHeight,g.clearRect(0,0,h,y),t3({ctx:g,prevColor:t,nextColor:r,fraction:a}),g.save(),g.beginPath(),g.rect(0,0,h,y),g.clip(),g.clearRect(0,0,h,y),g.globalAlpha=Qpe,t3({ctx:g,prevColor:t,nextColor:r,fraction:a}),g.beginPath(),g.ellipse(f,d,u*i/2,m*i/2,0,0,2*Math.PI),g.strokeStyle="white",g.lineWidth=8,g.stroke(),g.clip(),g.clearRect(0,0,h,y),g.globalAlpha=Jpe,t3({ctx:g,prevColor:t,nextColor:r,fraction:a}),g.restore();else throw new Error("Cannot find Overlay Canvas.")}var Zpe=e=>!!e;function V8(e){return(e.Challenge.ColorSequences??[]).map(({FreshnessColor:o,DownscrollDuration:n,FlatDisplayDuration:a})=>{let i=o.RGB,s=`rgb(${i[0]},${i[1]},${i[2]})`;return typeof s<"u"&&typeof n<"u"&&typeof a<"u"?{color:s,downscrollDuration:n,flatDisplayDuration:a}:void 0}).filter(Zpe)}async function j8(e,t){let r=await e.detectFaces(t),o;switch(r.length){case 0:{o=It.CANT_IDENTIFY;break}case 1:{o=It.FACE_IDENTIFIED;break}default:{o=It.TOO_MANY;break}}return o}async function G8({parsedSessionInformation:e,faceDetector:t,videoEl:r,ovalDetails:o,reduceThreshold:n=!1}){let a=e.Challenge.ChallengeConfig,{FaceDistanceThresholdMin:i,FaceDistanceThreshold:s}=a,c=await t.detectFaces(r),l,p=!1,u;switch(c.length){case 0:{u=Wt.FACE_DISTANCE_ERROR;break}case 1:{l=c[0];let{width:m}=o,{pupilDistance:f,faceHeight:d}=U8(l),h=(2*f+1.8*d)/2/2;m&&(p=h/m<(n?s:i),p||(u=Wt.FACE_DISTANCE_ERROR));break}default:{u=Wt.MULTIPLE_FACES_ERROR;break}}return{isDistanceBelowThreshold:p,error:u}}var gp=class{constructor(t,r){this.backend=t,this.dataMover=r,this.data=new WeakMap,this.dataIdsCount=0}get(t){return this.data.has(t)||this.dataMover.moveData(this.backend,t),this.data.get(t)}set(t,r){this.dataIdsCount++,this.data.set(t,r)}has(t){return this.data.has(t)}delete(t){return this.dataIdsCount--,this.data.delete(t)}numDataIds(){return this.dataIdsCount}},_s=class{refCount(t){return Tn("refCount")}incRef(t){return Tn("incRef")}timerAvailable(){return!0}time(t){return Tn("time")}read(t){return Tn("read")}readSync(t){return Tn("readSync")}readToGPU(t,r){return Tn("readToGPU")}numDataIds(){return Tn("numDataIds")}disposeData(t,r){return Tn("disposeData")}write(t,r,o){return Tn("write")}move(t,r,o,n,a){return Tn("move")}createTensorFromGPUData(t,r,o){return Tn("createTensorFromGPUData")}memory(){return Tn("memory")}floatPrecision(){return Tn("floatPrecision")}epsilon(){return this.floatPrecision()===32?1e-7:1e-4}dispose(){return Tn("dispose")}};function Tn(e){throw new Error(`'${e}' not yet implemented or not found in the registry. This kernel may not be supported by the tfjs backend you have chosen`)}function q8(e){let t=e.length,r=0;for(;t>0;)r=Math.random()*t|0,t--,w1(e,t,r)}function eue(e,t){if(e.length!==t.length)throw new Error(`Array sizes must match to be shuffled together First array length was ${e.length}Second array length was ${t.length}`);let r=e.length,o=0;for(;r>0;)o=Math.random()*r|0,r--,w1(e,r,o),w1(t,r,o)}function Kd(e,t,r){return Math.max(e,Math.min(t,r))}function tue(e){return e%2===0?e:e+1}function w1(e,t,r){let o=e[t];e[t]=e[r],e[r]=o}function rue(e){let t=0;for(let r=0;r<e.length;r++)t+=e[r];return t}function oue(e,t){let r=Math.random();return t*r+(1-r)*e}function nue(e,t){let r=0;for(let o=0;o<e.length;o++){let n=Number(e[o])-Number(t[o]);r+=n*n}return r}function D(e,t){if(!e)throw new Error(typeof t=="string"?t:t())}function gr(e,t,r=""){D(Cn(e,t),()=>r+` Shapes ${e} and ${t} must match`)}function Kn(e){D(e!=null,()=>"The input to the tensor constructor must be a non-null value.")}function mt(e){if(e.length===0)return 1;let t=e[0];for(let r=1;r<e.length;r++)t*=e[r];return t}function aue(e){return e.length===0}function i3(e,t){if(e===t)return!0;if(e==null||t==null||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==null&&t[r]!==null&&e[r]!==t[r])return!1;return!0}function Cn(e,t){if(e===t)return!0;if(e==null||t==null||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function Es(e){return e%1===0}function iue(e){if(Math.tanh!=null)return Math.tanh(e);if(e===1/0)return 1;if(e===-1/0)return-1;{let t=Math.exp(2*e);return(t-1)/(t+1)}}function sue(e){let t=Math.ceil(Math.sqrt(e));return[t,Math.ceil(e/t)]}function lue(e){let t=new Uint32Array(e);for(let r=0;r<e;++r)t[r]=r;return q8(t),t}function vp(e,t){return t<=e.length?e:e+" ".repeat(t-e.length)}function cue(e,t=n=>0,r,o){return new Promise((n,a)=>{let i=0,s=()=>{if(e()){n();return}i++;let c=t(i);if(r!=null&&i>=r){a();return}o!=null?o(s,c):setTimeout(s,c)};s()})}function pue(e,t){let r=1,o=-1;for(let a=0;a<e.length;++a)if(e[a]>=0)r*=e[a];else if(e[a]===-1){if(o!==-1)throw Error(`Shapes can only have 1 implicit size. Found -1 at dim ${o} and dim ${a}`);o=a}else if(e[a]<0)throw Error(`Shapes can not be < 0. Found ${e[a]} at dim ${a}`);if(o===-1){if(t>0&&t!==r)throw Error(`Size(${t}) must match the product of shape ${e}`);return e}if(r===0)throw Error(`Cannot infer the missing size in [${e}] when there are 0 elements`);if(t%r!==0)throw Error(`The implicit shape can't be a fractional number. Got ${t} / ${r}`);let n=e.slice();return n[o]=t/r,n}function zl(e,t){let r=t.length;return e=e==null?t.map((o,n)=>n):[].concat(e),D(e.every(o=>o>=-r&&o<r),()=>`All values in axis param must be in range [-${r}, ${r}) but got axis ${e}`),D(e.every(o=>Es(o)),()=>`All values in axis param must be integers but got axis ${e}`),e.map(o=>o<0?r+o:o)}function s3(e,t){let r=[],o=[],n=t!=null&&Array.isArray(t)&&t.length===0,a=t==null||n?null:zl(t,e).sort(),i=0;for(let s=0;s<e.length;++s){if(a!=null){if(a[i]===s&&e[s]!==1)throw new Error(`Can't squeeze axis ${s} since its dim '${e[s]}' is not 1`);(a[i]==null||a[i]>s)&&e[s]===1&&(r.push(e[s]),o.push(s)),a[i]<=s&&i++}e[s]!==1&&(r.push(e[s]),o.push(s))}return{newShape:r,keptDims:o}}function l3(e,t){return S1(e,t)}function S1(e,t){let r=null;if(e==null||e==="float32")r=new Float32Array(t);else if(e==="int32")r=new Int32Array(t);else if(e==="bool")r=new Uint8Array(t);else if(e==="string")r=new Array(t);else throw new Error(`Unknown data type ${e}`);return r}function c3(e,t){for(let r=0;r<e.length;r++){let o=e[r];if(isNaN(o)||!isFinite(o))throw Error(`A tensor of type ${t} being uploaded contains ${o}.`)}}function p3(e){return e==="bool"||e==="complex64"||e==="float32"||e==="int32"||e==="string"}function uue(e,t){return!(t==="complex64"||t==="float32"&&e!=="complex64"||t==="int32"&&e!=="float32"&&e!=="complex64"||t==="bool"&&e==="bool")}function Xd(e){if(e==="float32"||e==="int32")return 4;if(e==="complex64")return 8;if(e==="bool")return 1;throw new Error(`Unknown dtype ${e}`)}function u3(e){if(e==null)return 0;let t=0;return e.forEach(r=>t+=r.length),t}function Yd(e){return typeof e=="string"||e instanceof String}function K8(e){return typeof e=="boolean"}function X8(e){return typeof e=="number"}function $l(e){return Array.isArray(e)?$l(e[0]):e instanceof Float32Array?"float32":e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray?"int32":X8(e)?"float32":Yd(e)?"string":K8(e)?"bool":"float32"}function Qd(e){return!!(e&&e.constructor&&e.call&&e.apply)}function Jd(e,t){for(let r=t;r<e;++r)if(e%r===0)return r;return e}function Ai(e){let t=e.length;if(t<2)return[];let r=new Array(t-1);r[t-2]=e[t-1];for(let o=t-3;o>=0;--o)r[o]=r[o+1]*e[o+1];return r}function Y8(e,t,r,o=!1){let n=new Array;if(t.length===1){let a=t[0]*(o?2:1);for(let i=0;i<a;i++)n[i]=r[e+i]}else{let a=t[0],i=t.slice(1),s=i.reduce((c,l)=>c*l)*(o?2:1);for(let c=0;c<a;c++)n[c]=Y8(e+c*s,i,r,o)}return n}function yp(e,t,r=!1){if(e.length===0)return t[0];let o=e.reduce((n,a)=>n*a)*(r?2:1);if(o===0)return[];if(o!==t.length)throw new Error(`[${e}] does not match the input size ${t.length}${r?" for a complex tensor":""}.`);return Y8(0,e,t,r)}function mue(e,t){if(Array.isArray(e))return e;if(t==="float32")return e instanceof Float32Array?e:new Float32Array(e);if(t==="int32")return e instanceof Int32Array?e:new Int32Array(e);if(t==="bool"||t==="string")return Uint8Array.from(new Int32Array(e));throw new Error(`Unknown dtype ${t}`)}function Xv(e,t){let r=Zd(e,t);for(let o=0;o<r.length;o++)r[o]=1;return r}function Zd(e,t){if(t==null||t==="float32"||t==="complex64")return new Float32Array(e);if(t==="int32")return new Int32Array(e);if(t==="bool")return new Uint8Array(e);throw new Error(`Unknown data type ${t}`)}function fue(e,t){let r=e.reduce((o,n)=>o*n,1);if(t==null||t==="float32")return yp(e,new Float32Array(r));if(t==="int32")return yp(e,new Int32Array(r));if(t==="bool")return yp(e,new Uint8Array(r));throw new Error(`Unknown data type ${t}`)}function or(e){e.forEach(t=>{D(Number.isInteger(t)&&t>=0,()=>`Tensor must have a shape comprised of positive integers but got shape [${e}].`)})}function due(e,t,r){if(t===0)return 0;if(t===1)return e[0];let o=e[e.length-1];for(let n=0;n<e.length-1;++n)o+=r[n]*e[n];return o}function hue(e,t,r){if(t===0)return[];if(t===1)return[e];let o=new Array(t);for(let n=0;n<o.length-1;++n)o[n]=Math.floor(e/r[n]),e-=o[n]*r[n];return o[o.length-1]=e,o}function bp(e){return e&&e.then&&typeof e.then=="function"}var Q8="tfjsflags",Yv=class{constructor(t){this.global=t,this.flags={},this.flagRegistry={},this.urlFlags={},this.getQueryParams=yue,this.populateURLFlags()}setPlatform(t,r){this.platform!=null&&(Ne().getBool("IS_TEST")||Ne().getBool("PROD")||console.warn(`Platform ${this.platformName} has already been set. Overwriting the platform with ${t}.`)),this.platformName=t,this.platform=r}registerFlag(t,r,o){if(this.flagRegistry[t]={evaluationFn:r,setHook:o},this.urlFlags[t]!=null){let n=this.urlFlags[t];Ne().getBool("IS_TEST")||Ne().getBool("PROD")||console.warn(`Setting feature override from URL ${t}: ${n}.`),this.set(t,n)}}async getAsync(t){return t in this.flags?this.flags[t]:(this.flags[t]=await this.evaluateFlag(t),this.flags[t])}get(t){if(t in this.flags)return this.flags[t];let r=this.evaluateFlag(t);if(bp(r))throw new Error(`Flag ${t} cannot be synchronously evaluated. Please use getAsync() instead.`);return this.flags[t]=r,this.flags[t]}getNumber(t){return this.get(t)}getBool(t){return this.get(t)}getString(t){return this.get(t)}getFlags(){return this.flags}get features(){return this.flags}set(t,r){if(this.flagRegistry[t]==null)throw new Error(`Cannot set flag ${t} as it has not been registered.`);this.flags[t]=r,this.flagRegistry[t].setHook!=null&&this.flagRegistry[t].setHook(r)}evaluateFlag(t){if(this.flagRegistry[t]==null)throw new Error(`Cannot evaluate flag '${t}': no evaluation function found.`);return this.flagRegistry[t].evaluationFn()}setFlags(t){this.flags=Object.assign({},t)}reset(){this.flags={},this.urlFlags={},this.populateURLFlags()}populateURLFlags(){if(typeof this.global>"u"||typeof this.global.location>"u"||typeof this.global.location.search>"u")return;let t=this.getQueryParams(this.global.location.search);Q8 in t&&t[Q8].split(",").forEach(o=>{let[n,a]=o.split(":");this.urlFlags[n]=bue(n,a)})}};function yue(e){let t={};return e.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g,(r,...o)=>(vue(t,o[0],o[1]),o.join("="))),t}function vue(e,t,r){e[decodeURIComponent(t)]=decodeURIComponent(r||"")}function bue(e,t){let r=t.toLowerCase();return r==="true"||r==="false"?r==="true":`${+r}`===r?+r:t}function Ne(){return m3}var m3=null;function J8(e){m3=e}var f3;function d3(){if(f3==null){let e;if(typeof window<"u")e=window;else if(typeof global<"u")e=global;else if(typeof process<"u")e=process;else if(typeof self<"u")e=self;else throw new Error("Could not find a global object");f3=e}return f3}function xue(){let e=d3();return e._tfGlobals==null&&(e._tfGlobals=new Map),e._tfGlobals}function Qv(e,t){let r=xue();if(r.has(e))return r.get(e);{let o=t();return r.set(e,o),r.get(e)}}var eh="Abs",xp="Acos",wp="Acosh",Is="Add",Sp="AddN",kp="All",_p="Any",th="ArgMax",rh="ArgMin",Ep="Asin",Ip="Asinh",Tp="Atan",Cp="Atanh",Np="Atan2",Ap="AvgPool",k1="AvgPoolGrad",oh="AvgPool3D",_1="AvgPool3DGrad",Rp="BatchMatMul",nh="BatchToSpaceND",Dp="Bincount",Fp="BitwiseAnd";var ah="BroadcastArgs",Ll="Cast",Mp="Ceil",Bl="ClipByValue",E1="Complex",I1="ComplexAbs",ih="Concat",Op="Conv2D",T1="Conv2DBackpropFilter",Pp="Conv2DBackpropInput",zp="Conv3D",Jv="Conv3DBackpropFilterV2",$p="Conv3DBackpropInputV2",Lp="Cos",Bp="Cosh",Up="Cumprod",Wp="Cumsum",Hp="CropAndResize",sh="DenseBincount",Vp="DepthToSpace",jp="DepthwiseConv2dNative",C1="DepthwiseConv2dNativeBackpropFilter",N1="DepthwiseConv2dNativeBackpropInput",lh="Diag",Gp="Dilation2D",ch="Dilation2DBackpropInput",ph="Dilation2DBackpropFilter",Zv="Draw",qp="RealDiv",A1="Einsum",Kp="Elu",eb="EluGrad",Xp="Erf",Yp="Equal",Qp="Exp",uh="ExpandDims",Jp="Expm1",R1="FFT",mh="Fill",Zp="FlipLeftRight",eu="Floor",tu="FloorDiv",ru="FusedBatchNorm",fh="GatherV2",ou="GatherNd",nu="Greater",au="GreaterEqual",Ul="Identity",D1="IFFT",F1="Imag",iu="IsFinite",su="IsInf",lu="IsNan",cu="LeakyRelu",pu="Less",uu="LessEqual",mu="LinSpace",fu="Log",du="Log1p",hu="LogicalAnd",gu="LogicalNot",yu="LogicalOr",Z8="LogicalXor";var vu="LRN",tb="LRNGrad";var bu="Max",xu="Maximum",wu="MaxPool",M1="MaxPoolGrad",dh="MaxPool3D",O1="MaxPool3DGrad",hh="MaxPoolWithArgmax",Su="Mean",ku="Min",_u="Minimum",Eu="MirrorPad",Iu="Mod",Tu="Multinomial",Cu="Multiply",gh="Neg",Nu="NotEqual",Au="NonMaxSuppressionV3",Ru="NonMaxSuppressionV4",Du="NonMaxSuppressionV5",yh="OnesLike",Fu="OneHot",vh="Pack",Mu="PadV2";var Ou="Pow",Pu="Prelu",zu="Prod",P1="RaggedGather",z1="RaggedRange",$1="RaggedTensorToTensor",bh="Range",L1="Real",$u="Reciprocal",Lu="Relu",xh="Reshape",Bu="ResizeNearestNeighbor",rb="ResizeNearestNeighborGrad",Uu="ResizeBilinear",ob="ResizeBilinearGrad",Wu="Relu6",Hu="Reverse",Vu="Round",ju="Rsqrt",Gu="ScatterNd",qu="TensorScatterUpdate",Ku="SearchSorted",wh="Select",Xu="Selu",Sh="Slice",Yu="Sin",Qu="Sinh",Ju="Sign",Zu="Sigmoid",em="Softplus",tm="Sqrt",rm="Sum",kh="SpaceToBatchND",_h="SplitV",om="Softmax",Eh="SparseFillEmptyRows",nm="SparseReshape",Ih="SparseSegmentMean",Th="SparseSegmentSum",am="SparseToDense",im="SquaredDifference",B1="Square",nb="StaticRegexReplace",sm="StridedSlice",Ch="StringNGrams",Nh="StringSplit",Ah="StringToHashBucketFast",lm="Sub",cm="Tan",pm="Tanh",Ts="Tile",um="TopK",mm="Transform",Cs="Transpose",Rh="Unique",Dh="Unpack",U1="UnsortedSegmentSum";var Fh="ZerosLike",Wl="Step",h3="FromPixels",fm="RotateWithOffset",Hl="_FusedMatMul",Vl="FusedConv2D",jl="FusedDepthwiseConv2D";function Ns(...e){Ne().getBool("IS_TEST")||Ne().getBool("PROD")||console.warn(...e)}function wue(...e){Ne().getBool("IS_TEST")||Ne().getBool("PROD")||console.log(...e)}var W1=Qv("kernelRegistry",()=>new Map),Sue=Qv("gradRegistry",()=>new Map);function Mh(e,t){let r=tL(e,t);return W1.get(r)}function g3(e){return Sue.get(e)}function y3(e){let t=W1.entries(),r=[];for(;;){let{done:o,value:n}=t.next();if(o)break;let[a,i]=n,[s]=a.split("_");s===e&&r.push(i)}return r}function H1(e){let{kernelName:t,backendName:r}=e,o=tL(t,r);W1.has(o)&&Ns(`The kernel '${t}' for backend '${r}' is already registered`),W1.set(o,e)}function tL(e,t){return`${t}_${e}`}var S={};Ot(S,{arraysEqual:()=>Cn,arraysEqualWithNull:()=>i3,assert:()=>D,assertNonNegativeIntegerDimensions:()=>or,assertNonNull:()=>Kn,assertShapesMatch:()=>gr,bytesFromStringArray:()=>u3,bytesPerElement:()=>Xd,checkConversionForErrors:()=>c3,clamp:()=>Kd,computeStrides:()=>Ai,convertBackendValuesAndArrayBuffer:()=>mue,createScalarValue:()=>Nue,createShuffledIndices:()=>lue,decodeString:()=>Lh,distSquared:()=>nue,encodeString:()=>$h,fetch:()=>Rue,fingerPrint64:()=>Cue,flatten:()=>ql,getArrayFromDType:()=>S1,getTypedArrayFromDType:()=>l3,hasEncodingLoss:()=>uue,hexToLong:()=>ab,indexToLoc:()=>hue,inferDtype:()=>$l,inferFromImplicitShape:()=>pue,isBoolean:()=>K8,isFunction:()=>Qd,isInt:()=>Es,isNumber:()=>X8,isPromise:()=>bp,isScalarShape:()=>aue,isString:()=>Yd,isTypedArray:()=>Co,isValidDtype:()=>p3,locToIndex:()=>due,makeOnesTypedArray:()=>Xv,makeZerosNestedTypedArray:()=>fue,makeZerosTypedArray:()=>Zd,nearestDivisor:()=>Jd,nearestLargerEven:()=>tue,now:()=>vm,parseAxisParam:()=>zl,randUniform:()=>oue,repeatedTry:()=>cue,rightPad:()=>vp,shuffle:()=>q8,shuffleCombo:()=>eue,sizeFromShape:()=>mt,sizeToSquarishShape:()=>sue,squeezeShape:()=>s3,sum:()=>rue,swap:()=>w1,tanh:()=>iue,toNestedArray:()=>yp,toTypedArray:()=>zh});function V1(e){return e instanceof Float32Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray}var w3=Ie(mL());var ym=w3.default||w3;function ab(e){return ym.fromString(e,!0,16)}var dL=ab("c3a5c85c97cb3127"),gm=ab("b492b66fbe98f273"),Lo=ab("9ae16a3b2f90404f");function x3(e){return e.xor(e.shru(47))}function hL(e,t,r){let o=e.slice(t,t+r);return ym.fromBytes(Array.from(o),!0,!0)}function nr(e,t){return hL(e,t,8)}function fL(e,t){return hL(e,t,4)}function io(e,t){return t===0?e:e.shru(t).or(e.shl(64-t))}function Gl(e,t,r=ab("9ddfea08eb382d69")){let o=e.xor(t).mul(r);o=o.xor(o.shru(47));let n=t.xor(o).mul(r);return n=n.xor(n.shru(47)),n=n.mul(r),n}function _ue(e,t,r,o,n,a){n=n.add(e),a=io(a.add(n).add(o),21);let i=n;return n=n.add(t),n=n.add(r),a=a.add(io(n,44)),[n.add(o),a.add(i)]}function G1(e,t,r,o){return _ue(nr(e,t),nr(e,t+8),nr(e,t+16),nr(e,t+24),r,o)}function Eue(e,t=e.length){if(t>=8){let r=Lo.add(t*2),o=nr(e,0).add(Lo),n=nr(e,t-8),a=io(n,37).mul(r).add(o),i=io(o,25).add(n).mul(r);return Gl(a,i,r)}if(t>=4){let r=Lo.add(t*2),o=fL(e,0);return Gl(o.shl(3).add(t),fL(e,t-4),r)}if(t>0){let r=e[0],o=e[t>>1],n=e[t-1],a=r+(o<<8),i=t+(n<<2);return x3(Lo.mul(a).xor(dL.mul(i))).mul(Lo)}return Lo}function Iue(e,t=e.length){let r=Lo.add(t*2),o=nr(e,0).mul(gm),n=nr(e,8),a=nr(e,t-8).mul(r),i=nr(e,t-16).mul(Lo);return Gl(io(o.add(n),43).add(io(a,30)).add(i),o.add(io(n.add(Lo),18)).add(a),r)}function Tue(e,t=e.length){let r=Lo.add(t*2),o=nr(e,0).mul(Lo),n=nr(e,8),a=nr(e,t-8).mul(r),i=nr(e,t-16).mul(Lo),s=io(o.add(n),43).add(io(a,30)).add(i),c=Gl(s,o.add(io(n.add(Lo),18)).add(a),r),l=nr(e,16).mul(r),p=nr(e,24),u=s.add(nr(e,t-32)).mul(r),m=c.add(nr(e,t-24)).mul(r);return Gl(io(l.add(p),43).add(io(u,30)).add(m),l.add(io(p.add(o),18)).add(u),r)}function Cue(e,t=e.length){let r=ym.fromNumber(81,!0);if(t<=32)return t<=16?Eue(e,t):Iue(e,t);if(t<=64)return Tue(e,t);let o=r,n=r.mul(gm).add(113),a=x3(n.mul(Lo).add(113)).mul(Lo),i=[ym.UZERO,ym.UZERO],s=[ym.UZERO,ym.UZERO];o=o.mul(Lo).add(nr(e,0));let c=0,l=(t-1>>6)*64,p=l+(t-1&63)-63;do o=io(o.add(n).add(i[0]).add(nr(e,c+8)),37).mul(gm),n=io(n.add(i[1]).add(nr(e,c+48)),42).mul(gm),o=o.xor(s[1]),n=n.add(i[0]).add(nr(e,c+40)),a=io(a.add(s[0]),33).mul(gm),i=G1(e,c,i[1].mul(gm),o.add(s[0])),s=G1(e,c+32,a.add(s[1]),n.add(nr(e,c+16))),[a,o]=[o,a],c+=64;while(c!==l);let u=gm.add(a.and(255).shl(1));return c=p,s[0]=s[0].add(t-1&63),i[0]=i[0].add(s[0]),s[0]=s[0].add(i[0]),o=io(o.add(n).add(i[0]).add(nr(e,c+8)),37).mul(u),n=io(n.add(i[1]).add(nr(e,c+48)),42).mul(u),o=o.xor(s[1].mul(9)),n=n.add(i[0].mul(9).add(nr(e,c+40))),a=io(a.add(s[0]),33).mul(u),i=G1(e,c,i[1].mul(u),o.add(s[0])),s=G1(e,c+32,a.add(s[1]),n.add(nr(e,c+16))),[a,o]=[o,a],Gl(Gl(i[0],s[0],u).add(x3(n).mul(dL)).add(a),Gl(i[1],s[1],u).add(o),u)}function Nue(e,t){return t==="string"?$h(e):zh([e],t)}function Aue(e,t){return e instanceof Float32Array&&t==="float32"||e instanceof Int32Array&&t==="int32"||e instanceof Uint8Array&&t==="bool"}function zh(e,t){if(t==="string")throw new Error("Cannot convert a string[] to a TypedArray");if(Array.isArray(e)&&(e=ql(e)),Ne().getBool("DEBUG")&&c3(e,t),Aue(e,t))return e;if(t==null||t==="float32"||t==="complex64")return new Float32Array(e);if(t==="int32")return new Int32Array(e);if(t==="bool"){let r=new Uint8Array(e.length);for(let o=0;o<r.length;++o)Math.round(e[o])!==0&&(r[o]=1);return r}else throw new Error(`Unknown data type ${t}`)}function vm(){return Ne().platform.now()}function Rue(e,t){return Ne().platform.fetch(e,t)}function $h(e,t="utf-8"){return t=t||"utf-8",Ne().platform.encode(e,t)}function Lh(e,t="utf-8"){return t=t||"utf-8",Ne().platform.decode(e,t)}function Co(e){return Ne().platform.isTypedArray!=null?Ne().platform.isTypedArray(e):V1(e)}function ql(e,t=[],r=!1){if(t==null&&(t=[]),typeof e=="boolean"||typeof e=="number"||typeof e=="string"||bp(e)||e==null||Co(e)&&r)t.push(e);else if(Array.isArray(e)||Co(e))for(let o=0;o<e.length;++o)ql(e[o],t,r);else{let o=-1;for(let n of Object.keys(e))/^([1-9]+[0-9]*|0)$/.test(n)&&(o=Math.max(o,Number(n)));for(let n=0;n<=o;n++)ql(e[n],t,r)}return t}var q1=class{constructor(t,r){this.backendTimer=t,this.logger=r,r==null&&(this.logger=new S3)}profileKernel(t,r,o){let n,a=()=>{n=o()},i,s=vm();if(this.backendTimer.timerAvailable())i=this.backendTimer.time(a);else{a();for(let l of n)l.dataSync();i=Promise.resolve({kernelMs:vm()-s})}if(Ne().getBool("CHECK_COMPUTATION_FOR_ERRORS"))for(let l=0;l<n.length;l++){let p=n[l];p.data().then(u=>{Due(u,p.dtype,t)})}return{kernelName:t,outputs:n,inputs:r,timeMs:i.then(l=>l.kernelMs),extraInfo:i.then(l=>l.getExtraProfileInfo!=null?l.getExtraProfileInfo():"")}}logKernelProfile(t){let{kernelName:r,outputs:o,timeMs:n,inputs:a,extraInfo:i}=t;o.forEach(s=>{Promise.all([s.data(),n,i]).then(c=>{this.logger.logKernelProfile(r,s,c[0],c[1],a,c[2])})})}};function Due(e,t,r){if(t!=="float32")return!1;for(let o=0;o<e.length;o++){let n=e[o];if(isNaN(n)||!isFinite(n))return console.warn(`Found ${n} in the result of '${r}'`),!0}return!1}var S3=class{logKernelProfile(t,r,o,n,a,i){let s=typeof n=="number"?vp(`${n}ms`,9):n.error,c=vp(t,25),l=r.rank,p=r.size,u=vp(r.shape.toString(),14),m="";for(let f in a){let d=a[f];if(d!=null){let h=d.shape||r.shape,y=h.length;m+=`${f}: ${y}D ${y>0?h:""} `}}console.log(`%c${c} %c${s} %c${l}D ${u} %c${p} %c${m} %c${i}`,"font-weight:bold","color:red","color:blue","color: orange","color: green","color: steelblue")}};function gL(e,t,r){let o={},n={};for(let c=0;c<t.length;c++)o[t[c].id]=!0;for(let c=0;c<e.length;c++){let l=e[c],p=l.inputs;for(let u in p){let m=p[u],f=!1;for(let d=0;d<t.length;d++)if(o[m.id]){l.outputs.forEach(h=>o[h.id]=!0),f=!0,n[l.id]=!0;break}if(f)break}}let a={};a[r.id]=!0;let i={};for(let c=e.length-1;c>=0;c--){let l=e[c],p=l.inputs;for(let u=0;u<l.outputs.length;u++)if(a[l.outputs[u].id]){for(let m in p)a[p[m].id]=!0,i[l.id]=!0;break}}let s=[];for(let c=0;c<e.length;c++){let l=e[c];if(n[l.id]&&i[l.id]){let p={};for(let m in l.inputs){let f=l.inputs[m];o[f.id]&&(p[m]=f)}let u=Object.assign({},l);u.inputs=p,u.outputs=l.outputs,s.push(u)}}return s}function yL(e,t,r,o){for(let n=t.length-1;n>=0;n--){let a=t[n],i=[];if(a.outputs.forEach(c=>{let l=e[c.id];l!=null?i.push(l):i.push(null)}),a.gradient==null)throw new Error(`Cannot compute gradient: gradient function not found for ${a.kernelName}.`);let s=a.gradient(i);for(let c in a.inputs){if(!(c in s))throw new Error(`Cannot backprop through input ${c}. Available gradients found: ${Object.keys(s)}.`);let l=r(()=>s[c]());if(l.dtype!=="float32")throw new Error(`Error in gradient for op ${a.kernelName}. The gradient of input ${c} must have 'float32' dtype, but has '${l.dtype}'`);let p=a.inputs[c];if(!Cn(l.shape,p.shape))throw new Error(`Error in gradient for op ${a.kernelName}. The gradient of input '${c}' has shape '${l.shape}', which does not match the shape of the input '${p.shape}'`);if(e[p.id]==null)e[p.id]=l;else{let u=e[p.id];e[p.id]=o(u,l),u.dispose()}}}}var vL=20,ib=3,k3=7;function bL(e,t,r,o){let n=Ai(t),a=Fue(e,t,r,n),i=t.length,s=K1(e,t,r,n,a),c=["Tensor"];return o&&(c.push(` dtype: ${r}`),c.push(` rank: ${i}`),c.push(` shape: [${t}]`),c.push(" values:")),c.push(s.map(l=>" "+l).join(`
90
+ `)),c.join(`
91
+ `)}function Fue(e,t,r,o){let n=mt(t),a=o[o.length-1],i=new Array(a).fill(0),s=t.length,c=r==="complex64"?lb(e):e;if(s>1)for(let l=0;l<n/a;l++){let p=l*a;for(let u=0;u<a;u++)i[u]=Math.max(i[u],sb(c[p+u],0,r).length)}return i}function sb(e,t,r){let o;return Array.isArray(e)?o=`${parseFloat(e[0].toFixed(k3))} + ${parseFloat(e[1].toFixed(k3))}j`:Yd(e)?o=`'${e}'`:r==="bool"?o=xL(e):o=parseFloat(e.toFixed(k3)).toString(),vp(o,t)}function xL(e){return e===0?"false":"true"}function K1(e,t,r,o,n,a=!0){let i=r==="complex64"?2:1,s=t[0],c=t.length;if(c===0){if(r==="complex64"){let h=lb(e);return[sb(h[0],0,r)]}return r==="bool"?[xL(e[0])]:[e[0].toString()]}if(c===1){if(s>vL){let y=ib*i,g=Array.from(e.slice(0,y)),b=Array.from(e.slice((s-ib)*i,s*i));return r==="complex64"&&(g=lb(g),b=lb(b)),["["+g.map((x,w)=>sb(x,n[w],r)).join(", ")+", ..., "+b.map((x,w)=>sb(x,n[s-ib+w],r)).join(", ")+"]"]}return["["+(r==="complex64"?lb(e):Array.from(e)).map((y,g)=>sb(y,n[g],r)).join(", ")+"]"]}let l=t.slice(1),p=o.slice(1),u=o[0]*i,m=[];if(s>vL){for(let h=0;h<ib;h++){let y=h*u,g=y+u;m.push(...K1(e.slice(y,g),l,r,p,n,!1))}m.push("...");for(let h=s-ib;h<s;h++){let y=h*u,g=y+u;m.push(...K1(e.slice(y,g),l,r,p,n,h===s-1))}}else for(let h=0;h<s;h++){let y=h*u,g=y+u;m.push(...K1(e.slice(y,g),l,r,p,n,h===s-1))}let f=c===2?",":"";m[0]="["+(s>0?m[0]+f:"");for(let h=1;h<m.length-1;h++)m[h]=" "+m[h]+f;let d=`,
92
+ `;for(let h=2;h<c;h++)d+=`
93
+ `;return m[m.length-1]=" "+m[m.length-1]+"]"+(a?"":d),m}function lb(e){let t=[];for(let r=0;r<e.length;r+=2)t.push([e[r],e[r+1]]);return t}var Tt=class{constructor(t,r,o){if(this.dtype=r,this.shape=t.slice(),this.size=mt(t),o!=null){let n=o.length;D(n===this.size,()=>`Length of values '${n}' does not match the size inferred by the shape '${this.size}'.`)}if(r==="complex64")throw new Error("complex64 dtype TensorBuffers are not supported. Please create a TensorBuffer for the real and imaginary parts separately and call tf.complex(real, imag).");this.values=o||S1(r,this.size),this.strides=Ai(t)}set(t,...r){r.length===0&&(r=[0]),D(r.length===this.rank,()=>`The number of provided coordinates (${r.length}) must match the rank (${this.rank})`);let o=this.locToIndex(r);this.values[o]=t}get(...t){t.length===0&&(t=[0]);let r=0;for(let n of t){if(n<0||n>=this.shape[r]){let a=`Requested out of range element at ${t}. Buffer shape=${this.shape}`;throw new Error(a)}r++}let o=t[t.length-1];for(let n=0;n<t.length-1;++n)o+=this.strides[n]*t[n];return this.values[o]}locToIndex(t){if(this.rank===0)return 0;if(this.rank===1)return t[0];let r=t[t.length-1];for(let o=0;o<t.length-1;++o)r+=this.strides[o]*t[o];return r}indexToLoc(t){if(this.rank===0)return[];if(this.rank===1)return[t];let r=new Array(this.shape.length);for(let o=0;o<r.length-1;++o)r[o]=Math.floor(t/this.strides[o]),t-=r[o]*this.strides[o];return r[r.length-1]=t,r}get rank(){return this.shape.length}toTensor(){return oi().makeTensor(this.values,this.shape,this.dtype)}},oi=null,Bh=null,Mue=null;function wL(e){oi=e}function SL(e){Bh=e}function kL(e){Mue=e}var $t=class{constructor(t,r,o,n){this.kept=!1,this.isDisposedInternal=!1,this.shape=t.slice(),this.dtype=r||"float32",this.size=mt(t),this.strides=Ai(t),this.dataId=o,this.id=n,this.rankType=this.rank<5?this.rank.toString():"higher"}get rank(){return this.shape.length}async buffer(){let t=await this.data();return Bh.buffer(this.shape,this.dtype,t)}bufferSync(){return Bh.buffer(this.shape,this.dtype,this.dataSync())}async array(){let t=await this.data();return yp(this.shape,t,this.dtype==="complex64")}arraySync(){return yp(this.shape,this.dataSync(),this.dtype==="complex64")}async data(){this.throwIfDisposed();let t=oi().read(this.dataId);if(this.dtype==="string"){let r=await t;try{return r.map(o=>Lh(o))}catch{throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}}return t}dataToGPU(t){return this.throwIfDisposed(),oi().readToGPU(this.dataId,t)}dataSync(){this.throwIfDisposed();let t=oi().readSync(this.dataId);if(this.dtype==="string")try{return t.map(r=>Lh(r))}catch{throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}return t}async bytes(){this.throwIfDisposed();let t=await oi().read(this.dataId);return this.dtype==="string"?t:new Uint8Array(t.buffer)}dispose(){this.isDisposed||(this.kerasMask&&this.kerasMask.dispose(),oi().disposeTensor(this),this.isDisposedInternal=!0)}get isDisposed(){return this.isDisposedInternal}throwIfDisposed(){if(this.isDisposed)throw new Error("Tensor is disposed.")}print(t=!1){return Bh.print(this,t)}clone(){return this.throwIfDisposed(),Bh.clone(this)}toString(t=!1){let r=this.dataSync();return bL(r,this.shape,this.dtype,t)}cast(t){return this.throwIfDisposed(),Bh.cast(this,t)}variable(t=!0,r,o){return this.throwIfDisposed(),oi().makeVariable(this,t,r,o)}};Object.defineProperty($t,Symbol.hasInstance,{value:e=>!!e&&e.data!=null&&e.dataSync!=null&&e.throwIfDisposed!=null});function Oue(){return Qv("Tensor",()=>$t)}Oue();var As=class extends $t{constructor(t,r,o,n){super(t.shape,t.dtype,t.dataId,n),this.trainable=r,this.name=o}assign(t){if(t.dtype!==this.dtype)throw new Error(`dtype of the new value (${t.dtype}) and previous value (${this.dtype}) must match`);if(!Cn(t.shape,this.shape))throw new Error(`shape of the new value (${t.shape}) and previous value (${this.shape}) must match`);oi().disposeTensor(this),this.dataId=t.dataId,oi().incRef(this,null)}dispose(){oi().disposeVariable(this),this.isDisposedInternal=!0}};Object.defineProperty(As,Symbol.hasInstance,{value:e=>e instanceof $t&&e.assign!=null&&e.assign instanceof Function});var _3;(function(e){e.R0="R0",e.R1="R1",e.R2="R2",e.R3="R3",e.R4="R4",e.R5="R5",e.R6="R6"})(_3||(_3={}));var E3;(function(e){e.float32="float32",e.int32="int32",e.bool="int32",e.complex64="complex64"})(E3||(E3={}));var I3;(function(e){e.float32="float32",e.int32="int32",e.bool="bool",e.complex64="complex64"})(I3||(I3={}));var T3;(function(e){e.float32="float32",e.int32="float32",e.bool="float32",e.complex64="complex64"})(T3||(T3={}));var C3;(function(e){e.float32="complex64",e.int32="complex64",e.bool="complex64",e.complex64="complex64"})(C3||(C3={}));var Pue={float32:T3,int32:E3,bool:I3,complex64:C3};function Xn(e,t){if(e==="string"||t==="string"){if(e==="string"&&t==="string")return"string";throw new Error(`Can not upcast ${e} with ${t}`)}return Pue[e][t]}function X1(e){return e!=null&&typeof e=="object"&&"texture"in e&&e.texture instanceof WebGLTexture}function Y1(e){return typeof GPUBuffer<"u"&&e!=null&&typeof e=="object"&&"buffer"in e&&e.buffer instanceof GPUBuffer}function ot(e,t){if(e.dtype===t.dtype)return[e,t];let r=Xn(e.dtype,t.dtype);return[e.cast(r),t.cast(r)]}function _L(e,t){D(e.dtype===t.dtype,()=>`The dtypes of the first(${e.dtype}) and second(${t.dtype}) input must match`)}function Q1(e){let t=[];return EL(e,t,new Set),t}function EL(e,t,r){if(e==null)return;if(e instanceof $t){t.push(e);return}if(!zue(e))return;let o=e;for(let n in o){let a=o[n];r.has(a)||(r.add(a),EL(a,t,r))}}function zue(e){return Array.isArray(e)||typeof e=="object"}function N3(e){return e.kernelName!=null}var J1=class{constructor(){this.registeredVariables={},this.nextTapeNodeId=0,this.numBytes=0,this.numTensors=0,this.numStringTensors=0,this.numDataBuffers=0,this.gradientDepth=0,this.kernelDepth=0,this.scopeStack=[],this.numDataMovesStack=[],this.nextScopeId=0,this.tensorInfo=new WeakMap,this.profiling=!1,this.activeProfile={newBytes:0,newTensors:0,peakBytes:0,kernels:[],result:null,get kernelNames(){return Array.from(new Set(this.kernels.map(t=>t.name)))}}}dispose(){for(let t in this.registeredVariables)this.registeredVariables[t].dispose()}},cb=class e{constructor(t){this.ENV=t,this.registry={},this.registryFactory={},this.pendingBackendInitId=0,this.state=new J1}async ready(){if(this.pendingBackendInit!=null)return this.pendingBackendInit.then(()=>{});if(this.backendInstance!=null)return;let t=this.getSortedBackends();for(let r=0;r<t.length;r++){let o=t[r];if(await this.initializeBackend(o).success){await this.setBackend(o);return}}throw new Error("Could not initialize any backends, all backend initializations failed.")}get backend(){if(this.pendingBackendInit!=null)throw new Error(`Backend '${this.backendName}' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods`);if(this.backendInstance==null){let{name:t,asyncInit:r}=this.initializeBackendsAndReturnBest();if(r)throw new Error(`The highest priority backend '${t}' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods`);this.setBackend(t)}return this.backendInstance}backendNames(){return Object.keys(this.registryFactory)}findBackend(t){if(!(t in this.registry))if(t in this.registryFactory){let{asyncInit:r}=this.initializeBackend(t);if(r)return null}else return null;return this.registry[t]}findBackendFactory(t){return t in this.registryFactory?this.registryFactory[t].factory:null}registerBackend(t,r,o=1){return t in this.registryFactory?(Ns(`${t} backend was already registered. Reusing existing backend factory.`),!1):(this.registryFactory[t]={factory:r,priority:o},!0)}async setBackend(t){if(this.registryFactory[t]==null)throw new Error(`Backend name '${t}' not found in registry`);if(this.backendName=t,this.registry[t]==null){this.backendInstance=null;let{success:r,asyncInit:o}=this.initializeBackend(t);if(!(o?await r:r))return!1}return this.backendInstance=this.registry[t],this.setupRegisteredKernels(),this.profiler=new q1(this.backendInstance),!0}setupRegisteredKernels(){y3(this.backendName).forEach(r=>{r.setupFunc!=null&&r.setupFunc(this.backendInstance)})}disposeRegisteredKernels(t){y3(t).forEach(o=>{o.disposeFunc!=null&&o.disposeFunc(this.registry[t])})}initializeBackend(t){let r=this.registryFactory[t];if(r==null)throw new Error(`Cannot initialize backend ${t}, no registration found.`);try{let o=r.factory();if(o&&!(o instanceof _s)&&typeof o.then=="function"){let n=++this.pendingBackendInitId,a=o.then(i=>n<this.pendingBackendInitId?!1:(this.registry[t]=i,this.pendingBackendInit=null,!0)).catch(i=>(n<this.pendingBackendInitId||(this.pendingBackendInit=null,Ns(`Initialization of backend ${t} failed`),Ns(i.stack||i.message)),!1));return this.pendingBackendInit=a,{success:a,asyncInit:!0}}else return this.registry[t]=o,{success:!0,asyncInit:!1}}catch(o){return Ns(`Initialization of backend ${t} failed`),Ns(o.stack||o.message),{success:!1,asyncInit:!1}}}removeBackend(t){if(!(t in this.registryFactory))throw new Error(`${t} backend not found in registry`);this.backendName===t&&this.pendingBackendInit!=null&&this.pendingBackendInitId++,t in this.registry&&(this.disposeRegisteredKernels(t),this.registry[t].dispose(),delete this.registry[t]),delete this.registryFactory[t],this.backendName===t&&(this.pendingBackendInit=null,this.backendName=null,this.backendInstance=null)}getSortedBackends(){if(Object.keys(this.registryFactory).length===0)throw new Error("No backend found in registry.");return Object.keys(this.registryFactory).sort((t,r)=>this.registryFactory[r].priority-this.registryFactory[t].priority)}initializeBackendsAndReturnBest(){let t=this.getSortedBackends();for(let r=0;r<t.length;r++){let o=t[r],{success:n,asyncInit:a}=this.initializeBackend(o);if(a||n)return{name:o,asyncInit:a}}throw new Error("Could not initialize any backends, all backend initializations failed.")}moveData(t,r){let o=this.state.tensorInfo.get(r),n=o.backend,a=this.readSync(r),i=n.refCount(r);n.disposeData(r,!0),o.backend=t,t.move(r,a,o.shape,o.dtype,i),this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack[this.state.numDataMovesStack.length-1]++}tidy(t,r){let o=null;if(r==null){if(typeof t!="function")throw new Error("Please provide a function to tidy()");r=t}else{if(typeof t!="string"&&!(t instanceof String))throw new Error("When calling with two arguments, the first argument to tidy() must be a string");if(typeof r!="function")throw new Error("When calling with two arguments, the 2nd argument to tidy() must be a function");o=t}let n;return this.scopedRun(()=>this.startScope(o),()=>this.endScope(n),()=>(n=r(),n instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),n))}scopedRun(t,r,o){t();try{let n=o();return r(),n}catch(n){throw r(),n}}nextTensorId(){return e.nextTensorId++}nextVariableId(){return e.nextVariableId++}clone(t){let r=A.runKernel(Ul,{x:t}),o={x:t},n=i=>({x:()=>{let s="float32",c={x:i},l={dtype:s};return A.runKernel(Ll,c,l)}}),a=[];return this.addTapeNode(this.state.activeScope.name,o,[r],n,a,{}),r}runKernel(t,r,o){if(this.backendName==null&&this.backend,!(Mh(t,this.backendName)!=null))throw new Error(`Kernel '${t}' not registered for backend '${this.backendName}'`);return this.runKernelFunc({kernelName:t,inputs:r,attrs:o})}shouldCheckForMemLeaks(){return this.ENV.getBool("IS_TEST")}checkKernelForMemLeak(t,r,o){let n=this.backend.numDataIds(),a=0;o.forEach(c=>{a+=c.dtype==="complex64"?3:1});let i=this.state.numDataMovesStack[this.state.numDataMovesStack.length-1],s=n-r-a-i;if(s>0)throw new Error(`Backend '${this.backendName}' has an internal memory leak (${s} data ids) after running '${t}'`)}runKernelFunc(t){let r,o=[],n=this.isTapeOn(),a=this.state.numBytes,i=this.state.numTensors;this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack.push(0);let s;this.backendName==null&&this.backend;let c,l=N3(t)?t.kernelName:this.state.activeScope!=null?this.state.activeScope.name:"";if(N3(t)){let{kernelName:d,inputs:h,attrs:y}=t;this.backendName==null&&this.backend;let g=Mh(d,this.backendName);D(g!=null,()=>`Cannot find registered kernel '${d}' for backend '${this.backendName}'`),s=()=>{let b=this.backend.numDataIds();c=g.kernelFunc({inputs:h,attrs:y,backend:this.backend});let x=Array.isArray(c)?c:[c];this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(d,b,x);let w=x.map(I=>I.rank!=null?I:this.makeTensorFromTensorInfo(I));if(n){let I=this.getTensorsForGradient(d,h,w);o=this.saveTensorsForBackwardMode(I)}return w}}else{let{forwardFunc:d}=t,h=y=>{n&&(o=y.map(g=>this.keep(this.clone(g))))};s=()=>{let y=this.backend.numDataIds();c=this.tidy(()=>d(this.backend,h));let g=Array.isArray(c)?c:[c];return this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(l,y,g),g}}let{inputs:p,attrs:u}=t,m=N3(t)?null:t.backwardsFunc,f;return this.scopedRun(()=>this.state.kernelDepth++,()=>this.state.kernelDepth--,()=>{!this.ENV.getBool("DEBUG")&&!this.state.profiling?r=s():(f=this.profiler.profileKernel(l,p,()=>s()),this.ENV.getBool("DEBUG")&&this.profiler.logKernelProfile(f),r=f.outputs)}),n&&this.addTapeNode(l,p,r,m,o,u),this.state.profiling&&this.state.activeProfile.kernels.push({name:l,bytesAdded:this.state.numBytes-a,totalBytesSnapshot:this.state.numBytes,tensorsAdded:this.state.numTensors-i,totalTensorsSnapshot:this.state.numTensors,inputShapes:Object.keys(p).map(d=>p[d]!=null?p[d].shape:null),outputShapes:r.map(d=>d.shape),kernelTimeMs:f.timeMs,extraInfo:f.extraInfo}),Array.isArray(c)?r:r[0]}saveTensorsForBackwardMode(t){return t.map(o=>this.keep(this.clone(o)))}getTensorsForGradient(t,r,o){let n=g3(t);if(n!=null){let a=n.inputsToSave||[],i=n.outputsToSave||[],s;n.saveAllInputs?(D(Array.isArray(r),()=>"saveAllInputs is true, expected inputs to be an array."),s=Object.keys(r).map(l=>r[l])):s=a.map(l=>r[l]);let c=o.filter((l,p)=>i[p]);return s.concat(c)}return[]}makeTensor(t,r,o,n){if(t==null)throw new Error("Values passed to engine.makeTensor() are null");o=o||"float32",n=n||this.backend;let a=t;o==="string"&&Yd(t[0])&&(a=t.map(c=>$h(c)));let i=n.write(a,r,o),s=new $t(r,o,i,this.nextTensorId());if(this.trackTensor(s,n),o==="string"){let c=this.state.tensorInfo.get(i),l=u3(a);this.state.numBytes+=l-c.bytes,c.bytes=l}return s}makeTensorFromDataId(t,r,o,n){o=o||"float32";let a={dataId:t,shape:r,dtype:o};return this.makeTensorFromTensorInfo(a,n)}makeTensorFromTensorInfo(t,r){let{dataId:o,shape:n,dtype:a}=t,i=new $t(n,a,o,this.nextTensorId());return this.trackTensor(i,r),i}makeVariable(t,r=!0,o,n){o=o||this.nextVariableId().toString(),n!=null&&n!==t.dtype&&(t=t.cast(n));let a=new As(t,r,o,this.nextTensorId());if(this.state.registeredVariables[a.name]!=null)throw new Error(`Variable with name ${a.name} was already registered`);return this.state.registeredVariables[a.name]=a,this.incRef(a,this.backend),a}trackTensor(t,r){this.state.numTensors++,t.dtype==="string"&&this.state.numStringTensors++;let o=0;t.dtype!=="complex64"&&t.dtype!=="string"&&(o=t.size*Xd(t.dtype)),this.state.numBytes+=o,this.state.tensorInfo.has(t.dataId)||(this.state.numDataBuffers++,this.state.tensorInfo.set(t.dataId,{backend:r||this.backend,dtype:t.dtype,shape:t.shape,bytes:o})),t instanceof As||this.track(t)}incRef(t,r){this.trackTensor(t,r),this.backend.incRef(t.dataId)}removeDataId(t,r){this.state.tensorInfo.has(t)&&this.state.tensorInfo.get(t).backend===r&&(this.state.tensorInfo.delete(t),this.state.numDataBuffers--)}disposeTensor(t){if(!this.state.tensorInfo.has(t.dataId))return;let r=this.state.tensorInfo.get(t.dataId);if(this.state.numTensors--,t.dtype==="string"&&(this.state.numStringTensors--,this.state.numBytes-=r.bytes),t.dtype!=="complex64"&&t.dtype!=="string"){let o=t.size*Xd(t.dtype);this.state.numBytes-=o}r.backend.disposeData(t.dataId)&&this.removeDataId(t.dataId,r.backend)}disposeVariables(){for(let t in this.state.registeredVariables){let r=this.state.registeredVariables[t];this.disposeVariable(r)}}disposeVariable(t){this.disposeTensor(t),this.state.registeredVariables[t.name]!=null&&delete this.state.registeredVariables[t.name]}memory(){let t=this.backend.memory();return t.numTensors=this.state.numTensors,t.numDataBuffers=this.state.numDataBuffers,t.numBytes=this.state.numBytes,this.state.numStringTensors>0&&(t.unreliable=!0,t.reasons==null&&(t.reasons=[]),t.reasons.push("Memory usage by string tensors is approximate (2 bytes per character)")),t}async profile(t){this.state.profiling=!0;let r=this.state.numBytes,o=this.state.numTensors;this.state.activeProfile.kernels=[],this.state.activeProfile.result=await t(),this.state.profiling=!1,this.state.activeProfile.peakBytes=Math.max(...this.state.activeProfile.kernels.map(n=>n.totalBytesSnapshot)),this.state.activeProfile.newBytes=this.state.numBytes-r,this.state.activeProfile.newTensors=this.state.numTensors-o;for(let n of this.state.activeProfile.kernels)n.kernelTimeMs=await n.kernelTimeMs,n.extraInfo=await n.extraInfo;return this.state.activeProfile}isTapeOn(){return this.state.gradientDepth>0&&this.state.kernelDepth===0}addTapeNode(t,r,o,n,a,i){let s={id:this.state.nextTapeNodeId++,kernelName:t,inputs:r,outputs:o,saved:a},c=g3(t);c!=null&&(n=c.gradFunc),n!=null&&(s.gradient=l=>(l=l.map((p,u)=>{if(p==null){let m=o[u],f=Zd(m.size,m.dtype);return this.makeTensor(f,m.shape,m.dtype)}return p}),n(l.length>1?l:l[0],a,i))),this.state.activeTape.push(s)}keep(t){return t.kept=!0,t}startTape(){this.state.gradientDepth===0&&(this.state.activeTape=[]),this.state.gradientDepth++}endTape(){this.state.gradientDepth--}startScope(t){let r={track:[],name:"unnamed scope",id:this.state.nextScopeId++};t&&(r.name=t),this.state.scopeStack.push(r),this.state.activeScope=r}endScope(t){let r=Q1(t),o=new Set(r.map(a=>a.id));for(let a=0;a<this.state.activeScope.track.length;a++){let i=this.state.activeScope.track[a];!i.kept&&!o.has(i.id)&&i.dispose()}let n=this.state.scopeStack.pop();this.state.activeScope=this.state.scopeStack.length===0?null:this.state.scopeStack[this.state.scopeStack.length-1],r.forEach(a=>{!a.kept&&a.scopeId===n.id&&this.track(a)})}gradients(t,r,o,n=!1){if(D(r.length>0,()=>"gradients() received an empty list of xs."),o!=null&&o.dtype!=="float32")throw new Error(`dy must have 'float32' dtype, but has '${o.dtype}'`);let a=this.scopedRun(()=>this.startTape(),()=>this.endTape(),()=>this.tidy("forward",t));D(a instanceof $t,()=>"The result y returned by f() must be a tensor.");let i=gL(this.state.activeTape,r,a);if(!n&&i.length===0&&r.length>0)throw new Error("Cannot compute gradient of y=f(x) with respect to x. Make sure that the f you passed encloses all operations that lead from x to y.");return this.tidy("backward",()=>{let s={};s[a.id]=o??$ue(a.shape),yL(s,i,l=>this.tidy(l),Lue);let c=r.map(l=>s[l.id]);return this.state.gradientDepth===0&&(this.state.activeTape.forEach(l=>{for(let p of l.saved)p.dispose()}),this.state.activeTape=null),{value:a,grads:c}})}customGrad(t){return D(Qd(t),()=>"The f passed in customGrad(f) must be a function."),(...r)=>{D(r.every(s=>s instanceof $t),()=>"The args passed in customGrad(f)(x1, x2,...) must all be tensors");let o,n={};r.forEach((s,c)=>{n[c]=s});let a=(s,c)=>(o=t(...r,c),D(o.value instanceof $t,()=>"The function f passed in customGrad(f) must return an object where `obj.value` is a tensor"),D(Qd(o.gradFunc),()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function."),o.value),i=(s,c)=>{let l=o.gradFunc(s,c),p=Array.isArray(l)?l:[l];D(p.length===r.length,()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns the same number of tensors as inputs passed to f(...)."),D(p.every(m=>m instanceof $t),()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns a list of only tensors.");let u={};return p.forEach((m,f)=>{u[f]=()=>m}),u};return this.runKernelFunc({forwardFunc:a,backwardsFunc:i,inputs:n})}}readSync(t){return this.state.tensorInfo.get(t).backend.readSync(t)}read(t){return this.state.tensorInfo.get(t).backend.read(t)}readToGPU(t,r){return this.state.tensorInfo.get(t).backend.readToGPU(t,r)}async time(t){let r=vm(),o=await this.backend.time(t);return o.wallMs=vm()-r,o}track(t){return this.state.activeScope!=null&&(t.scopeId=this.state.activeScope.id,this.state.activeScope.track.push(t)),t}get registeredVariables(){return this.state.registeredVariables}reset(){this.pendingBackendInitId++,this.state.dispose(),this.ENV.reset(),this.state=new J1;for(let t in this.registry)this.disposeRegisteredKernels(t),this.registry[t].dispose(),delete this.registry[t];this.backendName=null,this.backendInstance=null,this.pendingBackendInit=null}};cb.nextTensorId=0;cb.nextVariableId=0;function $ue(e){let t=Xv(mt(e),"float32");return A.makeTensor(t,e,"float32")}function A3(){let e=d3();if(e._tfengine==null){let t=new Yv(e);e._tfengine=new cb(t)}return J8(e._tfengine.ENV),wL(()=>e._tfengine),e._tfengine}var A=A3();function Lue(e,t){let r={a:e,b:t};return A.runKernel(Is,r)}function IL(){return typeof window<"u"&&window.document!=null||typeof WorkerGlobalScope<"u"}var rn=Ne();rn.registerFlag("DEBUG",()=>!1,e=>{e&&console.warn("Debugging mode is ON. The output of every math call will be downloaded to CPU and checked for NaNs. This significantly impacts performance.")});rn.registerFlag("IS_BROWSER",()=>IL());rn.registerFlag("IS_NODE",()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u");rn.registerFlag("IS_CHROME",()=>typeof navigator<"u"&&navigator!=null&&navigator.userAgent!=null&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor));rn.registerFlag("IS_SAFARI",()=>typeof navigator<"u"&&navigator!=null&&navigator.userAgent!=null&&/Safari/.test(navigator.userAgent)&&/Apple/.test(navigator.vendor));rn.registerFlag("PROD",()=>!1);rn.registerFlag("TENSORLIKE_CHECK_SHAPE_CONSISTENCY",()=>rn.getBool("DEBUG"));rn.registerFlag("DEPRECATION_WARNINGS_ENABLED",()=>!0);rn.registerFlag("IS_TEST",()=>!1);rn.registerFlag("CHECK_COMPUTATION_FOR_ERRORS",()=>rn.getBool("DEBUG"));rn.registerFlag("WRAP_TO_IMAGEBITMAP",()=>!1);rn.registerFlag("CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU",()=>!1);rn.registerFlag("USE_SETTIMEOUTCUSTOM",()=>!1);function on(e,t){let r=e;if(Co(e))return t==="string"?[]:[e.length];if(X1(e)){let n=e.channels||"RGBA";return[e.height,e.width*n.length]}else if(Y1(e))return[e.buffer.size/(t==null?4:Xd(t))];if(!Array.isArray(e))return[];let o=[];for(;Array.isArray(r)||Co(r)&&t!=="string";)o.push(r.length),r=r[0];return Array.isArray(e)&&Ne().getBool("TENSORLIKE_CHECK_SHAPE_CONSISTENCY")&&CL(e,o,[]),o}function CL(e,t,r){if(r=r||[],!Array.isArray(e)&&!Co(e)){D(t.length===0,()=>`Element arr[${r.join("][")}] is a primitive, but should be an array/TypedArray of ${t[0]} elements`);return}D(t.length>0,()=>`Element arr[${r.join("][")}] should be a primitive, but is an array of ${e.length} elements`),D(e.length===t[0],()=>`Element arr[${r.join("][")}] should have ${t[0]} elements, but has ${e.length} elements`);let o=t.slice(1);for(let n=0;n<e.length;++n)CL(e[n],o,r.concat(n))}function TL(e,t,r,o){if(e!=="string_or_numeric"){if(e==null)throw new Error("Expected dtype cannot be null.");if(e!=="numeric"&&e!==t||e==="numeric"&&t==="string")throw new Error(`Argument '${r}' passed to '${o}' must be ${e} tensor, but got ${t} tensor`)}}function _(e,t,r,o="numeric"){if(e instanceof $t)return TL(o,e.dtype,t,r),e;let n=$l(e);if(n!=="string"&&["bool","int32","float32"].indexOf(o)>=0&&(n=o),TL(o,n,t,r),e==null||!Co(e)&&!Array.isArray(e)&&typeof e!="number"&&typeof e!="boolean"&&typeof e!="string"){let c=e==null?"null":e.constructor.name;throw new Error(`Argument '${t}' passed to '${r}' must be a Tensor or TensorLike, but got '${c}'`)}let a=on(e,n);!Co(e)&&!Array.isArray(e)&&(e=[e]);let s=n!=="string"?zh(e,n):ql(e,[],!0);return A.makeTensor(s,a,n)}function bm(e,t,r,o="numeric"){if(!Array.isArray(e))throw new Error(`Argument ${t} passed to ${r} must be a \`Tensor[]\` or \`TensorLike[]\``);return e.map((a,i)=>_(a,`${t}[${i}]`,r,o))}var R3="__op";function T(e){let t=Object.keys(e);if(t.length!==1)throw new Error(`Please provide an object with a single key (operation name) mapping to a function. Got an object with ${t.length} keys.`);let r=t[0],o=e[r];r.endsWith("_")&&(r=r.substring(0,r.length-1)),r=r+R3;let n=(...a)=>{A.startScope(r);try{let i=o(...a);return bp(i)&&console.error("Cannot return a Promise inside of tidy."),A.endScope(i),i}catch(i){throw A.endScope(null),i}};return Object.defineProperty(n,"name",{value:r,configurable:!0}),n}function Uue(e,t){let r=_(e,"real","complex"),o=_(t,"imag","complex");gr(r.shape,o.shape,`real and imag shapes, ${r.shape} and ${o.shape}, must match in call to tf.complex().`);let n={real:r,imag:o};return A.runKernel(E1,n)}var nn=T({complex_:Uue});function Bo(e,t,r,o){if(o==null)o=$l(e);else if(o==="complex64")throw new Error("Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).");if(Y1(e)||X1(e)){if(o!=="float32"&&o!=="int32")throw new Error(`Creating tensor from GPU data only supports 'float32'|'int32' dtype, while the dtype is ${o}.`);return A.backend.createTensorFromGPUData(e,t||r,o)}if(!Co(e)&&!Array.isArray(e)&&typeof e!="number"&&typeof e!="boolean"&&typeof e!="string")throw new Error("values passed to tensor(values) must be a number/boolean/string or an array of numbers/booleans/strings, or a TypedArray");if(t!=null){or(t);let n=mt(t),a=mt(r);D(n===a,()=>`Based on the provided shape, [${t}], the tensor should have ${n} values but has ${a}`);for(let i=0;i<r.length;++i){let s=r[i],c=i===r.length-1?s!==mt(t.slice(i)):!0;D(r[i]===t[i]||!c,()=>`Error creating a new Tensor. Inferred shape (${r}) does not match the provided shape (${t}). `)}}return!Co(e)&&!Array.isArray(e)&&(e=[e]),t=t||r,e=o!=="string"?zh(e,o):ql(e,[],!0),A.makeTensor(e,t,o)}function go(e,t,r){let o=on(e,r);return Bo(e,t,o,r)}var pb={float32:4,float16:2,int32:4,uint16:2,uint8:1,bool:1,complex64:8};var yo=class e{static join(t){return new e(t).slice()}constructor(t){if(this.shards=[],this.previousShardIndex=0,t==null||(t instanceof Array||(t=[t]),t=t.map(o=>Co(o)?o.buffer:o),t.length===0))return;this.bufferUniformSize=t[0].byteLength;let r=0;for(let o=0;o<t.length;o++){let n=t[o];o!==t.length-1&&n.byteLength!==this.bufferUniformSize&&(this.bufferUniformSize=void 0);let a=r+n.byteLength;this.shards.push({buffer:n,start:r,end:a}),r=a}this.shards.length===0&&(this.byteLength=0),this.byteLength=this.shards[this.shards.length-1].end}slice(t=0,r=this.byteLength){if(this.shards.length===0)return new ArrayBuffer(0);if(t=isNaN(Number(t))?0:t,r=isNaN(Number(r))?0:r,t=Math.max(0,t),r=Math.min(this.byteLength,r),r<=t)return new ArrayBuffer(0);let o=this.findShardForByte(t);if(o===-1)throw new Error(`Could not find start shard for byte ${t}`);let n=r-t,a=new ArrayBuffer(n),i=new Uint8Array(a),s=0;for(let c=o;c<this.shards.length;c++){let l=this.shards[c],u=t+s-l.start,m=s,d=Math.min(r,l.end)-l.start,h=new Uint8Array(l.buffer,u,d-u);if(i.set(h,m),s+=h.length,r<l.end)break}return a}findShardForByte(t){if(this.shards.length===0||t<0||t>=this.byteLength)return-1;if(this.bufferUniformSize!=null)return this.previousShardIndex=Math.floor(t/this.bufferUniformSize),this.previousShardIndex;function r(n){return t<n.start?-1:t>=n.end?1:0}if(r(this.shards[this.previousShardIndex])===0)return this.previousShardIndex;let o=Wue(this.shards,r);return o===-1?-1:(this.previousShardIndex=o,this.previousShardIndex)}};function Wue(e,t){let r=0,o=e.length;for(;r<=o;){let n=Math.floor((o-r)/2)+r,a=t(e[n]);if(a===0)return n;a<0?o=n:r=n+1}return-1}var Z1=4;async function AL(e,t){let r=[],o=[],n=Array.isArray(e)?e.map(i=>i.name):Object.keys(e);for(let i=0;i<n.length;++i){let s=n[i],c=Array.isArray(e)?e[i].tensor:e[s];if(c.dtype!=="float32"&&c.dtype!=="int32"&&c.dtype!=="bool"&&c.dtype!=="string"&&c.dtype!=="complex64")throw new Error(`Unsupported dtype in weight '${s}': ${c.dtype}`);let l={name:s,shape:c.shape,dtype:c.dtype};if(c.dtype==="string"){let p=new Promise(async u=>{let m=await c.bytes(),f=m.reduce((y,g)=>y+g.length,0)+Z1*m.length,d=new Uint8Array(f),h=0;for(let y=0;y<m.length;y++){let g=m[y],b=new Uint8Array(new Uint32Array([g.length]).buffer);d.set(b,h),h+=Z1,d.set(g,h),h+=g.length}u(d)});o.push(p)}else o.push(c.data());t!=null&&(l.group=t),r.push(l)}let a=await Promise.all(o);return{data:Hue(a),specs:r}}function eS(e,t){let r=new yo(e),o={},n,a=0;for(let i of t){let s=i.name,c=i.dtype,l=i.shape,p=mt(l),u;if("quantization"in i){let m=i.quantization;if(m.dtype==="uint8"||m.dtype==="uint16"){if(!("min"in m&&"scale"in m))throw new Error(`Weight ${i.name} with quantization ${m.dtype} doesn't have corresponding metadata min and scale.`)}else if(m.dtype==="float16"){if(c!=="float32")throw new Error(`Weight ${i.name} is quantized with ${m.dtype} which only supports weights of type float32 not ${c}.`)}else throw new Error(`Weight ${i.name} has unknown quantization dtype ${m.dtype}. Supported quantization dtypes are: 'uint8', 'uint16', and 'float16'.`);let f=pb[m.dtype],d=r.slice(a,a+p*f),h=m.dtype==="uint8"?new Uint8Array(d):new Uint16Array(d);if(c==="float32")if(m.dtype==="uint8"||m.dtype==="uint16"){u=new Float32Array(h.length);for(let y=0;y<h.length;y++){let g=h[y];u[y]=g*m.scale+m.min}}else if(m.dtype==="float16")n===void 0&&(n=que()),u=n(h);else throw new Error(`Unsupported quantization type ${m.dtype} for weight type float32.`);else if(c==="int32"){if(m.dtype!=="uint8"&&m.dtype!=="uint16")throw new Error(`Unsupported quantization type ${m.dtype} for weight type int32.`);u=new Int32Array(h.length);for(let y=0;y<h.length;y++){let g=h[y];u[y]=Math.round(g*m.scale+m.min)}}else throw new Error(`Unsupported dtype in weight '${s}': ${c}`);a+=p*f}else if(c==="string"){let m=mt(i.shape);u=[];for(let f=0;f<m;f++){let d=new Uint32Array(r.slice(a,a+Z1))[0];a+=Z1;let h=new Uint8Array(r.slice(a,a+d));u.push(h),a+=d}}else{let m=pb[c],f=r.slice(a,a+p*m);if(c==="float32")u=new Float32Array(f);else if(c==="int32")u=new Int32Array(f);else if(c==="bool")u=new Uint8Array(f);else if(c==="complex64"){u=new Float32Array(f);let d=new Float32Array(u.length/2),h=new Float32Array(u.length/2);for(let b=0;b<d.length;b++)d[b]=u[b*2],h[b]=u[b*2+1];let y=go(d,l,"float32"),g=go(h,l,"float32");o[s]=nn(y,g),y.dispose(),g.dispose()}else throw new Error(`Unsupported dtype in weight '${s}': ${c}`);a+=p*m}c!=="complex64"&&(o[s]=go(u,l,c))}return o}function Hue(e){if(e===null)throw new Error(`Invalid input value: ${JSON.stringify(e)}`);let t=0,r=[];e.forEach(a=>{if(t+=a.byteLength,r.push(a.byteLength===a.buffer.byteLength?a:new a.constructor(a)),!(a instanceof Float32Array||a instanceof Int32Array||a instanceof Uint8Array))throw new Error(`Unsupported TypedArray subtype: ${a.constructor.name}`)});let o=new Uint8Array(t),n=0;return r.forEach(a=>{o.set(new Uint8Array(a.buffer),n),n+=a.byteLength}),o.buffer}var D3=typeof Buffer<"u"&&(typeof Blob>"u"||typeof atob>"u"||typeof btoa>"u");function NL(e){return D3?Buffer.byteLength(e,"utf8"):new Blob([e]).size}function RL(e){if(D3)return Buffer.from(e).toString("base64");let t=new Uint8Array(e),r="";for(let o=0,n=t.length;o<n;o++)r+=String.fromCharCode(t[o]);return btoa(r)}function DL(e){if(D3){let o=Buffer.from(e,"base64");return o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength)}let t=atob(e),r=new Uint8Array(t.length);for(let o=0;o<t.length;++o)r.set([t.charCodeAt(o)],o);return r.buffer}function FL(e){return yo.join(e)}function F3(e){let t="/";for(e=e.trim();e.endsWith(t);)e=e.slice(0,e.length-1);let r=e.split(t);return r[r.length-1]}function tS(e,t){let r={modelTopology:e.modelTopology,format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy,weightsManifest:t};return e.signature!=null&&(r.signature=e.signature),e.userDefinedMetadata!=null&&(r.userDefinedMetadata=e.userDefinedMetadata),e.modelInitializer!=null&&(r.modelInitializer=e.modelInitializer),e.initializerSignature!=null&&(r.initializerSignature=e.initializerSignature),e.trainingConfig!=null&&(r.trainingConfig=e.trainingConfig),r}function M3(e,t,r){let o={modelTopology:e.modelTopology,format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy};if(e.trainingConfig!=null&&(o.trainingConfig=e.trainingConfig),e.weightsManifest!=null){if(!t)throw new Error("modelJSON has weightsManifest but weightSpecs is null");if(!r)throw new Error("modelJSON has weightsManifest but weightData is null");o.weightSpecs=t,o.weightData=r}return e.signature!=null&&(o.signature=e.signature),e.userDefinedMetadata!=null&&(o.userDefinedMetadata=e.userDefinedMetadata),e.modelInitializer!=null&&(o.modelInitializer=e.modelInitializer),e.initializerSignature!=null&&(o.initializerSignature=e.initializerSignature),o}async function Uh(e,t){let r,o;return e.weightsManifest!=null&&([r,o]=await t(e.weightsManifest)),M3(e,r,o)}function Ri(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("Expected JSON model topology, received ArrayBuffer.");return{dateSaved:new Date,modelTopologyType:"JSON",modelTopologyBytes:e.modelTopology==null?0:NL(JSON.stringify(e.modelTopology)),weightSpecsBytes:e.weightSpecs==null?0:NL(JSON.stringify(e.weightSpecs)),weightDataBytes:e.weightData==null?0:new yo(e.weightData).byteLength}}function rS(e){let t=[];for(let r of e)t.push(...r.weights);return t}function Vue(){let e=r=>{let o=r<<13,n=0;for(;!(o&8388608);)n-=8388608,o<<=1;return o&=-8388609,n+=947912704,o|n},t=new Uint32Array(2048);t[0]=0;for(let r=1;r<1024;r++)t[r]=e(r);for(let r=1024;r<2048;r++)t[r]=939524096+(r-1024<<13);return t}function jue(){let e=new Uint32Array(64);e[0]=0,e[31]=1199570944,e[32]=2147483648,e[63]=3347054592;for(let t=1;t<31;t++)e[t]=t<<23;for(let t=33;t<63;t++)e[t]=2147483648+(t-32<<23);return e}function Gue(){let e=new Uint32Array(64);for(let t=0;t<64;t++)e[t]=1024;return e[0]=e[32]=0,e}function que(){let e=Vue(),t=jue(),r=Gue();return o=>{let n=new ArrayBuffer(4*o.length),a=new Uint32Array(n);for(let i=0;i<o.length;i++){let s=o[i],c=e[r[s>>10]+(s&1023)]+t[s>>10];a[i]=c}return new Float32Array(n)}}var Jr=class e{constructor(){this.saveRouters=[],this.loadRouters=[]}static getInstance(){return e.instance==null&&(e.instance=new e),e.instance}static registerSaveRouter(t){e.getInstance().saveRouters.push(t)}static registerLoadRouter(t){e.getInstance().loadRouters.push(t)}static getSaveHandlers(t){return e.getHandlers(t,"save")}static getLoadHandlers(t,r){return e.getHandlers(t,"load",r)}static getHandlers(t,r,o){let n=[];return(r==="load"?e.getInstance().loadRouters:e.getInstance().saveRouters).forEach(i=>{let s=i(t,o);s!==null&&n.push(s)}),n}},ML=e=>Jr.registerSaveRouter(e),OL=e=>Jr.registerLoadRouter(e),PL=e=>Jr.getSaveHandlers(e),zL=(e,t)=>Jr.getLoadHandlers(e,t);var O3="tensorflowjs",P3=1,xm="models_store",Kl="model_info_store";function $L(){if(!Ne().getBool("IS_BROWSER"))throw new Error("Failed to obtain IndexedDB factory because the current environmentis not a web browser.");let e=typeof window>"u"?self:window,t=e.indexedDB||e.mozIndexedDB||e.webkitIndexedDB||e.msIndexedDB||e.shimIndexedDB;if(t==null)throw new Error("The current browser does not appear to support IndexedDB.");return t}function z3(e){let t=e.result;t.createObjectStore(xm,{keyPath:"modelPath"}),t.createObjectStore(Kl,{keyPath:"modelPath"})}var Di=class{constructor(t){if(this.indexedDB=$L(),t==null||!t)throw new Error("For IndexedDB, modelPath must not be null, undefined or empty.");this.modelPath=t}async save(t){if(t.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");return this.databaseAction(this.modelPath,t)}async load(){return this.databaseAction(this.modelPath)}databaseAction(t,r){return new Promise((o,n)=>{let a=this.indexedDB.open(O3,P3);a.onupgradeneeded=()=>z3(a),a.onsuccess=()=>{let i=a.result;if(r==null){let s=i.transaction(xm,"readonly"),l=s.objectStore(xm).get(this.modelPath);l.onsuccess=()=>{if(l.result==null)return i.close(),n(new Error(`Cannot find model with path '${this.modelPath}' in IndexedDB.`));o(l.result.modelArtifacts)},l.onerror=p=>(i.close(),n(l.error)),s.oncomplete=()=>i.close()}else{r.weightData=yo.join(r.weightData);let s=Ri(r),c=i.transaction(Kl,"readwrite"),l=c.objectStore(Kl),p;try{p=l.put({modelPath:this.modelPath,modelArtifactsInfo:s})}catch(m){return n(m)}let u;p.onsuccess=()=>{u=i.transaction(xm,"readwrite");let m=u.objectStore(xm),f;try{f=m.put({modelPath:this.modelPath,modelArtifacts:r,modelArtifactsInfo:s})}catch(d){return n(d)}f.onsuccess=()=>o({modelArtifactsInfo:s}),f.onerror=d=>{l=c.objectStore(Kl);let h=l.delete(this.modelPath);h.onsuccess=()=>(i.close(),n(f.error)),h.onerror=y=>(i.close(),n(f.error))}},p.onerror=m=>(i.close(),n(p.error)),c.oncomplete=()=>{u==null?i.close():u.oncomplete=()=>i.close()}}},a.onerror=i=>n(a.error)})}};Di.URL_SCHEME="indexeddb://";var LL=e=>Ne().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(Di.URL_SCHEME)?Kue(e.slice(Di.URL_SCHEME.length)):null;Jr.registerSaveRouter(LL);Jr.registerLoadRouter(LL);function Kue(e){return new Di(e)}function Xue(e){return e.startsWith(Di.URL_SCHEME)?e.slice(Di.URL_SCHEME.length):e}var oS=class{constructor(){this.indexedDB=$L()}async listModels(){return new Promise((t,r)=>{let o=this.indexedDB.open(O3,P3);o.onupgradeneeded=()=>z3(o),o.onsuccess=()=>{let n=o.result,a=n.transaction(Kl,"readonly"),s=a.objectStore(Kl).getAll();s.onsuccess=()=>{let c={};for(let l of s.result)c[l.modelPath]=l.modelArtifactsInfo;t(c)},s.onerror=c=>(n.close(),r(s.error)),a.oncomplete=()=>n.close()},o.onerror=n=>r(o.error)})}async removeModel(t){return t=Xue(t),new Promise((r,o)=>{let n=this.indexedDB.open(O3,P3);n.onupgradeneeded=()=>z3(n),n.onsuccess=()=>{let a=n.result,i=a.transaction(Kl,"readwrite"),s=i.objectStore(Kl),c=s.get(t),l;c.onsuccess=()=>{if(c.result==null)return a.close(),o(new Error(`Cannot find model with path '${t}' in IndexedDB.`));{let p=s.delete(t),u=()=>{l=a.transaction(xm,"readwrite");let f=l.objectStore(xm).delete(t);f.onsuccess=()=>r(c.result.modelArtifactsInfo),f.onerror=d=>o(c.error)};p.onsuccess=u,p.onerror=m=>(u(),a.close(),o(c.error))}},c.onerror=p=>(a.close(),o(c.error)),i.oncomplete=()=>{l==null?a.close():l.oncomplete=()=>a.close()}},n.onerror=a=>o(n.error)})}};var Rs="/",Wh="tensorflowjs_models",BL="info",Yue="model_topology",Que="weight_specs",Jue="weight_data",Zue="model_metadata";function UL(e){return{info:[Wh,e,BL].join(Rs),topology:[Wh,e,Yue].join(Rs),weightSpecs:[Wh,e,Que].join(Rs),weightData:[Wh,e,Jue].join(Rs),modelMetadata:[Wh,e,Zue].join(Rs)}}function WL(e){for(let t of Object.values(e))window.localStorage.removeItem(t)}function eme(e){let t=e.split(Rs);if(t.length<3)throw new Error(`Invalid key format: ${e}`);return t.slice(1,t.length-1).join(Rs)}function tme(e){return e.startsWith(Fi.URL_SCHEME)?e.slice(Fi.URL_SCHEME.length):e}var Fi=class{constructor(t){if(!Ne().getBool("IS_BROWSER")||typeof window>"u"||typeof window.localStorage>"u")throw new Error("The current environment does not support local storage.");if(this.LS=window.localStorage,t==null||!t)throw new Error("For local storage, modelPath must not be null, undefined or empty.");this.modelPath=t,this.keys=UL(this.modelPath)}async save(t){if(t.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");{let r=JSON.stringify(t.modelTopology),o=JSON.stringify(t.weightSpecs),n=Ri(t),a=yo.join(t.weightData);try{this.LS.setItem(this.keys.info,JSON.stringify(n)),this.LS.setItem(this.keys.topology,r),this.LS.setItem(this.keys.weightSpecs,o),this.LS.setItem(this.keys.weightData,RL(a));let i={format:t.format,generatedBy:t.generatedBy,convertedBy:t.convertedBy,signature:t.signature!=null?t.signature:void 0,userDefinedMetadata:t.userDefinedMetadata!=null?t.userDefinedMetadata:void 0,modelInitializer:t.modelInitializer!=null?t.modelInitializer:void 0,initializerSignature:t.initializerSignature!=null?t.initializerSignature:void 0,trainingConfig:t.trainingConfig!=null?t.trainingConfig:void 0};return this.LS.setItem(this.keys.modelMetadata,JSON.stringify(i)),{modelArtifactsInfo:n}}catch{throw WL(this.keys),new Error(`Failed to save model '${this.modelPath}' to local storage: size quota being exceeded is a possible cause of this failure: modelTopologyBytes=${n.modelTopologyBytes}, weightSpecsBytes=${n.weightSpecsBytes}, weightDataBytes=${n.weightDataBytes}.`)}}}async load(){let t=JSON.parse(this.LS.getItem(this.keys.info));if(t==null)throw new Error(`In local storage, there is no model with name '${this.modelPath}'`);if(t.modelTopologyType!=="JSON")throw new Error("BrowserLocalStorage does not support loading non-JSON model topology yet.");let r={},o=JSON.parse(this.LS.getItem(this.keys.topology));if(o==null)throw new Error(`In local storage, the topology of model '${this.modelPath}' is missing.`);r.modelTopology=o;let n=JSON.parse(this.LS.getItem(this.keys.weightSpecs));if(n==null)throw new Error(`In local storage, the weight specs of model '${this.modelPath}' are missing.`);r.weightSpecs=n;let a=this.LS.getItem(this.keys.modelMetadata);if(a!=null){let s=JSON.parse(a);r.format=s.format,r.generatedBy=s.generatedBy,r.convertedBy=s.convertedBy,s.signature!=null&&(r.signature=s.signature),s.userDefinedMetadata!=null&&(r.userDefinedMetadata=s.userDefinedMetadata),s.modelInitializer!=null&&(r.modelInitializer=s.modelInitializer),s.initializerSignature!=null&&(r.initializerSignature=s.initializerSignature),s.trainingConfig!=null&&(r.trainingConfig=s.trainingConfig)}let i=this.LS.getItem(this.keys.weightData);if(i==null)throw new Error(`In local storage, the binary weight values of model '${this.modelPath}' are missing.`);return r.weightData=DL(i),r}};Fi.URL_SCHEME="localstorage://";var HL=e=>Ne().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(Fi.URL_SCHEME)?rme(e.slice(Fi.URL_SCHEME.length)):null;Jr.registerSaveRouter(HL);Jr.registerLoadRouter(HL);function rme(e){return new Fi(e)}var nS=class{constructor(){D(Ne().getBool("IS_BROWSER"),()=>"Current environment is not a web browser"),D(typeof window>"u"||typeof window.localStorage<"u",()=>"Current browser does not appear to support localStorage"),this.LS=window.localStorage}async listModels(){let t={},r=Wh+Rs,o=Rs+BL;for(let n=0;n<this.LS.length;++n){let a=this.LS.key(n);if(a.startsWith(r)&&a.endsWith(o)){let i=eme(a);t[i]=JSON.parse(this.LS.getItem(a))}}return t}async removeModel(t){t=tme(t);let r=UL(t);if(this.LS.getItem(r.info)==null)throw new Error(`Cannot find model at path '${t}'`);let o=JSON.parse(this.LS.getItem(r.info));return WL(r),o}};var Hh="://",ni=class e{constructor(){this.managers={}}static getInstance(){return e.instance==null&&(e.instance=new e),e.instance}static registerManager(t,r){D(t!=null,()=>"scheme must not be undefined or null."),t.endsWith(Hh)&&(t=t.slice(0,t.indexOf(Hh))),D(t.length>0,()=>"scheme must not be an empty string.");let o=e.getInstance();D(o.managers[t]==null,()=>`A model store manager is already registered for scheme '${t}'.`),o.managers[t]=r}static getManager(t){let r=e.getInstance().managers[t];if(r==null)throw new Error(`Cannot find model manager for scheme '${t}'`);return r}static getSchemes(){return Object.keys(e.getInstance().managers)}};function aS(e){if(e.indexOf(Hh)===-1)throw new Error(`The url string provided does not contain a scheme. Supported schemes are: ${ni.getSchemes().join(",")}`);return{scheme:e.split(Hh)[0],path:e.split(Hh)[1]}}async function VL(e,t,r=!1){D(e!==t,()=>`Old path and new path are the same: '${e}'`);let o=Jr.getLoadHandlers(e);D(o.length>0,()=>`Copying failed because no load handler is found for source URL ${e}.`),D(o.length<2,()=>`Copying failed because more than one (${o.length}) load handlers for source URL ${e}.`);let n=o[0],a=Jr.getSaveHandlers(t);D(a.length>0,()=>`Copying failed because no save handler is found for destination URL ${t}.`),D(a.length<2,()=>`Copying failed because more than one (${o.length}) save handlers for destination URL ${t}.`);let i=a[0],s=aS(e).scheme,c=aS(e).path,l=s===aS(e).scheme,p=await n.load();r&&l&&await ni.getManager(s).removeModel(c);let u=await i.save(p);return r&&!l&&await ni.getManager(s).removeModel(c),u.modelArtifactsInfo}async function jL(){let e=ni.getSchemes(),t={};for(let r of e){let o=await ni.getManager(r).listModels();for(let n in o){let a=r+Hh+n;t[a]=o[n]}}return t}async function GL(e){let t=aS(e);return ni.getManager(t.scheme).removeModel(t.path)}async function qL(e,t){return VL(e,t,!1)}async function KL(e,t){return VL(e,t,!0)}var $3=class{constructor(){this.messageName="setTimeoutCustom",this.functionRefs=[],this.handledMessageCount=0,this.hasEventListener=!1}fetch(t,r){return fetch(t,r)}now(){return performance.now()}encode(t,r){if(r!=="utf-8"&&r!=="utf8")throw new Error(`Browser's encoder only supports utf-8, but got ${r}`);return this.textEncoder==null&&(this.textEncoder=new TextEncoder),this.textEncoder.encode(t)}decode(t,r){return new TextDecoder(r).decode(t)}setTimeoutCustom(t,r){if(typeof window>"u"||!Ne().getBool("USE_SETTIMEOUTCUSTOM")){setTimeout(t,r);return}this.functionRefs.push(t),setTimeout(()=>{window.postMessage({name:this.messageName,index:this.functionRefs.length-1},"*")},r),this.hasEventListener||(this.hasEventListener=!0,window.addEventListener("message",o=>{if(o.source===window&&o.data.name===this.messageName){o.stopPropagation();let n=this.functionRefs[o.data.index];n(),this.handledMessageCount++,this.handledMessageCount===this.functionRefs.length&&(this.functionRefs=[],this.handledMessageCount=0)}},!0))}isTypedArray(t){return V1(t)}};if(Ne().get("IS_BROWSER")){Ne().setPlatform("browser",new $3);try{ni.registerManager(Fi.URL_SCHEME,new nS)}catch{}try{ni.registerManager(Di.URL_SCHEME,new oS)}catch{}}var ome={importFetch:()=>XL()},L3;var B3=class{constructor(){this.util=YL(),this.textEncoder=new this.util.TextEncoder}fetch(t,r){return Ne().global.fetch!=null?Ne().global.fetch(t,r):(L3==null&&(L3=ome.importFetch()),L3(t,r))}now(){let t=process.hrtime();return t[0]*1e3+t[1]/1e6}encode(t,r){if(r!=="utf-8"&&r!=="utf8")throw new Error(`Node built-in encoder only supports utf-8, but got ${r}`);return this.textEncoder.encode(t)}decode(t,r){return t.length===0?"":new this.util.TextDecoder(r).decode(t)}isTypedArray(t){return this.util.types.isFloat32Array(t)||this.util.types.isInt32Array(t)||this.util.types.isUint8Array(t)||this.util.types.isUint8ClampedArray(t)}};Ne().get("IS_NODE")&&!Ne().get("IS_BROWSER")&&Ne().setPlatform("node",new B3);function Re(e,t="float32",r){return t=t||"float32",or(e),new Tt(e,t,r)}function nme(e,t){let r=_(e,"x","cast");if(!p3(t))throw new Error(`Failed to cast to unknown dtype ${t}`);if(t==="string"&&r.dtype!=="string"||t!=="string"&&r.dtype==="string")throw new Error("Only strings can be casted to strings");let o={x:r},n={dtype:t};return A.runKernel(Ll,o,n)}var pt=T({cast_:nme});function ame(e){let r={x:_(e,"x","clone","string_or_numeric")};return A.runKernel(Ul,r)}var Rn=T({clone_:ame});function iS(e,t=!1){console.log(e.toString(t))}A3();var ime={buffer:Re,cast:pt,clone:Rn,print:iS};SL(ime);function QL(e){Ne().getBool("DEPRECATION_WARNINGS_ENABLED")&&console.warn(e+" You can disable deprecation warnings with tf.disableDeprecationWarnings().")}kL(QL);function ub(){return A}function He(e,t){return A.tidy(e,t)}function Yt(e){Q1(e).forEach(r=>r.dispose())}function an(e){return A.keep(e)}function U3(e){return A.setBackend(e)}function JL(){return A.ready()}function sS(e,t,r=1){return A.registerBackend(e,t,r)}function sme(e,t){let r=_(e,"a","add"),o=_(t,"b","add");[r,o]=ot(r,o);let n={a:r,b:o};return A.runKernel(Is,n)}var be=T({add_:sme});function lme(e,t){let r=_(e,"a","floorDiv"),o=_(t,"b","floorDiv");[r,o]=ot(r,o);let n={a:r,b:o};return A.runKernel(tu,n)}var lS=T({floorDiv_:lme});function cme(e,t){let r=_(e,"a","div"),o=_(t,"b","div");if([r,o]=ot(r,o),r.dtype==="int32"&&o.dtype==="int32")return lS(r,o);let n={a:r,b:o},a={};return A.runKernel(qp,n,a)}var je=T({div_:cme});function pme(e,t){let r=_(e,"a","mul"),o=_(t,"b","mul");[r,o]=ot(r,o);let n={a:r,b:o};return A.runKernel(Cu,n)}var ce=T({mul_:pme});function ume(e){let t=_(e,"x","abs");if(t.dtype==="complex64"){let r={x:t};return A.runKernel(I1,r)}else{let r={x:t};return A.runKernel(eh,r)}}var so=T({abs_:ume});function mme(e){let r={x:_(e,"x","acos")};return A.runKernel(xp,r)}var ZL=T({acos_:mme});function fme(e){let r={x:_(e,"x","acosh")};return A.runKernel(wp,r)}var eB=T({acosh_:fme});function dme(e){D(Array.isArray(e),()=>"The argument passed to tf.addN() must be a list of tensors"),D(e.length>=1,()=>`Must pass at least one tensor to tf.addN(), but got ${e.length}`);let t=e.map((n,a)=>_(n,`tensors${a}`,"addN")),r=t[0];t.forEach(n=>{if(n.dtype!==r.dtype)throw new Error("All tensors passed to tf.addN() must have the same dtype")}),t.forEach(n=>{if(!Cn(n.shape,r.shape))throw new Error("All tensors passed to tf.addN() must have the same shape")});let o=t;return A.runKernel(Sp,o)}var tB=T({addN_:dme});function hme(e,t=null,r=!1){let n={x:_(e,"x","all","bool")},a={axis:t,keepDims:r};return A.runKernel(kp,n,a)}var rB=T({all_:hme});function gme(e,t=null,r=!1){let n={x:_(e,"x","any","bool")},a={axis:t,keepDims:r};return A.runKernel(_p,n,a)}var oB=T({any_:gme});function yme(e,t=0){let o={x:_(e,"x","argMax")},n={axis:t};return A.runKernel(th,o,n)}var nB=T({argMax_:yme});function vme(e,t=0){let o={x:_(e,"x","argMin")},n={axis:t};return A.runKernel(rh,o,n)}var aB=T({argMin_:vme});function bme(e){let r={x:_(e,"x","asin")};return A.runKernel(Ep,r)}var iB=T({asin_:bme});function xme(e){let r={x:_(e,"x","asinh")};return A.runKernel(Ip,r)}var sB=T({asinh_:xme});function wme(e){let r={x:_(e,"x","atan")};return A.runKernel(Tp,r)}var lB=T({atan_:wme});function Sme(e,t){let r=_(e,"a","atan2"),o=_(t,"b","atan2");[r,o]=ot(r,o);let n={a:r,b:o};return A.runKernel(Np,n)}var cB=T({atan2_:Sme});function kme(e){let r={x:_(e,"x","atanh")};return A.runKernel(Cp,r)}var pB=T({atanh_:kme});function _me(e,t,r,o,n="NHWC",a){let i=e[3],s=[...t,i],c=mB(n);return Sm(e,s,r,a,o,null,null,c)}function H3(e,t,r,o,n,a,i="channelsLast"){let[s,c]=mb(t),l;if(i==="channelsLast")l=[s,c,e[3],e[3]];else if(i==="channelsFirst")l=[s,c,e[1],e[1]];else throw new Error(`Unknown dataFormat ${i}`);return Sm(e,l,r,o,n,a,!1,i)}function Eme(e,t,r,o,n,a,i="NDHWC"){let[s,c,l]=W3(t),p,u;if(i==="NDHWC")u="channelsLast",p=[s,c,l,e[4],e[4]];else if(i==="NCDHW")u="channelsFirst",p=[s,c,l,e[1],e[1]];else throw new Error(`Unknown dataFormat ${i}`);return uB(e,p,r,o,n,!1,u,a)}function Sm(e,t,r,o,n,a,i=!1,s="channelsLast"){let[c,l,p,u]=[-1,-1,-1,-1];if(s==="channelsLast")[c,l,p,u]=e;else if(s==="channelsFirst")[c,u,l,p]=e;else throw new Error(`Unknown dataFormat ${s}`);let[m,f,,d]=t,[h,y]=mb(r),[g,b]=mb(o),x=Vh(m,g),w=Vh(f,b),{padInfo:I,outHeight:C,outWidth:R}=Cme(n,l,p,h,y,x,w,a,s),P=i?d*u:d,z;return s==="channelsFirst"?z=[c,P,C,R]:s==="channelsLast"&&(z=[c,C,R,P]),{batchSize:c,dataFormat:s,inHeight:l,inWidth:p,inChannels:u,outHeight:C,outWidth:R,outChannels:P,padInfo:I,strideHeight:h,strideWidth:y,filterHeight:m,filterWidth:f,effectiveFilterHeight:x,effectiveFilterWidth:w,dilationHeight:g,dilationWidth:b,inShape:e,outShape:z,filterShape:t}}function uB(e,t,r,o,n,a=!1,i="channelsLast",s){let[c,l,p,u,m]=[-1,-1,-1,-1,-1];if(i==="channelsLast")[c,l,p,u,m]=e;else if(i==="channelsFirst")[c,m,l,p,u]=e;else throw new Error(`Unknown dataFormat ${i}`);let[f,d,h,,y]=t,[g,b,x]=W3(r),[w,I,C]=W3(o),R=Vh(f,w),P=Vh(d,I),z=Vh(h,C),{padInfo:$,outDepth:B,outHeight:V,outWidth:H}=Nme(n,l,p,u,g,b,x,R,P,z,s),G=a?y*m:y,X;return i==="channelsFirst"?X=[c,G,B,V,H]:i==="channelsLast"&&(X=[c,B,V,H,G]),{batchSize:c,dataFormat:i,inDepth:l,inHeight:p,inWidth:u,inChannels:m,outDepth:B,outHeight:V,outWidth:H,outChannels:G,padInfo:$,strideDepth:g,strideHeight:b,strideWidth:x,filterDepth:f,filterHeight:d,filterWidth:h,effectiveFilterDepth:R,effectiveFilterHeight:P,effectiveFilterWidth:z,dilationDepth:w,dilationHeight:I,dilationWidth:C,inShape:e,outShape:X,filterShape:t}}function Ime(e,t,r,o,n){o==null&&(o=V3(e,t,r));let a=e[0],i=e[1],s=fb((a-t+2*o)/r+1,n),c=fb((i-t+2*o)/r+1,n);return[s,c]}function Tme(e,t,r,o,n,a){n==null&&(n=V3(e,t[0],o[0]));let i=[0,0,0,r];for(let s=0;s<3;s++)e[s]+2*n>=t[s]&&(i[s]=fb((e[s]-t[s]+2*n)/o[s]+1,a));return i}function V3(e,t,r,o=1){let n=Vh(t,o);return Math.floor((e[0]*(r-1)-r+n)/2)}function mb(e){return typeof e=="number"?[e,e,e]:e.length===2?[e[0],e[1],1]:e}function W3(e){return typeof e=="number"?[e,e,e]:e}function Vh(e,t){return t<=1?e:e+(e-1)*(t-1)}function Cme(e,t,r,o,n,a,i,s,c){let l,p,u;if(typeof e=="number"){l={top:e,bottom:e,left:e,right:e,type:e===0?"VALID":"NUMBER"};let f=Ime([t,r],a,o,e,s);p=f[0],u=f[1]}else if(e==="same"){p=Math.ceil(t/o),u=Math.ceil(r/n);let m=Math.max(0,(p-1)*o+a-t),f=Math.max(0,(u-1)*n+i-r),d=Math.floor(m/2),h=m-d,y=Math.floor(f/2),g=f-y;l={top:d,bottom:h,left:y,right:g,type:"SAME"}}else if(e==="valid")l={top:0,bottom:0,left:0,right:0,type:"VALID"},p=Math.ceil((t-a+1)/o),u=Math.ceil((r-i+1)/n);else if(typeof e=="object"){let m=c==="channelsLast"?e[1][0]:e[2][0],f=c==="channelsLast"?e[1][1]:e[2][1],d=c==="channelsLast"?e[2][0]:e[3][0],h=c==="channelsLast"?e[2][1]:e[3][1];l={top:m,bottom:f,left:d,right:h,type:m===0&&f===0&&d===0&&h===0?"VALID":"EXPLICIT"},p=fb((t-a+m+f)/o+1,s),u=fb((r-i+d+h)/n+1,s)}else throw Error(`Unknown padding parameter: ${e}`);return{padInfo:l,outHeight:p,outWidth:u}}function Nme(e,t,r,o,n,a,i,s,c,l,p){let u,m,f,d;if(e==="valid"&&(e=0),typeof e=="number"){u={top:e,bottom:e,left:e,right:e,front:e,back:e,type:e===0?"VALID":"NUMBER"};let y=Tme([t,r,o,1],[s,c,l],1,[n,a,i],e,p);m=y[0],f=y[1],d=y[2]}else if(e==="same"){m=Math.ceil(t/n),f=Math.ceil(r/a),d=Math.ceil(o/i);let h=(m-1)*n+s-t,y=(f-1)*a+c-r,g=(d-1)*i+l-o,b=Math.floor(h/2),x=h-b,w=Math.floor(y/2),I=y-w,C=Math.floor(g/2),R=g-C;u={top:w,bottom:I,left:C,right:R,front:b,back:x,type:"SAME"}}else throw Error(`Unknown padding parameter: ${e}`);return{padInfo:u,outDepth:m,outHeight:f,outWidth:d}}function fb(e,t){if(!t)return Math.trunc(e);switch(t){case"round":return Math.round(e);case"ceil":return Math.ceil(e);case"floor":return Math.floor(e);default:throw new Error(`Unknown roundingMode ${t}`)}}function wm(e){let[t,r,o]=mb(e);return t===1&&r===1&&o===1}function No(e,t){return wm(e)||wm(t)}function Mi(e){return mb(e).every(t=>t>0)}function mB(e){if(e==="NHWC")return"channelsLast";if(e==="NCHW")return"channelsFirst";throw new Error(`Unknown dataFormat ${e}`)}function Rr(e,t,r){if(r!=null){if(typeof t=="string")throw Error(`Error in ${e}: pad must be an integer when using dimRoundingMode ${r} but got pad ${t}.`);if(typeof t=="number")D(Es(t),()=>`Error in ${e}: pad must be an integer when using dimRoundingMode ${r} but got pad ${t}.`);else if(typeof t=="object")t.forEach(o=>{o.forEach(n=>{D(Es(n),()=>`Error in ${e}: pad must be an integer when using dimRoundingMode ${r} but got pad ${n}.`)})});else throw Error(`Error in ${e}: Unknown padding parameter: ${t}`)}}function Ame(e,t){let o={x:_(e,"x","reshape","string_or_numeric")},n={shape:t};return A.runKernel(xh,o,n)}var K=T({reshape_:Ame});function Rme(e,t,r,o,n){let a=_(e,"x","avgPool","float32"),i=1;D(No(r,i),()=>`Error in avgPool: Either strides or dilations must be 1. Got strides ${r} and dilations '${i}'`);let s=a,c=!1;a.rank===3&&(c=!0,s=K(a,[1,a.shape[0],a.shape[1],a.shape[2]])),D(s.rank===4,()=>`Error in avgPool: x must be rank 4 but got rank ${s.rank}.`),Rr("avgPool",o,n);let l={x:s},p={filterSize:t,strides:r,pad:o,dimRoundingMode:n},u=A.runKernel(Ap,l,p);return u=pt(u,a.dtype),c?K(u,[u.shape[1],u.shape[2],u.shape[3]]):u}var cS=T({avgPool_:Rme});function Dme(e,t,r,o,n,a="NDHWC"){let i=_(e,"x","avgPool3d","float32"),s=i,c=!1;i.rank===4&&(c=!0,s=K(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]])),D(s.rank===5,()=>`Error in avgPool3d: x must be rank 5 but got rank ${s.rank}.`),D(a==="NDHWC",()=>`Error in avgPool3d: Only NDHWC is currently supported, but got dataFormat of ${a}`),D(typeof r=="number"&&r>0||Array.isArray(r)&&r[0]>0&&r[1]>0&&r[2]>0,()=>`Error in avgPool3d: Stride must be > 0, but got '${r}'`),Rr("avgPool3d",o,n);let l={x:s},p={filterSize:t,strides:r,pad:o,dimRoundingMode:n,dataFormat:a},u=A.runKernel(oh,l,p);return u=pt(u,s.dtype),c?K(u,[u.shape[1],u.shape[2],u.shape[3],u.shape[4]]):u}var fB=T({avgPool3d_:Dme});function Fme(e,t=0){D(e.length>=1,()=>"Pass at least one tensor to concat");let r=bm(e,"tensors","concat","string_or_numeric");if(r[0].dtype==="complex64"&&r.forEach(a=>{if(a.dtype!=="complex64")throw new Error(`Cannot concatenate complex64 tensors with a tensor
94
+ with dtype ${a.dtype}. `)}),r.length===1)return Rn(r[0]);let o=r,n={axis:t};return A.runKernel(ih,o,n)}var Gt=T({concat_:Fme});function Mme(e,t,r=!1,o=!1){let n=_(e,"a","matMul"),a=_(t,"b","matMul");[n,a]=ot(n,a);let i={a:n,b:a},s={transposeA:r,transposeB:o};return A.runKernel(Rp,i,s)}var Dt=T({matMul_:Mme});function Ome(e){let r={x:_(e,"x","sigmoid","float32")};return A.runKernel(Zu,r)}var Sa=T({sigmoid_:Ome});function Pme(e,t,r){let o=_(e,"x","slice","string_or_numeric");if(o.rank===0)throw new Error("Slicing scalar is not possible");let n={x:o},a={begin:t,size:r};return A.runKernel(Sh,n,a)}var We=T({slice_:Pme});function zme(e){let r={x:_(e,"x","tanh","float32")};return A.runKernel(pm,r)}var db=T({tanh_:zme});function $me(e,t,r,o,n,a){let i=_(e,"forgetBias","basicLSTMCell"),s=_(t,"lstmKernel","basicLSTMCell"),c=_(r,"lstmBias","basicLSTMCell"),l=_(o,"data","basicLSTMCell"),p=_(n,"c","basicLSTMCell"),u=_(a,"h","basicLSTMCell"),m=Gt([l,u],1),f=Dt(m,s),d=be(f,c),h=d.shape[0],y=d.shape[1]/4,g=[h,y],b=We(d,[0,0],g),x=We(d,[0,y],g),w=We(d,[0,y*2],g),I=We(d,[0,y*3],g),C=be(ce(Sa(b),db(x)),ce(p,Sa(be(i,w)))),R=ce(db(C),Sa(I));return[C,R]}var dB=T({basicLSTMCell_:$me});function Lme(e,t,r){let o=_(e,"x","batchToSpaceND"),n=t.reduce((s,c)=>s*c);D(o.rank>=1+t.length,()=>`input rank is ${o.rank} but should be > than blockShape.length ${t.length}`),D(r.length===t.length,()=>`crops.length is ${r.length} but should be equal to blockShape.length ${t.length}`),D(o.shape[0]%n===0,()=>`input tensor batch is ${o.shape[0]} but is not divisible by the product of the elements of blockShape ${t.join(" * ")} === ${n}`);let a={x:o},i={blockShape:t,crops:r};return A.runKernel(nh,a,i)}var pS=T({batchToSpaceND_:Lme});function hB(e){let t;return e.rank===0||e.rank===1?t=K(e,[1,1,1,e.size]):e.rank===2?t=K(e,[1,1,e.shape[0],e.shape[1]]):e.rank===3?t=K(e,[1,e.shape[0],e.shape[1],e.shape[2]]):t=e,t}function Bme(e,t,r,o,n,a){a==null&&(a=.001);let i=_(e,"x","batchNorm"),s=_(t,"mean","batchNorm"),c=_(r,"variance","batchNorm"),l;n!=null&&(l=_(n,"scale","batchNorm"));let p;o!=null&&(p=_(o,"offset","batchNorm")),D(s.rank===c.rank,()=>"Batch normalization gradient requires mean and variance to have equal ranks."),D(p==null||s.rank===p.rank,()=>"Batch normalization gradient requires mean and offset to have equal ranks."),D(l==null||s.rank===l.rank,()=>"Batch normalization gradient requires mean and scale to have equal ranks.");let m={x:hB(i),scale:l,offset:p,mean:s,variance:c},f={varianceEpsilon:a},d=A.runKernel(ru,m,f);return K(d,i.shape)}var Xl=T({batchNorm_:Bme});function Ume(e,t,r,o,n,a){let i=_(e,"x","batchNorm"),s=_(t,"mean","batchNorm"),c=_(r,"variance","batchNorm"),l;n!=null&&(l=_(n,"scale","batchNorm"));let p;return o!=null&&(p=_(o,"offset","batchNorm")),D(i.rank===2,()=>`Error in batchNorm2D: x must be rank 2 but got rank ${i.rank}.`),D(s.rank===2||s.rank===1,()=>`Error in batchNorm2D: mean must be rank 2 or rank 1 but got rank ${s.rank}.`),D(c.rank===2||c.rank===1,()=>`Error in batchNorm2D: variance must be rank 2 or rank 1 but got rank ${c.rank}.`),l!=null&&D(l.rank===2||l.rank===1,()=>`Error in batchNorm2D: scale must be rank 2 or rank 1 but got rank ${l.rank}.`),p!=null&&D(p.rank===2||p.rank===1,()=>`Error in batchNorm2D: offset must be rank 2 or rank 1 but got rank ${p.rank}.`),Xl(i,s,c,p,l,a)}var gB=T({batchNorm2d_:Ume});function Wme(e,t,r,o,n,a){let i=_(e,"x","batchNorm"),s=_(t,"mean","batchNorm"),c=_(r,"variance","batchNorm"),l;n!=null&&(l=_(n,"scale","batchNorm"));let p;return o!=null&&(p=_(o,"offset","batchNorm")),D(i.rank===3,()=>`Error in batchNorm3D: x must be rank 3 but got rank ${i.rank}.`),D(s.rank===3||s.rank===1,()=>`Error in batchNorm3D: mean must be rank 3 or rank 1 but got rank ${s.rank}.`),D(c.rank===3||c.rank===1,()=>`Error in batchNorm3D: variance must be rank 3 or rank 1 but got rank ${c.rank}.`),l!=null&&D(l.rank===3||l.rank===1,()=>`Error in batchNorm3D: scale must be rank 3 or rank 1 but got rank ${l.rank}.`),p!=null&&D(p.rank===3||p.rank===1,()=>`Error in batchNorm3D: offset must be rank 3 or rank 1 but got rank ${p.rank}.`),Xl(i,s,c,p,l,a)}var yB=T({batchNorm3d_:Wme});function Hme(e,t,r,o,n,a){let i=_(e,"x","batchNorm"),s=_(t,"mean","batchNorm"),c=_(r,"variance","batchNorm"),l;n!=null&&(l=_(n,"scale","batchNorm"));let p;return o!=null&&(p=_(o,"offset","batchNorm")),D(i.rank===4,()=>`Error in batchNorm4D: x must be rank 4 but got rank ${i.rank}.`),D(s.rank===4||s.rank===1,()=>`Error in batchNorm4D: mean must be rank 4 or rank 1 but got rank ${s.rank}.`),D(c.rank===4||c.rank===1,()=>`Error in batchNorm4D: variance must be rank 4 or rank 1 but got rank ${c.rank}.`),l!=null&&D(l.rank===4||l.rank===1,()=>`Error in batchNorm4D: scale must be rank 4 or rank 1 but got rank ${l.rank}.`),p!=null&&D(p.rank===4||p.rank===1,()=>`Error in batchNorm4D: offset must be rank 4 or rank 1 but got rank ${p.rank}.`),Xl(i,s,c,p,l,a)}var vB=T({batchNorm4d_:Hme});function Vme(e,t,r){let o=_(e,"x","bincount"),n=_(t,"weights","bincount");D(o.dtype==="int32",()=>`Error in bincount: input dtype must be int32, but got ${o.dtype}`),D(r>=0,()=>`size must be non-negative, but got ${r}.`),D(n.size===o.size||n.size===0,()=>`Error in bincount: weights must have the same size as input or0-length, but got input shape: ${o.shape}, weights shape: ${n.shape}.`);let a={x:o,weights:n},i={size:r};return A.runKernel(Dp,a,i)}var uS=T({bincount_:Vme});function jme(e,t){let r=_(e,"x","bitwiseAnd"),o=_(t,"y","bitwiseAnd");if(!Cn(r.shape,o.shape))throw new Error(`BitwiseAnd: Tensors must have the same shape. x: ${r.shape}, y: ${o.shape}`);if(r.dtype!=="int32"||o.dtype!=="int32")throw new Error(`BitwiseAnd: Only supports 'int32' values in tensor, found type of x: ${r.dtype} and type of y: ${o.dtype}`);let n={a:r,b:o};return A.runKernel(Fp,n)}var bB=T({bitwiseAnd_:jme});function Gme(e,t){let r=_(e,"s0","broadcastArgs","int32"),o=_(t,"s1","broadcastArgs","int32");if(r.rank!==1)throw new Error(`broadcastArgs(): first input must be a vector (rank=1). Has rank ${r.rank}`);if(o.rank!==1)throw new Error(`broadcastArgs(): second input must be a vector (rank=1). Has rank ${o.rank}`);let n={s0:r,s1:o};return A.runKernel(ah,n)}var xB=T({broadcastArgs_:Gme});function qme(e,t){let r=_(e,"broadcastTo","x"),o=r.shape;if(or(t),t.length<r.rank)throw new Error(`broadcastTo(): shape.length=${t.length} < input.rank=${r.rank}.`);if(t.length>r.rank){let l=r.shape.slice();for(;l.length<t.length;)l.unshift(1);r=K(r,l)}let n=r.shape,a=Array.from(t);for(let l=t.length-1;l>=0;l--)if(n[l]===t[l])a[l]=1;else if(r.shape[l]!==1)throw new Error(`broadcastTo(): [${o}] cannot be broadcast to [${t}].`);if(a.map((l,p)=>l>1?p:-1).filter(l=>l>=0).length===0)return Rn(r);let s={x:r},c={reps:a};return A.runKernel(Ts,s,c)}var Yl=T({broadcastTo_:qme});function Kme(e){let r={x:_(e,"x","ceil","float32")};return A.runKernel(Mp,r)}var wB=T({ceil_:Kme});function Pi(e,t,r){or(e),r=r||$l(t);let o={shape:e,value:t,dtype:r};return A.runKernel(mh,{},o)}function Xme(e,t,r){let o=_(e,"x","clipByValue");if(D(t<=r,()=>`Error in clip: min (${t}) must be less than or equal to max (${r}).`),t===r)return Pi(o.shape,t,o.dtype);let n={x:o},a={clipValueMin:t,clipValueMax:r};return A.runKernel(Bl,n,a)}var mS=T({clipByValue_:Xme});function Yme(e){return Gt(e,0)}var SB=T({concat1d_:Yme});function Qme(e,t){return Gt(e,t)}var kB=T({concat2d_:Qme});function Jme(e,t){return Gt(e,t)}var _B=T({concat3d_:Jme});function Zme(e,t){return Gt(e,t)}var EB=T({concat4d_:Zme});function efe(e,t,r,o,n="NHWC",a=[1,1],i){let s=_(e,"x","conv2d","float32"),c=_(t,"filter","conv2d","float32"),l=s,p=!1;s.rank===3&&(p=!0,l=K(s,[1,s.shape[0],s.shape[1],s.shape[2]])),D(l.rank===4,()=>`Error in conv2d: input must be rank 4, but got rank ${l.rank}.`),D(c.rank===4,()=>`Error in conv2d: filter must be rank 4, but got rank ${c.rank}.`),Rr("conv2d",o,i);let u=n==="NHWC"?l.shape[3]:l.shape[1];D(u===c.shape[2],()=>`Error in conv2d: depth of input (${u}) must match input depth for filter ${c.shape[2]}.`),D(No(r,a),()=>`Error in conv2D: Either strides or dilations must be 1. Got strides ${r} and dilations '${a}'`),D(Mi(a),()=>"Error in conv2D: Dilated rates should be larger than 0."),D(Mi(r),()=>"Error in conv2D: Strides should be larger than 0.");let m={x:l,filter:c},f={strides:r,pad:o,dataFormat:n,dilations:a,dimRoundingMode:i},d=A.runKernel(Op,m,f);return p?K(d,[d.shape[1],d.shape[2],d.shape[3]]):d}var Ql=T({conv2d_:efe});function tfe(e,t,r,o,n="NWC",a=1,i){let s=_(e,"x","conv1d"),c=_(t,"filter","conv1d"),l=s,p=!1;s.rank===2&&(p=!0,l=K(s,[1,s.shape[0],s.shape[1]])),D(l.rank===3,()=>`Error in conv1d: input must be rank 3, but got rank ${l.rank}.`),D(c.rank===3,()=>`Error in conv1d: filter must be rank 3, but got rank ${c.rank}.`),Rr("conv1d",o,i),D(l.shape[2]===c.shape[1],()=>`Error in conv1d: depth of input (${l.shape[2]}) must match input depth for filter ${c.shape[1]}.`),D(No(r,a),()=>`Error in conv1D: Either stride or dilation must be 1. Got stride ${r} and dilation '${a}'`),D(Mi(a),()=>"Error in conv1D: Dilated rates should be larger than 0."),D(Mi(r),()=>"Error in conv1D: Stride should be larger than 0."),D(n==="NWC",()=>`Error in conv1d: got dataFormat of ${n} but only NWC is currently supported.`);let u=K(c,[1,c.shape[0],c.shape[1],c.shape[2]]),m=K(l,[l.shape[0],1,l.shape[1],l.shape[2]]),y=Ql(m,u,[1,r],o,"NHWC",[1,a],i);return p?K(y,[y.shape[2],y.shape[3]]):K(y,[y.shape[0],y.shape[2],y.shape[3]])}var IB=T({conv1d_:tfe});function rfe(e,t,r,o,n,a="NHWC",i){D(e.length===t.rank,()=>`Length of inShape (${e.length}) and rank of dy (${t.rank}) must match`);let s=e,c=t,l=!1;t.rank===3&&(l=!0,c=K(t,[1,t.shape[0],t.shape[1],t.shape[2]]),s=[1,e[0],e[1],e[2]]),D(s.length===4,()=>`Error in conv2dDerInput: inShape must be length 4, but got length ${s.length}.`),D(c.rank===4,()=>`Error in conv2dDerInput: dy must be rank 4, but got rank ${c.rank}`),D(r.rank===4,()=>`Error in conv2dDerInput: filter must be rank 4, but got rank ${r.rank}`);let p=a==="NHWC"?s[3]:s[1],u=a==="NHWC"?c.shape[3]:c.shape[1];D(p===r.shape[2],()=>`Error in conv2dDerInput: depth of input (${p}) must match input depth for filter ${r.shape[2]}.`),D(u===r.shape[3],()=>`Error in conv2dDerInput: depth of output (${u}) must match output depth for filter ${r.shape[3]}.`),Rr("conv2dDerInput",n,i);let m={dy:c,filter:r},f={strides:o,pad:n,dataFormat:a,dimRoundingMode:i,inputShape:s},d=A.runKernel(Pp,m,f);return l?K(d,[d.shape[1],d.shape[2],d.shape[3]]):d}var fS=T({conv2DBackpropInput_:rfe});function ofe(e,t,r,o,n,a){let i=_(e,"x","conv2dTranspose"),s=_(t,"filter","conv2dTranspose");return fS(r,i,s,o,n,"NHWC",a)}var TB=T({conv2dTranspose_:ofe});function nfe(e,t,r,o,n="NDHWC",a=[1,1,1]){let i=_(e,"x","conv3d"),s=_(t,"filter","conv3d"),c=i,l=!1;i.rank===4&&(l=!0,c=K(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]])),D(c.rank===5,()=>`Error in conv3d: input must be rank 5, but got rank ${c.rank}.`),D(s.rank===5,()=>`Error in conv3d: filter must be rank 5, but got rank ${s.rank}.`),D(c.shape[4]===s.shape[3],()=>`Error in conv3d: depth of input (${c.shape[4]}) must match input depth for filter ${s.shape[3]}.`),D(No(r,a),()=>`Error in conv3D: Either strides or dilations must be 1. Got strides ${r} and dilations '${a}'`),D(n==="NDHWC",()=>`Error in conv3d: got dataFormat of ${n} but only NDHWC is currently supported.`),D(Mi(a),()=>"Error in conv3D: Dilated rates should be larger than 0."),D(Mi(r),()=>"Error in conv3D: Strides should be larger than 0.");let p={x:c,filter:s},u={strides:r,pad:o,dataFormat:n,dilations:a},m=A.runKernel(zp,p,u);return l?K(m,[m.shape[1],m.shape[2],m.shape[3],m.shape[4]]):m}var CB=T({conv3d_:nfe});function afe(e,t,r,o,n){D(e.length===t.rank,()=>`Length of inShape (${e.length}) and rank of dy (${t.rank}) must match`);let a=e,i=t,s=!1;t.rank===4&&(s=!0,i=K(t,[1,t.shape[0],t.shape[1],t.shape[2],t.shape[3]]),a=[1,e[0],e[1],e[2],e[3]]);let c=a[4],l=i.shape[4];D(a.length===5,()=>`Error in conv3dDerInput: inShape must be length 5, but got length ${a.length}.`),D(i.rank===5,()=>`Error in conv3dDerInput: dy must be rank 5, but got rank ${i.rank}`),D(r.rank===5,()=>`Error in conv3dDerInput: filter must be rank 5, but got rank ${r.rank}`),D(c===r.shape[3],()=>`Error in conv3dDerInput: depth of input (${c}) must match input depth for filter ${r.shape[3]}.`),D(l===r.shape[4],()=>`Error in conv3dDerInput: depth of output (${l}) must match output depth for filter ${r.shape[4]}.`);let p={dy:i,filter:r},u={pad:n,strides:o,inputShape:a},m=A.runKernel($p,p,u);return s?K(m,[m.shape[1],m.shape[2],m.shape[3],m.shape[4]]):m}var NB=T({conv3DBackpropInput_:afe});function ife(e,t,r,o,n){let a=_(e,"x","conv3dTranspose"),i=_(t,"filter","conv3dTranspose");return NB(r,a,i,o,n)}var AB=T({conv3dTranspose_:ife});function sfe(e){let r={x:_(e,"x","cos","float32")};return A.runKernel(Lp,r)}var RB=T({cos_:sfe});function lfe(e){let r={x:_(e,"x","cosh","float32")};return A.runKernel(Bp,r)}var DB=T({cosh_:lfe});function cfe(e,t=0,r=!1,o=!1){let a={x:_(e,"x","cumprod")},i={axis:t,exclusive:r,reverse:o};return A.runKernel(Up,a,i)}var FB=T({cumprod_:cfe});function pfe(e,t=0,r=!1,o=!1){let a={x:_(e,"x","cumsum")},i={axis:t,exclusive:r,reverse:o};return A.runKernel(Wp,a,i)}var MB=T({cumsum_:pfe});function ufe(e,t,r,o=!1){let n=_(e,"x","denseBincount"),a=_(t,"weights","denseBincount");D(n.dtype==="int32",()=>`Error in denseBincount: input dtype must be int32, but got ${n.dtype}`),D(n.rank<=2,()=>`Error in denseBincount: input must be at most rank 2, but got rank ${n.rank}.`),D(r>=0,()=>`size must be non-negative, but got ${r}.`),D(a.size===n.size||a.size===0,()=>`Error in denseBincount: weights must have the same shape as x or 0-length, but got x shape: ${n.shape}, weights shape: ${a.shape}.`);let i={x:n,weights:a},s={size:r,binaryOutput:o};return A.runKernel(sh,i,s)}var OB=T({denseBincount_:ufe});function mfe(e,t,r="NHWC"){let o=_(e,"x","depthToSpace","float32"),n=r==="NHWC"?o.shape[1]:o.shape[2],a=r==="NHWC"?o.shape[2]:o.shape[3],i=r==="NHWC"?o.shape[3]:o.shape[1];D(t>1,()=>`blockSize should be > 1 for depthToSpace, but was: ${t}`),D(n*t>=0,()=>`Negative dimension size caused by overflow when multiplying
95
+ ${n} and ${t} for depthToSpace with input shape
96
+ ${o.shape}`),D(a*t>=0,()=>`Negative dimension size caused by overflow when multiplying
97
+ ${a} and ${t} for depthToSpace with input shape
98
+ ${o.shape}`),D(i%(t*t)===0,()=>`Dimension size must be evenly divisible by ${t*t} but is ${i} for depthToSpace with input shape ${o.shape}`);let s={x:o},c={blockSize:t,dataFormat:r};return A.runKernel(Vp,s,c)}var PB=T({depthToSpace_:mfe});function ffe(e,t,r,o,n="NHWC",a=[1,1],i){let s=_(e,"x","depthwiseConv2d","float32"),c=_(t,"filter","depthwiseConv2d","float32"),l=s,p=!1;s.rank===3&&(p=!0,l=K(s,[1,s.shape[0],s.shape[1],s.shape[2]])),D(l.rank===4,()=>`Error in depthwiseConv2d: input must be rank 4, but got rank ${l.rank}.`),D(c.rank===4,()=>`Error in depthwiseConv2d: filter must be rank 4, but got rank ${c.rank}.`);let u=n==="NHWC"?l.shape[3]:l.shape[1];D(u===c.shape[2],()=>`Error in depthwiseConv2d: number of input channels (${u}) must match the inChannels dimension in filter ${c.shape[2]}.`),Rr("depthwiseConv2d",o,i);let m={x:l,filter:c},f={strides:r,pad:o,dataFormat:n,dilations:a,dimRoundingMode:i},d=A.runKernel(jp,m,f);return p?K(d,[d.shape[1],d.shape[2],d.shape[3]]):d}var jh=T({depthwiseConv2d_:ffe});function dfe(e){let r={x:_(e,"x","diag")};return A.runKernel(lh,r)}var zB=T({diag_:dfe});function hfe(e,t,r,o,n=[1,1],a="NHWC"){let i=_(e,"x","dilation2d"),s=_(t,"filter","dilation2d");D(i.rank===3||i.rank===4,()=>`Error in dilation2d: input must be rank 3 or 4, but got rank ${i.rank}.`),D(s.rank===3,()=>`Error in dilation2d: filter must be rank 3, but got rank ${s.rank}.`),D(a==="NHWC",()=>`Error in dilation2d: Only NHWC is currently supported, but got dataFormat of ${a}`);let c=i,l=!1;i.rank===3&&(c=K(i,[1,i.shape[0],i.shape[1],i.shape[2]]),l=!0),D(c.shape[3]===s.shape[2],()=>`Error in dilation2d: input and filter must have the same depth: ${c.shape[3]} vs ${s.shape[2]}`);let p={x:c,filter:s},u={strides:r,pad:o,dilations:n},m=A.runKernel(Gp,p,u);return l?K(m,[m.shape[1],m.shape[2],m.shape[3]]):m}var $B=T({dilation2d_:hfe});var ka={};Ot(ka,{assertAndGetBroadcastShape:()=>Ct,getBroadcastDims:()=>LB,getReductionAxes:()=>dS});function LB(e,t){let r=e.length,o=[];for(let n=0;n<r;n++){let a=r-1-n,i=e[a]||1;(t[t.length-1-n]||1)>1&&i===1&&o.unshift(a)}return o}function dS(e,t){let r=[];for(let o=0;o<t.length;o++){let n=e[e.length-o-1],a=t.length-o-1,i=t[a];(n==null||n===1&&i>1)&&r.unshift(a)}return r}function Ct(e,t){let r=Math.max(e.length,t.length),o=new Array(r);for(let n=0;n<r;n++){let a=e[e.length-n-1];a==null&&(a=1);let i=t[t.length-n-1];if(i==null&&(i=1),a===1)o[r-n-1]=i;else if(i===1)o[r-n-1]=a;else if(a!==i){let s=`Operands could not be broadcast together with shapes ${e} and ${t}.`;throw Error(s)}else o[r-n-1]=a}return o}function gfe(e,t){let r=_(e,"a","equal","string_or_numeric"),o=_(t,"b","equal","string_or_numeric");[r,o]=ot(r,o),Ct(r.shape,o.shape);let n={a:r,b:o};return A.runKernel(Yp,n)}var hS=T({equal_:gfe});function yfe(e,t,r){let o=_(t,"a","where"),n=_(r,"b","where"),a=_(e,"condition","where","bool"),i=Ct(Ct(a.shape,o.shape),n.shape),s=Yl(a,i),c=Yl(o,i),l=Yl(n,i),p={condition:s,t:c,e:l};return A.runKernel(wh,p)}var Yn=T({where_:yfe});function vfe(e){let r={x:_(e,"x","zerosLike")};return A.runKernel(Fh,r)}var Gr=T({zerosLike_:vfe});function bfe(e,t){let r=_(e,"a","div"),o=_(t,"b","div");[r,o]=ot(r,o);let n=je(r,o),a=Gr(n),i=hS(o,a);return Yn(i,a,n)}var BB=T({divNoNan_:bfe});function xfe(e,t){let r=_(e,"t1","dot"),o=_(t,"t2","dot");D((r.rank===1||r.rank===2)&&(o.rank===1||o.rank===2),()=>`Error in dot: inputs must all be rank 1 or 2, but got ranks ${r.rank} and ${o.rank}.`);let n=r.rank===1?r.size:r.shape[1],a=o.rank===1?o.size:o.shape[0];if(D(n===a,()=>`Error in dot: inner dimensions of inputs must match, but got ${n} and ${a}.`),r.rank===1&&o.rank===1){let i=K(r,[1,-1]),s=K(o,[-1,1]),c=Dt(i,s);return K(c,[])}else if(r.rank===1&&o.rank===2){let i=K(r,[1,-1]),s=K(o,[o.shape[0],o.shape[1]]),c=Dt(i,s);return K(c,[c.size])}else if(r.rank===2&&o.rank===1){let i=K(o,[-1,1]),s=Dt(r,i);return K(s,[s.size])}else{let i=K(o,[o.shape[0],o.shape[1]]);return Dt(r,i)}}var UB=T({dot_:xfe});function wfe(e,...t){let r=t.map((n,a)=>_(n,`tensors${a}`,"einsum")),o={equation:e};return A.runKernel(A1,r,o)}var Jl=T({einsum_:wfe});function Sfe(e){let r={x:_(e,"x","elu","float32")};return A.runKernel(Kp,r)}var gS=T({elu_:Sfe});function kfe(e,t){let r=_(e,"x","ensureShape","string_or_numeric");if(!i3(r.shape,t))throw new Error(`EnsureShape: Shape of tensor ${r.shape} is not compatible with expected shape ${t}`);return e}var WB=T({ensureShape_:kfe});function _fe(e){let t=_(e,"x","erf");D(t.dtype==="int32"||t.dtype==="float32",()=>"Input dtype must be `int32` or `float32`."),t.dtype==="int32"&&(t=pt(t,"float32"));let r={x:t};return A.runKernel(Xp,r)}var HB=T({erf_:_fe});function j3(e,t){for(let r=0;r<e.length;++r)if(e[e.length-r-1]!==t-1-r)return!1;return!0}function VB(e,t,r){let o=e.length+t.length,n=[],a=0,i=0;for(let s=0;s<o;s++)r.indexOf(s)===-1?n.push(e[a++]):n.push(t[i++]);return n}function Efe(e,t){let r=[],o=e.length;for(let a=0;a<o;a++)t.indexOf(a)===-1&&r.push(e[a]);let n=t.map(a=>e[a]);return[r,n]}function Ds(e,t){let r=t.map(o=>1);return VB(e,r,t)}function Ife(e,t,r){D(j3(t,r),()=>`${e} supports only inner-most axes for now. Got axes ${t} and rank-${r} input.`)}function Tfe(e,t){if(j3(e,t))return null;let r=[];for(let o=0;o<t;++o)e.indexOf(o)===-1&&r.push(o);return e.forEach(o=>r.push(o)),r}function Cfe(e){return e.map((t,r)=>[r,t]).sort((t,r)=>t[1]-r[1]).map(t=>t[0])}function Nfe(e,t){let r=[];for(let o=t-e;o<t;++o)r.push(o);return r}function Rfe(e,t=null,r=!1){let n={x:_(e,"x","max")},a={reductionIndices:t,keepDims:r};return A.runKernel(bu,n,a)}var zi=T({max_:Rfe});function Dfe(e,t=null,r=!1){let n={x:_(e,"x","min")},a={axis:t,keepDims:r};return A.runKernel(ku,n,a)}var hb=T({min_:Dfe});function Ffe(e,t){let r=_(e,"base","pow"),o=_(t,"exp","pow");[r,o]=ot(r,o);let n={a:r,b:o};return A.runKernel(Ou,n)}var Fs=T({pow_:Ffe});function $e(e,t){if((Co(e)&&t!=="string"||Array.isArray(e))&&t!=="complex64")throw new Error("Error creating a new Scalar: value must be a primitive (number|boolean|string)");if(t==="string"&&Co(e)&&!(e instanceof Uint8Array))throw new Error("When making a scalar from encoded string, the value must be `Uint8Array`.");return Bo(e,[],[],t)}function Mfe(e){let r={x:_(e,"x","sqrt","float32")};return A.runKernel(tm,r)}var sn=T({sqrt_:Mfe});function Ofe(e){let t=_(e,"x","square"),r={};return A.runKernel("Square",{x:t},r)}var lo=T({square_:Ofe});function Pfe(e,t=null,r=!1){let o=_(e,"x","sum");o.dtype==="bool"&&(o=pt(o,"int32"));let n={x:o},a={axis:t,keepDims:r};return A.runKernel(rm,n,a)}var Ft=T({sum_:Pfe});function zfe(e,t="euclidean",r=null,o=!1){e=_(e,"x","norm");let n=jB(e,t,r),a=n.shape;if(o){let i=zl(r,e.shape);a=Ds(n.shape,i)}return K(n,a)}function jB(e,t,r=null){if(e.rank===0)return so(e);if(e.rank!==1&&r===null)return jB(K(e,[-1]),t,r);if(e.rank===1||typeof r=="number"||Array.isArray(r)&&r.length===1){if(t===1)return Ft(so(e),r);if(t===1/0)return zi(so(e),r);if(t===-1/0)return hb(so(e),r);if(t==="euclidean"||t===2)return sn(Ft(Fs(so(e),$e(2,"int32")),r));throw new Error(`Error in norm: invalid ord value: ${t}`)}if(Array.isArray(r)&&r.length===2){if(t===1)return zi(Ft(so(e),r[0]),r[1]-1);if(t===1/0)return zi(Ft(so(e),r[1]),r[0]);if(t===-1/0)return hb(Ft(so(e),r[1]),r[0]);if(t==="fro"||t==="euclidean")return sn(Ft(lo(e),r));throw new Error(`Error in norm: invalid ord value: ${t}`)}throw new Error(`Error in norm: invalid axis: ${r}`)}var km=T({norm_:zfe});function $fe(e,t=null,r=!1){return km(e,"euclidean",t,r)}var GB=T({euclideanNorm_:$fe});function Lfe(e){let r={x:_(e,"x","exp")};return A.runKernel(Qp,r)}var ln=T({exp_:Lfe});function Bfe(e,t=0){let r=_(e,"x","expandDims","string_or_numeric");D(t<=r.rank,()=>"Axis must be <= rank of the tensor");let o={input:r},n={dim:t};return A.runKernel(uh,o,n)}var Dn=T({expandDims_:Bfe});function Ufe(e){let r={x:_(e,"x","expm1")};return A.runKernel(Jp,r)}var qB=T({expm1_:Ufe});function Wfe(e,t){let r=_(e,"x","tile","string_or_numeric");D(r.rank===t.length,()=>`Error in transpose: rank of input ${r.rank} must match length of reps ${t}.`);let o={x:r},n={reps:t};return A.runKernel(Ts,o,n)}var Zl=T({tile_:Wfe});function Hfe(e,t,r,o="float32"){t==null&&(t=e);let n=Re([e,t],o),a=e<=t?e:t;for(let s=0;s<a;++s)n.set(1,s,s);let i=K(n.toTensor(),[e,t]);if(r==null)return i;if(r.length===1)return Zl(Dn(i,0),[r[0],1,1]);if(r.length===2)return Zl(Dn(Dn(i,0),0),[r[0],r[1],1,1]);if(r.length===3)return Zl(Dn(Dn(Dn(i,0),0),0),[r[0],r[1],r[2],1,1]);throw new Error(`eye() currently supports only 1D and 2D batchShapes, but received ${r.length}D.`)}var yS=T({eye_:Hfe});function Vfe(e){let r={x:_(e,"x","floor","float32")};return A.runKernel(eu,r)}var vS=T({floor_:Vfe});function jfe(e,t,r=0,o=0){let n=_(e,"x","gather"),a=_(t,"indices","gather","int32"),i={x:n,indices:a},s={axis:r,batchDims:o};return A.runKernel(fh,i,s)}var bS=T({gather_:jfe});function Gfe(e,t){let r=_(e,"a","greater","string_or_numeric"),o=_(t,"b","greater","string_or_numeric");[r,o]=ot(r,o),Ct(r.shape,o.shape);let n={a:r,b:o};return A.runKernel(nu,n)}var _m=T({greater_:Gfe});function qfe(e,t){let r=_(e,"a","greaterEqual","string_or_numeric"),o=_(t,"b","greaterEqual","string_or_numeric");[r,o]=ot(r,o),Ct(r.shape,o.shape);let n={a:r,b:o};return A.runKernel(au,n)}var xS=T({greaterEqual_:qfe});function Kfe(e){let r={input:_(e,"input","imag")};return A.runKernel(F1,r)}var ec=T({imag_:Kfe});function Xfe(e){let r={x:_(e,"x","isFinite")};return A.runKernel(iu,r)}var KB=T({isFinite_:Xfe});function Yfe(e){let r={x:_(e,"x","isInf")};return A.runKernel(su,r)}var XB=T({isInf_:Yfe});function Qfe(e){let r={x:_(e,"x","isNaN")};return A.runKernel(lu,r)}var YB=T({isNaN_:Qfe});function Jfe(e,t=.2){let o={x:_(e,"x","leakyRelu")},n={alpha:t};return A.runKernel(cu,o,n)}var wS=T({leakyRelu_:Jfe});function Zfe(e,t){let r=_(e,"a","less","string_or_numeric"),o=_(t,"b","less","string_or_numeric");[r,o]=ot(r,o),Ct(r.shape,o.shape);let n={a:r,b:o};return A.runKernel(pu,n)}var gb=T({less_:Zfe});function ede(e,t){let r=_(e,"a","lessEqual","string_or_numeric"),o=_(t,"b","lessEqual","string_or_numeric");[r,o]=ot(r,o),Ct(r.shape,o.shape);let n={a:r,b:o};return A.runKernel(uu,n)}var Gh=T({lessEqual_:ede});function QB(e,t,r){if(r<=0)throw new Error("The number of values should be positive.");let o={start:e,stop:t,num:r};return A.runKernel(mu,{},o)}function tde(e,t=5,r=1,o=1,n=.5){let a=_(e,"x","localResponseNormalization");D(a.rank===4||a.rank===3,()=>`Error in localResponseNormalization: x must be rank 3 or 4 but got
99
+ rank ${a.rank}.`),D(Es(t),()=>`Error in localResponseNormalization: depthRadius must be an integer but got depthRadius ${t}.`);let i=a,s=!1;a.rank===3&&(s=!0,i=K(a,[1,a.shape[0],a.shape[1],a.shape[2]]));let c={x:i},l={depthRadius:t,bias:r,alpha:o,beta:n},p=A.runKernel(vu,c,l);return s?K(p,[p.shape[1],p.shape[2],p.shape[3]]):p}var JB=T({localResponseNormalization_:tde});function rde(e){let r={x:_(e,"x","log","float32")};return A.runKernel(fu,r)}var Ms=T({log_:rde});function ode(e){let r={x:_(e,"x","log1p")};return A.runKernel(du,r)}var SS=T({log1p_:ode});function ZB(e,t){D(Qd(e),()=>"The f passed in variableGrads(f) must be a function"),D(t==null||Array.isArray(t)&&t.every(l=>l instanceof As),()=>"The varList passed in variableGrads(f, varList) must be an array of variables");let r=t!=null;if(!r){t=[];for(let l in A.registeredVariables)t.push(A.registeredVariables[l])}let o=r?t.filter(l=>!l.trainable):null,n=t.length;t=t.filter(l=>l.trainable),D(t.length>0,()=>`variableGrads() expects at least one of the input variables to be trainable, but none of the ${n} variables is trainable.`);let a=!0,{value:i,grads:s}=A.gradients(e,t,null,a);D(s.some(l=>l!=null),()=>"Cannot find a connection between any variable and the result of the loss function y=f(x). Please make sure the operations that use variables are inside the function f passed to minimize()."),D(i.rank===0,()=>`The f passed in variableGrads(f) must return a scalar, but it returned a rank-${i.rank} tensor`);let c={};return t.forEach((l,p)=>{s[p]!=null&&(c[l.name]=s[p])}),o?.forEach(l=>c[l.name]=null),{value:i,grads:c}}function cn(e){return A.customGrad(e)}function nde(e){let r={x:_(e,"x","neg")};return A.runKernel(gh,r)}var vo=T({neg_:nde});function ade(e){let r={x:_(e,"x","softplus")};return A.runKernel(em,r)}var kS=T({softplus_:ade});function ide(e){let t=_(e,"x","logSigmoid");return cn(o=>({value:vo(kS(vo(o))),gradFunc:i=>ce(i,Sa(vo(o)))}))(t)}var eU=T({logSigmoid_:ide});function sde(e,t){let r=_(e,"a","sub"),o=_(t,"b","sub");[r,o]=ot(r,o);let n={a:r,b:o};return A.runKernel(lm,n)}var Fe=T({sub_:sde});function lde(e,t=-1){let r=_(e,"logits","logSoftmax");if(t===-1&&(t=r.rank-1),t!==r.rank-1)throw Error(`Log Softmax along a non-last dimension is not yet supported. Logits was rank ${r.rank} and axis was ${t}`);return cn((n,a)=>{let s=zi(n,t,!0),c=Fe(n,s),l=Fe(pt(c,"float32"),Ms(Ft(ln(c),t,!0)));return a([l]),{value:l,gradFunc:(u,m)=>{let[f]=m,d=!0,h=ln(f);return Fe(u,ce(Ft(u,t,d),h))}}})(r)}var tU=T({logSoftmax_:lde});function cde(e,t=null,r=!1){let o=_(e,"x","logSumExp"),n=zl(t,o.shape),a=zi(o,n,!0),i=Fe(o,a),s=ln(i),c=Ft(s,n),l=Ms(c),p=be(K(a,l.shape),l);if(r){let u=Ds(p.shape,n);return K(p,u)}return p}var _S=T({logSumExp_:cde});function pde(e,t){let r=_(e,"a","logicalAnd","bool"),o=_(t,"b","logicalAnd","bool");Ct(r.shape,o.shape);let n={a:r,b:o};return A.runKernel(hu,n)}var Em=T({logicalAnd_:pde});function ude(e){let r={x:_(e,"x","logicalNot","bool")};return A.runKernel(gu,r)}var ES=T({logicalNot_:ude});function mde(e,t){let r=_(e,"a","logicalOr","bool"),o=_(t,"b","logicalOr","bool");Ct(r.shape,o.shape);let n={a:r,b:o};return A.runKernel(yu,n)}var IS=T({logicalOr_:mde});function fde(e,t){let r=_(e,"a","logicalXor","bool"),o=_(t,"b","logicalXor","bool");return Ct(r.shape,o.shape),Em(IS(e,t),ES(Em(e,t)))}var rU=T({logicalXor_:fde});var TS=2147483648;function dde(e,t,r="left"){let o=_(e,"sortedSequence","searchSorted"),n=_(t,"values","searchSorted"),a=o.shape[o.shape.length-1],i=n.shape[n.shape.length-1],s=K(o,[-1,a]),c=K(n,[-1,i]);if(s.rank<2)throw new Error("Sorted input argument must be at least 2-dimensional");if(s.shape[0]!==c.shape[0])throw new Error("Leading dimension of 'sortedSequence' and 'values' must match.");if(mt(c.shape)>=TS)throw new Error(`values tensor size must less than ${TS}`);if(s.shape[1]>=TS)throw new Error(`trailing dim_size must less than ${TS} for int32 output type, was ${s.shape[1]}`);let l={sortedSequence:s,values:c},p={side:r};return A.runKernel(Ku,l,p)}var yb=T({searchSorted_:dde});function oU(e,t){return yb(e,t,"left")}function hde(e,t,r,o,n){let a=_(e,"x","maxPool"),i=1,s=a,c=!1;a.rank===3&&(c=!0,s=K(a,[1,a.shape[0],a.shape[1],a.shape[2]])),D(s.rank===4,()=>`Error in maxPool: input must be rank 4 but got rank ${s.rank}.`),D(No(r,i),()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${r} and dilations '${i}'`),Rr("maxPool",o,n);let l={x:s},p={filterSize:t,strides:r,pad:o,dimRoundingMode:n},u=A.runKernel(wu,l,p);return c?K(u,[u.shape[1],u.shape[2],u.shape[3]]):u}var CS=T({maxPool_:hde});function gde(e,t=[1,1,1],r,o,n,a="NDHWC"){let i=_(e,"x","maxPool3d"),s=i,c=!1;i.rank===4&&(c=!0,s=K(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]])),D(s.rank===5,()=>`Error in maxPool3d: x must be rank 5 but got rank ${s.rank}.`),D(a==="NDHWC",()=>`Error in maxPool3d: Only NDHWC is currently supported, but got dataFormat of ${a}`),Rr("maxPool3d",o,n);let l={x:s},p={filterSize:t,strides:r,pad:o,dimRoundingMode:n,dataFormat:a},u=A.runKernel(dh,l,p);return c?K(u,[u.shape[1],u.shape[2],u.shape[3],u.shape[4]]):u}var nU=T({maxPool3d_:gde});function yde(e,t,r,o,n=!1){let i={x:_(e,"x","maxPoolWithArgmax")},s={filterSize:t,strides:r,pad:o,includeBatchInIndex:n},c=A.runKernel(hh,i,s);return{result:c[0],indexes:c[1]}}var aU=T({maxPoolWithArgmax_:yde});function vde(e,t){let r=_(e,"a","maximum"),o=_(t,"b","maximum");[r,o]=ot(r,o),r.dtype==="bool"&&(r=pt(r,"int32"),o=pt(o,"int32")),Ct(r.shape,o.shape);let n={a:r,b:o};return A.runKernel(xu,n)}var NS=T({maximum_:vde});function bde(e,t=null,r=!1){let n={x:_(e,"x","mean")},a={axis:t,keepDims:r};return A.runKernel(Su,n,a)}var Im=T({mean_:bde});function $i(e,t="float32"){if(or(e),t==="complex64"){let o=$i(e,"float32"),n=$i(e,"float32");return nn(o,n)}let r=Zd(mt(e),t);return A.makeTensor(r,e,t)}function Li(e,t="float32"){if(or(e),t==="complex64"){let o=Li(e,"float32"),n=$i(e,"float32");return nn(o,n)}let r=Xv(mt(e),t);return A.makeTensor(r,e,t)}function iU(e,t,{indexing:r="xy"}={}){if(r!=="xy"&&r!=="ij")throw new TypeError(`${r} is not a valid third argument to meshgrid`);if(e===void 0)return[];let o=_(e,"x","meshgrid",e instanceof $t?e.dtype:"float32");if(t===void 0)return[o];let n=_(t,"y","meshgrid",t instanceof $t?t.dtype:"float32"),a=mt(o.shape),i=mt(n.shape);return r==="xy"?(o=K(o,[1,-1]),n=K(n,[-1,1]),[Dt(Li([i,1],o.dtype),o),Dt(n,Li([1,a],n.dtype))]):(o=K(o,[-1,1]),n=K(n,[1,-1]),[Dt(o,Li([1,i],o.dtype)),Dt(Li([a,1],n.dtype),n)])}function xde(e,t){let r=_(e,"a","minimum"),o=_(t,"b","minimum");[r,o]=ot(r,o),r.dtype==="bool"&&(r=pt(r,"int32"),o=pt(o,"int32")),Ct(r.shape,o.shape);let n={a:r,b:o};return A.runKernel(_u,n)}var Tm=T({minimum_:xde});function wde(e,t,r){D(r==="reflect"||r==="symmetric",()=>`Invalid mode. Mode must be either reflect or symmetric. Got ${r}.`);let o=_(e,"x","mirrorPad");if(o.rank===0)throw new Error("mirrorPad(scalar) is not defined. Pass non-scalar to mirrorPad");D(t.length===o.rank,()=>`Padding doesn't match input. Must be ${o.rank}. Got ${t.length}.`);let n=r==="reflect"?1:0;for(let s=0;s<o.rank;s++)D(t[s].length===2,()=>"Invalid number of paddings. Must be length of 2 each."),D(t[s][0]>=0&&t[s][0]<=o.shape[s]-n&&t[s][1]>=0&&t[s][1]<=o.shape[s]-n,()=>`Padding in dimension ${s} cannot be greater than or equal to ${o.shape[s]-n} or less than 0 for input of shape ${o.shape}`);let a={paddings:t,mode:r},i={x:o};return A.runKernel(Eu,i,a)}var sU=T({mirrorPad_:wde});function Sde(e,t){let r=_(e,"a","mod"),o=_(t,"b","mod");[r,o]=ot(r,o);let n={a:r,b:o};return A.runKernel(Iu,n)}var lU=T({mod_:Sde});function kde(e,t=null,r=!1){e=_(e,"x","moments");let o=zl(t,e.shape),n=Im(e,o,r),a=n.shape;r||(a=Ds(n.shape,o));let i=lo(Fe(pt(e,"float32"),K(n,a))),s=Im(i,o,r);return{mean:n,variance:s}}var cU=T({moments_:kde});function _de(e,t,r,o){let n=_(t,"data","multiRNNCell"),a=bm(r,"c","multiRNNCell"),i=bm(o,"h","multiRNNCell"),s=n,c=[];for(let u=0;u<e.length;u++){let m=e[u](s,a[u],i[u]);c.push(m[0]),c.push(m[1]),s=m[1]}let l=[],p=[];for(let u=0;u<c.length;u+=2)l.push(c[u]),p.push(c[u+1]);return[l,p]}var pU=T({multiRNNCell_:_de});function Ede(e,t,r,o=!1){let n=_(e,"logits","multinomial"),a=n.size,i=n.rank;if(a<2)throw new Error(`Error in multinomial: you need at least 2 outcomes, but got ${a}.`);if(i>2)throw new Error(`Rank of probabilities must be 1 or 2, but is ${i}`);r=r||Math.random();let c={logits:i===1?K(n,[1,-1]):n},l={numSamples:t,seed:r,normalized:o},p=A.runKernel(Tu,c,l);return i===1?K(p,[p.size]):p}var uU=T({multinomial_:Ede});function Ide(e,t){let r=_(e,"a","notEqual","string_or_numeric"),o=_(t,"b","notEqual","string_or_numeric");[r,o]=ot(r,o),Ct(r.shape,o.shape);let n={a:r,b:o};return A.runKernel(Nu,n)}var AS=T({notEqual_:Ide});function Tde(e,t,r=1,o=0,n="int32"){if(t<2)throw new Error(`Error in oneHot: depth must be >=2, but it is ${t}`);let i={indices:_(e,"indices","oneHot","int32")},s={dtype:n,depth:t,onValue:r,offValue:o};return A.runKernel(Fu,i,s)}var mU=T({oneHot_:Tde});function Cde(e){let r={x:_(e,"x","onesLike")};return A.runKernel(yh,r)}var fU=T({onesLike_:Cde});function Nde(e,t){let r=_(e,"v1","outerProduct"),o=_(t,"v2","outerProduct");D(r.rank===1&&o.rank===1,()=>`Error in outerProduct: inputs must be rank 1, but got ranks ${r.rank} and ${o.rank}.`);let n=K(r,[-1,1]),a=K(o,[1,-1]);return Dt(n,a)}var dU=T({outerProduct_:Nde});function Ade(e,t,r=0){let o=_(e,"x","pad");if(o.rank===0)throw new Error("pad(scalar) is not defined. Pass non-scalar to pad");let n={paddings:t,constantValue:r},a={x:o};return A.runKernel(Mu,a,n)}var Bi=T({pad_:Ade});function Rde(e,t,r=0){return D(t.length===2,()=>"Invalid number of paddings. Must be length of 2."),Bi(e,[t],r)}var hU=T({pad1d_:Rde});function Dde(e,t,r=0){return D(t.length===2&&t[0].length===2&&t[1].length===2,()=>"Invalid number of paddings. Must be length of 2 each."),Bi(e,t,r)}var gU=T({pad2d_:Dde});function Fde(e,t,r=0){return D(t.length===3&&t[0].length===2&&t[1].length===2&&t[2].length===2,()=>"Invalid number of paddings. Must be length of 2 each."),Bi(e,t,r)}var yU=T({pad3d_:Fde});function Mde(e,t,r=0){return D(t.length===4&&t[0].length===2&&t[1].length===2&&t[2].length===2&&t[3].length===2,()=>"Invalid number of paddings. Must be length of 2 each."),Bi(e,t,r)}var vU=T({pad4d_:Mde});function Ode(e,t,r){let o=_(e,"x","spaceToBatchND");D(o.rank>=1+t.length,()=>`input rank ${o.rank} should be > than [blockShape] ${t.length}`),D(r.length===t.length,()=>`paddings.shape[0] ${r.length} must be equal to [blockShape] ${t.length}`),D(o.shape.reduce((i,s,c)=>c>0&&c<=t.length?i&&(s+r[c-1][0]+r[c-1][1])%t[c-1]===0:i,!0),()=>`input spatial dimensions ${o.shape.slice(1)} with paddings ${r.toString()} must be divisible by blockShapes ${t.toString()}`);let n={x:o},a={blockShape:t,paddings:r};return A.runKernel(kh,n,a)}var RS=T({spaceToBatchND_:Ode});function Pde(e,t,r,o,n,a,i){n==null&&(n=[1,1]),a==null&&(a=1),o===0&&(o="valid");let s=_(e,"x","maxPool"),c=s,l=!1;s.rank===3&&(l=!0,c=K(s,[1,s.shape[0],s.shape[1],s.shape[2]])),D(No(a,n),()=>`Error in pool: Either strides or dilations must be 1. Got strides ${a} and dilations '${n}'`);let p=H3(c.shape,t,a,n,o),u=[p.dilationHeight,p.dilationWidth],m;o==="same"?m=$de([p.filterHeight,p.filterWidth],u):m=[[0,0],[0,0]];let f=u[0]===1&&u[1]===1,[d,h]=zde([p.inHeight,p.inWidth],u,m),y=f?o:"valid",g=f?c:RS(c,u,d),x=(r==="avg"?()=>cS(g,t,a,y,i):()=>CS(g,t,a,y,i))(),w=f?x:pS(x,u,h);return l?K(w,[w.shape[1],w.shape[2],w.shape[3]]):w}function zde(e,t,r){let o=r.map(p=>p[0]),n=r.map(p=>p[1]),a=e.concat(o,n),i=t.map((p,u)=>(p-a[u]%p)%p),s=n.map((p,u)=>p+i[u]),c=t.map((p,u)=>[o[u],s[u]]),l=t.map((p,u)=>[0,i[u]]);return[c,l]}function $de(e,t){let o=e.map((i,s)=>i+(i-1)*(t[s]-1)).map(i=>i-1),n=o.map(i=>Math.floor(i/2)),a=o.map((i,s)=>i-n[s]);return o.map((i,s)=>[n[s],a[s]])}var bU=T({pool_:Pde});function Lde(e,t){let r=_(e,"x","prelu"),o=_(t,"alpha","prelu"),n={x:r,alpha:o};return A.runKernel(Pu,n)}var DS=T({prelu_:Lde});function Bde(e,t=null,r=!1){let o=_(e,"x","prod");o.dtype==="bool"&&(o=pt(o,"int32"));let n={x:o},a={axis:t,keepDims:r};return A.runKernel(zu,n,a)}var xU=T({prod_:Bde});function Ude(e,t,r,o){let n=e.map((p,u)=>_(p,`tensors${u}`,"raggedGather","int32")),a=_(t,"paramsDenseValues","raggedGather"),i=_(r,"indices","raggedGather","int32"),s={paramsNestedSplits:n,paramsDenseValues:a,indices:i},c={outputRaggedRank:o},l=A.runKernel(P1,s,c);return{outputNestedSplits:l.slice(0,l.length-1),outputDenseValues:l[l.length-1]}}var wU=T({raggedGather_:Ude});function Wde(e,t,r){let o=_(e,"starts","raggedRange"),n=_(t,"limits","raggedRange",o.dtype),a=_(r,"deltas","raggedRange",o.dtype),i={starts:o,limits:n,deltas:a},s=A.runKernel(z1,i);return{rtNestedSplits:s[0],rtDenseValues:s[1]}}var SU=T({raggedRange_:Wde});function Hde(e,t,r,o,n){let a=_(e,"shape","raggedTensorToTensor","int32"),i=_(t,"values","raggedTensorToTensor"),s=_(r,"defaultValue","raggedTensorToTensor",i.dtype),c=o.map((u,m)=>_(u,`tensors${m}`,"raggedTensorToTensor","int32")),l={shape:a,values:i,defaultValue:s,rowPartitionTensors:c},p={rowPartitionTypes:n};return A.runKernel($1,l,p)}var kU=T({raggedTensorToTensor_:Hde});function Vde(e,t,r){or(e);let o=mt(e),n=null;if(r==null||r==="float32")n=new Float32Array(o);else if(r==="int32")n=new Int32Array(o);else if(r==="bool")n=new Uint8Array(o);else throw new Error(`Unknown data type ${r}`);for(let a=0;a<o;a++)n[a]=t();return A.makeTensor(n,e,r)}var _U=T({rand_:Vde});var PS=Ie(J3());var Nm=class{constructor(t,r,o,n,a){this.mean=t,this.stdDev=r,this.dtype=o,this.nextVal=NaN,this.truncated=n,this.truncated&&(this.upper=this.mean+this.stdDev*2,this.lower=this.mean-this.stdDev*2);let i=a||Math.random();this.random=PS.alea(i.toString())}nextValue(){if(!isNaN(this.nextVal)){let n=this.nextVal;return this.nextVal=NaN,n}let t,r,o=!1;for(;!o;){let n,a,i;do n=2*this.random()-1,a=2*this.random()-1,i=n*n+a*a;while(i>=1||i===0);let s=Math.sqrt(-2*Math.log(i)/i);t=this.mean+this.stdDev*n*s,r=this.mean+this.stdDev*a*s,(!this.truncated||this.isValidTruncated(t))&&(o=!0)}return(!this.truncated||this.isValidTruncated(r))&&(this.nextVal=this.convertValue(r)),this.convertValue(t)}convertValue(t){return this.dtype==null||this.dtype==="float32"?t:Math.round(t)}isValidTruncated(t){return t<=this.upper&&t>=this.lower}},MS=class{constructor(t,r,o,n){this.alpha=t,this.beta=1/r,this.dtype=o;let a=n||Math.random();this.randu=PS.alea(a.toString()),this.randn=new Nm(0,1,o,!1,this.randu()),t<1?this.d=t+2/3:this.d=t-1/3,this.c=1/Math.sqrt(9*this.d)}nextValue(){let t,r,o,n,a,i;for(;;){do n=this.randn.nextValue(),i=1+this.c*n;while(i<=0);if(i*=i*i,t=n*n,r=1-.331*t*t,o=.5*t+this.d*(1-i+Math.log(i)),a=this.randu(),a<r||Math.log(a)<o)break}return i=1/this.beta*this.d*i,this.alpha<1&&(i*=Math.pow(this.randu(),1/this.alpha)),this.convertValue(i)}convertValue(t){return this.dtype==="float32"?t:Math.round(t)}},OS=class{constructor(t=0,r=1,o,n){if(this.canReturnFloat=()=>this.dtype==null||this.dtype==="float32",this.min=t,this.range=r-t,this.dtype=o,n==null&&(n=Math.random()),typeof n=="number"&&(n=n.toString()),!this.canReturnFloat()&&this.range<=1)throw new Error(`The difference between ${t} - ${r} <= 1 and dtype is not float`);this.random=PS.alea(n)}convertValue(t){return this.canReturnFloat()?t:Math.round(t)}nextValue(){return this.convertValue(this.min+this.range*this.random())}};function Qde(e,t,r=1,o="float32",n){if(or(e),r==null&&(r=1),o==null&&(o="float32"),o!=="float32"&&o!=="int32")throw new Error(`Unsupported data type ${o}`);let a=new MS(t,r,o,n),i=Re(e,o);for(let s=0;s<i.values.length;s++)i.values[s]=a.nextValue();return i.toTensor()}var UU=T({randomGamma_:Qde});function Jde(e,t=0,r=1,o,n){if(or(e),o!=null&&o==="bool")throw new Error(`Unsupported data type ${o}`);let a=new Nm(t,r,o,!1,n),i=Re(e,o);for(let s=0;s<i.values.length;s++)i.values[s]=a.nextValue();return i.toTensor()}var zS=T({randomNormal_:Jde});function Zde(e,t,r){if(t!=null&&t==="bool")throw new Error(`Unsupported data type ${t}`);return zS(e,0,1,t,r)}var WU=T({randomStandardNormal_:Zde});function ehe(e,t=0,r=1,o="float32",n){or(e);let a=Re(e,o),i=new OS(t,r,null,n);for(let s=0;s<a.values.length;s++)a.values[s]=i.nextValue();return a.toTensor()}var qh=T({randomUniform_:ehe});function the(e,t,r,o){return qh(e,t,r,"int32",o)}var HU=T({randomUniformInt_:the});function tc(e,t,r=1,o="float32"){if(r===0)throw new Error("Cannot have a step of zero");let n={start:e,stop:t,step:r,dtype:o};return A.runKernel(bh,{},n)}function rhe(e){let r={input:_(e,"input","real")};return A.runKernel(L1,r)}var Os=T({real_:rhe});function ohe(e){let r={x:_(e,"x","reciprocal")};return A.runKernel($u,r)}var VU=T({reciprocal_:ohe});function nhe(e){let r={x:_(e,"x","relu")};return A.runKernel(Lu,r)}var rc=T({relu_:nhe});function ahe(e){let r={x:_(e,"x","relu6")};return A.runKernel(Wu,r)}var $S=T({relu6_:ahe});function ihe(e,t){let o={x:_(e,"x","reverse")},n={dims:t};return A.runKernel(Hu,o,n)}var Qn=T({reverse_:ihe});function she(e){let t=_(e,"x","reverse");return D(t.rank===1,()=>`Error in reverse1D: x must be rank 1 but got rank ${t.rank}.`),Qn(t,0)}var jU=T({reverse1d_:she});function lhe(e,t){let r=_(e,"x","reverse");return D(r.rank===2,()=>`Error in reverse2D: x must be rank 2 but got rank ${r.rank}.`),Qn(r,t)}var GU=T({reverse2d_:lhe});function che(e,t){let r=_(e,"x","reverse");return D(r.rank===3,()=>`Error in reverse3D: x must be rank 3 but got rank ${r.rank}.`),Qn(r,t)}var qU=T({reverse3d_:che});function phe(e,t){let r=_(e,"x","reverse");return D(r.rank===4,()=>`Error in reverse4D: x must be rank 4 but got rank ${r.rank}.`),Qn(r,t)}var KU=T({reverse4d_:phe});function uhe(e){let r={x:_(e,"x","round")};return A.runKernel(Vu,r)}var LS=T({round_:uhe});function mhe(e){let r={x:_(e,"x","rsqrt","float32")};return A.runKernel(ju,r)}var XU=T({rsqrt_:mhe});function fhe(e){let r={x:_(e,"x","selu")};return A.runKernel(Xu,r)}var YU=T({selu_:fhe});function dhe(e,t,r,o,n,a=[1,1],i="NHWC"){let s=_(e,"x","separableConv2d"),c=_(t,"depthwiseFilter","separableConv2d"),l=_(r,"pointwiseFilter","separableConv2d"),p=s,u=!1;if(s.rank===3&&(u=!0,p=K(s,[1,s.shape[0],s.shape[1],s.shape[2]])),i==="NCHW")throw new Error("separableConv2d currently does not support dataFormat NCHW; only NHWC is supported");D(p.rank===4,()=>`Error in separableConv2d: input must be rank 4, but got rank ${p.rank}.`),D(c.rank===4,()=>`Error in separableConv2d: depthwise filter must be rank 4, but got rank ${c.rank}.`),D(l.rank===4,()=>`Error in separableConv2d: pointwise filter must be rank 4, but got rank ${c.rank}.`),D(l.shape[0]===1,()=>`Error in separableConv2d: the first dimension of pointwise filter must be 1, but got ${l.shape[0]}.`),D(l.shape[1]===1,()=>`Error in separableConv2d: the second dimension of pointwise filter must be 1, but got ${l.shape[1]}.`);let m=c.shape[2],f=c.shape[3];D(l.shape[2]===m*f,()=>`Error in separableConv2d: the third dimension of pointwise filter must be ${m*f}, but got ${l.shape[2]}.`);let d=jh(p,c,o,n,i,a),y=Ql(d,l,1,"valid",i);return u?K(y,[y.shape[1],y.shape[2],y.shape[3]]):y}var QU=T({separableConv2d_:dhe});async function hhe(e,t){let r=_(e,"x","setdiff1d"),o=_(t,"y","setdiff1d");D(r.dtype===o.dtype,()=>`x and y should have the same dtype, but got x (${r.dtype}) and y (${o.dtype}).`),D(r.rank===1,()=>`x should be 1D tensor, but got x (${r.shape}).`),D(o.rank===1,()=>`y should be 1D tensor, but got y (${o.shape}).`);let n=await r.data(),a=await o.data(),i=new Set(a),s=0;for(let p=0;p<n.length;p++)i.has(n[p])||s++;let c=new Tt([s],r.dtype),l=new Tt([s],"int32");for(let p=0,u=0;p<n.length;p++)i.has(n[p])||(c.values[u]=n[p],l.values[u]=p,u++);return[c.toTensor(),l.toTensor()]}var JU=hhe;function ghe(e){let r={x:_(e,"x","sign")};return A.runKernel(Ju,r)}var ZU=T({sign_:ghe});function yhe(e){let r={x:_(e,"x","sin","float32")};return A.runKernel(Yu,r)}var e9=T({sin_:yhe});function vhe(e){let r={x:_(e,"x","sinh")};return A.runKernel(Qu,r)}var t9=T({sinh_:vhe});function bhe(e,t,r){let o=_(e,"x","slice1d");return D(o.rank===1,()=>`slice1d expects a rank-1 tensor, but got a rank-${o.rank} tensor`),We(o,[t],[r])}var r9=T({slice1d_:bhe});function xhe(e,t,r){let o=_(e,"x","slice2d");return D(o.rank===2,()=>`slice2d expects a rank-2 tensor, but got a rank-${o.rank} tensor`),We(o,t,r)}var o9=T({slice2d_:xhe});function whe(e,t,r){let o=_(e,"x","slice3d");return D(o.rank===3,()=>`slice3d expects a rank-3 tensor, but got a rank-${o.rank} tensor`),We(o,t,r)}var n9=T({slice3d_:whe});function She(e,t,r){let o=_(e,"x","slice4d");return D(o.rank===4,()=>`slice4d expects a rank-4 tensor, but got a rank-${o.rank} tensor`),We(o,t,r)}var a9=T({slice4d_:She});function khe(e,t=-1){let r=_(e,"logits","softmax","float32");if(t===-1&&(t=r.rank-1),t!==r.rank-1)throw Error(`Softmax along a non-last dimension is not yet supported. Logits was rank ${r.rank} and dim was ${t}`);let o={logits:r},n={dim:t};return A.runKernel(om,o,n)}var i9=T({softmax_:khe});function _he(e){D(e.dtype==="complex64",()=>`The dtype for tf.spectral.fft() must be complex64 but got ${e.dtype}.`);let t={input:e};return A.runKernel(R1,t)}var Kh=T({fft_:_he});function Ehe(e){D(e.dtype==="complex64",()=>`The dtype for tf.spectral.ifft() must be complex64 but got ${e.dtype}.`);let t={input:e};return A.runKernel(D1,t)}var Am=T({ifft_:Ehe});function Ihe(e){let t=e.shape[e.shape.length-1],r=e.size/t,o;if(t<=2){let n=K(e,[r,t]);o=Am(n)}else{let n=[r,2*(t-1)],a=K(Os(e),[r,t]),i=K(ec(e),[r,t]),s=Qn(We(a,[0,1],[r,t-2]),1),c=ce(Qn(We(i,[0,1],[r,t-2]),1),$e(-1)),l=Gt([a,s],1),p=Gt([i,c],1),u=K(nn(l,p),[n[0],n[1]]);o=Am(u)}if(o=Os(o),e.rank===3&&e.shape[0]!==0){let n=o,a=e.shape[0];o=K(o,[a,o.shape[0]/a,o.shape[1]]),n.dispose()}return o}var BS=T({irfft_:Ihe});function The(e,t,r=0){let n={x:_(e,"x","split")},a={numOrSizeSplits:t,axis:r};return A.runKernel(_h,n,a)}var Ps=T({split_:The});function Che(e,t){D(e.dtype==="float32",()=>`The dtype for rfft() must be real value but got ${e.dtype}`);let r=e.shape[e.shape.length-1],o=e.size/r,n;if(t!=null&&t<r){let d=e.shape.map(y=>0),h=e.shape.map(y=>y);h[e.shape.length-1]=t,n=We(e,d,h),r=t}else if(t!=null&&t>r){let d=e.shape.map(h=>h);d[e.shape.length-1]=t-r,n=Gt([e,$i(d)],e.shape.length-1),r=t}else n=e;let a=Gr(n),i=K(nn(n,a),[o,r]),s=Kh(i),c=Math.floor(r/2)+1,l=Os(s),p=ec(s),u=Ps(l,[c,r-c],l.shape.length-1),m=Ps(p,[c,r-c],p.shape.length-1),f=n.shape.slice();return f[n.shape.length-1]=c,K(nn(u[0],m[0]),f)}var Xh=T({rfft_:Che});function Nhe(e,t){let r=_(e,"a","squaredDifference"),o=_(t,"b","squaredDifference");[r,o]=ot(r,o),Ct(r.shape,o.shape);let n={a:r,b:o},a={};return A.runKernel(im,n,a)}var US=T({squaredDifference_:Nhe});function Ahe(e,t){let r=_(e,"x","squeeze","string_or_numeric");return K(r,s3(r.shape,t).newShape)}var Lr=T({squeeze_:Ahe});function Rhe(e,t=0){let r=bm(e,"tensors","stack","string_or_numeric");D(r.length>=1,()=>"Pass at least one tensor to tf.stack"),r.length>0&&D(t<=r[0].rank,()=>"Axis must be <= rank of the tensor");let o=r,n={axis:t};return A.runKernel(vh,o,n)}var Uo=T({stack_:Rhe});function Dhe(e,t=0){let o={x:_(e,"x","step")},n={alpha:t};return A.runKernel(Wl,o,n)}var WS=T({step_:Dhe});function Fhe(e,t,r,o,n=0,a=0,i=0,s=0,c=0){let p={x:_(e,"x","stridedSlice","string_or_numeric")},u={begin:t,end:r,strides:o,beginMask:n,endMask:a,ellipsisMask:i,newAxisMask:s,shrinkAxisMask:c};return A.runKernel(sm,p,u)}var s9=T({stridedSlice_:Fhe});function Mhe(e){let r={x:_(e,"x","tan","float32")};return A.runKernel(cm,r)}var l9=T({tan_:Mhe});function yr(e,t){Kn(e);let r=on(e,t);if(r.length!==1)throw new Error("tensor1d() requires values to be a flat/TypedArray");return Bo(e,null,r,t)}function ai(e,t,r){if(Kn(e),t!=null&&t.length!==2)throw new Error("tensor2d() requires shape to have two numbers");let o=on(e,r);if(o.length!==2&&o.length!==1)throw new Error("tensor2d() requires values to be number[][] or flat/TypedArray");if(o.length===1&&t==null)throw new Error("tensor2d() requires shape to be provided when `values` are a flat/TypedArray");return Bo(e,t,o,r)}function HS(e,t,r){if(Kn(e),t!=null&&t.length!==3)throw new Error("tensor3d() requires shape to have three numbers");let o=on(e,r);if(o.length!==3&&o.length!==1)throw new Error("tensor3d() requires values to be number[][][] or flat/TypedArray");if(o.length===1&&t==null)throw new Error("tensor3d() requires shape to be provided when `values` are a flat array");return Bo(e,t,o,r)}function c9(e,t,r){if(Kn(e),t!=null&&t.length!==4)throw new Error("tensor4d() requires shape to have four numbers");let o=on(e,r);if(o.length!==4&&o.length!==1)throw new Error("tensor4d() requires values to be number[][][][] or flat/TypedArray");if(o.length===1&&t==null)throw new Error("tensor4d() requires shape to be provided when `values` are a flat array");return Bo(e,t,o,r)}function p9(e,t,r){if(Kn(e),t!=null&&t.length!==5)throw new Error("tensor5d() requires shape to have five numbers");let o=on(e,r);if(o.length!==5&&o.length!==1)throw new Error("tensor5d() requires values to be number[][][][][] or flat/TypedArray");if(o.length===1&&t==null)throw new Error("tensor5d() requires shape to be provided when `values` are a flat array");return Bo(e,t,o,r)}function u9(e,t,r){if(Kn(e),t!=null&&t.length!==6)throw new Error("tensor6d() requires shape to have six numbers");let o=on(e,r);if(o.length!==6&&o.length!==1)throw new Error("tensor6d() requires values to be number[][][][][][] or flat/TypedArray");if(o.length===1&&t==null)throw new Error("tensor6d() requires shape to be provided when `values` are a flat array");return t=t||o,Bo(e,t,o,r)}var oc={};Ot(oc,{calculateShapes:()=>m9,validateInput:()=>Yh,validateUpdateShape:()=>Z3});function Z3(e,t,r){let o=t.rank>1?t.shape[t.rank-1]:1,n=t.rank>1?t.rank-1:1,a=`Must have updates.shape = indices.shape[:batchDim] + shape[sliceDim:], got updates.shape: ${r.shape}, indices.shape: ${t.shape}, shape: ${e}, sliceDim: ${o}, and batchDim: ${n}.`;if(r.rank<n)throw new Error(a+` update.rank < ${n}. `);if(e.length<o+(r.rank-n))throw new Error(a+` Output shape length < ${o+(r.rank-n)}`);if(r.rank!==n+e.length-o)throw new Error(a+` update.rank != ${n+e.length-o}`);for(let i=0;i<n;++i)if(r.shape[i]!==t.shape[i])throw new Error(a+` updates.shape[${i}] (${r.shape[i]}) != indices.shape[${i}] (${t.shape[i]}).`);for(let i=0;i<r.rank-n;++i)if(r.shape[i+n]!==e[i+o])throw new Error(a+` updates.shape[${i+n}] (${r.shape[i+n]}) != shape[${i+n}] (${e[i+n]})`)}function Yh(e,t,r){if(t.rank<1)throw new Error(`tf.scatterND() expects the indices to be rank 1 or higher, but the rank was ${t.rank}.`);if(e.rank<1)throw new Error(`tf.scatterND() expects the updates to be rank 1 or higher, but the rank was ${e.rank}.`);if(t.dtype!=="int32")throw new Error(`The dtype of 'indices' should be int32, but got dtype: ${t.dtype}`);if(r.length<1)throw new Error(`Output rank must be greater or equal to 1, but got shape: ${r}`);if(r.length===0){if(t.size===0)throw new Error(`Indices specified for empty output. indices shape: ${t.shape}`);if(e.size===0)throw new Error(`Updates specified for empty output. updates shape: ${e.shape}`)}Z3(r,t,e)}function m9(e,t,r){let o=t.shape.length,n=o>1?t.shape[o-1]:1,a=r.length,i=1;for(let u=n;u<a;++u)i*=r[u];let s=n<1?1:n,c=mt(t.shape)/s,l=[...Ai(r.slice(0,n)),1],p=mt(r);return{sliceRank:n,numUpdates:c,sliceSize:i,strides:l,outputSize:p}}function Ohe(e,t,r){let o=_(e,"tensor","tensorScatterupdate"),n=_(t,"indices","tensorScatterupdate","int32"),a=_(r,"updates","tensorScatterupdate");if(Yh(a,n,o.shape),o.dtype!==a.dtype)throw new Error(`tensor and updates must have the same dtype, instead they are ${o.dtype} and ${a.dtype}.`);let i={tensor:o,indices:n,updates:a},s={};return A.runKernel(qu,i,s)}var f9=T({tensorScatterUpdate_:Ohe});function Phe(e,t=1,r=!0){let o=_(e,"x","topk");if(o.rank===0)throw new Error("topk() expects the input to be of rank 1 or higher");let n=o.shape[o.shape.length-1];if(t<0)throw new Error(`'k' passed to topk() must be >= 0 but got ${t}`);if(t>n)throw new Error(`'k' passed to topk() must be <= the last dimension (${n}) but got ${t}`);let a={x:o},i={k:t,sorted:r},[s,c]=A.runKernel(um,a,i);return{values:s,indices:c}}var d9=T({topk_:Phe});function zhe(e,t=0,r=1,o,n){if(or(e),o!=null&&o==="bool")throw new Error("Unsupported data type $ { dtype }");let a=new Nm(t,r,o,!0,n),i=Re(e,o);for(let s=0;s<i.values.length;s++)i.values[s]=a.nextValue();return i.toTensor()}var h9=T({truncatedNormal_:zhe});function $he(e,t=0){let r=_(e,"x","unique","string_or_numeric");D(r.rank>0,()=>"The input tensor must be at least 1D");let o={x:r},n={axis:t},[a,i]=A.runKernel(Rh,o,n);return{values:a,indices:i}}var g9=T({unique_:$he});function Lhe(e,t,r){let o=_(e,"x","unsortedSegmentSum"),n=_(t,"segmentIds","unsortedSegmentSum","int32");D(Es(r),()=>"numSegments must be of dtype int");let a={x:o,segmentIds:n},i={numSegments:r};return A.runKernel(U1,a,i)}var y9=T({unsortedSegmentSum_:Lhe});function Bhe(e,t=0){let r=_(e,"x","unstack","string_or_numeric");D(t>=-r.shape.length&&t<r.shape.length,()=>`Axis = ${t} is not in [-${r.shape.length}, ${r.shape.length})`);let o={value:r},n={axis:t};return A.runKernel(Dh,o,n)}var Jn=T({unstack_:Bhe});function v9(e,t){return yb(e,t,"right")}function b9(e,t=!0,r,o){return A.makeVariable(e,t,r,o)}function VS(e,t){let r=[];for(let a=0;a<t.length;a++)t[a]&&r.push(a);let o=Re(e,"int32"),n=Re([r.length,e.length],"int32");for(let a=0;a<r.length;a++){let i=o.indexToLoc(r[a]),s=a*e.length;n.values.set(i,s)}return n.toTensor()}async function Uhe(e){let t=_(e,"condition","whereAsync","bool"),r=await t.data(),o=VS(t.shape,r);return e!==t&&t.dispose(),o}var jS=Uhe;async function Whe(e,t,r){let o=_(e,"tensor","boolMask"),n=_(t,"mask","boolMask","bool"),a=r??0,i=n.rank,s=o.shape;D(i>0,()=>"mask cannot be scalar"),gr(s.slice(a,a+i),n.shape,"mask's shape must match the first K dimensions of tensor's shape,");let c=1;for(let h=a;h<a+i;h++)c*=s[h];let l=s.slice(0,a).concat([c],s.slice(a+i)),p=K(o,l),u=K(n,[-1]),m=await jS(u),f=Lr(m,[1]),d=bS(p,f,a);return e!==o&&o.dispose(),t!==n&&n.dispose(),f.dispose(),p.dispose(),u.dispose(),m.dispose(),d}var Hhe=Whe;function Vhe(e,t,r){let o=_(e,"x","transpose");if(t==null&&(t=o.shape.map((i,s)=>s).reverse()),D(o.rank===t.length,()=>`Error in transpose: rank of input ${o.rank} must match length of perm ${t}.`),t.forEach(i=>{D(i>=0&&i<o.rank,()=>`All entries in 'perm' must be between 0 and ${o.rank-1} but got ${t}`)}),o.rank<=1)return o.clone();let n={x:o},a={perm:t};return o.dtype==="complex64"?He(()=>{let i=Os(o),s=ec(o);return i=A.runKernel(Cs,{x:i},a),s=A.runKernel(Cs,{x:s},a),r&&(s=vo(s)),nn(i,s)}):A.runKernel(Cs,n,a)}var GS=T({transpose_:Vhe});function jhe(e,t,r,o,n=!0){let a=_(e,"v","movingAverage"),i=_(t,"x","movingAverage"),s=_(r,"decay","movingAverage");_L(a,i),D(Cn(a.shape,i.shape),()=>"Shape mismatch in v and x");let c=$e(1),l=Fe(c,s),p=ce(Fe(i,a),l);if(n){D(o!=null,()=>"When using zeroDebias: true, step is required.");let u=_(o,"step","movingAverage");p=je(p,Fe(c,Fs(s,u)))}return be(a,p)}var Ghe=T({movingAverage_:jhe});function qhe(e,t,r){or(r);let o=_(e,"indices","scatterND","int32"),n=_(t,"updates","scatterND");Yh(n,o,r);let a={indices:o,updates:n},i={shape:r};return A.runKernel(Gu,a,i)}var Khe=T({scatterND_:qhe});function x9(e,t,r,o){if(e.dtype!=="int32")throw new Error(`tf.sparseToDense() expects the indices to be int32 type, but the dtype was ${e.dtype}.`);if(e.rank>2)throw new Error(`sparseIndices should be a scalar, vector, or matrix, but got shape ${e.shape}.`);let n=e.rank>0?e.shape[0]:1,a=e.rank>1?e.shape[1]:1;if(r.length!==a)throw new Error(`outputShape has incorrect number of elements:, ${r.length}, should be: ${a}.`);let i=t.size;if(!(t.rank===0||t.rank===1&&i===n))throw new Error(`sparseValues has incorrect shape ${t.shape}, should be [] or [${n}]`);if(t.dtype!==o.dtype)throw new Error("sparseValues.dtype must match defaultValues.dtype")}function Yhe(e,t,r,o=0){or(r);let n=_(e,"sparseIndices","sparseToDense","int32"),a=_(t,"sparseValues","sparseToDense","string_or_numeric"),i=_(o,"defaultValue","sparseToDense",a.dtype);x9(n,a,r,i);let s={sparseIndices:n,sparseValues:a,defaultValue:i},c={outputShape:r};return A.runKernel(am,s,c)}var Qhe=T({sparseToDense_:Yhe});function Jhe(e,t){let r=_(t,"indices","gatherND","int32"),n={params:_(e,"x","gatherND","string_or_numeric"),indices:r};return A.runKernel(ou,n)}var Zhe=T({gatherND_:Jhe});function w9(e,t){if(t==null)return e.shape.slice();if(Cn(e.shape,t))return t;if(e.shape.length===t.length){let r=[];for(let o=0;o<e.shape.length;o++)t[o]==null&&e.shape[o]!=null?r.push(e.shape[o]):r.push(t[o]);return r}return t}function ege(e,t,r,o){let n=_(e,"x","dropout");if(D(n.dtype==="float32",()=>`x has to be a floating point tensor since it's going to be scaled, but got a ${n.dtype} tensor instead.`),D(t>=0&&t<1,()=>`rate must be a float in the range [0, 1), but got ${t}.`),t===0)return e instanceof $t?n.clone():n;let a=w9(n,r),i=1-t,s=je(vS(be(qh(a,0,1,"float32",o),i)),i);return ce(n,s)}var tge=T({dropout_:ege});function eA(e){return Math.floor(Math.pow(2,Math.ceil(Math.log(e)/Math.log(2))))}function vb(e,t,r){let o=1-e%2,n=new Float32Array(e);for(let a=0;a<e;++a){let i=2*Math.PI*a/(e+o-1);n[a]=t-r*Math.cos(i)}return yr(n,"float32")}async function rge(e,t,r=1){let o=_(e,"predictions","inTopK"),n=_(t,"targets","inTopK");D(o.rank>1,()=>`inTopK() expects the predictions to be of rank 2 or higher, but got ${o.rank}`),D(o.rank-1===n.rank,()=>`predictions rank should be 1 larger than targets rank, but got predictions rank ${o.rank} and targets rank ${n.rank}`),gr(o.shape.slice(0,o.shape.length-1),n.shape,"predictions's shape should be align with the targets' shape, except the last dimension.");let a=o.shape[o.shape.length-1];D(r>0&&r<=a,()=>`'k' passed to inTopK() must be > 0 && <= the predictions last dimension (${a}), but got ${r}`);let i=await o.data(),s=await n.data(),[c,l]=[i.length/a,a],p=l3("bool",c);for(let u=0;u<c;u++){let m=u*l,f=i.subarray(m,m+l),d=[];for(let h=0;h<f.length;h++)d.push({value:f[h],index:h});d.sort((h,y)=>y.value-h.value),p[u]=0;for(let h=0;h<r;h++)if(d[h].index===s[u]){p[u]=1;break}}return e!==o&&o.dispose(),t!==n&&n.dispose(),go(p,n.shape,"bool")}var oge=rge;var tA={};Ot(tA,{conv2d:()=>k9,depthwiseConv2d:()=>I9,matMul:()=>T9});function nge(e,t,r,o,n,a="NHWC",i){let s=e;e.rank===3&&(s=K(e,[1,e.shape[0],e.shape[1],e.shape[2]]));let c=t;c.rank===3&&(c=K(t,[1,t.shape[0],t.shape[1],t.shape[2]])),D(s.rank===4,()=>`Error in conv2dDerFilter: input must be rank 4, but got shape ${s.shape}.`),D(c.rank===4,()=>`Error in conv2dDerFilter: dy must be rank 4, but got shape ${c.shape}.`),D(r.length===4,()=>`Error in conv2dDerFilter: filterShape must be length 4, but got ${r}.`);let l=a==="NHWC"?s.shape[3]:s.shape[1],p=a==="NHWC"?c.shape[3]:c.shape[1];D(l===r[2],()=>`Error in conv2dDerFilter: depth of input ${l}) must match input depth in filter (${r[2]}.`),D(p===r[3],()=>`Error in conv2dDerFilter: depth of dy (${p}) must match output depth for filter (${r[3]}).`),Rr("conv2dDerFilter",n,i);let u={x:s,dy:c},m={strides:o,pad:n,dataFormat:a,dimRoundingMode:i,filterShape:r};return A.runKernel(T1,u,m)}var S9=T({conv2DBackpropFilter_:nge});function Rm(e,t,r){if(r==null||r==="linear")return e;if(r==="relu")return ce(e,WS(t));throw new Error(`Cannot compute gradient for fused activation ${r}.`)}function Dm(e,t){let r=t,o=dS(e.shape,t.shape);return o.length>0&&(r=Ft(r,o)),K(r,e.shape)}function Fm(e,t,r,o){if(t==="linear")return e;if(t==="relu")return rc(e);if(t==="elu")return gS(e);if(t==="relu6")return $S(e);if(t==="prelu")return DS(e,r);if(t==="leakyrelu")return wS(e,o);if(t==="sigmoid")return Sa(e);throw new Error(`Unknown fused activation ${t}.`)}var Mm=(e,t)=>!(e>0)||t==="linear";function age({x:e,filter:t,strides:r,pad:o,dataFormat:n="NHWC",dilations:a=[1,1],dimRoundingMode:i,bias:s,activation:c="linear",preluActivationWeights:l,leakyreluAlpha:p}){if(c=c||"linear",Mm(A.state.gradientDepth,c)===!1){D(n==="NHWC",()=>`Error in fused conv2d: got dataFormat of ${n} but only NHWC is currently supported for the case of gradient depth is 0 and the activation is not linear.`);let C=Ql(e,t,r,o,n,a,i);return s!=null&&(C=be(C,s)),Fm(C,c,l,p)}let u=_(e,"x","conv2d","float32"),m=_(t,"filter","conv2d","float32"),f=u,d=!1;u.rank===3&&(d=!0,f=K(u,[1,u.shape[0],u.shape[1],u.shape[2]])),D(f.rank===4,()=>`Error in fused conv2d: input must be rank 4, but got rank ${f.rank}.`),D(m.rank===4,()=>`Error in fused conv2d: filter must be rank 4, but got rank ${m.rank}.`),Rr("fused conv2d",o,i);let h=n==="NHWC"?f.shape[3]:f.shape[1];D(m.shape[2]===h,()=>`Error in conv2d: depth of input (${h}) must match input depth for filter ${m.shape[2]}.`),D(No(r,a),()=>`Error in conv2D: Either strides or dilations must be 1. Got strides ${r} and dilations '${a}'`);let y=Sm(f.shape,m.shape,r,a,o,i),g;s!=null&&(g=_(s,"bias","fused conv2d"),[g]=ot(g,u),n==="NHWC"?Ct(y.outShape,g.shape):(D(g.shape.length<=1,()=>`Error in fused conv2d: only supports scalar or 1-D Tensor bias for NCHW format but got the bias of rank-${g.shape.length}.`),D(g.shape.length===0||g.shape[0]===y.outChannels||g.shape[0]===1,()=>`Error in fused conv2d: bias shape (${g.shape}) is not compatible with the number of output channels (${y.outChannels})`)));let b;if(l!=null){let C=l.shape;if(D(C.length<=1||C.length===3,()=>`Error in fused conv2d: only supports scalar, 1-D Tensor or 3-D Tensor PReLU activation weights but got a tensor of rank-${C.length}.`),C.length===1)D(C[0]===1||C[0]===y.outChannels,()=>`Error in fused conv2d: PReLU activation weights (${C}) is not compatible with the number of output channels (${y.outChannels}).`);else if(C.length===3)try{Ct(C,y.outShape)}catch{let P=`Error in fused conv2d: PReLU activation weights (${C}) is not compatible with the output shape of the conv2d (${y.outShape}).`;throw Error(P)}b=_(l,"prelu weights","fused conv2d")}let x=(C,R)=>{D(n==="NHWC",()=>`Error in gradient of fused conv2D: got dataFormat of ${n} but only NHWC is currently supported.`);let[P,z,$,B]=R,V=Rm(C,$,c);D(wm(a),()=>`Error in gradient of fused conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${a}'`);let H=fS(z.shape,V,P,r,o),G=S9(z,V,P.shape,r,o),X=[H,G];if(B!=null){let ee=Dm(B,V);X.push(ee)}return X},w={x:f,filter:m,bias:g,preluActivationWeights:b},I={strides:r,pad:o,dataFormat:n,dilations:a,dimRoundingMode:i,activation:c,leakyreluAlpha:p};return s==null?cn((R,P,z)=>{let $=A.runKernel(Vl,w,I);return z([P,R,$]),d&&($=K($,[$.shape[1],$.shape[2],$.shape[3]])),{value:$,gradFunc:x}})(f,m):cn((R,P,z,$)=>{let B=A.runKernel(Vl,w,I);return $([P,R,B,z]),d&&(B=K(B,[B.shape[1],B.shape[2],B.shape[3]])),{value:B,gradFunc:x}})(f,m,g)}var k9=T({fusedConv2d_:age});function ige(e,t,r,o,n,a=[1,1],i){let s=e;e.rank===3&&(s=K(e,[1,e.shape[0],e.shape[1],e.shape[2]]));let c=t;c.rank===3&&(c=K(t,[1,t.shape[0],t.shape[1],t.shape[2]]));let l={x:s,dy:c},p={strides:o,pad:n,dimRoundingMode:i,dilations:a,filterShape:r};return A.runKernel(C1,l,p)}var _9=T({depthwiseConv2dNativeBackpropFilter_:ige});function sge(e,t,r,o,n,a=[1,1],i){let s=t,c=!1;t.rank===3&&(c=!0,s=K(t,[1,t.shape[0],t.shape[1],t.shape[2]]));let l={dy:s,filter:r},p={strides:o,pad:n,dimRoundingMode:i,dilations:a,inputShape:e},u=A.runKernel(N1,l,p);return c?K(u,[u.shape[1],u.shape[2],u.shape[3]]):u}var E9=T({depthwiseConv2dNativeBackpropInput_:sge});function lge({x:e,filter:t,strides:r,pad:o,dataFormat:n="NHWC",dilations:a=[1,1],dimRoundingMode:i,bias:s,activation:c="linear",preluActivationWeights:l,leakyreluAlpha:p}){if(Mm(A.state.gradientDepth,c)===!1){let I=jh(e,t,r,o,n,a,i);return s!=null&&(I=be(I,s)),Fm(I,c,l,p)}let u=_(e,"x","depthwiseConv2d","float32"),m=_(t,"filter","depthwiseConv2d","float32"),f=u,d=!1;u.rank===3&&(d=!0,f=K(u,[1,u.shape[0],u.shape[1],u.shape[2]])),D(f.rank===4,()=>`Error in fused depthwiseConv2d: input must be rank 4, but got rank ${f.rank}.`),D(m.rank===4,()=>`Error in fused depthwiseConv2d: filter must be rank 4, but got rank ${m.rank}.`),D(f.shape[3]===m.shape[2],()=>`Error in fused depthwiseConv2d: number of input channels (${f.shape[3]}) must match the inChannels dimension in filter ${m.shape[2]}.`),a==null&&(a=[1,1]),D(No(r,a),()=>`Error in fused depthwiseConv2d: Either strides or dilations must be 1. Got strides ${r} and dilations '${a}'`),Rr("fused depthwiseConv2d",o,i);let h=Sm(f.shape,m.shape,r,a,o,i,!0),y;s!=null&&(y=_(s,"bias","fused conv2d"),[y]=ot(y,u),Ct(h.outShape,y.shape));let g;l!=null&&(g=_(l,"prelu weights","fused depthwiseConv2d"));let b=(I,C)=>{D(wm(a),()=>`Error in gradient of fused depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations '${a}'`);let[R,P,z,$]=C,B=Rm(I,z,c),V=E9(P.shape,B,R,r,o,a,i),H=_9(P,B,R.shape,r,o,a,i);if($!=null){let G=Dm(y,B);return[V,H,G]}return[V,H]},x={x:f,filter:m,bias:y,preluActivationWeights:g},w={strides:r,pad:o,dataFormat:n,dilations:a,dimRoundingMode:i,activation:c,leakyreluAlpha:p};return s==null?cn((C,R,P)=>{let z=A.runKernel(jl,x,w);return P([R,C,z]),d&&(z=K(z,[z.shape[1],z.shape[2],z.shape[3]])),{value:z,gradFunc:b}})(f,m):cn((C,R,P,z)=>{let $=A.runKernel(jl,x,w);return z([R,C,$,P]),d&&($=K($,[$.shape[1],$.shape[2],$.shape[3]])),{value:$,gradFunc:b}})(f,m,y)}var I9=T({fusedDepthwiseConv2d_:lge});function cge({a:e,b:t,transposeA:r=!1,transposeB:o=!1,bias:n,activation:a="linear",preluActivationWeights:i,leakyreluAlpha:s=.2}){if(Mm(A.state.gradientDepth,a)===!1){let B=Dt(e,t,r,o);return n!=null&&(B=be(B,n)),Fm(B,a,i,s)}let c=_(e,"a","fused matMul"),l=_(t,"b","fused matMul");[c,l]=ot(c,l);let p=r?c.shape[c.rank-2]:c.shape[c.rank-1],u=o?l.shape[l.rank-1]:l.shape[l.rank-2],m=r?c.shape[c.rank-1]:c.shape[c.rank-2],f=o?l.shape[l.rank-2]:l.shape[l.rank-1],d=c.shape.slice(0,-2),h=l.shape.slice(0,-2),y=mt(d),g=mt(h);D(p===u,()=>`Error in fused matMul: inner shapes (${p}) and (${u}) of Tensors with shapes ${c.shape} and ${l.shape} and transposeA=${r} and transposeB=${o} must match.`);let x=Ct(c.shape.slice(0,-2),l.shape.slice(0,-2)).concat([m,f]),w=r?K(c,[y,p,m]):K(c,[y,m,p]),I=o?K(l,[g,f,u]):K(l,[g,u,f]),C;n!=null&&(C=_(n,"bias","fused matMul"),[C]=ot(C,c),Ct(x,C.shape));let R;i!=null&&(R=_(i,"prelu weights","fused matMul"));let P=(B,V)=>{let[H,G,X,ee]=V,Z=Rm(K(B,X.shape),X,a),te,re;if(!r&&!o?(te=Dt(Z,G,!1,!0),re=Dt(H,Z,!0,!1)):!r&&o?(te=Dt(Z,G,!1,!1),re=Dt(Z,H,!0,!1)):r&&!o?(te=Dt(G,Z,!1,!0),re=Dt(H,Z,!1,!1)):(te=Dt(G,Z,!0,!0),re=Dt(Z,H,!0,!0)),n!=null){let se=Dm(ee,Z);return[te,re,se]}else return[te,re]},z={a:w,b:I,bias:C,preluActivationWeights:R},$={transposeA:r,transposeB:o,activation:a,leakyreluAlpha:s};return n==null?cn((V,H,G)=>{let X=A.runKernel(Hl,z,$);return G([V,H,X]),{value:K(X,x),gradFunc:P}})(w,I):cn((V,H,G,X)=>{let ee=A.runKernel(Hl,z,$);return X([V,H,ee,G]),{value:K(ee,x),gradFunc:P}})(w,I,C)}var T9=T({fusedMatMul_:cge});function pge(e){return vb(e,.54,.46)}var C9=T({hammingWindow_:pge});function uge(e){return vb(e,.5,.5)}var qS=T({hannWindow_:uge});function mge(e,t,r,o=!1,n=0){let a=0,i=[];for(;a+t<=e.size;)i.push(We(e,a,t)),a+=r;if(o)for(;a<e.size;){let s=a+t-e.size,c=Gt([We(e,a,t-s),Pi([s],n)]);i.push(c),a+=r}return i.length===0?ai([],[0,t]):K(Gt(i),[i.length,t])}var KS=T({frame_:mge});function fge(e,t,r,o,n=qS){o==null&&(o=eA(t));let a=KS(e,t,r),i=ce(a,n(t));return Xh(i,o)}var N9=T({stft_:fge});function dge(e,t,r,o,n="bilinear",a=0){let i=_(e,"image","cropAndResize"),s=_(t,"boxes","cropAndResize","float32"),c=_(r,"boxInd","cropAndResize","int32"),l=s.shape[0];D(i.rank===4,()=>`Error in cropAndResize: image must be rank 4,but got rank ${i.rank}.`),D(s.rank===2&&s.shape[1]===4,()=>`Error in cropAndResize: boxes must be have size [${l},4] but had shape ${s.shape}.`),D(c.rank===1&&c.shape[0]===l,()=>`Error in cropAndResize: boxInd must be have size [${l}] but had shape ${s.shape}.`),D(o.length===2,()=>`Error in cropAndResize: cropSize must be of length 2, but got length ${o.length}.`),D(o[0]>=1&&o[1]>=1,()=>`cropSize must be atleast [1,1], but was ${o}`),D(n==="bilinear"||n==="nearest",()=>`method must be bilinear or nearest, but was ${n}`);let p={image:i,boxes:s,boxInd:c},u={method:n,extrapolationValue:a,cropSize:o};return A.runKernel(Hp,p,u)}var A9=T({cropAndResize_:dge});function hge(e){let t=_(e,"image","flipLeftRight","float32");D(t.rank===4,()=>`Error in flipLeftRight: image must be rank 4,but got rank ${t.rank}.`);let r={image:t};return A.runKernel(Zp,r,{})}var R9=T({flipLeftRight_:hge});function gge(e){let t=_(e,"image","grayscaleToRGB"),r=t.rank-1,o=t.shape[r];D(t.rank>=2,()=>`Error in grayscaleToRGB: images must be at least rank 2, but got rank ${t.rank}.`),D(o===1,()=>`Error in grayscaleToRGB: last dimension of a grayscale image should be size 1, but got size ${o}.`);let n=new Array(t.rank);return n.fill(1,0,r),n[r]=3,Zl(t,n)}var D9=T({grayscaleToRGB_:gge});function yge(e){let t=_(e,"image","RGBToGrayscale"),r=t.rank-1,o=t.shape[r];D(t.rank>=2,()=>`Error in RGBToGrayscale: images must be at least rank 2, but got rank ${t.rank}.`),D(o===3,()=>`Error in RGBToGrayscale: last dimension of an RGB image should be size 3, but got size ${o}.`);let n=t.dtype,a=pt(t,"float32"),i=yr([.2989,.587,.114]),s;switch(t.rank){case 2:s=Jl("ij,j->i",a,i);break;case 3:s=Jl("ijk,k->ij",a,i);break;case 4:s=Jl("ijkl,l->ijk",a,i);break;case 5:s=Jl("ijklm,m->ijkl",a,i);break;case 6:s=Jl("ijklmn,n->ijklm",a,i);break;default:throw new Error("Not a valid tensor rank.")}return s=Dn(s,-1),pt(s,n)}var F9=T({rgbToGrayscale_:yge});function vge(e,t,r=0,o=.5){let n=_(e,"image","rotateWithOffset","float32");D(n.rank===4,()=>`Error in rotateWithOffset: image must be rank 4,but got rank ${n.rank}.`);let a={image:n},i={radians:t,fillValue:r,center:o};return A.runKernel(fm,a,i)}var M9=T({rotateWithOffset_:vge});function _a(e,t,r,o,n,a){o==null&&(o=.5),n==null&&(n=Number.NEGATIVE_INFINITY),a==null&&(a=0);let i=e.shape[0];return r=Math.min(r,i),D(0<=o&&o<=1,()=>`iouThreshold must be in [0, 1], but was '${o}'`),D(e.rank===2,()=>`boxes must be a 2D tensor, but was of rank '${e.rank}'`),D(e.shape[1]===4,()=>`boxes must have 4 columns, but 2nd dimension was ${e.shape[1]}`),D(t.rank===1,()=>"scores must be a 1D tensor"),D(t.shape[0]===i,()=>`scores has incompatible shape with boxes. Expected ${i}, but was ${t.shape[0]}`),D(0<=a&&a<=1,()=>`softNmsSigma must be in [0, 1], but was '${a}'`),{maxOutputSize:r,iouThreshold:o,scoreThreshold:n,softNmsSigma:a}}function bge(e,t,r,o=.5,n=Number.NEGATIVE_INFINITY){let a=_(e,"boxes","nonMaxSuppression","float32"),i=_(t,"scores","nonMaxSuppression","float32"),s=_a(a,i,r,o,n);r=s.maxOutputSize,o=s.iouThreshold,n=s.scoreThreshold;let c={maxOutputSize:r,iouThreshold:o,scoreThreshold:n};return A.runKernel(Au,{boxes:a,scores:i},c)}var O9=T({nonMaxSuppression_:bge});function P9(e,t,r){let o=xge(e,t,r),n=o<0?-(o+1):o;e.splice(n,0,t)}function xge(e,t,r){return Sge(e,t,r||wge)}function wge(e,t){return e>t?1:e<t?-1:0}function Sge(e,t,r){let o=0,n=e.length,a=0,i=!1;for(;o<n;){a=o+(n-o>>>1);let s=r(t,e[a]);s>0?o=a+1:(n=a,i=!s)}return i?o:-o-1}function XS(e,t,r,o,n){return rA(e,t,r,o,n,0)}function YS(e,t,r,o,n,a){return rA(e,t,r,o,n,0,!1,a,!0)}function QS(e,t,r,o,n,a){return rA(e,t,r,o,n,a,!0)}function rA(e,t,r,o,n,a,i=!1,s=!1,c=!1){let l=[];for(let y=0;y<t.length;y++)t[y]>n&&l.push({score:t[y],boxIndex:y,suppressBeginIndex:0});l.sort(z9);let p=a>0?-.5/a:0,u=[],m=[];for(;u.length<r&&l.length>0;){let y=l.pop(),{score:g,boxIndex:b,suppressBeginIndex:x}=y;if(g<n)break;let w=!1;for(let I=u.length-1;I>=x;--I){let C=kge(e,b,u[I]);if(C>=o){w=!0;break}if(y.score=y.score*_ge(o,p,C),y.score<=n)break}y.suppressBeginIndex=u.length,w||(y.score===g?(u.push(b),m.push(y.score)):y.score>n&&P9(l,y,z9))}let f=u.length,d=r-f;s&&d>0&&(u.push(...new Array(d).fill(0)),m.push(...new Array(d).fill(0)));let h={selectedIndices:u};return i&&(h.selectedScores=m),c&&(h.validOutputs=f),h}function kge(e,t,r){let o=e.subarray(t*4,t*4+4),n=e.subarray(r*4,r*4+4),a=Math.min(o[0],o[2]),i=Math.min(o[1],o[3]),s=Math.max(o[0],o[2]),c=Math.max(o[1],o[3]),l=Math.min(n[0],n[2]),p=Math.min(n[1],n[3]),u=Math.max(n[0],n[2]),m=Math.max(n[1],n[3]),f=(s-a)*(c-i),d=(u-l)*(m-p);if(f<=0||d<=0)return 0;let h=Math.max(a,l),y=Math.max(i,p),g=Math.min(s,u),b=Math.min(c,m),x=Math.max(g-h,0)*Math.max(b-y,0);return x/(f+d-x)}function _ge(e,t,r){let o=Math.exp(t*r*r);return r<=e?o:0}function z9(e,t){return e.score-t.score||e.score===t.score&&t.boxIndex-e.boxIndex}async function Ege(e,t,r,o=.5,n=Number.NEGATIVE_INFINITY){let a=_(e,"boxes","nonMaxSuppressionAsync"),i=_(t,"scores","nonMaxSuppressionAsync"),s=_a(a,i,r,o,n);r=s.maxOutputSize,o=s.iouThreshold,n=s.scoreThreshold;let c=await Promise.all([a.data(),i.data()]),l=c[0],p=c[1],{selectedIndices:u}=XS(l,p,r,o,n);return a!==e&&a.dispose(),i!==t&&i.dispose(),yr(u,"int32")}var $9=Ege;function Ige(e,t,r,o=.5,n=Number.NEGATIVE_INFINITY,a=0){let i=_(e,"boxes","nonMaxSuppression"),s=_(t,"scores","nonMaxSuppression"),c=_a(i,s,r,o,n,a);r=c.maxOutputSize,o=c.iouThreshold,n=c.scoreThreshold,a=c.softNmsSigma;let l={boxes:i,scores:s},p={maxOutputSize:r,iouThreshold:o,scoreThreshold:n,softNmsSigma:a},u=A.runKernel(Du,l,p);return{selectedIndices:u[0],selectedScores:u[1]}}var L9=T({nonMaxSuppressionWithScore_:Ige});async function Tge(e,t,r,o=.5,n=Number.NEGATIVE_INFINITY,a=0){let i=_(e,"boxes","nonMaxSuppressionAsync"),s=_(t,"scores","nonMaxSuppressionAsync"),c=_a(i,s,r,o,n,a);r=c.maxOutputSize,o=c.iouThreshold,n=c.scoreThreshold,a=c.softNmsSigma;let l=await Promise.all([i.data(),s.data()]),p=l[0],u=l[1],{selectedIndices:m,selectedScores:f}=QS(p,u,r,o,n,a);return i!==e&&i.dispose(),s!==t&&s.dispose(),{selectedIndices:yr(m,"int32"),selectedScores:yr(f)}}var B9=Tge;function Cge(e,t,r,o=.5,n=Number.NEGATIVE_INFINITY,a=!1){let i=_(e,"boxes","nonMaxSuppression"),s=_(t,"scores","nonMaxSuppression"),c=_a(i,s,r,o,n,null),l=c.maxOutputSize,p=c.iouThreshold,u=c.scoreThreshold,m={boxes:i,scores:s},f={maxOutputSize:l,iouThreshold:p,scoreThreshold:u,padToMaxOutputSize:a},d=A.runKernel(Ru,m,f);return{selectedIndices:d[0],validOutputs:d[1]}}var U9=T({nonMaxSuppressionPadded_:Cge});async function Nge(e,t,r,o=.5,n=Number.NEGATIVE_INFINITY,a=!1){let i=_(e,"boxes","nonMaxSuppressionAsync"),s=_(t,"scores","nonMaxSuppressionAsync"),c=_a(i,s,r,o,n,null),l=c.maxOutputSize,p=c.iouThreshold,u=c.scoreThreshold,[m,f]=await Promise.all([i.data(),s.data()]),{selectedIndices:d,validOutputs:h}=YS(m,f,l,p,u,a);return i!==e&&i.dispose(),s!==t&&s.dispose(),{selectedIndices:yr(d,"int32"),validOutputs:$e(h,"int32")}}var W9=Nge;function Age(e,t,r=!1,o=!1){let n=_(e,"images","resizeBilinear");D(n.rank===3||n.rank===4,()=>`Error in resizeBilinear: x must be rank 3 or 4, but got rank ${n.rank}.`),D(t.length===2,()=>`Error in resizeBilinear: new shape must 2D, but got shape ${t}.`),D(o===!1||r===!1,()=>"Error in resizeBilinear: If halfPixelCenters is true, alignCorners must be false.");let a=n,i=!1;n.rank===3&&(i=!0,a=K(n,[1,n.shape[0],n.shape[1],n.shape[2]]));let[]=t,s={images:a},c={alignCorners:r,halfPixelCenters:o,size:t},l=A.runKernel(Uu,s,c);return i?K(l,[l.shape[1],l.shape[2],l.shape[3]]):l}var H9=T({resizeBilinear_:Age});function Rge(e,t,r=!1,o=!1){let n=_(e,"images","resizeNearestNeighbor");D(n.rank===3||n.rank===4,()=>`Error in resizeNearestNeighbor: x must be rank 3 or 4, but got rank ${n.rank}.`),D(t.length===2,()=>`Error in resizeNearestNeighbor: new shape must 2D, but got shape ${t}.`),D(n.dtype==="float32"||n.dtype==="int32",()=>"`images` must have `int32` or `float32` as dtype"),D(o===!1||r===!1,()=>"Error in resizeNearestNeighbor: If halfPixelCenters is true, alignCorners must be false.");let a=n,i=!1;n.rank===3&&(i=!0,a=K(n,[1,n.shape[0],n.shape[1],n.shape[2]]));let[]=t,s={images:a},c={alignCorners:r,halfPixelCenters:o,size:t},l=A.runKernel(Bu,s,c);return i?K(l,[l.shape[1],l.shape[2],l.shape[3]]):l}var V9=T({resizeNearestNeighbor_:Rge});function Dge(e,t="binary",r=!1,o=.5){let n=_(e,"image","threshold"),a=.2989,i=.587,s=.114,c=n.shape[0]*n.shape[1],l=ce(yr([o]),255),p,u,m,f;if(D(n.rank===3,()=>`Error in threshold: image must be rank 3,but got rank ${n.rank}.`),D(n.shape[2]===3||n.shape[2]===1,()=>`Error in threshold: image color channel must be equal to 3 or 1but got ${n.shape[2]}.`),D(n.dtype==="int32"||n.dtype==="float32",()=>`Error in dtype: image dtype must be int32 or float32,but got dtype ${n.dtype}.`),D(t==="otsu"||t==="binary",()=>`Method must be binary or otsu, but was ${t}`),n.shape[2]===3){[p,u,m]=Ps(n,[1,1,1],-1);let y=ce(p,a),g=ce(u,i),b=ce(m,s);f=be(be(y,g),b)}else f=e;if(t==="otsu"){let y=uS(pt(LS(f),"int32"),go([]),256);l=Fge(y,c)}let d=r?Gh(f,l):_m(f,l);return pt(ce(d,255),"int32")}function Fge(e,t){let r=yr([-1]),o=yr([0]),n=yr([0]),a,i,s,c,l,p;for(let u=0;u<e.size-1;u++){a=We(e,0,u+1),i=We(e,u+1),l=je(Ft(a),t),p=je(Ft(i),t);let m=Ft(ce(a,tc(0,a.size)));s=je(m,Ft(a));let f=Pi(i.shape,a.size),d=be(tc(0,i.size),f),h=ce(i,d);c=je(Ft(h),Ft(i));let y=Fe(s,c),g=Fe(s,c),b=ce(l,p);n=ce(ce(b,y),g);let x=_m(n,o);o=Yn(x,n,o),r=Yn(x,yr([u]),r)}return r}var j9=T({threshold_:Dge});function Mge(e,t,r="nearest",o="constant",n=0,a){let i=_(e,"image","transform","float32"),s=_(t,"transforms","transform","float32");D(i.rank===4,()=>`Error in transform: image must be rank 4,but got rank ${i.rank}.`),D(s.rank===2&&(s.shape[0]===i.shape[0]||s.shape[0]===1)&&s.shape[1]===8,()=>"Error in transform: Input transform should be batch x 8 or 1 x 8"),D(a==null||a.length===2,()=>`Error in transform: outputShape must be [height, width] or null, but got ${a}.`);let c={image:i,transforms:s},l={interpolation:r,fillMode:o,fillValue:n,outputShape:a};return A.runKernel(mm,c,l)}var G9=T({transform_:Mge});function Oge(e,t,r){let o=_(e,"a","bandPart");D(o.rank>=2,()=>`bandPart(): Rank must be at least 2, got ${o.rank}.`);let n=o.shape,[a,i]=o.shape.slice(-2),s,c;typeof t=="number"?(D(t%1===0,()=>`bandPart(): numLower must be an integer, got ${t}.`),D(t<=a,()=>`bandPart(): numLower (${t}) must not be greater than the number of rows (${a}).`),s=_(t<0?a:t,"numLower","bandPart")):(D(t.dtype==="int32",()=>"bandPart(): numLower's dtype must be an int32."),s=Yn(gb(t,0),a,Tm(t,a))),typeof r=="number"?(D(r%1===0,()=>`bandPart(): numUpper must be an integer, got ${r}.`),D(r<=i,()=>`bandPart(): numUpper (${r}) must not be greater than the number of columns (${i}).`),c=_(r<0?i:r,"numUpper","bandPart")):(D(r.dtype==="int32",()=>"bandPart(): numUpper's dtype must be an int32."),c=Yn(gb(r,0),i,Tm(r,i)));let l=K(tc(0,a,1,"int32"),[-1,1]),p=tc(0,i,1,"int32"),u=Fe(l,p),m=Em(Gh(u,s),xS(u,vo(c))),f=$i([a,i],o.dtype);return K(Uo(Jn(K(o,[-1,a,i])).map(d=>Yn(m,d,f))),n)}var q9=T({bandPart_:Oge});function Pge(e){let t;if(Array.isArray(e)){t=!1,D(e!=null&&e.length>0,()=>"Gram-Schmidt process: input must not be null, undefined, or empty");let n=e[0].shape[0];for(let a=1;a<e.length;++a)D(e[a].shape[0]===n,()=>`Gram-Schmidt: Non-unique lengths found in the input vectors: (${e[a].shape[0]} vs. ${n})`)}else t=!0,e=Ps(e,e.shape[0],0).map(n=>Lr(n,[0]));D(e.length<=e[0].shape[0],()=>`Gram-Schmidt: Number of vectors (${e.length}) exceeds number of dimensions (${e[0].shape[0]}).`);let r=[],o=e;for(let n=0;n<e.length;++n)r.push(A.tidy(()=>{let a=o[n];if(n>0)for(let i=0;i<n;++i){let s=ce(Ft(ce(r[i],a)),r[i]);a=Fe(a,s)}return je(a,km(a,"euclidean"))}));return t?Uo(r,0):r}var K9=T({gramSchmidt_:Pge});function zge(e,t=!1){if(D(e.rank>=2,()=>`qr() requires input tensor to have a rank >= 2, but got rank ${e.rank}`),e.rank===2)return X9(e,t);{let r=e.shape.slice(0,e.shape.length-2).reduce((c,l)=>c*l),o=Jn(K(e,[r,e.shape[e.shape.length-2],e.shape[e.shape.length-1]]),0),n=[],a=[];o.forEach(c=>{let[l,p]=X9(c,t);n.push(l),a.push(p)});let i=K(Uo(n,0),e.shape),s=K(Uo(a,0),e.shape);return[i,s]}}function X9(e,t=!1){return A.tidy(()=>{D(e.shape.length===2,()=>`qr2d() requires a 2D Tensor, but got a ${e.shape.length}D Tensor.`);let r=e.shape[0],o=e.shape[1],n=yS(r),a=Rn(e),i=ai([[1]],[1,1]),s=Rn(i),c=r>=o?o:r;for(let l=0;l<c;++l){let p=a,u=s,m=n;[s,a,n]=A.tidy(()=>{let f=We(a,[l,l],[r-l,1]),d=km(f),h=We(a,[l,l],[1,1]),y=Yn(_m(h,0),ai([[-1]]),ai([[1]])),g=Fe(h,ce(y,d)),b=je(f,g);b.shape[0]===1?s=Rn(i):s=Gt([i,We(b,[1,0],[b.shape[0]-1,b.shape[1]])],0);let x=vo(je(Dt(y,g),d)),w=We(a,[l,0],[r-l,o]),I=ce(x,s),C=GS(s);if(l===0)a=Fe(w,Dt(I,Dt(C,w)));else{let z=Fe(w,Dt(I,Dt(C,w)));a=Gt([We(a,[0,0],[l,o]),z],0)}let R=GS(I),P=We(n,[0,l],[r,n.shape[1]-l]);if(l===0)n=Fe(P,Dt(Dt(P,s),R));else{let z=Fe(P,Dt(Dt(P,s),R));n=Gt([We(n,[0,0],[r,l]),z],1)}return[s,a,n]}),Yt([p,u,m])}return!t&&r>o&&(n=We(n,[0,0],[r,o]),a=We(a,[0,0],[o,o])),[n,a]})}var Y9=T({qr_:zge});var kr;(function(e){e[e.NONE=0]="NONE",e[e.MEAN=1]="MEAN",e[e.SUM=2]="SUM",e[e.SUM_BY_NONZERO_WEIGHTS=3]="SUM_BY_NONZERO_WEIGHTS"})(kr||(kr={}));function $ge(e,t,r=kr.SUM_BY_NONZERO_WEIGHTS){let o=_(e,"losses","computeWeightedLoss"),n=null;t!=null&&(n=_(t,"weights","computeWeightedLoss"));let a=n==null?o:ce(o,n);if(r===kr.NONE)return a;if(r===kr.SUM)return Ft(a);if(r===kr.MEAN){if(n==null)return Im(a);{let i=o.size/n.size,s=je(Ft(a),Ft(n));return i>1?je(s,$e(i)):s}}if(r===kr.SUM_BY_NONZERO_WEIGHTS){if(n==null)return je(Ft(a),$e(o.size));{let i=ce(n,Li(o.shape)),s=pt(Ft(AS(i,$e(0))),"float32");return je(Ft(a),s)}}throw Error(`Unknown reduction: ${r}`)}var bo=T({computeWeightedLoss_:$ge});function Lge(e,t,r,o=kr.SUM_BY_NONZERO_WEIGHTS){let n=_(e,"labels","absoluteDifference"),a=_(t,"predictions","absoluteDifference"),i=null;r!=null&&(i=_(r,"weights","absoluteDifference")),gr(n.shape,a.shape,"Error in absoluteDifference: ");let s=so(Fe(n,a));return bo(s,i,o)}var Q9=T({absoluteDifference_:Lge});function Bge(e,t,r,o,n=kr.SUM_BY_NONZERO_WEIGHTS){let a=_(e,"labels","cosineDistance"),i=_(t,"predictions","cosineDistance"),s=null;o!=null&&(s=_(o,"weights","cosineDistance")),gr(a.shape,i.shape,"Error in cosineDistance: ");let c=$e(1),l=Fe(c,Ft(ce(a,i),r,!0));return bo(l,s,n)}var J9=T({cosineDistance_:Bge});function Uge(e,t,r,o=kr.SUM_BY_NONZERO_WEIGHTS){let n=_(e,"labels","hingeLoss"),a=_(t,"predictions","hingeLoss"),i=null;r!=null&&(i=_(r,"weights","hingeLoss")),gr(n.shape,a.shape,"Error in hingeLoss: ");let s=$e(1);n=Fe(ce($e(2),n),s);let c=rc(Fe(s,ce(n,a)));return bo(c,i,o)}var Z9=T({hingeLoss_:Uge});function Wge(e,t,r,o=1,n=kr.SUM_BY_NONZERO_WEIGHTS){let a=_(e,"labels","huberLoss"),i=_(t,"predictions","huberLoss"),s=null;r!=null&&(s=_(r,"weights","huberLoss")),gr(a.shape,i.shape,"Error in huberLoss: ");let c=$e(o),l=so(Fe(i,a)),p=Tm(l,c),u=Fe(l,p),m=be(ce($e(.5),lo(p)),ce(c,u));return bo(m,s,n)}var e7=T({huberLoss_:Wge});function Hge(e,t,r,o=1e-7,n=kr.SUM_BY_NONZERO_WEIGHTS){let a=_(e,"labels","logLoss"),i=_(t,"predictions","logLoss"),s=null;r!=null&&(s=_(r,"weights","logLoss")),gr(a.shape,i.shape,"Error in logLoss: ");let c=$e(1),l=$e(o),p=vo(ce(a,Ms(be(i,l)))),u=ce(Fe(c,a),Ms(be(Fe(c,i),l))),m=Fe(p,u);return bo(m,s,n)}var t7=T({logLoss_:Hge});function Vge(e,t,r,o=kr.SUM_BY_NONZERO_WEIGHTS){let n=_(e,"labels","meanSquaredError"),a=_(t,"predictions","meanSquaredError"),i=null;r!=null&&(i=_(r,"weights","meanSquaredError")),gr(n.shape,a.shape,"Error in meanSquaredError: ");let s=US(n,a);return bo(s,i,o)}var r7=T({meanSquaredError_:Vge});function jge(e,t){let r=_(e,"labels","sigmoidCrossEntropyWithLogits"),o=_(t,"logits","sigmoidCrossEntropyWithLogits");gr(r.shape,o.shape,"Error in sigmoidCrossEntropyWithLogits: ");let n=rc(o),a=ce(o,r),i=SS(ln(vo(so(o))));return be(Fe(n,a),i)}function Gge(e,t,r,o=0,n=kr.SUM_BY_NONZERO_WEIGHTS){let a=_(e,"multiClassLabels","sigmoidCrossEntropy"),i=_(t,"logits","sigmoidCrossEntropy"),s=null;if(r!=null&&(s=_(r,"weights","sigmoidCrossEntropy")),gr(a.shape,i.shape,"Error in sigmoidCrossEntropy: "),o>0){let l=$e(o),p=$e(1),u=$e(.5);a=be(ce(a,Fe(p,l)),ce(u,l))}let c=jge(a,i);return bo(c,s,n)}var o7=T({sigmoidCrossEntropy_:Gge});function qge(e,t,r=-1){if(r===-1&&(r=t.rank-1),r!==t.rank-1)throw Error(`Softmax cross entropy along a non-last dimension is not yet supported. Labels / logits was rank ${t.rank} and dim was ${r}`);return cn((n,a,i)=>{let c=_S(a,[r],!0),l=Fe(pt(a,"float32"),c);i([n,l]);let p=vo(ce(l,n));return{value:Ft(p,[r]),gradFunc:(f,d)=>{let[h,y]=d,g=Ds(f.shape,[r]);return[ce(K(f,g),Fe(pt(h,"float32"),ln(y))),ce(K(f,g),Fe(ln(y),pt(h,"float32")))]}}})(e,t)}function Kge(e,t,r,o=0,n=kr.SUM_BY_NONZERO_WEIGHTS){let a=_(e,"onehotLabels","softmaxCrossEntropy"),i=_(t,"logits","softmaxCrossEntropy"),s=null;if(r!=null&&(s=_(r,"weights","softmaxCrossEntropy")),gr(a.shape,i.shape,"Error in softmaxCrossEntropy: "),o>0){let l=$e(o),p=$e(1),u=$e(a.shape[1]);a=be(ce(a,Fe(p,l)),je(l,u))}let c=qge(a,i);return bo(c,s,n)}var n7=T({softmaxCrossEntropy_:Kge});function Xge(e,t,r,o){let n=_(e,"indices","sparseFillEmptyRows","int32"),a=_(t,"values","sparseFillEmptyRows"),i=_(r,"denseShape","sparseFillEmptyRows","int32"),s=_(o,"defaultValue","sparseFillEmptyRows",a.dtype);if(n.rank!==2)throw new Error(`Indices should be Tensor2D but received shape
100
+ ${n.shape}`);if(a.rank!==1)throw new Error(`Values should be Tensor1D but received shape ${a.shape}`);if(i.rank!==1)throw new Error(`Dense shape should be Tensor1D but received shape ${i.shape}`);if(s.rank!==0)throw new Error(`Default value should be a scalar but received shape ${s.shape}`);let c={indices:n,values:a,denseShape:i,defaultValue:s},l=A.runKernel(Eh,c);return{outputIndices:l[0],outputValues:l[1],emptyRowIndicator:l[2],reverseIndexMap:l[3]}}var a7=T({sparseFillEmptyRows_:Xge});function Yge(e,t,r){let o=_(e,"inputIndices","sparseReshape","int32"),n=_(t,"inputShape","sparseReshape","int32"),a=_(r,"newShape","sparseReshape","int32");if(o.rank!==2)throw new Error(`Input indices should be Tensor2D but received shape
101
+ ${o.shape}`);if(n.rank!==1)throw new Error(`Input shape should be Tensor1D but received shape ${n.shape}`);if(a.rank!==1)throw new Error(`New shape should be Tensor1D but received shape ${a.shape}`);let i={inputIndices:o,inputShape:n,newShape:a},s=A.runKernel(nm,i);return{outputIndices:s[0],outputShape:s[1]}}var i7=T({sparseReshape_:Yge});function Qge(e,t,r){let o=_(e,"data","sparseSegmentMean"),n=_(t,"indices","sparseSegmentMean","int32"),a=_(r,"segmentIds","sparseSegmentMean","int32");if(o.rank<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(n.rank!==1)throw new Error(`Indices should be Tensor1D but received shape
102
+ ${n.shape}`);if(a.rank!==1)throw new Error(`Segment ids should be Tensor1D but received shape
103
+ ${a.shape}`);let i={data:o,indices:n,segmentIds:a};return A.runKernel(Ih,i)}var s7=T({sparseSegmentMean_:Qge});function Jge(e,t,r){let o=_(e,"data","sparseSegmentSum"),n=_(t,"indices","sparseSegmentSum","int32"),a=_(r,"segmentIds","sparseSegmentSum","int32");if(o.rank<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(n.rank!==1)throw new Error(`Indices should be Tensor1D but received shape
104
+ ${n.shape}`);if(a.rank!==1)throw new Error(`Segment ids should be Tensor1D but received shape
105
+ ${a.shape}`);let i={data:o,indices:n,segmentIds:a};return A.runKernel(Th,i)}var l7=T({sparseSegmentSum_:Jge});function Zge(e,t,r,o,n,a,i,s){let c=_(e,"data","stringNGrams","string");if(c.dtype!=="string")throw new Error("Data must be of datatype string");if(c.shape.length!==1)throw new Error(`Data must be a vector, saw: ${c.shape}`);let l=_(t,"dataSplits","stringNGrams");if(l.dtype!=="int32")throw new Error("Data splits must be of datatype int32");let p={separator:r,nGramWidths:o,leftPad:n,rightPad:a,padWidth:i,preserveShortSequences:s},u={data:c,dataSplits:l},m=A.runKernel(Ch,u,p);return{nGrams:m[0],nGramsSplits:m[1]}}var c7=T({stringNGrams_:Zge});function eye(e,t,r=!0){let o=_(e,"input","stringSplit","string"),n=_(t,"delimiter","stringSplit","string");if(o.rank!==1)throw new Error(`Input should be Tensor1D but received shape ${o.shape}`);if(n.rank!==0)throw new Error(`Delimiter should be a scalar but received shape ${n.shape}`);let a={skipEmpty:r},i={input:o,delimiter:n},s=A.runKernel(Nh,i,a);return{indices:s[0],values:s[1],shape:s[2]}}var p7=T({stringSplit_:eye});function tye(e,t){let r=_(e,"input","stringToHashBucketFast","string"),o={numBuckets:t};if(t<=0)throw new Error("Number of buckets must be at least 1");let n={input:r};return A.runKernel(Ah,n,o)}var u7=T({stringToHashBucketFast_:tye});function rye(e,t,r,o=!0){let n=_(e,"input","staticRegexReplace","string"),a={pattern:t,rewrite:r,replaceGlobal:o};return A.runKernel(nb,{x:n},a)}var m7=T({staticRegexReplace_:rye});var oye={fft:Kh,ifft:Am,rfft:Xh,irfft:BS},nye={hammingWindow:C9,hannWindow:qS,frame:KS,stft:N9},bb={flipLeftRight:R9,grayscaleToRGB:D9,resizeNearestNeighbor:V9,resizeBilinear:H9,rgbToGrayscale:F9,rotateWithOffset:M9,cropAndResize:A9,nonMaxSuppression:O9,nonMaxSuppressionAsync:$9,nonMaxSuppressionWithScore:L9,nonMaxSuppressionWithScoreAsync:B9,nonMaxSuppressionPadded:U9,nonMaxSuppressionPaddedAsync:W9,threshold:j9,transform:G9},aye={bandPart:q9,gramSchmidt:K9,qr:Y9},iye={absoluteDifference:Q9,computeWeightedLoss:bo,cosineDistance:J9,hingeLoss:Z9,huberLoss:e7,logLoss:t7,meanSquaredError:r7,sigmoidCrossEntropy:o7,softmaxCrossEntropy:n7},sye={sparseFillEmptyRows:a7,sparseReshape:i7,sparseSegmentMean:s7,sparseSegmentSum:l7},lye={stringNGrams:c7,stringSplit:p7,stringToHashBucketFast:u7,staticRegexReplace:m7};var cye=new Map,pye=new Map,JS=class{getClassName(){return this.constructor.className}static fromConfig(t,r){return new t(r)}},oA=class e{constructor(){this.classNameMap={}}static getMap(){return e.instance==null&&(e.instance=new e),e.instance}static register(t){e.getMap().classNameMap[t.className]=[t,t.fromConfig]}};function f7(e,t,r){D(e.className!=null,()=>"Class being registered does not have the static className property defined."),D(typeof e.className=="string",()=>"className is required to be a string, but got type "+typeof e.className),D(e.className.length>0,()=>"Class being registered has an empty-string as its className, which is disallowed."),typeof t>"u"&&(t="Custom"),typeof r>"u"&&(r=e.className);let o=r,n=t+">"+o;return oA.register(e),cye.set(n,e),pye.set(e,n),e}var pn=class extends JS{minimize(t,r=!1,o){let{value:n,grads:a}=this.computeGradients(t,o);if(o!=null){let i=o.map(s=>({name:s.name,tensor:a[s.name]}));this.applyGradients(i)}else this.applyGradients(a);return Yt(a),r?n:(n.dispose(),null)}get iterations(){return this.iterations_==null&&(this.iterations_=0),this.iterations_}incrementIterations(){this.iterations_=this.iterations+1}computeGradients(t,r){return ZB(t,r)}dispose(){this.iterations_!=null&&Yt(this.iterations_)}async saveIterations(){return this.iterations_==null&&(this.iterations_=0),{name:"iter",tensor:$e(this.iterations_,"int32")}}async getWeights(){throw new Error("getWeights() is not implemented for this optimizer yet.")}async setWeights(t){throw new Error(`setWeights() is not implemented for this optimizer class ${this.getClassName()}`)}async extractIterations(t){return this.iterations_=(await t[0].tensor.data())[0],t.slice(1)}};Object.defineProperty(pn,Symbol.hasInstance,{value:e=>e.minimize!=null&&e.computeGradients!=null&&e.applyGradients!=null});var ZS=class extends pn{static get className(){return"Adadelta"}constructor(t,r,o=null){super(),this.learningRate=t,this.rho=r,this.epsilon=o,this.accumulatedGrads=[],this.accumulatedUpdates=[],o==null&&(this.epsilon=A.backend.epsilon())}applyGradients(t){(Array.isArray(t)?t.map(o=>o.name):Object.keys(t)).forEach((o,n)=>{let a=A.registeredVariables[o],i=!1;this.accumulatedGrads[n]==null&&(this.accumulatedGrads[n]={originalName:`${o}/accum_grad`,variable:He(()=>Gr(a).variable(i))}),this.accumulatedUpdates[n]==null&&(this.accumulatedUpdates[n]={originalName:`${o}/accum_var`,variable:He(()=>Gr(a).variable(i))});let s=Array.isArray(t)?t[n].tensor:t[o];if(s==null)return;let c=this.accumulatedGrads[n].variable,l=this.accumulatedUpdates[n].variable;He(()=>{let p=be(ce(c,this.rho),ce(lo(s),1-this.rho)),u=ce(je(sn(be(l,this.epsilon)),sn(be(c,this.epsilon))),s),m=be(ce(l,this.rho),ce(lo(u),1-this.rho));c.assign(p),l.assign(m);let f=be(ce(u,-this.learningRate),a);a.assign(f)})}),this.incrementIterations()}dispose(){this.accumulatedUpdates!=null&&(Yt(this.accumulatedGrads.map(t=>t.variable)),Yt(this.accumulatedUpdates.map(t=>t.variable)))}async getWeights(){let t=[...this.accumulatedGrads,...this.accumulatedUpdates];return[await this.saveIterations()].concat(t.map(r=>({name:r.originalName,tensor:r.variable})))}async setWeights(t){t=await this.extractIterations(t);let r=t.length/2,o=!1;this.accumulatedGrads=t.slice(0,r).map(n=>({originalName:n.name,variable:n.tensor.variable(o)})),this.accumulatedUpdates=t.slice(r,r*2).map(n=>({originalName:n.name,variable:n.tensor.variable(o)}))}getConfig(){return{learningRate:this.learningRate,rho:this.rho,epsilon:this.epsilon}}static fromConfig(t,r){return new t(r.learningRate,r.rho,r.epsilon)}};var ek=class extends pn{static get className(){return"Adagrad"}constructor(t,r=.1){super(),this.learningRate=t,this.initialAccumulatorValue=r,this.accumulatedGrads=[]}applyGradients(t){(Array.isArray(t)?t.map(o=>o.name):Object.keys(t)).forEach((o,n)=>{let a=A.registeredVariables[o];this.accumulatedGrads[n]==null&&(this.accumulatedGrads[n]={originalName:`${o}/accumulator`,variable:He(()=>Pi(a.shape,this.initialAccumulatorValue).variable(!1))});let i=Array.isArray(t)?t[n].tensor:t[o];if(i==null)return;let s=this.accumulatedGrads[n].variable;He(()=>{let c=be(s,lo(i));s.assign(c);let l=be(ce(je(i,sn(be(c,A.backend.epsilon()))),-this.learningRate),a);a.assign(l)})}),this.incrementIterations()}dispose(){this.accumulatedGrads!=null&&Yt(this.accumulatedGrads.map(t=>t.variable))}async getWeights(){return[await this.saveIterations()].concat(this.accumulatedGrads.map(t=>({name:t.originalName,tensor:t.variable})))}async setWeights(t){t=await this.extractIterations(t);let r=!1;this.accumulatedGrads=t.map(o=>({originalName:o.name,variable:o.tensor.variable(r)}))}getConfig(){return{learningRate:this.learningRate,initialAccumulatorValue:this.initialAccumulatorValue}}static fromConfig(t,r){return new t(r.learningRate,r.initialAccumulatorValue)}};var tk=class extends pn{static get className(){return"Adam"}constructor(t,r,o,n=null){super(),this.learningRate=t,this.beta1=r,this.beta2=o,this.epsilon=n,this.accumulatedFirstMoment=[],this.accumulatedSecondMoment=[],He(()=>{this.accBeta1=$e(r).variable(),this.accBeta2=$e(o).variable()}),n==null&&(this.epsilon=A.backend.epsilon())}applyGradients(t){let r=Array.isArray(t)?t.map(o=>o.name):Object.keys(t);He(()=>{let o=Fe(1,this.accBeta1),n=Fe(1,this.accBeta2);r.forEach((a,i)=>{let s=A.registeredVariables[a],c=!1;this.accumulatedFirstMoment[i]==null&&(this.accumulatedFirstMoment[i]={originalName:`${a}/m`,variable:He(()=>Gr(s).variable(c))}),this.accumulatedSecondMoment[i]==null&&(this.accumulatedSecondMoment[i]={originalName:`${a}/v`,variable:He(()=>Gr(s).variable(c))});let l=Array.isArray(t)?t[i].tensor:t[a];if(l==null)return;let p=this.accumulatedFirstMoment[i].variable,u=this.accumulatedSecondMoment[i].variable,m=be(ce(p,this.beta1),ce(l,1-this.beta1)),f=be(ce(u,this.beta2),ce(lo(l),1-this.beta2)),d=je(m,o),h=je(f,n);p.assign(m),u.assign(f);let y=be(ce(je(d,be(sn(h),this.epsilon)),-this.learningRate),s);s.assign(y)}),this.accBeta1.assign(ce(this.accBeta1,this.beta1)),this.accBeta2.assign(ce(this.accBeta2,this.beta2))}),this.incrementIterations()}dispose(){this.accBeta1.dispose(),this.accBeta2.dispose(),this.accumulatedFirstMoment!=null&&Yt(this.accumulatedFirstMoment.map(t=>t.variable)),this.accumulatedSecondMoment!=null&&Yt(this.accumulatedSecondMoment.map(t=>t.variable))}async getWeights(){let t=[...this.accumulatedFirstMoment,...this.accumulatedSecondMoment];return[await this.saveIterations()].concat(t.map(r=>({name:r.originalName,tensor:r.variable})))}async setWeights(t){t=await this.extractIterations(t),He(()=>{this.accBeta1.assign(Fs(this.beta1,this.iterations_+1)),this.accBeta2.assign(Fs(this.beta2,this.iterations_+1))});let r=t.length/2,o=!1;this.accumulatedFirstMoment=t.slice(0,r).map(n=>({originalName:n.name,variable:n.tensor.variable(o)})),this.accumulatedSecondMoment=t.slice(r,r*2).map(n=>({originalName:n.name,variable:n.tensor.variable(o)}))}getConfig(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon}}static fromConfig(t,r){return new t(r.learningRate,r.beta1,r.beta2,r.epsilon)}};var rk=class extends pn{static get className(){return"Adamax"}constructor(t,r,o,n=null,a=0){super(),this.learningRate=t,this.beta1=r,this.beta2=o,this.epsilon=n,this.decay=a,this.accumulatedFirstMoment=[],this.accumulatedWeightedInfNorm=[],He(()=>{this.iteration=$e(0).variable(),this.accBeta1=$e(r).variable()}),n==null&&(this.epsilon=A.backend.epsilon())}applyGradients(t){let r=Array.isArray(t)?t.map(o=>o.name):Object.keys(t);He(()=>{let o=Fe(1,this.accBeta1),n=je(-this.learningRate,be(ce(this.iteration,this.decay),1));r.forEach((a,i)=>{let s=A.registeredVariables[a],c=!1;this.accumulatedFirstMoment[i]==null&&(this.accumulatedFirstMoment[i]={originalName:`${a}/m`,variable:Gr(s).variable(c)}),this.accumulatedWeightedInfNorm[i]==null&&(this.accumulatedWeightedInfNorm[i]={originalName:`${a}/v`,variable:Gr(s).variable(c)});let l=Array.isArray(t)?t[i].tensor:t[a];if(l==null)return;let p=this.accumulatedFirstMoment[i].variable,u=this.accumulatedWeightedInfNorm[i].variable,m=be(ce(p,this.beta1),ce(l,1-this.beta1)),f=ce(u,this.beta2),d=so(l),h=NS(f,d);p.assign(m),u.assign(h);let y=be(ce(je(n,o),je(m,be(h,this.epsilon))),s);s.assign(y)}),this.iteration.assign(be(this.iteration,1)),this.accBeta1.assign(ce(this.accBeta1,this.beta1))}),this.incrementIterations()}dispose(){this.accBeta1.dispose(),this.iteration.dispose(),this.accumulatedFirstMoment!=null&&Yt(this.accumulatedFirstMoment.map(t=>t.variable)),this.accumulatedWeightedInfNorm!=null&&Yt(this.accumulatedWeightedInfNorm.map(t=>t.variable))}async getWeights(){throw new Error("getWeights() is not implemented for Adamax yet.")}async setWeights(t){throw new Error("setWeights() is not implemented for Adamax yet.")}getConfig(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon,decay:this.decay}}static fromConfig(t,r){return new t(r.learningRate,r.beta1,r.beta2,r.epsilon,r.decay)}};var Qh=class extends pn{static get className(){return"SGD"}constructor(t){super(),this.learningRate=t,this.setLearningRate(t)}applyGradients(t){(Array.isArray(t)?t.map(o=>o.name):Object.keys(t)).forEach((o,n)=>{let a=Array.isArray(t)?t[n].tensor:t[o];if(a==null)return;let i=A.registeredVariables[o];He(()=>{let s=be(ce(this.c,a),i);i.assign(s)})}),this.incrementIterations()}setLearningRate(t){this.learningRate=t,this.c!=null&&this.c.dispose(),this.c=an($e(-t))}dispose(){this.c.dispose()}async getWeights(){return[await this.saveIterations()]}async setWeights(t){if(t=await this.extractIterations(t),t.length!==0)throw new Error("SGD optimizer does not have settable weights.")}getConfig(){return{learningRate:this.learningRate}}static fromConfig(t,r){return new t(r.learningRate)}};var ok=class extends Qh{static get className(){return"Momentum"}constructor(t,r,o=!1){super(t),this.learningRate=t,this.momentum=r,this.useNesterov=o,this.accumulations=[],this.m=$e(this.momentum)}applyGradients(t){(Array.isArray(t)?t.map(o=>o.name):Object.keys(t)).forEach((o,n)=>{let a=A.registeredVariables[o];this.accumulations[n]==null&&(this.accumulations[n]={originalName:`${o}/momentum`,variable:He(()=>Gr(a).variable(!1))});let i=this.accumulations[n].variable,s=Array.isArray(t)?t[n].tensor:t[o];s!=null&&He(()=>{let c,l=be(ce(this.m,i),s);this.useNesterov?c=be(ce(this.c,be(s,ce(l,this.m))),a):c=be(ce(this.c,l),a),i.assign(l),a.assign(c)})}),this.incrementIterations()}dispose(){this.m.dispose(),this.accumulations!=null&&Yt(this.accumulations.map(t=>t.variable))}setMomentum(t){this.momentum=t}async getWeights(){return[await this.saveIterations()].concat(this.accumulations.map(t=>({name:t.originalName,tensor:t.variable})))}async setWeights(t){t=await this.extractIterations(t);let r=!1;this.accumulations=t.map(o=>({originalName:o.name,variable:o.tensor.variable(r)}))}getConfig(){return{learningRate:this.learningRate,momentum:this.momentum,useNesterov:this.useNesterov}}static fromConfig(t,r){return new t(r.learningRate,r.momentum,r.useNesterov)}};var nk=class extends pn{static get className(){return"RMSProp"}constructor(t,r=.9,o=0,n=null,a=!1){if(super(),this.learningRate=t,this.decay=r,this.momentum=o,this.epsilon=n,this.accumulatedMeanSquares=[],this.accumulatedMoments=[],this.accumulatedMeanGrads=[],this.centered=a,n==null&&(this.epsilon=A.backend.epsilon()),t==null)throw new Error("learningRate for RMSPropOptimizer must be defined.")}applyGradients(t){(Array.isArray(t)?t.map(o=>o.name):Object.keys(t)).forEach((o,n)=>{let a=A.registeredVariables[o],i=!1;this.accumulatedMeanSquares[n]==null&&(this.accumulatedMeanSquares[n]={originalName:`${o}/rms`,variable:He(()=>Gr(a).variable(i))}),this.accumulatedMoments[n]==null&&(this.accumulatedMoments[n]={originalName:`${o}/momentum`,variable:He(()=>Gr(a).variable(i))}),this.accumulatedMeanGrads[n]==null&&this.centered&&(this.accumulatedMeanGrads[n]={originalName:`${o}/mg`,variable:He(()=>Gr(a).variable(i))});let s=Array.isArray(t)?t[n].tensor:t[o];if(s==null)return;let c=this.accumulatedMeanSquares[n].variable,l=this.accumulatedMoments[n].variable;He(()=>{let p=be(ce(c,this.decay),ce(lo(s),1-this.decay));if(this.centered){let u=this.accumulatedMeanGrads[n].variable,m=be(ce(u,this.decay),ce(s,1-this.decay)),f=je(ce(s,this.learningRate),sn(Fe(p,be(lo(m),this.epsilon)))),d=be(ce(l,this.momentum),f);c.assign(p),u.assign(m),l.assign(d);let h=Fe(a,d);a.assign(h)}else{let u=be(ce(c,this.decay),ce(lo(s),1-this.decay)),m=be(ce(l,this.momentum),je(ce(s,this.learningRate),sn(be(u,this.epsilon))));c.assign(u),l.assign(m);let f=Fe(a,m);a.assign(f)}})}),this.incrementIterations()}dispose(){this.accumulatedMeanSquares!=null&&Yt(this.accumulatedMeanSquares.map(t=>t.variable)),this.accumulatedMeanGrads!=null&&this.centered&&Yt(this.accumulatedMeanGrads.map(t=>t.variable)),this.accumulatedMoments!=null&&Yt(this.accumulatedMoments.map(t=>t.variable))}async getWeights(){let t=[...this.accumulatedMeanSquares,...this.accumulatedMoments];return this.centered&&t.push(...this.accumulatedMeanGrads),[await this.saveIterations()].concat(t.map(r=>({name:r.originalName,tensor:r.variable})))}async setWeights(t){t=await this.extractIterations(t);let r=this.centered?t.length/3:t.length/2,o=!1;this.accumulatedMeanSquares=t.slice(0,r).map(n=>({originalName:n.name,variable:n.tensor.variable(o)})),this.accumulatedMoments=t.slice(r,r*2).map(n=>({originalName:n.name,variable:n.tensor.variable(o)})),this.centered&&(this.accumulatedMeanGrads=t.slice(r*2,r*3).map(n=>({originalName:n.name,variable:n.tensor.variable(o)})))}getConfig(){return{learningRate:this.learningRate,decay:this.decay,momentum:this.momentum,epsilon:this.epsilon,centered:this.centered}}static fromConfig(t,r){return new t(r.learningRate,r.decay,r.momentum,r.epsilon,r.centered)}};var uye=[ZS,ek,tk,rk,ok,nk,Qh];function d7(){for(let e of uye)f7(e)}var Sb={};Ot(Sb,{CompositeArrayBuffer:()=>yo,browserFiles:()=>g7,browserHTTPRequest:()=>b7,concatenateArrayBuffers:()=>FL,copyModel:()=>qL,decodeWeights:()=>eS,encodeWeights:()=>AL,fromMemory:()=>x7,fromMemorySync:()=>cA,getLoadHandlers:()=>zL,getModelArtifactsForJSON:()=>Uh,getModelArtifactsForJSONSync:()=>M3,getModelArtifactsInfoForJSON:()=>Ri,getSaveHandlers:()=>PL,getWeightSpecs:()=>rS,http:()=>ik,isHTTPScheme:()=>ak,listModels:()=>jL,loadWeights:()=>y7,moveModel:()=>KL,registerLoadRouter:()=>OL,registerSaveRouter:()=>ML,removeModel:()=>GL,weightsLoaderFactory:()=>sA,withSaveHandler:()=>w7,withSaveHandlerSync:()=>S7});var mye="model",fye=".json",dye=".weights.bin";function h7(e){return new Promise(t=>setTimeout(t)).then(e)}var Jh=class e{constructor(t){if(!Ne().getBool("IS_BROWSER"))throw new Error("browserDownloads() cannot proceed because the current environment is not a browser.");t.startsWith(e.URL_SCHEME)&&(t=t.slice(e.URL_SCHEME.length)),(t==null||t.length===0)&&(t=mye),this.modelJsonFileName=t+fye,this.weightDataFileName=t+dye}async save(t){if(typeof document>"u")throw new Error("Browser downloads are not supported in this environment since `document` is not present");let r=yo.join(t.weightData),o=window.URL.createObjectURL(new Blob([r],{type:"application/octet-stream"}));if(t.modelTopology instanceof ArrayBuffer)throw new Error("BrowserDownloads.save() does not support saving model topology in binary formats yet.");{let n=[{paths:["./"+this.weightDataFileName],weights:t.weightSpecs}],a=tS(t,n),i=window.URL.createObjectURL(new Blob([JSON.stringify(a)],{type:"application/json"})),s=this.modelJsonAnchor==null?document.createElement("a"):this.modelJsonAnchor;if(s.download=this.modelJsonFileName,s.href=i,await h7(()=>s.dispatchEvent(new MouseEvent("click"))),t.weightData!=null){let c=this.weightDataAnchor==null?document.createElement("a"):this.weightDataAnchor;c.download=this.weightDataFileName,c.href=o,await h7(()=>c.dispatchEvent(new MouseEvent("click")))}return{modelArtifactsInfo:Ri(t)}}}};Jh.URL_SCHEME="downloads://";var nA=class{constructor(t){if(t==null||t.length<1)throw new Error(`When calling browserFiles, at least 1 file is required, but received ${t}`);this.jsonFile=t[0],this.weightsFiles=t.slice(1)}async load(){return new Promise((t,r)=>{let o=new FileReader;o.onload=n=>{let a=JSON.parse(n.target.result),i=a.modelTopology;if(i==null){r(new Error(`modelTopology field is missing from file ${this.jsonFile.name}`));return}if(a.weightsManifest==null){r(new Error(`weightManifest field is missing from file ${this.jsonFile.name}`));return}if(this.weightsFiles.length===0){t({modelTopology:i});return}let c=Uh(a,l=>this.loadWeights(l));t(c)},o.onerror=n=>r(`Failed to read model topology and weights manifest JSON from file '${this.jsonFile.name}'. BrowserFiles supports loading Keras-style tf.Model artifacts only.`),o.readAsText(this.jsonFile)})}loadWeights(t){let r=[],o=[];for(let i of t)r.push(...i.weights),o.push(...i.paths);let n=this.checkManifestAndWeightFiles(t),a=o.map(i=>this.loadWeightsFile(i,n[i]));return Promise.all(a).then(i=>[r,i])}loadWeightsFile(t,r){return new Promise((o,n)=>{let a=new FileReader;a.onload=i=>{let s=i.target.result;o(s)},a.onerror=i=>n(`Failed to weights data from file of path '${t}'.`),a.readAsArrayBuffer(r)})}checkManifestAndWeightFiles(t){let r=[],o=this.weightsFiles.map(a=>F3(a.name)),n={};for(let a of t)a.paths.forEach(i=>{let s=F3(i);if(r.indexOf(s)!==-1)throw new Error(`Duplicate file basename found in weights manifest: '${s}'`);if(r.push(s),o.indexOf(s)===-1)throw new Error(`Weight file with basename '${s}' is not provided.`);n[i]=this.weightsFiles[o.indexOf(s)]});if(r.length!==this.weightsFiles.length)throw new Error(`Mismatch in the number of files in weights manifest (${r.length}) and the number of weight files provided (${this.weightsFiles.length}).`);return n}},hye=e=>Ne().getBool("IS_BROWSER")&&!Array.isArray(e)&&e.startsWith(Jh.URL_SCHEME)?gye(e.slice(Jh.URL_SCHEME.length)):null;Jr.registerSaveRouter(hye);function gye(e="model"){return new Jh(e)}function g7(e){return new nA(e)}function aA(e,t,r,o){i(e),r=r??0,o=o??1,s(r,o);let n=0,a=c=>(c.then(l=>{let p=r+ ++n/e.length*(o-r);return t(p),l}),c);function i(c){D(c!=null&&Array.isArray(c)&&c.length>0,()=>"promises must be a none empty array")}function s(c,l){D(c>=0&&c<=1,()=>`Progress fraction must be in range [0, 1], but got startFraction ${c}`),D(l>=0&&l<=1,()=>`Progress fraction must be in range [0, 1], but got endFraction ${l}`),D(l>=c,()=>`startFraction must be no more than endFraction, but got startFraction ${c} and endFraction ${l}`)}return Promise.all(e.map(a))}async function iA(e,t){t==null&&(t={});let r=t.fetchFunc==null?Ne().platform.fetch:t.fetchFunc,o=e.map(u=>r(u,t.requestInit,{isBinary:!0})),s=(t.onProgress==null?await Promise.all(o):await aA(o,t.onProgress,0,.5)).map(u=>u.arrayBuffer());return t.onProgress==null?await Promise.all(s):await aA(s,t.onProgress,.5,1)}async function y7(e,t="",r,o){return sA(i=>iA(i,{requestInit:o}))(e,t,r)}function sA(e){return async(t,r="",o)=>{let n=t.map(()=>!1),a={},i=o!=null?o.map(()=>!1):[],s=[];if(t.forEach((f,d)=>{let h=0;f.weights.forEach(y=>{let g="quantization"in y?y.quantization.dtype:y.dtype,b=pb[g]*mt(y.shape),x=()=>{n[d]=!0,a[d]==null&&(a[d]=[]),a[d].push({manifestEntry:y,groupOffset:h,sizeBytes:b})};o!=null?o.forEach((w,I)=>{w===y.name&&(x(),i[I]=!0)}):x(),s.push(y.name),h+=b})}),!i.every(f=>f)){let f=o.filter((d,h)=>!i[h]);throw new Error(`Could not find weights in manifest with names: ${f.join(", ")}.
106
+ Manifest JSON has weights with names: ${s.join(", ")}.`)}let c=n.reduce((f,d,h)=>(d&&f.push(h),f),[]),l=[];c.forEach(f=>{t[f].paths.forEach(d=>{let h=r+(r.endsWith("/")?"":"/")+d;l.push(h)})});let p=await e(l),u={},m=0;return c.forEach(f=>{let d=t[f].paths.length,h=new yo(p.slice(m,m+d));a[f].forEach(g=>{let b=h.slice(g.groupOffset,g.groupOffset+g.sizeBytes),x=eS(b,[g.manifestEntry]);for(let w in x)u[w]=x[w]}),m+=d}),u}}var yye="application/octet-stream",vye="application/json",xb=class{constructor(t,r){if(this.DEFAULT_METHOD="POST",r==null&&(r={}),this.weightPathPrefix=r.weightPathPrefix,this.onProgress=r.onProgress,this.weightUrlConverter=r.weightUrlConverter,r.fetchFunc!=null?(D(typeof r.fetchFunc=="function",()=>"Must pass a function that matches the signature of `fetch` (see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)"),this.fetch=r.fetchFunc):this.fetch=Ne().platform.fetch,D(t!=null&&t.length>0,()=>"URL path for http must not be null, undefined or empty."),Array.isArray(t)&&D(t.length===2,()=>`URL paths for http must have a length of 2, (actual length is ${t.length}).`),this.path=t,r.requestInit!=null&&r.requestInit.body!=null)throw new Error("requestInit is expected to have no pre-existing body, but has one.");this.requestInit=r.requestInit||{}}async save(t){if(t.modelTopology instanceof ArrayBuffer)throw new Error("BrowserHTTPRequest.save() does not support saving model topology in binary formats yet.");let r=Object.assign({method:this.DEFAULT_METHOD},this.requestInit);r.body=new FormData;let o=[{paths:["./model.weights.bin"],weights:t.weightSpecs}],n=tS(t,o);if(r.body.append("model.json",new Blob([JSON.stringify(n)],{type:vye}),"model.json"),t.weightData!=null){let i=yo.join(t.weightData);r.body.append("model.weights.bin",new Blob([i],{type:yye}),"model.weights.bin")}let a=await this.fetch(this.path,r);if(a.ok)return{modelArtifactsInfo:Ri(t),responses:[a]};throw new Error(`BrowserHTTPRequest.save() failed due to HTTP response status ${a.status}.`)}async load(){let t=await this.fetch(this.path,this.requestInit);if(!t.ok)throw new Error(`Request to ${this.path} failed with status code ${t.status}. Please verify this URL points to the model JSON of the model to load.`);let r;try{r=await t.json()}catch{let i=`Failed to parse model JSON of response from ${this.path}.`;throw this.path.endsWith(".pb")?i+=" Your path contains a .pb file extension. Support for .pb models have been removed in TensorFlow.js 1.0 in favor of .json models. You can re-convert your Python TensorFlow model using the TensorFlow.js 1.0 conversion scripts or you can convert your.pb models with the 'pb2json'NPM script in the tensorflow/tfjs-converter repository.":i+=" Please make sure the server is serving valid JSON for this request.",new Error(i)}let o=r.modelTopology,n=r.weightsManifest;if(o==null&&n==null)throw new Error(`The JSON from HTTP path ${this.path} contains neither model topology or manifest for weights.`);return Uh(r,a=>this.loadWeights(a))}async loadWeights(t){let r=Array.isArray(this.path)?this.path[1]:this.path,[o,n]=bye(r),a=this.weightPathPrefix||o,i=rS(t),s=[],c=[];for(let p of t)for(let u of p.paths)this.weightUrlConverter!=null?c.push(this.weightUrlConverter(u)):s.push(a+u+n);this.weightUrlConverter&&s.push(...await Promise.all(c));let l=await iA(s,{requestInit:this.requestInit,fetchFunc:this.fetch,onProgress:this.onProgress});return[i,l]}};xb.URL_SCHEME_REGEX=/^https?:\/\//;function bye(e){let t=e.lastIndexOf("/"),r=e.lastIndexOf("?"),o=e.substring(0,t),n=r>t?e.substring(r):"";return[o+"/",n]}function ak(e){return e.match(xb.URL_SCHEME_REGEX)!=null}var v7=(e,t)=>{if(typeof fetch>"u"&&(t==null||t.fetchFunc==null))return null;{let r=!0;if(Array.isArray(e)?r=e.every(o=>ak(o)):r=ak(e),r)return ik(e,t)}return null};Jr.registerSaveRouter(v7);Jr.registerLoadRouter(v7);function ik(e,t){return new xb(e,t)}function b7(e,t){return ik(e,t)}var wb=class{constructor(t){this.modelArtifacts=t}load(){return this.modelArtifacts}},sk=class{constructor(t){this.saveHandler=t}save(t){return this.saveHandler(t)}},lA=class{constructor(t){t.load&&(this.load=()=>Promise.resolve(t.load())),t.save&&(this.save=r=>Promise.resolve(t.save(r)))}};function x7(e,t,r,o){let n=arguments;return new lA(cA(...n))}function cA(e,t,r,o){return arguments.length===1?e.modelTopology!=null||e.weightSpecs!=null?new wb(e):(console.warn("Please call tf.io.fromMemory() with only one argument. The argument should be of type ModelArtifacts. The multi-argument signature of tf.io.fromMemory() has been deprecated and will be removed in a future release."),new wb({modelTopology:e})):(console.warn("Please call tf.io.fromMemory() with only one argument. The argument should be of type ModelArtifacts. The multi-argument signature of tf.io.fromMemory() has been deprecated and will be removed in a future release."),new wb({modelTopology:e,weightSpecs:t,weightData:r,trainingConfig:o}))}function w7(e){return new sk(e)}function S7(e){return new sk(e)}var kb={};Ot(kb,{draw:()=>Tye,fromPixels:()=>Cye,fromPixelsAsync:()=>_ye,toPixels:()=>Iye});var Om,k7=!1;function _7(e,t=3){if(t>4)throw new Error("Cannot construct Tensor with more than 4 channels from pixels.");if(e==null)throw new Error("pixels passed to tf.browser.fromPixels() can not be null");let r=!1,o=!1,n=!1,a=!1,i=!1,s=!1;if(e.data instanceof Uint8Array)r=!0;else if(typeof ImageData<"u"&&e instanceof ImageData)o=!0;else if(typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement)n=!0;else if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement)a=!0;else if(e.getContext!=null)i=!0;else if(typeof ImageBitmap<"u"&&e instanceof ImageBitmap)s=!0;else throw new Error(`pixels passed to tf.browser.fromPixels() must be either an HTMLVideoElement, HTMLImageElement, HTMLCanvasElement, ImageData in browser, or OffscreenCanvas, ImageData in webworker or {data: Uint32Array, width: number, height: number}, but was ${e.constructor.name}`);if(Mh(h3,A.backendName)!=null){let d={pixels:e},h={numChannels:t};return A.runKernel(h3,d,h)}let[l,p]=n?[e.videoWidth,e.videoHeight]:[e.width,e.height],u;if(i)u=e.getContext("2d").getImageData(0,0,l,p).data;else if(o||r)u=e.data;else if(a||n||s){if(Om==null)if(typeof document>"u")if(typeof OffscreenCanvas<"u"&&typeof OffscreenCanvasRenderingContext2D<"u")Om=new OffscreenCanvas(1,1).getContext("2d");else throw new Error("Cannot parse input in current context. Reason: OffscreenCanvas Context2D rendering is not supported.");else Om=document.createElement("canvas").getContext("2d",{willReadFrequently:!0});Om.canvas.width=l,Om.canvas.height=p,Om.drawImage(e,0,0,l,p),u=Om.getImageData(0,0,l,p).data}let m;if(t===4)m=new Int32Array(u);else{let d=l*p;m=new Int32Array(d*t);for(let h=0;h<d;h++)for(let y=0;y<t;++y)m[h*t+y]=u[h*4+y]}return HS(m,[p,l,t],"int32")}function xye(e){return e!=null&&e.data instanceof Uint8Array}function wye(){return typeof window<"u"&&typeof ImageBitmap<"u"&&window.hasOwnProperty("createImageBitmap")}function Sye(e){return e!=null&&e.width!==0&&e.height!==0}function kye(e){return wye()&&!(e instanceof ImageBitmap)&&Sye(e)&&!xye(e)}async function _ye(e,t=3){let r=null;if(Ne().getBool("WRAP_TO_IMAGEBITMAP")&&kye(e)){let o;try{o=await createImageBitmap(e,{premultiplyAlpha:"none"})}catch{o=null}o!=null&&o.width===e.width&&o.height===e.height?r=o:r=e}else r=e;return _7(r,t)}function E7(e){if(e.rank!==2&&e.rank!==3)throw new Error(`toPixels only supports rank 2 or 3 tensors, got rank ${e.rank}.`);let t=e.rank===2?1:e.shape[2];if(t>4||t===2)throw new Error(`toPixels only supports depth of size 1, 3 or 4 but got ${t}`);if(e.dtype!=="float32"&&e.dtype!=="int32")throw new Error(`Unsupported type for toPixels: ${e.dtype}. Please use float32 or int32 tensors.`)}function Eye(e){let t=e?.alpha||1;if(t>1||t<0)throw new Error(`Alpha value ${t} is suppoed to be in range [0 - 1].`)}async function Iye(e,t){let r=_(e,"img","toPixels");if(!(e instanceof $t)){let l=r;r=pt(l,"int32"),l.dispose()}E7(r);let[o,n]=r.shape.slice(0,2),a=r.rank===2?1:r.shape[2],i=await r.data(),s=r.dtype==="float32"?255:1,c=new Uint8ClampedArray(n*o*4);for(let l=0;l<o*n;++l){let p=[0,0,0,255];for(let m=0;m<a;m++){let f=i[l*a+m];if(r.dtype==="float32"){if(f<0||f>1)throw new Error(`Tensor values for a float32 Tensor must be in the range [0 - 1] but encountered ${f}.`)}else if(r.dtype==="int32"&&(f<0||f>255))throw new Error(`Tensor values for a int32 Tensor must be in the range [0 - 255] but encountered ${f}.`);a===1?(p[0]=f*s,p[1]=f*s,p[2]=f*s):p[m]=f*s}let u=l*4;c[u+0]=Math.round(p[0]),c[u+1]=Math.round(p[1]),c[u+2]=Math.round(p[2]),c[u+3]=Math.round(p[3])}if(t!=null){k7||Mh(Zv,A.backendName)!=null&&(console.warn("tf.browser.toPixels is not efficient to draw tensor on canvas. Please try tf.browser.draw instead."),k7=!0),t.width=n,t.height=o;let l=t.getContext("2d"),p=new ImageData(c,n,o);l.putImageData(p,0,0)}return r!==e&&r.dispose(),c}function Tye(e,t,r){let o=_(e,"img","draw");if(!(e instanceof $t)){let i=o;o=pt(i,"int32"),i.dispose()}E7(o),Eye(r?.imageOptions);let n={image:o},a={canvas:t,options:r};A.runKernel(Zv,n,a)}var Cye=T({fromPixels_:_7});var lk={};Ot(lk,{prepareAndValidate:()=>I7});function I7(e,t){let r=e.shape.length,o=t.shape.length;if(r<1)throw new Error(`tf.gatherND() expects the input to be rank 1 or higher, but the rank was ${r}.`);if(o<1)throw new Error(`tf.gatherND() expects the indices to be rank 1 or higher, but the rank was ${o}.`);if(t.dtype!=="int32")throw new Error(`tf.gatherND() expects the indices to be int32 type, but the dtype was ${t.dtype}.`);if(t.shape[o-1]>r)throw new Error(`index innermost dimension length must be <= tensor rank; saw: ${t.shape[o-1]} vs. ${r}`);if(mt(e.shape)===0)throw new Error(`Requested more than 0 entries, but input is empty. Input shape: ${e.shape}.`);let n=t.shape,a=n[n.length-1],i=1;for(let u=0;u<n.length-1;++u)i*=n[u];let s=e.shape,c=n.slice();c.pop();let l=1;for(let u=a;u<r;++u)l*=s[u],c.push(s[u]);let p=[...Ai(e.shape).map(u=>u/l),1].slice(0,a);return[c,i,l,p]}var co={};Ot(co,{assertParamsValid:()=>Aye,computeFlatOffset:()=>Oye,computeOutShape:()=>Dye,getNormalizedAxes:()=>Fye,isSliceContinous:()=>Mye,maskToAxes:()=>Rye,parseSliceParams:()=>Pye,sliceInfo:()=>zye,startForAxis:()=>M7,startIndicesWithElidedDims:()=>R7,stopForAxis:()=>O7,stopIndicesWithElidedDims:()=>D7,stridesForAxis:()=>F7,stridesWithElidedDims:()=>C7});var pA=-2,Nye=-1;function Aye(e,t,r){let o=e.shape.length;D(o===t.length,()=>`Error in slice${o}D: Length of begin ${t} must match the rank of the array (${o}).`),D(o===r.length,()=>`Error in slice${o}D: Length of size ${r} must match the rank of the array (${o}).`);for(let n=0;n<o;++n)D(t[n]+r[n]<=e.shape[n],()=>`Error in slice${o}D: begin[${n}] + size[${n}] (${t[n]+r[n]}) would overflow input.shape[${n}] (${e.shape[n]})`)}function Rye(e){let t=[],r=0;for(;e>0;)e&1&&t.push(r),e/=2,r++;return t}function Dye(e,t,r){let o=[];for(let n=0;n<e.length;n++)o[n]=Math.ceil((t[n]-e[n])/r[n]);return o}function C7(e,t,r,o){let n=[...e];for(let a=n.length;a<o.length;a++)n.push(1);for(let a=0;a<r;a++)a===0?n[t]=1:(n.splice(t,0,1),n.pop());return n}function N7(e,t,r){return r<=e?r:r-(t-1)}function A7(e,t){let r=[];for(let o=0;o<e;o++)r.push(t+o);return r}function Fye(e,t,r,o,n,a,i,s,c){let l=e.length,p=new Array(l),u=new Array(l),m=new Array(l);if(t.length&&r>0){let f=t[0],d=r+1;p=R7(i,f,d,o,e),u=D7(s,f,d,n,e),m=C7(a,f,d,e)}else for(let f=0;f<l;f++)p[f]=M7(i,o,a,e,f,c),u[f]=O7(s,n,a,e,f,c),m[f]=F7(a,f,c);return{begin:p,end:u,strides:m}}function R7(e,t,r,o,n){let a=[...n],i=A7(r,t);for(let s=0;s<a.length;s++)if(i.indexOf(s)>-1)a[s]=0;else{let c=N7(t,r,s),l=o[c];e&1<<c&&(l=0),a[s]=l}return a}function D7(e,t,r,o,n){let a=[...n],i=A7(r,t);for(let s=0;s<a.length;s++)if(i.indexOf(s)>-1)a[s]=Number.MAX_SAFE_INTEGER;else{let c=N7(t,r,s),l=o[c];e&1<<c&&(l=Number.MAX_SAFE_INTEGER),a[s]=l}for(let s=0;s<a.length;s++){let c=n[s];a[s]<0&&(a[s]+=c),a[s]=Kd(0,a[s],n[s])}return a}function F7(e,t,r){let o=e[t];return(r&1<<t||o==null)&&(o=1),o}function M7(e,t,r,o,n,a){let i=t[n],s=r[n]||1;(e&1<<n||a&1<<n||i==null)&&(s>0?i=Number.MIN_SAFE_INTEGER:i=Number.MAX_SAFE_INTEGER);let c=o[n];return i<0&&(i+=c),i=Kd(0,i,c-1),i}function O7(e,t,r,o,n,a){let i=t[n],s=r[n]||1;(e&1<<n||a&1<<n||i==null)&&(s>0?i=Number.MAX_SAFE_INTEGER:i=Number.MIN_SAFE_INTEGER);let c=o[n];return i<0&&(i+=c),s>0?i=Kd(0,i,c):i=Kd(-1,i,c-1),i}function Mye(e,t,r){let o=r.length;for(let n=0;n<r.length;n++)if(r[n]>1){o=n;break}for(let n=o+1;n<r.length;n++)if(t[n]>0||r[n]!==e[n])return!1;return!0}function Oye(e,t){let r=e.length>0?e[e.length-1]:1;for(let o=0;o<e.length-1;o++)r+=e[o]*t[o];return r}function Pye(e,t,r){let o,n=e.shape.length;typeof t=="number"?o=[t,...new Array(n-1).fill(0)]:t.length<n?o=t.concat(new Array(n-t.length).fill(0)):o=t.slice(),o.forEach(i=>{D(i!==-1,()=>"slice() does not support negative begin indexing.")});let a;return r==null?a=new Array(n).fill(-1):typeof r=="number"?a=[r,...new Array(n-1).fill(-1)]:r.length<n?a=r.concat(new Array(n-r.length).fill(-1)):a=r,a=a.map((i,s)=>i>=0?i:(D(i===-1,()=>`Negative size values should be exactly -1 but got ${i} for the slice() size at index ${s}.`),e.shape[s]-o[s])),[o,a]}function zye(e,t,r,o,n,a,i,s,c){let l;if(o==null?(l=new Array(t.length),l.fill(1)):l=o,i!=null&&i&i-1)throw new Error("Multiple ellipses in slice is not allowed.");let p=!1,u={dims:l.length,numAddAxisAfterEllipsis:0,begin:t.slice(),end:r.slice(),strides:l.slice(),beginMask:n,endMask:a,ellipsisMask:i,newAxisMask:s,shrinkAxisMask:c};for(let x=0;x<u.dims;x++)p&&1<<x&s&&u.numAddAxisAfterEllipsis++,1<<x&i&&(p=!0);p||(u.ellipsisMask|=1<<u.dims,u.dims++);let m={dims:e.length,beginMask:0,endMask:0,beginValid:!1,endValid:!1};$ye(u,m);let f=!0,d=!0,h=!0,y=[],g=[];for(let x=0;x<e.length;++x){if(m.strides[x]===0)throw Error(`strides[${x}] must be non-zero`);let w=!!(m.shrinkAxisMask&1<<x),I=e[x];if(I===-1){y.push(w?1:-1);continue}let C=[m.beginMask&1<<x,m.endMask&1<<x],R=[m.strides[x]>0?0:-1,m.strides[x]>0?I:I-1];if(w&&m.strides[x]<=0)throw Error("only stride 1 allowed on non-range indexing.");h=h&&m.strides[x]===1;let P=!!(m.beginMask&1<<x&&m.endMask&1<<x);if(m.beginValid&&m.endValid){if(w){let V=m.begin[x]<0?I+m.begin[x]:m.begin[x];if(m.begin[x]=V,m.end[x]=m.begin[x]+1,V<0||V>=I)throw Error(`slice index ${m.begin[x]} of dimension ${x} out of bounds.`)}else m.begin[x]=T7(m.begin[x],0,m.strides[x],I,C,R),m.end[x]=T7(m.end[x],1,m.strides[x],I,C,R);let B=m.strides[x]===1&&m.begin[x]===0&&m.end[x]===I;f=f&&B,d=d&&(x===0&&m.strides[x]===1||B)}else f=f&&m.strides[x]===1&&P,d=d&&(x===0&&m.strides[x]===1||P);let z,$=!1;if(m.beginValid&&m.endValid?(z=m.end[x]-m.begin[x],$=!0):w?(z=1,$=!0):P&&I>=0&&(m.strides[x]<0?z=-I:z=I,$=!0),$){let B;z===0||z<0!=m.strides[x]<0?B=0:B=Math.trunc(z/m.strides[x])+(z%m.strides[x]!==0?1:0),y.push(B)}else y.push(-1)}for(let x=0;x<m.finalShapeGatherIndices.length;++x){let w=m.finalShapeGatherIndices[x];w>=0?g.push(y[w]):w===pA&&g.push(1)}return{finalShapeSparse:g.filter((x,w)=>m.finalShapeGatherIndices[w]!==pA),finalShape:g,isIdentity:f,sliceDim0:d,isSimpleSlice:h,begin:m.begin,end:m.end,strides:m.strides}}function $ye(e,t){t.beginMask=0,t.endMask=0,t.shrinkAxisMask=0;let r=0;t.beginValid=e.begin!=null,t.endValid=e.end!=null,t.begin=new Array(t.dims),t.end=new Array(t.dims),t.strides=new Array(t.dims),t.finalShapeGatherIndices=[],t.finalShapeGatherIndicesSparse=[],t.inputShapeGatherIndicesSparse=new Array(t.dims);for(let o=0;o<e.dims;o++)if(1<<o&e.ellipsisMask){let n=Math.min(t.dims-(e.dims-o)+1+e.numAddAxisAfterEllipsis,t.dims);for(;r<n;r++)t.begin[r]=0,t.end[r]=0,t.strides[r]=1,t.beginMask|=1<<r,t.endMask|=1<<r,t.finalShapeGatherIndices.push(r),t.finalShapeGatherIndicesSparse.push(-1),t.inputShapeGatherIndicesSparse[r]=o}else if(1<<o&e.newAxisMask)t.finalShapeGatherIndices.push(pA),t.finalShapeGatherIndicesSparse.push(-1);else{if(r===t.begin.length)throw Error(`Index out of range using input dim ${r}; input has only ${t.dims} dims, ${t.begin.length}.`);e.begin!=null&&(t.begin[r]=e.begin[o]),e.end!=null&&(t.end[r]=e.end[o]),t.strides[r]=e.strides[o],e.beginMask&1<<o&&(t.beginMask|=1<<r),e.endMask&1<<o&&(t.endMask|=1<<r),e.shrinkAxisMask&1<<o?(t.finalShapeGatherIndices.push(Nye),t.finalShapeGatherIndicesSparse.push(-1),t.shrinkAxisMask|=1<<r):(t.finalShapeGatherIndices.push(r),t.finalShapeGatherIndicesSparse.push(o)),t.inputShapeGatherIndicesSparse[r]=o,r++}}function T7(e,t,r,o,n,a){if(n[t])return r>0?a[t]:a[t+1&1];{let i=e<0?o+e:e;return i<a[0]?a[0]:i>a[1]?a[1]:i}}var M={};Ot(M,{ERF_A1:()=>tve,ERF_A2:()=>rve,ERF_A3:()=>ove,ERF_A4:()=>nve,ERF_A5:()=>ave,ERF_P:()=>eve,PARALLELIZE_THRESHOLD:()=>ck,RowPartitionType:()=>Ui,SELU_SCALE:()=>Zye,SELU_SCALEALPHA:()=>Jye,applyActivation:()=>Fm,assertAndGetBroadcastShape:()=>Ct,assertAxesAreInnerMostDims:()=>Ife,assertParamsConsistent:()=>Lye,assignToTypedArray:()=>uve,axesAreInnerMostDims:()=>j3,calculateShapes:()=>m9,checkEinsumDimSizes:()=>yve,checkPadOnDimRoundingMode:()=>Rr,combineLocations:()=>VB,combineRaggedTensorToTensorShapes:()=>Uye,complexWithEvenIndex:()=>lve,complexWithOddIndex:()=>cve,computeConv2DInfo:()=>Sm,computeConv3DInfo:()=>uB,computeDefaultPad:()=>V3,computeDilation2DInfo:()=>_me,computeOptimalWindowSize:()=>jye,computeOutAndReduceShapes:()=>Efe,computeOutShape:()=>Bye,computePool2DInfo:()=>H3,computePool3DInfo:()=>Eme,convertConv2DDataFormat:()=>mB,decodeEinsumEquation:()=>hve,eitherStridesOrDilationsAreOne:()=>No,expandShapeToKeepDim:()=>Ds,exponent:()=>fve,exponents:()=>mve,fromStringArrayToUint8:()=>$ve,fromUint8ToStringArray:()=>zve,getAxesPermutation:()=>Tfe,getBroadcastDims:()=>LB,getComplexWithIndex:()=>pve,getEinsumComputePath:()=>vve,getEinsumPermutation:()=>gve,getFusedBiasGradient:()=>Dm,getFusedDyActivation:()=>Rm,getImageCenter:()=>Gye,getInnerMostAxes:()=>Nfe,getPermuted:()=>Kye,getRaggedRank:()=>Hye,getReductionAxes:()=>dS,getReshaped:()=>qye,getReshapedPermuted:()=>Xye,getRowPartitionTypesHelper:()=>Wye,getSliceBeginCoords:()=>Yye,getSliceSize:()=>Qye,getSparseFillEmptyRowsIndicesDenseShapeMismatch:()=>Sve,getSparseFillEmptyRowsNegativeIndexErrorMessage:()=>kve,getSparseFillEmptyRowsOutOfRangeIndexErrorMessage:()=>_ve,getSparseReshapeEmptyTensorZeroOutputDimErrorMessage:()=>Tve,getSparseReshapeInputOutputMismatchErrorMessage:()=>Nve,getSparseReshapeInputOutputMultipleErrorMessage:()=>Cve,getSparseReshapeMultipleNegativeOneOutputDimErrorMessage:()=>Eve,getSparseReshapeNegativeOutputDimErrorMessage:()=>Ive,getSparseSegmentReductionIndicesOutOfRangeErrorMessage:()=>Fve,getSparseSegmentReductionNegativeSegmentIdsErrorMessage:()=>Ave,getSparseSegmentReductionNonIncreasingSegmentIdsErrorMessage:()=>Rve,getSparseSegmentReductionSegmentIdOutOfRangeErrorMessage:()=>Dve,getUndoAxesPermutation:()=>Cfe,isIdentityPermutation:()=>bve,log:()=>wue,mergeRealAndImagArrays:()=>ive,prepareAndValidate:()=>I7,prepareSplitSize:()=>wve,segment_util:()=>mA,shouldFuse:()=>Mm,slice_util:()=>co,splitRealAndImagArrays:()=>sve,stridesOrDilationsArePositive:()=>Mi,tupleValuesAreOne:()=>wm,upcastType:()=>Xn,validateDefaultValueShape:()=>Vye,validateInput:()=>Yh,validateUpdateShape:()=>Z3,warn:()=>Ns});function Lye(e,t){let r=e[0].length;e.forEach((n,a)=>{D(n.length===r,()=>`Error in concat${r}D: rank of tensors[${a}] must be the same as the rank of the rest (${r})`)}),D(t>=0&&t<r,()=>`Error in concat${r}D: axis must be between 0 and ${r-1}.`);let o=e[0];e.forEach((n,a)=>{for(let i=0;i<r;i++)D(i===t||n[i]===o[i],()=>`Error in concat${r}D: Shape of tensors[${a}] (${n}) does not match the shape of the rest (${o}) along the non-concatenated axis ${a}.`)})}function Bye(e,t){let r=e[0].slice();for(let o=1;o<e.length;o++)r[t]+=e[o][t];return r}var Ui;(function(e){e[e.FIRST_DIM_SIZE=0]="FIRST_DIM_SIZE",e[e.VALUE_ROWIDS=1]="VALUE_ROWIDS",e[e.ROW_LENGTHS=2]="ROW_LENGTHS",e[e.ROW_SPLITS=3]="ROW_SPLITS",e[e.ROW_LIMITS=4]="ROW_LIMITS",e[e.ROW_STARTS=5]="ROW_STARTS"})(Ui||(Ui={}));function Uye(e,t,r){let o=new Array;if(r==null&&t==null)return o;if(t==null)for(;o.length<e+r.length;)o.push(-1);else o=t.slice();if(r==null)return o;if(e+r.length!==o.length)throw new Error(`rt input.shape and shape=${t} are incompatible: rt input.rank = ${e+r.length}, but shape.rank = ${o.length}`);for(let n=1;n<r.length;++n){let a=r[n],i=o[o.length-r.length+n],s=o[i];if(a>=0)if(s>=0){if(s!==a)throw new Error(`rt input.shape and shape=${t} are incompatible: rt input.shape[${n+e}] = ${a} but shape[${n+e}] = ${s}`)}else o[i]=a}return o}function Wye(e){let t={FIRST_DIM_SIZE:Ui.FIRST_DIM_SIZE,VALUE_ROWIDS:Ui.VALUE_ROWIDS,ROW_LENGTHS:Ui.ROW_LENGTHS,ROW_SPLITS:Ui.ROW_SPLITS,ROW_LIMITS:Ui.ROW_LIMITS,ROW_STARTS:Ui.ROW_STARTS},r=[];for(let o of e)if(o in t)r.push(t[o]);else break;return r}function Hye(e){return e.length===0?0:e[0]===Ui.FIRST_DIM_SIZE?e.length-1:e.length}function Vye(e,t){if(e==null||t==null)return;let r=e.length,o=t.length;if(r>=o)throw new Error(`defaultValue.shape=${e} and ragged tensor flatValues.shape=${t}, are incompatible: defaultValue.rank = ${r} must be less than ragged tensor input flatValues.rank = ${o})`);for(let n=0;n<Math.min(r,o-1);++n){let a=e[n],i=t[n+1];if(a>=0&&i>=0&&a!==1&&a!==i)throw new Error(`defaultValue.shape=${e}, and ragged tensor input flatValues.shape=${t} are incompatible: defaultValue.shape[${n-e.length}] = ${a} but ragged tensor input.flatValues.shape[${n-e.length}] = ${i}`)}}var ck=30;function jye(e){return e<=ck?e:Jd(e,Math.floor(Math.sqrt(e)))}function Gye(e,t,r){let o=r*(typeof e=="number"?e:e[0]),n=t*(typeof e=="number"?e:e[1]);return[o,n]}function qye(e,t,r,o=!0){let n=[];if(o)n=n.concat(t.slice(0)),n.push(e[0]/r),n=n.concat(e.slice(1));else{n=n.concat(e[0]);let a=t.length;for(let i=0;i<a;++i)n=n.concat([e[i+1]/t[i],t[i]]);n=n.concat(e.slice(a+1))}return n}function Kye(e,t,r=!0){let o=[];if(r){o.push(t);for(let n=t+1;n<e;++n)n<=2*t?(o.push(n),o.push(n-(t+1))):o.push(n)}else{let n=[],a=[];for(let i=1;i<e;++i)i>=t*2+1||i%2===1?a.push(i):n.push(i);o.push(...n),o.push(0),o.push(...a)}return o}function Xye(e,t,r,o=!0){let n=[];o?n.push(e[0]/r):n.push(e[0]*r);for(let a=1;a<e.length;++a)a<=t.length?o?n.push(t[a-1]*e[a]):n.push(e[a]/t[a-1]):n.push(e[a]);return n}function Yye(e,t){let r=[0];for(let o=0;o<t;++o)r.push(e[o][0]);return r}function Qye(e,t,r){let o=e.slice(0,1);for(let n=0;n<r;++n)o.push(e[n+1]-t[n][0]-t[n][1]);return o}var Jye=1.7580993408473768,Zye=1.0507009873554805;var eve=.3275911,tve=.254829592,rve=-.284496736,ove=1.421413741,nve=-1.453152027,ave=1.061405429;function ive(e,t){if(e.length!==t.length)throw new Error(`Cannot merge real and imag arrays of different lengths. real:${e.length}, imag: ${t.length}.`);let r=new Float32Array(e.length*2);for(let o=0;o<r.length;o+=2)r[o]=e[o/2],r[o+1]=t[o/2];return r}function sve(e){let t=new Float32Array(e.length/2),r=new Float32Array(e.length/2);for(let o=0;o<e.length;o+=2)t[o/2]=e[o],r[o/2]=e[o+1];return{real:t,imag:r}}function lve(e){let t=Math.ceil(e.length/4),r=new Float32Array(t),o=new Float32Array(t);for(let n=0;n<e.length;n+=4)r[Math.floor(n/4)]=e[n],o[Math.floor(n/4)]=e[n+1];return{real:r,imag:o}}function cve(e){let t=Math.floor(e.length/4),r=new Float32Array(t),o=new Float32Array(t);for(let n=2;n<e.length;n+=4)r[Math.floor(n/4)]=e[n],o[Math.floor(n/4)]=e[n+1];return{real:r,imag:o}}function pve(e,t){let r=e[t*2],o=e[t*2+1];return{real:r,imag:o}}function uve(e,t,r,o){e[o*2]=t,e[o*2+1]=r}function mve(e,t){let r=new Float32Array(e/2),o=new Float32Array(e/2);for(let n=0;n<Math.ceil(e/2);n++){let a=(t?2:-2)*Math.PI*(n/e);r[n]=Math.cos(a),o[n]=Math.sin(a)}return{real:r,imag:o}}function fve(e,t,r){let o=(r?2:-2)*Math.PI*(e/t),n=Math.cos(o),a=Math.sin(o);return{real:n,imag:a}}var uA="->",dve=/->/g,P7=",",z7="...";function hve(e,t){e=e.replace(/\s/g,"");let r=(e.length-e.replace(dve,"").length)/uA.length;if(r<1)throw new Error("Equations without an arrow are not supported.");if(r>1)throw new Error(`Equation must contain exactly one arrow ("${uA}").`);let[o,n]=e.split(uA);D(o.indexOf(z7)===-1,()=>`The ellipsis notation ("${z7}") is not supported yet.`);let a=o.split(P7),i=a.length;if(t!==i)throw new Error(`Expected ${i} input tensors, received ${t}`);if(i>2)throw new Error("Support for more than 2 input tensors is not implemented yet.");let s=[];for(let m=0;m<n.length;++m){let f=n[m];if(!a.some(d=>d.indexOf(f)!==-1))throw new Error(`Output subscripts contain the label ${f} not present in the input subscripts.`);s.indexOf(f)===-1&&s.push(f)}for(let m=0;m<o.length;++m){let f=o[m];s.indexOf(f)===-1&&f!==P7&&s.push(f)}let c=new Array(a.length);for(let m=0;m<i;++m){if(new Set(a[m].split("")).size!==a[m].length)throw new Error(`Found duplicate axes in input component ${a[m]}. Support for duplicate axes in input is not implemented yet.`);c[m]=[];for(let f=0;f<a[m].length;++f)c[m].push(s.indexOf(a[m][f]))}let l=s.length,p=n.length,u=[];for(let m=p;m<l;++m)u.push(m);return{allDims:s,summedDims:u,idDims:c}}function gve(e,t){let r=new Array(e);r.fill(-1);for(let n=0;n<t.length;++n)r[t[n]]=n;let o=[];for(let n=0;n<e;++n)r[n]===-1&&o.push(n);return r=r.filter(n=>n!==-1),{permutationIndices:r,expandDims:o}}function yve(e,t,r){let o=new Array(e);for(let n=0;n<r.length;++n){let a=r[n].shape;for(let i=0;i<t[n].length;++i)o[t[n][i]]===void 0?o[t[n][i]]=a[i]:D(o[t[n][i]]===a[i],()=>`Expected dimension ${o[t[n][i]]} at axis ${i} of input shaped ${JSON.stringify(a)}, but got dimension ${a[i]}`)}}function vve(e,t){let r=e,o=[],n=0;e.length===0&&r.push(-1),n=e.length+1;for(let i=0;i<n;++i)o.push([]);let a=[];for(let i=0;i<r.length;++i){let s=r[i],c=xve(t,s);for(let l of c)a.indexOf(l)===-1&&(o[i].push(l),a.push(l))}return{path:r,steps:o}}function bve(e){return e.every((t,r)=>t===r)}function xve(e,t){let r=[];for(let o=0;o<e.length;++o)(e[o].length===0||e[o].indexOf(t)!==-1||t===-1)&&r.push(o);return r}function wve(e,t,r=0){let o=[];if(typeof t=="number")D(e.shape[r]%t===0,()=>"Number of splits must evenly divide the axis."),o=new Array(t).fill(e.shape[r]/t);else{let n=t.reduce((i,s)=>(s===-1&&(i+=1),i),0);D(n<=1,()=>"There should be only one negative value in split array.");let a=t.indexOf(-1);if(a!==-1){let i=t.reduce((s,c)=>c>0?s+c:s);t[a]=e.shape[r]-i}D(e.shape[r]===t.reduce((i,s)=>i+s),()=>"The sum of sizes must match the size of the axis dimension."),o=t}return o}function Sve(e){return`Received SparseTensor with denseShape[0] = 0 but
107
+ indices.shape[0] = ${e}`}function kve(e,t){return`indices(${e}, 0) is invalid: ${t} < 0`}function _ve(e,t,r){return`indices(${e}, 0) is invalid: ${t} >= ${r}`}function Eve(e,t){return`only one output dimension may be -1, not both ${e} and ${t}`}function Ive(e,t){return`size ${e} must be non-negative, not ${t}`}function Tve(){return"reshape cannot infer the missing input size for an empty tensor unless all specified input sizes are non-zero"}function Cve(e,t){let r=mt(e),o=mt(t);return`Input to reshape is a SparseTensor with ${r}
108
+ dense values, but the requested shape requires a multiple of ${o}. inputShape=${e} outputShape= ${t}`}function Nve(e,t){let r=mt(e),o=mt(t);return`Input to reshape is a tensor with ${r} dense values, but the requested shape has ${o}. inputShape=${e} outputShape=${t}`}function Ave(){return"segment ids must be >= 0"}function Rve(){return"segment ids are not increasing"}function Dve(e,t){return`Segment id ${e} out of range [0, ${t}), possibly because segmentIds input is not sorted.`}function Fve(e,t,r){return`Bad: indices[${e}] == ${t} out of range [0, ${r})`}var mA={};Ot(mA,{collectGatherOpShapeInfo:()=>Pve,computeOutShape:()=>Ove,segOpComputeOptimalWindowSize:()=>Mve});function Mve(e,t){let r=!1,o;for(e<=ck?(o=e,r=!0):o=Jd(e,Math.floor(Math.sqrt(e)));!r;)o>t||o===e?r=!0:o=Jd(e,o+1);return o}function Ove(e,t,r){let o=[],n=e.length;for(let a=0;a<n;a++)a!==t?o.push(e[a]):o.push(r);return o}function Pve(e,t,r,o){let n=t.shape.length,a=e.shape.length;if(o!==0&&(o<-n||o>n))throw new Error(`Expect batchDims in the range of [-${n}, ${n}], but got ${o}`);if(o<0&&(o+=n),o>a)throw new Error(`batchDims (${o}) must be less than rank(x) (
109
+ ${a}).`);if(r<o)throw new Error(`batchDims (${o}) must be less than or equal to axis (${r}).`);for(let u=0;u<o;++u)if(e.shape[u]!==t.shape[u])throw new Error(`x.shape[${u}]: ${e.shape[u]} should be equal to indices.shape[${u}]: ${t.shape[u]}.`);let i=e.shape[r],s=[],c=1,l=1,p=1;for(let u=0;u<o;++u)s.push(e.shape[u]),c*=e.shape[u];for(let u=o;u<r;u++)s.push(e.shape[u]),l*=e.shape[u];for(let u=o;u<n;u++)s.push(t.shape[u]);for(let u=r+1;u<a;u++)s.push(e.shape[u]),p*=e.shape[u];return{batchSize:c,sliceSize:p,outerSize:l,dimSize:i,outputShape:s}}function zve(e){try{return e.map(t=>Lh(t))}catch(t){throw new Error(`Failed to decode encoded string bytes into utf-8, error: ${t}`)}}function $ve(e){return e.map(t=>$h(t))}var Wi={};Ot(Wi,{nonMaxSuppressionV3Impl:()=>XS,nonMaxSuppressionV4Impl:()=>YS,nonMaxSuppressionV5Impl:()=>QS,whereImpl:()=>VS});d7();var fA=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function $7(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var pk={};var L7;function B7(){return L7?pk:(L7=1,function(){var e;function t(v){var E=0;return function(){return E<v.length?{done:!1,value:v[E++]}:{done:!0}}}var r=typeof Object.defineProperties=="function"?Object.defineProperty:function(v,E,N){return v==Array.prototype||v==Object.prototype||(v[E]=N.value),v};function o(v){v=[typeof globalThis=="object"&&globalThis,v,typeof window=="object"&&window,typeof self=="object"&&self,typeof fA=="object"&&fA];for(var E=0;E<v.length;++E){var N=v[E];if(N&&N.Math==Math)return N}throw Error("Cannot find global object")}var n=o(this);function a(v,E){if(E)e:{var N=n;v=v.split(".");for(var O=0;O<v.length-1;O++){var U=v[O];if(!(U in N))break e;N=N[U]}v=v[v.length-1],O=N[v],E=E(O),E!=O&&E!=null&&r(N,v,{configurable:!0,writable:!0,value:E})}}a("Symbol",function(v){function E(j){if(this instanceof E)throw new TypeError("Symbol is not a constructor");return new N(O+(j||"")+"_"+U++,j)}function N(j,W){this.g=j,r(this,"description",{configurable:!0,writable:!0,value:W})}if(v)return v;N.prototype.toString=function(){return this.g};var O="jscomp_symbol_"+(1e9*Math.random()>>>0)+"_",U=0;return E}),a("Symbol.iterator",function(v){if(v)return v;v=Symbol("Symbol.iterator");for(var E="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),N=0;N<E.length;N++){var O=n[E[N]];typeof O=="function"&&typeof O.prototype[v]!="function"&&r(O.prototype,v,{configurable:!0,writable:!0,value:function(){return i(t(this))}})}return v});function i(v){return v={next:v},v[Symbol.iterator]=function(){return this},v}function s(v){var E=typeof Symbol<"u"&&Symbol.iterator&&v[Symbol.iterator];return E?E.call(v):{next:t(v)}}function c(v){if(!(v instanceof Array)){v=s(v);for(var E,N=[];!(E=v.next()).done;)N.push(E.value);v=N}return v}var l=typeof Object.create=="function"?Object.create:function(v){function E(){}return E.prototype=v,new E},p;if(typeof Object.setPrototypeOf=="function")p=Object.setPrototypeOf;else{var u;e:{var m={a:!0},f={};try{f.__proto__=m,u=f.a;break e}catch{}u=!1}p=u?function(v,E){if(v.__proto__=E,v.__proto__!==E)throw new TypeError(v+" is not extensible");return v}:null}var d=p;function h(v,E){if(v.prototype=l(E.prototype),v.prototype.constructor=v,d)d(v,E);else for(var N in E)if(N!="prototype")if(Object.defineProperties){var O=Object.getOwnPropertyDescriptor(E,N);O&&Object.defineProperty(v,N,O)}else v[N]=E[N];v.na=E.prototype}function y(){this.l=!1,this.i=null,this.h=void 0,this.g=1,this.u=this.o=0,this.j=null}function g(v){if(v.l)throw new TypeError("Generator is already running");v.l=!0}y.prototype.s=function(v){this.h=v};function b(v,E){v.j={da:E,ea:!0},v.g=v.o||v.u}y.prototype.return=function(v){this.j={return:v},this.g=this.u};function x(v,E,N){return v.g=N,{value:E}}function w(v){this.g=new y,this.h=v}function I(v,E){g(v.g);var N=v.g.i;return N?C(v,"return"in N?N.return:function(O){return{value:O,done:!0}},E,v.g.return):(v.g.return(E),R(v))}function C(v,E,N,O){try{var U=E.call(v.g.i,N);if(!(U instanceof Object))throw new TypeError("Iterator result "+U+" is not an object");if(!U.done)return v.g.l=!1,U;var j=U.value}catch(W){return v.g.i=null,b(v.g,W),R(v)}return v.g.i=null,O.call(v.g,j),R(v)}function R(v){for(;v.g.g;)try{var E=v.h(v.g);if(E)return v.g.l=!1,{value:E.value,done:!1}}catch(N){v.g.h=void 0,b(v.g,N)}if(v.g.l=!1,v.g.j){if(E=v.g.j,v.g.j=null,E.ea)throw E.da;return{value:E.return,done:!0}}return{value:void 0,done:!0}}function P(v){this.next=function(E){return g(v.g),v.g.i?E=C(v,v.g.i.next,E,v.g.s):(v.g.s(E),E=R(v)),E},this.throw=function(E){return g(v.g),v.g.i?E=C(v,v.g.i.throw,E,v.g.s):(b(v.g,E),E=R(v)),E},this.return=function(E){return I(v,E)},this[Symbol.iterator]=function(){return this}}function z(v){function E(O){return v.next(O)}function N(O){return v.throw(O)}return new Promise(function(O,U){function j(W){W.done?O(W.value):Promise.resolve(W.value).then(E,N).then(j,U)}j(v.next())})}function $(v){return z(new P(new w(v)))}a("Promise",function(v){function E(W){this.h=0,this.i=void 0,this.g=[],this.s=!1;var Q=this.j();try{W(Q.resolve,Q.reject)}catch(oe){Q.reject(oe)}}function N(){this.g=null}function O(W){return W instanceof E?W:new E(function(Q){Q(W)})}if(v)return v;N.prototype.h=function(W){if(this.g==null){this.g=[];var Q=this;this.i(function(){Q.l()})}this.g.push(W)};var U=n.setTimeout;N.prototype.i=function(W){U(W,0)},N.prototype.l=function(){for(;this.g&&this.g.length;){var W=this.g;this.g=[];for(var Q=0;Q<W.length;++Q){var oe=W[Q];W[Q]=null;try{oe()}catch(de){this.j(de)}}}this.g=null},N.prototype.j=function(W){this.i(function(){throw W})},E.prototype.j=function(){function W(de){return function(Te){oe||(oe=!0,de.call(Q,Te))}}var Q=this,oe=!1;return{resolve:W(this.D),reject:W(this.l)}},E.prototype.D=function(W){if(W===this)this.l(new TypeError("A Promise cannot resolve to itself"));else if(W instanceof E)this.H(W);else{e:switch(typeof W){case"object":var Q=W!=null;break e;case"function":Q=!0;break e;default:Q=!1}Q?this.A(W):this.o(W)}},E.prototype.A=function(W){var Q=void 0;try{Q=W.then}catch(oe){this.l(oe);return}typeof Q=="function"?this.I(Q,W):this.o(W)},E.prototype.l=function(W){this.u(2,W)},E.prototype.o=function(W){this.u(1,W)},E.prototype.u=function(W,Q){if(this.h!=0)throw Error("Cannot settle("+W+", "+Q+"): Promise already settled in state"+this.h);this.h=W,this.i=Q,this.h===2&&this.G(),this.B()},E.prototype.G=function(){var W=this;U(function(){if(W.C()){var Q=n.console;typeof Q<"u"&&Q.error(W.i)}},1)},E.prototype.C=function(){if(this.s)return!1;var W=n.CustomEvent,Q=n.Event,oe=n.dispatchEvent;return typeof oe>"u"?!0:(typeof W=="function"?W=new W("unhandledrejection",{cancelable:!0}):typeof Q=="function"?W=new Q("unhandledrejection",{cancelable:!0}):(W=n.document.createEvent("CustomEvent"),W.initCustomEvent("unhandledrejection",!1,!0,W)),W.promise=this,W.reason=this.i,oe(W))},E.prototype.B=function(){if(this.g!=null){for(var W=0;W<this.g.length;++W)j.h(this.g[W]);this.g=null}};var j=new N;return E.prototype.H=function(W){var Q=this.j();W.M(Q.resolve,Q.reject)},E.prototype.I=function(W,Q){var oe=this.j();try{W.call(Q,oe.resolve,oe.reject)}catch(de){oe.reject(de)}},E.prototype.then=function(W,Q){function oe(Xe,De){return typeof Xe=="function"?function(et){try{de(Xe(et))}catch(kt){Te(kt)}}:De}var de,Te,Ke=new E(function(Xe,De){de=Xe,Te=De});return this.M(oe(W,de),oe(Q,Te)),Ke},E.prototype.catch=function(W){return this.then(void 0,W)},E.prototype.M=function(W,Q){function oe(){switch(de.h){case 1:W(de.i);break;case 2:Q(de.i);break;default:throw Error("Unexpected state: "+de.h)}}var de=this;this.g==null?j.h(oe):this.g.push(oe),this.s=!0},E.resolve=O,E.reject=function(W){return new E(function(Q,oe){oe(W)})},E.race=function(W){return new E(function(Q,oe){for(var de=s(W),Te=de.next();!Te.done;Te=de.next())O(Te.value).M(Q,oe)})},E.all=function(W){var Q=s(W),oe=Q.next();return oe.done?O([]):new E(function(de,Te){function Ke(et){return function(kt){Xe[et]=kt,De--,De==0&&de(Xe)}}var Xe=[],De=0;do Xe.push(void 0),De++,O(oe.value).M(Ke(Xe.length-1),Te),oe=Q.next();while(!oe.done)})},E});function B(v,E){v instanceof String&&(v+="");var N=0,O=!1,U={next:function(){if(!O&&N<v.length){var j=N++;return{value:E(j,v[j]),done:!1}}return O=!0,{done:!0,value:void 0}}};return U[Symbol.iterator]=function(){return U},U}var V=typeof Object.assign=="function"?Object.assign:function(v,E){for(var N=1;N<arguments.length;N++){var O=arguments[N];if(O)for(var U in O)Object.prototype.hasOwnProperty.call(O,U)&&(v[U]=O[U])}return v};a("Object.assign",function(v){return v||V}),a("Object.is",function(v){return v||function(E,N){return E===N?E!==0||1/E===1/N:E!==E&&N!==N}}),a("Array.prototype.includes",function(v){return v||function(E,N){var O=this;O instanceof String&&(O=String(O));var U=O.length;for(N=N||0,0>N&&(N=Math.max(N+U,0));N<U;N++){var j=O[N];if(j===E||Object.is(j,E))return!0}return!1}}),a("String.prototype.includes",function(v){return v||function(E,N){if(this==null)throw new TypeError("The 'this' value for String.prototype.includes must not be null or undefined");if(E instanceof RegExp)throw new TypeError("First argument to String.prototype.includes must not be a regular expression");return this.indexOf(E,N||0)!==-1}}),a("Array.prototype.keys",function(v){return v||function(){return B(this,function(E){return E})}});var H=this||self;function G(v,E){v=v.split(".");var N=H;v[0]in N||typeof N.execScript>"u"||N.execScript("var "+v[0]);for(var O;v.length&&(O=v.shift());)v.length||E===void 0?N[O]&&N[O]!==Object.prototype[O]?N=N[O]:N=N[O]={}:N[O]=E}function X(){throw Error("Invalid UTF8")}function ee(v,E){return E=String.fromCharCode.apply(null,E),v==null?E:v+E}var Z,te=typeof TextDecoder<"u",re,se=typeof TextEncoder<"u",ae={},pe=null;function ie(v){var E;E===void 0&&(E=0),ge(),E=ae[E];for(var N=Array(Math.floor(v.length/3)),O=E[64]||"",U=0,j=0;U<v.length-2;U+=3){var W=v[U],Q=v[U+1],oe=v[U+2],de=E[W>>2];W=E[(W&3)<<4|Q>>4],Q=E[(Q&15)<<2|oe>>6],oe=E[oe&63],N[j++]=de+W+Q+oe}switch(de=0,oe=O,v.length-U){case 2:de=v[U+1],oe=E[(de&15)<<2]||O;case 1:v=v[U],N[j]=E[v>>2]+E[(v&3)<<4|de>>4]+oe+O}return N.join("")}function Y(v){var E=v.length,N=3*E/4;N%3?N=Math.floor(N):"=.".indexOf(v[E-1])!=-1&&(N="=.".indexOf(v[E-2])!=-1?N-2:N-1);var O=new Uint8Array(N),U=0;return le(v,function(j){O[U++]=j}),U!==N?O.subarray(0,U):O}function le(v,E){function N(oe){for(;O<v.length;){var de=v.charAt(O++),Te=pe[de];if(Te!=null)return Te;if(!/^[\s\xa0]*$/.test(de))throw Error("Unknown base64 encoding at char: "+de)}return oe}ge();for(var O=0;;){var U=N(-1),j=N(0),W=N(64),Q=N(64);if(Q===64&&U===-1)break;E(U<<2|j>>4),W!=64&&(E(j<<4&240|W>>2),Q!=64&&E(W<<6&192|Q))}}function ge(){if(!pe){pe={};for(var v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),E=["+/=","+/","-_=","-_.","-_"],N=0;5>N;N++){var O=v.concat(E[N].split(""));ae[N]=O;for(var U=0;U<O.length;U++){var j=O[U];pe[j]===void 0&&(pe[j]=U)}}}}var ve=typeof Uint8Array=="function";function Ee(v){return ve&&v!=null&&v instanceof Uint8Array}var Se;function Ve(v){if(this.L=v,v!==null&&v.length===0)throw Error("ByteString should be constructed with non-empty values")}var Ge=typeof Uint8Array.prototype.slice=="function",Ye=0,Ze=0;function Je(v,E){if(v.constructor===Uint8Array)return v;if(v.constructor===ArrayBuffer)return new Uint8Array(v);if(v.constructor===Array)return new Uint8Array(v);if(v.constructor===String)return Y(v);if(v.constructor===Ve)return!E&&(E=v.L)&&E.constructor===Uint8Array?E:(E=v.L,E=E==null||Ee(E)?E:typeof E=="string"?Y(E):null,(v=v.L=E)?new Uint8Array(v):Se||(Se=new Uint8Array(0)));if(v instanceof Uint8Array)return new Uint8Array(v.buffer,v.byteOffset,v.byteLength);throw Error("Type not convertible to a Uint8Array, expected a Uint8Array, an ArrayBuffer, a base64 encoded string, or Array of numbers")}function yt(v,E){return Error("Invalid wire type: "+v+" (at position "+E+")")}function lt(){return Error("Failed to read varint, encoding is invalid.")}function Nt(v,E){E=E===void 0?{}:E,E=E.v===void 0?!1:E.v,this.h=null,this.g=this.i=this.j=0,this.v=E,v&&St(this,v)}function St(v,E){v.h=Je(E,v.v),v.j=0,v.i=v.h.length,v.g=v.j}Nt.prototype.reset=function(){this.g=this.j};function zt(v){if(v.g>v.i)throw Error("Tried to read past the end of the data "+v.g+" > "+v.i)}function Lt(v){var E=v.h,N=E[v.g],O=N&127;if(128>N)return v.g+=1,zt(v),O;if(N=E[v.g+1],O|=(N&127)<<7,128>N)return v.g+=2,zt(v),O;if(N=E[v.g+2],O|=(N&127)<<14,128>N)return v.g+=3,zt(v),O;if(N=E[v.g+3],O|=(N&127)<<21,128>N)return v.g+=4,zt(v),O;if(N=E[v.g+4],v.g+=5,O|=(N&15)<<28,128>N)return zt(v),O;if(128<=E[v.g++]&&128<=E[v.g++]&&128<=E[v.g++]&&128<=E[v.g++]&&128<=E[v.g++])throw lt();return zt(v),O}var Kr=[];function tr(){this.g=[]}tr.prototype.length=function(){return this.g.length},tr.prototype.end=function(){var v=this.g;return this.g=[],v};function xt(v,E){for(;127<E;)v.g.push(E&127|128),E>>>=7;v.g.push(E)}function Qt(v){var E={},N=E.W===void 0?!1:E.W;this.l={v:E.v===void 0?!1:E.v},this.W=N,E=this.l,Kr.length?(N=Kr.pop(),E&&(N.v=E.v),v&&St(N,v),v=N):v=new Nt(v,E),this.g=v,this.j=this.g.g,this.h=this.i=-1}Qt.prototype.reset=function(){this.g.reset(),this.j=this.g.g,this.h=this.i=-1};function Ht(v){var E=v.g;if(E.g==E.i)return!1;v.j=v.g.g;var N=Lt(v.g)>>>0;if(E=N>>>3,N&=7,!(0<=N&&5>=N))throw yt(N,v.j);if(1>E)throw Error("Invalid field number: "+E+" (at position "+v.j+")");return v.i=E,v.h=N,!0}function _r(v){switch(v.h){case 0:if(v.h!=0)_r(v);else e:{v=v.g;for(var E=v.g,N=E+10;E<N;)if(!(v.h[E++]&128)){v.g=E,zt(v);break e}throw lt()}break;case 1:v=v.g,v.g+=8,zt(v);break;case 2:v.h!=2?_r(v):(E=Lt(v.g)>>>0,v=v.g,v.g+=E,zt(v));break;case 5:v=v.g,v.g+=4,zt(v);break;case 3:E=v.i;do{if(!Ht(v))throw Error("Unmatched start-group tag: stream EOF");if(v.h==4){if(v.i!=E)throw Error("Unmatched end-group tag");break}_r(v)}while(!0);break;default:throw yt(v.h,v.j)}}var br=[];function Br(){this.i=[],this.h=0,this.g=new tr}function Ao(v,E){E.length!==0&&(v.i.push(E),v.h+=E.length)}function On(v,E){if(E=E.ba){Ao(v,v.g.end());for(var N=0;N<E.length;N++)Ao(v,E[N])}}var Xo=typeof Symbol=="function"&&typeof Symbol()=="symbol"?Symbol(void 0):void 0;function Mr(v,E){Object.isFrozen(v)||(Xo?v[Xo]|=E:v.N!==void 0?v.N|=E:Object.defineProperties(v,{N:{value:E,configurable:!0,writable:!0,enumerable:!1}}))}function na(v){var E;return Xo?E=v[Xo]:E=v.N,E??0}function Pa(v){return Mr(v,1),v}function za(v){return Array.isArray(v)?!!(na(v)&2):!1}function sf(v){if(!Array.isArray(v))throw Error("cannot mark non-array as immutable");Mr(v,2)}function $a(v){return v!==null&&typeof v=="object"&&!Array.isArray(v)&&v.constructor===Object}var La=Object.freeze(Pa([]));function aa(v){if(za(v.m))throw Error("Cannot mutate an immutable Message")}var lf=typeof Symbol<"u"&&typeof Symbol.hasInstance<"u";function _c(v){return{value:v,configurable:!1,writable:!1,enumerable:!1}}function to(v,E,N){return E===-1?null:E>=v.i?v.g?v.g[E]:void 0:N!==void 0&&N&&v.g&&(N=v.g[E],N!=null)?N:v.m[E+v.h]}function Er(v,E,N,O){O=O===void 0?!1:O,aa(v),E<v.i&&!O?v.m[E+v.h]=N:(v.g||(v.g=v.m[v.i+v.h]={}))[E]=N}function Ec(v,E,N,O){N=N===void 0?!0:N,O=O===void 0?!1:O;var U=to(v,E,O);return U==null&&(U=La),za(v.m)?N&&(sf(U),Object.freeze(U)):(U===La||za(U))&&(U=Pa(U.slice()),Er(v,E,U,O)),U}function So(v,E,N){return v=to(v,E),v=v==null?v:+v,v??(N===void 0?0:N)}function Or(v,E,N,O){v.j||(v.j={});var U=za(v.m),j=v.j[N];if(!j){O=Ec(v,N,!0,O===void 0?!1:O),j=[],U=U||za(O);for(var W=0;W<O.length;W++)j[W]=new E(O[W]),U&&sf(j[W].m);U&&(sf(j),Object.freeze(j)),v.j[N]=j}return j}function Ic(v,E,N,O,U){var j=j===void 0?!1:j;return aa(v),j=Or(v,N,E,j),N=O||new N,v=Ec(v,E),U!=null?(j.splice(U,0,N),v.splice(U,0,N.m)):(j.push(N),v.push(N.m)),N}function cf(v,E){return v=to(v,E),v??0}function pf(v,E){return v=to(v,E),v??""}function gx(v){switch(typeof v){case"number":return isFinite(v)?v:String(v);case"object":if(v&&!Array.isArray(v)){if(Ee(v))return ie(v);if(v instanceof Ve){var E=v.L;return E=E==null||typeof E=="string"?E:ve&&E instanceof Uint8Array?ie(E):null,(v.L=E)||""}}}return v}function Ug(v){var E=Wg;return E=E===void 0?Hg:E,mi(v,E)}function Tc(v,E){if(v!=null){if(Array.isArray(v))v=mi(v,E);else if($a(v)){var N={},O;for(O in v)N[O]=Tc(v[O],E);v=N}else v=E(v);return v}}function mi(v,E){for(var N=v.slice(),O=0;O<N.length;O++)N[O]=Tc(N[O],E);return Array.isArray(v)&&na(v)&1&&Pa(N),N}function Wg(v){return v&&typeof v=="object"&&v.toJSON?v.toJSON():(v=gx(v),Array.isArray(v)?Ug(v):v)}function Hg(v){return Ee(v)?new Uint8Array(v):v}function fi(v,E,N){v||(v=uf),uf=null;var O=this.constructor.h;v||(v=O?[O]:[]),this.h=(O?0:-1)-(this.constructor.g||0),this.j=void 0,this.m=v;e:{if(O=this.m.length,v=O-1,O&&(O=this.m[v],$a(O))){this.i=v-this.h,this.g=O;break e}E!==void 0&&-1<E?(this.i=Math.max(E,v+1-this.h),this.g=void 0):this.i=Number.MAX_VALUE}if(N)for(E=0;E<N.length;E++)if(v=N[E],v<this.i)v+=this.h,(O=this.m[v])?Array.isArray(O)&&Pa(O):this.m[v]=La;else{O=this.g||(this.g=this.m[this.i+this.h]={});var U=O[v];U?Array.isArray(U)&&Pa(U):O[v]=La}}fi.prototype.toJSON=function(){return Ug(this.m)},fi.prototype.toString=function(){return this.m.toString()};var uf;function Ji(){fi.apply(this,arguments)}if(h(Ji,fi),lf){var Cc={};Object.defineProperties(Ji,(Cc[Symbol.hasInstance]=_c(function(){throw Error("Cannot perform instanceof checks for MutableMessage")}),Cc))}function mf(v,E,N){if(N){var O={},U;for(U in N){var j=N[U],W=j.ha;W||(O.F=j.la||j.fa.P,j.aa?(O.U=df(j.aa),W=function(Q){return function(oe,de,Te){return Q.F(oe,de,Te,Q.U)}}(O)):j.ca?(O.T=hf(j.X.g,j.ca),W=function(Q){return function(oe,de,Te){return Q.F(oe,de,Te,Q.T)}}(O)):W=O.F,j.ha=W),W(E,v,j.X),O={F:O.F,U:O.U,T:O.T}}}On(E,v)}var Zi=Symbol();function ff(v,E,N){return v[Zi]||(v[Zi]=function(O,U){return E(O,U,N)})}function Qe(v){var E=v[Zi];if(!E){var N=wf(v);E=function(O,U){return di(O,U,N)},v[Zi]=E}return E}function Nc(v){var E=v.aa;if(E)return Qe(E);if(E=v.ka)return ff(v.X.g,E,v.ca)}function Vg(v){var E=Nc(v),N=v.X,O=v.fa.O;return E?function(U,j){return O(U,j,N,E)}:function(U,j){return O(U,j,N)}}function Ac(v,E,N,O,U,j){v=v();var W=0;for(v.length&&typeof v[0]!="number"&&(N(E,v[0]),W++);W<v.length;){N=v[W++];for(var Q=W+1;Q<v.length&&typeof v[Q]!="number";)Q++;var oe=v[W++];switch(Q-=W,Q){case 0:O(E,N,oe);break;case 1:O(E,N,oe,v[W++]);break;case 2:U(E,N,oe,v[W++],v[W++]);break;case 3:Q=v[W++];var de=v[W++],Te=v[W++];Array.isArray(Te)?U(E,N,oe,Q,de,Te):j(E,N,oe,Q,de,Te);break;case 4:j(E,N,oe,v[W++],v[W++],v[W++],v[W++]);break;default:throw Error("unexpected number of binary field arguments: "+Q)}}return E}var Ba=Symbol();function df(v){var E=v[Ba];if(!E){var N=bf(v);E=function(O,U){return Sf(O,U,N)},v[Ba]=E}return E}function hf(v,E){var N=v[Ba];return N||(N=function(O,U){return mf(O,U,E)},v[Ba]=N),N}var gf=Symbol();function jg(v,E){v.push(E)}function Gg(v,E,N){v.push(E,N.P)}function yf(v,E,N,O,U){var j=df(U),W=N.P;v.push(E,function(Q,oe,de){return W(Q,oe,de,O,j)})}function vf(v,E,N,O,U,j){var W=hf(O,j),Q=N.P;v.push(E,function(oe,de,Te){return Q(oe,de,Te,O,W)})}function bf(v){var E=v[gf];return E||Ac(v,v[gf]=[],jg,Gg,yf,vf)}var xf=Symbol();function qg(v,E){v[0]=E}function Rc(v,E,N,O){var U=N.O;v[E]=O?function(j,W,Q){return U(j,W,Q,O)}:U}function Kg(v,E,N,O,U,j){var W=N.O,Q=Qe(U);v[E]=function(oe,de,Te){return W(oe,de,Te,O,Q,j)}}function Xg(v,E,N,O,U,j,W){var Q=N.O,oe=ff(O,U,j);v[E]=function(de,Te,Ke){return Q(de,Te,Ke,O,oe,W)}}function wf(v){var E=v[xf];return E||Ac(v,v[xf]={},qg,Rc,Kg,Xg)}function di(v,E,N){for(;Ht(E)&&E.h!=4;){var O=E.i,U=N[O];if(!U){var j=N[0];j&&(j=j[O])&&(U=N[O]=Vg(j))}if((!U||!U(E,v,O))&&(U=E,O=v,j=U.j,_r(U),!U.W)){var W=U.g.h;U=U.g.g,U=j===U?Se||(Se=new Uint8Array(0)):Ge?W.slice(j,U):new Uint8Array(W.subarray(j,U)),(j=O.ba)?j.push(U):O.ba=[U]}}return v}function Dc(v,E,N){if(br.length){var O=br.pop();v&&(St(O.g,v),O.i=-1,O.h=-1),v=O}else v=new Qt(v);try{return di(new E,v,wf(N))}finally{E=v.g,E.h=null,E.j=0,E.i=0,E.g=0,E.v=!1,v.i=-1,v.h=-1,100>br.length&&br.push(v)}}function Sf(v,E,N){for(var O=N.length,U=O%2==1,j=U?1:0;j<O;j+=2)(0,N[j+1])(E,v,N[j]);mf(v,E,U?N[0]:void 0)}function Ys(v,E){var N=new Br;Sf(v,N,bf(E)),Ao(N,N.g.end()),v=new Uint8Array(N.h),E=N.i;for(var O=E.length,U=0,j=0;j<O;j++){var W=E[j];v.set(W,U),U+=W.length}return N.i=[v],v}function es(v,E){return{O:v,P:E}}var ko=es(function(v,E,N){if(v.h!==5)return!1;v=v.g;var O=v.h[v.g],U=v.h[v.g+1],j=v.h[v.g+2],W=v.h[v.g+3];return v.g+=4,zt(v),U=(O<<0|U<<8|j<<16|W<<24)>>>0,v=2*(U>>31)+1,O=U>>>23&255,U&=8388607,Er(E,N,O==255?U?NaN:1/0*v:O==0?v*Math.pow(2,-149)*U:v*Math.pow(2,O-150)*(U+Math.pow(2,23))),!0},function(v,E,N){if(E=to(E,N),E!=null){xt(v.g,8*N+5),v=v.g;var O=E;O=(N=0>O?1:0)?-O:O,O===0?0<1/O?Ye=Ze=0:(Ze=0,Ye=2147483648):isNaN(O)?(Ze=0,Ye=2147483647):34028234663852886e22<O?(Ze=0,Ye=(N<<31|2139095040)>>>0):11754943508222875e-54>O?(O=Math.round(O/Math.pow(2,-149)),Ze=0,Ye=(N<<31|O)>>>0):(E=Math.floor(Math.log(O)/Math.LN2),O*=Math.pow(2,-E),O=Math.round(8388608*O),16777216<=O&&++E,Ze=0,Ye=(N<<31|E+127<<23|O&8388607)>>>0),N=Ye,v.g.push(N>>>0&255),v.g.push(N>>>8&255),v.g.push(N>>>16&255),v.g.push(N>>>24&255)}}),Yg=es(function(v,E,N){if(v.h!==0)return!1;for(var O=v.g,U=128,j=0,W=v=0;4>W&&128<=U;W++)U=O.h[O.g++],zt(O),j|=(U&127)<<7*W;if(128<=U&&(U=O.h[O.g++],zt(O),j|=(U&127)<<28,v|=(U&127)>>4),128<=U)for(W=0;5>W&&128<=U;W++)U=O.h[O.g++],zt(O),v|=(U&127)<<7*W+3;if(128>U)O=j>>>0,U=v>>>0,(v=U&2147483648)&&(O=~O+1>>>0,U=~U>>>0,O==0&&(U=U+1>>>0)),O=4294967296*U+(O>>>0);else throw lt();return Er(E,N,v?-O:O),!0},function(v,E,N){if(E=to(E,N),E!=null&&E!=null){xt(v.g,8*N),v=v.g;var O=E;for(N=0>O,O=Math.abs(O),E=O>>>0,O=Math.floor((O-E)/4294967296),O>>>=0,N&&(O=~O>>>0,E=(~E>>>0)+1,4294967295<E&&(E=0,O++,4294967295<O&&(O=0))),Ye=E,Ze=O,N=Ye,E=Ze;0<E||127<N;)v.g.push(N&127|128),N=(N>>>7|E<<25)>>>0,E>>>=7;v.g.push(N)}}),Qg=es(function(v,E,N){return v.h!==0?!1:(Er(E,N,Lt(v.g)),!0)},function(v,E,N){if(E=to(E,N),E!=null&&E!=null)if(xt(v.g,8*N),v=v.g,N=E,0<=N)xt(v,N);else{for(E=0;9>E;E++)v.g.push(N&127|128),N>>=7;v.g.push(1)}}),kf=es(function(v,E,N){if(v.h!==2)return!1;var O=Lt(v.g)>>>0;v=v.g;var U=v.g;v.g+=O,zt(v),v=v.h;var j;if(te)(j=Z)||(j=Z=new TextDecoder("utf-8",{fatal:!0})),j=j.decode(v.subarray(U,U+O));else{O=U+O;for(var W=[],Q=null,oe,de,Te;U<O;)oe=v[U++],128>oe?W.push(oe):224>oe?U>=O?X():(de=v[U++],194>oe||(de&192)!==128?(U--,X()):W.push((oe&31)<<6|de&63)):240>oe?U>=O-1?X():(de=v[U++],(de&192)!==128||oe===224&&160>de||oe===237&&160<=de||((j=v[U++])&192)!==128?(U--,X()):W.push((oe&15)<<12|(de&63)<<6|j&63)):244>=oe?U>=O-2?X():(de=v[U++],(de&192)!==128||(oe<<28)+(de-144)>>30||((j=v[U++])&192)!==128||((Te=v[U++])&192)!==128?(U--,X()):(oe=(oe&7)<<18|(de&63)<<12|(j&63)<<6|Te&63,oe-=65536,W.push((oe>>10&1023)+55296,(oe&1023)+56320))):X(),8192<=W.length&&(Q=ee(Q,W),W.length=0);j=ee(Q,W)}return Er(E,N,j),!0},function(v,E,N){if(E=to(E,N),E!=null){var O=!1;if(O=O===void 0?!1:O,se){if(O&&/(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])/.test(E))throw Error("Found an unpaired surrogate");E=(re||(re=new TextEncoder)).encode(E)}else{for(var U=0,j=new Uint8Array(3*E.length),W=0;W<E.length;W++){var Q=E.charCodeAt(W);if(128>Q)j[U++]=Q;else{if(2048>Q)j[U++]=Q>>6|192;else{if(55296<=Q&&57343>=Q){if(56319>=Q&&W<E.length){var oe=E.charCodeAt(++W);if(56320<=oe&&57343>=oe){Q=1024*(Q-55296)+oe-56320+65536,j[U++]=Q>>18|240,j[U++]=Q>>12&63|128,j[U++]=Q>>6&63|128,j[U++]=Q&63|128;continue}else W--}if(O)throw Error("Found an unpaired surrogate");Q=65533}j[U++]=Q>>12|224,j[U++]=Q>>6&63|128}j[U++]=Q&63|128}}E=j.subarray(0,U)}xt(v.g,8*N+2),xt(v.g,E.length),Ao(v,v.g.end()),Ao(v,E)}}),Ua=es(function(v,E,N,O,U){if(v.h!==2)return!1;E=Ic(E,N,O),N=v.g.i,O=Lt(v.g)>>>0;var j=v.g.g+O,W=j-N;if(0>=W&&(v.g.i=j,U(E,v),W=j-v.g.g),W)throw Error("Message parsing ended unexpectedly. Expected to read "+(O+" bytes, instead read "+(O-W)+" bytes, either the data ended unexpectedly or the message misreported its own length"));return v.g.g=j,v.g.i=N,!0},function(v,E,N,O,U){if(E=Or(E,O,N),E!=null)for(O=0;O<E.length;O++){var j=v;xt(j.g,8*N+2);var W=j.g.end();Ao(j,W),W.push(j.h),j=W,U(E[O],v),W=v;var Q=j.pop();for(Q=W.h+W.g.length()-Q;127<Q;)j.push(Q&127|128),Q>>>=7,W.h++;j.push(Q),W.h++}});function uo(){Ji.apply(this,arguments)}if(h(uo,Ji),lf){var _f={};Object.defineProperties(uo,(_f[Symbol.hasInstance]=_c(Object[Symbol.hasInstance]),_f))}function ts(v){uo.call(this,v)}h(ts,uo);function Ef(){return[1,Qg,2,ko,3,kf,4,kf]}function Fc(v){uo.call(this,v,-1,Tf)}h(Fc,uo),Fc.prototype.addClassification=function(v,E){return Ic(this,1,ts,v,E),this};function If(){return[1,Ua,ts,Ef]}var Tf=[1];function Qs(v){uo.call(this,v)}h(Qs,uo);function Cf(){return[1,ko,2,ko,3,ko,4,ko,5,ko]}function Mc(v){uo.call(this,v,-1,Jg)}h(Mc,uo);function Nf(){return[1,Ua,Qs,Cf]}var Jg=[1];function Oc(v){uo.call(this,v)}h(Oc,uo);function Af(){return[1,ko,2,ko,3,ko,4,ko,5,ko,6,Yg]}var Rf=[[61,146],[146,91],[91,181],[181,84],[84,17],[17,314],[314,405],[405,321],[321,375],[375,291],[61,185],[185,40],[40,39],[39,37],[37,0],[0,267],[267,269],[269,270],[270,409],[409,291],[78,95],[95,88],[88,178],[178,87],[87,14],[14,317],[317,402],[402,318],[318,324],[324,308],[78,191],[191,80],[80,81],[81,82],[82,13],[13,312],[312,311],[311,310],[310,415],[415,308]],Pc=[[263,249],[249,390],[390,373],[373,374],[374,380],[380,381],[381,382],[382,362],[263,466],[466,388],[388,387],[387,386],[386,385],[385,384],[384,398],[398,362]],Zg=[[276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]],Df=[[33,7],[7,163],[163,144],[144,145],[145,153],[153,154],[154,155],[155,133],[33,246],[246,161],[161,160],[160,159],[159,158],[158,157],[157,173],[173,133]],Ff=[[46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]],Mf=[[10,338],[338,297],[297,332],[332,284],[284,251],[251,389],[389,356],[356,454],[454,323],[323,361],[361,288],[288,397],[397,365],[365,379],[379,378],[378,400],[400,377],[377,152],[152,148],[148,176],[176,149],[149,150],[150,136],[136,172],[172,58],[58,132],[132,93],[93,234],[234,127],[127,162],[162,21],[21,54],[54,103],[103,67],[67,109],[109,10]],ey=[].concat(c(Rf),c(Pc),c(Zg),c(Df),c(Ff),c(Mf));function Of(v,E,N){if(N=v.createShader(N===0?v.VERTEX_SHADER:v.FRAGMENT_SHADER),v.shaderSource(N,E),v.compileShader(N),!v.getShaderParameter(N,v.COMPILE_STATUS))throw Error(`Could not compile WebGL shader.
110
+
111
+ `+v.getShaderInfoLog(N));return N}function ty(v){return Or(v,ts,1).map(function(E){return{index:cf(E,1),ga:So(E,2),label:to(E,3)!=null?pf(E,3):void 0,displayName:to(E,4)!=null?pf(E,4):void 0}})}function ry(v){return{x:So(v,1),y:So(v,2),z:So(v,3),visibility:to(v,4)!=null?So(v,4):void 0}}function zc(v,E){this.h=v,this.g=E,this.l=0}function Pf(v,E,N){return oy(v,E),typeof v.g.canvas.transferToImageBitmap=="function"?Promise.resolve(v.g.canvas.transferToImageBitmap()):N?Promise.resolve(v.g.canvas):typeof createImageBitmap=="function"?createImageBitmap(v.g.canvas):(v.i===void 0&&(v.i=document.createElement("canvas")),new Promise(function(O){v.i.height=v.g.canvas.height,v.i.width=v.g.canvas.width,v.i.getContext("2d",{}).drawImage(v.g.canvas,0,0,v.g.canvas.width,v.g.canvas.height),O(v.i)}))}function oy(v,E){var N=v.g;if(v.o===void 0){var O=Of(N,`
112
+ attribute vec2 aVertex;
113
+ attribute vec2 aTex;
114
+ varying vec2 vTex;
115
+ void main(void) {
116
+ gl_Position = vec4(aVertex, 0.0, 1.0);
117
+ vTex = aTex;
118
+ }`,0),U=Of(N,`
119
+ precision mediump float;
120
+ varying vec2 vTex;
121
+ uniform sampler2D sampler0;
122
+ void main(){
123
+ gl_FragColor = texture2D(sampler0, vTex);
124
+ }`,1),j=N.createProgram();if(N.attachShader(j,O),N.attachShader(j,U),N.linkProgram(j),!N.getProgramParameter(j,N.LINK_STATUS))throw Error(`Could not compile WebGL program.
125
+
126
+ `+N.getProgramInfoLog(j));O=v.o=j,N.useProgram(O),U=N.getUniformLocation(O,"sampler0"),v.j={K:N.getAttribLocation(O,"aVertex"),J:N.getAttribLocation(O,"aTex"),ma:U},v.u=N.createBuffer(),N.bindBuffer(N.ARRAY_BUFFER,v.u),N.enableVertexAttribArray(v.j.K),N.vertexAttribPointer(v.j.K,2,N.FLOAT,!1,0,0),N.bufferData(N.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),N.STATIC_DRAW),N.bindBuffer(N.ARRAY_BUFFER,null),v.s=N.createBuffer(),N.bindBuffer(N.ARRAY_BUFFER,v.s),N.enableVertexAttribArray(v.j.J),N.vertexAttribPointer(v.j.J,2,N.FLOAT,!1,0,0),N.bufferData(N.ARRAY_BUFFER,new Float32Array([0,1,0,0,1,0,1,1]),N.STATIC_DRAW),N.bindBuffer(N.ARRAY_BUFFER,null),N.uniform1i(U,0)}O=v.j,N.useProgram(v.o),N.canvas.width=E.width,N.canvas.height=E.height,N.viewport(0,0,E.width,E.height),N.activeTexture(N.TEXTURE0),v.h.bindTexture2d(E.glName),N.enableVertexAttribArray(O.K),N.bindBuffer(N.ARRAY_BUFFER,v.u),N.vertexAttribPointer(O.K,2,N.FLOAT,!1,0,0),N.enableVertexAttribArray(O.J),N.bindBuffer(N.ARRAY_BUFFER,v.s),N.vertexAttribPointer(O.J,2,N.FLOAT,!1,0,0),N.bindFramebuffer(N.DRAW_FRAMEBUFFER?N.DRAW_FRAMEBUFFER:N.FRAMEBUFFER,null),N.clearColor(0,0,0,0),N.clear(N.COLOR_BUFFER_BIT),N.colorMask(!0,!0,!0,!0),N.drawArrays(N.TRIANGLE_FAN,0,4),N.disableVertexAttribArray(O.K),N.disableVertexAttribArray(O.J),N.bindBuffer(N.ARRAY_BUFFER,null),v.h.bindTexture2d(0)}function ny(v){this.g=v}var ay=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,9,1,7,0,65,0,253,15,26,11]);function iy(v,E){return E+v}function zf(v,E){window[v]=E}function sy(v){var E=document.createElement("script");return E.setAttribute("src",v),E.setAttribute("crossorigin","anonymous"),new Promise(function(N){E.addEventListener("load",function(){N()},!1),E.addEventListener("error",function(){N()},!1),document.body.appendChild(E)})}function ly(){return $(function(v){switch(v.g){case 1:return v.o=2,x(v,WebAssembly.instantiate(ay),4);case 4:v.g=3,v.o=0;break;case 2:return v.o=0,v.j=null,v.return(!1);case 3:return v.return(!0)}})}function $c(v){if(this.g=v,this.listeners={},this.j={},this.H={},this.o={},this.u={},this.I=this.s=this.Z=!0,this.D=Promise.resolve(),this.Y="",this.C={},this.locateFile=v&&v.locateFile||iy,typeof window=="object")var E=window.location.pathname.toString().substring(0,window.location.pathname.toString().lastIndexOf("/"))+"/";else if(typeof location<"u")E=location.pathname.toString().substring(0,location.pathname.toString().lastIndexOf("/"))+"/";else throw Error("solutions can only be loaded on a web page or in a web worker");if(this.$=E,v.options){E=s(Object.keys(v.options));for(var N=E.next();!N.done;N=E.next()){N=N.value;var O=v.options[N].default;O!==void 0&&(this.j[N]=typeof O=="function"?O():O)}}}e=$c.prototype,e.close=function(){return this.i&&this.i.delete(),Promise.resolve()};function cy(v){var E,N,O,U,j,W,Q,oe,de,Te,Ke;return $(function(Xe){switch(Xe.g){case 1:return v.Z?(E=v.g.files===void 0?[]:typeof v.g.files=="function"?v.g.files(v.j):v.g.files,x(Xe,ly(),2)):Xe.return();case 2:if(N=Xe.h,typeof window=="object")return zf("createMediapipeSolutionsWasm",{locateFile:v.locateFile}),zf("createMediapipeSolutionsPackedAssets",{locateFile:v.locateFile}),W=E.filter(function(De){return De.data!==void 0}),Q=E.filter(function(De){return De.data===void 0}),oe=Promise.all(W.map(function(De){var et=Js(v,De.url);if(De.path!==void 0){var kt=De.path;et=et.then(function(Jt){return v.overrideFile(kt,Jt),Promise.resolve(Jt)})}return et})),de=Promise.all(Q.map(function(De){return De.simd===void 0||De.simd&&N||!De.simd&&!N?sy(v.locateFile(De.url,v.$)):Promise.resolve()})).then(function(){var De,et,kt;return $(function(Jt){if(Jt.g==1)return De=window.createMediapipeSolutionsWasm,et=window.createMediapipeSolutionsPackedAssets,kt=v,x(Jt,De(et),2);kt.h=Jt.h,Jt.g=0})}),Te=function(){return $(function(De){return v.g.graph&&v.g.graph.url?De=x(De,Js(v,v.g.graph.url),0):(De.g=0,De=void 0),De})}(),x(Xe,Promise.all([de,oe,Te]),7);if(typeof importScripts!="function")throw Error("solutions can only be loaded on a web page or in a web worker");return O=E.filter(function(De){return De.simd===void 0||De.simd&&N||!De.simd&&!N}).map(function(De){return v.locateFile(De.url,v.$)}),importScripts.apply(null,c(O)),U=v,x(Xe,createMediapipeSolutionsWasm(Module),6);case 6:U.h=Xe.h,v.l=new OffscreenCanvas(1,1),v.h.canvas=v.l,j=v.h.GL.createContext(v.l,{antialias:!1,alpha:!1,ja:typeof WebGL2RenderingContext<"u"?2:1}),v.h.GL.makeContextCurrent(j),Xe.g=4;break;case 7:if(v.l=document.createElement("canvas"),Ke=v.l.getContext("webgl2",{}),!Ke&&(Ke=v.l.getContext("webgl",{}),!Ke))return alert("Failed to create WebGL canvas context when passing video frame."),Xe.return();v.G=Ke,v.h.canvas=v.l,v.h.createContext(v.l,!0,!0,{});case 4:v.i=new v.h.SolutionWasm,v.Z=!1,Xe.g=0}})}function py(v){var E,N,O,U,j,W,Q,oe;return $(function(de){if(de.g==1){if(v.g.graph&&v.g.graph.url&&v.Y===v.g.graph.url)return de.return();if(v.s=!0,!v.g.graph||!v.g.graph.url){de.g=2;return}return v.Y=v.g.graph.url,x(de,Js(v,v.g.graph.url),3)}for(de.g!=2&&(E=de.h,v.i.loadGraph(E)),N=s(Object.keys(v.C)),O=N.next();!O.done;O=N.next())U=O.value,v.i.overrideFile(U,v.C[U]);if(v.C={},v.g.listeners)for(j=s(v.g.listeners),W=j.next();!W.done;W=j.next())Q=W.value,dy(v,Q);oe=v.j,v.j={},v.setOptions(oe),de.g=0})}e.reset=function(){var v=this;return $(function(E){v.i&&(v.i.reset(),v.o={},v.u={}),E.g=0})},e.setOptions=function(v,E){var N=this;if(E=E||this.g.options){for(var O=[],U=[],j={},W=s(Object.keys(v)),Q=W.next();!Q.done;j={R:j.R,S:j.S},Q=W.next()){var oe=Q.value;oe in this.j&&this.j[oe]===v[oe]||(this.j[oe]=v[oe],Q=E[oe],Q!==void 0&&(Q.onChange&&(j.R=Q.onChange,j.S=v[oe],O.push(function(de){return function(){var Te;return $(function(Ke){if(Ke.g==1)return x(Ke,de.R(de.S),2);Te=Ke.h,Te===!0&&(N.s=!0),Ke.g=0})}}(j))),Q.graphOptionXref&&(oe={valueNumber:Q.type===1?v[oe]:0,valueBoolean:Q.type===0?v[oe]:!1,valueString:Q.type===2?v[oe]:""},Q=Object.assign(Object.assign(Object.assign({},{calculatorName:"",calculatorIndex:0}),Q.graphOptionXref),oe),U.push(Q))))}(O.length!==0||U.length!==0)&&(this.s=!0,this.B=(this.B===void 0?[]:this.B).concat(U),this.A=(this.A===void 0?[]:this.A).concat(O))}};function uy(v){var E,N,O,U,j,W,Q;return $(function(oe){switch(oe.g){case 1:if(!v.s)return oe.return();if(!v.A){oe.g=2;break}E=s(v.A),N=E.next();case 3:if(N.done){oe.g=5;break}return O=N.value,x(oe,O(),4);case 4:N=E.next(),oe.g=3;break;case 5:v.A=void 0;case 2:if(v.B){for(U=new v.h.GraphOptionChangeRequestList,j=s(v.B),W=j.next();!W.done;W=j.next())Q=W.value,U.push_back(Q);v.i.changeOptions(U),U.delete(),v.B=void 0}v.s=!1,oe.g=0}})}e.initialize=function(){var v=this;return $(function(E){return E.g==1?x(E,cy(v),2):E.g!=3?x(E,py(v),3):x(E,uy(v),0)})};function Js(v,E){var N,O;return $(function(U){return E in v.H?U.return(v.H[E]):(N=v.locateFile(E,""),O=fetch(N).then(function(j){return j.arrayBuffer()}),v.H[E]=O,U.return(O))})}e.overrideFile=function(v,E){this.i?this.i.overrideFile(v,E):this.C[v]=E},e.clearOverriddenFiles=function(){this.C={},this.i&&this.i.clearOverriddenFiles()},e.send=function(v,E){var N=this,O,U,j,W,Q,oe,de,Te,Ke;return $(function(Xe){switch(Xe.g){case 1:return N.g.inputs?(O=1e3*(E??performance.now()),x(Xe,N.D,2)):Xe.return();case 2:return x(Xe,N.initialize(),3);case 3:for(U=new N.h.PacketDataList,j=s(Object.keys(v)),W=j.next();!W.done;W=j.next())if(Q=W.value,oe=N.g.inputs[Q]){e:{var De=v[Q];switch(oe.type){case"video":var et=N.o[oe.stream];if(et||(et=new zc(N.h,N.G),N.o[oe.stream]=et),et.l===0&&(et.l=et.h.createTexture()),typeof HTMLVideoElement<"u"&&De instanceof HTMLVideoElement)var kt=De.videoWidth,Jt=De.videoHeight;else typeof HTMLImageElement<"u"&&De instanceof HTMLImageElement?(kt=De.naturalWidth,Jt=De.naturalHeight):(kt=De.width,Jt=De.height);Jt={glName:et.l,width:kt,height:Jt},kt=et.g,kt.canvas.width=Jt.width,kt.canvas.height=Jt.height,kt.activeTexture(kt.TEXTURE0),et.h.bindTexture2d(et.l),kt.texImage2D(kt.TEXTURE_2D,0,kt.RGBA,kt.RGBA,kt.UNSIGNED_BYTE,De),et.h.bindTexture2d(0),et=Jt;break e;case"detections":for(et=N.o[oe.stream],et||(et=new ny(N.h),N.o[oe.stream]=et),et.data||(et.data=new et.g.DetectionListData),et.data.reset(De.length),Jt=0;Jt<De.length;++Jt){kt=De[Jt];var qt=et.data,Ur=qt.setBoundingBox,Ro=Jt,mo=kt.boundingBox,At=new Oc;if(Er(At,1,mo.xCenter),Er(At,2,mo.yCenter),Er(At,3,mo.height),Er(At,4,mo.width),Er(At,5,mo.rotation),Er(At,6,mo.rectId),mo=Ys(At,Af),Ur.call(qt,Ro,mo),kt.landmarks)for(qt=0;qt<kt.landmarks.length;++qt){At=kt.landmarks[qt];var Ir=!!At.visibility;Ur=et.data,Ro=Ur.addNormalizedLandmark,mo=Jt,At=Object.assign(Object.assign({},At),{visibility:Ir?At.visibility:0}),Ir=new Qs,Er(Ir,1,At.x),Er(Ir,2,At.y),Er(Ir,3,At.z),At.visibility&&Er(Ir,4,At.visibility),At=Ys(Ir,Cf),Ro.call(Ur,mo,At)}if(kt.V)for(qt=0;qt<kt.V.length;++qt)Ur=et.data,Ro=Ur.addClassification,mo=Jt,At=kt.V[qt],Ir=new ts,Er(Ir,2,At.ga),At.index&&Er(Ir,1,At.index),At.label&&Er(Ir,3,At.label),At.displayName&&Er(Ir,4,At.displayName),At=Ys(Ir,Ef),Ro.call(Ur,mo,At)}et=et.data;break e;default:et={}}}switch(de=et,Te=oe.stream,oe.type){case"video":U.pushTexture2d(Object.assign(Object.assign({},de),{stream:Te,timestamp:O}));break;case"detections":Ke=de,Ke.stream=Te,Ke.timestamp=O,U.pushDetectionList(Ke);break;default:throw Error("Unknown input config type: '"+oe.type+"'")}}return N.i.send(U),x(Xe,N.D,4);case 4:U.delete(),Xe.g=0}})};function my(v,E,N){var O,U,j,W,Q,oe,de,Te,Ke,Xe,De,et,kt,Jt;return $(function(qt){switch(qt.g){case 1:if(!N)return qt.return(E);for(O={},U=0,j=s(Object.keys(N)),W=j.next();!W.done;W=j.next())Q=W.value,oe=N[Q],typeof oe!="string"&&oe.type==="texture"&&E[oe.stream]!==void 0&&++U;1<U&&(v.I=!1),de=s(Object.keys(N)),W=de.next();case 2:if(W.done){qt.g=4;break}if(Te=W.value,Ke=N[Te],typeof Ke=="string")return kt=O,Jt=Te,x(qt,fy(v,Te,E[Ke]),14);if(Xe=E[Ke.stream],Ke.type==="detection_list"){if(Xe){for(var Ur=Xe.getRectList(),Ro=Xe.getLandmarksList(),mo=Xe.getClassificationsList(),At=[],Ir=0;Ir<Ur.size();++Ir){var ia=Dc(Ur.get(Ir),Oc,Af);ia={boundingBox:{xCenter:So(ia,1),yCenter:So(ia,2),height:So(ia,3),width:So(ia,4),rotation:So(ia,5,0),rectId:cf(ia,6)},landmarks:Or(Dc(Ro.get(Ir),Mc,Nf),Qs,1).map(ry),V:ty(Dc(mo.get(Ir),Fc,If))},At.push(ia)}Ur=At}else Ur=[];O[Te]=Ur,qt.g=7;break}if(Ke.type==="proto_list"){if(Xe){for(Ur=Array(Xe.size()),Ro=0;Ro<Xe.size();Ro++)Ur[Ro]=Xe.get(Ro);Xe.delete()}else Ur=[];O[Te]=Ur,qt.g=7;break}if(Xe===void 0){qt.g=3;break}if(Ke.type==="float_list"){O[Te]=Xe,qt.g=7;break}if(Ke.type==="proto"){O[Te]=Xe,qt.g=7;break}if(Ke.type!=="texture")throw Error("Unknown output config type: '"+Ke.type+"'");return De=v.u[Te],De||(De=new zc(v.h,v.G),v.u[Te]=De),x(qt,Pf(De,Xe,v.I),13);case 13:et=qt.h,O[Te]=et;case 7:Ke.transform&&O[Te]&&(O[Te]=Ke.transform(O[Te])),qt.g=3;break;case 14:kt[Jt]=qt.h;case 3:W=de.next(),qt.g=2;break;case 4:return qt.return(O)}})}function fy(v,E,N){var O;return $(function(U){return typeof N=="number"||N instanceof Uint8Array||N instanceof v.h.Uint8BlobList?U.return(N):N instanceof v.h.Texture2dDataOut?(O=v.u[E],O||(O=new zc(v.h,v.G),v.u[E]=O),U.return(Pf(O,N,v.I))):U.return(void 0)})}function dy(v,E){for(var N=E.name||"$",O=[].concat(c(E.wants)),U=new v.h.StringList,j=s(E.wants),W=j.next();!W.done;W=j.next())U.push_back(W.value);j=v.h.PacketListener.implement({onResults:function(Q){for(var oe={},de=0;de<E.wants.length;++de)oe[O[de]]=Q.get(de);var Te=v.listeners[N];Te&&(v.D=my(v,oe,E.outs).then(function(Ke){Ke=Te(Ke);for(var Xe=0;Xe<E.wants.length;++Xe){var De=oe[O[Xe]];typeof De=="object"&&De.hasOwnProperty&&De.hasOwnProperty("delete")&&De.delete()}Ke&&(v.D=Ke)}))}}),v.i.attachMultiListener(U,j),U.delete()}e.onResults=function(v,E){this.listeners[E||"$"]=v},G("Solution",$c),G("OptionType",{BOOL:0,NUMBER:1,ia:2,0:"BOOL",1:"NUMBER",2:"STRING"});function $f(v){var E=this;v=v||{};var N={url:"face_detection_short.binarypb"},O={type:1,graphOptionXref:{calculatorType:"TensorsToDetectionsCalculator",calculatorName:"facedetectionshortrangegpu__facedetectionshortrangecommon__TensorsToDetectionsCalculator",fieldName:"min_score_thresh"}};this.g=new $c({locateFile:v.locateFile,files:[{data:!0,url:"face_detection_short.binarypb"},{data:!0,url:"face_detection_short_range.tflite"},{simd:!0,url:"face_detection_solution_simd_wasm_bin.js"},{simd:!1,url:"face_detection_solution_wasm_bin.js"}],graph:N,listeners:[{wants:["detections","image_transformed"],outs:{image:"image_transformed",detections:{type:"detection_list",stream:"detections"}}}],inputs:{image:{type:"video",stream:"input_frames_gpu"}},options:{useCpuInference:{type:0,graphOptionXref:{calculatorType:"InferenceCalculator",fieldName:"use_cpu_inference"},default:typeof window!="object"||window.navigator===void 0?!1:"iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod".split(";").includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document},selfieMode:{type:0,graphOptionXref:{calculatorType:"GlScalerCalculator",calculatorIndex:1,fieldName:"flip_horizontal"}},model:{type:0,onChange:function(U){var j,W,Q,oe,de,Te;return $(function(Ke){switch(Ke.g){case 1:j=U==="short"?["face_detection_short_range.tflite"]:["face_detection_full_range_sparse.tflite"],W=s(j),Q=W.next();case 2:if(Q.done){Ke.g=4;break}return oe=Q.value,de="third_party/mediapipe/modules/face_detection/"+oe,x(Ke,Js(E.g,oe),5);case 5:Te=Ke.h,E.g.overrideFile(de,Te),Q=W.next(),Ke.g=2;break;case 4:return N.url=U==="short"?"face_detection_short.binarypb":"face_detection_full.binarypb",O.graphOptionXref.calculatorName=U==="short"?"facedetectionshortrangegpu__facedetectionshortrangecommon__TensorsToDetectionsCalculator":"facedetectionfullrangegpu__facedetectionfullrangecommon__TensorsToDetectionsCalculator",Ke.return(!0)}})}},minDetectionConfidence:O}})}e=$f.prototype,e.close=function(){return this.g.close(),Promise.resolve()},e.onResults=function(v){this.g.onResults(v)},e.initialize=function(){var v=this;return $(function(E){return x(E,v.g.initialize(),0)})},e.reset=function(){this.g.reset()},e.send=function(v){var E=this;return $(function(N){return x(N,E.g.send(v),0)})},e.setOptions=function(v){this.g.setOptions(v)},G("FaceDetection",$f),G("FACEDETECTION_LIPS",Rf),G("FACEDETECTION_LEFT_EYE",Pc),G("FACEDETECTION_LEFT_EYEBROW",Zg),G("FACEDETECTION_RIGHT_EYE",Df),G("FACEDETECTION_RIGHT_EYEBROW",Ff),G("FACEDETECTION_FACE_OVAL",Mf),G("FACEDETECTION_CONTOURS",ey),G("FACEDETECTION_TESSELATION",[[127,34],[34,139],[139,127],[11,0],[0,37],[37,11],[232,231],[231,120],[120,232],[72,37],[37,39],[39,72],[128,121],[121,47],[47,128],[232,121],[121,128],[128,232],[104,69],[69,67],[67,104],[175,171],[171,148],[148,175],[118,50],[50,101],[101,118],[73,39],[39,40],[40,73],[9,151],[151,108],[108,9],[48,115],[115,131],[131,48],[194,204],[204,211],[211,194],[74,40],[40,185],[185,74],[80,42],[42,183],[183,80],[40,92],[92,186],[186,40],[230,229],[229,118],[118,230],[202,212],[212,214],[214,202],[83,18],[18,17],[17,83],[76,61],[61,146],[146,76],[160,29],[29,30],[30,160],[56,157],[157,173],[173,56],[106,204],[204,194],[194,106],[135,214],[214,192],[192,135],[203,165],[165,98],[98,203],[21,71],[71,68],[68,21],[51,45],[45,4],[4,51],[144,24],[24,23],[23,144],[77,146],[146,91],[91,77],[205,50],[50,187],[187,205],[201,200],[200,18],[18,201],[91,106],[106,182],[182,91],[90,91],[91,181],[181,90],[85,84],[84,17],[17,85],[206,203],[203,36],[36,206],[148,171],[171,140],[140,148],[92,40],[40,39],[39,92],[193,189],[189,244],[244,193],[159,158],[158,28],[28,159],[247,246],[246,161],[161,247],[236,3],[3,196],[196,236],[54,68],[68,104],[104,54],[193,168],[168,8],[8,193],[117,228],[228,31],[31,117],[189,193],[193,55],[55,189],[98,97],[97,99],[99,98],[126,47],[47,100],[100,126],[166,79],[79,218],[218,166],[155,154],[154,26],[26,155],[209,49],[49,131],[131,209],[135,136],[136,150],[150,135],[47,126],[126,217],[217,47],[223,52],[52,53],[53,223],[45,51],[51,134],[134,45],[211,170],[170,140],[140,211],[67,69],[69,108],[108,67],[43,106],[106,91],[91,43],[230,119],[119,120],[120,230],[226,130],[130,247],[247,226],[63,53],[53,52],[52,63],[238,20],[20,242],[242,238],[46,70],[70,156],[156,46],[78,62],[62,96],[96,78],[46,53],[53,63],[63,46],[143,34],[34,227],[227,143],[123,117],[117,111],[111,123],[44,125],[125,19],[19,44],[236,134],[134,51],[51,236],[216,206],[206,205],[205,216],[154,153],[153,22],[22,154],[39,37],[37,167],[167,39],[200,201],[201,208],[208,200],[36,142],[142,100],[100,36],[57,212],[212,202],[202,57],[20,60],[60,99],[99,20],[28,158],[158,157],[157,28],[35,226],[226,113],[113,35],[160,159],[159,27],[27,160],[204,202],[202,210],[210,204],[113,225],[225,46],[46,113],[43,202],[202,204],[204,43],[62,76],[76,77],[77,62],[137,123],[123,116],[116,137],[41,38],[38,72],[72,41],[203,129],[129,142],[142,203],[64,98],[98,240],[240,64],[49,102],[102,64],[64,49],[41,73],[73,74],[74,41],[212,216],[216,207],[207,212],[42,74],[74,184],[184,42],[169,170],[170,211],[211,169],[170,149],[149,176],[176,170],[105,66],[66,69],[69,105],[122,6],[6,168],[168,122],[123,147],[147,187],[187,123],[96,77],[77,90],[90,96],[65,55],[55,107],[107,65],[89,90],[90,180],[180,89],[101,100],[100,120],[120,101],[63,105],[105,104],[104,63],[93,137],[137,227],[227,93],[15,86],[86,85],[85,15],[129,102],[102,49],[49,129],[14,87],[87,86],[86,14],[55,8],[8,9],[9,55],[100,47],[47,121],[121,100],[145,23],[23,22],[22,145],[88,89],[89,179],[179,88],[6,122],[122,196],[196,6],[88,95],[95,96],[96,88],[138,172],[172,136],[136,138],[215,58],[58,172],[172,215],[115,48],[48,219],[219,115],[42,80],[80,81],[81,42],[195,3],[3,51],[51,195],[43,146],[146,61],[61,43],[171,175],[175,199],[199,171],[81,82],[82,38],[38,81],[53,46],[46,225],[225,53],[144,163],[163,110],[110,144],[52,65],[65,66],[66,52],[229,228],[228,117],[117,229],[34,127],[127,234],[234,34],[107,108],[108,69],[69,107],[109,108],[108,151],[151,109],[48,64],[64,235],[235,48],[62,78],[78,191],[191,62],[129,209],[209,126],[126,129],[111,35],[35,143],[143,111],[117,123],[123,50],[50,117],[222,65],[65,52],[52,222],[19,125],[125,141],[141,19],[221,55],[55,65],[65,221],[3,195],[195,197],[197,3],[25,7],[7,33],[33,25],[220,237],[237,44],[44,220],[70,71],[71,139],[139,70],[122,193],[193,245],[245,122],[247,130],[130,33],[33,247],[71,21],[21,162],[162,71],[170,169],[169,150],[150,170],[188,174],[174,196],[196,188],[216,186],[186,92],[92,216],[2,97],[97,167],[167,2],[141,125],[125,241],[241,141],[164,167],[167,37],[37,164],[72,38],[38,12],[12,72],[38,82],[82,13],[13,38],[63,68],[68,71],[71,63],[226,35],[35,111],[111,226],[101,50],[50,205],[205,101],[206,92],[92,165],[165,206],[209,198],[198,217],[217,209],[165,167],[167,97],[97,165],[220,115],[115,218],[218,220],[133,112],[112,243],[243,133],[239,238],[238,241],[241,239],[214,135],[135,169],[169,214],[190,173],[173,133],[133,190],[171,208],[208,32],[32,171],[125,44],[44,237],[237,125],[86,87],[87,178],[178,86],[85,86],[86,179],[179,85],[84,85],[85,180],[180,84],[83,84],[84,181],[181,83],[201,83],[83,182],[182,201],[137,93],[93,132],[132,137],[76,62],[62,183],[183,76],[61,76],[76,184],[184,61],[57,61],[61,185],[185,57],[212,57],[57,186],[186,212],[214,207],[207,187],[187,214],[34,143],[143,156],[156,34],[79,239],[239,237],[237,79],[123,137],[137,177],[177,123],[44,1],[1,4],[4,44],[201,194],[194,32],[32,201],[64,102],[102,129],[129,64],[213,215],[215,138],[138,213],[59,166],[166,219],[219,59],[242,99],[99,97],[97,242],[2,94],[94,141],[141,2],[75,59],[59,235],[235,75],[24,110],[110,228],[228,24],[25,130],[130,226],[226,25],[23,24],[24,229],[229,23],[22,23],[23,230],[230,22],[26,22],[22,231],[231,26],[112,26],[26,232],[232,112],[189,190],[190,243],[243,189],[221,56],[56,190],[190,221],[28,56],[56,221],[221,28],[27,28],[28,222],[222,27],[29,27],[27,223],[223,29],[30,29],[29,224],[224,30],[247,30],[30,225],[225,247],[238,79],[79,20],[20,238],[166,59],[59,75],[75,166],[60,75],[75,240],[240,60],[147,177],[177,215],[215,147],[20,79],[79,166],[166,20],[187,147],[147,213],[213,187],[112,233],[233,244],[244,112],[233,128],[128,245],[245,233],[128,114],[114,188],[188,128],[114,217],[217,174],[174,114],[131,115],[115,220],[220,131],[217,198],[198,236],[236,217],[198,131],[131,134],[134,198],[177,132],[132,58],[58,177],[143,35],[35,124],[124,143],[110,163],[163,7],[7,110],[228,110],[110,25],[25,228],[356,389],[389,368],[368,356],[11,302],[302,267],[267,11],[452,350],[350,349],[349,452],[302,303],[303,269],[269,302],[357,343],[343,277],[277,357],[452,453],[453,357],[357,452],[333,332],[332,297],[297,333],[175,152],[152,377],[377,175],[347,348],[348,330],[330,347],[303,304],[304,270],[270,303],[9,336],[336,337],[337,9],[278,279],[279,360],[360,278],[418,262],[262,431],[431,418],[304,408],[408,409],[409,304],[310,415],[415,407],[407,310],[270,409],[409,410],[410,270],[450,348],[348,347],[347,450],[422,430],[430,434],[434,422],[313,314],[314,17],[17,313],[306,307],[307,375],[375,306],[387,388],[388,260],[260,387],[286,414],[414,398],[398,286],[335,406],[406,418],[418,335],[364,367],[367,416],[416,364],[423,358],[358,327],[327,423],[251,284],[284,298],[298,251],[281,5],[5,4],[4,281],[373,374],[374,253],[253,373],[307,320],[320,321],[321,307],[425,427],[427,411],[411,425],[421,313],[313,18],[18,421],[321,405],[405,406],[406,321],[320,404],[404,405],[405,320],[315,16],[16,17],[17,315],[426,425],[425,266],[266,426],[377,400],[400,369],[369,377],[322,391],[391,269],[269,322],[417,465],[465,464],[464,417],[386,257],[257,258],[258,386],[466,260],[260,388],[388,466],[456,399],[399,419],[419,456],[284,332],[332,333],[333,284],[417,285],[285,8],[8,417],[346,340],[340,261],[261,346],[413,441],[441,285],[285,413],[327,460],[460,328],[328,327],[355,371],[371,329],[329,355],[392,439],[439,438],[438,392],[382,341],[341,256],[256,382],[429,420],[420,360],[360,429],[364,394],[394,379],[379,364],[277,343],[343,437],[437,277],[443,444],[444,283],[283,443],[275,440],[440,363],[363,275],[431,262],[262,369],[369,431],[297,338],[338,337],[337,297],[273,375],[375,321],[321,273],[450,451],[451,349],[349,450],[446,342],[342,467],[467,446],[293,334],[334,282],[282,293],[458,461],[461,462],[462,458],[276,353],[353,383],[383,276],[308,324],[324,325],[325,308],[276,300],[300,293],[293,276],[372,345],[345,447],[447,372],[352,345],[345,340],[340,352],[274,1],[1,19],[19,274],[456,248],[248,281],[281,456],[436,427],[427,425],[425,436],[381,256],[256,252],[252,381],[269,391],[391,393],[393,269],[200,199],[199,428],[428,200],[266,330],[330,329],[329,266],[287,273],[273,422],[422,287],[250,462],[462,328],[328,250],[258,286],[286,384],[384,258],[265,353],[353,342],[342,265],[387,259],[259,257],[257,387],[424,431],[431,430],[430,424],[342,353],[353,276],[276,342],[273,335],[335,424],[424,273],[292,325],[325,307],[307,292],[366,447],[447,345],[345,366],[271,303],[303,302],[302,271],[423,266],[266,371],[371,423],[294,455],[455,460],[460,294],[279,278],[278,294],[294,279],[271,272],[272,304],[304,271],[432,434],[434,427],[427,432],[272,407],[407,408],[408,272],[394,430],[430,431],[431,394],[395,369],[369,400],[400,395],[334,333],[333,299],[299,334],[351,417],[417,168],[168,351],[352,280],[280,411],[411,352],[325,319],[319,320],[320,325],[295,296],[296,336],[336,295],[319,403],[403,404],[404,319],[330,348],[348,349],[349,330],[293,298],[298,333],[333,293],[323,454],[454,447],[447,323],[15,16],[16,315],[315,15],[358,429],[429,279],[279,358],[14,15],[15,316],[316,14],[285,336],[336,9],[9,285],[329,349],[349,350],[350,329],[374,380],[380,252],[252,374],[318,402],[402,403],[403,318],[6,197],[197,419],[419,6],[318,319],[319,325],[325,318],[367,364],[364,365],[365,367],[435,367],[367,397],[397,435],[344,438],[438,439],[439,344],[272,271],[271,311],[311,272],[195,5],[5,281],[281,195],[273,287],[287,291],[291,273],[396,428],[428,199],[199,396],[311,271],[271,268],[268,311],[283,444],[444,445],[445,283],[373,254],[254,339],[339,373],[282,334],[334,296],[296,282],[449,347],[347,346],[346,449],[264,447],[447,454],[454,264],[336,296],[296,299],[299,336],[338,10],[10,151],[151,338],[278,439],[439,455],[455,278],[292,407],[407,415],[415,292],[358,371],[371,355],[355,358],[340,345],[345,372],[372,340],[346,347],[347,280],[280,346],[442,443],[443,282],[282,442],[19,94],[94,370],[370,19],[441,442],[442,295],[295,441],[248,419],[419,197],[197,248],[263,255],[255,359],[359,263],[440,275],[275,274],[274,440],[300,383],[383,368],[368,300],[351,412],[412,465],[465,351],[263,467],[467,466],[466,263],[301,368],[368,389],[389,301],[395,378],[378,379],[379,395],[412,351],[351,419],[419,412],[436,426],[426,322],[322,436],[2,164],[164,393],[393,2],[370,462],[462,461],[461,370],[164,0],[0,267],[267,164],[302,11],[11,12],[12,302],[268,12],[12,13],[13,268],[293,300],[300,301],[301,293],[446,261],[261,340],[340,446],[330,266],[266,425],[425,330],[426,423],[423,391],[391,426],[429,355],[355,437],[437,429],[391,327],[327,326],[326,391],[440,457],[457,438],[438,440],[341,382],[382,362],[362,341],[459,457],[457,461],[461,459],[434,430],[430,394],[394,434],[414,463],[463,362],[362,414],[396,369],[369,262],[262,396],[354,461],[461,457],[457,354],[316,403],[403,402],[402,316],[315,404],[404,403],[403,315],[314,405],[405,404],[404,314],[313,406],[406,405],[405,313],[421,418],[418,406],[406,421],[366,401],[401,361],[361,366],[306,408],[408,407],[407,306],[291,409],[409,408],[408,291],[287,410],[410,409],[409,287],[432,436],[436,410],[410,432],[434,416],[416,411],[411,434],[264,368],[368,383],[383,264],[309,438],[438,457],[457,309],[352,376],[376,401],[401,352],[274,275],[275,4],[4,274],[421,428],[428,262],[262,421],[294,327],[327,358],[358,294],[433,416],[416,367],[367,433],[289,455],[455,439],[439,289],[462,370],[370,326],[326,462],[2,326],[326,370],[370,2],[305,460],[460,455],[455,305],[254,449],[449,448],[448,254],[255,261],[261,446],[446,255],[253,450],[450,449],[449,253],[252,451],[451,450],[450,252],[256,452],[452,451],[451,256],[341,453],[453,452],[452,341],[413,464],[464,463],[463,413],[441,413],[413,414],[414,441],[258,442],[442,441],[441,258],[257,443],[443,442],[442,257],[259,444],[444,443],[443,259],[260,445],[445,444],[444,260],[467,342],[342,445],[445,467],[459,458],[458,250],[250,459],[289,392],[392,290],[290,289],[290,328],[328,460],[460,290],[376,433],[433,435],[435,376],[250,290],[290,392],[392,250],[411,416],[416,433],[433,411],[341,463],[463,464],[464,341],[453,464],[464,465],[465,453],[357,465],[465,412],[412,357],[343,412],[412,399],[399,343],[360,363],[363,440],[440,360],[437,399],[399,456],[456,437],[420,456],[456,363],[363,420],[401,435],[435,288],[288,401],[372,383],[383,353],[353,372],[339,255],[255,249],[249,339],[448,261],[261,255],[255,448],[133,243],[243,190],[190,133],[133,155],[155,112],[112,133],[33,246],[246,247],[247,33],[33,130],[130,25],[25,33],[398,384],[384,286],[286,398],[362,398],[398,414],[414,362],[362,463],[463,341],[341,362],[263,359],[359,467],[467,263],[263,249],[249,255],[255,263],[466,467],[467,260],[260,466],[75,60],[60,166],[166,75],[238,239],[239,79],[79,238],[162,127],[127,139],[139,162],[72,11],[11,37],[37,72],[121,232],[232,120],[120,121],[73,72],[72,39],[39,73],[114,128],[128,47],[47,114],[233,232],[232,128],[128,233],[103,104],[104,67],[67,103],[152,175],[175,148],[148,152],[119,118],[118,101],[101,119],[74,73],[73,40],[40,74],[107,9],[9,108],[108,107],[49,48],[48,131],[131,49],[32,194],[194,211],[211,32],[184,74],[74,185],[185,184],[191,80],[80,183],[183,191],[185,40],[40,186],[186,185],[119,230],[230,118],[118,119],[210,202],[202,214],[214,210],[84,83],[83,17],[17,84],[77,76],[76,146],[146,77],[161,160],[160,30],[30,161],[190,56],[56,173],[173,190],[182,106],[106,194],[194,182],[138,135],[135,192],[192,138],[129,203],[203,98],[98,129],[54,21],[21,68],[68,54],[5,51],[51,4],[4,5],[145,144],[144,23],[23,145],[90,77],[77,91],[91,90],[207,205],[205,187],[187,207],[83,201],[201,18],[18,83],[181,91],[91,182],[182,181],[180,90],[90,181],[181,180],[16,85],[85,17],[17,16],[205,206],[206,36],[36,205],[176,148],[148,140],[140,176],[165,92],[92,39],[39,165],[245,193],[193,244],[244,245],[27,159],[159,28],[28,27],[30,247],[247,161],[161,30],[174,236],[236,196],[196,174],[103,54],[54,104],[104,103],[55,193],[193,8],[8,55],[111,117],[117,31],[31,111],[221,189],[189,55],[55,221],[240,98],[98,99],[99,240],[142,126],[126,100],[100,142],[219,166],[166,218],[218,219],[112,155],[155,26],[26,112],[198,209],[209,131],[131,198],[169,135],[135,150],[150,169],[114,47],[47,217],[217,114],[224,223],[223,53],[53,224],[220,45],[45,134],[134,220],[32,211],[211,140],[140,32],[109,67],[67,108],[108,109],[146,43],[43,91],[91,146],[231,230],[230,120],[120,231],[113,226],[226,247],[247,113],[105,63],[63,52],[52,105],[241,238],[238,242],[242,241],[124,46],[46,156],[156,124],[95,78],[78,96],[96,95],[70,46],[46,63],[63,70],[116,143],[143,227],[227,116],[116,123],[123,111],[111,116],[1,44],[44,19],[19,1],[3,236],[236,51],[51,3],[207,216],[216,205],[205,207],[26,154],[154,22],[22,26],[165,39],[39,167],[167,165],[199,200],[200,208],[208,199],[101,36],[36,100],[100,101],[43,57],[57,202],[202,43],[242,20],[20,99],[99,242],[56,28],[28,157],[157,56],[124,35],[35,113],[113,124],[29,160],[160,27],[27,29],[211,204],[204,210],[210,211],[124,113],[113,46],[46,124],[106,43],[43,204],[204,106],[96,62],[62,77],[77,96],[227,137],[137,116],[116,227],[73,41],[41,72],[72,73],[36,203],[203,142],[142,36],[235,64],[64,240],[240,235],[48,49],[49,64],[64,48],[42,41],[41,74],[74,42],[214,212],[212,207],[207,214],[183,42],[42,184],[184,183],[210,169],[169,211],[211,210],[140,170],[170,176],[176,140],[104,105],[105,69],[69,104],[193,122],[122,168],[168,193],[50,123],[123,187],[187,50],[89,96],[96,90],[90,89],[66,65],[65,107],[107,66],[179,89],[89,180],[180,179],[119,101],[101,120],[120,119],[68,63],[63,104],[104,68],[234,93],[93,227],[227,234],[16,15],[15,85],[85,16],[209,129],[129,49],[49,209],[15,14],[14,86],[86,15],[107,55],[55,9],[9,107],[120,100],[100,121],[121,120],[153,145],[145,22],[22,153],[178,88],[88,179],[179,178],[197,6],[6,196],[196,197],[89,88],[88,96],[96,89],[135,138],[138,136],[136,135],[138,215],[215,172],[172,138],[218,115],[115,219],[219,218],[41,42],[42,81],[81,41],[5,195],[195,51],[51,5],[57,43],[43,61],[61,57],[208,171],[171,199],[199,208],[41,81],[81,38],[38,41],[224,53],[53,225],[225,224],[24,144],[144,110],[110,24],[105,52],[52,66],[66,105],[118,229],[229,117],[117,118],[227,34],[34,234],[234,227],[66,107],[107,69],[69,66],[10,109],[109,151],[151,10],[219,48],[48,235],[235,219],[183,62],[62,191],[191,183],[142,129],[129,126],[126,142],[116,111],[111,143],[143,116],[118,117],[117,50],[50,118],[223,222],[222,52],[52,223],[94,19],[19,141],[141,94],[222,221],[221,65],[65,222],[196,3],[3,197],[197,196],[45,220],[220,44],[44,45],[156,70],[70,139],[139,156],[188,122],[122,245],[245,188],[139,71],[71,162],[162,139],[149,170],[170,150],[150,149],[122,188],[188,196],[196,122],[206,216],[216,92],[92,206],[164,2],[2,167],[167,164],[242,141],[141,241],[241,242],[0,164],[164,37],[37,0],[11,72],[72,12],[12,11],[12,38],[38,13],[13,12],[70,63],[63,71],[71,70],[31,226],[226,111],[111,31],[36,101],[101,205],[205,36],[203,206],[206,165],[165,203],[126,209],[209,217],[217,126],[98,165],[165,97],[97,98],[237,220],[220,218],[218,237],[237,239],[239,241],[241,237],[210,214],[214,169],[169,210],[140,171],[171,32],[32,140],[241,125],[125,237],[237,241],[179,86],[86,178],[178,179],[180,85],[85,179],[179,180],[181,84],[84,180],[180,181],[182,83],[83,181],[181,182],[194,201],[201,182],[182,194],[177,137],[137,132],[132,177],[184,76],[76,183],[183,184],[185,61],[61,184],[184,185],[186,57],[57,185],[185,186],[216,212],[212,186],[186,216],[192,214],[214,187],[187,192],[139,34],[34,156],[156,139],[218,79],[79,237],[237,218],[147,123],[123,177],[177,147],[45,44],[44,4],[4,45],[208,201],[201,32],[32,208],[98,64],[64,129],[129,98],[192,213],[213,138],[138,192],[235,59],[59,219],[219,235],[141,242],[242,97],[97,141],[97,2],[2,141],[141,97],[240,75],[75,235],[235,240],[229,24],[24,228],[228,229],[31,25],[25,226],[226,31],[230,23],[23,229],[229,230],[231,22],[22,230],[230,231],[232,26],[26,231],[231,232],[233,112],[112,232],[232,233],[244,189],[189,243],[243,244],[189,221],[221,190],[190,189],[222,28],[28,221],[221,222],[223,27],[27,222],[222,223],[224,29],[29,223],[223,224],[225,30],[30,224],[224,225],[113,247],[247,225],[225,113],[99,60],[60,240],[240,99],[213,147],[147,215],[215,213],[60,20],[20,166],[166,60],[192,187],[187,213],[213,192],[243,112],[112,244],[244,243],[244,233],[233,245],[245,244],[245,128],[128,188],[188,245],[188,114],[114,174],[174,188],[134,131],[131,220],[220,134],[174,217],[217,236],[236,174],[236,198],[198,134],[134,236],[215,177],[177,58],[58,215],[156,143],[143,124],[124,156],[25,110],[110,7],[7,25],[31,228],[228,25],[25,31],[264,356],[356,368],[368,264],[0,11],[11,267],[267,0],[451,452],[452,349],[349,451],[267,302],[302,269],[269,267],[350,357],[357,277],[277,350],[350,452],[452,357],[357,350],[299,333],[333,297],[297,299],[396,175],[175,377],[377,396],[280,347],[347,330],[330,280],[269,303],[303,270],[270,269],[151,9],[9,337],[337,151],[344,278],[278,360],[360,344],[424,418],[418,431],[431,424],[270,304],[304,409],[409,270],[272,310],[310,407],[407,272],[322,270],[270,410],[410,322],[449,450],[450,347],[347,449],[432,422],[422,434],[434,432],[18,313],[313,17],[17,18],[291,306],[306,375],[375,291],[259,387],[387,260],[260,259],[424,335],[335,418],[418,424],[434,364],[364,416],[416,434],[391,423],[423,327],[327,391],[301,251],[251,298],[298,301],[275,281],[281,4],[4,275],[254,373],[373,253],[253,254],[375,307],[307,321],[321,375],[280,425],[425,411],[411,280],[200,421],[421,18],[18,200],[335,321],[321,406],[406,335],[321,320],[320,405],[405,321],[314,315],[315,17],[17,314],[423,426],[426,266],[266,423],[396,377],[377,369],[369,396],[270,322],[322,269],[269,270],[413,417],[417,464],[464,413],[385,386],[386,258],[258,385],[248,456],[456,419],[419,248],[298,284],[284,333],[333,298],[168,417],[417,8],[8,168],[448,346],[346,261],[261,448],[417,413],[413,285],[285,417],[326,327],[327,328],[328,326],[277,355],[355,329],[329,277],[309,392],[392,438],[438,309],[381,382],[382,256],[256,381],[279,429],[429,360],[360,279],[365,364],[364,379],[379,365],[355,277],[277,437],[437,355],[282,443],[443,283],[283,282],[281,275],[275,363],[363,281],[395,431],[431,369],[369,395],[299,297],[297,337],[337,299],[335,273],[273,321],[321,335],[348,450],[450,349],[349,348],[359,446],[446,467],[467,359],[283,293],[293,282],[282,283],[250,458],[458,462],[462,250],[300,276],[276,383],[383,300],[292,308],[308,325],[325,292],[283,276],[276,293],[293,283],[264,372],[372,447],[447,264],[346,352],[352,340],[340,346],[354,274],[274,19],[19,354],[363,456],[456,281],[281,363],[426,436],[436,425],[425,426],[380,381],[381,252],[252,380],[267,269],[269,393],[393,267],[421,200],[200,428],[428,421],[371,266],[266,329],[329,371],[432,287],[287,422],[422,432],[290,250],[250,328],[328,290],[385,258],[258,384],[384,385],[446,265],[265,342],[342,446],[386,387],[387,257],[257,386],[422,424],[424,430],[430,422],[445,342],[342,276],[276,445],[422,273],[273,424],[424,422],[306,292],[292,307],[307,306],[352,366],[366,345],[345,352],[268,271],[271,302],[302,268],[358,423],[423,371],[371,358],[327,294],[294,460],[460,327],[331,279],[279,294],[294,331],[303,271],[271,304],[304,303],[436,432],[432,427],[427,436],[304,272],[272,408],[408,304],[395,394],[394,431],[431,395],[378,395],[395,400],[400,378],[296,334],[334,299],[299,296],[6,351],[351,168],[168,6],[376,352],[352,411],[411,376],[307,325],[325,320],[320,307],[285,295],[295,336],[336,285],[320,319],[319,404],[404,320],[329,330],[330,349],[349,329],[334,293],[293,333],[333,334],[366,323],[323,447],[447,366],[316,15],[15,315],[315,316],[331,358],[358,279],[279,331],[317,14],[14,316],[316,317],[8,285],[285,9],[9,8],[277,329],[329,350],[350,277],[253,374],[374,252],[252,253],[319,318],[318,403],[403,319],[351,6],[6,419],[419,351],[324,318],[318,325],[325,324],[397,367],[367,365],[365,397],[288,435],[435,397],[397,288],[278,344],[344,439],[439,278],[310,272],[272,311],[311,310],[248,195],[195,281],[281,248],[375,273],[273,291],[291,375],[175,396],[396,199],[199,175],[312,311],[311,268],[268,312],[276,283],[283,445],[445,276],[390,373],[373,339],[339,390],[295,282],[282,296],[296,295],[448,449],[449,346],[346,448],[356,264],[264,454],[454,356],[337,336],[336,299],[299,337],[337,338],[338,151],[151,337],[294,278],[278,455],[455,294],[308,292],[292,415],[415,308],[429,358],[358,355],[355,429],[265,340],[340,372],[372,265],[352,346],[346,280],[280,352],[295,442],[442,282],[282,295],[354,19],[19,370],[370,354],[285,441],[441,295],[295,285],[195,248],[248,197],[197,195],[457,440],[440,274],[274,457],[301,300],[300,368],[368,301],[417,351],[351,465],[465,417],[251,301],[301,389],[389,251],[394,395],[395,379],[379,394],[399,412],[412,419],[419,399],[410,436],[436,322],[322,410],[326,2],[2,393],[393,326],[354,370],[370,461],[461,354],[393,164],[164,267],[267,393],[268,302],[302,12],[12,268],[312,268],[268,13],[13,312],[298,293],[293,301],[301,298],[265,446],[446,340],[340,265],[280,330],[330,425],[425,280],[322,426],[426,391],[391,322],[420,429],[429,437],[437,420],[393,391],[391,326],[326,393],[344,440],[440,438],[438,344],[458,459],[459,461],[461,458],[364,434],[434,394],[394,364],[428,396],[396,262],[262,428],[274,354],[354,457],[457,274],[317,316],[316,402],[402,317],[316,315],[315,403],[403,316],[315,314],[314,404],[404,315],[314,313],[313,405],[405,314],[313,421],[421,406],[406,313],[323,366],[366,361],[361,323],[292,306],[306,407],[407,292],[306,291],[291,408],[408,306],[291,287],[287,409],[409,291],[287,432],[432,410],[410,287],[427,434],[434,411],[411,427],[372,264],[264,383],[383,372],[459,309],[309,457],[457,459],[366,352],[352,401],[401,366],[1,274],[274,4],[4,1],[418,421],[421,262],[262,418],[331,294],[294,358],[358,331],[435,433],[433,367],[367,435],[392,289],[289,439],[439,392],[328,462],[462,326],[326,328],[94,2],[2,370],[370,94],[289,305],[305,455],[455,289],[339,254],[254,448],[448,339],[359,255],[255,446],[446,359],[254,253],[253,449],[449,254],[253,252],[252,450],[450,253],[252,256],[256,451],[451,252],[256,341],[341,452],[452,256],[414,413],[413,463],[463,414],[286,441],[441,414],[414,286],[286,258],[258,441],[441,286],[258,257],[257,442],[442,258],[257,259],[259,443],[443,257],[259,260],[260,444],[444,259],[260,467],[467,445],[445,260],[309,459],[459,250],[250,309],[305,289],[289,290],[290,305],[305,290],[290,460],[460,305],[401,376],[376,435],[435,401],[309,250],[250,392],[392,309],[376,411],[411,433],[433,376],[453,341],[341,464],[464,453],[357,453],[453,465],[465,357],[343,357],[357,412],[412,343],[437,343],[343,399],[399,437],[344,360],[360,440],[440,344],[420,437],[437,456],[456,420],[360,420],[420,363],[363,360],[361,401],[401,288],[288,361],[265,372],[372,353],[353,265],[390,339],[339,249],[249,390],[339,448],[448,255],[255,339]]),G("VERSION","0.4.1646425229")}.call(pk),pk)}var Bve=B7(),U7=$7(Bve);var Uve=Ne();Uve.registerFlag("KEEP_INTERMEDIATE_TENSORS",()=>!1,e=>{e&&console.warn("Keep intermediate tensors is ON. This will print the values of all intermediate tensors during model inference. Not all models support this mode. For details, check e2e/benchmarks/ model_config.js. This significantly impacts performance.")});var Zn;(function(e){e[e.DT_INVALID=0]="DT_INVALID",e[e.DT_FLOAT=1]="DT_FLOAT",e[e.DT_DOUBLE=2]="DT_DOUBLE",e[e.DT_INT32=3]="DT_INT32",e[e.DT_UINT8=4]="DT_UINT8",e[e.DT_INT16=5]="DT_INT16",e[e.DT_INT8=6]="DT_INT8",e[e.DT_STRING=7]="DT_STRING",e[e.DT_COMPLEX64=8]="DT_COMPLEX64",e[e.DT_INT64=9]="DT_INT64",e[e.DT_BOOL=10]="DT_BOOL",e[e.DT_QINT8=11]="DT_QINT8",e[e.DT_QUINT8=12]="DT_QUINT8",e[e.DT_QINT32=13]="DT_QINT32",e[e.DT_BFLOAT16=14]="DT_BFLOAT16",e[e.DT_QINT16=15]="DT_QINT16",e[e.DT_QUINT16=16]="DT_QUINT16",e[e.DT_UINT16=17]="DT_UINT16",e[e.DT_COMPLEX128=18]="DT_COMPLEX128",e[e.DT_HALF=19]="DT_HALF",e[e.DT_RESOURCE=20]="DT_RESOURCE",e[e.DT_VARIANT=21]="DT_VARIANT",e[e.DT_UINT32=22]="DT_UINT32",e[e.DT_UINT64=23]="DT_UINT64",e[e.DT_FLOAT_REF=101]="DT_FLOAT_REF",e[e.DT_DOUBLE_REF=102]="DT_DOUBLE_REF",e[e.DT_INT32_REF=103]="DT_INT32_REF",e[e.DT_UINT8_REF=104]="DT_UINT8_REF",e[e.DT_INT16_REF=105]="DT_INT16_REF",e[e.DT_INT8_REF=106]="DT_INT8_REF",e[e.DT_STRING_REF=107]="DT_STRING_REF",e[e.DT_COMPLEX64_REF=108]="DT_COMPLEX64_REF",e[e.DT_INT64_REF=109]="DT_INT64_REF",e[e.DT_BOOL_REF=110]="DT_BOOL_REF",e[e.DT_QINT8_REF=111]="DT_QINT8_REF",e[e.DT_QUINT8_REF=112]="DT_QUINT8_REF",e[e.DT_QINT32_REF=113]="DT_QINT32_REF",e[e.DT_BFLOAT16_REF=114]="DT_BFLOAT16_REF",e[e.DT_QINT16_REF=115]="DT_QINT16_REF",e[e.DT_QUINT16_REF=116]="DT_QUINT16_REF",e[e.DT_UINT16_REF=117]="DT_UINT16_REF",e[e.DT_COMPLEX128_REF=118]="DT_COMPLEX128_REF",e[e.DT_HALF_REF=119]="DT_HALF_REF",e[e.DT_RESOURCE_REF=120]="DT_RESOURCE_REF",e[e.DT_VARIANT_REF=121]="DT_VARIANT_REF",e[e.DT_UINT32_REF=122]="DT_UINT32_REF",e[e.DT_UINT64_REF=123]="DT_UINT64_REF"})(Zn||(Zn={}));var W7;(function(e){let t;(function(r){r[r.LEGACY=0]="LEGACY",r[r.V1=1]="V1",r[r.V2=2]="V2"})(t=e.CheckpointFormatVersion||(e.CheckpointFormatVersion={}))})(W7||(W7={}));var Hve={};function uk(e){return Hve[e]}function k(e,t,r,o,n){let a=t.inputParams[e];if(a&&a.inputIndexStart!==void 0){let s=a.inputIndexStart,c=a.inputIndexEnd===0?void 0:a.inputIndexEnd===void 0?s+1:a.inputIndexEnd,l=s<0?t.inputNames.length+s:s;if(a.type==="tensor")return Dr(t.inputNames[l],r,o,n);if(a.type==="tensors"){let m=t.inputs.slice(s,c);return t.inputNames.slice(s,c).filter((d,h)=>{var y;return((y=m[h])===null||y===void 0?void 0:y.op)!=="NoOp"}).map(d=>Dr(d,r,o,n))}let p=Dr(t.inputNames[l],r,o,n),u=p.dataSync();return a.type==="number"?u[0]:S.toNestedArray(p.shape,u)}let i=t.attrParams[e];return i&&i.value}function Dr(e,t,r,o){let[n,a]=Wo(e,r);if(o!=null){let s=o.getHashTableHandleByName(n);if(s!=null)return s}let i=r.currentContextIds.find(s=>!!t[mk(n,s)]);return i!==void 0?t[mk(n,i)][a]:void 0}function dA(e,t,r){return t[mk(e,r.currentContextId)]}function ii(e,t){let[r,o,n]=Wo(e,t);return[mk(r,t&&t.currentContextId),o,n]}function mk(e,t){return t?`${e}-${t}`:e}function Wo(e,t){if(e==="")return["",0,void 0];let r=t!=null&&t.parseNodeNameCache!=null;if(r){let a=t.parseNodeNameCache.get(e);if(a!=null)return a}let o=e.split(":"),n;if(o.length===1)n=[e,0,void 0];else{let a=o[0],i=o.length===3?o[1]:void 0,s=Number(o[o.length-1]);n=[a,s,i]}return r&&t.parseNodeNameCache.set(e,n),n}function _b(e,t,r){let o=k("pad",e,t,r);if(o==="explicit"){o=k("explicitPaddings",e,t,r);let n=[[0,0],[0,0],[0,0],[0,0]];for(let a=0;a<4;a++)n[a][0]=o[a*2],n[a][1]=o[a*2+1];return n}return o}function si(e){return e.kept?e:Rn(e)}var hA={};Ot(hA,{json:()=>Vve});var Vve=[{tfOpName:"Add",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"AddV2",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"AddN",category:"arithmetic",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}]},{tfOpName:"BiasAdd",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"Sub",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"RealDiv",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Div",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"DivNoNan",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"FloorDiv",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Mul",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Maximum",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Minimum",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Pow",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SquaredDifference",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Mod",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"FloorMod",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}];var gA={};Ot(gA,{json:()=>jve});var jve=[{tfOpName:"Abs",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Acos",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Asin",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atan2",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"y",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Ceil",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ClipByValue",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"clipValueMin",type:"number"},{start:2,name:"clipValueMax",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Complex",category:"basic_math",inputs:[{start:0,name:"real",type:"tensor"},{start:1,name:"imag",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ComplexAbs",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Cos",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Cosh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Elu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Exp",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Floor",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Log",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Imag",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"Tout",name:"outputType",type:"dtype",notSupported:!0}]},{tfOpName:"Neg",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Real",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"Tout",name:"outputType",type:"dtype",notSupported:!0}]},{tfOpName:"Prelu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"alpha",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Relu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Relu6",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Selu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sigmoid",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sin",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sinh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sqrt",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Rsqrt",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Square",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Tan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Tanh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sign",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Round",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Expm1",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Log1p",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Reciprocal",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Softplus",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Asinh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Acosh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atanh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Erf",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LeakyRelu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"alpha",name:"alpha",type:"number",defaultValue:.2},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"IsNan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"IsFinite",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"IsInf",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}];var yA={};Ot(yA,{json:()=>Gve});var Gve=[{tfOpName:"EmptyTensorList",category:"control",inputs:[{start:0,name:"elementShape",type:"shape"},{start:1,name:"maxNumElements",type:"number"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"LoopCond",category:"control",inputs:[{start:0,name:"pred",type:"tensor"}]},{tfOpName:"Switch",category:"control",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"pred",type:"tensor"}]},{tfOpName:"Merge",category:"control",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}]},{tfOpName:"Enter",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"frame_name",name:"frameName",type:"string"},{tfName:"is_constant",name:"isConstant",type:"bool"}]},{tfOpName:"Exit",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"NextIteration",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayV3",category:"control",inputs:[{start:0,name:"size",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape",name:"elementShape",type:"shape"},{tfName:"dynamic_size",name:"dynamicSize",type:"bool"},{tfName:"clear_after_read",name:"clearAfterRead",type:"bool"},{tfName:"identical_element_shapes",name:"identicalElementShapes",type:"bool"},{tfName:"tensor_array_name",name:"name",type:"string"}]},{tfOpName:"TensorArrayWriteV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"tensor",type:"tensor"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayReadV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayGatherV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape",name:"elementShape",type:"shape"}]},{tfOpName:"TensorArrayScatterV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"tensor",type:"tensor"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"TensorArrayConcatV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape_except0",name:"elementShapeExcept0",type:"shape",notSupported:!0}]},{tfOpName:"TensorArraySplitV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"tensor",type:"tensor"},{start:2,name:"lengths",type:"number[]"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"TensorArraySizeV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"},{start:1,name:"flowIn",type:"number"}]},{tfOpName:"TensorArrayCloseV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"tensor"}]},{tfOpName:"StatelessIf",category:"control",inputs:[{start:0,name:"cond",type:"tensor"},{start:1,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"then_branch",name:"thenBranch",type:"func"},{tfName:"else_branch",name:"elseBranch",type:"func"}]},{tfOpName:"If",category:"control",inputs:[{start:0,name:"cond",type:"tensor"},{start:1,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"then_branch",name:"thenBranch",type:"func"},{tfName:"else_branch",name:"elseBranch",type:"func"}]},{tfOpName:"StatelessWhile",category:"control",inputs:[{start:0,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"cond",name:"cond",type:"func"},{tfName:"body",name:"body",type:"func"}]},{tfOpName:"While",category:"control",inputs:[{start:0,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"cond",name:"cond",type:"func"},{tfName:"body",name:"body",type:"func"}]},{tfOpName:"TensorListScatter",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListScatterV2",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"elementShape",type:"shape"},{start:3,name:"numElements",type:"number"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListGather",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"indices",type:"number[]"},{start:2,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListGetItem",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListSetItem",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"index",type:"number"},{start:2,name:"tensor",type:"tensor"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListReserve",category:"control",inputs:[{start:0,name:"elementShape",type:"shape"},{start:1,name:"numElements",type:"number"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListFromTensor",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListStack",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"},{tfName:"num_elements",name:"numElements",type:"dtype"}]},{tfOpName:"TensorListSplit",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"elementShape",type:"shape"},{start:2,name:"lengths",type:"number[]"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListConcat",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"}],attrs:[{tfName:"element_shape",name:"elementShape",type:"shape"},{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListConcatV2",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"}],attrs:[{tfName:"element_shape",name:"elementShape",type:"shape"},{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListPopBack",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"elementShape",type:"shape"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListPushBack",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"tensor",type:"tensor"}],attrs:[{tfName:"element_dtype",name:"elementDType",type:"dtype"}]},{tfOpName:"TensorListLength",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"}]},{tfOpName:"TensorListResize",category:"control",inputs:[{start:0,name:"tensorListId",type:"tensor"},{start:1,name:"size",type:"number"}]}];var vA={};Ot(vA,{json:()=>qve});var qve=[{tfOpName:"AvgPool",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPool",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[],notSupported:!0},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPoolWithArgmax",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"include_batch_in_index",name:"includeBatchInIndex",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"AvgPool3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPool3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Conv1D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"stride",name:"stride",type:"number"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NWC"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"dilation",name:"dilation",type:"number",defaultValue:1}]},{tfOpName:"Conv2D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"useCudnnOnGpu",name:"useCudnnOnGpu",type:"bool"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"_FusedConv2D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"use_cudnn_on_gpu",name:"useCudnnOnGpu",type:"bool",defaultValue:!0},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]",defaultValue:[1,1,1,1]},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]},{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:1e-4},{tfName:"leakyrelu_alpha",name:"leakyreluAlpha",type:"number",defaultValue:.2}]},{tfOpName:"Conv2DBackpropInput",category:"convolution",inputs:[{start:2,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:0,name:"outputShape",type:"number[]"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]",notSupported:!0}]},{tfOpName:"DepthwiseConv2d",category:"convolution",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"DepthwiseConv2dNative",category:"convolution",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"FusedDepthwiseConv2dNative",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]",defaultValue:[1,1,1,1]},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]}]},{tfOpName:"Conv3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"Dilation2D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"rates",name:"dilations",type:"number[]"},{tfName:"padding",name:"pad",type:"string"}]}];var bA={};Ot(bA,{json:()=>Kve});var Kve=[{tfOpName:"Fill",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"},{start:1,name:"value",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"LinSpace",category:"creation",inputs:[{start:0,name:"start",type:"number"},{start:1,name:"stop",type:"number"},{start:2,name:"num",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"OneHot",category:"creation",inputs:[{start:0,name:"indices",type:"tensor"},{start:1,name:"depth",type:"number"},{start:2,name:"onValue",type:"number",defaultValue:1},{start:3,name:"offValue",type:"number",defaultValue:0}],attrs:[{tfName:"axis",name:"axis",type:"number",notSupported:!0},{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"Ones",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"OnesLike",category:"creation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"RandomStandardNormal",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"seed",name:"seed",type:"number",defaultValue:0},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0},{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"T",name:"T",type:"number",notSupported:!0}]},{tfOpName:"RandomUniform",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"minval",name:"minval",type:"number",defaultValue:0},{tfName:"maxval",name:"maxval",type:"number",defaultValue:1},{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"seed",name:"seed",type:"number",defaultValue:0},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0},{tfName:"T",name:"T",type:"number",notSupported:!0}]},{tfOpName:"RandomUniformInt",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"minval",name:"minval",type:"number"},{tfName:"maxval",name:"maxval",type:"number"},{tfName:"seed",name:"seed",type:"number",defaultValue:0},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0}]},{tfOpName:"Range",category:"creation",inputs:[{start:0,name:"start",type:"number"},{start:1,name:"stop",type:"number"},{start:2,name:"step",type:"number",defaultValue:0}],attrs:[{tfName:"Tidx",name:"dtype",type:"dtype"}]},{tfOpName:"TruncatedNormal",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"means",name:"mean",type:"number",defaultValue:0},{tfName:"stddev",name:"stdDev",type:"number",defaultValue:1},{tfName:"seed",name:"seed",type:"number"},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0},{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"T",name:"T",type:"number",notSupported:!0}]},{tfOpName:"Zeros",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"ZerosLike",category:"creation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"Multinomial",category:"creation",inputs:[{start:0,name:"logits",type:"tensor"},{start:1,name:"numSamples",type:"number"}],attrs:[{tfName:"seed",name:"seed",type:"number"},{tfName:"seed2",name:"seed2",type:"number"},{tfName:"T",name:"dtype",type:"dtype"},{tfName:"output_dtype",name:"output_dtype",type:"dtype"}]}];var xA={};Ot(xA,{json:()=>Xve});var Xve=[{tfOpName:"NonMaxSuppressionV2",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"}]},{tfOpName:"NonMaxSuppressionV3",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"},{start:4,name:"scoreThreshold",type:"number"}]},{tfOpName:"NonMaxSuppressionV4",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"},{start:4,name:"scoreThreshold",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"T_threshold",name:"threshold",type:"dtype",notSupported:!0},{tfName:"pad_to_max_output_size",name:"padToMaxOutputSize",type:"bool"}]},{tfOpName:"NonMaxSuppressionV5",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"},{start:4,name:"scoreThreshold",type:"number"},{start:5,name:"softNmsSigma",type:"number"}]},{tfOpName:"Where",category:"dynamic",inputs:[{start:0,name:"condition",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ListDiff",category:"dynamic",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"y",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}];var wA={};Ot(wA,{json:()=>Yve});var Yve=[{tfOpName:"LowerBound",category:"evaluation",inputs:[{start:0,name:"sortedSequence",type:"tensor"},{start:1,name:"values",type:"tensor"}]},{tfOpName:"TopKV2",category:"evaluation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"k",type:"number"}],attrs:[{tfName:"sorted",name:"sorted",type:"bool"}]},{tfOpName:"UpperBound",category:"evaluation",inputs:[{start:0,name:"sortedSequence",type:"tensor"},{start:1,name:"values",type:"tensor"}]},{tfOpName:"Unique",category:"evaluation",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"UniqueV2",category:"evaluation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]}];var SA={};Ot(SA,{json:()=>Qve});var Qve=[{tfOpName:"PlaceholderWithDefault",category:"graph",inputs:[{start:0,name:"default",type:"tensor"}],attrs:[{tfName:"shape",name:"shape",type:"shape"},{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"Placeholder",category:"graph",attrs:[{tfName:"shape",name:"shape",type:"shape"},{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"Const",category:"graph"},{tfOpName:"Identity",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"IdentityN",category:"graph",inputs:[{start:0,end:0,name:"x",type:"tensors"}]},{tfOpName:"Snapshot",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Rank",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Size",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Shape",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"ShapeN",category:"graph",inputs:[{start:0,end:0,name:"x",type:"tensors"}]},{tfOpName:"Print",category:"graph",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"data",type:"tensors"}],attrs:[{tfName:"message",name:"message",type:"string"},{tfName:"first_n",name:"firstN",type:"number",notSupported:!0},{tfName:"summarize",name:"summarize",type:"number",defaultValue:3}]},{tfOpName:"NoOp",category:"graph",inputs:[]},{tfOpName:"StopGradient",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"FakeQuantWithMinMaxVars",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"min",name:"min",type:"number"},{tfName:"max",name:"max",type:"number"}]}];var kA={};Ot(kA,{json:()=>Jve});var Jve=[{tfOpName:"HashTable",category:"hash_table",inputs:[],attrs:[{tfName:"shared_name",name:"sharedName",type:"string"},{tfName:"use_node_name_sharing",name:"useNodeNameSharing",type:"bool"},{tfName:"key_dtype",name:"keyDType",type:"dtype"},{tfName:"value_dtype",name:"valueDType",type:"dtype"}]},{tfOpName:"HashTableV2",category:"hash_table",inputs:[],attrs:[{tfName:"shared_name",name:"sharedName",type:"string"},{tfName:"use_node_name_sharing",name:"useNodeNameSharing",type:"bool"},{tfName:"key_dtype",name:"keyDType",type:"dtype"},{tfName:"value_dtype",name:"valueDType",type:"dtype"}]},{tfOpName:"LookupTableImport",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"values",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableImportV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"values",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableFind",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableFindV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableSize",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"}]},{tfOpName:"LookupTableSizeV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"}]},{tfOpName:"InitializeTable",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"values",type:"tensor"}]},{tfOpName:"InitializeTableV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"values",type:"tensor"}]}];var _A={};Ot(_A,{json:()=>Zve});var Zve=[{tfOpName:"ResizeBilinear",category:"image",inputs:[{start:0,name:"images",type:"tensor"},{start:1,name:"size",type:"number[]"}],attrs:[{tfName:"align_corners",name:"alignCorners",type:"bool"},{tfName:"half_pixel_centers",name:"halfPixelCenters",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ResizeNearestNeighbor",category:"image",inputs:[{start:0,name:"images",type:"tensor"},{start:1,name:"size",type:"number[]"}],attrs:[{tfName:"align_corners",name:"alignCorners",type:"bool"},{tfName:"half_pixel_centers",name:"halfPixelCenters",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"CropAndResize",category:"image",inputs:[{start:0,name:"image",type:"tensor"},{start:1,name:"boxes",type:"tensor"},{start:2,name:"boxInd",type:"tensor"},{start:3,name:"cropSize",type:"number[]"}],attrs:[{tfName:"method",name:"method",type:"string"},{tfName:"extrapolation_value",name:"extrapolationValue",type:"number"}]},{tfOpName:"ImageProjectiveTransformV3",category:"image",inputs:[{start:0,name:"images",type:"tensor"},{start:1,name:"transforms",type:"tensor"},{start:2,name:"outputShape",type:"number[]"},{start:3,name:"fillValue",type:"number"}],attrs:[{tfName:"interpolation",name:"interpolation",type:"string"},{tfName:"fill_mode",name:"fillMode",type:"string"}]}];var EA={};Ot(EA,{json:()=>ebe});var ebe=[{tfOpName:"Equal",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"NotEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Greater",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"GreaterEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Less",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LessEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalAnd",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalNot",category:"logical",inputs:[{start:0,name:"a",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalOr",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Select",category:"logical",inputs:[{start:0,name:"condition",type:"tensor"},{start:1,name:"a",type:"tensor"},{start:2,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SelectV2",category:"logical",inputs:[{start:0,name:"condition",type:"tensor"},{start:1,name:"a",type:"tensor"},{start:2,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"BitwiseAnd",category:"logical",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"y",type:"tensor"}]}];var IA={};Ot(IA,{json:()=>tbe});var tbe=[{tfOpName:"_FusedMatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]},{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:1e-4},{tfName:"transpose_a",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"transpose_b",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"leakyrelu_alpha",name:"leakyreluAlpha",type:"number",defaultValue:.2},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"transpose_a",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"transpose_b",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"BatchMatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"adj_x",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"adj_y",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"BatchMatMulV2",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"adj_x",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"adj_y",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Transpose",category:"matrices",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"perm",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Einsum",category:"matrices",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}],attrs:[{tfName:"equation",name:"equation",type:"string"},{tfName:"N",name:"n",type:"number",defaultValue:2},{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"MatrixBandPart",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"numLower",type:"tensor"},{start:1,name:"numUpper",type:"tensor"}]}];var TA={};Ot(TA,{json:()=>rbe});var rbe=[{tfOpName:"EuclideanNorm",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool",defaultValue:!1}]},{tfOpName:"FusedBatchNorm",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"FusedBatchNormV2",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"FusedBatchNormV3",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"LRN",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"depth_radius",name:"radius",type:"number",defaultValue:5},{tfName:"bias",name:"bias",type:"number",defaultValue:1},{tfName:"alpha",name:"alpha",type:"number",defaultValue:1},{tfName:"beta",name:"beta",type:"number",defaultValue:.5}]},{tfOpName:"Softmax",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"LogSoftmax",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}]}];var CA={};Ot(CA,{json:()=>obe});var obe=[{tfOpName:"Bincount",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"size",type:"number"},{start:2,name:"weights",type:"tensor"}]},{tfOpName:"DenseBincount",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"size",type:"number"},{start:2,name:"weights",type:"tensor"}],attrs:[{tfName:"binary_output",name:"binaryOutput",type:"bool"}]},{tfOpName:"Max",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Mean",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Min",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Sum",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"All",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Any",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"ArgMax",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"ArgMin",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"Prod",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Cumprod",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}],attrs:[{tfName:"exclusive",name:"exclusive",type:"bool"},{tfName:"reverse",name:"reverse",type:"bool"}]},{tfOpName:"Cumsum",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}],attrs:[{tfName:"exclusive",name:"exclusive",type:"bool"},{tfName:"reverse",name:"reverse",type:"bool"}]}];var NA={};Ot(NA,{json:()=>nbe});var nbe=[{tfOpName:"ConcatV2",category:"slice_join",inputs:[{start:0,end:-1,name:"tensors",type:"tensors"},{start:-1,name:"axis",type:"number"}],attrs:[{tfName:"N",name:"n",type:"number",defaultValue:2}]},{tfOpName:"Concat",category:"slice_join",inputs:[{start:1,end:0,name:"tensors",type:"tensors"},{start:0,name:"axis",type:"number"}],attrs:[{tfName:"N",name:"n",type:"number",defaultValue:2}]},{tfOpName:"GatherV2",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"axis",type:"number",defaultValue:0}],attrs:[{tfName:"batch_dims",name:"batchDims",type:"number",defaultValue:0}]},{tfOpName:"Gather",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"}],attrs:[{tfName:"validate_indices",name:"validateIndices",type:"bool",notSupported:!0}]},{tfOpName:"Reverse",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"dims",type:"bool[]"}]},{tfOpName:"ReverseV2",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}]},{tfOpName:"Slice",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"begin",type:"number[]"},{start:2,name:"size",type:"number[]"}]},{tfOpName:"StridedSlice",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"begin",type:"number[]"},{start:2,name:"end",type:"number[]"},{start:3,name:"strides",type:"number[]"}],attrs:[{tfName:"begin_mask",name:"beginMask",type:"number",defaultValue:0},{tfName:"end_mask",name:"endMask",type:"number",defaultValue:0},{tfName:"new_axis_mask",name:"newAxisMask",type:"number",defaultValue:0},{tfName:"ellipsis_mask",name:"ellipsisMask",type:"number",defaultValue:0},{tfName:"shrink_axis_mask",name:"shrinkAxisMask",type:"number",defaultValue:0}]},{tfOpName:"Pack",category:"slice_join",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}],attrs:[{tfName:"axis",name:"axis",type:"number",defaultValue:0}]},{tfOpName:"Unpack",category:"slice_join",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"axis",name:"axis",type:"number",defaultValue:0},{tfName:"num",name:"num",type:"number",defaultValue:0,notSupported:!0}]},{tfOpName:"Tile",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"reps",type:"number[]"}]},{tfOpName:"Split",category:"slice_join",inputs:[{start:0,name:"axis",type:"number",defaultValue:0},{start:1,name:"x",type:"tensor"}],attrs:[{tfName:"num_split",name:"numOrSizeSplits",type:"number",defaultValue:1}]},{tfOpName:"SplitV",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"numOrSizeSplits",type:"number[]"},{start:2,name:"axis",type:"number",defaultValue:0}]},{tfOpName:"ScatterNd",category:"slice_join",inputs:[{start:0,name:"indices",type:"tensor"},{start:1,name:"values",type:"tensor"},{start:2,name:"shape",type:"number[]"}]},{tfOpName:"GatherNd",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"}]},{tfOpName:"SparseToDense",category:"slice_join",inputs:[{start:0,name:"sparseIndices",type:"tensor"},{start:1,name:"outputShape",type:"number[]"},{start:2,name:"sparseValues",type:"tensor"},{start:3,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"validate_indices",name:"validateIndices",type:"bool",defaultValue:!1,notSupported:!0}]},{tfOpName:"TensorScatterUpdate",category:"slice_join",inputs:[{start:0,name:"tensor",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"values",type:"tensor"}]}];var AA={};Ot(AA,{json:()=>abe});var abe=[{tfOpName:"SparseFillEmptyRows",category:"sparse",inputs:[{start:0,name:"indices",type:"tensor"},{start:1,name:"values",type:"tensor"},{start:2,name:"denseShape",type:"tensor"},{start:3,name:"defaultValue",type:"tensor"}]},{tfOpName:"SparseReshape",category:"sparse",inputs:[{start:0,name:"inputIndices",type:"tensor"},{start:1,name:"inputShape",type:"tensor"},{start:2,name:"newShape",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SparseSegmentMean",category:"sparse",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"segmentIds",type:"tensor"}]},{tfOpName:"SparseSegmentSum",category:"sparse",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"segmentIds",type:"tensor"}]}];var RA={};Ot(RA,{json:()=>ibe});var ibe=[{tfOpName:"FFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"IFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"RFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"fft_length",type:"number",notSupported:!0}]},{tfOpName:"IRFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"fft_length",type:"number",notSupported:!0}]}];var DA={};Ot(DA,{json:()=>sbe});var sbe=[{tfOpName:"StaticRegexReplace",category:"string",inputs:[{start:0,name:"input",type:"tensor"}],attrs:[{tfName:"pattern",name:"pattern",type:"string"},{tfName:"rewrite",name:"rewrite",type:"string"},{tfName:"replace_global",name:"replaceGlobal",type:"bool"}]},{tfOpName:"StringNGrams",category:"string",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"dataSplits",type:"tensor"}],attrs:[{tfName:"separator",name:"separator",type:"string"},{tfName:"ngram_widths",name:"nGramWidths",type:"number[]"},{tfName:"left_pad",name:"leftPad",type:"string"},{tfName:"right_pad",name:"rightPad",type:"string"},{tfName:"pad_width",name:"padWidth",type:"number"},{tfName:"preserve_short_sequences",name:"preserveShortSequences",type:"bool"}],outputs:["ngrams","ngrams_splits"]},{tfOpName:"StringSplit",category:"string",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"delimiter",type:"tensor"}],attrs:[{tfName:"skip_empty",name:"skipEmpty",type:"bool"}],outputs:["indices","values","shape"]},{tfOpName:"StringToHashBucketFast",category:"string",inputs:[{start:0,name:"input",type:"tensor"}],attrs:[{tfName:"num_buckets",name:"numBuckets",type:"number"}]}];var FA={};Ot(FA,{json:()=>lbe});var lbe=[{tfOpName:"Cast",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"SrcT",name:"sdtype",type:"dtype",notSupported:!0},{tfName:"DstT",name:"dtype",type:"dtype"}]},{tfOpName:"ExpandDims",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"MirrorPad",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"}],attrs:[{tfName:"mode",name:"mode",type:"string"}]},{tfOpName:"Pad",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"}],attrs:[{tfName:"constant_value",name:"constantValue",type:"number",defaultValue:0}]},{tfOpName:"PadV2",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"},{start:2,name:"constantValue",type:"number",defaultValue:0}]},{tfOpName:"Reshape",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"shape",type:"number[]"}]},{tfOpName:"EnsureShape",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"shape",type:"number[]"}]},{tfOpName:"Squeeze",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"axis",tfDeprecatedName:"squeeze_dims",name:"axis",type:"number[]"}]},{tfOpName:"SpaceToBatchND",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"blockShape",type:"number[]"},{start:2,name:"paddings",type:"number[]"}]},{tfOpName:"BatchToSpaceND",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"blockShape",type:"number[]"},{start:2,name:"crops",type:"number[]"}]},{tfOpName:"DepthToSpace",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"block_size",name:"blockSize",type:"number"},{tfName:"data_format",name:"dataFormat",type:"string"}]},{tfOpName:"BroadcastTo",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"shape",type:"number[]"}],attrs:[]},{tfOpName:"BroadcastArgs",category:"transformation",inputs:[{start:0,name:"s0",type:"tensor"},{start:1,name:"s1",type:"tensor"}],attrs:[]}];var Eb=class{static get Instance(){return this._instance||(this._instance=new this)}constructor(){let t=[hA,gA,yA,vA,bA,xA,wA,SA,kA,_A,EA,IA,TA,CA,NA,AA,RA,DA,FA],r=[].concat(...t.map(o=>o.json));this.opMappers=r.reduce((o,n)=>(o[n.tfOpName]=n,o),{})}transformGraph(t,r={}){let o=t.node,n=[],a=[],i=[],s=o.reduce((h,y)=>(h[y.name]=this.mapNode(y),y.op.startsWith("Placeholder")?n.push(h[y.name]):y.op==="Const"?a.push(h[y.name]):(y.input==null||y.input.length===0)&&i.push(h[y.name]),h),{}),c=[],l=[],p={},u={};r!=null&&(p=this.mapSignatureEntries(r.inputs),u=this.mapSignatureEntries(r.outputs));let m=Object.keys(s);m.forEach(h=>{let y=s[h];y.inputNames.forEach((g,b)=>{let[x,,w]=ii(g),I=s[x];if(I.outputs!=null){let C=I.outputs.indexOf(w);if(C!==-1){let R=`${x}:${C}`;y.inputNames[b]=R}}y.inputs.push(I),I.children.push(y)})}),Object.keys(u).length===0?m.forEach(h=>{let y=s[h];y.children.length===0&&l.push(y)}):Object.keys(u).forEach(h=>{let[y]=ii(h),g=s[y];g!=null&&(g.signatureKey=u[h],l.push(g))}),Object.keys(p).length>0?Object.keys(p).forEach(h=>{let[y]=ii(h),g=s[y];g&&(g.signatureKey=p[h],c.push(g))}):c=n;let f={};t.library!=null&&t.library.function!=null&&(f=t.library.function.reduce((h,y)=>(h[y.signature.name]=this.mapFunction(y),h),{}));let d={nodes:s,inputs:c,outputs:l,weights:a,placeholders:n,signature:r,functions:f};return i.length>0&&(d.initNodes=i),d}mapSignatureEntries(t){return Object.keys(t||{}).reduce((r,o)=>(r[t[o].name]=o,r),{})}mapNode(t){let r=uk(t.op)||this.opMappers[t.op]||{};t.attr==null&&(t.attr={});let o={name:t.name,op:t.op,category:r.category,inputNames:(t.input||[]).map(n=>n.startsWith("^")?n.slice(1):n),inputs:[],children:[],inputParams:{},attrParams:{},rawAttrs:t.attr,outputs:r.outputs};return r.inputs!=null&&(o.inputParams=r.inputs.reduce((n,a)=>(n[a.name]={type:a.type,inputIndexStart:a.start,inputIndexEnd:a.end},n),{})),r.attrs!=null&&(o.attrParams=r.attrs.reduce((n,a)=>{let i=a.type,s;switch(a.type){case"string":s=fk(t.attr,a.tfName,a.defaultValue),s===void 0&&a.tfDeprecatedName&&(s=fk(t.attr,a.tfDeprecatedName,a.defaultValue));break;case"string[]":s=xk(t.attr,a.tfName,a.defaultValue),s===void 0&&a.tfDeprecatedName&&(s=xk(t.attr,a.tfDeprecatedName,a.defaultValue));break;case"number":s=hk(t.attr,a.tfName,a.defaultValue||0),s===void 0&&a.tfDeprecatedName&&(s=hk(t.attr,a.tfDeprecatedName,a.defaultValue));break;case"number[]":s=bk(t.attr,a.tfName,a.defaultValue),s===void 0&&a.tfDeprecatedName&&(s=bk(t.attr,a.tfDeprecatedName,a.defaultValue));break;case"bool":s=dk(t.attr,a.tfName,a.defaultValue),s===void 0&&a.tfDeprecatedName&&(s=dk(t.attr,a.tfDeprecatedName,a.defaultValue));break;case"bool[]":s=Sk(t.attr,a.tfName,a.defaultValue),s===void 0&&a.tfDeprecatedName&&(s=Sk(t.attr,a.tfDeprecatedName,a.defaultValue));break;case"shape":s=vk(t.attr,a.tfName,a.defaultValue),s===void 0&&a.tfDeprecatedName&&(s=vk(t.attr,a.tfDeprecatedName,a.defaultValue));break;case"shape[]":s=wk(t.attr,a.tfName,a.defaultValue),s===void 0&&a.tfDeprecatedName&&(s=wk(t.attr,a.tfDeprecatedName,a.defaultValue));break;case"dtype":s=gk(t.attr,a.tfName,a.defaultValue),s===void 0&&a.tfDeprecatedName&&(s=gk(t.attr,a.tfDeprecatedName,a.defaultValue));break;case"dtype[]":s=yk(t.attr,a.tfName,a.defaultValue),s===void 0&&a.tfDeprecatedName&&(s=yk(t.attr,a.tfDeprecatedName,a.defaultValue));break;case"func":s=H7(t.attr,a.tfName,a.defaultValue),s===void 0&&a.tfDeprecatedName&&(s=H7(t.attr,a.tfDeprecatedName,a.defaultValue));break;case"tensor":case"tensors":break;default:throw new Error(`Unsupported param type: ${a.type} for op: ${t.op}`)}return n[a.name]={value:s,type:i},n},{})),o}mapFunction(t){let r=t.nodeDef,o=[],n=[],a={};r!=null&&(a=r.reduce((u,m)=>(u[m.name]=this.mapNode(m),m.op==="Const"&&n.push(u[m.name]),u),{}));let i=[],s=[];t.signature.inputArg.forEach(u=>{let[m]=ii(u.name),f={name:m,op:"Placeholder",inputs:[],inputNames:[],category:"graph",inputParams:{},attrParams:{dtype:{value:MA(u.type),type:"dtype"}},children:[]};f.signatureKey=u.name,i.push(f),a[m]=f}),Object.keys(a).forEach(u=>{let m=a[u];m.inputNames.forEach((f,d)=>{let[h,,y]=ii(f),g=a[h];if(g.outputs!=null){let b=g.outputs.indexOf(y);if(b!==-1){let x=`${h}:${b}`;m.inputNames[d]=x}}m.inputs.push(g),g.children.push(m)})});let l=t.ret;t.signature.outputArg.forEach(u=>{let[m,f]=ii(l[u.name]),d=a[m];d!=null&&(d.defaultOutput=f,s.push(d))});let p=this.mapArgsToSignature(t);return{nodes:a,inputs:i,outputs:s,weights:n,placeholders:o,signature:p}}mapArgsToSignature(t){return{methodName:t.signature.name,inputs:t.signature.inputArg.reduce((r,o)=>(r[o.name]=this.mapArgToTensorInfo(o),r),{}),outputs:t.signature.outputArg.reduce((r,o)=>(r[o.name]=this.mapArgToTensorInfo(o,t.ret),r),{})}}mapArgToTensorInfo(t,r){let o=t.name;return r!=null&&(o=r[o]),{name:o,dtype:t.type}}};function cbe(e){let t=Ne().global;if(typeof t.atob<"u")return t.atob(e);if(typeof Buffer<"u")return new Buffer(e,"base64").toString();throw new Error("Unable to decode base64 in this environment. Missing built-in atob() or Buffer()")}function V7(e,t){let r=Array.isArray(e)?String.fromCharCode.apply(null,e):cbe(e);return t?r:r.toLowerCase()}function fk(e,t,r,o=!1){let n=e[t];return n!=null?V7(n.s,o):r}function dk(e,t,r){let o=e[t];return o?o.b:r}function hk(e,t,r){let o=e[t]||{},n=o.i!=null?o.i:o.f!=null?o.f:r;return typeof n=="number"?n:parseInt(n,10)}function MA(e){switch(typeof e=="string"&&(e=Zn[e]),e){case Zn.DT_FLOAT:case Zn.DT_HALF:return"float32";case Zn.DT_INT32:case Zn.DT_INT64:case Zn.DT_INT8:case Zn.DT_UINT8:return"int32";case Zn.DT_BOOL:return"bool";case Zn.DT_DOUBLE:return"float32";case Zn.DT_STRING:return"string";default:return null}}function H7(e,t,r){let o=e[t];return o&&o.func?o.func.name:r}function gk(e,t,r){let o=e[t];return o&&o.type?MA(o.type):r}function yk(e,t,r){let o=e[t];return o&&o.list&&o.list.type?o.list.type.map(n=>MA(n)):r}function j7(e){if(!e.unknownRank)return e.dim!=null?e.dim.map(t=>typeof t.size=="number"?t.size:parseInt(t.size,10)):[]}function vk(e,t,r){let o=e[t];return o&&o.shape?j7(o.shape):r}function bk(e,t,r){let o=e[t];return o?((o.list.f&&o.list.f.length?o.list.f:o.list.i)||[]).map(n=>typeof n=="number"?n:parseInt(n,10)):r}function xk(e,t,r,o=!1){let n=e[t];return n&&n.list&&n.list.s?n.list.s.map(a=>V7(a,o)):r}function wk(e,t,r){let o=e[t];return o&&o.list&&o.list.shape?o.list.shape.map(n=>j7(n)):r}function Sk(e,t,r){let o=e[t];return o&&o.list&&o.list.b?o.list.b:r}var kk=class{constructor(t,r,o){this.node=t,this.tensorMap=r,this.context=o,this.inputs=[],this.attrs={},this.inputs=t.inputNames.map(n=>this.getInput(n)),t.rawAttrs!=null&&(this.attrs=Object.keys(t.rawAttrs).reduce((n,a)=>(n[a]=this.getAttr(a),n),{}))}getInput(t){return Dr(t,this.tensorMap,this.context)}getAttr(t,r){let o=this.node.rawAttrs[t];if(o.tensor!=null)return Dr(t,this.tensorMap,this.context);if(o.i!=null||o.f!=null)return hk(this.node.rawAttrs,t,r);if(o.s!=null)return fk(this.node.rawAttrs,t,r);if(o.b!=null)return dk(this.node.rawAttrs,t,r);if(o.shape!=null)return vk(this.node.rawAttrs,t,r);if(o.type!=null)return gk(this.node.rawAttrs,t,r);if(o.list!=null){if(o.list.i!=null||o.list.f!=null)return bk(this.node.rawAttrs,t,r);if(o.list.s!=null)return xk(this.node.rawAttrs,t,r);if(o.list.shape!=null)return wk(this.node.rawAttrs,t,r);if(o.list.b!=null)return Sk(this.node.rawAttrs,t,r);if(o.list.type!=null)return yk(this.node.rawAttrs,t,r)}return r}};var wt={};Ot(wt,{OP_SCOPE_SUFFIX:()=>R3,abs:()=>so,acos:()=>ZL,acosh:()=>eB,add:()=>be,addN:()=>tB,all:()=>rB,any:()=>oB,argMax:()=>nB,argMin:()=>aB,asin:()=>iB,asinh:()=>sB,atan:()=>lB,atan2:()=>cB,atanh:()=>pB,avgPool:()=>cS,avgPool3d:()=>fB,basicLSTMCell:()=>dB,batchNorm:()=>Xl,batchNorm2d:()=>gB,batchNorm3d:()=>yB,batchNorm4d:()=>vB,batchToSpaceND:()=>pS,bincount:()=>uS,bitwiseAnd:()=>bB,booleanMaskAsync:()=>Hhe,broadcastArgs:()=>xB,broadcastTo:()=>Yl,buffer:()=>Re,cast:()=>pt,ceil:()=>wB,clipByValue:()=>mS,clone:()=>Rn,complex:()=>nn,concat:()=>Gt,concat1d:()=>SB,concat2d:()=>kB,concat3d:()=>_B,concat4d:()=>EB,conv1d:()=>IB,conv2d:()=>Ql,conv2dTranspose:()=>TB,conv3d:()=>CB,conv3dTranspose:()=>AB,cos:()=>RB,cosh:()=>DB,cosineWindow:()=>vb,cumprod:()=>FB,cumsum:()=>MB,denseBincount:()=>OB,depthToSpace:()=>PB,depthwiseConv2d:()=>jh,diag:()=>zB,dilation2d:()=>$B,div:()=>je,divNoNan:()=>BB,dot:()=>UB,dropout:()=>tge,einsum:()=>Jl,elu:()=>gS,enclosingPowerOfTwo:()=>eA,ensureShape:()=>WB,equal:()=>hS,erf:()=>HB,euclideanNorm:()=>GB,exp:()=>ln,expandDims:()=>Dn,expm1:()=>qB,eye:()=>yS,fft:()=>Kh,fill:()=>Pi,floor:()=>vS,floorDiv:()=>lS,fused:()=>tA,gather:()=>bS,gatherND:()=>Zhe,greater:()=>_m,greaterEqual:()=>xS,ifft:()=>Am,imag:()=>ec,image:()=>bb,inTopKAsync:()=>oge,irfft:()=>BS,isFinite:()=>KB,isInf:()=>XB,isNaN:()=>YB,leakyRelu:()=>wS,less:()=>gb,lessEqual:()=>Gh,linalg:()=>aye,linspace:()=>QB,localResponseNormalization:()=>JB,log:()=>Ms,log1p:()=>SS,logSigmoid:()=>eU,logSoftmax:()=>tU,logSumExp:()=>_S,logicalAnd:()=>Em,logicalNot:()=>ES,logicalOr:()=>IS,logicalXor:()=>rU,losses:()=>iye,lowerBound:()=>oU,matMul:()=>Dt,max:()=>zi,maxPool:()=>CS,maxPool3d:()=>nU,maxPoolWithArgmax:()=>aU,maximum:()=>NS,mean:()=>Im,meshgrid:()=>iU,min:()=>hb,minimum:()=>Tm,mirrorPad:()=>sU,mod:()=>lU,moments:()=>cU,movingAverage:()=>Ghe,mul:()=>ce,multiRNNCell:()=>pU,multinomial:()=>uU,neg:()=>vo,norm:()=>km,notEqual:()=>AS,oneHot:()=>mU,ones:()=>Li,onesLike:()=>fU,op:()=>T,outerProduct:()=>dU,pad:()=>Bi,pad1d:()=>hU,pad2d:()=>gU,pad3d:()=>yU,pad4d:()=>vU,pool:()=>bU,pow:()=>Fs,prelu:()=>DS,print:()=>iS,prod:()=>xU,raggedGather:()=>wU,raggedRange:()=>SU,raggedTensorToTensor:()=>kU,rand:()=>_U,randomGamma:()=>UU,randomNormal:()=>zS,randomStandardNormal:()=>WU,randomUniform:()=>qh,randomUniformInt:()=>HU,range:()=>tc,real:()=>Os,reciprocal:()=>VU,relu:()=>rc,relu6:()=>$S,reshape:()=>K,reverse:()=>Qn,reverse1d:()=>jU,reverse2d:()=>GU,reverse3d:()=>qU,reverse4d:()=>KU,rfft:()=>Xh,round:()=>LS,rsqrt:()=>XU,scalar:()=>$e,scatterND:()=>Khe,searchSorted:()=>yb,selu:()=>YU,separableConv2d:()=>QU,setdiff1dAsync:()=>JU,sigmoid:()=>Sa,sign:()=>ZU,signal:()=>nye,sin:()=>e9,sinh:()=>t9,slice:()=>We,slice1d:()=>r9,slice2d:()=>o9,slice3d:()=>n9,slice4d:()=>a9,softmax:()=>i9,softplus:()=>kS,spaceToBatchND:()=>RS,sparse:()=>sye,sparseToDense:()=>Qhe,spectral:()=>oye,split:()=>Ps,sqrt:()=>sn,square:()=>lo,squaredDifference:()=>US,squeeze:()=>Lr,stack:()=>Uo,step:()=>WS,stridedSlice:()=>s9,string:()=>lye,sub:()=>Fe,sum:()=>Ft,tan:()=>l9,tanh:()=>db,tensor:()=>go,tensor1d:()=>yr,tensor2d:()=>ai,tensor3d:()=>HS,tensor4d:()=>c9,tensor5d:()=>p9,tensor6d:()=>u9,tensorScatterUpdate:()=>f9,tile:()=>Zl,topk:()=>d9,transpose:()=>GS,truncatedNormal:()=>h9,unique:()=>g9,unsortedSegmentSum:()=>y9,unstack:()=>Jn,upperBound:()=>v9,variable:()=>b9,where:()=>Yn,whereAsync:()=>jS,zeros:()=>$i,zerosLike:()=>Gr});var G7=(e,t,r,o=wt)=>{switch(e.op){case"BiasAdd":case"AddV2":case"Add":return[o.add(k("a",e,t,r),k("b",e,t,r))];case"AddN":return[o.addN(k("tensors",e,t,r))];case"FloorMod":case"Mod":return[o.mod(k("a",e,t,r),k("b",e,t,r))];case"Mul":return[o.mul(k("a",e,t,r),k("b",e,t,r))];case"RealDiv":case"Div":return[o.div(k("a",e,t,r),k("b",e,t,r))];case"DivNoNan":return[o.divNoNan(k("a",e,t,r),k("b",e,t,r))];case"FloorDiv":return[o.floorDiv(k("a",e,t,r),k("b",e,t,r))];case"Sub":return[o.sub(k("a",e,t,r),k("b",e,t,r))];case"Minimum":return[o.minimum(k("a",e,t,r),k("b",e,t,r))];case"Maximum":return[o.maximum(k("a",e,t,r),k("b",e,t,r))];case"Pow":return[o.pow(k("a",e,t,r),k("b",e,t,r))];case"SquaredDifference":return[o.squaredDifference(k("a",e,t,r),k("b",e,t,r))];default:throw TypeError(`Node type ${e.op} is not implemented`)}};var q7=(e,t,r,o=wt)=>{switch(e.op){case"Abs":case"ComplexAbs":return[o.abs(k("x",e,t,r))];case"Acos":return[o.acos(k("x",e,t,r))];case"Acosh":return[o.acosh(k("x",e,t,r))];case"Asin":return[o.asin(k("x",e,t,r))];case"Asinh":return[o.asinh(k("x",e,t,r))];case"Atan":return[o.atan(k("x",e,t,r))];case"Atan2":return[o.atan2(k("x",e,t,r),k("y",e,t,r))];case"Atanh":return[o.atanh(k("x",e,t,r))];case"Ceil":return[o.ceil(k("x",e,t,r))];case"Complex":return[o.complex(k("real",e,t,r),k("imag",e,t,r))];case"Cos":return[o.cos(k("x",e,t,r))];case"Cosh":return[o.cosh(k("x",e,t,r))];case"Elu":return[o.elu(k("x",e,t,r))];case"Erf":return[o.erf(k("x",e,t,r))];case"Exp":return[o.exp(k("x",e,t,r))];case"Expm1":return[o.expm1(k("x",e,t,r))];case"Floor":return[o.floor(k("x",e,t,r))];case"Log":return[o.log(k("x",e,t,r))];case"Log1p":return[o.log1p(k("x",e,t,r))];case"Imag":return[o.imag(k("x",e,t,r))];case"Neg":return[o.neg(k("x",e,t,r))];case"Reciprocal":return[o.reciprocal(k("x",e,t,r))];case"Real":return[o.real(k("x",e,t,r))];case"Relu":return[o.relu(k("x",e,t,r))];case"Round":return[o.round(k("x",e,t,r))];case"Selu":return[o.selu(k("x",e,t,r))];case"Sigmoid":return[o.sigmoid(k("x",e,t,r))];case"Sin":return[o.sin(k("x",e,t,r))];case"Sign":return[o.sign(k("x",e,t,r))];case"Sinh":return[o.sinh(k("x",e,t,r))];case"Softplus":return[o.softplus(k("x",e,t,r))];case"Sqrt":return[o.sqrt(k("x",e,t,r))];case"Square":return[o.square(k("x",e,t,r))];case"Tanh":return[o.tanh(k("x",e,t,r))];case"Tan":return[o.tan(k("x",e,t,r))];case"ClipByValue":return[o.clipByValue(k("x",e,t,r),k("clipValueMin",e,t,r),k("clipValueMax",e,t,r))];case"Relu6":return[o.relu6(k("x",e,t,r))];case"Rsqrt":return[o.rsqrt(Dr(e.inputNames[0],t,r))];case"LeakyRelu":return[o.leakyRelu(k("x",e,t,r),k("alpha",e,t,r))];case"Prelu":return[o.prelu(k("x",e,t,r),k("alpha",e,t,r))];case"IsNan":return[o.isNaN(Dr(e.inputNames[0],t,r))];case"IsInf":return[o.isInf(Dr(e.inputNames[0],t,r))];case"IsFinite":return[o.isFinite(Dr(e.inputNames[0],t,r))];default:throw TypeError(`Node type ${e.op} is not implemented`)}};function Fn(e,t,r=""){if(!(typeof e=="number"||typeof t=="number")){S.assert(e.length===t.length,()=>r+` Shapes ${e} and ${t} must match`);for(let o=0;o<e.length;o++){let n=e[o],a=t[o];S.assert(n<0||a<0||n===a,()=>r+` Shapes ${e} and ${t} must match`)}}}function K7(e){return!(typeof e=="number"||e.some(t=>t<0))}function Zh(e,t,r){let o=_k(e,r),n=!K7(o);if(n&&t.length===0)throw new Error(`Tried to calculate elements of an empty list with non-fully-defined elementShape: ${o}`);if(n&&t.forEach(a=>{o=_k(a.shape,o)}),!K7(o))throw new Error(`Non-fully-defined elementShape: ${o}`);return o}function _k(e,t){if(typeof e=="number")return t;if(typeof t=="number")return e;if(e.length!==t.length)throw new Error(`Incompatible ranks during merge: ${e} vs. ${t}`);let r=[];for(let o=0;o<e.length;++o){let n=e[o],a=t[o];if(n>=0&&a>=0&&n!==a)throw new Error(`Incompatible shape during merge: ${e} vs. ${t}`);r[o]=n>=0?n:a}return r}var Ek=class{constructor(t,r,o,n,a,i,s){this.name=t,this.dtype=r,this.maxSize=o,this.elementShape=n,this.identicalElementShapes=a,this.dynamicSize=i,this.clearAfterRead=s,this.tensors=[],this.closed_=!1,this.idTensor=$e(0),an(this.idTensor)}get id(){return this.idTensor.id}get closed(){return this.closed_}clearAndClose(t){this.tensors.forEach(r=>{(t==null||!t.has(r.tensor.id))&&r.tensor.dispose()}),this.tensors=[],this.closed_=!0,this.idTensor.dispose()}size(){return this.tensors.length}read(t){if(this.closed_)throw new Error(`TensorArray ${this.name} has already been closed.`);if(t<0||t>=this.size())throw new Error(`Tried to read from index ${t}, but array size is: ${this.size()}`);let r=this.tensors[t];if(r.cleared)throw new Error(`TensorArray ${this.name}: Could not read index ${t} twice because it was cleared after a previous read (perhaps try setting clear_after_read = false?).`);return this.clearAfterRead&&(r.cleared=!0),r.read=!0,r.tensor}readMany(t){return t.map(r=>this.read(r))}write(t,r){if(this.closed_)throw new Error(`TensorArray ${this.name} has already been closed.`);if(t<0||!this.dynamicSize&&t>=this.maxSize)throw new Error(`Tried to write to index ${t}, but array is not resizeable and size is: ${this.maxSize}`);let o=this.tensors[t]||{};if(r.dtype!==this.dtype)throw new Error(`TensorArray ${this.name}: Could not write to TensorArray index ${t},
127
+ because the value dtype is ${r.dtype}, but TensorArray dtype is ${this.dtype}.`);if(this.size()===0&&(this.elementShape==null||this.elementShape.length===0)&&(this.elementShape=r.shape),Fn(this.elementShape,r.shape,`TensorArray ${this.name}: Could not write to TensorArray index ${t}.`),o.read)throw new Error(`TensorArray ${this.name}: Could not write to TensorArray index ${t}, because it has already been read.`);if(o.written)throw new Error(`TensorArray ${this.name}: Could not write to TensorArray index ${t}, because it has already been written.`);o.tensor=r,an(r),o.written=!0,this.tensors[t]=o}writeMany(t,r){if(t.length!==r.length)throw new Error(`TensorArray ${this.name}: could not write multiple tensors,because the index size: ${t.length} is not the same as tensors size: ${r.length}.`);t.forEach((o,n)=>this.write(o,r[n]))}gather(t,r){if(r&&r!==this.dtype)throw new Error(`TensorArray dtype is ${this.dtype} but gather requested dtype ${r}`);if(t)t=t.slice(0,this.size());else{t=[];for(let n=0;n<this.size();n++)t.push(n)}if(t.length===0)return go([],[0].concat(this.elementShape));let o=this.readMany(t);return Fn(this.elementShape,o[0].shape,"TensorArray shape mismatch: "),Uo(o,0)}concat(t){if(t&&t!==this.dtype)throw new Error(`TensorArray dtype is ${this.dtype} but concat requested dtype ${t}`);if(this.size()===0)return go([],[0].concat(this.elementShape));let r=[];for(let n=0;n<this.size();n++)r.push(n);let o=this.readMany(r);return Fn(this.elementShape,o[0].shape,`TensorArray shape mismatch: tensor array shape (${this.elementShape}) vs first tensor shape (${o[0].shape})`),Gt(o,0)}scatter(t,r){if(r.dtype!==this.dtype)throw new Error(`TensorArray dtype is ${this.dtype} but tensor has dtype ${r.dtype}`);if(t.length!==r.shape[0])throw new Error(`Expected len(indices) == tensor.shape[0], but saw: ${t.length} vs. ${r.shape[0]}`);let o=Math.max(...t);if(!this.dynamicSize&&o>=this.maxSize)throw new Error(`Max index must be < array size (${o} vs. ${this.maxSize})`);this.writeMany(t,Jn(r,0))}split(t,r){if(r.dtype!==this.dtype)throw new Error(`TensorArray dtype is ${this.dtype} but tensor has dtype ${r.dtype}`);let o=0,n=t.map(c=>(o+=c,o));if(o!==r.shape[0])throw new Error(`Expected sum of lengths to be equal to
128
+ tensor.shape[0], but sum of lengths is
129
+ ${o}, and tensor's shape is: ${r.shape}`);if(!this.dynamicSize&&t.length!==this.maxSize)throw new Error(`TensorArray's size is not equal to the size of lengths (${this.maxSize} vs. ${t.length}), and the TensorArray is not marked as dynamically resizeable`);let a=o===0?0:r.size/o,i=[];He(()=>{r=K(r,[1,o,a]);for(let c=0;c<t.length;++c){let p=[0,c===0?0:n[c-1],0],u=[1,t[c],a];i[c]=K(We(r,p,u),this.elementShape)}return i});let s=[];for(let c=0;c<t.length;c++)s[c]=c;this.writeMany(s,i)}};var eg=class e{get id(){return this.idTensor.id}constructor(t,r,o,n=-1){this.tensors=t,this.elementShape=r,this.elementDtype=o,t?.forEach(a=>{if(o!==a.dtype)throw new Error(`Invalid data types; op elements ${o}, but list elements ${a.dtype}`);Fn(r,a.shape,"TensorList shape mismatch: "),an(a)}),this.idTensor=$e(0),this.maxNumElements=n,an(this.idTensor)}copy(){return new e([...this.tensors],this.elementShape,this.elementDtype)}clearAndClose(t){this.tensors.forEach(r=>{(t==null||!t.has(r.id))&&r.dispose()}),this.tensors.length=0,this.idTensor.dispose()}size(){return this.tensors.length}stack(t,r,o=-1){if(r!==this.elementDtype)throw new Error(`Invalid data types; op elements ${r}, but list elements ${this.elementDtype}`);if(o!==-1&&this.tensors.length!==o)throw new Error(`Operation expected a list with ${o} elements but got a list with ${this.tensors.length} elements.`);Fn(t,this.elementShape,"TensorList shape mismatch: ");let n=Zh(this.elementShape,this.tensors,t);return He(()=>{let a=this.tensors.map(i=>K(i,n));return Uo(a,0)})}popBack(t,r){if(r!==this.elementDtype)throw new Error(`Invalid data types; op elements ${r}, but list elements ${this.elementDtype}`);if(this.size()===0)throw new Error("Trying to pop from an empty list.");let o=Zh(this.elementShape,this.tensors,t),n=this.tensors.pop();return n.kept=!1,Fn(n.shape,t,"TensorList shape mismatch: "),K(n,o)}pushBack(t){if(t.dtype!==this.elementDtype)throw new Error(`Invalid data types; op elements ${t.dtype}, but list elements ${this.elementDtype}`);if(Fn(t.shape,this.elementShape,"TensorList shape mismatch: "),this.maxNumElements===this.size())throw new Error("Trying to push element into a full list.");an(t),this.tensors.push(t)}resize(t){if(t<0)throw new Error(`TensorListResize expects size to be non-negative. Got: ${t}`);if(this.maxNumElements!==-1&&t>this.maxNumElements)throw new Error(`TensorListResize input size ${t} is greater maxNumElement ${this.maxNumElements}.`);let r=new e([],this.elementShape,this.elementDtype,this.maxNumElements);r.tensors.length=t;for(let o=0;o<Math.min(this.tensors.length,t);++o)r.tensors[o]=this.tensors[o];return r}getItem(t,r,o){if(o!==this.elementDtype)throw new Error(`Invalid data types; op elements ${o}, but list elements ${this.elementDtype}`);if(t<0||t>this.tensors.length)throw new Error(`Trying to access element ${t} in a list with ${this.tensors.length} elements.`);if(this.tensors[t]==null)throw new Error(`element at index ${t} is null.`);Fn(this.tensors[t].shape,r,"TensorList shape mismatch: ");let n=Zh(this.elementShape,this.tensors,r);return K(this.tensors[t],n)}setItem(t,r){if(r.dtype!==this.elementDtype)throw new Error(`Invalid data types; op elements ${r.dtype}, but list elements ${this.elementDtype}`);if(t<0||this.maxNumElements!==-1&&t>=this.maxNumElements)throw new Error(`Trying to set element ${t} in a list with max ${this.maxNumElements} elements.`);Fn(this.elementShape,r.shape,"TensorList shape mismatch: "),an(r),this.tensors[t]!=null&&(this.tensors[t].kept=!1),this.tensors[t]=r}gather(t,r,o){if(r!==this.elementDtype)throw new Error(`Invalid data types; op elements ${r}, but list elements ${this.elementDtype}`);Fn(this.elementShape,o,"TensorList shape mismatch: "),t=t.slice(0,this.size());let n=Zh(this.elementShape,this.tensors,o);return t.length===0?go([],[0].concat(n)):He(()=>{let a=t.map(i=>K(this.tensors[i],n));return Uo(a,0)})}concat(t,r){if(t&&t!==this.elementDtype)throw new Error(`TensorList dtype is ${this.elementDtype} but concat requested dtype ${t}`);Fn(this.elementShape,r,"TensorList shape mismatch: ");let o=Zh(this.elementShape,this.tensors,r);return this.size()===0?go([],[0].concat(o)):He(()=>{let n=this.tensors.map(a=>K(a,o));return Gt(n,0)})}};function X7(e,t,r){let o=e.dtype;if(e.shape.length<1)throw new Error(`Tensor must be at least a vector, but saw shape: ${e.shape}`);if(e.dtype!==r)throw new Error(`Invalid data types; op elements ${e.dtype}, but list elements ${r}`);let n=e.shape.slice(1);Fn(n,t,"TensorList shape mismatch: ");let a=Jn(e);return new eg(a,t,o)}function Y7(e,t,r,o){return new eg([],e,t,o)}function Q7(e,t,r,o){if(t.length!==e.shape[0])throw new Error(`Expected len(indices) == tensor.shape[0], but saw: ${t.length} vs. ${e.shape[0]}`);let n=Math.max(...t);if(o!=null&&o!==-1&&n>=o)throw new Error(`Max index must be < array size (${n} vs. ${o})`);let a=new eg([],r,e.dtype,o),i=Jn(e,0);return t.forEach((s,c)=>{a.setItem(s,i[c])}),a}function J7(e,t,r){let o=0,n=t.map(p=>(o+=p,o));if(o!==e.shape[0])throw new Error(`Expected sum of lengths to be equal to
130
+ tensor.shape[0], but sum of lengths is
131
+ ${o}, and tensor's shape is: ${e.shape}`);let a=e.shape.slice(1),i=_k(a,r),s=o===0?0:e.size/o,c=He(()=>{let p=[];e=K(e,[1,o,s]);for(let u=0;u<t.length;++u){let f=[0,u===0?0:n[u-1],0],d=[1,t[u],s];p[u]=K(We(e,f,d),i)}return e.dispose(),p}),l=new eg([],r,e.dtype,t.length);for(let p=0;p<c.length;p++)l.setItem(p,c[p]);return l}var Z7=async(e,t,r)=>{switch(e.op){case"If":case"StatelessIf":{let o=k("thenBranch",e,t,r),n=k("elseBranch",e,t,r),a=k("cond",e,t,r),i=k("args",e,t,r);return(await a.data())[0]?r.functionMap[o].executeFunctionAsync(i,r.tensorArrayMap,r.tensorListMap):r.functionMap[n].executeFunctionAsync(i,r.tensorArrayMap,r.tensorListMap)}case"While":case"StatelessWhile":{let o=k("body",e,t,r),n=k("cond",e,t,r),a=k("args",e,t,r),i=await r.functionMap[n].executeFunctionAsync(a,r.tensorArrayMap,r.tensorListMap),s=a.map(p=>p.id),c=await i[0].data();i.forEach(p=>{!p.kept&&s.indexOf(p.id)===-1&&p.dispose()});let l=a;for(;c[0];){let p=l;l=await r.functionMap[o].executeFunctionAsync(l,r.tensorArrayMap,r.tensorListMap);let u=l.map(f=>f.id);p.forEach(f=>{!f.kept&&s.indexOf(f.id)===-1&&u.indexOf(f.id)===-1&&f.dispose()});let m=await r.functionMap[n].executeFunctionAsync(l,r.tensorArrayMap,r.tensorListMap);c=await m[0].data(),m.forEach(f=>{!f.kept&&s.indexOf(f.id)===-1&&u.indexOf(f.id)===-1&&f.dispose()})}return l}case"LoopCond":{let o=k("pred",e,t,r);return[si(o)]}case"Switch":{let o=k("pred",e,t,r),n=k("data",e,t,r);return n.kept||(n=si(n)),(await o.data())[0]?[void 0,n]:[n,void 0]}case"Merge":{let o=e.inputNames.find(n=>Dr(n,t,r)!==void 0);if(o){let n=Dr(o,t,r);return[si(n)]}return}case"Enter":{let o=k("frameName",e,t,r),n=k("tensor",e,t,r);return r.enterFrame(o),[si(n)]}case"Exit":{let o=k("tensor",e,t,r);return r.exitFrame(),[si(o)]}case"NextIteration":{let o=k("tensor",e,t,r);return r.nextIteration(),[si(o)]}case"TensorArrayV3":{let o=k("size",e,t,r),n=k("dtype",e,t,r),a=k("elementShape",e,t,r),i=k("dynamicSize",e,t,r),s=k("clearAfterRead",e,t,r),c=k("identicalElementShapes",e,t,r),l=k("name",e,t,r),p=new Ek(l,n,o,a,c,i,s);return r.addTensorArray(p),[p.idTensor,$e(1)]}case"TensorArrayWriteV3":{let o=k("tensorArrayId",e,t,r),n=k("index",e,t,r),a=k("tensor",e,t,r),i=r.getTensorArray(o.id);return i.write(n,a),[i.idTensor]}case"TensorArrayReadV3":{let o=k("tensorArrayId",e,t,r),n=k("index",e,t,r);return[r.getTensorArray(o.id).read(n)]}case"TensorArrayGatherV3":{let o=k("tensorArrayId",e,t,r),n=k("indices",e,t,r),a=k("dtype",e,t,r);return[r.getTensorArray(o.id).gather(n,a)]}case"TensorArrayScatterV3":{let o=k("tensorArrayId",e,t,r),n=k("indices",e,t,r),a=k("tensor",e,t,r),i=r.getTensorArray(o.id);return i.scatter(n,a),[i.idTensor]}case"TensorArrayConcatV3":{let o=k("tensorArrayId",e,t,r),n=r.getTensorArray(o.id),a=k("dtype",e,t,r);return[n.concat(a)]}case"TensorArraySplitV3":{let o=k("tensorArrayId",e,t,r),n=k("tensor",e,t,r),a=k("lengths",e,t,r),i=r.getTensorArray(o.id);return i.split(a,n),[i.idTensor]}case"TensorArraySizeV3":{let o=k("tensorArrayId",e,t,r),n=r.getTensorArray(o.id);return[$e(n.size(),"int32")]}case"TensorArrayCloseV3":{let o=k("tensorArrayId",e,t,r),n=r.getTensorArray(o.id);return n.clearAndClose(),[n.idTensor]}case"TensorListSetItem":{let o=k("tensorListId",e,t,r),n=k("index",e,t,r),a=k("tensor",e,t,r),i=r.getTensorList(o.id);return i.setItem(n,a),[i.idTensor]}case"TensorListGetItem":{let o=k("tensorListId",e,t,r),n=k("index",e,t,r),a=k("elementShape",e,t,r),i=k("elementDType",e,t,r);return[r.getTensorList(o.id).getItem(n,a,i)]}case"TensorListScatterV2":case"TensorListScatter":{let o=k("indices",e,t,r),n=k("tensor",e,t,r),a=k("elementShape",e,t,r),i=k("numElements",e,t,r),s=Q7(n,o,a,i);return r.addTensorList(s),[s.idTensor]}case"TensorListReserve":case"EmptyTensorList":{let o=k("elementShape",e,t,r),n=k("elementDType",e,t,r),a;e.op==="TensorListReserve"?a="numElements":a="maxNumElements";let i=k(a,e,t,r),s=e.op==="TensorListReserve"?-1:i,c=Y7(o,n,i,s);return r.addTensorList(c),[c.idTensor]}case"TensorListGather":{let o=k("tensorListId",e,t,r),n=k("indices",e,t,r),a=k("elementShape",e,t,r),i=k("elementDType",e,t,r);return[r.getTensorList(o.id).gather(n,i,a)]}case"TensorListStack":{let o=k("tensorListId",e,t,r),n=k("elementShape",e,t,r),a=k("elementDType",e,t,r),i=k("numElements",e,t,r);return[r.getTensorList(o.id).stack(n,a,i)]}case"TensorListFromTensor":{let o=k("tensor",e,t,r),n=k("elementShape",e,t,r),a=k("elementDType",e,t,r),i=X7(o,n,a);return r.addTensorList(i),[i.idTensor]}case"TensorListConcat":case"TensorListConcatV2":{let o=k("tensorListId",e,t,r),n=r.getTensorList(o.id),a=k("dtype",e,t,r),i=k("elementShape",e,t,r);return[n.concat(a,i)]}case"TensorListPushBack":{let o=k("tensorListId",e,t,r),n=k("tensor",e,t,r),a=r.getTensorList(o.id);return a.pushBack(n),[a.idTensor]}case"TensorListPopBack":{let o=k("tensorListId",e,t,r),n=k("elementShape",e,t,r),a=k("elementDType",e,t,r);return[r.getTensorList(o.id).popBack(n,a)]}case"TensorListSplit":{let o=k("tensor",e,t,r),n=k("elementShape",e,t,r),a=k("lengths",e,t,r),i=J7(o,a,n);return r.addTensorList(i),[i.idTensor]}case"TensorListLength":{let o=k("tensorListId",e,t,r),n=r.getTensorList(o.id);return[$e(n.size(),"int32")]}case"TensorListResize":{let o=k("tensorListId",e,t,r),n=k("size",e,t,r),i=r.getTensorList(o.id).resize(n);return r.addTensorList(i),[i.idTensor]}default:throw TypeError(`Node type ${e.op} is not implemented`)}};function eW(e,t,r){let[o,n]=k("fusedOps",e,t,r),a=o==="biasadd",i=!a,s=n==="prelu",c=o==="fusedbatchnorm",l=k("numArgs",e,t,r);if(a){if(s&&l!==2)throw new Error("FusedConv2d and DepthwiseConv2d with BiasAdd and Prelu must have two extra arguments: bias and alpha.");if(!s&&a&&l!==1)throw new Error("FusedConv2d and DepthwiseConv2d with BiasAdd must have one extra argument: bias.")}if(c)throw new Error("FusedConv2d and DepthwiseConv2d with FusedBatchNorm is not supported");let p=k("strides",e,t,r),u=_b(e,t,r),m=k("dataFormat",e,t,r).toUpperCase(),f=k("dilations",e,t,r),[d,h]=k("args",e,t,r);i&&(h=d,d=void 0);let y=k("leakyreluAlpha",e,t,r);return{stride:p,pad:u,dataFormat:m,dilations:f,biasArg:d,preluArg:h,activationFunc:n,leakyreluAlpha:y}}var tW=(e,t,r,o=wt)=>{switch(e.op){case"Conv1D":{let n=k("stride",e,t,r),a=k("pad",e,t,r),i=k("dataFormat",e,t,r).toUpperCase(),s=k("dilation",e,t,r);return[o.conv1d(k("x",e,t,r),k("filter",e,t,r),n,a,i,s)]}case"Conv2D":{let n=k("strides",e,t,r),a=_b(e,t,r),i=k("dataFormat",e,t,r).toUpperCase(),s=k("dilations",e,t,r);return[o.conv2d(k("x",e,t,r),k("filter",e,t,r),[n[1],n[2]],a,i,[s[1],s[2]])]}case"_FusedConv2D":{let{stride:n,pad:a,dataFormat:i,dilations:s,biasArg:c,preluArg:l,activationFunc:p,leakyreluAlpha:u}=eW(e,t,r);return[o.fused.conv2d({x:k("x",e,t,r),filter:k("filter",e,t,r),strides:[n[1],n[2]],pad:a,dataFormat:i,dilations:[s[1],s[2]],bias:c,activation:p,preluActivationWeights:l,leakyreluAlpha:u})]}case"FusedDepthwiseConv2dNative":{let{stride:n,pad:a,dataFormat:i,dilations:s,biasArg:c,preluArg:l,activationFunc:p,leakyreluAlpha:u}=eW(e,t,r);return[o.fused.depthwiseConv2d({x:k("x",e,t,r),filter:k("filter",e,t,r),strides:[n[1],n[2]],pad:a,dataFormat:i,dilations:[s[1],s[2]],bias:c,activation:p,preluActivationWeights:l,leakyreluAlpha:u})]}case"Conv2DBackpropInput":case"Conv2dTranspose":{let n=k("outputShape",e,t,r),a=k("strides",e,t,r),i=_b(e,t,r);return[o.conv2dTranspose(k("x",e,t,r),k("filter",e,t,r),n,[a[1],a[2]],i)]}case"DepthwiseConv2dNative":case"DepthwiseConv2d":{let n=k("strides",e,t,r),a=_b(e,t,r),i=k("dilations",e,t,r),s=k("dataFormat",e,t,r).toUpperCase();return[o.depthwiseConv2d(k("input",e,t,r),k("filter",e,t,r),[n[1],n[2]],a,s,[i[1],i[2]])]}case"Conv3D":{let n=k("strides",e,t,r),a=k("pad",e,t,r),i=k("dataFormat",e,t,r).toUpperCase(),s=k("dilations",e,t,r);return[o.conv3d(k("x",e,t,r),k("filter",e,t,r),[n[1],n[2],n[3]],a,i,[s[1],s[2],s[3]])]}case"AvgPool":{let n=k("strides",e,t,r),a=k("pad",e,t,r),i=k("kernelSize",e,t,r);return[o.avgPool(k("x",e,t,r),[i[1],i[2]],[n[1],n[2]],a)]}case"MaxPool":{let n=k("strides",e,t,r),a=k("pad",e,t,r),i=k("kernelSize",e,t,r);return[o.maxPool(k("x",e,t,r),[i[1],i[2]],[n[1],n[2]],a)]}case"MaxPoolWithArgmax":{let n=k("strides",e,t,r),a=k("pad",e,t,r),i=k("kernelSize",e,t,r),s=k("includeBatchInIndex",e,t,r),{result:c,indexes:l}=o.maxPoolWithArgmax(k("x",e,t,r),[i[1],i[2]],[n[1],n[2]],a,s);return[c,l]}case"AvgPool3D":{let n=k("strides",e,t,r),a=k("pad",e,t,r),i=k("kernelSize",e,t,r);return[o.avgPool3d(k("x",e,t,r),[i[1],i[2],i[3]],[n[1],n[2],n[3]],a)]}case"MaxPool3D":{let n=k("strides",e,t,r),a=k("pad",e,t,r),i=k("kernelSize",e,t,r);return[o.maxPool3d(k("x",e,t,r),[i[1],i[2],i[3]],[n[1],n[2],n[3]],a)]}case"Dilation2D":{let n=k("strides",e,t,r),a=k("pad",e,t,r),i=k("dilations",e,t,r),s=n[1],c=n[2],l=i[1],p=i[2];return[o.dilation2d(k("x",e,t,r),k("filter",e,t,r),[s,c],a,[l,p],"NHWC")]}default:throw TypeError(`Node type ${e.op} is not implemented`)}};var rW=(e,t,r,o=wt)=>{switch(e.op){case"Fill":{let n=k("shape",e,t,r),a=k("dtype",e,t,r),i=k("value",e,t,r);return[o.fill(n,i,a)]}case"LinSpace":{let n=k("start",e,t,r),a=k("stop",e,t,r),i=k("num",e,t,r);return[o.linspace(n,a,i)]}case"Multinomial":{let n=k("logits",e,t,r),a=k("numSamples",e,t,r),i=k("seed",e,t,r);return[o.multinomial(n,a,i)]}case"OneHot":{let n=k("indices",e,t,r),a=k("depth",e,t,r),i=k("onValue",e,t,r),s=k("offValue",e,t,r),c=k("dtype",e,t,r);return[o.oneHot(n,a,i,s,c)]}case"Ones":return[o.ones(k("shape",e,t,r),k("dtype",e,t,r))];case"OnesLike":return[o.onesLike(k("x",e,t,r))];case"RandomStandardNormal":return[o.randomStandardNormal(k("shape",e,t,r),k("dtype",e,t,r),k("seed",e,t,r))];case"RandomUniform":return[o.randomUniform(k("shape",e,t,r),k("minval",e,t,r),k("maxval",e,t,r),k("dtype",e,t,r))];case"RandomUniformInt":return[o.randomUniformInt(k("shape",e,t,r),k("minval",e,t,r),k("maxval",e,t,r),k("seed",e,t,r))];case"Range":{let n=k("start",e,t,r),a=k("stop",e,t,r),i=k("step",e,t,r);return[o.range(n,a,i,k("dtype",e,t,r))]}case"TruncatedNormal":{let n=k("shape",e,t,r),a=k("mean",e,t,r),i=k("stdDev",e,t,r),s=k("seed",e,t,r);return[o.truncatedNormal(n,a,i,k("dtype",e,t,r),s)]}case"Zeros":return[o.zeros(k("shape",e,t,r),k("dtype",e,t,r))];case"ZerosLike":return[o.zerosLike(k("x",e,t,r))];default:throw TypeError(`Node type ${e.op} is not implemented`)}};function OA(e,t,r){let o=k("boxes",e,t,r),n=k("scores",e,t,r),a=k("maxOutputSize",e,t,r),i=k("iouThreshold",e,t,r),s=k("scoreThreshold",e,t,r),c=k("softNmsSigma",e,t,r);return{boxes:o,scores:n,maxOutputSize:a,iouThreshold:i,scoreThreshold:s,softNmsSigma:c}}var oW=async(e,t,r,o,n=wt)=>{switch(e.op){case"NonMaxSuppressionV5":{let{boxes:a,scores:i,maxOutputSize:s,iouThreshold:c,scoreThreshold:l,softNmsSigma:p}=OA(e,t,r),u=await n.image.nonMaxSuppressionWithScoreAsync(a,i,s,c,l,p);return[u.selectedIndices,u.selectedScores]}case"NonMaxSuppressionV4":{let{boxes:a,scores:i,maxOutputSize:s,iouThreshold:c,scoreThreshold:l}=OA(e,t,r),p=k("padToMaxOutputSize",e,t,r),u=await n.image.nonMaxSuppressionPaddedAsync(a,i,s,c,l,p);return[u.selectedIndices,u.validOutputs]}case"NonMaxSuppressionV3":case"NonMaxSuppressionV2":{let{boxes:a,scores:i,maxOutputSize:s,iouThreshold:c,scoreThreshold:l}=OA(e,t,r);return[await n.image.nonMaxSuppressionAsync(a,i,s,c,l)]}case"Where":{let a=n.cast(k("condition",e,t,r),"bool"),i=[await n.whereAsync(a)];return a.dispose(),i}case"ListDiff":return n.setdiff1dAsync(k("x",e,t,r),k("y",e,t,r));default:throw TypeError(`Node type ${e.op} is not implemented`)}};var nW=(e,t,r,o=wt)=>{switch(e.op){case"LowerBound":{let n=k("sortedSequence",e,t,r),a=k("values",e,t,r);return[o.lowerBound(n,a)]}case"TopKV2":{let n=k("x",e,t,r),a=k("k",e,t,r),i=k("sorted",e,t,r),s=o.topk(n,a,i);return[s.values,s.indices]}case"UpperBound":{let n=k("sortedSequence",e,t,r),a=k("values",e,t,r);return[o.upperBound(n,a)]}case"Unique":{let n=k("x",e,t,r),a=o.unique(n);return[a.values,a.indices]}case"UniqueV2":{let n=k("x",e,t,r),a=k("axis",e,t,r),i=o.unique(n,a);return[i.values,i.indices]}default:throw TypeError(`Node type ${e.op} is not implemented`)}};var aW=(e,t,r,o=wt)=>{switch(e.op){case"Const":return t[e.name];case"PlaceholderWithDefault":let n=k("default",e,t,r);return[Dr(e.name,t,r)||n];case"Placeholder":return[Dr(e.name,t,r)];case"Identity":case"StopGradient":case"FakeQuantWithMinMaxVars":{let p=k("x",e,t,r);return[si(p)]}case"IdentityN":return k("x",e,t,r).map(p=>si(p));case"Snapshot":let a=k("x",e,t,r);return[si(a)];case"Shape":return[o.tensor1d(k("x",e,t,r).shape,"int32")];case"ShapeN":return k("x",e,t,r).map(p=>o.tensor1d(p.shape));case"Size":return[o.scalar(k("x",e,t,r).size,"int32")];case"Rank":return[o.scalar(k("x",e,t,r).rank,"int32")];case"NoOp":return[o.scalar(1)];case"Print":let i=k("x",e,t,r),s=k("data",e,t,r),c=k("message",e,t,r),l=k("summarize",e,t,r);console.warn("The graph has a tf.print() operation,usually used for debugging, which slows down performance."),console.log(c);for(let p=0;p<s.length;p++)console.log(Array.prototype.slice.call(s[p].dataSync()).slice(0,l));return[i];default:throw TypeError(`Node type ${e.op} is not implemented`)}};var Ik=class{get id(){return this.handle.id}constructor(t,r){this.keyDType=t,this.valueDType=r,this.handle=$e(0),this.tensorMap=new Map,an(this.handle)}clearAndClose(){this.tensorMap.forEach(t=>t.dispose()),this.tensorMap.clear(),this.handle.dispose()}size(){return this.tensorMap.size}tensorSize(){return $e(this.size(),"int32")}async import(t,r){this.checkKeyAndValueTensor(t,r);let o=await t.data();return this.tensorMap.forEach(n=>n.dispose()),this.tensorMap.clear(),He(()=>{let n=Jn(r),a=o.length,i=n.length;S.assert(a===i,()=>`The number of elements doesn't match, keys has ${a} elements, the values has ${i} elements.`);for(let s=0;s<a;s++){let c=o[s],l=n[s];an(l),this.tensorMap.set(c,l)}return this.handle})}async find(t,r){this.checkKeyAndValueTensor(t,r);let o=await t.data();return He(()=>{let n=[];for(let a=0;a<o.length;a++){let i=o[a],s=this.findWithDefault(i,r);n.push(s)}return Uo(n)})}findWithDefault(t,r){let o=this.tensorMap.get(t);return o??r}checkKeyAndValueTensor(t,r){if(t.dtype!==this.keyDType)throw new Error(`Expect key dtype ${this.keyDType}, but got ${t.dtype}`);if(r.dtype!==this.valueDType)throw new Error(`Expect value dtype ${this.valueDType}, but got ${r.dtype}`)}};var iW=async(e,t,r,o)=>{switch(e.op){case"HashTable":case"HashTableV2":{let n=o.getHashTableHandleByName(e.name);if(n!=null)return[n];{let a=k("keyDType",e,t,r),i=k("valueDType",e,t,r),s=new Ik(a,i);return o.addHashTable(e.name,s),[s.handle]}}case"InitializeTable":case"InitializeTableV2":case"LookupTableImport":case"LookupTableImportV2":{let n=k("tableHandle",e,t,r,o),a=k("keys",e,t,r),i=k("values",e,t,r);return[await o.getHashTableById(n.id).import(a,i)]}case"LookupTableFind":case"LookupTableFindV2":{let n=k("tableHandle",e,t,r,o),a=k("keys",e,t,r),i=k("defaultValue",e,t,r);return[await o.getHashTableById(n.id).find(a,i)]}case"LookupTableSize":case"LookupTableSizeV2":{let n=k("tableHandle",e,t,r,o);return[o.getHashTableById(n.id).tensorSize()]}default:throw TypeError(`Node type ${e.op} is not implemented`)}};var sW=(e,t,r,o=wt)=>{switch(e.op){case"ResizeBilinear":{let n=k("images",e,t,r),a=k("size",e,t,r),i=k("alignCorners",e,t,r),s=k("halfPixelCenters",e,t,r);return[o.image.resizeBilinear(n,[a[0],a[1]],i,s)]}case"ResizeNearestNeighbor":{let n=k("images",e,t,r),a=k("size",e,t,r),i=k("alignCorners",e,t,r),s=k("halfPixelCenters",e,t,r);return[o.image.resizeNearestNeighbor(n,[a[0],a[1]],i,s)]}case"CropAndResize":{let n=k("image",e,t,r),a=k("boxes",e,t,r),i=k("boxInd",e,t,r),s=k("cropSize",e,t,r),c=k("method",e,t,r),l=k("extrapolationValue",e,t,r);return[o.image.cropAndResize(n,a,i,s,c,l)]}case"ImageProjectiveTransformV3":{let n=k("images",e,t,r),a=k("transforms",e,t,r),i=k("outputShape",e,t,r),s=k("fillValue",e,t,r),c=k("interpolation",e,t,r),l=k("fillMode",e,t,r);return[o.image.transform(n,a,c.toLowerCase(),l.toLowerCase(),s,i)]}default:throw TypeError(`Node type ${e.op} is not implemented`)}};var lW=(e,t,r,o=wt)=>{switch(e.op){case"Equal":return[o.equal(k("a",e,t,r),k("b",e,t,r))];case"NotEqual":return[o.notEqual(k("a",e,t,r),k("b",e,t,r))];case"Greater":return[o.greater(k("a",e,t,r),k("b",e,t,r))];case"GreaterEqual":return[o.greaterEqual(k("a",e,t,r),k("b",e,t,r))];case"Less":return[o.less(k("a",e,t,r),k("b",e,t,r))];case"LessEqual":return[o.lessEqual(k("a",e,t,r),k("b",e,t,r))];case"LogicalAnd":return[o.logicalAnd(k("a",e,t,r),k("b",e,t,r))];case"LogicalNot":return[o.logicalNot(k("a",e,t,r))];case"LogicalOr":return[o.logicalOr(k("a",e,t,r),k("b",e,t,r))];case"Select":case"SelectV2":return[o.where(k("condition",e,t,r),k("a",e,t,r),k("b",e,t,r))];case"BitwiseAnd":return[o.bitwiseAnd(k("a",e,t,r),k("b",e,t,r))];default:throw TypeError(`Node type ${e.op} is not implemented`)}};var cW=(e,t,r,o=wt)=>{switch(e.op){case"BatchMatMul":case"BatchMatMulV2":case"MatMul":return[o.matMul(k("a",e,t,r),k("b",e,t,r),k("transposeA",e,t,r),k("transposeB",e,t,r))];case"Einsum":return[o.einsum(k("equation",e,t,r),...k("tensors",e,t,r))];case"Transpose":return[o.transpose(k("x",e,t,r),k("perm",e,t,r))];case"_FusedMatMul":let[n,a]=k("fusedOps",e,t,r),i=n==="biasadd",s=a==="prelu",c=k("numArgs",e,t,r),l=k("leakyreluAlpha",e,t,r);if(i){if(s&&c!==2)throw new Error("Fused MatMul with BiasAdd and Prelu must have two extra arguments: bias and alpha.");if(!s&&c!==1)throw new Error("Fused MatMul with BiasAdd must have one extra argument: bias.")}let[p,u]=k("args",e,t,r);return[o.fused.matMul({a:k("a",e,t,r),b:k("b",e,t,r),transposeA:k("transposeA",e,t,r),transposeB:k("transposeB",e,t,r),bias:p,activation:a,preluActivationWeights:u,leakyreluAlpha:l})];case"MatrixBandPart":return[o.linalg.bandPart(k("a",e,t,r),k("numLower",e,t,r),k("numUpper",e,t,r))];default:throw TypeError(`Node type ${e.op} is not implemented`)}};var pW=(e,t,r,o=wt)=>{switch(e.op){case"EuclideanNorm":return[o.euclideanNorm(k("x",e,t,r),k("axis",e,t,r),k("keepDims",e,t,r))];case"FusedBatchNorm":case"FusedBatchNormV2":return[o.batchNorm(k("x",e,t,r),k("mean",e,t,r),k("variance",e,t,r),k("offset",e,t,r),k("scale",e,t,r),k("epsilon",e,t,r))];case"FusedBatchNormV3":return[o.batchNorm(k("x",e,t,r),k("mean",e,t,r),k("variance",e,t,r),k("offset",e,t,r),k("scale",e,t,r),k("epsilon",e,t,r))];case"LRN":return[o.localResponseNormalization(k("x",e,t,r),k("radius",e,t,r),k("bias",e,t,r),k("alpha",e,t,r),k("beta",e,t,r))];case"Softmax":return[o.softmax(k("x",e,t,r))];case"LogSoftmax":return[o.logSoftmax(k("x",e,t,r))];default:throw TypeError(`Node type ${e.op} is not implemented`)}};var uW=(e,t,r,o=wt)=>{switch(e.op){case"RaggedGather":{let{outputNestedSplits:n,outputDenseValues:a}=o.raggedGather(k("paramsNestedSplits",e,t,r),k("paramsDenseValues",e,t,r),k("indices",e,t,r),k("outputRaggedRank",e,t,r));return n.concat(a)}case"RaggedRange":{let{rtNestedSplits:n,rtDenseValues:a}=o.raggedRange(k("starts",e,t,r),k("limits",e,t,r),k("splits",e,t,r));return[n,a]}case"RaggedTensorToTensor":return[o.raggedTensorToTensor(k("shape",e,t,r),k("values",e,t,r),k("defaultValue",e,t,r),k("rowPartitionTensors",e,t,r),k("rowPartitionTypes",e,t,r))];default:throw TypeError(`Node type ${e.op} is not implemented`)}};var mW=(e,t,r,o=wt)=>{switch(e.op){case"Max":{let s=k("axis",e,t,r),c=k("keepDims",e,t,r);return[o.max(k("x",e,t,r),s,c)]}case"Mean":{let s=k("axis",e,t,r),c=k("keepDims",e,t,r);return[o.mean(k("x",e,t,r),s,c)]}case"Min":{let s=k("axis",e,t,r),c=k("keepDims",e,t,r);return[o.min(k("x",e,t,r),s,c)]}case"Sum":{let s=k("axis",e,t,r),c=k("keepDims",e,t,r);return[o.sum(k("x",e,t,r),s,c)]}case"All":{let s=k("axis",e,t,r),c=k("keepDims",e,t,r);return[o.all(k("x",e,t,r),s,c)]}case"Any":{let s=k("axis",e,t,r),c=k("keepDims",e,t,r);return[o.any(k("x",e,t,r),s,c)]}case"ArgMax":{let s=k("axis",e,t,r);return[o.argMax(k("x",e,t,r),s)]}case"ArgMin":{let s=k("axis",e,t,r);return[o.argMin(k("x",e,t,r),s)]}case"Prod":{let s=k("axis",e,t,r),c=k("keepDims",e,t,r);return[o.prod(k("x",e,t,r),s,c)]}case"Cumprod":{let s=k("axis",e,t,r),c=k("exclusive",e,t,r),l=k("reverse",e,t,r);return[o.cumprod(k("x",e,t,r),s,c,l)]}case"Cumsum":{let s=k("axis",e,t,r),c=k("exclusive",e,t,r),l=k("reverse",e,t,r);return[o.cumsum(k("x",e,t,r),s,c,l)]}case"Bincount":let n=k("x",e,t,r),a=k("weights",e,t,r),i=k("size",e,t,r);return[o.bincount(n,a,i)];case"DenseBincount":{let s=k("x",e,t,r),c=k("weights",e,t,r),l=k("size",e,t,r),p=k("binaryOutput",e,t,r);return[o.denseBincount(s,c,l,p)]}default:throw TypeError(`Node type ${e.op} is not implemented`)}};var fW=(e,t,r,o=wt)=>{switch(e.op){case"ConcatV2":case"Concat":{let n=k("n",e,t,r),a=k("axis",e,t,r),i=k("tensors",e,t,r);return i=i.slice(0,n),[o.concat(i,a)]}case"Gather":{let n=k("x",e,t,r),a=k("indices",e,t,r);return[o.gather(n,o.cast(a,"int32"),0)]}case"GatherV2":{let n=k("axis",e,t,r),a=k("batchDims",e,t,r),i=k("x",e,t,r),s=k("indices",e,t,r);return[o.gather(i,o.cast(s,"int32"),n,a)]}case"Reverse":{let n=k("dims",e,t,r),a=[];for(let s=0;s<n.length;s++)n[s]&&a.push(s);let i=k("x",e,t,r);return[o.reverse(i,a)]}case"ReverseV2":{let n=k("axis",e,t,r),a=k("x",e,t,r);return[o.reverse(a,n)]}case"Slice":{let n=k("begin",e,t,r),a=k("size",e,t,r);return[o.slice(k("x",e,t,r),n,a)]}case"StridedSlice":{let n=k("begin",e,t,r),a=k("end",e,t,r),i=k("strides",e,t,r),s=k("beginMask",e,t,r),c=k("endMask",e,t,r),l=k("ellipsisMask",e,t,r),p=k("newAxisMask",e,t,r),u=k("shrinkAxisMask",e,t,r),m=k("x",e,t,r);return[o.stridedSlice(m,n,a,i,s,c,l,p,u)]}case"Pack":return He(()=>{let n=k("axis",e,t,r),a=k("tensors",e,t,r),i=a[0].shape,s=o.squeeze(a[0]).shape,c=a.map(l=>{let p=S.arraysEqual(l.shape,i);if(!p&&!S.arraysEqual(o.squeeze(l).shape,s))throw new Error("the input tensors shape does not match");return p?l:o.reshape(l,i)});return[o.stack(c,n)]});case"Unpack":{let n=k("axis",e,t,r),a=k("tensor",e,t,r);return o.unstack(a,n)}case"Tile":{let n=k("reps",e,t,r);return[o.tile(k("x",e,t,r),n)]}case"Split":case"SplitV":{let n=k("axis",e,t,r),a=k("numOrSizeSplits",e,t,r),i=k("x",e,t,r);return o.split(i,a,n)}case"ScatterNd":{let n=k("indices",e,t,r),a=k("values",e,t,r),i=k("shape",e,t,r);return[o.scatterND(n,a,i)]}case"GatherNd":{let n=k("x",e,t,r),a=k("indices",e,t,r);return[o.gatherND(n,a)]}case"SparseToDense":{let n=k("sparseIndices",e,t,r),a=k("outputShape",e,t,r),i=k("sparseValues",e,t,r),s=k("defaultValue",e,t,r);return[o.sparseToDense(n,i,a,i.dtype===s.dtype?s:o.cast(s,i.dtype))]}case"TensorScatterUpdate":{let n=k("indices",e,t,r),a=k("values",e,t,r),i=k("tensor",e,t,r);return[o.tensorScatterUpdate(i,n,a)]}default:throw TypeError(`Node type ${e.op} is not implemented`)}};var dW=(e,t,r,o=wt)=>{switch(e.op){case"SparseFillEmptyRows":{let{outputIndices:n,outputValues:a,emptyRowIndicator:i,reverseIndexMap:s}=o.sparse.sparseFillEmptyRows(k("indices",e,t,r),k("values",e,t,r),k("denseShape",e,t,r),k("defaultValue",e,t,r));return[n,a,i,s]}case"SparseReshape":{let{outputIndices:n,outputShape:a}=o.sparse.sparseReshape(k("inputIndices",e,t,r),k("inputShape",e,t,r),k("newShape",e,t,r));return[n,a]}case"SparseSegmentMean":return[o.sparse.sparseSegmentMean(k("data",e,t,r),k("indices",e,t,r),k("segmentIds",e,t,r))];case"SparseSegmentSum":return[o.sparse.sparseSegmentSum(k("data",e,t,r),k("indices",e,t,r),k("segmentIds",e,t,r))];default:throw TypeError(`Node type ${e.op} is not implemented`)}};var hW=(e,t,r,o=wt)=>{switch(e.op){case"FFT":return[o.fft(k("x",e,t,r))];case"IFFT":return[o.ifft(k("x",e,t,r))];case"RFFT":return[o.rfft(k("x",e,t,r))];case"IRFFT":return[o.irfft(k("x",e,t,r))];default:throw TypeError(`Node type ${e.op} is not implemented`)}};var gW=(e,t,r,o=wt)=>{switch(e.op){case"StaticRegexReplace":return[o.string.staticRegexReplace(k("input",e,t,r),k("pattern",e,t,r),k("rewrite",e,t,r),k("replaceGlobal",e,t,r))];case"StringNGrams":{let{nGrams:n,nGramsSplits:a}=o.string.stringNGrams(k("data",e,t,r),k("dataSplits",e,t,r),k("separator",e,t,r),k("nGramWidths",e,t,r),k("leftPad",e,t,r),k("rightPad",e,t,r),k("padWidth",e,t,r),k("preserveShortSequences",e,t,r));return[n,a]}case"StringSplit":{let{indices:n,values:a,shape:i}=o.string.stringSplit(k("input",e,t,r),k("delimiter",e,t,r),k("skipEmpty",e,t,r));return[n,a,i]}case"StringToHashBucketFast":return[o.string.stringToHashBucketFast(k("input",e,t,r),k("numBuckets",e,t,r))];default:throw TypeError(`Node type ${e.op} is not implemented`)}};var yW=(e,t,r,o=wt)=>{switch(e.op){case"Cast":return[o.cast(k("x",e,t,r),k("dtype",e,t,r))];case"ExpandDims":{let n=k("axis",e,t,r);return[o.expandDims(k("x",e,t,r),n)]}case"Squeeze":{let n=k("axis",e,t,r);return[o.squeeze(k("x",e,t,r),n)]}case"Reshape":return[o.reshape(k("x",e,t,r),k("shape",e,t,r))];case"EnsureShape":return[o.ensureShape(k("x",e,t,r),k("shape",e,t,r))];case"MirrorPad":return[o.mirrorPad(k("x",e,t,r),k("padding",e,t,r),k("mode",e,t,r))];case"PadV2":case"Pad":return[o.pad(k("x",e,t,r),k("padding",e,t,r),k("constantValue",e,t,r))];case"SpaceToBatchND":{let n=k("blockShape",e,t,r),a=k("paddings",e,t,r);return[o.spaceToBatchND(k("x",e,t,r),n,a)]}case"BatchToSpaceND":{let n=k("blockShape",e,t,r),a=k("crops",e,t,r);return[o.batchToSpaceND(k("x",e,t,r),n,a)]}case"DepthToSpace":{let n=k("blockSize",e,t,r),a=k("dataFormat",e,t,r).toUpperCase();return[o.depthToSpace(k("x",e,t,r),n,a)]}case"BroadcastTo":return[o.broadcastTo(k("x",e,t,r),k("shape",e,t,r))];case"BroadcastArgs":return[o.broadcastArgs(k("s0",e,t,r),k("s1",e,t,r))];default:throw TypeError(`Node type ${e.op} is not implemented`)}};function PA(e,t,r,o,n=He){let a=((i,s,c)=>{switch(i.category){case"arithmetic":return n(()=>G7(i,s,c));case"basic_math":return n(()=>q7(i,s,c));case"control":return Z7(i,s,c);case"convolution":return n(()=>tW(i,s,c));case"creation":return n(()=>rW(i,s,c));case"dynamic":return oW(i,s,c);case"evaluation":return n(()=>nW(i,s,c));case"image":return n(()=>sW(i,s,c));case"graph":return n(()=>aW(i,s,c));case"logical":return n(()=>lW(i,s,c));case"matrices":return n(()=>cW(i,s,c));case"normalization":return n(()=>pW(i,s,c));case"ragged":return n(()=>uW(i,s,c));case"reduction":return n(()=>mW(i,s,c));case"slice_join":return n(()=>fW(i,s,c));case"sparse":return n(()=>dW(i,s,c));case"spectral":return n(()=>hW(i,s,c));case"string":return n(()=>gW(i,s,c));case"transformation":return n(()=>yW(i,s,c));case"hash_table":return iW(i,s,c,o);case"custom":let l=uk(i.op);if(l&&l.customExecutor)return l.customExecutor(new kk(i,s,c));throw TypeError(`Custom op ${i.op} is not registered.`);default:throw TypeError(`Unknown op '${i.op}'. File an issue at https://github.com/tensorflow/tfjs/issues so we can add it, or register a custom execution with tf.registerOp()`)}})(e,t,r);return S.isPromise(a)?a.then(i=>[].concat(i)):[].concat(a)}var Ib=class{constructor(t={},r={},o={},n={},a){this.weightMap=t,this.tensorArrayMap=r,this.tensorListMap=o,this.functionMap=n,this.parseNodeNameCache=a,this.rootContext={id:0,frameName:"",iterationId:0},this.contexts=[this.rootContext],this.lastId=0,this.generateCurrentContextIds()}newFrame(t,r){return{id:t,frameName:r,iterationId:0}}set currentContext(t){this.contexts!==t&&(this.contexts=t,this.generateCurrentContextIds())}get currentContext(){return this.contexts}get currentContextId(){return this._currentContextIds[0]}get currentContextIds(){return this._currentContextIds}generateCurrentContextIds(){let t=[];for(let r=0;r<this.contexts.length-1;r++){let o=this.contexts.slice(0,this.contexts.length-r);t.push(this.contextIdforContexts(o))}t.push(""),this._currentContextIds=t}contextIdforContexts(t){return t?t.map(r=>r.id===0&&r.iterationId===0?"":`${r.frameName}-${r.iterationId}`).join("/"):""}enterFrame(t){this.contexts&&(this.lastId++,this.contexts=this.contexts.slice(),this.contexts.push(this.newFrame(this.lastId,t)),this._currentContextIds.unshift(this.contextIdforContexts(this.contexts)))}exitFrame(){if(this.contexts&&this.contexts.length>1)this.contexts=this.contexts.slice(),this.contexts.splice(-1),this.currentContextIds.shift();else throw new Error("Cannot exit frame, the context is empty")}nextIteration(){if(this.contexts&&this.contexts.length>0){this.contexts=this.contexts.slice(),this.lastId++;let t=Object.assign({},this.contexts[this.contexts.length-1]);t.iterationId+=1,t.id=this.lastId,this.contexts.splice(-1,1,t),this._currentContextIds.splice(0,1,this.contextIdforContexts(this.contexts))}else throw new Error("Cannot increase frame iteration, the context is empty")}getWeight(t){return this.weightMap[t]}addTensorArray(t){this.tensorArrayMap[t.id]=t}getTensorArray(t){return this.tensorArrayMap[t]}addTensorList(t){this.tensorListMap[t.id]=t}getTensorList(t){return this.tensorListMap[t]}dispose(t){for(let r in this.tensorArrayMap)this.tensorArrayMap[r].clearAndClose(t);for(let r in this.tensorListMap)this.tensorListMap[r].clearAndClose(t)}};function zA(e,t,r,o){let n=new Set,a=[],i=null,s=null,c=new Set,l=new Set(Object.keys(e).map(m=>Wo(m)[0]));o=o||[];let p=new Set(o.map(m=>Wo(m.name)[0])),u=[...t];for(;u.length>0;){let m=u.pop();if((nc(m)||Obe(m)||Pbe(m))&&i==null&&(i=m,s=i.children.map(f=>f.name).filter(f=>n.has(f))),n.add(m.name),r[m.name]==null&&!l.has(m.name)&&!p.has(m.name)){if(m.inputs.length===0){a.push(m.name);continue}m.inputs.forEach(f=>{c.has(f.name)||(c.add(f.name),u.push(f))})}}return{inputs:e,outputs:t,usedNodes:n,missingInputs:a,dynamicNode:i,syncInputs:s}}function vW(e,t){let{usedNodes:r,inputs:o}=t,n=Object.keys(o).map(y=>Wo(y)[0]).map(y=>e.nodes[y]),a=e.initNodes||[],i=y=>r.has(typeof y=="string"?y:y.name);function s(y){return[...new Map(y.map(g=>[g.name,g])).values()]}let c=s([...n,...e.weights,...a]).filter(i),l=s([...c,...Object.values(e.nodes)]).filter(i),p=new Map(l.map(y=>[y.name,y])),u={};for(let y of l){u[y.name]=u[y.name]||0;for(let g of y.children)i(g)||(u[g.name]=Number.POSITIVE_INFINITY),u[g.name]=(u[g.name]||0)+1}let m=Object.entries(u).filter(([,y])=>y===0).map(([y])=>y),f=[...m];for(;m.length>0;){let y=m.pop(),g=p.get(y);for(let b of g.children.filter(i))--u[b.name]===0&&(f.push(b.name),m.push(b.name))}let d=f.map(y=>p.get(y)),h=Abe(d,c);return Rbe(h,c),h}function Abe(e,t){let r=new Map(e.map(i=>[i.name,i])),o=t.map(i=>i.name),n=new Set(o);for(;o.length>0;){let i=o.pop(),s=r.get(i);for(let c of s.children)!r.has(c.name)||n.has(c.name)||(n.add(c.name),o.push(c.name))}return e.filter(i=>n.has(i.name))}var tg=class extends Error{constructor(t){super(`NodesExecutionOrderError: ${t}`)}};function Rbe(e,t){let r=new Map(e.map((s,c)=>[s.name,c])),o=new Set(t.map(s=>s.name)),n=s=>o.has(typeof s=="string"?s:s.name),a=new Set(e.map(s=>s.name)),i=s=>a.has(typeof s=="string"?s:s.name);for(let s of e){for(let c of s.children.filter(i)){if(!r.has(c.name))throw new tg(`Child ${c.name} of node ${s.name} is unreachable.`);if(r.get(s.name)>r.get(c.name))throw new tg(`Node ${s.name} is scheduled to run after its child ${c.name}.`)}if(!n(s))for(let c of s.inputs){if(!r.has(c.name))throw new tg(`Input ${c.name} of node ${s.name} is unreachable.`);if(r.get(c.name)>r.get(s.name))throw new tg(`Node ${s.name} is scheduled to run before its input ${c.name}.`)}}}function bW(e){let t=new Map(e.map((s,c)=>[s.name,c])),r=Number.MAX_SAFE_INTEGER,o=e.map((s,c)=>nc(s)?r:c),n=s=>{let c=o[t.get(s.name)];return c??-1},a=e.map((s,c)=>s.children.map(n).reduce((l,p)=>Math.max(l,p),o[c])),i=new Map;for(let s=0;s<e.length;++s){let c=a[s];if(c===r)continue;let l=e[s],p=e[c];i.has(p.name)||i.set(p.name,[]),i.get(p.name).push(l)}return i}var Dbe=new Set(["Switch","Merge","Enter","Exit","NextIteration","StatelessIf","StatelessWhile","if","While"]),Fbe=new Set(["NonMaxSuppressionV2","NonMaxSuppressionV3","NonMaxSuppressionV5","Where"]),Mbe=new Set(["HashTable","HashTableV2","LookupTableImport","LookupTableImportV2","LookupTableFind","LookupTableFindV2","LookupTableSize","LookupTableSizeV2"]);function nc(e){return Dbe.has(e.op)}function Obe(e){return Fbe.has(e.op)}function Pbe(e){return Mbe.has(e.op)}var Tb=class e{get weightIds(){return this.parent?this.parent.weightIds:this._weightIds}get functionExecutorMap(){return this.parent?this.parent.functionExecutorMap:this._functionExecutorMap}get weightMap(){return this.parent?this.parent.weightMap:this._weightMap}set weightMap(t){let r=Object.keys(t).map(o=>t[o].map(n=>n.id));this._weightIds=[].concat(...r),this._weightMap=t}set resourceManager(t){this._resourceManager=t}get inputs(){return this._inputs.map(t=>({name:t.name,shape:t.attrParams.shape?t.attrParams.shape.value:void 0,dtype:t.attrParams.dtype?t.attrParams.dtype.value:void 0}))}get outputs(){return this._outputs.map(t=>({name:t.name,shape:t.attrParams.shape?t.attrParams.shape.value:void 0,dtype:t.attrParams.dtype?t.attrParams.dtype.value:void 0}))}get inputNodes(){return this._inputs.map(t=>t.signatureKey||t.name)}get outputNodes(){return this._outputs.map(t=>{let r=t.signatureKey||t.name;return t.defaultOutput?`${r}:${t.defaultOutput}`:r})}get functions(){return Object.keys(this._functions).reduce((t,r)=>(t[r]=this._functions[r].signature,t),{})}constructor(t,r){this.graph=t,this.parent=r,this.compiledMap=new Map,this.parseNodeNameCache=new Map,this._weightMap={},this.SEPARATOR=",",this._functions={},this._functionExecutorMap={},this.keepIntermediateTensors=!1,this._outputs=t.outputs,this._inputs=t.inputs,this._initNodes=t.initNodes,this._signature=t.signature,this._functions=t.functions,t.functions!=null&&Object.keys(t.functions).forEach(o=>{this._functionExecutorMap[o]=new e(t.functions[o],this)})}getCompilationKey(t,r){let o=t.map(a=>a.name).sort(),n=r.map(a=>a.name).sort();return o.join(this.SEPARATOR)+"--"+n.join(this.SEPARATOR)}compile(t,r){let o=zA(t,r,this.weightMap,this._initNodes),{missingInputs:n,dynamicNode:a,syncInputs:i}=o;if(a!=null)throw new Error(`This execution contains the node '${a.name}', which has the dynamic op '${a.op}'. Please use model.executeAsync() instead. Alternatively, to avoid the dynamic ops, specify the inputs [${i}]`);if(n.length>0){let l=r.map(u=>u.name),p=Object.keys(t);throw new Error(`Cannot compute the outputs [${l}] from the provided inputs [${p}]. Missing the following inputs: [${n}]`)}let s=vW(this.graph,o),c=bW(s);return{orderedNodes:s,nodeLiveUntilMap:c}}cloneAndKeepTensor(t){if(t==null)return null;let r=t.clone();return an(r),r}cloneTensorList(t){return t?t.map(o=>this.cloneAndKeepTensor(o)):null}cloneTensorMap(t){return Object.fromEntries(Object.entries(t).map(([r,o])=>[r,this.cloneTensorList(o)]))}execute(t,r){this.disposeIntermediateTensors(),t=this.mapInputs(t);let o=Object.keys(t).sort();this.checkInputs(t),this.checkInputShapeAndType(t),r=this.mapOutputs(r),this.checkOutputs(r);let n=o.map(m=>this.graph.nodes[Wo(m)[0]]),a=r.map(m=>Wo(m)[0]),i=new Set(a),s=a.map(m=>this.graph.nodes[m]);s.length===0&&(s=this._outputs);let c=this.getCompilationKey(n,s),l=this.compiledMap.get(c);l==null&&(l=this.compile(t,s),this.compiledMap.set(c,l));try{this.keepIntermediateTensors=Ne().getBool("KEEP_INTERMEDIATE_TENSORS")}catch(m){this.keepIntermediateTensors=!1,console.warn(m.message)}let p={},u={};return He(()=>{let m=new Ib(this.weightMap,p,u,this.functionExecutorMap,this.parseNodeNameCache),f=Object.assign({},this.weightMap);this.keepIntermediateTensors&&(this.clonedTensorsMap=this.cloneTensorMap(this.weightMap)),Object.keys(t).forEach(g=>{let[b,x]=Wo(g,m),w=[];w[x]=t[g],f[b]=w,this.keepIntermediateTensors&&(this.clonedTensorsMap[b]=this.cloneTensorList(w))});let d=this.getFrozenTensorIds(f),{orderedNodes:h,nodeLiveUntilMap:y}=l;for(let g of h){if(f[g.name])continue;let b=PA(g,f,m,this._resourceManager);if(S.isPromise(b))throw new Error(`The execution of the op '${g.op}' returned a promise. Please use model.executeAsync() instead.`);f[g.name]=b,this.keepIntermediateTensors&&(this.clonedTensorsMap[g.name]=this.cloneTensorList(b)),this.checkTensorForDisposalWithNodeLiveUntilInfo(g,f,m,d,i,y.get(g.name))}return this.parent==null&&m.dispose(d),r.map(g=>Dr(g,f,m))})}getFrozenTensorIds(t){let r=[].concat.apply([],Object.keys(t).map(o=>t[o]).map(o=>o.map(n=>n.id)));return new Set(r)}checkTensorForDisposal(t,r,o,n,a,i,s){if(!(nc(r)||i.has(t))){for(let c of o[t])c!=null&&(s[c.id]=(s[c.id]||0)+r.children.length);for(let c of r.inputs){if(nc(c))continue;let l=dA(c.name,o,n);if(l!=null)for(let p of l){if(!p||p.kept||a.has(p.id))continue;let u=s[p.id];u===1?(p.dispose(),delete s[p.id]):u!=null&&s[p.id]--}}}}checkTensorForDisposalWithNodeLiveUntilInfo(t,r,o,n,a,i){function s(c){return nc(c)||a.has(c.name)}if(!(nc(t)||i==null))for(let c of i){if(s(c))continue;let l=dA(c.name,r,o);for(let p of l)!p||p.kept||n.has(p.id)||p.dispose()}}async executeAsync(t,r){return this._executeAsync(t,r)}disposeIntermediateTensors(){this.clonedTensorsMap&&(Object.values(this.clonedTensorsMap).forEach(t=>{for(let r of t)r&&!r.isDisposed&&r.dispose()}),this.clonedTensorsMap=null)}getIntermediateTensors(){return this.clonedTensorsMap}async _executeAsync(t,r,o=!1,n={},a={}){this.disposeIntermediateTensors(),o||(t=this.mapInputs(t),this.checkInputs(t),this.checkInputShapeAndType(t),r=this.mapOutputs(r),this.checkOutputs(r));try{this.keepIntermediateTensors=Ne().getBool("KEEP_INTERMEDIATE_TENSORS")}catch(m){this.keepIntermediateTensors=!1,console.warn(m.message)}let i=new Ib(this.weightMap,n,a,this.functionExecutorMap,this.parseNodeNameCache);this.keepIntermediateTensors&&(this.clonedTensorsMap=this.cloneTensorMap(this.weightMap));let s=await this.executeWithControlFlow(t,i,r,o),c=r.map(m=>Dr(m,s,i)),l=c.map(m=>m.id),p=Object.keys(t).map(m=>t[m].id),u=new Set([...l,...p,...this.weightIds]);return Object.values(s).forEach(m=>{m.forEach(f=>{f&&!f.isDisposed&&!u.has(f.id)&&f.dispose()})}),this.parent==null&&i.dispose(u),c}async executeFunctionAsync(t,r,o){let n=t.reduce((a,i,s)=>(a[this.inputs[s].name]=i,a),{});return this._executeAsync(n,this.outputNodes,!0,r,o)}async executeWithControlFlow(t,r,o,n){let a=Object.keys(t),i=a.map(w=>this.graph.nodes[Wo(w)[0]]),s=o.map(w=>Wo(w)[0]),c=new Set(s),l=s.map(w=>this.graph.nodes[w]);l.length===0&&(l=this._outputs);let{usedNodes:p,missingInputs:u,dynamicNode:m,syncInputs:f}=zA(t,l,this.weightMap,this._initNodes),d=[...i,...this.graph.weights,...this._initNodes||[]].map(w=>({node:w,contexts:r.currentContext})),h=Object.assign({},this.weightMap);Object.keys(t).forEach(w=>{let[I,C]=Wo(w),R=[];R[C]=t[w],h[I]=R});let y={},g=this.getFrozenTensorIds(h),b={};for(;d.length>0;){let w=this.processStack(i,d,r,h,b,g,c,y,p);await Promise.all(w)}m==null&&!n&&console.warn("This model execution did not contain any nodes with control flow or dynamic output shapes. You can use model.execute() instead.");let x=l.filter(w=>!nc(w)&&!Dr(w.name,h,r)).map(w=>w.name);if(x.length>0){let w="";throw m!=null&&(w=`Alternatively, to avoid the dynamic ops, use model.execute() and specify the inputs [${f}]`),new Error(`Cannot compute the outputs [${x}] from the provided inputs [${a}]. Consider providing the following inputs: [${u}]. ${w}`)}return h}processStack(t,r,o,n,a,i,s,c,l){let p=[];for(;r.length>0;){let u=r.pop();o.currentContext=u.contexts;let m="";if(u.node.op==="Enter"&&k("isConstant",u.node,n,o)&&([m]=ii(u.node.name,o)),n[u.node.name]==null){let f=PA(u.node,n,o,this._resourceManager);m||([m]=ii(u.node.name,o));let d=o.currentContext;S.isPromise(f)?p.push(f.then(h=>(n[m]=h,this.keepIntermediateTensors&&(this.clonedTensorsMap[m]=this.cloneTensorList(h)),o.currentContext=d,this.checkTensorForDisposal(m,u.node,n,o,i,s,c),this.processChildNodes(u.node,r,o,n,a,l),h))):(n[m]=f,this.keepIntermediateTensors&&(this.clonedTensorsMap[m]=this.cloneTensorList(f)),this.checkTensorForDisposal(m,u.node,n,o,i,s,c),this.processChildNodes(u.node,r,o,n,a,l))}else this.processChildNodes(u.node,r,o,n,a,l)}return p}processChildNodes(t,r,o,n,a,i){t.children.forEach(s=>{let[c]=ii(s.name,o);a[c]||!i.has(s.name)||(s.op==="Merge"?s.inputNames.some(l=>!!Dr(l,n,o))&&(a[c]=!0,r.push({contexts:o.currentContext,node:s})):s.inputNames.every(l=>!!Dr(l,n,o))&&(a[c]=!0,r.push({contexts:o.currentContext,node:s})))})}dispose(){Object.keys(this.weightMap).forEach(t=>this.weightMap[t].forEach(r=>r.dispose()))}checkInputShapeAndType(t){Object.keys(t).forEach(r=>{let o=t[r],[n]=Wo(r),a=this.graph.nodes[n];if(a.attrParams.shape&&a.attrParams.shape.value){let i=a.attrParams.shape.value,s=i.length===o.shape.length&&o.shape.every((c,l)=>i[l]===-1||i[l]===c);S.assert(s,()=>`The shape of dict['${a.name}'] provided in model.execute(dict) must be [${i}], but was [${o.shape}]`)}a.attrParams.dtype&&a.attrParams.dtype.value&&S.assert(o.dtype===a.attrParams.dtype.value,()=>`The dtype of dict['${a.name}'] provided in model.execute(dict) must be ${a.attrParams.dtype.value}, but was ${o.dtype}`)})}mapInputs(t){var r,o;let n={};for(let a in t){let i=(o=(r=this._signature)===null||r===void 0?void 0:r.inputs)===null||o===void 0?void 0:o[a];i!=null?n[i.name]=t[a]:n[a]=t[a]}return n}checkInputs(t){let r=Object.keys(t).filter(o=>{let[n]=Wo(o);return this.graph.nodes[n]==null});if(r.length>0)throw new Error(`The dict provided in model.execute(dict) has keys: [${r}] that are not part of graph`)}mapOutputs(t){return t.map(r=>{var o,n;let a=(n=(o=this._signature)===null||o===void 0?void 0:o.outputs)===null||n===void 0?void 0:n[r];return a!=null?a.name:r},{})}checkOutputs(t){t.forEach(r=>{let[o]=Wo(r);if(!this.graph.nodes[o])throw new Error(`The output '${r}' is not found in the graph`)})}};var Tk=class{constructor(t={},r={}){this.hashTableNameToHandle=t,this.hashTableMap=r}addHashTable(t,r){this.hashTableNameToHandle[t]=r.handle,this.hashTableMap[r.id]=r}getHashTableHandleByName(t){return this.hashTableNameToHandle[t]}getHashTableById(t){return this.hashTableMap[t]}dispose(){for(let t in this.hashTableMap)this.hashTableMap[t].clearAndClose(),delete this.hashTableMap[t];for(let t in this.hashTableNameToHandle)this.hashTableNameToHandle[t].dispose(),delete this.hashTableNameToHandle[t]}};var zbe="?tfjs-format=file",$be="model.json",Ck=class{get modelVersion(){return this.version}get inputNodes(){return this.executor.inputNodes}get outputNodes(){return this.executor.outputNodes}get inputs(){return this.executor.inputs}get outputs(){return this.executor.outputs}get weights(){return this.executor.weightMap}get metadata(){return this.artifacts.userDefinedMetadata}get modelSignature(){return this.signature}get modelStructuredOutputKeys(){return this.structuredOutputKeys}constructor(t,r={},o=Sb){this.modelUrl=t,this.loadOptions=r,this.version="n/a",this.io=o,r==null&&(this.loadOptions={}),this.resourceManager=new Tk}findIOHandler(){let t=this.modelUrl;if(t.load!=null)this.handler=t;else if(this.loadOptions.requestInit!=null)this.handler=this.io.browserHTTPRequest(t,this.loadOptions);else{let r=this.io.getLoadHandlers(t,this.loadOptions);if(r.length===0)r.push(this.io.browserHTTPRequest(t,this.loadOptions));else if(r.length>1)throw new Error(`Found more than one (${r.length}) load handlers for URL '${[t]}'`);this.handler=r[0]}}load(){if(this.findIOHandler(),this.handler.load==null)throw new Error("Cannot proceed with model loading because the IOHandler provided does not have the `load` method implemented.");let t=this.handler.load();return S.isPromise(t)?t.then(r=>this.loadSync(r)):this.loadSync(t)}loadSync(t){this.artifacts=t;let r=this.artifacts.modelTopology,o=this.artifacts.signature;if(this.artifacts.userDefinedMetadata!=null){let a=this.artifacts.userDefinedMetadata;a.signature!=null&&(o=a.signature),a.structuredOutputKeys!=null&&(this.structuredOutputKeys=a.structuredOutputKeys)}this.signature=o,this.version=`${r.versions.producer}.${r.versions.minConsumer}`;let n=this.io.decodeWeights(this.artifacts.weightData,this.artifacts.weightSpecs);if(this.executor=new Tb(Eb.Instance.transformGraph(r,this.signature)),this.executor.weightMap=this.convertTensorMapToTensorsMap(n),this.executor.resourceManager=this.resourceManager,t.modelInitializer!=null&&t.modelInitializer.node!=null){let a=Eb.Instance.transformGraph(t.modelInitializer);this.initializer=new Tb(a),this.initializer.weightMap=this.executor.weightMap,this.initializer.resourceManager=this.resourceManager,this.initializerSignature=t.initializerSignature}return!0}async save(t,r){if(typeof t=="string"){let o=this.io.getSaveHandlers(t);if(o.length===0)throw new Error(`Cannot find any save handlers for URL '${t}'`);if(o.length>1)throw new Error(`Found more than one (${o.length}) save handlers for URL '${t}'`);t=o[0]}if(t.save==null)throw new Error("GraphModel.save() cannot proceed because the IOHandler provided does not have the `save` attribute defined.");return t.save(this.artifacts)}addStructuredOutputNames(t){if(this.structuredOutputKeys){let r=t instanceof $t?[t]:t,o={};return r.forEach((n,a)=>o[this.structuredOutputKeys[a]]=n),o}return t}predict(t,r){let o=this.execute(t,this.outputNodes);return this.addStructuredOutputNames(o)}async predictAsync(t,r){let o=await this.executeAsync(t,this.outputNodes);return this.addStructuredOutputNames(o)}normalizeInputs(t){var r;if(!(t instanceof $t)&&!Array.isArray(t)){let a=(r=this.signature)===null||r===void 0?void 0:r.inputs;if(a!=null)for(let i in a){let s=a[i];s.resourceId!=null&&(t[i]=this.resourceIdToCapturedInput[s.resourceId])}return t}t=Array.isArray(t)?t:[t];let o=Object.keys(this.resourceIdToCapturedInput).length;if(t.length+o!==this.inputNodes.length)throw new Error(`Input tensor count mismatch, the graph model has ${this.inputNodes.length-o} non-resource placeholders, while there are ${t.length} input tensors provided.`);let n=0;return this.inputNodes.reduce((a,i)=>{var s,c,l;let p=(l=(c=(s=this.signature)===null||s===void 0?void 0:s.inputs)===null||c===void 0?void 0:c[i])===null||l===void 0?void 0:l.resourceId;return p!=null?a[i]=this.resourceIdToCapturedInput[p]:a[i]=t[n++],a},{})}normalizeOutputs(t){return t=t||this.outputNodes,Array.isArray(t)?t:[t]}executeInitializerGraph(){return this.initializer==null?[]:this.initializerSignature==null?this.initializer.execute({},[]):this.initializer.execute({},Object.keys(this.initializerSignature.outputs))}async executeInitializerGraphAsync(){return this.initializer==null?[]:this.initializerSignature==null?this.initializer.executeAsync({},[]):this.initializer.executeAsync({},Object.keys(this.initializerSignature.outputs))}setResourceIdToCapturedInput(t){if(this.resourceIdToCapturedInput={},this.initializerSignature){let r=this.initializerSignature.outputs,o=Object.keys(r);for(let n=0;n<o.length;n++){let a=o[n],i=r[a];this.resourceIdToCapturedInput[i.resourceId]=t[n]}}}execute(t,r){this.resourceIdToCapturedInput==null&&this.setResourceIdToCapturedInput(this.executeInitializerGraph()),t=this.normalizeInputs(t),r=this.normalizeOutputs(r);let o=this.executor.execute(t,r);return o.length>1?o:o[0]}async executeAsync(t,r){this.resourceIdToCapturedInput==null&&this.setResourceIdToCapturedInput(await this.executeInitializerGraphAsync()),t=this.normalizeInputs(t),r=this.normalizeOutputs(r);let o=await this.executor.executeAsync(t,r);return o.length>1?o:o[0]}getIntermediateTensors(){return this.executor.getIntermediateTensors()}disposeIntermediateTensors(){this.executor.disposeIntermediateTensors()}convertTensorMapToTensorsMap(t){return Object.keys(t).reduce((r,o)=>(r[o]=[t[o]],r),{})}dispose(){this.executor.dispose(),this.initializer&&(this.initializer.dispose(),this.resourceIdToCapturedInput&&Yt(this.resourceIdToCapturedInput)),this.resourceManager.dispose()}};async function $A(e,t={},r=Sb){if(e==null)throw new Error("modelUrl in loadGraphModel() cannot be null. Please provide a url or an IOHandler that loads the model");t==null&&(t={}),t.fromTFHub&&typeof e=="string"&&(e=Lbe(e));let o=new Ck(e,t,r);return await o.load(),o}function Lbe(e){return e.endsWith("/")||(e=e+"/"),`${e}${$be}${zbe}`}var ac=function(){return ac=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},ac.apply(this,arguments)};function zs(e,t,r,o){return new(r||(r=Promise))(function(n,a){function i(l){try{c(o.next(l))}catch(p){a(p)}}function s(l){try{c(o.throw(l))}catch(p){a(p)}}function c(l){var p;l.done?n(l.value):(p=l.value,p instanceof r?p:new r(function(u){u(p)})).then(i,s)}c((o=o.apply(e,[])).next())})}function $s(e,t){var r,o,n,a,i={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(c){return function(l){return function(p){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,o&&(n=2&p[0]?o.return:p[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,p[1])).done)return n;switch(o=0,n&&(p=[2&p[0],n.value]),p[0]){case 0:case 1:n=p;break;case 4:return i.label++,{value:p[1],done:!1};case 5:i.label++,o=p[1],p=[0];continue;case 7:p=i.ops.pop(),i.trys.pop();continue;default:if(n=i.trys,!((n=n.length>0&&n[n.length-1])||p[0]!==6&&p[0]!==2)){i=0;continue}if(p[0]===3&&(!n||p[1]>n[0]&&p[1]<n[3])){i.label=p[1];break}if(p[0]===6&&i.label<n[1]){i.label=n[1],n=p;break}if(n&&i.label<n[2]){i.label=n[2],i.ops.push(p);break}n[2]&&i.ops.pop(),i.trys.pop();continue}p=t.call(e,i)}catch(u){p=[6,u],o=0}finally{r=n=0}if(5&p[0])throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}([c,l])}}}var kW=["rightEye","leftEye","noseTip","mouthCenter","rightEarTragion","leftEarTragion"],LA={modelType:"short",runtime:"mediapipe",maxFaces:1},Bbe=function(){function e(t){var r=this;this.width=0,this.height=0,this.selfieMode=!1,this.faceDetectorSolution=new U7({locateFile:function(o,n){if(t.solutionPath){var a=t.solutionPath.replace(/\/+$/,"");return"".concat(a,"/").concat(o)}return"".concat(n,"/").concat(o)}}),this.faceDetectorSolution.setOptions({selfieMode:this.selfieMode,model:t.modelType}),this.faceDetectorSolution.onResults(function(o){if(r.height=o.image.height,r.width=o.image.width,r.faces=[],o.detections!==null)for(var n=0,a=o.detections;n<a.length;n++){var i=a[n];r.faces.push(r.normalizedToAbsolute(i.landmarks,(s=i.boundingBox,c=void 0,l=void 0,p=void 0,c=s.xCenter-s.width/2,l=c+s.width,p=s.yCenter-s.height/2,{xMin:c,xMax:l,yMin:p,yMax:p+s.height,width:s.width,height:s.height})))}var s,c,l,p})}return e.prototype.normalizedToAbsolute=function(t,r){var o=this;return{keypoints:t.map(function(n,a){return{x:n.x*o.width,y:n.y*o.height,name:kW[a]}}),box:{xMin:r.xMin*this.width,yMin:r.yMin*this.height,xMax:r.xMax*this.width,yMax:r.yMax*this.height,width:r.width*this.width,height:r.height*this.height}}},e.prototype.estimateFaces=function(t,r){return zs(this,void 0,void 0,function(){var o,n;return $s(this,function(a){switch(a.label){case 0:return r&&r.flipHorizontal&&r.flipHorizontal!==this.selfieMode&&(this.selfieMode=r.flipHorizontal,this.faceDetectorSolution.setOptions({selfieMode:this.selfieMode})),t instanceof $t?(n=ImageData.bind,[4,kb.toPixels(t)]):[3,2];case 1:return o=new(n.apply(ImageData,[void 0,a.sent(),t.shape[1],t.shape[0]])),[3,3];case 2:o=t,a.label=3;case 3:return t=o,[4,this.faceDetectorSolution.send({image:t})];case 4:return a.sent(),[2,this.faces]}})})},e.prototype.dispose=function(){this.faceDetectorSolution.close()},e.prototype.reset=function(){this.faceDetectorSolution.reset(),this.width=0,this.height=0,this.faces=null,this.selfieMode=!1},e.prototype.initialize=function(){return this.faceDetectorSolution.initialize()},e}();function Ube(e){return zs(this,void 0,void 0,function(){var t,r;return $s(this,function(o){switch(o.label){case 0:return t=function(n){if(n==null)return ac({},LA);var a=ac({},n);return a.runtime="mediapipe",a.modelType==null&&(a.modelType=LA.modelType),a.maxFaces==null&&(a.maxFaces=LA.maxFaces),a}(e),[4,(r=new Bbe(t)).initialize()];case 1:return o.sent(),[2,r]}})})}function Wbe(e,t,r,o){var n=e.width,a=e.height,i=1,s=Math.cos(e.rotation),c=Math.sin(e.rotation),l=e.xCenter,p=e.yCenter,u=1/t,m=1/r,f=new Array(16);return f[0]=n*s*i*u,f[1]=-a*c*u,f[2]=0,f[3]=(-.5*n*s*i+.5*a*c+l)*u,f[4]=n*c*i*m,f[5]=a*s*m,f[6]=0,f[7]=(-.5*a*s-.5*n*c*i+p)*m,f[8]=0,f[9]=0,f[10]=n*u,f[11]=0,f[12]=0,f[13]=0,f[14]=0,f[15]=1,function(d){if(d.length!==16)throw new Error("Array length must be 16 but got ".concat(d.length));return[[d[0],d[1],d[2],d[3]],[d[4],d[5],d[6],d[7]],[d[8],d[9],d[10],d[11]],[d[12],d[13],d[14],d[15]]]}(f)}function _W(e){return e instanceof $t?{height:e.shape[0],width:e.shape[1]}:{height:e.height,width:e.width}}function EW(e){return e instanceof $t?e:kb.fromPixels(e)}function BA(e,t){S.assert(e.width!==0,function(){return"".concat(t," width cannot be 0.")}),S.assert(e.height!==0,function(){return"".concat(t," height cannot be 0.")})}function Hbe(e,t){var r=function(o,n,a,i){var s=n-o,c=i-a,l=c/s;return{scale:l,offset:a-o*l}}(0,255,t[0],t[1]);return He(function(){return be(ce(e,r.scale),r.offset)})}function Vbe(e,t,r){var o=t.outputTensorSize,n=t.keepAspectRatio,a=t.borderMode,i=t.outputTensorFloatRange,s=_W(e),c=function(m,f){return{xCenter:.5*m.width,yCenter:.5*m.height,width:m.width,height:m.height,rotation:0}}(s),l=function(m,f,d){if(d===void 0&&(d=!1),!d)return{top:0,left:0,right:0,bottom:0};var h=f.height,y=f.width;BA(f,"targetSize"),BA(m,"roi");var g,b,x=h/y,w=m.height/m.width,I=0,C=0;return x>w?(g=m.width,b=m.width*x,C=(1-w/x)/2):(g=m.height/x,b=m.height,I=(1-x/w)/2),m.width=g,m.height=b,{top:C,left:I,right:I,bottom:C}}(c,o,n),p=Wbe(c,s.width,s.height),u=He(function(){var m=EW(e),f=ai(function(y,g,b){return BA(b,"inputResolution"),[1/b.width*y[0][0]*g.width,1/b.height*y[0][1]*g.width,y[0][3]*g.width,1/b.width*y[1][0]*g.height,1/b.height*y[1][1]*g.height,y[1][3]*g.height,0,0]}(p,s,o),[1,8]),d=a==="zero"?"constant":"nearest",h=bb.transform(Dn(pt(m,"float32")),f,"bilinear",d,0,[o.height,o.width]);return i!=null?Hbe(h,i):h});return{imageTensor:u,padding:l,transformationMatrix:p}}function xW(e){e.reduceBoxesInLowestLayer==null&&(e.reduceBoxesInLowestLayer=!1),e.interpolatedScaleAspectRatio==null&&(e.interpolatedScaleAspectRatio=1),e.fixedAnchorSize==null&&(e.fixedAnchorSize=!1);for(var t=[],r=0;r<e.numLayers;){for(var o=[],n=[],a=[],i=[],s=r;s<e.strides.length&&e.strides[s]===e.strides[r];){var c=wW(e.minScale,e.maxScale,s,e.strides.length);if(s===0&&e.reduceBoxesInLowestLayer)a.push(1),a.push(2),a.push(.5),i.push(.1),i.push(c),i.push(c);else{for(var l=0;l<e.aspectRatios.length;++l)a.push(e.aspectRatios[l]),i.push(c);if(e.interpolatedScaleAspectRatio>0){var p=s===e.strides.length-1?1:wW(e.minScale,e.maxScale,s+1,e.strides.length);i.push(Math.sqrt(c*p)),a.push(e.interpolatedScaleAspectRatio)}}s++}for(var u=0;u<a.length;++u){var m=Math.sqrt(a[u]);o.push(i[u]/m),n.push(i[u]*m)}var f=0,d=0;if(e.featureMapHeight.length>0)f=e.featureMapHeight[r],d=e.featureMapWidth[r];else{var h=e.strides[r];f=Math.ceil(e.inputSizeHeight/h),d=Math.ceil(e.inputSizeWidth/h)}for(var y=0;y<f;++y)for(var g=0;g<d;++g)for(var b=0;b<o.length;++b){var x={xCenter:(g+e.anchorOffsetX)/d,yCenter:(y+e.anchorOffsetY)/f,width:0,height:0};e.fixedAnchorSize?(x.width=1,x.height=1):(x.width=n[b],x.height=o[b]),t.push(x)}r=s}return t}function wW(e,t,r,o){return o===1?.5*(e+t):e+(t-e)*r/(o-1)}function SW(e,t){var r=t[0],o=t[1];return[r*e[0]+o*e[1]+e[3],r*e[4]+o*e[5]+e[7]]}function jbe(e){return He(function(){var t=function(n){return He(function(){return[We(n,[0,0,0],[1,-1,1]),We(n,[0,0,1],[1,-1,-1])]})}(e),r=t[0],o=t[1];return{boxes:Lr(o),logits:Lr(r)}})}function Gbe(e,t,r,o){return zs(this,void 0,void 0,function(){var n,a,i,s,c;return $s(this,function(l){switch(l.label){case 0:return e.sort(function(p,u){return Math.max.apply(Math,u.score)-Math.max.apply(Math,p.score)}),n=ai(e.map(function(p){return[p.locationData.relativeBoundingBox.yMin,p.locationData.relativeBoundingBox.xMin,p.locationData.relativeBoundingBox.yMax,p.locationData.relativeBoundingBox.xMax]})),a=yr(e.map(function(p){return p.score[0]})),[4,bb.nonMaxSuppressionAsync(n,a,t,r)];case 1:return[4,(i=l.sent()).array()];case 2:return s=l.sent(),c=e.filter(function(p,u){return s.indexOf(u)>-1}),Yt([n,a,i]),[2,c]}})})}function qbe(e,t,r){return zs(this,void 0,void 0,function(){var o,n,a,i,s;return $s(this,function(c){switch(c.label){case 0:return o=e[0],n=e[1],a=function(l,p,u){return He(function(){var m,f,d,h;u.reverseOutputOrder?(f=Lr(We(l,[0,u.boxCoordOffset+0],[-1,1])),m=Lr(We(l,[0,u.boxCoordOffset+1],[-1,1])),h=Lr(We(l,[0,u.boxCoordOffset+2],[-1,1])),d=Lr(We(l,[0,u.boxCoordOffset+3],[-1,1]))):(m=Lr(We(l,[0,u.boxCoordOffset+0],[-1,1])),f=Lr(We(l,[0,u.boxCoordOffset+1],[-1,1])),d=Lr(We(l,[0,u.boxCoordOffset+2],[-1,1])),h=Lr(We(l,[0,u.boxCoordOffset+3],[-1,1]))),f=be(ce(je(f,u.xScale),p.w),p.x),m=be(ce(je(m,u.yScale),p.h),p.y),u.applyExponentialOnBoxSize?(d=ce(ln(je(d,u.hScale)),p.h),h=ce(ln(je(h,u.wScale)),p.w)):(d=ce(je(d,u.hScale),p.h),h=ce(je(h,u.wScale),p.h));var y=Fe(m,je(d,2)),g=Fe(f,je(h,2)),b=be(m,je(d,2)),x=be(f,je(h,2)),w=Gt([K(y,[u.numBoxes,1]),K(g,[u.numBoxes,1]),K(b,[u.numBoxes,1]),K(x,[u.numBoxes,1])],1);if(u.numKeypoints)for(var I=0;I<u.numKeypoints;++I){var C=u.keypointCoordOffset+I*u.numValuesPerKeypoint,R=void 0,P=void 0;u.reverseOutputOrder?(R=Lr(We(l,[0,C],[-1,1])),P=Lr(We(l,[0,C+1],[-1,1]))):(P=Lr(We(l,[0,C],[-1,1])),R=Lr(We(l,[0,C+1],[-1,1])));var z=be(ce(je(R,u.xScale),p.w),p.x),$=be(ce(je(P,u.yScale),p.h),p.y);w=Gt([w,K(z,[u.numBoxes,1]),K($,[u.numBoxes,1])],1)}return w})}(n,t,r),i=He(function(){var l=o;return r.sigmoidScore?(r.scoreClippingThresh!=null&&(l=mS(o,-r.scoreClippingThresh,r.scoreClippingThresh)),l=Sa(l)):l}),[4,Kbe(a,i,r)];case 1:return s=c.sent(),Yt([a,i]),[2,s]}})})}function Kbe(e,t,r){return zs(this,void 0,void 0,function(){var o,n,a,i,s,c,l,p,u,m,f,d;return $s(this,function(h){switch(h.label){case 0:return o=[],[4,e.data()];case 1:return n=h.sent(),[4,t.data()];case 2:for(a=h.sent(),i=0;i<r.numBoxes;++i)if(!(r.minScoreThresh!=null&&a[i]<r.minScoreThresh||(s=i*r.numCoords,c=Xbe(n[s+0],n[s+1],n[s+2],n[s+3],a[i],r.flipVertically,i),(l=c.locationData.relativeBoundingBox).width<0||l.height<0))){if(r.numKeypoints>0)for((p=c.locationData).relativeKeypoints=[],u=r.numKeypoints*r.numValuesPerKeypoint,m=0;m<u;m+=r.numValuesPerKeypoint)f=s+r.keypointCoordOffset+m,d={x:n[f+0],y:r.flipVertically?1-n[f+1]:n[f+1]},p.relativeKeypoints.push(d);o.push(c)}return[2,o]}})})}function Xbe(e,t,r,o,n,a,i){return{score:[n],ind:i,locationData:{relativeBoundingBox:{xMin:t,yMin:a?1-r:e,xMax:o,yMax:a?1-e:r,width:o-t,height:r-e}}}}var Ybe={reduceBoxesInLowestLayer:!1,interpolatedScaleAspectRatio:1,featureMapHeight:[],featureMapWidth:[],numLayers:4,minScale:.1484375,maxScale:.75,inputSizeHeight:128,inputSizeWidth:128,anchorOffsetX:.5,anchorOffsetY:.5,strides:[8,16,16,16],aspectRatios:[1],fixedAnchorSize:!0},Qbe={reduceBoxesInLowestLayer:!1,interpolatedScaleAspectRatio:0,featureMapHeight:[],featureMapWidth:[],numLayers:1,minScale:.1484375,maxScale:.75,inputSizeHeight:192,inputSizeWidth:192,anchorOffsetX:.5,anchorOffsetY:.5,strides:[4],aspectRatios:[1],fixedAnchorSize:!0},UA={runtime:"tfjs",modelType:"short",maxFaces:1,detectorModelUrl:"https://tfhub.dev/mediapipe/tfjs-model/face_detection/short/1"},Jbe={applyExponentialOnBoxSize:!1,flipVertically:!1,ignoreClasses:[],numClasses:1,numBoxes:896,numCoords:16,boxCoordOffset:0,keypointCoordOffset:4,numKeypoints:6,numValuesPerKeypoint:2,sigmoidScore:!0,scoreClippingThresh:100,reverseOutputOrder:!0,xScale:128,yScale:128,hScale:128,wScale:128,minScoreThresh:.5},Zbe={applyExponentialOnBoxSize:!1,flipVertically:!1,ignoreClasses:[],numClasses:1,numBoxes:2304,numCoords:16,boxCoordOffset:0,keypointCoordOffset:4,numKeypoints:6,numValuesPerKeypoint:2,sigmoidScore:!0,scoreClippingThresh:100,reverseOutputOrder:!0,xScale:192,yScale:192,hScale:192,wScale:192,minScoreThresh:.6},exe=.3,txe={outputTensorSize:{width:128,height:128},keepAspectRatio:!0,outputTensorFloatRange:[-1,1],borderMode:"zero"},rxe={outputTensorSize:{width:192,height:192},keepAspectRatio:!0,outputTensorFloatRange:[-1,1],borderMode:"zero"},Cb,oxe=function(){function e(t,r,o){this.detectorModel=r,this.maxFaces=o,t==="full"?(this.imageToTensorConfig=rxe,this.tensorsToDetectionConfig=Zbe,this.anchors=xW(Qbe)):(this.imageToTensorConfig=txe,this.tensorsToDetectionConfig=Jbe,this.anchors=xW(Ybe));var n=yr(this.anchors.map(function(c){return c.width})),a=yr(this.anchors.map(function(c){return c.height})),i=yr(this.anchors.map(function(c){return c.xCenter})),s=yr(this.anchors.map(function(c){return c.yCenter}));this.anchorTensor={x:i,y:s,w:n,h:a}}return e.prototype.dispose=function(){this.detectorModel.dispose(),Yt([this.anchorTensor.x,this.anchorTensor.y,this.anchorTensor.w,this.anchorTensor.h])},e.prototype.reset=function(){},e.prototype.detectFaces=function(t,r){return r===void 0&&(r=!1),zs(this,void 0,void 0,function(){var o,n,a,i,s,c,l,p,u,m,f;return $s(this,function(d){switch(d.label){case 0:return t==null?(this.reset(),[2,[]]):(o=He(function(){var h=pt(EW(t),"float32");return r&&(h=Lr(bb.flipLeftRight(Dn(h,0)),[0])),h}),n=Vbe(o,this.imageToTensorConfig),a=n.imageTensor,i=n.transformationMatrix,s=this.detectorModel.execute(a,"Identity:0"),c=jbe(s),l=c.boxes,[4,qbe([p=c.logits,l],this.anchorTensor,this.tensorsToDetectionConfig)]);case 1:return(u=d.sent()).length===0?(Yt([o,a,s,p,l]),[2,u]):[4,Gbe(u,this.maxFaces,exe)];case 2:return m=d.sent(),f=function(h,y){h===void 0&&(h=[]);var g,b=(g=y,[].concat.apply([],g));return h.forEach(function(x){var w=x.locationData;w.relativeKeypoints.forEach(function($){var B=SW(b,[$.x,$.y]),V=B[0],H=B[1];$.x=V,$.y=H});var I=w.relativeBoundingBox,C=Number.MAX_VALUE,R=Number.MAX_VALUE,P=Number.MIN_VALUE,z=Number.MIN_VALUE;[[I.xMin,I.yMin],[I.xMin+I.width,I.yMin],[I.xMin+I.width,I.yMin+I.height],[I.xMin,I.yMin+I.height]].forEach(function($){var B=SW(b,$),V=B[0],H=B[1];C=Math.min(C,V),P=Math.max(P,V),R=Math.min(R,H),z=Math.max(z,H)}),w.relativeBoundingBox={xMin:C,xMax:P,yMin:R,yMax:z,width:P-C,height:z-R}}),h}(m,i),Yt([o,a,s,p,l]),[2,f]}})})},e.prototype.estimateFaces=function(t,r){return zs(this,void 0,void 0,function(){var o,n;return $s(this,function(a){return o=_W(t),n=!!r&&r.flipHorizontal,[2,this.detectFaces(t,n).then(function(i){return i.map(function(s){for(var c=s.locationData.relativeKeypoints.map(function(d,h){return ac(ac({},d),{x:d.x*o.width,y:d.y*o.height,name:kW[h]})}),l=s.locationData.relativeBoundingBox,p=0,u=["width","xMax","xMin"];p<u.length;p++)l[u[p]]*=o.width;for(var m=0,f=["height","yMax","yMin"];m<f.length;m++)l[f[m]]*=o.height;return{keypoints:c,box:l}})})]})})},e}();function nxe(e){return zs(this,void 0,void 0,function(){var t,r,o;return $s(this,function(n){switch(n.label){case 0:return t=function(a){if(a==null)return ac({},UA);var i=ac({},a);return i.modelType==null&&(i.modelType=UA.modelType),i.maxFaces==null&&(i.maxFaces=UA.maxFaces),i.detectorModelUrl==null&&(i.modelType==="full"?i.detectorModelUrl="https://tfhub.dev/mediapipe/tfjs-model/face_detection/full/1":i.detectorModelUrl="https://tfhub.dev/mediapipe/tfjs-model/face_detection/short/1"),i}(e),r=typeof t.detectorModelUrl=="string"&&t.detectorModelUrl.indexOf("https://tfhub.dev")>-1,[4,$A(t.detectorModelUrl,{fromTFHub:r})];case 1:return o=n.sent(),[2,new oxe(t.modelType,o,t.maxFaces)]}})})}function IW(e,t){return zs(this,void 0,void 0,function(){var r,o;return $s(this,function(n){if(e===Cb.MediaPipeFaceDetector){if(o=void 0,(r=t)!=null){if(r.runtime==="tfjs")return[2,nxe(r)];if(r.runtime==="mediapipe")return[2,Ube(r)];o=r.runtime}throw new Error("Expect modelConfig.runtime to be either 'tfjs' "+"or 'mediapipe', but got ".concat(o))}throw new Error("".concat(e," is not a supported model name."))})})}(function(e){e.MediaPipeFaceDetector="MediaPipeFaceDetector"})(Cb||(Cb={}));var Ae;(function(e){e[e.float32=0]="float32",e[e.int32=1]="int32",e[e.bool=2]="bool",e[e.string=3]="string",e[e.complex64=4]="complex64"})(Ae||(Ae={}));var ic;(function(e){e[e.linear=0]="linear",e[e.relu=1]="relu",e[e.relu6=2]="relu6",e[e.prelu=3]="prelu",e[e.leakyrelu=4]="leakyrelu",e[e.sigmoid=5]="sigmoid",e[e.elu=6]="elu"})(ic||(ic={}));var TW;function axe(e){TW=e.wasm.cwrap(Hl,null,["number","array","number","number","array","number","number","number","number","number","number","number","number"])}function ixe(e){let{inputs:t,backend:r,attrs:o}=e,{a:n,b:a,bias:i,preluActivationWeights:s}=t;if(n.dtype!=="float32"||a.dtype!=="float32")throw new Error("_FusedMatMul for non non-float32 tensors not yet supported.");let{transposeA:c,transposeB:l,activation:p,leakyreluAlpha:u}=o,m=r.dataIdMap.get(n.dataId).id,f=r.dataIdMap.get(a.dataId).id,d=0;if(i!=null){let P=r.dataIdMap.get(i.dataId);if(P.shape.length!==1)throw new Error(`_FusedMatMul only supports rank-1 bias but got rank ${P.shape.length}.`);d=P.id}let h=s==null?0:r.dataIdMap.get(s.dataId).id,y=ic[p];if(y==null)throw new Error(`${p} activation not yet supported for FusedConv2D in the wasm backend.`);let g=c?n.shape[2]:n.shape[1],b=l?a.shape[1]:a.shape[2],x=ka.assertAndGetBroadcastShape(n.shape.slice(0,-2),a.shape.slice(0,-2)),w=r.makeOutput([...x,g,b],n.dtype),I=r.dataIdMap.get(w.dataId).id,C=new Uint8Array(new Int32Array(n.shape).buffer),R=new Uint8Array(new Int32Array(a.shape).buffer);return TW(m,C,n.shape.length,f,R,a.shape.length,c,l,y,d,h,u||0,I),w}var CW={kernelName:Hl,backendName:"wasm",setupFunc:axe,kernelFunc:ixe};function we(e,t){let r;function o(a){r=a.wasm.cwrap(e,null,["number","number","number"])}function n(a){let{backend:i,inputs:{x:s}}=a,c=i.dataIdMap.get(s.dataId).id,l=i.makeOutput(s.shape,t||s.dtype),p=i.dataIdMap.get(l.dataId).id;return S.sizeFromShape(l.shape)===0||r(c,Ae[s.dtype],p),l}return{kernelName:e,backendName:"wasm",setupFunc:o,kernelFunc:n}}var NW=we(eh);var AW=we(xp);var RW=we(wp);function ut(e,t,r){let o;function n(i){o=i.wasm.cwrap(e,null,["number","array","number","number","array","number","number","number"])}function a(i){let{backend:s,inputs:c}=i,{a:l,b:p}=c,u=s.dataIdMap.get(l.dataId).id,m=s.dataIdMap.get(p.dataId).id,f=r??l.dtype,d=M.assertAndGetBroadcastShape(l.shape,p.shape),h=s.makeOutput(d,f);if(S.sizeFromShape(d)===0)return h;let y=new Uint8Array(new Int32Array(l.shape).buffer),g=new Uint8Array(new Int32Array(p.shape).buffer),b=s.dataIdMap.get(h.dataId).id;return o(u,y,l.shape.length,m,g,p.shape.length,Ae[l.dtype],b),h}return{kernelName:e,backendName:"wasm",setupFunc:n,kernelFunc:a}}var sxe=!0,DW=ut(Is,sxe);var FW;function lxe(e){FW=e.wasm.cwrap(Sp,null,["array","number","number","number"])}function cxe(e){let{inputs:t,backend:r}=e,o=r.makeOutput(t[0].shape,t[0].dtype);if(S.sizeFromShape(o.shape)===0)return o;let n=t.map(s=>r.dataIdMap.get(s.dataId).id),a=new Uint8Array(new Int32Array(n).buffer),i=r.dataIdMap.get(o.dataId).id;return FW(a,n.length,Ae[o.dtype],i),o}var MW={kernelName:Sp,backendName:"wasm",setupFunc:lxe,kernelFunc:cxe};function Pm(e){let{inputs:{x:t},backend:r}=e;if(t.dtype==="string")return go(r.readSync(t.dataId),t.shape,t.dtype);let o=r.makeOutput(t.shape,t.dtype),n=r.typedArrayFromHeap(t);return r.typedArrayFromHeap(o).set(n),o}var OW={kernelName:Ul,backendName:"wasm",kernelFunc:Pm};var PW;function pxe(e){PW=e.wasm.cwrap(Cs,null,["number","array","number","number","number","array","number"])}function ea(e){let{inputs:t,backend:r,attrs:o}=e,[n,a]=mxe(t.x.shape,o.perm),i=!0;for(let d=0;d<a.length;d++)a[d]!==d&&(i=!1);let s=uxe(t.x.shape,o.perm),c={dataId:t.x.dataId,shape:n,dtype:t.x.dtype};if(i){let d=Pm({inputs:t,backend:r});return d.shape=s,d}let l=r.makeOutput(s,c.dtype),p=r.dataIdMap.get(c.dataId).id,u=r.dataIdMap.get(l.dataId).id,m=new Uint8Array(new Int32Array(a).buffer),f=new Uint8Array(new Int32Array(c.shape).buffer);return PW(p,f,c.shape.length,Ae[c.dtype],u,m,a.length),l}function uxe(e,t){let r=new Array(e.length);for(let o=0;o<r.length;o++)r[o]=e[t[o]];return r}function mxe(e,t){let r=[],o=[];for(let n=0;n<e.length;++n)e[n]!==1&&r.push(e[n]),e[t[n]]!==1&&o.push(t[n]);for(let n=0;n<o.length;++n){let a=-1;for(let i=0;i<o.length;++i)o[i]>=n&&(a===-1||o[a]>o[i])&&(a=i);o[a]=n}return[r,o]}var zW={kernelName:Cs,backendName:"wasm",kernelFunc:ea,setupFunc:pxe};function Ho(e,t,r){let o=e.shape,n=e.shape.length,a=S.parseAxisParam(t,o),i=a,s=M.getAxesPermutation(i,n),c=null,l=!1;if(s!=null){let p=new Array(n);for(let f=0;f<p.length;f++)p[f]=o[s[f]];i=M.getInnerMostAxes(i.length,n),c=ea({inputs:{x:e},attrs:{perm:s},backend:r});let u=r.dataIdMap.get(e.dataId).id;r.dataIdMap.get(c.dataId).id!==u&&(l=!0)}return{transposed:c,originalAxes:a,axes:i,inputWasTransposed:l}}var $W;function fxe(e){$W=e.wasm.cwrap(kp,null,["number, number, number"])}function dxe(e){let{backend:t,inputs:r,attrs:o}=e,{axis:n,keepDims:a}=o,{x:i}=r,c=t.dataIdMap.get(i.dataId).id,l=i,{transposed:p,axes:u,originalAxes:m,inputWasTransposed:f}=Ho(i,n,t);if(f){let x=t.dataIdMap.get(p.dataId).id;l=p,c=x}let d=l.shape.length;M.assertAxesAreInnerMostDims("all",u,d);let[h,y]=M.computeOutAndReduceShapes(l.shape,u),g=S.sizeFromShape(y),b=t.makeOutput(h,i.dtype);if(S.sizeFromShape(l.shape)!==0){let x=t.dataIdMap.get(b.dataId).id;$W(c,g,x)}if(f&&t.disposeData(p.dataId),a){let x=M.expandShapeToKeepDim(b.shape,m);b.shape=x}return b}var LW={kernelName:kp,backendName:"wasm",setupFunc:fxe,kernelFunc:dxe};var BW;function hxe(e){BW=e.wasm.cwrap(_p,null,["number, number, number"])}function gxe(e){let{backend:t,inputs:r,attrs:o}=e,{axis:n,keepDims:a}=o,{x:i}=r,c=t.dataIdMap.get(i.dataId).id,l=i,{transposed:p,axes:u,originalAxes:m,inputWasTransposed:f}=Ho(i,n,t);if(f){let x=t.dataIdMap.get(p.dataId).id;l=p,c=x}let d=l.shape.length;M.assertAxesAreInnerMostDims("any",u,d);let[h,y]=M.computeOutAndReduceShapes(l.shape,u),g=S.sizeFromShape(y),b=t.makeOutput(h,i.dtype);if(S.sizeFromShape(l.shape)!==0){let x=t.dataIdMap.get(b.dataId).id;BW(c,g,x)}if(f&&t.disposeData(p.dataId),a){let x=M.expandShapeToKeepDim(b.shape,m);b.shape=x}return b}var UW={kernelName:_p,backendName:"wasm",setupFunc:hxe,kernelFunc:gxe};function Nk(e){let t;function r(n){t=n.wasm.cwrap(e,null,["number","number","number","number","number"])}function o(n){let{backend:a,inputs:i,attrs:s}=n,{axis:c}=s,{x:l}=i,p=a.dataIdMap.get(l.dataId).id,u=p,m=l,{transposed:f,axes:d,inputWasTransposed:h}=Ho(l,c,a);if(h){let I=a.dataIdMap.get(f.dataId).id;I!==p&&(m=f,u=I)}let y=m.shape.slice(0,-1),g=a.makeOutput(y,"int32"),b=a.dataIdMap.get(g.dataId).id,x=S.sizeFromShape(g.shape),w=m.shape[d[0]];return t(u,Ae[m.dtype],x,w,b),h&&a.disposeData(f.dataId),g}return{kernelName:e,backendName:"wasm",setupFunc:r,kernelFunc:o}}var WW=Nk(th);var HW=Nk(rh);var VW=we(Ep);var jW=we(Ip);var GW=we(Tp);var qW=ut(Np,!1);var KW=we(Cp);var XW;function yxe(e){XW=e.wasm.cwrap(Ap,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function vxe(e){let{inputs:t,attrs:r,backend:o}=e,n=t.x,a=o.dataIdMap.get(n.dataId).id,{filterSize:i,strides:s,pad:c,dimRoundingMode:l}=r,p=M.computePool2DInfo(n.shape,i,s,1,c,l),u=p.filterHeight,m=p.filterWidth,f=p.padInfo.top,d=p.padInfo.right,h=p.padInfo.bottom,y=p.padInfo.left,g=p.strideHeight,b=p.strideWidth,x=p.inChannels;if(p.dataFormat!=="channelsLast")throw new Error(`wasm backend does not support dataFormat:'${p.dataFormat}'. Please use 'channelsLast'.`);if(p.dilationWidth!==1||p.dilationHeight!==1)throw new Error(`was backend only supports average pooling with dilation = [1, 1], got [${p.dilationHeight}, ${p.dilationWidth}].`);let w=o.makeOutput(p.outShape,"float32"),I=o.dataIdMap.get(w.dataId).id;return XW(a,n.shape[0],n.shape[1],n.shape[2],u,m,f,d,h,y,g,b,x,I),w}var YW={kernelName:Ap,backendName:"wasm",setupFunc:yxe,kernelFunc:vxe};var QW;function bxe(e){QW=e.wasm.cwrap("AvgPool3D",null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function xxe(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,{filterSize:a,strides:i,pad:s,dimRoundingMode:c,dataFormat:l}=o,p=M.computePool3DInfo(n.shape,a,i,1,s,c,l),u=r.makeOutput(p.outShape,n.dtype);return QW(r.dataIdMap.get(n.dataId).id,r.dataIdMap.get(u.dataId).id,p.batchSize,p.inChannels,p.inDepth,p.inHeight,p.inWidth,p.outDepth,p.outHeight,p.outWidth,p.strideDepth,p.strideHeight,p.strideWidth,p.dilationDepth,p.dilationHeight,p.dilationWidth,p.effectiveFilterDepth,p.effectiveFilterHeight,p.effectiveFilterWidth,p.padInfo.front,p.padInfo.top,p.padInfo.left),u}var JW={kernelName:oh,backendName:"wasm",setupFunc:bxe,kernelFunc:xxe};var ZW;function wxe(e){ZW=e.wasm.cwrap("AvgPool3DGrad",null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function Sxe(e){let{inputs:t,backend:r,attrs:o}=e,{dy:n,input:a}=t,{filterSize:i,strides:s,pad:c,dimRoundingMode:l}=o,p=M.computePool3DInfo(a.shape,i,s,1,c,l),u=r.makeOutput(a.shape,a.dtype);return ZW(r.dataIdMap.get(n.dataId).id,r.dataIdMap.get(u.dataId).id,p.batchSize,p.inChannels,p.inDepth,p.inHeight,p.inWidth,p.outDepth,p.outHeight,p.outWidth,p.strideDepth,p.strideHeight,p.strideWidth,p.dilationDepth,p.dilationHeight,p.dilationWidth,p.effectiveFilterDepth,p.effectiveFilterHeight,p.effectiveFilterWidth,p.padInfo.front,p.padInfo.top,p.padInfo.left,p.filterDepth,p.filterHeight,p.filterWidth),u}var eH={kernelName:_1,backendName:"wasm",setupFunc:wxe,kernelFunc:Sxe};var tH;function kxe(e){tH=e.wasm.cwrap("AvgPoolGrad",null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function _xe(e){let{inputs:t,backend:r,attrs:o}=e,{dy:n,input:a}=t,{filterSize:i,strides:s,pad:c}=o,l=M.computePool2DInfo(a.shape,i,s,1,c),p=r.makeOutput(a.shape,a.dtype);return tH(r.dataIdMap.get(n.dataId).id,r.dataIdMap.get(p.dataId).id,l.batchSize,l.inChannels,l.inHeight,l.inWidth,l.outHeight,l.outWidth,l.strideHeight,l.strideWidth,l.dilationHeight,l.dilationWidth,l.effectiveFilterHeight,l.effectiveFilterWidth,l.padInfo.top,l.padInfo.left,l.filterHeight,l.filterWidth),p}var rH={kernelName:k1,backendName:"wasm",setupFunc:kxe,kernelFunc:_xe};function Fr(e){let{inputs:t,attrs:r}=e,{x:o}=t,{shape:n}=r,a=S.sizeFromShape(o.shape),i=S.inferFromImplicitShape(n,a);return S.assert(a===S.sizeFromShape(i),()=>`new shape: ${i}, old shape: ${o.shape}. New shape and old shape must have the same number of elements.`),e.backend.incRef(o.dataId),{dataId:o.dataId,shape:i,dtype:o.dtype}}var oH={kernelName:xh,backendName:"wasm",kernelFunc:Fr};var nH;function Exe(e){nH=e.wasm.cwrap(Rp,null,["number","array","number","number","array","number","number","number","number"])}function Ixe(e){let{inputs:t,backend:r,attrs:o}=e,{a:n,b:a}=t,{transposeA:i,transposeB:s}=o;if(n.dtype!=="float32"||a.dtype!=="float32")throw new Error("BatchMatMul for non non-float32 tensors not yet supported.");let c=n.shape.length,l=a.shape.length,p=i?n.shape[c-2]:n.shape[c-1],u=s?a.shape[l-1]:a.shape[l-2],m=i?n.shape[c-1]:n.shape[c-2],f=s?a.shape[l-2]:a.shape[l-1],d=n.shape.slice(0,-2),h=a.shape.slice(0,-2),y=S.sizeFromShape(d),g=S.sizeFromShape(h),x=ka.assertAndGetBroadcastShape(n.shape.slice(0,-2),a.shape.slice(0,-2)).concat([m,f]);S.assert(p===u,()=>`Error in matMul: inner shapes (${p}) and (${u}) of Tensors with shapes ${n.shape} and ${a.shape} and transposeA=${i} and transposeB=${s} must match.`);let w=i?[y,p,m]:[y,m,p],I=s?[g,f,u]:[g,u,f],C=Fr({inputs:{x:n},backend:r,attrs:{shape:w}}),R=Fr({inputs:{x:a},backend:r,attrs:{shape:I}}),P=r.dataIdMap.get(C.dataId).id,z=r.dataIdMap.get(R.dataId).id,$=i?C.shape[2]:C.shape[1],B=s?R.shape[1]:R.shape[2],V=Math.max(y,g),H=r.makeOutput([V,$,B],C.dtype),G=r.dataIdMap.get(H.dataId).id,X=new Uint8Array(new Int32Array(C.shape).buffer),ee=new Uint8Array(new Int32Array(R.shape).buffer);return nH(P,X,C.shape.length,z,ee,R.shape.length,i,s,G),r.disposeData(C.dataId),r.disposeData(R.dataId),H.shape=x,H}var aH={kernelName:Rp,backendName:"wasm",setupFunc:Exe,kernelFunc:Ixe};function ne(e,t){Array.isArray(e)||(e=[e]),e.forEach(r=>{r!=null&&S.assert(r.dtype!=="complex64",()=>`${t} does not support complex64 tensors in the CPU backend.`)})}function Txe(e){let t=new Float32Array(e.length);for(let r=0;r<e.length;++r)t[r]=Math.abs(e[r]);return t}var Cxe=e=>{let{x:t}=e.inputs,r=e.backend;ne(t,"abs");let o=new Float32Array(S.sizeFromShape(t.shape)),n=r.data.get(t.dataId).values;return o=Txe(n),r.makeOutput(o,t.shape,t.dtype)},iH={kernelName:eh,backendName:"cpu",kernelFunc:Cxe};function it(e){return(t,r,o,n,a)=>{let i=M.assertAndGetBroadcastShape(t,r),s=i.length,c=S.computeStrides(i),l=S.sizeFromShape(i),p=S.getTypedArrayFromDType(a,l),u=t.length,m=r.length,f=S.computeStrides(t),d=S.computeStrides(r),h=M.getBroadcastDims(t,i),y=M.getBroadcastDims(r,i);if(h.length+y.length===0)for(let g=0;g<p.length;++g)p[g]=e(o[g%o.length],n[g%n.length]);else for(let g=0;g<p.length;++g){let b=S.indexToLoc(g,s,c),x=b.slice(-u);h.forEach(R=>x[R]=0);let w=S.locToIndex(x,u,f),I=b.slice(-m);y.forEach(R=>I[R]=0);let C=S.locToIndex(I,m,d);p[g]=e(o[w],n[C])}return[p,i]}}function qr(e){let{inputs:t,backend:r}=e,{real:o,imag:n}=t,a=r.data.get(o.dataId).values,i=r.data.get(n.dataId).values,s=r.makeTensorInfo(o.shape,"complex64"),c=r.data.get(s.dataId);return c.complexTensorInfos={real:r.makeTensorInfo(o.shape,"float32",a),imag:r.makeTensorInfo(n.shape,"float32",i)},s}var sH={kernelName:E1,backendName:"cpu",kernelFunc:qr};function rg(e,t,r="float32"){if(r==="complex64"){let n=rg(e,t,"float32"),a=rg(e,t,"float32");return qr({inputs:{real:n,imag:a},backend:e})}let o=S.makeZerosTypedArray(S.sizeFromShape(t),r);return e.makeTensorInfo(t,r,o)}function xo(e){let{inputs:t,backend:r}=e,{x:o}=t;return r.incRef(o.dataId),{dataId:o.dataId,shape:o.shape,dtype:o.dtype}}var lH={kernelName:Ul,backendName:"cpu",kernelFunc:xo};function Ea(e){let{inputs:t,backend:r}=e,{input:o}=t,n=r.data.get(o.dataId).complexTensorInfos.real,a=r.data.get(n.dataId).values;return r.makeTensorInfo(n.shape,n.dtype,a)}var cH={kernelName:L1,backendName:"cpu",kernelFunc:Ea};function Nxe(e,t,r,o){if(o==="int32"){let n=Int32Array.from(e);return[t,"int32",n]}if(o==="bool"){let n=S.toTypedArray([0],r),[a,i]=it((s,c)=>s!==c?1:0)(t,[],e,n,"bool");return[i,"bool",a]}throw new Error(`Error in Cast: failed to cast ${r} to ${o}`)}function Ia(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,{dtype:a}=o;if(a==="complex64"){if(n.dtype==="complex64")return xo({inputs:{x:n},backend:r});let p=rg(r,n.shape,n.dtype),u=Ia({inputs:{x:n},backend:r,attrs:{dtype:"float32"}}),m=qr({inputs:{real:u,imag:p},backend:r});return r.disposeIntermediateTensorInfo(p),r.disposeIntermediateTensorInfo(u),m}if(n.dtype==="complex64"){let p=Ea({inputs:{input:n},backend:r}),u=Ia({inputs:{x:p},backend:r,attrs:{dtype:a}});return r.disposeIntermediateTensorInfo(p),u}if(!S.hasEncodingLoss(n.dtype,a)){let p=xo({inputs:{x:n},backend:r});return{dataId:p.dataId,shape:p.shape,dtype:a}}let i=r.data.get(n.dataId).values,[s,c,l]=Nxe(i,n.shape,n.dtype,a);return r.makeTensorInfo(s,c,l)}var pH={kernelName:Ll,backendName:"cpu",kernelFunc:Ia};function ht(e,t,r,o){return r==null?({inputs:n,backend:a})=>{let{a:i,b:s}=n,c=a;ne([i,s],e);let l=c.data.get(i.dataId).values,p=c.data.get(s.dataId).values,u=i.dtype==="string"?M.fromUint8ToStringArray(l):l,m=i.dtype==="string"?M.fromUint8ToStringArray(p):p,f=o||i.dtype,[d,h]=t(i.shape,s.shape,u,m,f);return c.makeTensorInfo(h,f,d)}:({inputs:n,backend:a})=>{let{a:i,b:s}=n,c=a;if(i.dtype==="complex64"||s.dtype==="complex64"){let l=Ia({inputs:{x:i},backend:c,attrs:{dtype:"complex64"}}),p=c.data.get(l.dataId),u=p.complexTensorInfos.real,m=p.complexTensorInfos.imag,f=c.data.get(u.dataId).values,d=c.data.get(m.dataId).values,h=Ia({inputs:{x:s},backend:c,attrs:{dtype:"complex64"}}),y=c.data.get(h.dataId),g=y.complexTensorInfos.real,b=y.complexTensorInfos.imag,x=c.data.get(g.dataId).values,w=c.data.get(b.dataId).values,[I,C,R]=r(i.shape,s.shape,f,d,x,w),P=c.makeTensorInfo(R,"float32",I),z=c.makeTensorInfo(R,"float32",C),$=qr({inputs:{real:P,imag:z},backend:c});return c.disposeIntermediateTensorInfo(l),c.disposeIntermediateTensorInfo(h),c.disposeIntermediateTensorInfo(P),c.disposeIntermediateTensorInfo(z),$}else{let l=c.data.get(i.dataId).values,p=c.data.get(s.dataId).values,u=o||i.dtype,[m,f]=t(i.shape,s.shape,l,p,u);return c.makeTensorInfo(f,u,m)}}}function og(e){return(t,r,o,n,a,i)=>{let s=M.assertAndGetBroadcastShape(t,r),c=S.sizeFromShape(s),l=s.length,p=S.computeStrides(s),u=S.getTypedArrayFromDType("float32",c),m=S.getTypedArrayFromDType("float32",c),f=M.getBroadcastDims(t,s),d=M.getBroadcastDims(r,s),h=M.mergeRealAndImagArrays(o,n),y=M.mergeRealAndImagArrays(a,i),g=t.length,b=S.computeStrides(t),x=r.length,w=S.computeStrides(r);if(f.length+d.length===0)for(let I=0;I<u.length;I++){let C=I%h.length,R=I%y.length,P=e(h[C*2],h[C*2+1],y[R*2],y[R*2+1]);u[I]=P.real,m[I]=P.imag}else for(let I=0;I<u.length;I++){let C=S.indexToLoc(I,l,p),R=C.slice(-g);f.forEach(V=>R[V]=0);let P=S.locToIndex(R,g,b),z=C.slice(-x);d.forEach(V=>z[V]=0);let $=S.locToIndex(z,x,w),B=e(h[P*2],h[P*2+1],y[$*2],y[$*2+1]);u[I]=B.real,m[I]=B.imag}return[u,m,s]}}var Axe=it((e,t)=>e+t),Rxe=og((e,t,r,o)=>({real:e+r,imag:t+o})),Hi=ht(Is,Axe,Rxe),uH={kernelName:Is,backendName:"cpu",kernelFunc:Hi};function Ak(e,t,r,o,n){let a=S.sizeFromShape(o),i=S.makeZerosTypedArray(n,r);for(let s=0;s<e.length;s++){let c=e[s];if(c<0)throw new Error("Input x must be non-negative!");c>=n||(a>0?i[c]+=t[s]:i[c]+=1)}return i}function mH(e,t,r,o=!1){let n=e.shape[0],a=e.shape[1],i=Re([n,r],t.dtype);for(let s=0;s<n;s++)for(let c=0;c<a;c++){let l=e.get(s,c);if(l<0)throw new Error("Input x must be non-negative!");l>=r||(o?i.set(1,s,l):t.size>0?i.set(i.get(s,l)+t.get(s,c),s,l):i.set(i.get(s,l)+1,s,l))}return i}var Dxe=it((e,t)=>e&t),Fxe=ht(Fp,Dxe),fH={kernelName:Fp,backendName:"cpu",kernelFunc:Fxe};function Zr(e){return(t,r,o)=>{let n=S.getArrayFromDType(r,t.length);for(let a=0;a<t.length;++a)n[a]=e(t[a],o);return n}}function Oe(e,t,r){let o=Zr(t);return un(e,o,r)}function un(e,t,r){return({inputs:o,attrs:n,backend:a})=>{let{x:i}=o;ne(i,e);let s=a,c=s.data.get(i.dataId).values,l;if(i.dtype==="string"){if(!Array.isArray(c))throw new Error("String tensor's value was not an instance of Array");l=M.fromUint8ToStringArray(c)}else l=c;let p=r||i.dtype,u=t(l,p,n);return s.makeTensorInfo(i.shape,p,u)}}var Mxe=Zr(e=>Math.ceil(e)),Oxe=un(Mp,Mxe),dH={kernelName:Mp,backendName:"cpu",kernelFunc:Oxe};function ng(e,t,r,o){let n=S.getArrayFromDType(r,S.sizeFromShape(t));if(o&&r!=="string"){let a=0;e.forEach(i=>{let s=S.sizeFromShape(i.shape);n.set(i.vals,a),a+=s})}else{let a=0;e.forEach(i=>{let s=r==="string"?M.fromUint8ToStringArray(i.vals):i.vals,c=0;for(let l=0;l<i.shape[0];++l){let p=l*t[1]+a;for(let u=0;u<i.shape[1];++u)n[p+u]=s[c++]}a+=i.shape[1]})}return n}var Pxe=it((e,t)=>e===t?1:0),WA=ht(Yp,Pxe,null,"bool"),hH={kernelName:Yp,backendName:"cpu",kernelFunc:WA};var zxe=Zr(e=>Math.exp(e)),HA=un(Qp,zxe,"float32"),gH={kernelName:Qp,backendName:"cpu",kernelFunc:HA};var $xe=Zr(e=>Math.expm1(e)),Lxe=un(Jp,$xe),yH={kernelName:Jp,backendName:"cpu",kernelFunc:Lxe};var Bxe=Zr(e=>Math.floor(e)),Uxe=un(eu,Bxe),vH={kernelName:eu,backendName:"cpu",kernelFunc:Uxe};var Wxe=it((e,t)=>Math.floor(e/t)),Hxe=ht(tu,Wxe,null,"int32"),bH={kernelName:tu,backendName:"cpu",kernelFunc:Hxe};function xH(e,t,r,o,n,a,i,s,c){let l=Re([o,a],r);for(let p=0;p<o;p++){let u=[],m=0;for(let f=0;f<n;f++){let d=e[p*n+f];m+=d*i[f],u.push(d)}if(m<0||m>=c/a)throw new Error(`Invalid indices: ${u} does not index into ${s}`);for(let f=0;f<a;f++)l.values[p*a+f]=t.get(...t.indexToLoc(m*a+f))}return l}function wH(e,t,r){let o=Re(r,e.dtype);for(let n=0;n<o.size;++n){let i=o.indexToLoc(n).slice(),s=i[0],c=i[2],l=t.locToIndex([s,c]);i[2]=t.values[l];let p=e.locToIndex(i);0<=p&&p<e.values.length&&(o.values[n]=e.values[p])}return o}var Vxe=it((e,t)=>e>t?1:0),jxe=ht(nu,Vxe,null,"bool"),SH={kernelName:nu,backendName:"cpu",kernelFunc:jxe};var Gxe=it((e,t)=>e>=t?1:0),qxe=ht(au,Gxe,null,"bool"),kH={kernelName:au,backendName:"cpu",kernelFunc:qxe};var Kxe=it((e,t)=>e<t?1:0),Xxe=ht(pu,Kxe,null,"bool"),_H={kernelName:pu,backendName:"cpu",kernelFunc:Xxe};var Yxe=it((e,t)=>e<=t?1:0),Qxe=ht(uu,Yxe,null,"bool"),EH={kernelName:uu,backendName:"cpu",kernelFunc:Qxe};function IH(e,t,r){let o=(t-e)/(r-1),n=S.makeZerosTypedArray(r,"float32");n[0]=e;for(let a=1;a<n.length;a++)n[a]=n[a-1]+o;return n}var Jxe=Zr(e=>Math.log(e)),Zxe=un(fu,Jxe),TH={kernelName:fu,backendName:"cpu",kernelFunc:Zxe};function CH(e,t,r,o){let n=S.getTypedArrayFromDType(o,S.sizeFromShape(r));for(let a=0;a<n.length;++a){let i=a*t,s=e[i];for(let c=0;c<t;++c){let l=e[i+c];(Number.isNaN(l)||l>s)&&(s=l)}n[a]=s}return n}var e0e=it((e,t)=>Math.max(e,t)),t0e=ht(xu,e0e),NH={kernelName:xu,backendName:"cpu",kernelFunc:t0e};var r0e=it((e,t)=>Math.min(e,t)),o0e=ht(_u,r0e),AH={kernelName:_u,backendName:"cpu",kernelFunc:o0e};var VA=it((e,t)=>e*t),n0e=og((e,t,r,o)=>({real:e*r-t*o,imag:e*o+t*r})),zm=ht(Cu,VA,n0e),RH={kernelName:Cu,backendName:"cpu",kernelFunc:zm};function a0e(e,t,r){let o=S.createScalarValue(-1,r);return VA([],t,o,e,r)}function i0e(e){let{inputs:t,backend:r}=e,{x:o}=t;ne(o,"neg");let n=r.data.get(o.dataId).values,[a,i]=a0e(n,o.shape,o.dtype);return r.makeTensorInfo(i,o.dtype,a)}var DH={kernelName:gh,backendName:"cpu",kernelFunc:i0e};var s0e=it((e,t)=>e!==t?1:0),l0e=ht(Nu,s0e,null,"bool"),FH={kernelName:Nu,backendName:"cpu",kernelFunc:l0e};function Rk(e,t,r,o,n){let a=t.length,i=S.sizeFromShape(t),s=S.computeStrides(t),c=S.computeStrides(n),l=S.getTypedArrayFromDType(r,S.sizeFromShape(n));for(let p=0;p<i;++p){let u=S.indexToLoc(p,a,s),m=new Array(u.length);for(let d=0;d<m.length;d++)m[d]=u[o[d]];let f=S.locToIndex(m,a,c);l[f]=e[p]}return l}function ar(e){let{inputs:t,attrs:r,backend:o}=e,{x:n}=t,{perm:a}=r;ne(n,"transpose");let i=n.shape.length,s=new Array(i);for(let u=0;u<s.length;u++)s[u]=n.shape[a[u]];let c=o.data.get(n.dataId).values,l=Rk(c,n.shape,n.dtype,a,s);return{dataId:o.write(l,s,n.dtype),shape:s,dtype:n.dtype}}var MH={kernelName:Cs,backendName:"cpu",kernelFunc:ar};function c0e(e,t,r,o){let[n,a]=M.computeOutAndReduceShapes(e,o),i=Xn(t,"int32"),s=S.makeZerosTypedArray(S.sizeFromShape(n),i),c=S.sizeFromShape(a);for(let l=0;l<s.length;++l){let p=l*c,u=1;for(let m=0;m<c;++m)u*=r[p+m];s[l]=u}return{outVals:s,outShape:n,outDtype:i}}function p0e(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,{axis:a,keepDims:i}=o;ne(n,"prod");let s=n.shape.length,c=S.parseAxisParam(a,n.shape),l=M.getAxesPermutation(c,s),p=c,u=n,m=[];l!=null&&(u=ar({inputs:{x:n},backend:r,attrs:{perm:l}}),m.push(u),p=M.getInnerMostAxes(p.length,s));let f=r.data.get(u.dataId).values,{outVals:d,outShape:h,outDtype:y}=c0e(u.shape,u.dtype,f,p),g=h;return i&&(g=M.expandShapeToKeepDim(h,c)),m.forEach(b=>r.disposeIntermediateTensorInfo(b)),r.makeTensorInfo(g,y,d)}var OH={kernelName:zu,backendName:"cpu",kernelFunc:p0e};function u0e(e,t,r){e.forEach((o,n)=>{if(o<0||o>=r){let a=S.indexToLoc(n,t.length,S.computeStrides(t)).join(",");throw new Error(`indices[${a}] = ${o} is not in [0, ${r})`)}})}function m0e(e,t){for(let r=0;r<e.length;++r){let o=e[r],n=r===e.length-1?t:e[r+1].length;if(o.length===0)throw new Error("Ragged splits may not be empty");if(o[0]<0)throw new Error("Ragged splits must be non-negative");if(o[o.length-1]>n)throw new Error("Ragged splits must not point past values");for(let a=1;a<o.length;++a)if(o[a-1]>o[a])throw new Error("Ragged splits must be sorted in ascending order")}}function f0e(e,t,r,o){let n=[],a=0,i=t.length-1+r.length,s=new Array(i).fill(null).map(()=>[0]);m0e(r,o);let c=1;for(let l=0;l<t.length-1;++l){c*=t[l];let p=t[l+1];for(let u=1;u<c+1;++u)s[l].push(u*p)}for(let l=0;l<e.length;++l){let p=e[l],u=e[l]+1;for(let m=0;m<r.length;++m){let f=r[m],d=m+t.length-1;if(d>=0){let h=s[d],y=h[h.length-1]-f[p];for(let g=p;g<u;++g)s[d].push(f[g+1]+y)}p=f[p],u=f[u]}u!==p&&(n.push([p,u]),a+=u-p)}return{outSplits:s,valueSlices:n,numValues:a}}function d0e(e){let t=[];for(let r=0;r<e.length;++r){let o=e[r].length,n=S.getArrayFromDType("int32",o);t.push(n),e[r].forEach((a,i)=>n[i]=a)}return t}function PH(e,t){let r=e.slice(0,t);for(;r.length<t;)r.push(1);for(let o=t;o<e.length;o++)r[t-1]*=e[o];return r}function h0e(e,t,r,o,n,a){let i=PH(t,2)[1],s=PH(a,2)[1],c=0;for(let l of r)for(let p=l[0];p<l[1];++p){for(let u=0;u<o;++u)n[c*s+u]=e[p*i+u];++c}}function g0e(e,t,r,o,n){let a=t.slice();a[0]=n;let i=S.getArrayFromDType(r,S.sizeFromShape(a)),s=e.length,c=s===0?0:s/t[0];return h0e(e,t,o,c,i,a),[i,a]}function zH(e,t,r,o,n,a,i,s){if(e.length===0)throw new Error("paramsNestedSplits must be non empty");if(t[0].length===0)throw new Error("Split tensors must not be scalars");let c=t[0][0]-1;if(u0e(a,i,c),o.length===0)throw new Error("params.rank must be nonzero");let l=o[0],{outSplits:p,valueSlices:u,numValues:m}=f0e(a,i,e,l),f=d0e(p),d=g0e(r,o,n,u,m);return[f,d[0],d[1]]}var $H=2147483647;function LH(e,t,r,o,n,a,i){if(t.length>1)throw new Error("starts must be a scalar or vector");if(n.length>1)throw new Error("limits must be a scalar or vector");if(i.length>1)throw new Error("deltas must be a scalar or vector");let s=t.length===0,c=n.length===0,l=i.length===0,p=[];s||p.push(t[0]),c||p.push(n[0]),l||p.push(i[0]);for(let y=1;y<p.length;++y)if(p[y]!==p[y-1])throw new Error("starts, limits, and deltas must have the same shape");let u=p.length===0?1:p[0],m=S.getArrayFromDType("int32",u+1);m[0]=0;for(let y=0;y<u;++y){let g=s?e[0]:e[y],b=c?o[0]:o[y],x=l?a[0]:a[y];if(x===0)throw new Error("Requires delta != 0");let w;if(x>0&&b<g||x<0&&b>g)w=0;else if(w=Math.ceil(Math.abs((b-g)/x)),w>$H)throw new Error(`Requires ((limit - start) / delta) <= ${$H}`);m[y+1]=m[y]+w}let f=m[u],d=S.getArrayFromDType(r,f),h=0;for(let y=0;y<u;++y){let g=m[y+1]-m[y],b=s?e[0]:e[y],x=l?a[0]:a[y];for(let w=0;w<g;++w)d[h++]=b,b+=x}return[m,d]}var Ta=M.RowPartitionType,jA=class e{constructor(t,r,o,n,a,i,s,c,l,p){this.shape=t,this.shapeShape=r,this.values=o,this.valuesShape=n,this.valuesDType=a,this.defaultValue=i,this.defaultValueShape=s,this.rowPartitionValues=c,this.rowPartitionValuesShapes=l,this.rowPartitionTypes=M.getRowPartitionTypesHelper(p),this.raggedRank=M.getRaggedRank(this.rowPartitionTypes)}getRowPartitionTypeByDimension(t){return this.rowPartitionTypes[0]===Ta.FIRST_DIM_SIZE?this.rowPartitionTypes[t+1]:this.rowPartitionTypes[t]}getRowPartitionTensor(t){return this.rowPartitionTypes[0]===Ta.FIRST_DIM_SIZE?this.rowPartitionValues[t+1]:this.rowPartitionValues[t]}getMaxWidth(t){let r=this.getRowPartitionTensor(t-1);switch(this.getRowPartitionTypeByDimension(t-1)){case Ta.VALUE_ROWIDS:return e.getMaxWidthValueRowID(r);case Ta.ROW_SPLITS:return e.getMaxWidthRowSplit(r);default:throw new Error(`Cannot handle partition type ${Ta[this.getRowPartitionTypeByDimension(t-1)]}`)}}static getMaxWidthRowSplit(t){let r=t.length;if(r===0||r===1)return 0;let o=0;for(let n=0;n<r-1;++n){let a=t[n+1]-t[n];a>o&&(o=a)}return o}static getMaxWidthValueRowID(t){let r=t.length;if(r===0)return 0;let o=0,n=t[0],a=0;for(let i=1;i<r;++i){let s=t[i];s!==n&&(n=s,a=Math.max(i-o,a),o=i)}return Math.max(r-o,a)}tensorShapeFromTensor(t,r,o=!0){if(r.length===0){if(t[0]===-1)return[];throw new Error("The only valid scalar shape tensor is the fully unknown shape specified as -1.")}return UH(t,o)}calculateOutputSize(t){let r=this.valuesShape,o=this.defaultValueShape;M.validateDefaultValueShape(o,r);let n=this.tensorShapeFromTensor(this.shape,this.shapeShape),i=M.combineRaggedTensorToTensorShapes(this.raggedRank,n,r);i[0]<0&&(i[0]=t);for(let s=1;s<=this.raggedRank;++s)i[s]<0&&(i[s]=this.getMaxWidth(s));return i}calculateFirstParentOutputIndex(t,r,o){let n=Math.min(t,o),a=[],i=0;for(let s=0;s<n;++s,i+=r)a.push(i);for(let s=n;s<t;++s)a.push(-1);return S.assert(a.length===t,()=>"Final length of result must be equal to firstDimension."),a}calculateOutputIndexRowSplit(t,r,o,n){let a=t.length,i=[];for(let s=0;s<a-1;++s){let c=t[s+1]-t[s],l=Math.min(n,c),p=r[s];p===-1&&(l=0);for(let u=0;u<l;++u)i.push(p),p+=o;for(let u=0;u<c-l;++u)i.push(-1)}if(a>0&&i.length!==t[a-1])throw new Error("Invalid row split size.");return i}calculateOutputIndexValueRowID(t,r,o,n){let a=t.length,i=[];if(a===0)return[];let s=0,c=t[0];if(c>=r.length)throw new Error(`Got currentValueRowId=${c}, which is not less than ${r.length}`);let l=r[c];i.push(l);for(let p=1;p<a;++p){let u=t[p];if(u===c)l>=0&&(++s,s<n?l+=o:l=-1);else{if(s=0,c=u,u>=r.length)throw new Error(`Got nextValueRowId=${u} which is not less than ${r.length}`);l=r[u]}i.push(l)}if(i.length!==t.length)throw new Error("Invalid row ids.");return i}calculateOutputIndex(t,r,o,n){let a=this.getRowPartitionTensor(t),i=this.getRowPartitionTypeByDimension(t);switch(i){case Ta.VALUE_ROWIDS:return this.calculateOutputIndexValueRowID(a,r,o,n);case Ta.ROW_SPLITS:if(a.length-1>r.length)throw new Error(`Row partition size is greater than output size: ${a.length-1} > ${r.length}`);return this.calculateOutputIndexRowSplit(a,r,o,n);default:throw new Error(`Unsupported partition type: ${Ta[i]}`)}}getFirstDimensionSize(){let t=this.rowPartitionValues[0];if(this.rowPartitionTypes.length===0)throw new Error("No row_partition_types given.");let r=this.rowPartitionTypes[0];switch(r){case Ta.FIRST_DIM_SIZE:return t[0];case Ta.VALUE_ROWIDS:throw new Error("Cannot handle VALUE_ROWIDS in first dimension.");case Ta.ROW_SPLITS:return this.rowPartitionValuesShapes[0][0]-1;default:throw new Error(`Cannot handle type ${Ta[r]}`)}}compute(){if(this.rowPartitionValues[0].length<=0)throw new Error("Invalid first partition input. Tensor requires at least one element.");let r=this.getFirstDimensionSize(),o=this.calculateOutputSize(r),n=new Array(this.raggedRank+1);n[n.length-1]=1;for(let c=n.length-2;c>=0;--c)n[c]=n[c+1]*o[c+1];let a=UH(o,!1),i=S.getArrayFromDType(this.valuesDType,S.sizeFromShape(a));if(n[0]*o[0]>0){let c=this.calculateFirstParentOutputIndex(r,n[0],o[0]);for(let l=1;l<=this.raggedRank;++l)c=this.calculateOutputIndex(l-1,c,n[l],o[l]);this.setOutput(this.raggedRank,c,i,a)}return[a,i]}setOutput(t,r,o,n){if(o.length===0)return;let a=this.values,i=o,s=n.slice();s=s.slice(t+1);let c=S.sizeFromShape(s),l=r.length,p=this.defaultValue;if(p.length!==c&&p.length!==1){let d=this.defaultValueShape;He(()=>{let h=K(p,d);p=Yl(h,s).dataSync()})}let u=0,m=0,f=0;for(let d=0;d<=l;++d){let h=d<l?r[d]:-1;if(h===f){++f;continue}if(m<f){let y=a.subarray(u*c),g=i.subarray(m*c),b=(f-m)*c;BH(g,y,b)}if(d>=l){let y=o.length;h=Math.floor(y/c)}if(h>f)if(this.defaultValue.length===1)i.subarray(f*c,h*c).fill(this.defaultValue[0]),f=h;else for(;h>f;){let y=i.slice(f*c);BH(y,p,c),++f}h<0?(u=d+1,m=f):(u=d,m=f,f=m+1)}}};function BH(e,t,r){for(let o=0;o<r;o++)e[o]=t[o]}function UH(e,t){let r=[];for(let o of e){if(o<0){if(!t)throw new Error(`Dimension ${o} must be >= 0`);if(o<-1)throw new Error(`Dimension ${o} must be >= -1`);o=-1}r.push(o)}return r}function WH(e,t,r,o,n,a,i,s,c,l){return new jA(e,t,r,o,n,a,i,s,c,l).compute()}function ag(e,t,r,o){let n=e===t,a=e<t&&r<0,i=t<e&&r>1;if(n||a||i)return S.makeZerosTypedArray(0,o);let s=Math.abs(Math.ceil((t-e)/r)),c=S.makeZerosTypedArray(s,o);t<e&&r===1&&(r=-1),c[0]=e;for(let l=1;l<c.length;l++)c[l]=c[l-1]+r;return c}var y0e=Zr(e=>1/Math.sqrt(e)),v0e=un(ju,y0e),HH={kernelName:ju,backendName:"cpu",kernelFunc:v0e};function Ls(e,t,r,o,n,a,i,s,c,l){let p=[o/n,n],u=e.values,m=t.values;if(o===0)return Re(r,t.dtype);let f=c instanceof Tt?c:Re(p,t.dtype);typeof c=="string"||typeof c=="number"?f.values.fill(c):typeof c=="boolean"&&f.values.fill(+c);for(let d=0;d<a;d++){let h=[],y=0;for(let g=0;g<i;g++){let b=u[d*i+g];h.push(b),y+=b*s[g]}if(y<0||y>=o/n)throw new Error(`Invalid indices: ${h} does not index into ${r}`);for(let g=0;g<n;g++)l?f.values[y*n+g]+=m[d*n+g]:f.values[y*n+g]=t.rank===0?m[0]:m[d*n+g]}return f}var dEt=Zr(e=>1/(1+Math.exp(-e))),GA=Oe(Zu,e=>1/(1+Math.exp(-e))),VH={kernelName:Zu,backendName:"cpu",kernelFunc:GA};function ig(e,t,r,o,n){let a=co.isSliceContinous(o,t,r),i=S.sizeFromShape(r),s=S.computeStrides(o);if(a){let u=co.computeFlatOffset(t,s);return n==="string"?e.slice(u,u+i):e.subarray(u,u+i)}let c=n==="string"?M.fromUint8ToStringArray(e):e,l=Re(o,n,c),p=Re(r,n);for(let u=0;u<p.size;++u){let m=p.indexToLoc(u),f=m.map((d,h)=>d+t[h]);p.set(l.get(...f),...m)}return n==="string"?M.fromStringArrayToUint8(p.values):p.values}function Ca(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,{begin:a,size:i}=o;ne(n,"slice");let[s,c]=co.parseSliceParams(n,a,i);co.assertParamsValid(n,s,c);let l=r.data.get(n.dataId).values,p=ig(l,s,c,n.shape,n.dtype);return r.makeTensorInfo(c,n.dtype,p)}var jH={kernelName:Sh,backendName:"cpu",kernelFunc:Ca};function GH(e,t,r,o,n,a,i){let s=t[0],c=a[0],l=new Array(c),p=new Array(s),u=t[1];if(c===0){if(s!==0)throw new Error(M.getSparseFillEmptyRowsIndicesDenseShapeMismatch(s));let y=S.getArrayFromDType(r,0),g=S.getArrayFromDType(n,0);return[y,[0,u],g,l,p]}let m=!0,f=0,d=new Array(c).fill(0);for(let y=0;y<s;++y){let g=e[y*u];if(g<0)throw new Error(M.getSparseFillEmptyRowsNegativeIndexErrorMessage(y,g));if(g>=c)throw new Error(M.getSparseFillEmptyRowsOutOfRangeIndexErrorMessage(y,g,c));++d[g],m=m&&g>=f,f=g}let h=!0;for(let y=0;y<c;++y){let g=d[y]===0;l[y]=g,h=h&&!g,d[y]=Math.max(d[y],1),y>0&&(d[y]+=d[y-1])}if(h&&m){let y=e,g=o;for(let b=0;b<s;++b)p[b]=b;return[y,[s,u],g,l,p]}else{let y=d[c-1],g=S.getArrayFromDType(r,y*u),b=S.getArrayFromDType(n,y),x=new Array(c).fill(0);for(let w=0;w<s;++w){let I=e[w*u],C=x[I],R=(I===0?0:d[I-1])+C;x[I]++;for(let P=0;P<u;++P)g[R*u+P]=e[w*u+P];b[R]=o[w],p[w]=R}for(let w=0;w<c;++w)if(x[w]===0){let C=w===0?0:d[w-1];g[C*u+0]=w;for(let R=1;R<u;++R)g[C*u+R]=0;b[C]=i}return[g,[y,u],b,l,p]}}function qH(e,t,r,o,n){let a=S.sizeFromShape(o),i=t[0],s=n.length,c=[],l=1,p=-1;for(let y=0;y<s;++y){let g=n[y];if(g===-1){if(p!==-1)throw new Error(M.getSparseReshapeMultipleNegativeOneOutputDimErrorMessage(p,y));p=y,c.push(1)}else{if(g<0)throw new Error(M.getSparseReshapeNegativeOutputDimErrorMessage(y,g));l*=g,c.push(g)}}if(p!==-1){if(l<=0)throw new Error(M.getSparseReshapeEmptyTensorZeroOutputDimErrorMessage());let y=Math.trunc(a/l);if(l*y!==a)throw new Error(M.getSparseReshapeInputOutputMultipleErrorMessage(o,c));c[p]=y}if(S.sizeFromShape(c)!==a)throw new Error(M.getSparseReshapeInputOutputMismatchErrorMessage(o,c));let m=o.length,f=[];if(m>0){f[m-1]=1;for(let y=m-2;y>=0;--y)f[y]=f[y+1]*o[y+1]}let d=[];if(s>0){d[s-1]=1;for(let y=s-2;y>=0;--y)d[y]=d[y+1]*c[y+1]}let h=S.getArrayFromDType(r,i*s);for(let y=0;y<i;++y){let g=0;for(let b=0;b<m;++b)g+=e[y*m+b]*f[b];for(let b=0;b<s;++b)h[y*s+b]=Math.trunc(g/d[b]),g%=d[b]}return[h,[i,s],c]}function Dk(e,t,r,o,n,a=!1,i=0){let s=o.length,c=[t[0],e.length/t[0]],l=c[1],u=s>0?n[s-1]+1:0;if(u<0)throw new Error(M.getSparseSegmentReductionNegativeSegmentIdsErrorMessage());let m=t.slice();m[0]=u;let f=m.reduce((x,w)=>x*w,1),d=S.getArrayFromDType(r,f);if(s===0)return u>0&&d.fill(i),[d,m];if(u<=0)throw new Error(M.getSparseSegmentReductionNegativeSegmentIdsErrorMessage());let h=0,y=1,g=0,b=n[h];for(;;){let x=0;if(y<s){if(x=n[y],b===x){++y;continue}if(b>=x)throw new Error(M.getSparseSegmentReductionNonIncreasingSegmentIdsErrorMessage())}if(b<0||b>=u)throw new Error(M.getSparseSegmentReductionSegmentIdOutOfRangeErrorMessage(b,u));b>g&&d.fill(i,g*l,b*l);for(let w=h;w<y;++w){let I=o[w];if(I<0||I>=c[0])throw new Error(M.getSparseSegmentReductionIndicesOutOfRangeErrorMessage(w,o[w],c[0]));for(let C=0;C<l;C++)d[b*l+C]+=e[I*l+C]}if(a)for(let w=0;w<l;w++)d[b*l+w]/=y-h;if(h=y,++y,g=b+1,b=x,y>s)break}return g<u&&d.fill(i,g*l,u*l),[d,m]}var CEt=Zr(e=>Math.sqrt(e)),b0e=Oe(tm,e=>Math.sqrt(e)),KH={kernelName:tm,backendName:"cpu",kernelFunc:b0e};var x0e=it((e,t)=>{let r=e-t;return r*r}),w0e=ht(im,x0e),XH={kernelName:im,backendName:"cpu",kernelFunc:w0e};var S0e=Zr((e,t)=>{let{pattern:r,replaceGlobal:o,rewrite:n}=t;return e.replace(new RegExp(r,o?"g":""),n)}),k0e=un(nb,S0e),YH={kernelName:nb,backendName:"cpu",kernelFunc:k0e};function QH(e,t,r,o){let n=Re(e,t.dtype);for(let a=0;a<n.size;a++){let i=n.indexToLoc(a),s=new Array(i.length);for(let c=0;c<s.length;c++)s[c]=i[c]*r[c]+o[c];n.set(t.get(...s),...i)}return n}var qA=class{constructor(t,r,o,n,a,i){this.separator=S.encodeString(t),this.nGramWidths=r,this.leftPad=S.encodeString(o),this.rightPad=S.encodeString(n),this.padWidth=a,this.preserveShort=i}getPadWidth(t){return Math.min(this.padWidth<0?t-1:this.padWidth,t-1)}getNumNGrams(t,r){let o=this.getPadWidth(r);return Math.max(0,t+2*o-r+1)}createNGrams(t,r,o,n,a,i){for(let s=0;s<a;++s){let c=this.getPadWidth(i),l=Math.max(0,c-s),p=Math.max(0,c-(a-(s+1))),u=i-(l+p),m=r+(l>0?0:s-c),f=0;f+=l*this.leftPad.length;for(let b=0;b<u;++b)f+=t[m+b].length;f+=p*this.rightPad.length;let d=l+p+u-1;f+=d*this.separator.length,o[n+s]=new Uint8Array(f);let h=o[n+s],y=0,g=b=>b.forEach(x=>h[y++]=x);for(let b=0;b<l;++b)g(this.leftPad),g(this.separator);for(let b=0;b<u-1;++b)g(t[m+b]),g(this.separator);if(u>0){g(t[m+u-1]);for(let b=0;b<p;++b)g(this.separator),g(this.rightPad)}else{for(let b=0;b<p-1;++b)g(this.rightPad),g(this.separator);g(this.rightPad)}}}compute(t,r){let o=t.length,n=r.length;if(n>0){let c=r[0];if(c!==0)throw new Error(`First split value must be 0, got ${c}`);for(let l=1;l<n;++l){let p=r[l]>=c;if(p=p&&r[l]<=o,!p)throw new Error(`Invalid split value ${r[l]}, must be in [${c}, ${o}]`);c=r[l]}if(c!==o)throw new Error(`Last split value must be data size. Expected ${o}, got ${c}`)}let a=n-1,i=S.getArrayFromDType("int32",n);if(o===0||n===0){let c=new Array(o);for(let l=0;l<=a;++l)i[l]=0;return[c,i]}i[0]=0;for(let c=1;c<=a;++c){let l=r[c]-r[c-1],p=0;this.nGramWidths.forEach(u=>{p+=this.getNumNGrams(l,u)}),this.preserveShort&&l>0&&p===0&&(p=1),i[c]=i[c-1]+p}let s=new Array(i[a]);for(let c=0;c<a;++c){let l=r[c],p=i[c];if(this.nGramWidths.forEach(u=>{let m=r[c+1]-r[c],f=this.getNumNGrams(m,u);this.createNGrams(t,l,s,p,f,u),p+=f}),this.preserveShort&&p===i[c]){let u=r[c+1]-r[c];if(u===0)continue;let m=u+2*this.padWidth;this.createNGrams(t,l,s,p,1,m)}}return[s,i]}};function sg(e,t,r,o,n,a,i,s){return new qA(r,o,n,a,i,s).compute(e,t)}function _0e(e,t,r,o){if(!e.length)return;if(t.length===0){for(let a=0;a<e.length;++a)o.push(e.subarray(a,a+1));return}if(t.length===1){let a=t[0],i=e.indexOf(a);for(;i!==-1;){let s=e.subarray(0,i);(!r||s.length!==0)&&o.push(s),e=e.subarray(i+1),i=e.indexOf(a)}(!r||e.length!==0)&&o.push(e);return}let n=0;for(let a=0;a<e.length+1;a++)if(a===e.length||t.indexOf(e[a])!==-1){let i=e.subarray(n,a);(!r||i.length!==0)&&o.push(i),n=a+1}}function lg(e,t,r){let o=e.length,n=[],a=0,i=0,s=new Array(o);for(let m=0;m<o;++m){let f=n.length;_0e(e[m],t,r,n);let d=n.length-f;s[m]=d,a+=d,i=Math.max(i,d)}let c=S.getArrayFromDType("int32",a*2),l=new Array(a),p=[o,i],u=0;for(let m=0;m<o;++m)for(let f=0;f<s[m];++f)c[u*2]=m,c[u*2+1]=f,l[u]=n[u],++u;return[c,l,p]}function cg(e,t){let r=S.getArrayFromDType("int32",e.length);for(let o=0;o<e.length;++o)r[o]=S.fingerPrint64(e[o]).modulo(t).getLowBitsUnsigned();return r}var E0e=it((e,t)=>e-t),I0e=og((e,t,r,o)=>({real:e-r,imag:t-o})),Nb=ht(lm,E0e,I0e),JH={kernelName:lm,backendName:"cpu",kernelFunc:Nb};function ZH(e,t){let r=new Array(e.rank);for(let n=0;n<r.length;n++)r[n]=e.shape[n]*t[n];let o=Re(r,e.dtype);for(let n=0;n<o.values.length;++n){let a=o.indexToLoc(n),i=new Array(e.rank);for(let c=0;c<i.length;c++)i[c]=a[c]%e.shape[c];let s=e.locToIndex(i);o.values[n]=e.values[s]}return o}var Ab=(e,t)=>{let r=t.value-e.value;return r===0?e.index-t.index:r};function eV(e,t,r=0,o=e.length-1){for(;o>r;){if(o-r>600){let s=o-r+1,c=t-r+1,l=Math.log(s),p=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*p*(s-p)/s)*Math.sign(c-s/2),m=Math.max(r,Math.floor(t-c*p/s+u)),f=Math.min(o,Math.floor(t+(s-c)*p/s+u));eV(e,t,m,f)}let n=e[t],a=r,i=o;for(S.swap(e,r,t),Ab(e[o],n)>0&&S.swap(e,r,o);a<i;){for(S.swap(e,a,i),a++,i--;Ab(e[a],n)<0;)a=a+1;for(;Ab(e[i],n)>0;)i=i-1}Ab(e[r],n)===0?S.swap(e,r,i):(i=i+1,S.swap(e,i,o)),i<=t&&(r=i+1),t<=i&&(o=i-1)}}function tV(e,t,r,o,n){let a=t[t.length-1],[i,s]=[e.length/a,a],c=S.getTypedArrayFromDType(r,i*o),l=S.getTypedArrayFromDType("int32",i*o);for(let u=0;u<i;u++){let m=u*s,f=e.subarray(m,m+s),d=new Array(f.length);f.forEach((b,x)=>d[x]={value:b,index:x}),o<d.length&&(eV(d,o),d=d.slice(0,o)),n&&d.sort(Ab);let h=u*o,y=c.subarray(h,h+o),g=l.subarray(h,h+o);for(let b=0;b<o;b++)y[b]=d[b].value,g[b]=d[b].index}let p=t.slice();return p[p.length-1]=o,[Re(p,r,c),Re(p,"int32",l)]}function pg(e,t,r,o){let n=S.parseAxisParam(t,r)[0],a=[1,r[0],1];for(let d=0;d<n;d++)a[0]*=r[d];a[1]=r[n];for(let d=n+1;d<r.length;d++)a[2]*=r[d];let i=new Map,s=new Int32Array(r[n]),c=new Tt(a,o,e),l=[],p=a[0]===1&&a[2]===1;for(let d=0;d<r[n];d++){let h;if(p)h=e[d].toString();else{let g=[];for(let b=0;b<a[0];b++)for(let x=0;x<a[2];x++)g.push(c.get(b,d,x));h=g.join(",")}let y=i.get(h);if(y!=null)s[d]=y;else{let g=i.size;i.set(h,g),s[d]=g,l.push(d)}}let u=a.slice();u[1]=i.size;let m=new Tt(u,o);l.forEach((d,h)=>{for(let y=0;y<a[0];y++)for(let g=0;g<a[2];g++)m.set(c.get(y,d,g),y,h,g)});let f=r.slice();return f[n]=u[1],{outputValues:m.values,outputShape:f,indices:s}}function Na(e){let{inputs:{x:t},attrs:{begin:r,size:o},backend:n}=e,[a,i]=co.parseSliceParams(t,r,o),s=co.isSliceContinous(t.shape,a,i),c=n.readSync(t.dataId),l=n.makeOutput(i,t.dtype),p=S.computeStrides(t.shape),u=n.dataIdMap.get(l.dataId);if(s){let d=co.computeFlatOffset(a,p);return t.dtype==="string"?u.stringBytes=c.slice(d,d+S.sizeFromShape(i)):n.typedArrayFromHeap(l).set(c.subarray(d,d+S.sizeFromShape(i))),l}if(t.dtype==="string"){let d=ig(c,a,i,t.shape,t.dtype);return u.stringBytes=d,l}let m=n.typedArrayFromHeap(l),f=t.shape.length;if(f===2)T0e(c,p[0],m,a,i);else if(f===3)C0e(c,p[0],p[1],m,a,i);else if(f===4)N0e(c,p[0],p[1],p[2],m,a,i);else{let d=ig(c,a,i,t.shape,t.dtype);m.set(d)}return l}function T0e(e,t,r,o,n){let a=0,i=o[0],s=o[1],c=i+n[0];for(let l=i;l<c;l++){let p=l*t+s;r.set(e.subarray(p,p+n[1]),a),a+=n[1]}}function C0e(e,t,r,o,n,a){let i=0,s=n[0],c=n[1],l=n[2],p=s+a[0],u=c+a[1];for(let m=s;m<p;m++)for(let f=c;f<u;f++){let d=m*t+f*r+l;o.set(e.subarray(d,d+a[2]),i),i+=a[2]}}function N0e(e,t,r,o,n,a,i){let s=0,c=a[0],l=a[1],p=a[2],u=c+i[0],m=l+i[1],f=p+i[2],d=a[3];for(let h=c;h<u;h++)for(let y=l;y<m;y++)for(let g=p;g<f;g++){let b=h*t+y*r+g*o+d;n.set(e.subarray(b,b+i[3]),s),s+=i[3]}}var rV={kernelName:Sh,backendName:"wasm",kernelFunc:Na};function A0e(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,{blockShape:a,crops:i}=o,s=a.reduce((g,b)=>g*b),c=M.getReshaped(n.shape,a,s),l=M.getPermuted(c.length,a.length),p=M.getReshapedPermuted(n.shape,a,s),u=M.getSliceBeginCoords(i,a.length),m=M.getSliceSize(p,i,a.length),f=Fr({inputs:{x:n},backend:r,attrs:{shape:c}}),d=ea({inputs:{x:f},backend:r,attrs:{perm:l}}),h=Fr({inputs:{x:d},backend:r,attrs:{shape:p}}),y=Na({inputs:{x:h},backend:r,attrs:{begin:u,size:m}});return r.disposeData(f.dataId),r.disposeData(d.dataId),r.disposeData(h.dataId),y}var oV={kernelName:nh,backendName:"wasm",kernelFunc:A0e};var nV;function R0e(e){nV=e.wasm.cwrap(Dp,null,["number","number","boolean","number","number","number"])}function D0e(e){let{backend:t,inputs:r,attrs:o}=e,{x:n,weights:a}=r,{size:i}=o,s=a.shape.reduce((u,m)=>u*m,1)!==0,c=n.shape.length===1?[i]:[n.shape[0],i],l=t.makeOutput(c,a.dtype);function p(u){return t.dataIdMap.get(u.dataId).id}return nV(p(n),i,s,p(a),Ae[a.dtype],p(l)),l}var aV={kernelName:Dp,backendName:"wasm",setupFunc:R0e,kernelFunc:D0e};var F0e=!0,iV=ut(Fp,F0e);function M0e(e){let{inputs:t,backend:r}=e,{s0:o,s1:n}=t,a=r.typedArrayFromHeap(o),i=r.typedArrayFromHeap(n),s=M.assertAndGetBroadcastShape(Array.from(a),Array.from(i));return r.makeOutput([s.length],"int32",void 0,new Int32Array(s))}var sV={kernelName:ah,backendName:"wasm",kernelFunc:M0e};function mn(e){let{inputs:{x:t},attrs:{dtype:r},backend:o}=e,n=o.makeOutput(t.shape,r),a=o.typedArrayFromHeap(t);return o.typedArrayFromHeap(n).set(a),n}var lV={kernelName:Ll,backendName:"wasm",kernelFunc:mn};var cV=we(Mp);var pV;function O0e(e){pV=e.wasm.cwrap(Bl,null,["number","number","number","number"])}function P0e(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,{clipValueMin:a,clipValueMax:i}=o,s=r.dataIdMap.get(n.dataId).id,c=r.makeOutput(n.shape,n.dtype),l=r.dataIdMap.get(c.dataId).id;return pV(s,a,i,l),c}var uV={kernelName:Bl,backendName:"wasm",setupFunc:O0e,kernelFunc:P0e};function KA(e){let{inputs:t,backend:r}=e,o=S.parseAxisParam(e.attrs.axis,t[0].shape)[0],n=t.map(f=>f.shape);M.assertParamsConsistent(n,o);let a=M.computeOutShape(t.map(f=>f.shape),o),i=t.filter(f=>S.sizeFromShape(f.shape)>0);if(i.length===1)return Pm({inputs:{x:i[0]},backend:r});let s=r.makeOutput(a,t[0].dtype);if(S.sizeFromShape(a)===0)return s;if(i[0].dtype==="string"){let f=i.map(x=>{let I=[-1,S.sizeFromShape(x.shape.slice(o))];return Fr({inputs:{x},backend:r,attrs:{shape:I}})}),d=f.map(x=>({vals:r.readSync(x.dataId),shape:x.shape}));a=M.computeOutShape(f.map(x=>x.shape),1);let h=f[0].shape[0]===1,y=ng(d,a,t[0].dtype,h),g=M.computeOutShape(i.map(x=>x.shape),o);s.shape=g;let b=r.dataIdMap.get(s.dataId);return b.stringBytes=M.fromStringArrayToUint8(y),f.forEach(x=>r.disposeData(x.dataId)),s}let c=S.sizeFromShape(i[0].shape.slice(0,o)),l=0,p=i.map(f=>{let d=S.sizeFromShape(f.shape.slice(o));return l+=d,d}),u=i.map(f=>r.typedArrayFromHeap(f)),m=r.typedArrayFromHeap(s);for(let f=0;f<c;f++){let d=f*l;for(let h=0;h<u.length;h++){let y=p[h],g=f*y,b=u[h].subarray(g,g+y);m.set(b,d),d+=y}}return s}var mV={kernelName:ih,backendName:"wasm",kernelFunc:KA};var fV;function z0e(e){fV=e.wasm.cwrap(Op,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function $0e(e){let{inputs:t,attrs:r,backend:o}=e,{x:n,filter:a}=t,i=o.dataIdMap.get(n.dataId).id,s=o.dataIdMap.get(a.dataId).id,{strides:c,dilations:l,pad:p,dimRoundingMode:u,dataFormat:m}=r,f=M.convertConv2DDataFormat(m),d=M.computeConv2DInfo(n.shape,a.shape,c,l,p,u,!1,f),h=d.filterHeight,y=d.filterWidth,g=d.padInfo.top,b=d.padInfo.right,x=d.padInfo.bottom,w=d.padInfo.left,I=d.dilationHeight,C=d.dilationWidth,R=d.strideHeight,P=d.strideWidth,z=d.inChannels,$=d.outChannels,B=d.padInfo.type==="SAME"?1:0;if(d.dataFormat!=="channelsLast")throw new Error(`wasm backend Conv2D does not support dataFormat:'${d.dataFormat}'. Please use 'channelsLast'.`);let V=o.makeOutput(d.outShape,"float32"),H=o.dataIdMap.get(V.dataId).id;return fV(i,n.shape[0],n.shape[1],n.shape[2],s,h,y,g,b,x,w,B,I,C,R,P,z,$,H),V}var dV={kernelName:Op,backendName:"wasm",setupFunc:z0e,kernelFunc:$0e};var hV;function L0e(e){hV=e.wasm.cwrap(Pp,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function B0e(e){let{backend:t,inputs:r,attrs:o}=e,{dy:n,filter:a}=r,{strides:i,pad:s,dataFormat:c,dimRoundingMode:l,inputShape:p}=o,u=1,m=M.convertConv2DDataFormat(c),f=M.computeConv2DInfo(p,a.shape,i,u,s,l,!1,m),{batchSize:d,filterHeight:h,filterWidth:y,inChannels:g,inHeight:b,inWidth:x,outChannels:w,outHeight:I,outWidth:C,strideHeight:R,strideWidth:P}=f,z=h-1-f.padInfo.top,$=y-1-f.padInfo.left,B=f.dataFormat==="channelsLast",V=S.computeStrides(f.inShape),H=S.computeStrides(n.shape),[G,X,ee]=S.computeStrides(a.shape),Z=V[0],te=B?V[1]:V[2],re=B?V[2]:1,se=B?1:V[1],ae=H[0],pe=B?H[1]:H[2],ie=B?H[2]:1,Y=B?1:H[1],le=t.makeOutput(f.inShape,"float32"),ge=t.dataIdMap.get(le.dataId).id,ve=t.dataIdMap.get(n.dataId).id,Ee=t.dataIdMap.get(a.dataId).id;return hV(ve,Ee,d,h,y,b,x,g,I,C,w,R,P,z,$,G,X,ee,Z,te,re,se,ae,pe,ie,Y,ge),le}var gV={kernelName:Pp,backendName:"wasm",setupFunc:L0e,kernelFunc:B0e};var yV;function U0e(e){yV=e.wasm.cwrap(zp,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function W0e(e){let{inputs:t,backend:r,attrs:o}=e,{x:n,filter:a}=t,{strides:i,pad:s,dilations:c}=o;if(n.dtype!=="float32")throw new Error(`Tensor x must have dtype float32, got ${n.dtype}`);if(a.dtype!=="float32")throw new Error(`Tensor filter must have dtype float32, got ${a.dtype}`);let l=M.computeConv3DInfo(n.shape,a.shape,i,c,s),p=r.makeOutput(l.outShape,n.dtype);return yV(r.dataIdMap.get(n.dataId).id,r.dataIdMap.get(a.dataId).id,r.dataIdMap.get(p.dataId).id,l.batchSize,l.inDepth,l.inHeight,l.inWidth,l.inChannels,l.outDepth,l.outHeight,l.outWidth,l.outChannels,l.strideDepth,l.strideHeight,l.strideWidth,l.dilationDepth,l.dilationHeight,l.dilationWidth,l.filterDepth,l.filterHeight,l.filterWidth,l.padInfo.front,l.padInfo.top,l.padInfo.left),p}var vV={kernelName:zp,backendName:"wasm",setupFunc:U0e,kernelFunc:W0e};var bV;function H0e(e){bV=e.wasm.cwrap(Jv,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function V0e(e){let{inputs:t,backend:r,attrs:o}=e,{x:n,dy:a}=t,{strides:i,pad:s,filterShape:c}=o;if(n.dtype!=="float32")throw new Error(`Tensor dy must have dtype float32, got ${n.dtype}`);if(a.dtype!=="float32")throw new Error(`Tensor filter must have dtype float32, got ${a.dtype}`);let l=M.computeConv3DInfo(n.shape,c,i,1,s),p=r.makeOutput(l.filterShape,a.dtype);return bV(r.dataIdMap.get(n.dataId).id,r.dataIdMap.get(a.dataId).id,r.dataIdMap.get(p.dataId).id,l.batchSize,l.inDepth,l.inHeight,l.inWidth,l.inChannels,l.outDepth,l.outHeight,l.outWidth,l.outChannels,l.strideDepth,l.strideHeight,l.strideWidth,l.dilationDepth,l.dilationHeight,l.dilationWidth,l.filterDepth,l.filterHeight,l.filterWidth,l.padInfo.front,l.padInfo.top,l.padInfo.left),p}var xV={kernelName:Jv,backendName:"wasm",setupFunc:H0e,kernelFunc:V0e};var wV;function j0e(e){wV=e.wasm.cwrap($p,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function G0e(e){let{inputs:t,backend:r,attrs:o}=e,{dy:n,filter:a}=t,{pad:i,strides:s,inputShape:c}=o;if(n.dtype!=="float32")throw new Error(`Tensor dy must have dtype float32, got ${n.dtype}`);if(a.dtype!=="float32")throw new Error(`Tensor filter must have dtype float32, got ${a.dtype}`);let l=M.computeConv3DInfo(c,a.shape,s,1,i),p=r.makeOutput(l.inShape,n.dtype);return wV(r.dataIdMap.get(a.dataId).id,r.dataIdMap.get(n.dataId).id,r.dataIdMap.get(p.dataId).id,l.batchSize,l.inDepth,l.inHeight,l.inWidth,l.inChannels,l.outDepth,l.outHeight,l.outWidth,l.outChannels,l.strideDepth,l.strideHeight,l.strideWidth,l.dilationDepth,l.dilationHeight,l.dilationWidth,l.filterDepth,l.filterHeight,l.filterWidth,l.padInfo.front,l.padInfo.top,l.padInfo.left),p}var SV={kernelName:$p,backendName:"wasm",setupFunc:j0e,kernelFunc:G0e};var kV=we(Lp);var _V=we(Bp);var XA;(function(e){e[e.bilinear=0]="bilinear",e[e.nearest=1]="nearest"})(XA||(XA={}));var EV;function q0e(e){EV=e.wasm.cwrap(Hp,null,["number","number","number","number","array","number","number","number","number","number"])}function K0e(e){let{backend:t,inputs:r,attrs:o}=e,{method:n,extrapolationValue:a,cropSize:i}=o,{image:s,boxes:c,boxInd:l}=r,p=c.shape[0],[u,m]=i,f=[p,u,m,s.shape[3]],d=t.dataIdMap.get(s.dataId),h;s.dtype!=="float32"&&(h=mn({backend:t,inputs:{x:s},attrs:{dtype:"float32"}}),d=t.dataIdMap.get(h.dataId));let y=d.id,g=t.dataIdMap.get(c.dataId).id,b=t.dataIdMap.get(l.dataId).id,x=t.makeOutput(f,"float32"),w=t.dataIdMap.get(x.dataId).id,I=new Uint8Array(new Int32Array(s.shape).buffer);return EV(y,g,b,p,I,u,m,XA[n],a,w),h!=null&&t.disposeData(h.dataId),x}var IV={kernelName:Hp,backendName:"wasm",setupFunc:q0e,kernelFunc:K0e};var TV;function X0e(e){TV=e.wasm.cwrap(Up,null,["number","number","number","number","number","number"])}function Y0e(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,{axis:a,exclusive:i,reverse:s}=o,c=n.shape.length;S.assert(n.dtype==="float32"||n.dtype==="int32",()=>`cumprod does not support ${n.dtype} tensors in the WASM backend`);let l=M.getAxesPermutation([a],c),p=n;l!==null&&(p=ea({inputs:{x:n},attrs:{perm:l},backend:r}));let u=M.getInnerMostAxes(1,c)[0];M.assertAxesAreInnerMostDims("cumprod",[u],c);let m=r.makeOutput(p.shape,p.dtype),f=p.shape[u],d=r.dataIdMap.get(p.dataId).id,h=r.dataIdMap.get(m.dataId).id;TV(d,i?1:0,s?1:0,f,h,Ae[n.dtype]);let y=m;if(l!==null){let g=M.getUndoAxesPermutation(l);y=ea({inputs:{x:m},attrs:{perm:g},backend:r}),r.disposeData(p.dataId),r.disposeData(m.dataId)}return y}var CV={kernelName:Up,backendName:"wasm",setupFunc:X0e,kernelFunc:Y0e};var NV;function Q0e(e){NV=e.wasm.cwrap(Wp,null,["number","number","number","number","number","number"])}function J0e(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,{axis:a,exclusive:i,reverse:s}=o,c=n.shape.length;S.assert(n.dtype==="float32"||n.dtype==="int32",()=>`cumsum does not support ${n.dtype} tensors in the WASM backend`);let l=M.getAxesPermutation([a],c),p=n;l!==null&&(p=ea({inputs:{x:n},attrs:{perm:l},backend:r}));let u=M.getInnerMostAxes(1,c)[0];M.assertAxesAreInnerMostDims("cumsum",[u],c);let m=r.makeOutput(p.shape,p.dtype),f=p.shape[u],d=r.dataIdMap.get(p.dataId).id,h=r.dataIdMap.get(m.dataId).id;NV(d,i?1:0,s?1:0,f,h,Ae[n.dtype]);let y=m;if(l!==null){let g=M.getUndoAxesPermutation(l);y=ea({inputs:{x:m},attrs:{perm:g},backend:r}),r.disposeData(p.dataId),r.disposeData(m.dataId)}return y}var AV={kernelName:Wp,backendName:"wasm",setupFunc:Q0e,kernelFunc:J0e};var RV;function Z0e(e){RV=e.wasm.cwrap("DenseBincount",null,["number","array","number","number","boolean","number","number","boolean","number"])}function ewe(e){let{backend:t,inputs:r,attrs:o}=e,{x:n,weights:a}=r,{size:i,binaryOutput:s}=o,c=a.shape.reduce((m,f)=>m*f,1)!==0,l=n.shape.length===1?[i]:[n.shape[0],i],p=t.makeOutput(l,a.dtype);function u(m){return t.dataIdMap.get(m.dataId).id}return RV(u(n),new Uint8Array(new Int32Array(n.shape).buffer),n.shape.length,i,c,u(a),Ae[a.dtype],s,u(p)),p}var DV={kernelName:sh,backendName:"wasm",setupFunc:Z0e,kernelFunc:ewe};var FV;function twe(e){FV=e.wasm.cwrap(Vp,null,["number","number","number","array","number","array","array","number","number"])}function rwe(e){let{backend:t,inputs:r,attrs:o}=e,{x:n}=r,{blockSize:a,dataFormat:i}=o,s=n.shape[0],c=i==="NHWC"?n.shape[1]:n.shape[2],l=i==="NHWC"?n.shape[2]:n.shape[3],p=i==="NHWC"?n.shape[3]:n.shape[1],u=c*a,m=l*a,f=p/(a*a),d=i==="NHWC"?[s,u,m,f]:[s,f,u,m],h=t.makeOutput(d,"float32"),g=t.dataIdMap.get(n.dataId).id,b=new Uint8Array(new Int32Array(S.computeStrides(n.shape)).buffer),x=new Uint8Array(new Int32Array(d).buffer),w=new Uint8Array(new Int32Array(S.computeStrides(d)).buffer),I=t.dataIdMap.get(h.dataId).id;return FV(g,a,i==="NHWC"?1:0,b,n.shape.length-1,x,w,d.length,I),h}var MV={kernelName:Vp,backendName:"wasm",setupFunc:twe,kernelFunc:rwe};var OV;function owe(e){OV=e.wasm.cwrap(jp,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function nwe(e){let{inputs:t,attrs:r,backend:o}=e,{x:n,filter:a}=t,i=o.dataIdMap.get(n.dataId).id,s=o.dataIdMap.get(a.dataId).id,{strides:c,dilations:l,pad:p,dimRoundingMode:u}=r,m=l??[1,1],f=M.computeConv2DInfo(n.shape,a.shape,c,m,p,u,!0),d=f.filterHeight,h=f.filterWidth,y=f.padInfo.top,g=f.padInfo.right,b=f.padInfo.bottom,x=f.padInfo.left,w=f.dilationHeight,I=f.dilationWidth,C=f.strideHeight,R=f.strideWidth,P=f.inChannels,z=f.outChannels,$=f.padInfo.type==="SAME"?1:0;if(f.dataFormat!=="channelsLast")throw new Error(`wasm backend DepthwiseConv2dNative does not support dataFormat:'${f.dataFormat}'. Please use 'channelsLast'.`);let B=o.makeOutput(f.outShape,"float32"),V=o.dataIdMap.get(B.dataId).id;return OV(i,n.shape[0],n.shape[1],n.shape[2],s,d,h,y,g,b,x,$,w,I,C,R,P,z,V),B}var PV={kernelName:jp,backendName:"wasm",setupFunc:owe,kernelFunc:nwe};var zV;function awe(e){zV=e.wasm.cwrap("Diag",null,["number","number","number","number"])}function iwe(e){let{inputs:t,backend:r}=e,{x:o}=t,n=S.sizeFromShape(o.shape),a=r.makeOutput([...o.shape,...o.shape],o.dtype);return zV(r.dataIdMap.get(o.dataId).id,Ae[o.dtype],n,r.dataIdMap.get(a.dataId).id),a}var $V={kernelName:lh,backendName:"wasm",setupFunc:awe,kernelFunc:iwe};var LV;function swe(e){LV=e.wasm.cwrap(Gp,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function lwe(e){let{inputs:t,backend:r,attrs:o}=e,{x:n,filter:a}=t,{strides:i,pad:s,dilations:c}=o;if(n.dtype!==a.dtype)throw new Error(`Dilation2D error: x must have the same dtype as filter. Got ${n.dtype} and ${a.dtype}`);let l=M.computeDilation2DInfo(n.shape,a.shape,i,s,"NHWC",c),p=r.makeOutput(l.outShape,n.dtype);return LV(r.dataIdMap.get(n.dataId).id,r.dataIdMap.get(a.dataId).id,r.dataIdMap.get(p.dataId).id,Ae[n.dtype],l.batchSize,l.inChannels,l.inHeight,l.inWidth,l.outHeight,l.outWidth,l.strideHeight,l.strideWidth,l.dilationHeight,l.dilationWidth,l.filterHeight,l.filterWidth,l.padInfo.top,l.padInfo.left),p}var BV={kernelName:Gp,backendName:"wasm",setupFunc:swe,kernelFunc:lwe};var UV;function cwe(e){UV=e.wasm.cwrap(ph,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function pwe(e){let{inputs:t,backend:r,attrs:o}=e,{x:n,filter:a,dy:i}=t,{strides:s,pad:c,dilations:l}=o;if(n.dtype!==a.dtype||n.dtype!==i.dtype)throw new Error(`Dilation2DBackpropFilter error: x must have the same dtype as filter and dy. Got ${n.dtype}, ${a.dtype}, and ${i.dtype}`);let p=M.computeDilation2DInfo(n.shape,a.shape,s,c,"NHWC",l),u=r.makeOutput(a.shape,a.dtype);return UV(r.dataIdMap.get(n.dataId).id,r.dataIdMap.get(a.dataId).id,r.dataIdMap.get(i.dataId).id,r.dataIdMap.get(u.dataId).id,Ae[n.dtype],p.batchSize,p.inChannels,p.inHeight,p.inWidth,p.outHeight,p.outWidth,p.strideHeight,p.strideWidth,p.dilationHeight,p.dilationWidth,p.filterHeight,p.filterWidth,p.padInfo.top,p.padInfo.left),u}var WV={kernelName:ph,backendName:"wasm",setupFunc:cwe,kernelFunc:pwe};var HV;function uwe(e){HV=e.wasm.cwrap(ch,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function mwe(e){let{inputs:t,backend:r,attrs:o}=e,{x:n,filter:a,dy:i}=t,{strides:s,pad:c,dilations:l}=o;if(n.dtype!==a.dtype||n.dtype!==i.dtype)throw new Error(`Dilation2DBackpropInput error: x must have the same dtype as filter and dy. Got ${n.dtype}, ${a.dtype}, and ${i.dtype}`);let p=M.computeDilation2DInfo(n.shape,a.shape,s,c,"NHWC",l),u=r.makeOutput(n.shape,n.dtype);return HV(r.dataIdMap.get(n.dataId).id,r.dataIdMap.get(a.dataId).id,r.dataIdMap.get(i.dataId).id,r.dataIdMap.get(u.dataId).id,Ae[n.dtype],p.batchSize,p.inChannels,p.inHeight,p.inWidth,p.outHeight,p.outWidth,p.strideHeight,p.strideWidth,p.dilationHeight,p.dilationWidth,p.filterHeight,p.filterWidth,p.padInfo.top,p.padInfo.left),u}var VV={kernelName:ch,backendName:"wasm",setupFunc:uwe,kernelFunc:mwe};var jV=we(Kp);var GV;function fwe(e){GV=e.wasm.cwrap(eb,null,["number","number","number"])}function dwe(e){let{inputs:t,backend:r}=e,{dy:o,y:n}=t,a=r.makeOutput(n.shape,"float32"),i=s=>r.dataIdMap.get(s.dataId).id;return GV(i(n),i(o),i(a)),a}var qV={kernelName:eb,backendName:"wasm",setupFunc:fwe,kernelFunc:dwe};var hwe=!1,KV=ut(Yp,hwe,"bool");var XV=we(Xp);var YV=we(Qp,"float32");function Fk(e){let{inputs:t,attrs:r,backend:o}=e,{input:n}=t,{dim:a}=r,i=n.shape.length,s=n.shape.slice(),c=a;return a<0&&(S.assert(-(i+1)<=a,()=>`Axis must be in the interval [${-(i+1)}, ${i}]`),c=i+a+1),s.splice(c,0,1),Fr({inputs:{x:n},backend:o,attrs:{shape:s}})}var QV={kernelName:uh,backendName:"wasm",kernelFunc:Fk};var JV=we(Jp,"float32");function YA(e){let{attrs:{shape:t,value:r,dtype:o},backend:n}=e,a=n.makeOutput(t,o);return n.typedArrayFromHeap(a).fill(r),a}var ZV={kernelName:mh,backendName:"wasm",kernelFunc:YA};var ej;function gwe(e){ej=e.wasm.cwrap(Zp,null,["number","number","number","number","number","number"])}function ywe(e){let{inputs:t,backend:r}=e,{image:o}=t,n=r.makeOutput(o.shape,o.dtype),a=r.dataIdMap.get(o.dataId).id,i=r.dataIdMap.get(n.dataId).id,[s,c,l,p]=o.shape;return ej(a,s,c,l,p,i),n}var tj={kernelName:Zp,backendName:"wasm",kernelFunc:ywe,setupFunc:gwe};var rj=we(eu);var vwe=!1,oj=ut(tu,vwe);var nj;function bwe(e){nj=e.wasm.cwrap(ru,null,["number","number","number","number","number","number","number"])}function xwe(e){let{backend:t,inputs:r,attrs:o}=e,{varianceEpsilon:n}=o,{x:a,mean:i,variance:s,offset:c,scale:l}=r,p=t.dataIdMap.get(a.dataId).id,u=t.dataIdMap.get(i.dataId).id,m=t.dataIdMap.get(s.dataId).id,f=c!=null?t.dataIdMap.get(c.dataId).id:0,d=l!=null?t.dataIdMap.get(l.dataId).id:0,h=t.makeOutput(a.shape,a.dtype);if(S.sizeFromShape(a.shape)===0)return h;let y=t.dataIdMap.get(h.dataId).id;return nj(p,u,m,f,d,n,y),h}var aj={kernelName:ru,backendName:"wasm",setupFunc:bwe,kernelFunc:xwe};var ij;function wwe(e){ij=e.wasm.cwrap(Vl,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function Swe(e){let{inputs:t,attrs:r,backend:o}=e,{x:n,filter:a,bias:i,preluActivationWeights:s}=t,{strides:c,pad:l,dilations:p,dataFormat:u,dimRoundingMode:m,activation:f,leakyreluAlpha:d}=r,h=M.computeConv2DInfo(n.shape,a.shape,c,p,l,m),y=ic[f];if(y==null)throw new Error(`${f} activation not yet supported for FusedConv2D in the wasm backend.`);let g=o.dataIdMap.get(n.dataId).id,b=o.dataIdMap.get(a.dataId).id,x=h.outChannels,w=0;if(i!=null){let ie=o.dataIdMap.get(i.dataId);if(ie.shape.length!==1)throw new Error(`FusedConv2D only supports rank-1 bias but got rank ${ie.shape.length}.`);if(ie.shape[0]!==x)throw new Error(`FusedConv2D bias shape (${ie.shape}) does not match the number of output channels (${x})`);w=ie.id}let I=h.filterHeight,C=h.filterWidth,R=h.padInfo.top,P=h.padInfo.right,z=h.padInfo.bottom,$=h.padInfo.left,B=h.dilationHeight,V=h.dilationWidth,H=h.strideHeight,G=h.strideWidth,X=h.inChannels,ee=h.padInfo.type==="SAME"?1:0,Z=h.batchSize,te=h.inHeight,re=h.inWidth;if(u!=="NHWC")throw new Error(`wasm backend FusedConv2D does not support dataFormat:'${u}'. Please use 'NHWC'.`);let se=o.makeOutput(h.outShape,"float32"),ae=o.dataIdMap.get(se.dataId).id,pe=s==null?0:o.dataIdMap.get(s.dataId).id;return ij(g,Z,te,re,b,I,C,w,R,P,z,$,ee,B,V,H,G,X,x,y,pe,d||0,ae),se}var sj={kernelName:Vl,backendName:"wasm",setupFunc:wwe,kernelFunc:Swe};var lj;function kwe(e){lj=e.wasm.cwrap(jl,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function _we(e){let{inputs:t,attrs:r,backend:o}=e,{x:n,filter:a,bias:i,preluActivationWeights:s}=t,{strides:c,pad:l,dilations:p,dataFormat:u,dimRoundingMode:m,activation:f,leakyreluAlpha:d}=r,h=M.computeConv2DInfo(n.shape,a.shape,c,p,l,m,!0),y=ic[f];if(y==null)throw new Error(`${f} activation not yet supported for FusedDepthwiseConv2D in the wasm backend.`);let g=o.dataIdMap.get(n.dataId).id,b=o.dataIdMap.get(a.dataId).id,x=h.outChannels,w=0;if(i!=null){let ie=o.dataIdMap.get(i.dataId);if(ie.shape.length!==1)throw new Error(`FusedDepthwiseConv2D only supports rank-1 bias but got rank ${ie.shape.length}.`);if(ie.shape[0]!==x)throw new Error(`FusedDepthwiseConv2D bias shape (${ie.shape}) does not match the number of output channels (${x})`);w=ie.id}let I=h.filterHeight,C=h.filterWidth,R=h.padInfo.top,P=h.padInfo.right,z=h.padInfo.bottom,$=h.padInfo.left,B=h.dilationHeight,V=h.dilationWidth,H=h.strideHeight,G=h.strideWidth,X=h.inChannels,ee=h.padInfo.type==="SAME"?1:0,Z=h.batchSize,te=h.inHeight,re=h.inWidth;if(u!=="NHWC")throw new Error(`wasm backend FusedDepthwiseConv2D does not support dataFormat:'${u}'. Please use 'NHWC'.`);let se=o.makeOutput(h.outShape,"float32"),ae=o.dataIdMap.get(se.dataId).id,pe=s==null?0:o.dataIdMap.get(s.dataId).id;return lj(g,Z,te,re,b,I,C,w,R,P,z,$,ee,B,V,H,G,X,x,y,pe,d||0,ae),se}var cj={kernelName:jl,backendName:"wasm",setupFunc:kwe,kernelFunc:_we};var pj;function Ewe(e){pj=e.wasm.cwrap(ou,null,["number","number","number","number","number","number","array","number"])}function Iwe(e){let{backend:t,inputs:r}=e,{params:o,indices:n}=r,[a,i,s,c]=lk.prepareAndValidate(o,n),l=t.makeOutput(a,o.dtype);if(i===0)return l;let p=n.shape,u=p[p.length-1],f=t.dataIdMap.get(o.dataId).id,h=t.dataIdMap.get(n.dataId).id,y=new Uint8Array(new Int32Array(c).buffer),g=t.dataIdMap.get(l.dataId).id;return pj(f,Ae[o.dtype],h,i,u,s,y,g),l}var uj={kernelName:ou,backendName:"wasm",setupFunc:Ewe,kernelFunc:Iwe};var mj;function Twe(e){mj=e.wasm.cwrap("Gather",null,["number","number","array","number","number","number","array","number"])}function Cwe(e){let{backend:t,inputs:r,attrs:o}=e,{x:n,indices:a}=r,{axis:i,batchDims:s}=o,c=S.parseAxisParam(i,n.shape)[0],l=t.readSync(a.dataId),p=n.shape[c];for(let z=0;z<l.length;++z){let $=l[z];S.assert($<=p-1&&$>=0,()=>`GatherV2: the index value ${$} is not in [0, ${p-1}]`)}let u=M.segment_util.collectGatherOpShapeInfo(n,a,c,s),m=Fr({inputs:{x:n},attrs:{shape:[u.batchSize,u.outerSize,u.dimSize,u.sliceSize]},backend:t}),f=S.sizeFromShape(a.shape),d=Fr({inputs:{x:a},attrs:{shape:[u.batchSize,f/u.batchSize]},backend:t}),h=[u.batchSize,u.outerSize,f/u.batchSize,u.sliceSize],y=t.makeOutput(h,n.dtype);if(S.sizeFromShape(n.shape)===0)return y;let g=m.shape.length-1,x=t.dataIdMap.get(m.dataId).id,I=t.dataIdMap.get(d.dataId).id,C=t.dataIdMap.get(y.dataId).id,R=new Uint8Array(new Int32Array(S.computeStrides(m.shape)).buffer),P=new Uint8Array(new Int32Array(S.computeStrides(h)).buffer);return mj(x,Ae[n.dtype],R,g,I,u.batchSize,P,C),t.disposeData(m.dataId),t.disposeData(d.dataId),y.shape=u.outputShape,y}var fj={kernelName:fh,backendName:"wasm",setupFunc:Twe,kernelFunc:Cwe};var Nwe=!1,dj=ut(nu,Nwe,"bool");var Awe=!1,hj=ut(au,Awe,"bool");var gj=we(iu,"bool");var yj=we(su,"bool");var vj=we(lu,"bool");var bj;function Rwe(e){bj=e.wasm.cwrap(cu,null,["number","number","number","number"])}function Dwe(e){let{inputs:{x:t},attrs:{alpha:r},backend:o}=e,n=o.dataIdMap.get(t.dataId).id,a=o.makeOutput(t.shape,"float32");if(S.sizeFromShape(t.shape)!==0){let i=o.dataIdMap.get(a.dataId).id;bj(n,Ae[t.dtype],r,i)}return a}var xj={kernelName:cu,backendName:"wasm",setupFunc:Rwe,kernelFunc:Dwe};var Fwe=!1,wj=ut(pu,Fwe,"bool");var Mwe=!1,Sj=ut(uu,Mwe,"bool");var kj;function Owe(e){kj=e.wasm.cwrap(mu,null,["number","number","number","number"])}function Pwe(e){let{attrs:t,backend:r}=e,{start:o,stop:n,num:a}=t,i=Math.floor(a),s=r.makeOutput([i],"float32");return kj(r.dataIdMap.get(s.dataId).id,o,n,i),s}var _j={kernelName:mu,backendName:"wasm",setupFunc:Owe,kernelFunc:Pwe};var Ej=we(fu);var Ij=we(du);var zwe=!1,Tj=ut(hu,zwe,"bool");var Cj=we(gu);var $we=!1,Nj=ut(yu,$we,"bool");var Lwe=!1,Aj=ut(Z8,Lwe,"bool");var Rj;function Bwe(e){Rj=e.wasm.cwrap(vu,null,["number","number","number","number","number","number","number"])}function Uwe(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,{depthRadius:a,bias:i,alpha:s,beta:c}=o;if(n.dtype!=="float32")throw new Error("LRN error: x must have dtype float32");let l=r.makeOutput(n.shape,n.dtype);return Rj(r.dataIdMap.get(n.dataId).id,r.dataIdMap.get(l.dataId).id,n.shape[3],a,i,s,c),l}var Dj={kernelName:vu,backendName:"wasm",setupFunc:Bwe,kernelFunc:Uwe};var Fj;function Wwe(e){Fj=e.wasm.cwrap(tb,null,["number","number","number","number","number","number","number","number","number"])}function Hwe(e){let{inputs:t,backend:r,attrs:o}=e,{x:n,y:a,dy:i}=t,{depthRadius:s,bias:c,alpha:l,beta:p}=o;if(n.dtype!=="float32"||a.dtype!=="float32"||i.dtype!=="float32")throw new Error("LRNGrad error: x, y, and dy must have dtype float32");let u=r.makeOutput(n.shape,n.dtype);return Fj(r.dataIdMap.get(n.dataId).id,r.dataIdMap.get(a.dataId).id,r.dataIdMap.get(i.dataId).id,r.dataIdMap.get(u.dataId).id,i.shape[3],s,c,l,p),u}var Mj={kernelName:tb,backendName:"wasm",setupFunc:Wwe,kernelFunc:Hwe};var Oj;function Vwe(e){Oj=e.wasm.cwrap(bu,null,["number","number","number","number"])}function jwe(e){let{backend:t,inputs:r,attrs:o}=e,{reductionIndices:n,keepDims:a}=o,{x:i}=r,c=t.dataIdMap.get(i.dataId).id,l=i,{transposed:p,axes:u,originalAxes:m,inputWasTransposed:f}=Ho(i,n,t);if(f){let x=t.dataIdMap.get(p.dataId).id;l=p,c=x}let d=l.shape.length;M.assertAxesAreInnerMostDims("max",u,d);let[h,y]=M.computeOutAndReduceShapes(l.shape,u),g=S.sizeFromShape(y),b=t.makeOutput(h,i.dtype);if(S.sizeFromShape(l.shape)!==0){let x=t.dataIdMap.get(b.dataId).id;Oj(c,Ae[i.dtype],g,x)}if(f&&t.disposeData(p.dataId),a){let x=M.expandShapeToKeepDim(b.shape,m);b.shape=x}return b}var Pj={kernelName:bu,backendName:"wasm",setupFunc:Vwe,kernelFunc:jwe};var Gwe=!1,zj=ut(xu,Gwe);var $j;function qwe(e){$j=e.wasm.cwrap(wu,null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function Kwe(e){let{inputs:t,attrs:r,backend:o}=e,n=t.x,a=o.dataIdMap.get(n.dataId).id;S.assert(n.dtype==="float32",()=>`Error in MaxPool: only float32 input is supported. Got ${n.dtype}.`);let{filterSize:i,strides:s,pad:c,dimRoundingMode:l}=r,p=M.computePool2DInfo(n.shape,i,s,1,c,l),u=p.filterHeight,m=p.filterWidth,f=p.padInfo.top,d=p.padInfo.right,h=p.padInfo.bottom,y=p.padInfo.left,g=p.dilationHeight,b=p.dilationWidth,x=p.strideHeight,w=p.strideWidth,I=p.inChannels,C=p.outChannels;if(p.dataFormat!=="channelsLast")throw new Error(`wasm backend does not support dataFormat:'${p.dataFormat}'. Please use 'channelsLast'.`);let R=o.makeOutput(p.outShape,"float32"),P=o.dataIdMap.get(R.dataId).id;return $j(a,n.shape[0],n.shape[1],n.shape[2],u,m,f,d,h,y,g,b,x,w,I,C,P),R}var Lj={kernelName:wu,backendName:"wasm",setupFunc:qwe,kernelFunc:Kwe};var Bj;function Xwe(e){Bj=e.wasm.cwrap("MaxPool3D",null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function Ywe(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,{filterSize:a,strides:i,pad:s,dimRoundingMode:c,dataFormat:l}=o,p=M.computePool3DInfo(n.shape,a,i,1,s,c,l),u=r.makeOutput(p.outShape,n.dtype);return Bj(r.dataIdMap.get(n.dataId).id,r.dataIdMap.get(u.dataId).id,p.batchSize,p.inChannels,p.inDepth,p.inHeight,p.inWidth,p.outDepth,p.outHeight,p.outWidth,p.strideDepth,p.strideHeight,p.strideWidth,p.dilationDepth,p.dilationHeight,p.dilationWidth,p.effectiveFilterDepth,p.effectiveFilterHeight,p.effectiveFilterWidth,p.padInfo.front,p.padInfo.top,p.padInfo.left),u}var Uj={kernelName:dh,backendName:"wasm",setupFunc:Xwe,kernelFunc:Ywe};var Wj;function Qwe(e){Wj=e.wasm.cwrap("MaxPool3DGrad",null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function Jwe(e){let{inputs:t,backend:r,attrs:o}=e,{dy:n,input:a}=t,{filterSize:i,strides:s,pad:c,dimRoundingMode:l}=o,p=M.computePool3DInfo(a.shape,i,s,1,c,l),u=r.makeOutput(a.shape,a.dtype);return Wj(r.dataIdMap.get(a.dataId).id,r.dataIdMap.get(n.dataId).id,r.dataIdMap.get(u.dataId).id,p.batchSize,p.inChannels,p.inDepth,p.inHeight,p.inWidth,p.outDepth,p.outHeight,p.outWidth,p.strideDepth,p.strideHeight,p.strideWidth,p.dilationDepth,p.dilationHeight,p.dilationWidth,p.effectiveFilterDepth,p.effectiveFilterHeight,p.effectiveFilterWidth,p.padInfo.front,p.padInfo.top,p.padInfo.left),u}var Hj={kernelName:O1,backendName:"wasm",setupFunc:Qwe,kernelFunc:Jwe};var Vj;function Zwe(e){Vj=e.wasm.cwrap("MaxPoolGrad",null,["number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function e1e(e){let{inputs:t,backend:r,attrs:o}=e,{dy:n,input:a}=t,{filterSize:i,strides:s,pad:c,dimRoundingMode:l}=o,p=M.computePool2DInfo(a.shape,i,s,1,c,l),u=r.makeOutput(a.shape,a.dtype);return Vj(r.dataIdMap.get(a.dataId).id,r.dataIdMap.get(n.dataId).id,r.dataIdMap.get(u.dataId).id,p.batchSize,p.inChannels,p.inHeight,p.inWidth,p.outHeight,p.outWidth,p.strideHeight,p.strideWidth,p.dilationHeight,p.dilationWidth,p.effectiveFilterHeight,p.effectiveFilterWidth,p.padInfo.top,p.padInfo.left),u}var jj={kernelName:M1,backendName:"wasm",setupFunc:Zwe,kernelFunc:e1e};var Gj;function t1e(e){Gj=e.wasm.cwrap("MaxPoolWithArgmax",null,["number","number","number","number","boolean","number","number","number","number","number","number","number","number","number","number","number","number","number","number"])}function r1e(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,{filterSize:a,strides:i,pad:s,includeBatchInIndex:c}=o;S.assert(n.shape.length===4,()=>`Error in maxPool: input must be rank 4 but got rank ${n.shape.length}.`);let l=[1,1];S.assert(M.eitherStridesOrDilationsAreOne(i,l),()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${i} and dilations '${l}'`);let p=M.computePool2DInfo(n.shape,a,i,[1,1],s),u=r.makeOutput(p.outShape,n.dtype),m=r.makeOutput(p.outShape,"int32");return Gj(r.dataIdMap.get(n.dataId).id,r.dataIdMap.get(u.dataId).id,r.dataIdMap.get(m.dataId).id,Ae[n.dtype],c,p.batchSize,p.inChannels,p.inHeight,p.inWidth,p.outHeight,p.outWidth,p.strideHeight,p.strideWidth,p.dilationHeight,p.dilationWidth,p.effectiveFilterHeight,p.effectiveFilterWidth,p.padInfo.top,p.padInfo.left),[u,m]}var qj={kernelName:hh,backendName:"wasm",setupFunc:t1e,kernelFunc:r1e};var Kj;function o1e(e){Kj=e.wasm.cwrap(Su,null,["number, number, number"])}function n1e(e){let{backend:t,inputs:r,attrs:o}=e,{axis:n,keepDims:a}=o,{x:i}=r,s=t.dataIdMap.get(i.dataId).id,c=s,l=i,{transposed:p,axes:u,originalAxes:m,inputWasTransposed:f}=Ho(i,n,t),d=u;if(f){let w=t.dataIdMap.get(p.dataId).id;w!==s&&(l=p,c=w,d=M.getInnerMostAxes(d.length,l.shape.length))}M.assertAxesAreInnerMostDims("mean",d,l.shape.length);let[h,y]=M.computeOutAndReduceShapes(l.shape,d),g=S.sizeFromShape(y),b=l;l.dtype!=="float32"&&(b=mn({backend:t,inputs:{x:l},attrs:{dtype:"float32"}}),c=t.dataIdMap.get(b.dataId).id);let x=t.makeOutput(h,"float32");if(S.sizeFromShape(l.shape)!==0){let w=t.dataIdMap.get(x.dataId).id;Kj(c,g,w)}if(f&&t.disposeData(p.dataId),a){let w=M.expandShapeToKeepDim(x.shape,m);x.shape=w}return l.dtype!=="float32"&&t.disposeData(b.dataId),x}var Xj={kernelName:Su,backendName:"wasm",setupFunc:o1e,kernelFunc:n1e};var Yj;function a1e(e){Yj=e.wasm.cwrap(ku,null,["number","number","number","number"])}function i1e(e){let{backend:t,inputs:r,attrs:o}=e,{axis:n,keepDims:a}=o,{x:i}=r,s=t.dataIdMap.get(i.dataId).id,c=s,l=i,{transposed:p,axes:u,originalAxes:m,inputWasTransposed:f}=Ho(i,n,t);if(f){let x=t.dataIdMap.get(p.dataId).id;x!==s&&(l=p,c=x)}let d=l.shape.length;M.assertAxesAreInnerMostDims("min",u,d);let[h,y]=M.computeOutAndReduceShapes(l.shape,u),g=S.sizeFromShape(y),b=t.makeOutput(h,l.dtype);if(S.sizeFromShape(l.shape)!==0){let x=t.dataIdMap.get(b.dataId).id;Yj(c,Ae[i.dtype],g,x)}if(f&&t.disposeData(p.dataId),a){let x=M.expandShapeToKeepDim(b.shape,m);b.shape=x}return b}var Qj={kernelName:ku,backendName:"wasm",setupFunc:a1e,kernelFunc:i1e};var s1e=!1,Jj=ut(_u,s1e);var QA;(function(e){e[e.reflect=0]="reflect",e[e.symmetric=1]="symmetric"})(QA||(QA={}));var Zj;function l1e(e){Zj=e.wasm.cwrap(Eu,null,["number","array","number","number","array","array","number","number"])}function c1e(e){let{inputs:{x:t},backend:r,attrs:{paddings:o,mode:n}}=e,a=o.map((d,h)=>d[0]+t.shape[h]+d[1]),i=r.dataIdMap.get(t.dataId).id,s=r.makeOutput(a,t.dtype),c=r.dataIdMap.get(s.dataId).id,l=new Uint8Array(new Int32Array(t.shape).buffer),p=o.map(d=>d[0]),u=o.map(d=>d[1]),m=new Uint8Array(new Int32Array(p).buffer),f=new Uint8Array(new Int32Array(u).buffer);return Zj(i,l,t.shape.length,Ae[t.dtype],m,f,QA[n],c),s}var eG={kernelName:Eu,backendName:"wasm",kernelFunc:c1e,setupFunc:l1e};var tG;function p1e(e){tG=e.wasm.cwrap(om,null,["number","number","number","number"])}function JA(e){let{backend:t,inputs:{logits:r},attrs:{dim:o}}=e,n=t.dataIdMap.get(r.dataId).id,a=t.makeOutput(r.shape,r.dtype),i=t.dataIdMap.get(a.dataId).id,s=r.shape[o],c=S.sizeFromShape(r.shape)/s;return S.sizeFromShape(a.shape)===0||tG(n,i,s,c),a}var rG={kernelName:om,backendName:"wasm",setupFunc:p1e,kernelFunc:JA};var oG;function u1e(e){oG=e.wasm.cwrap(Tu,null,["number","number","number","number","number","number"])}function m1e(e){let{inputs:t,backend:r,attrs:o}=e,{logits:n}=t,{numSamples:a,seed:i,normalized:s}=o;if(n.dtype!=="float32")throw new Error(`Tensor logits must have dtype float32, got ${n.dtype}`);let c=s?n:JA({inputs:{logits:n},backend:r,attrs:{dim:n.shape.length-1}}),[l,p]=c.shape,u=r.makeOutput([l,a],"int32");return oG(r.dataIdMap.get(c.dataId).id,l,p,a,i,r.dataIdMap.get(u.dataId).id),s||r.disposeData(c.dataId),u}var nG={kernelName:Tu,backendName:"wasm",setupFunc:u1e,kernelFunc:m1e};var aG=ut(Iu,!0);var f1e=!0,iG=ut(Cu,f1e);var sG=we(gh);function ug(e,t){let r=new Int32Array(e.wasm.HEAPU8.buffer,t,4),o=r[0],n=r[1],a=r[2],i=r[3];return e.wasm._free(t),{pSelectedIndices:o,selectedSize:n,pSelectedScores:a,pValidOutputs:i}}var lG;function d1e(e){lG=e.wasm.cwrap(Au,"number",["number","number","number","number","number"])}function h1e(e){let{backend:t,inputs:r,attrs:o}=e,{iouThreshold:n,maxOutputSize:a,scoreThreshold:i}=o,{boxes:s,scores:c}=r,l=t.dataIdMap.get(s.dataId).id,p=t.dataIdMap.get(c.dataId).id,u=lG(l,p,a,n,i),{pSelectedIndices:m,selectedSize:f,pSelectedScores:d,pValidOutputs:h}=ug(t,u);return t.wasm._free(d),t.wasm._free(h),t.makeOutput([f],"int32",m)}var cG={kernelName:Au,backendName:"wasm",setupFunc:d1e,kernelFunc:h1e};var pG;function g1e(e){pG=e.wasm.cwrap(Ru,"number",["number","number","number","number","number","bool"])}function y1e(e){let{backend:t,inputs:r,attrs:o}=e,{iouThreshold:n,maxOutputSize:a,scoreThreshold:i,padToMaxOutputSize:s}=o,{boxes:c,scores:l}=r,p=t.dataIdMap.get(c.dataId).id,u=t.dataIdMap.get(l.dataId).id,m=pG(p,u,a,n,i,s),{pSelectedIndices:f,selectedSize:d,pSelectedScores:h,pValidOutputs:y}=ug(t,m);t.wasm._free(h);let g=t.makeOutput([d],"int32",f),b=t.makeOutput([],"int32",y);return[g,b]}var uG={kernelName:Ru,backendName:"wasm",setupFunc:g1e,kernelFunc:y1e};var mG;function v1e(e){mG=e.wasm.cwrap(Du,"number",["number","number","number","number","number","number"])}function b1e(e){let{backend:t,inputs:r,attrs:o}=e,{iouThreshold:n,maxOutputSize:a,scoreThreshold:i,softNmsSigma:s}=o,{boxes:c,scores:l}=r,p=t.dataIdMap.get(c.dataId).id,u=t.dataIdMap.get(l.dataId).id,m=mG(p,u,a,n,i,s),{pSelectedIndices:f,selectedSize:d,pSelectedScores:h,pValidOutputs:y}=ug(t,m);t.wasm._free(y);let g=t.makeOutput([d],"int32",f),b=t.makeOutput([d],"float32",h);return[g,b]}var fG={kernelName:Du,backendName:"wasm",setupFunc:v1e,kernelFunc:b1e};var x1e=!1,dG=ut(Nu,x1e,"bool");var hG;function w1e(e){hG=e.wasm.cwrap(Fu,null,["number","number","number","number","number"])}function S1e(e){let{inputs:t,backend:r,attrs:o}=e,{indices:n}=t,{dtype:a,depth:i,onValue:s,offValue:c}=o,l=r.makeOutput([...n.shape,i],a),p=r.dataIdMap.get(l.dataId).id,m=r.dataIdMap.get(n.dataId).id;return hG(m,i,s,c,p),l}var gG={kernelName:Fu,backendName:"wasm",setupFunc:w1e,kernelFunc:S1e};function k1e(e){let{inputs:{x:t},backend:r}=e,o=r.makeOutput(t.shape,t.dtype);return r.typedArrayFromHeap(o).fill(1),o}var yG={kernelName:yh,backendName:"wasm",kernelFunc:k1e};function _1e(e){let{inputs:t,backend:r,attrs:o}=e,{axis:n}=o;if(t.length===1)return Fk({inputs:{input:t[0]},backend:r,attrs:{dim:n}});let a=t[0].shape,i=t[0].dtype;t.forEach(p=>{S.assertShapesMatch(a,p.shape,"All tensors passed to stack must have matching shapes"),S.assert(i===p.dtype,()=>"All tensors passed to stack must have matching dtypes")});let s=[],c=t.map(p=>{let u=Fk({inputs:{input:p},backend:r,attrs:{dim:n}});return s.push(u),u}),l=KA({inputs:c,backend:r,attrs:{axis:n}});return s.forEach(p=>r.disposeData(p.dataId)),l}var vG={kernelName:vh,backendName:"wasm",kernelFunc:_1e};var bG;function E1e(e){bG=e.wasm.cwrap(Mu,null,["number","array","number","number","array","array","number","number"])}function I1e(e){let{inputs:{x:t},backend:r,attrs:{paddings:o,constantValue:n}}=e,a=o.map((h,y)=>h[0]+t.shape[y]+h[1]);if(S.sizeFromShape(t.shape)===0)return YA({backend:r,attrs:{shape:a,value:n,dtype:t.dtype}});let i=r.dataIdMap.get(t.dataId).id,s=r.makeOutput(a,t.dtype),l=r.dataIdMap.get(s.dataId).id,p=new Uint8Array(new Int32Array(t.shape).buffer),u=o.map(h=>h[0]),m=o.map(h=>h[1]),f=new Uint8Array(new Int32Array(u).buffer),d=new Uint8Array(new Int32Array(m).buffer);return bG(i,p,t.shape.length,Ae[t.dtype],f,d,n,l),s}var Mk={kernelName:Mu,backendName:"wasm",kernelFunc:I1e,setupFunc:E1e};var T1e=!1,xG=ut(Ou,T1e);var wG;function C1e(e){wG=e.wasm.cwrap(Pu,null,["number","number","number"])}function N1e(e){let{inputs:t,backend:r}=e,{x:o,alpha:n}=t,a=r.dataIdMap.get(o.dataId).id,i=r.dataIdMap.get(n.dataId).id,s=a,c=o,l=c;c.dtype!=="float32"&&(l=mn({backend:r,inputs:{x:o},attrs:{dtype:"float32"}}),s=r.dataIdMap.get(l.dataId).id);let p=r.makeOutput(o.shape,"float32"),u=r.dataIdMap.get(p.dataId).id;return wG(s,i,u),c.dtype!=="float32"&&r.disposeData(l.dataId),p}var SG={kernelName:Pu,backendName:"wasm",setupFunc:C1e,kernelFunc:N1e};var kG;function A1e(e){kG=e.wasm.cwrap(zu,null,["number","number","number","number"])}function R1e(e){let{backend:t,inputs:r,attrs:o}=e,{axis:n,keepDims:a}=o,{x:i}=r,s=t.dataIdMap.get(i.dataId).id,c=s,l=i,{transposed:p,axes:u,originalAxes:m,inputWasTransposed:f}=Ho(i,n,t),d=u;if(f){let x=t.dataIdMap.get(p.dataId).id;x!==s&&(l=p,c=x,d=M.getInnerMostAxes(d.length,l.shape.length))}M.assertAxesAreInnerMostDims("prod",d,l.shape.length);let[h,y]=M.computeOutAndReduceShapes(l.shape,d),g=S.sizeFromShape(y),b=t.makeOutput(h,l.dtype);if(S.sizeFromShape(l.shape)!==0){let x=t.dataIdMap.get(b.dataId).id;kG(c,g,Ae[b.dtype],x)}if(f&&t.disposeData(p.dataId),a){let x=M.expandShapeToKeepDim(b.shape,m);b.shape=x}return b}var _G={kernelName:zu,backendName:"wasm",setupFunc:A1e,kernelFunc:R1e};var D1e=e=>{let{backend:t,attrs:r}=e,{start:o,stop:n,step:a,dtype:i}=r,s=ag(o,n,a,i),c=t.makeOutput([s.length],i);return t.typedArrayFromHeap(c).set(s),c},EG={kernelName:bh,backendName:"wasm",kernelFunc:D1e};var F1e=!0,IG=ut(qp,F1e);var TG=we($u);var CG=we(Lu);var NG=we(Wu);var AG;function M1e(e){AG=e.wasm.cwrap(Uu,null,["number","number","number","number","number","number","number","number","number","number"])}function O1e(e){let{backend:t,inputs:r,attrs:o}=e,{images:n}=r,{alignCorners:a,halfPixelCenters:i,size:s}=o,[c,l]=s,[p,u,m,f]=n.shape,d=[p,c,l,f],h=t.dataIdMap.get(n.dataId),y;h.dtype!=="float32"&&(y=mn({backend:t,inputs:{x:n},attrs:{dtype:"float32"}}),h=t.dataIdMap.get(y.dataId));let g=h.id,b=t.makeOutput(d,"float32");if(S.sizeFromShape(n.shape)===0)return b;let x=t.dataIdMap.get(b.dataId).id;return AG(g,p,u,m,f,c,l,a?1:0,i?1:0,x),y!=null&&t.disposeData(y.dataId),b}var RG={kernelName:Uu,backendName:"wasm",setupFunc:M1e,kernelFunc:O1e};var DG;function P1e(e){DG=e.wasm.cwrap(ob,null,["number","number","number","array","array","boolean"])}function z1e(e){let{inputs:t,backend:r,attrs:o}=e,{images:n,dy:a}=t,{alignCorners:i}=o,s=r.makeOutput(n.shape,"float32"),c=r.dataIdMap.get(n.dataId),l;return c.dtype!=="float32"&&(l=mn({backend:r,inputs:{x:n},attrs:{dtype:"float32"}}),c=r.dataIdMap.get(l.dataId)),DG(r.dataIdMap.get(n.dataId).id,r.dataIdMap.get(a.dataId).id,r.dataIdMap.get(s.dataId).id,new Uint8Array(new Int32Array(n.shape).buffer),new Uint8Array(new Int32Array(a.shape).buffer),i),l!=null&&r.disposeData(l.dataId),s}var FG={kernelName:ob,backendName:"wasm",setupFunc:P1e,kernelFunc:z1e};var MG;function $1e(e){MG=e.wasm.cwrap(Bu,null,["number","number","number","number","number","number","number","number","number","number"])}function L1e(e){let{backend:t,inputs:r,attrs:o}=e,{images:n}=r,{alignCorners:a,halfPixelCenters:i,size:s}=o,[c,l]=s,[p,u,m,f]=n.shape,d=[p,c,l,f],h=t.makeOutput(d,"float32");if(S.sizeFromShape(n.shape)===0)return h;let y=t.dataIdMap.get(n.dataId),g;y.dtype!=="float32"&&(g=mn({backend:t,inputs:{x:n},attrs:{dtype:"float32"}}),y=t.dataIdMap.get(g.dataId));let b=y.id,x=t.dataIdMap.get(h.dataId).id;return MG(b,p,u,m,f,c,l,a?1:0,i?1:0,x),g!=null&&t.disposeData(g.dataId),h}var OG={kernelName:Bu,backendName:"wasm",setupFunc:$1e,kernelFunc:L1e};var PG;function B1e(e){PG=e.wasm.cwrap(rb,null,["number","number","number","array","array","boolean"])}function U1e(e){let{inputs:t,backend:r,attrs:o}=e,{images:n,dy:a}=t,{alignCorners:i}=o,s=r.makeOutput(n.shape,"float32"),c=r.dataIdMap.get(n.dataId),l;return c.dtype!=="float32"&&(l=mn({backend:r,inputs:{x:n},attrs:{dtype:"float32"}}),c=r.dataIdMap.get(l.dataId)),PG(r.dataIdMap.get(n.dataId).id,r.dataIdMap.get(a.dataId).id,r.dataIdMap.get(s.dataId).id,new Uint8Array(new Int32Array(n.shape).buffer),new Uint8Array(new Int32Array(a.shape).buffer),i),l!=null&&r.disposeData(l.dataId),s}var zG={kernelName:rb,backendName:"wasm",setupFunc:B1e,kernelFunc:U1e};var $G;function W1e(e){$G=e.wasm.cwrap(Hu,null,["number","array","number","array","number","number"])}function H1e(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,{dims:a}=o,i=S.parseAxisParam(a,n.shape);if(n.shape.length===0)return Pm({inputs:{x:n},backend:r});let s=r.makeOutput(n.shape,n.dtype),c=r.dataIdMap.get(n.dataId).id,l=r.dataIdMap.get(s.dataId).id,p=new Uint8Array(new Int32Array(i).buffer),u=new Uint8Array(new Int32Array(n.shape).buffer);$G(c,p,i.length,u,n.shape.length,l);let m=Fr({inputs:{x:s},attrs:{shape:n.shape},backend:r});return r.disposeData(s.dataId),m}var LG={kernelName:Hu,backendName:"wasm",kernelFunc:H1e,setupFunc:W1e};var BG;function V1e(e){BG=e.wasm.cwrap(fm,null,["number","number","number","number","number","number","number","number","array","number","number"])}function j1e(e){let{inputs:t,backend:r,attrs:o}=e,{image:n}=t,{radians:a,fillValue:i,center:s}=o,c=r.makeOutput(n.shape,n.dtype),l=r.dataIdMap.get(n.dataId).id,p=r.dataIdMap.get(c.dataId).id,[u,m,f,d]=n.shape,[h,y]=M.getImageCenter(s,m,f),g=i===0,b=255,x=typeof i=="number"?[i,i,i,g?0:b]:[...i,b],w=new Uint8Array(new Int32Array(x).buffer);return BG(l,u,m,f,d,a,h,y,w,x.length,p),c}var UG={kernelName:fm,backendName:"wasm",kernelFunc:j1e,setupFunc:V1e};var WG=we(Vu);var HG=we(ju);var VG;function G1e(e){VG=e.wasm.cwrap(Gu,null,["number","number","number","number","number","number","array","number","number"])}function q1e(e){let{backend:t,inputs:r,attrs:o}=e,{indices:n,updates:a}=r,{shape:i}=o,s=t.makeOutput(i,a.dtype);if(S.sizeFromShape(i)===0)return s;let{sliceRank:c,numUpdates:l,sliceSize:p,strides:u,outputSize:m}=oc.calculateShapes(a,n,i),d=t.dataIdMap.get(n.dataId).id,y=t.dataIdMap.get(a.dataId).id,g=new Uint8Array(new Int32Array(u).buffer),b=t.dataIdMap.get(s.dataId).id;return VG(d,y,Ae[a.dtype],c,l,p,g,m,b),s}var jG={kernelName:Gu,backendName:"wasm",setupFunc:G1e,kernelFunc:q1e};var GG;function K1e(e){GG=e.wasm.cwrap(Ku,null,["number","number","number","number","number","number","bool","number"])}function X1e(e){let{inputs:t,backend:r,attrs:o}=e,{sortedSequence:n,values:a}=t,{side:i}=o;if(n.dtype!==a.dtype)throw new Error(`SearchSorted error: sorted_sequence must have the same dtype as values. Got ${n.dtype} and ${a.dtype}`);let s=r.makeOutput(a.shape,"int32");function c(l){return r.dataIdMap.get(l.dataId).id}return GG(c(n),c(a),n.shape[0],n.shape[1],a.shape[1],Ae[n.dtype],i==="left",c(s)),s}var qG={kernelName:Ku,backendName:"wasm",setupFunc:K1e,kernelFunc:X1e};var KG;function Y1e(e){KG=e.wasm.cwrap("SelectV2",null,["number","number","number","number","number"])}function Q1e(e){let{inputs:t,backend:r}=e,{condition:o,t:n,e:a}=t,i=r.dataIdMap.get(o.dataId).id,s=r.dataIdMap.get(n.dataId).id,c=r.dataIdMap.get(a.dataId).id,l=r.makeOutput(n.shape,n.dtype),p=r.dataIdMap.get(l.dataId).id,u=o.shape.length,m=n.shape.length,f=u===0||u>1||m===1?1:S.sizeFromShape(n.shape.slice(1));return KG(i,s,c,f,p),l}var XG={kernelName:wh,backendName:"wasm",kernelFunc:Q1e,setupFunc:Y1e};var YG=we(Xu);var QG;function J1e(e){QG=e.wasm.cwrap(Zu,null,["number","number"])}function Z1e(e){let{backend:t,inputs:{x:r}}=e,o=t.dataIdMap.get(r.dataId).id,n=t.makeOutput(r.shape,r.dtype),a=t.dataIdMap.get(n.dataId).id;return S.sizeFromShape(n.shape)===0||QG(o,a),n}var JG={kernelName:"Sigmoid",backendName:"wasm",setupFunc:J1e,kernelFunc:Z1e};var ZG=we(Ju);var eq=we(Yu);var tq=we(Qu);var rq=we(em);function eSe(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,{blockShape:a,paddings:i}=o,s=S.sizeFromShape(a),c=[[0,0]];c.push(...i);for(let C=1+a.length;C<n.shape.length;++C)c.push([0,0]);let l=Mk.kernelFunc({inputs:{x:n},backend:r,attrs:{paddings:c,constantValue:0}}),p=M.getReshaped(l.shape,a,s,!1),u=M.getPermuted(p.length,a.length,!1),m=M.getReshapedPermuted(l.shape,a,s,!1),h=Fr({inputs:{x:l},backend:r,attrs:{shape:p}}),b=ea({inputs:{x:h},backend:r,attrs:{perm:u}}),I=Fr({inputs:{x:b},backend:r,attrs:{shape:m}});return r.disposeData(l.dataId),r.disposeData(h.dataId),r.disposeData(b.dataId),I}var oq={kernelName:kh,backendName:"wasm",kernelFunc:eSe};var nq;function tSe(e){nq=e.wasm.cwrap("SparseFillEmptyRows","number",["number","number","number","number","number","number","number","number","number","number","number","number"])}function rSe(e){let{backend:t,inputs:r}=e,{indices:o,values:n,denseShape:a,defaultValue:i}=r,s=o.shape[0],c=o.shape[1],l=t.readSync(a.dataId)[0],p=[s+l,c],u=t.dataIdMap.get(o.dataId).id,m=t.dataIdMap.get(n.dataId).id,f=t.dataIdMap.get(i.dataId).id,d=t.makeOutput(p,o.dtype),h=t.dataIdMap.get(d.dataId).id,y=t.makeOutput(p.slice(0,1),n.dtype),g=t.dataIdMap.get(y.dataId).id,b=t.makeOutput([l],"bool"),x=t.dataIdMap.get(b.dataId).id,w=t.makeOutput([s],o.dtype),I=t.dataIdMap.get(w.dataId).id,C=t.makeOutput([4],"int32"),R=t.dataIdMap.get(C.dataId).id,P=nq(u,m,Ae[n.dtype],s,l,c,f,h,g,x,I,R),z=t.readSync(C.dataId),$;switch(z[0]){case 1:{$=M.getSparseFillEmptyRowsIndicesDenseShapeMismatch(z[1]);break}case 2:{$=M.getSparseFillEmptyRowsNegativeIndexErrorMessage(z[1],z[2]);break}case 3:$=M.getSparseFillEmptyRowsOutOfRangeIndexErrorMessage(z[1],z[2],z[3]);break;default:$=""}if(t.disposeData(C.dataId),$)throw t.disposeData(d.dataId),t.disposeData(y.dataId),t.disposeData(b.dataId),t.disposeData(w.dataId),new Error($);let B=d,V=y;return P!==p[0]&&(B=Na({inputs:{x:d},attrs:{begin:0,size:[P,c]},backend:t}),V=Na({inputs:{x:y},attrs:{begin:0,size:P},backend:t}),t.disposeData(d.dataId),t.disposeData(y.dataId)),[B,V,b,w]}var aq={kernelName:Eh,backendName:"wasm",setupFunc:tSe,kernelFunc:rSe};var iq;function oSe(e){iq=e.wasm.cwrap(nm,null,["number","number","number","number","number","number","number"])}function nSe(e){let{backend:t,inputs:r}=e,{inputIndices:o,inputShape:n,newShape:a}=r;if(o.shape.length!==2)throw new Error(`Input indices should be a matrix but received shape
132
+ ${o.shape}`);if(n.shape.length!==1)throw new Error(`Input shape should be a vector but received shape
133
+ ${n.shape}`);if(a.shape.length!==1)throw new Error(`Target shape should be a vector but received shape ${a.shape}`);let i=t.dataIdMap.get(o.dataId).id,s=t.dataIdMap.get(n.dataId).id,c=t.dataIdMap.get(a.dataId).id,l=o.shape[0],p=S.sizeFromShape(a.shape),u=t.makeOutput([l,p],o.dtype),m=t.dataIdMap.get(u.dataId).id,f=t.makeOutput([p],a.dtype),d=t.dataIdMap.get(f.dataId).id,h=t.makeOutput([3],"int32"),y=t.dataIdMap.get(h.dataId).id;iq(i,s,c,l,m,d,y);let g=t.readSync(h.dataId),b;switch(g[0]){case 0:{b=M.getSparseReshapeMultipleNegativeOneOutputDimErrorMessage(g[1],g[2]);break}case 1:{b=M.getSparseReshapeNegativeOutputDimErrorMessage(g[1],g[2]);break}case 2:b=M.getSparseReshapeEmptyTensorZeroOutputDimErrorMessage();break;case 3:{let x=Array.from(t.readSync(n.dataId)),w=Array.from(t.readSync(f.dataId));b=M.getSparseReshapeInputOutputMultipleErrorMessage(x,w);break}case 4:{let x=Array.from(t.readSync(n.dataId)),w=Array.from(t.readSync(f.dataId));b=M.getSparseReshapeInputOutputMismatchErrorMessage(x,w);break}default:b=""}if(t.disposeData(h.dataId),b)throw t.disposeData(u.dataId),t.disposeData(f.dataId),new Error(b);return[u,f]}var sq={kernelName:nm,backendName:"wasm",setupFunc:oSe,kernelFunc:nSe};var lq;function Ok(e){lq=e.wasm.cwrap("SparseSegmentReduction",null,["number","number","number","number","number","number","number","number","number"])}function Pk(e,t){let{backend:r,inputs:o}=e,{data:n,indices:a,segmentIds:i}=o,s=a.shape[0],c=r.readSync(i.dataId,s-1,s)[0],p=s>0?c+1:0;if(p<0)throw new Error(M.getSparseSegmentReductionNegativeSegmentIdsErrorMessage());let u=n.shape.slice();u[0]=p;let m=r.dataIdMap.get(n.dataId).id,f=r.dataIdMap.get(a.dataId).id,d=r.dataIdMap.get(i.dataId).id,h=r.makeOutput(u,n.dtype),y=r.dataIdMap.get(h.dataId).id,g=r.makeOutput([4],"int32"),b=r.dataIdMap.get(g.dataId).id;lq(m,Ae[n.dtype],n.shape[0],f,d,y,b,t,0);let x=r.readSync(g.dataId),w;switch(x[0]){case 0:{w=M.getSparseSegmentReductionNegativeSegmentIdsErrorMessage();break}case 1:{w=M.getSparseSegmentReductionNonIncreasingSegmentIdsErrorMessage();break}case 2:w=M.getSparseSegmentReductionSegmentIdOutOfRangeErrorMessage(x[1],x[2]);break;case 3:w=M.getSparseSegmentReductionIndicesOutOfRangeErrorMessage(x[1],x[2],x[3]);break;default:w=""}if(r.disposeData(g.dataId),w)throw r.disposeData(h.dataId),new Error(w);return h}function aSe(e){return Pk(e,!0)}var cq={kernelName:Ih,backendName:"wasm",setupFunc:Ok,kernelFunc:aSe};function iSe(e){return Pk(e,!1)}var pq={kernelName:Th,backendName:"wasm",setupFunc:Ok,kernelFunc:iSe};var uq;function sSe(e){uq=e.wasm.cwrap(am,null,["number","number","number","number","number","number","number","number","array","number","number"])}function lSe(e){let{backend:t,inputs:r,attrs:o}=e,{sparseIndices:n,sparseValues:a,defaultValue:i}=r,{outputShape:s}=o,c=t.makeOutput(s,i.dtype);if(S.sizeFromShape(s)===0)return c;let{sliceRank:l,numUpdates:p,sliceSize:u,strides:m,outputSize:f}=M.calculateShapes(a,n,s),d=t.dataIdMap.get(n.dataId).id,h=t.dataIdMap.get(a.dataId).id,y=t.dataIdMap.get(i.dataId).id,g=new Uint8Array(new Int32Array(m).buffer),b=t.dataIdMap.get(c.dataId).id;return uq(d,h,a.shape.length,y,Ae[i.dtype],l,p,u,g,f,b),c}var mq={kernelName:am,backendName:"wasm",setupFunc:sSe,kernelFunc:lSe};function cSe(e){let{inputs:t,attrs:r,backend:o}=e,{x:n}=t,{numOrSizeSplits:a,axis:i}=r,s=S.parseAxisParam(i,n.shape)[0],c=M.prepareSplitSize(n,a,s),l=new Array(n.shape.length).fill(0),p=n.shape.slice();return c.map(u=>{let m=[...p];m[s]=u;let f=Na({inputs:{x:n},attrs:{begin:l,size:m},backend:o});return l[s]+=u,f})}var fq={kernelName:_h,backendName:"wasm",kernelFunc:cSe};var dq=we(tm);var hq=we(B1);var pSe=!0,gq=ut(im,pSe);var yq;function uSe(e){yq=e.wasm.cwrap(Wl,null,["number","number","number","number"])}function mSe(e){let{backend:t,inputs:r,attrs:o}=e,{alpha:n}=o,{x:a}=r,i=t.dataIdMap.get(a.dataId).id,s=t.makeOutput(a.shape,a.dtype),c=t.dataIdMap.get(s.dataId).id;return yq(i,n,Ae[a.dtype],c),s}var vq={kernelName:Wl,backendName:"wasm",setupFunc:uSe,kernelFunc:mSe};var bq;function fSe(e){bq=e.wasm.cwrap(sm,null,["number","array","number","array","array","array","array","array","number","number"])}function dSe(e){let{backend:t,inputs:r,attrs:o}=e,{x:n}=r,{begin:a,end:i,strides:s,beginMask:c,endMask:l,ellipsisMask:p,newAxisMask:u,shrinkAxisMask:m}=o,{finalShapeSparse:f,finalShape:d,isIdentity:h,sliceDim0:y,isSimpleSlice:g,begin:b,end:x,strides:w}=co.sliceInfo(n.shape,a,i,s,c,l,p,u,m),I;if(h)I=Fr({inputs:{x:n},backend:t,attrs:{shape:d}});else if(y||g){S.assert(n.shape.length>=1,()=>`Input must have rank at least 1, got: ${n.shape.length}`);let C=co.computeOutShape(b,x,w),R=Na({inputs:{x:n},backend:t,attrs:{begin:b,size:C}});I=Fr({inputs:{x:R},backend:t,attrs:{shape:d}}),t.disposeData(R.dataId)}else{let C=t.makeOutput(f,"float32"),R=t.dataIdMap.get(n.dataId).id,P=new Uint8Array(new Int32Array(S.computeStrides(n.shape)).buffer),z=new Uint8Array(new Int32Array(b).buffer),$=new Uint8Array(new Int32Array(x).buffer),B=new Uint8Array(new Int32Array(w).buffer),V=new Uint8Array(new Int32Array(f).buffer),H=new Uint8Array(new Int32Array(S.computeStrides(f)).buffer),G=t.dataIdMap.get(C.dataId).id;bq(R,P,n.shape.length,z,$,B,V,H,f.length,G),I=Fr({inputs:{x:C},backend:t,attrs:{shape:d}}),t.disposeData(C.dataId)}return I}var xq={kernelName:sm,backendName:"wasm",setupFunc:fSe,kernelFunc:dSe};function hSe(e){let{backend:t,inputs:r,attrs:o}=e,{data:n,dataSplits:a}=r,{separator:i,nGramWidths:s,leftPad:c,rightPad:l,padWidth:p,preserveShortSequences:u}=o,m=t.readSync(n.dataId),f=t.readSync(a.dataId),[d,h]=sg(m,f,i,s,c,l,p,u),y=t.makeOutput([d.length],"string"),g=t.dataIdMap.get(y.dataId);g.stringBytes=d;let b=t.makeOutput(a.shape,"int32");return t.typedArrayFromHeap(b).set(h),[y,b]}var wq={kernelName:Ch,backendName:"wasm",kernelFunc:hSe};function gSe(e){let{backend:t,inputs:r,attrs:o}=e,{input:n,delimiter:a}=r,{skipEmpty:i}=o,s=t.readSync(n.dataId),c=t.readSync(a.dataId),[l,p,u]=lg(s,c[0],i),m=p.length,f=t.makeOutput([m,2],"int32");t.typedArrayFromHeap(f).set(l);let h=t.makeOutput([m],"string"),y=t.dataIdMap.get(h.dataId);y.stringBytes=p;let g=t.makeOutput([2],"int32");return t.typedArrayFromHeap(g).set(u),[f,h,g]}var Sq={kernelName:Nh,backendName:"wasm",kernelFunc:gSe};function ySe(e){let{backend:t,inputs:r,attrs:o}=e,{input:n}=r,{numBuckets:a}=o,i=t.readSync(n.dataId),s=cg(i,a),c=t.makeOutput(n.shape,"int32");return t.typedArrayFromHeap(c).set(s),c}var kq={kernelName:Ah,backendName:"wasm",kernelFunc:ySe};var vSe=!0,_q=ut(lm,vSe);var Eq;function bSe(e){Eq=e.wasm.cwrap(rm,null,["number","number","number","number"])}function xSe(e){let{backend:t,inputs:r,attrs:o}=e,{axis:n,keepDims:a}=o,{x:i}=r,s=t.dataIdMap.get(i.dataId).id,c=s,l=i,{transposed:p,axes:u,originalAxes:m,inputWasTransposed:f}=Ho(i,n,t),d=u;if(f){let x=t.dataIdMap.get(p.dataId).id;x!==s&&(l=p,c=x,d=M.getInnerMostAxes(d.length,l.shape.length))}M.assertAxesAreInnerMostDims("sum",d,l.shape.length);let[h,y]=M.computeOutAndReduceShapes(l.shape,d),g=S.sizeFromShape(y),b=t.makeOutput(h,l.dtype);if(S.sizeFromShape(l.shape)!==0){let x=t.dataIdMap.get(b.dataId).id;Eq(c,g,Ae[b.dtype],x)}if(f&&t.disposeData(p.dataId),a){let x=M.expandShapeToKeepDim(b.shape,m);b.shape=x}return b}var Iq={kernelName:rm,backendName:"wasm",setupFunc:bSe,kernelFunc:xSe};var Tq=we(cm);var Cq=we(pm);var Nq;function wSe(e){Nq=e.wasm.cwrap(qu,null,["number","number","number","number","number","number","array","number","number","number"])}function SSe(e){let{backend:t,inputs:r,attrs:o}=e,{tensor:n,indices:a,updates:i}=r,{}=o,s=t.makeOutput(n.shape,n.dtype);if(S.sizeFromShape(n.shape)===0)return s;let{sliceRank:c,numUpdates:l,sliceSize:p,strides:u,outputSize:m}=oc.calculateShapes(i,a,n.shape),d=t.dataIdMap.get(a.dataId).id,y=t.dataIdMap.get(i.dataId).id,b=t.dataIdMap.get(n.dataId).id,x=new Uint8Array(new Int32Array(u).buffer),w=t.dataIdMap.get(s.dataId).id;return Nq(d,y,Ae[i.dtype],c,l,p,x,m,w,b),s}var Aq={kernelName:qu,backendName:"wasm",setupFunc:wSe,kernelFunc:SSe};var Rq;function kSe(e){Rq=e.wasm.cwrap(Ts,null,["number","array","number","array","number","number"])}function _Se(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,a=r.dataIdMap.get(n.dataId).id,{reps:i}=o,s=new Array(n.shape.length);for(let m=0;m<s.length;m++)s[m]=n.shape[m]*i[m];let c=new Uint8Array(new Int32Array(n.shape).buffer),l=new Uint8Array(new Int32Array(s).buffer),p=r.makeOutput(s,n.dtype),u=r.dataIdMap.get(p.dataId).id;return Rq(a,c,n.shape.length,l,s.length,Ae[p.dtype],u),p}var Dq={kernelName:Ts,backendName:"wasm",setupFunc:kSe,kernelFunc:_Se};var Fq;function ESe(e){Fq=e.wasm.cwrap(um,null,["number","array","number","number","number","bool","number","number"])}var ISe=({inputs:e,backend:t,attrs:r})=>{let{x:o}=e,{k:n,sorted:a}=r,i=t.dataIdMap.get(o.dataId).id,s=new Uint8Array(new Int32Array(o.shape).buffer),c=o.shape.slice();c[c.length-1]=n;let l=t.makeOutput(c,o.dtype),p=t.dataIdMap.get(l.dataId).id,u=t.makeOutput(c,"int32"),m=t.dataIdMap.get(u.dataId).id;return Fq(i,s,o.shape.length,Ae[o.dtype],n,a,p,m),[l,u]},Mq={kernelName:um,backendName:"wasm",setupFunc:ESe,kernelFunc:ISe};var Oq;function TSe(e){Oq=e.wasm.cwrap(mm,null,["number","number","bool","number","number","number","number","number","number","array","number","array","number","number","number","number","number"])}function CSe(e){let{backend:t,inputs:r,attrs:o}=e,{image:n,transforms:a}=r,{interpolation:i,fillMode:s,fillValue:c,outputShape:l}=o,[p,u,m,f]=n.shape,[d,h]=l??[u,m],y=[p,d,h,f],g=new Uint8Array(new Int32Array(S.computeStrides(n.shape)).buffer),b=new Uint8Array(new Int32Array(S.computeStrides(y)).buffer),x=t.makeOutput(y,n.dtype),w=t.dataIdMap.get(x.dataId).id,C=t.dataIdMap.get(n.dataId).id,P=t.dataIdMap.get(a.dataId).id,z=i==="nearest"?1:2,$;switch(s){case"constant":$=1;break;case"reflect":$=2;break;case"wrap":$=3;break;case"nearest":$=4;break;default:$=1;break}return Oq(C,P,a.shape[0]>1,p,d,h,f,m,u,g,n.shape.length-1,b,y.length-1,z,$,c,w),x}var Pq={kernelName:mm,backendName:"wasm",setupFunc:TSe,kernelFunc:CSe};function NSe(e){let{inputs:t,attrs:r,backend:o}=e,{axis:n}=r,{x:a}=t,{outputValues:i,outputShape:s,indices:c}=pg(o.readSync(a.dataId),n,a.shape,a.dtype);return[o.makeOutput(s,a.dtype,void 0,i),o.makeOutput([c.length],"int32",void 0,c)]}var zq={kernelName:Rh,backendName:"wasm",kernelFunc:NSe};function ASe(e){let{inputs:t,backend:r,attrs:o}=e,{value:n}=t,{axis:a}=o;a<0&&(a+=n.shape.length);let i=n.shape[a],s=n.shape.length,c=new Array(s-1),l=0;for(let f=0;f<s;f++)f!==a&&(c[l++]=n.shape[f]);let p=new Array(i),u=new Array(s).fill(0),m=n.shape.slice();m[a]=1;for(let f=0;f<p.length;f++)u[a]=f,p[f]=Na({inputs:{x:n},attrs:{begin:u,size:m},backend:r});return p.map(({dataId:f,dtype:d})=>({dataId:f,dtype:d,shape:c}))}var $q={kernelName:Dh,backendName:"wasm",kernelFunc:ASe};function RSe(e){let{inputs:{x:t},backend:r}=e,o=r.makeOutput(t.shape,t.dtype);return r.typedArrayFromHeap(o).fill(0),o}var Lq={kernelName:Fh,backendName:"wasm",kernelFunc:RSe};var DSe=[CW,NW,AW,RW,DW,MW,LW,UW,WW,HW,VW,jW,GW,qW,KW,YW,rH,JW,eH,aH,oV,aV,iV,sV,lV,cV,uV,mV,dV,gV,vV,xV,SV,kV,_V,IV,CV,AV,DV,MV,PV,$V,BV,WV,VV,jV,qV,KV,XV,YV,QV,JV,ZV,tj,rj,oj,aj,sj,cj,uj,fj,dj,hj,OW,gj,yj,vj,xj,wj,Sj,_j,Ij,Ej,Tj,Cj,Nj,Aj,Dj,Mj,Pj,zj,Lj,Uj,Hj,jj,qj,Xj,Qj,Jj,eG,nG,aG,iG,sG,cG,uG,fG,dG,gG,yG,vG,Mk,xG,SG,_G,EG,IG,TG,CG,NG,oH,RG,FG,OG,zG,LG,UG,WG,HG,jG,qG,XG,YG,JG,ZG,eq,tq,rV,rG,rq,oq,aq,sq,cq,pq,mq,fq,dq,hq,gq,vq,xq,wq,Sq,kq,_q,Iq,Tq,Cq,Aq,Dq,Mq,Pq,zW,zq,$q,Lq];for(let e of DSe)H1(e);var ZA=Ne();ZA.registerFlag("WASM_HAS_SIMD_SUPPORT",async()=>{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,9,1,7,0,65,0,253,15,26,11]))}catch{return!1}});ZA.registerFlag("WASM_HAS_MULTITHREAD_SUPPORT",async()=>{if(ZA.get("IS_NODE"))return!1;try{return 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}});var sR=Ie(Hq()),Xq=Ie(jq()),lR=Ie(Gq());var qq=sR.default||sR,FSe=lR.default||lR,Fb=class extends _s{constructor(t){super(),this.wasm=t,this.dataIdNextNumber=1,this.wasm.tfjs.initWithThreadsCount(zSe),$Se=this.wasm.tfjs.getThreadsCount(),this.dataIdMap=new gp(this,ub())}write(t,r,o){let n={id:this.dataIdNextNumber++};return this.move(n,t,r,o,1),n}numDataIds(){return this.dataIdMap.numDataIds()}async time(t){let r=S.now();return t(),{kernelMs:S.now()-r}}move(t,r,o,n,a){let i=this.dataIdNextNumber++;if(n==="string"){let p=r;this.dataIdMap.set(t,{id:i,stringBytes:p,shape:o,dtype:n,memoryOffset:null,refCount:a});return}let s=S.sizeFromShape(o),c=s*S.bytesPerElement(n),l=this.wasm._malloc(c)>>>0;this.dataIdMap.set(t,{id:i,memoryOffset:l,shape:o,dtype:n,refCount:a}),this.wasm.tfjs.registerTensor(i,s,l),r!=null&&this.wasm.HEAPU8.set(new Uint8Array(r.buffer,r.byteOffset,c),l)}async read(t){return this.readSync(t)}readSync(t,r,o){let{memoryOffset:n,dtype:a,shape:i,stringBytes:s}=this.dataIdMap.get(t);if(a==="string")return(r==null||r===0)&&(o==null||o>=s.length)?s:s.slice(r,o);r=r||0,o=o||S.sizeFromShape(i);let c=S.bytesPerElement(a),l=this.wasm.HEAPU8.slice(n+r*c,n+o*c);return OSe(l.buffer,a)}disposeData(t,r=!1){if(this.dataIdMap.has(t)){let o=this.dataIdMap.get(t);if(o.refCount--,!r&&o.refCount>0)return!1;this.wasm._free(o.memoryOffset),this.wasm.tfjs.disposeData(o.id),this.dataIdMap.delete(t)}return!0}refCount(t){return this.dataIdMap.has(t)?this.dataIdMap.get(t).refCount:0}incRef(t){let r=this.dataIdMap.get(t);r!=null&&r.refCount++}floatPrecision(){return 32}getMemoryOffset(t){return this.dataIdMap.get(t).memoryOffset}dispose(){this.wasm.tfjs.dispose(),"PThread"in this.wasm&&this.wasm.PThread.terminateAllThreads(),this.wasm=null}memory(){return{unreliable:!1}}makeOutput(t,r,o,n){let a;if(o==null)a=this.write(n??null,t,r);else{let i=this.dataIdNextNumber++;a={id:i},this.dataIdMap.set(a,{id:i,memoryOffset:o,shape:t,dtype:r,refCount:1});let s=S.sizeFromShape(t);this.wasm.tfjs.registerTensor(i,s,o)}return{dataId:a,shape:t,dtype:r}}typedArrayFromHeap({shape:t,dtype:r,dataId:o}){let n=this.wasm.HEAPU8.buffer,{memoryOffset:a}=this.dataIdMap.get(o),i=S.sizeFromShape(t);switch(r){case"float32":return new Float32Array(n,a,i);case"int32":return new Int32Array(n,a,i);case"bool":return new Uint8Array(n,a,i);default:throw new Error(`Unknown dtype ${r}`)}}};function MSe(e){return(t,r)=>(S.fetch(e,{credentials:"same-origin"}).then(o=>{o.ok||t.env.a(`failed to load wasm binary file at '${e}'`),o.arrayBuffer().then(n=>{WebAssembly.instantiate(n,t).then(a=>{r(a.instance,a.module)})})}),{})}function Kq(e,t,r){if(iR!=null)return iR;let o="tfjs-backend-wasm.wasm";return e&&t?o="tfjs-backend-wasm-threaded-simd.wasm":e&&(o="tfjs-backend-wasm-simd.wasm"),Db!=null&&Db[o]!=null?Db[o]:r+o}async function Yq(){let[e,t]=await Promise.all([Ne().getAsync("WASM_HAS_SIMD_SUPPORT"),Ne().getAsync("WASM_HAS_MULTITHREAD_SUPPORT")]);return new Promise((r,o)=>{let n={};n.locateFile=(s,c)=>{if(s.endsWith(".worker.js")){let l=Xq.wasmWorkerContents.replace(/\n/g,"\\n"),p=new Blob([l],{type:"application/javascript"});return URL.createObjectURL(p)}return s.endsWith(".wasm")?Kq(e,t,Rb??c):c+s},Qq&&(n.instantiateWasm=MSe(Kq(e,t,Rb??"")));let a=!1;n.onAbort=()=>{if(a||Lk)return;Lk=!0,o({message:"Make sure the server can serve the `.wasm` file relative to the bundled js file. For more details see https://github.com/tensorflow/tfjs/blob/master/tfjs-backend-wasm/README.md#using-bundlers"})};let i;t&&e&&iR==null?(n.mainScriptUrlOrBlob=new Blob(["var WasmBackendModuleThreadedSimd = "+qq.toString()],{type:"text/javascript"}),i=qq(n)):i=FSe(n),i.then(s=>{a=!0,Lk=!1;let c=null;s.tfjs={init:s.cwrap("init",null,[]),initWithThreadsCount:s.cwrap("init_with_threads_count",null,["number"]),getThreadsCount:s.cwrap("get_threads_count","number",[]),registerTensor:s.cwrap("register_tensor",null,["number","number","number"]),disposeData:s.cwrap("dispose_data",c,["number"]),dispose:s.cwrap("dispose",c,[])},r({wasm:s})}).catch(o)})}function OSe(e,t){switch(t){case"float32":return new Float32Array(e);case"int32":return new Int32Array(e);case"bool":return new Uint8Array(e);default:throw new Error(`Unknown dtype ${t}`)}}var PSe=["tfjs-backend-wasm.wasm","tfjs-backend-wasm-simd.wasm","tfjs-backend-wasm-threaded-simd.wasm"],iR=null,Rb=null,Db={},Lk=!1,Qq=!1;function cR(e,t=!1){if(Lk)throw new Error("The WASM backend was already initialized. Make sure you call `setWasmPaths()` before you call `tf.setBackend()` or `tf.ready()`");if(typeof e=="string")Rb=e;else{Db=e;let r=PSe.filter(o=>Db[o]==null);if(r.length>0)throw new Error(`There were no entries found for the following binaries: ${r.join(",")}. Please either call setWasmPaths with a map providing a path for each binary, or with a string indicating the directory where all the binaries can be found.`)}Qq=t}var zSe=-1,$Se=-1;var pR="4.11.0";var LSe=2;sS("wasm",async()=>{let{wasm:e}=await Yq();return new Fb(e)},LSe);var BSe=Wi.whereImpl,Mb=class e extends _s{nextDataId(){return e.nextDataId++}constructor(){super(),this.blockSize=48,this.firstUse=!0,this.data=new gp(this,ub())}write(t,r,o){this.firstUse&&(this.firstUse=!1,Ne().get("IS_NODE")&&M.warn(`
134
+ ============================
135
+ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dramatically, install our node backend, visit https://github.com/tensorflow/tfjs-node for more details.
136
+ ============================`));let n={id:this.nextDataId()};return this.data.set(n,{values:t,dtype:o,refCount:1}),n}makeTensorInfo(t,r,o){let n;if(r==="string"&&o!=null&&o.length>0&&S.isString(o[0])){let a=o.map(i=>S.encodeString(i));n=this.write(a,t,r)}else n=this.write(o,t,r);return{dataId:n,shape:t,dtype:r}}refCount(t){return this.data.has(t)?this.data.get(t).refCount:0}incRef(t){let r=this.data.get(t);r.refCount++}decRef(t){if(this.data.has(t)){let r=this.data.get(t);r.refCount--}}move(t,r,o,n,a){this.data.set(t,{values:r,dtype:n,refCount:a})}numDataIds(){return this.data.numDataIds()}async read(t){return this.readSync(t)}readSync(t){let{dtype:r,complexTensorInfos:o}=this.data.get(t);if(r==="complex64"){let n=this.readSync(o.real.dataId),a=this.readSync(o.imag.dataId);return M.mergeRealAndImagArrays(n,a)}return S.convertBackendValuesAndArrayBuffer(this.data.get(t).values,r)}bufferSync(t){let r=this.readSync(t.dataId);if(t.dtype==="string")try{let o=r.map(n=>S.decodeString(n));return Re(t.shape,t.dtype,o)}catch{throw new Error("Failed to decode encoded string bytes into utf-8")}return Re(t.shape,t.dtype,r)}makeOutput(t,r,o){return ub().makeTensorFromTensorInfo(this.makeTensorInfo(r,o,t),this)}disposeData(t,r=!1){if(this.data.has(t)){if(this.data.get(t).refCount--,!r&&this.data.get(t).refCount>0)return!1;let{complexTensorInfos:o}=this.data.get(t);o!=null&&(this.disposeData(o.real.dataId,!0),this.disposeData(o.imag.dataId,!0)),this.data.delete(t)}return!0}disposeIntermediateTensorInfo(t){this.disposeData(t.dataId)}async time(t){let r=S.now();return t(),{kernelMs:S.now()-r}}memory(){return{unreliable:!0,reasons:["The reported memory is an upper bound. Due to automatic garbage collection, the true allocated memory may be less."]}}where(t){ne([t],"where");let r=this.readSync(t.dataId);return BSe(t.shape,r)}dispose(){}floatPrecision(){return 32}epsilon(){return super.epsilon()}};Mb.nextDataId=0;sS("cpu",()=>new Mb,1);var uR=Oe(Kp,e=>e>=0?e:Math.exp(e)-1),Jq={kernelName:Kp,backendName:"cpu",kernelFunc:uR};function mR(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,{alpha:a}=o;ne([n],"leakyRelu");let i=S.sizeFromShape(n.shape),s=r.data.get(n.dataId).values,c=S.getTypedArrayFromDType("float32",i);for(let l=0;l<s.length;l++)c[l]=s[l]<0?a*s[l]:s[l];return r.makeTensorInfo(n.shape,"float32",c)}var Zq={kernelName:cu,backendName:"cpu",kernelFunc:mR};var USe=it((e,t)=>e<0?t*e:e);function fR(e){let{inputs:t,backend:r}=e,{x:o,alpha:n}=t;ne([o,n],"prelu");let a=r.data.get(o.dataId).values,i=r.data.get(n.dataId).values,[s,c]=USe(o.shape,n.shape,a,i,"float32");return r.makeTensorInfo(c,"float32",s)}var eK={kernelName:Pu,backendName:"cpu",kernelFunc:fR};var dR=Oe(Lu,e=>Math.max(0,e)),tK={kernelName:Lu,backendName:"cpu",kernelFunc:dR};var hR=Oe(Wu,e=>Math.min(Math.max(0,e),6)),rK={kernelName:Wu,backendName:"cpu",kernelFunc:hR};function $m(e,t,r,o,n){if(r==="linear")return xo({inputs:{x:t},backend:e});if(r==="relu")return dR({inputs:{x:t},backend:e});if(r==="elu")return uR({inputs:{x:t},backend:e});if(r==="relu6")return hR({inputs:{x:t},backend:e});if(r==="prelu")return fR({inputs:{x:t,alpha:o},backend:e});if(r==="leakyrelu")return mR({inputs:{x:t},backend:e,attrs:{alpha:n}});if(r==="sigmoid")return GA({inputs:{x:t},backend:e});throw new Error(`Activation ${r} has not been implemented for the CPU backend.`)}function st(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,{shape:a}=o,i=S.sizeFromShape(n.shape),s=S.inferFromImplicitShape(a,i),c=S.sizeFromShape(s);S.assert(i===c,()=>`The new shape (${s}) has ${c} elements and the old shape (${n.shape}) has ${i} elements. The new shape and old shape must have the same number of elements.`),r.incRef(n.dataId);let l=r.data.get(n.dataId);if(l.complexTensorInfos!=null){let p=l.complexTensorInfos.real,u=l.complexTensorInfos.imag;p.shape=s,u.shape=s}return{dataId:n.dataId,shape:s,dtype:n.dtype}}var oK={kernelName:xh,backendName:"cpu",kernelFunc:st};function gR(e){let{inputs:t,backend:r,attrs:o}=e,{a:n,b:a}=t,{transposeA:i,transposeB:s}=o;ne([n,a],"matMul");let c=n.shape.length,l=a.shape.length,p=i?n.shape[c-2]:n.shape[c-1],u=s?a.shape[l-1]:a.shape[l-2],m=i?n.shape[c-1]:n.shape[c-2],f=s?a.shape[l-2]:a.shape[l-1],d=n.shape.slice(0,-2),h=a.shape.slice(0,-2),y=S.sizeFromShape(d),g=S.sizeFromShape(h),x=ka.assertAndGetBroadcastShape(n.shape.slice(0,-2),a.shape.slice(0,-2)).concat([m,f]);S.assert(p===u,()=>`Error in matMul: inner shapes (${p}) and (${u}) of Tensors with shapes ${n.shape} and ${a.shape} and transposeA=${i} and transposeB=${s} must match.`);let w=i?[y,p,m]:[y,m,p],I=s?[g,f,u]:[g,u,f],C=st({inputs:{x:n},backend:r,attrs:{shape:w}}),R=st({inputs:{x:a},backend:r,attrs:{shape:I}}),P=i?C.shape[1]:C.shape[2],z=i?C.shape[2]:C.shape[1],$=s?R.shape[1]:R.shape[2],B=Math.max(y,g),V=r.data.get(C.dataId).values,H=r.data.get(R.dataId).values,G=S.computeStrides(C.shape),X=S.computeStrides(R.shape),[ee,Z,te]=i?[G[0],1,G[1]]:[G[0],G[1],1],[re,se,ae]=s?[1,X[1],X[0]]:[X[1],1,X[0]],pe=z*$,ie=Re([B,z,$],C.dtype),Y=ie.values,le=r.blockSize;for(let ge=0;ge<B;ge++){let ve=ge%y,Ee=ge%g;for(let Se=0;Se<z;Se+=le){let Ve=Math.min(Se+le,z);for(let Ge=0;Ge<$;Ge+=le){let Ye=Math.min(Ge+le,$);for(let Ze=0;Ze<P;Ze+=le){let Je=Math.min(Ze+le,P);for(let yt=Se;yt<Ve;yt++)for(let lt=Ge;lt<Ye;lt++){let Nt=0;for(let St=Ze;St<Je;St++){let zt=V[ve*ee+yt*Z+St*te],Lt=H[St*re+lt*se+Ee*ae];Nt+=zt*Lt}Y[ge*pe+(yt*$+lt)]+=Nt}}}}}return r.disposeIntermediateTensorInfo(C),r.disposeIntermediateTensorInfo(R),r.makeTensorInfo(x,ie.dtype,ie.values)}var nK={kernelName:Rp,backendName:"cpu",kernelFunc:gR};function WSe(e){let{inputs:t,backend:r,attrs:o}=e,{a:n,b:a,bias:i,preluActivationWeights:s}=t,{transposeA:c,transposeB:l,activation:p,leakyreluAlpha:u}=o,m,f,d,h=[];m=gR({inputs:{a:n,b:a},attrs:{transposeA:c,transposeB:l},backend:r}),i&&(f=Hi({inputs:{a:m,b:i},backend:r}),h.push(m),m=f),p&&(d=$m(r,m,p,s,u),h.push(m),m=d);for(let g of h)r.disposeIntermediateTensorInfo(g);return m}var aK={kernelName:Hl,backendName:"cpu",kernelFunc:WSe};var HSe=Oe(xp,e=>Math.acos(e)),iK={kernelName:xp,backendName:"cpu",kernelFunc:HSe};var VSe=Oe(wp,e=>Math.acosh(e)),sK={kernelName:wp,backendName:"cpu",kernelFunc:VSe};function jSe(e){let{inputs:t,backend:r}=e,o=t;ne(t,"addN");let n=o.map(s=>r.data.get(s.dataId).values),a=Re(o[0].shape,o[0].dtype),i=a.values;for(let s=0;s<o.length;s++){let c=n[s];for(let l=0;l<i.length;l++)i[l]+=c[l]}return r.makeTensorInfo(a.shape,a.dtype,a.values)}var lK={kernelName:Sp,backendName:"cpu",kernelFunc:jSe};function GSe(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,{axis:a,keepDims:i}=o;ne(n,"all");let s=S.parseAxisParam(a,n.shape),c=s,l=M.getAxesPermutation(c,n.shape.length),p=n;l!=null&&(p=ar({inputs:{x:n},backend:r,attrs:{perm:l}}),c=M.getInnerMostAxes(c.length,n.shape.length)),M.assertAxesAreInnerMostDims("all",c,p.shape.length);let[u,m]=M.computeOutAndReduceShapes(p.shape,c),f=S.sizeFromShape(m),d=S.makeZerosTypedArray(S.sizeFromShape(u),p.dtype),h=r.data.get(p.dataId).values;for(let g=0;g<d.length;++g){let b=g*f,x=h[b];for(let w=0;w<f;++w){let I=h[b+w];x=x&&I}d[g]=x}l!=null&&r.disposeIntermediateTensorInfo(p);let y=r.makeTensorInfo(u,p.dtype,d);if(i){let g=M.expandShapeToKeepDim(u,s),b=st({inputs:{x:y},backend:r,attrs:{shape:g}});return r.disposeIntermediateTensorInfo(y),b}return y}var cK={kernelName:kp,backendName:"cpu",kernelFunc:GSe};function qSe(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,{axis:a,keepDims:i}=o;ne(n,"any");let s=S.parseAxisParam(a,n.shape),c=s,l=M.getAxesPermutation(c,n.shape.length),p=n;l!=null&&(p=ar({inputs:{x:n},backend:r,attrs:{perm:l}}),c=M.getInnerMostAxes(c.length,n.shape.length)),M.assertAxesAreInnerMostDims("any",c,p.shape.length);let[u,m]=M.computeOutAndReduceShapes(p.shape,c),f=S.sizeFromShape(m),d=S.makeZerosTypedArray(S.sizeFromShape(u),p.dtype),h=r.data.get(p.dataId).values;for(let g=0;g<d.length;++g){let b=g*f,x=h[b];for(let w=0;w<f;++w){let I=h[b+w];x=x||I}d[g]=x}l!=null&&r.disposeIntermediateTensorInfo(p);let y=r.makeTensorInfo(u,p.dtype,d);if(i){let g=M.expandShapeToKeepDim(u,s),b=st({inputs:{x:y},backend:r,attrs:{shape:g}});return r.disposeIntermediateTensorInfo(y),b}return y}var pK={kernelName:_p,backendName:"cpu",kernelFunc:qSe};function KSe(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,{axis:a}=o;ne(n,"argMax");let i=S.parseAxisParam(a,n.shape),s=M.getAxesPermutation(i,n.shape.length),c=n,l=[];s!=null&&(c=ar({inputs:{x:n},backend:r,attrs:{perm:s}}),l.push(c),i=M.getInnerMostAxes(i.length,c.shape.length)),i=[i[0]],M.assertAxesAreInnerMostDims("argMax",i,c.shape.length);let[p,u]=M.computeOutAndReduceShapes(c.shape,i),m=S.sizeFromShape(p),f=S.makeZerosTypedArray(m,"int32"),d=S.sizeFromShape(u),h=r.data.get(c.dataId).values;for(let y=0;y<f.length;++y){let g=y*d,b=h[g],x=0;for(let w=0;w<d;++w){let I=h[g+w];I>b&&(b=I,x=w)}f[y]=x}return l.forEach(y=>r.disposeIntermediateTensorInfo(y)),r.makeTensorInfo(p,"int32",f)}var uK={kernelName:th,backendName:"cpu",kernelFunc:KSe};function XSe(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,{axis:a}=o;ne(n,"argMin");let i=S.parseAxisParam(a,n.shape),s=M.getAxesPermutation(i,n.shape.length),c=n,l=[];s!=null&&(c=ar({inputs:{x:n},backend:r,attrs:{perm:s}}),l.push(c),i=M.getInnerMostAxes(i.length,c.shape.length)),i=[i[0]],M.assertAxesAreInnerMostDims("argMin",i,c.shape.length);let[p,u]=M.computeOutAndReduceShapes(c.shape,i),m=S.sizeFromShape(p),f=S.makeZerosTypedArray(m,"int32"),d=S.sizeFromShape(u),h=r.data.get(c.dataId).values;for(let y=0;y<f.length;++y){let g=y*d,b=h[g],x=0;for(let w=0;w<d;++w){let I=h[g+w];I<b&&(b=I,x=w)}f[y]=x}return l.forEach(y=>r.disposeIntermediateTensorInfo(y)),r.makeTensorInfo(p,"int32",f)}var mK={kernelName:rh,backendName:"cpu",kernelFunc:XSe};var YSe=Oe(Ep,e=>Math.asin(e)),fK={kernelName:Ep,backendName:"cpu",kernelFunc:YSe};var QSe=Oe(Ip,e=>Math.asinh(e)),dK={kernelName:Ip,backendName:"cpu",kernelFunc:QSe};var JSe=Oe(Tp,e=>Math.atan(e)),hK={kernelName:Tp,backendName:"cpu",kernelFunc:JSe};var ZSe=it((e,t)=>Math.atan2(e,t)),eke=ht(Np,ZSe),gK={kernelName:Np,backendName:"cpu",kernelFunc:eke};var tke=Oe(Cp,e=>Math.atanh(e)),yK={kernelName:Cp,backendName:"cpu",kernelFunc:tke};function mg(e,t,r,o,n,a){let i=n.strideHeight,s=n.strideWidth,c=n.dilationHeight,l=n.dilationWidth,p=n.effectiveFilterHeight,u=n.effectiveFilterWidth,m=n.padInfo.top,f=n.padInfo.left,d=a==="max"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,h=Re(n.outShape,r),y=h.values,g=n.outShape[1]*n.outShape[2]*n.outShape[3],b=n.outShape[2]*n.outShape[3],x=n.outShape[3];for(let w=0;w<n.batchSize;++w){let I=w*g,C=w*o[0];for(let R=0;R<n.inChannels;++R)for(let P=0;P<n.outHeight;++P){let z=P*i-m,$=Math.max(0,z),B=Math.min(n.inHeight,p+z),V=I+P*b;for(let H=0;H<n.outWidth;++H){let G=H*s-f,X=Math.max(0,G),ee=Math.min(n.inWidth,u+G),Z=d,te=0,re=0;for(let ae=$;ae<B;ae+=c){let pe=C+ae*o[1];for(let ie=X;ie<ee;ie+=l){let Y=pe+ie*o[2],le=e[Y+R];a==="max"&&le>Z?Z=le:a==="avg"&&(te+=le,re++)}if(isNaN(Z))break}let se=V+H*x+R;y[se]=a==="avg"?te/re:Z}}}return h}function Bk(e,t,r,o,n=!1,a=!1){let i=Re(o.outShape,"int32"),s=o.strideHeight,c=o.strideWidth,l=o.dilationHeight,p=o.dilationWidth,u=o.effectiveFilterHeight,m=o.effectiveFilterWidth,f=o.padInfo.top,d=o.padInfo.left,h=Re(t,r,e);for(let y=0;y<o.batchSize;++y)for(let g=0;g<o.inChannels;++g)for(let b=0;b<o.outHeight;++b){let x=b*s-f,w=x;for(;w<0;)w+=l;let I=Math.min(o.inHeight,u+x);for(let C=0;C<o.outWidth;++C){let R=C*c-d,P=R;for(;P<0;)P+=p;let z=Math.min(o.inWidth,m+R),$=Number.NEGATIVE_INFINITY,B=-1;for(let V=w;V<I;V+=l){let H=V-x;for(let G=P;G<z;G+=p){let X=G-R,ee=h.get(y,V,G,g);ee>$&&($=ee,n?B=a?((y*o.inHeight+V)*o.inWidth+G)*o.inChannels+g:(V*o.inWidth+G)*o.inChannels+g:B=H*m+X)}}i.set(B,y,b,C,g)}}return i}function Uk(e,t,r,o,n,a){let i=n.strideDepth,s=n.strideHeight,c=n.strideWidth,l=n.dilationDepth,p=n.dilationHeight,u=n.dilationWidth,m=n.effectiveFilterDepth,f=n.effectiveFilterHeight,d=n.effectiveFilterWidth,h=n.padInfo.front,y=n.padInfo.top,g=n.padInfo.left,b=a==="max"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,x=Re(n.outShape,r),w=x.values,I=n.outShape[1]*n.outShape[2]*n.outShape[3]*n.outShape[4],C=n.outShape[2]*n.outShape[3]*n.outShape[4],R=n.outShape[3]*n.outShape[4],P=n.outShape[4];for(let z=0;z<n.batchSize;++z){let $=z*I,B=z*o[0];for(let V=0;V<n.inChannels;++V)for(let H=0;H<n.outDepth;++H){let G=H*i-h,X=G;for(;X<0;)X+=l;let ee=Math.min(n.inDepth,m+G),Z=$+H*C;for(let te=0;te<n.outHeight;++te){let re=te*s-y,se=re;for(;se<0;)se+=p;let ae=Math.min(n.inHeight,f+re),pe=Z+te*R;for(let ie=0;ie<n.outWidth;++ie){let Y=ie*c-g,le=Y;for(;le<0;)le+=u;let ge=Math.min(n.inWidth,d+Y),ve=pe+ie*P,Ee=b,Se=0,Ve=0;for(let Ye=X;Ye<ee;Ye+=l){let Ze=B+Ye*o[1];for(let Je=se;Je<ae;Je+=p){let yt=Ze+Je*o[2];for(let lt=le;lt<ge;lt+=u){let Nt=yt+lt*o[3],St=e[Nt+V];if(a==="max"&&St>Ee?Ee=St:a==="avg"&&(Se+=St,Ve++),isNaN(Ee))break}if(isNaN(Ee))break}if(isNaN(Ee))break}let Ge=ve+V;w[Ge]=a==="avg"?Se/Math.max(Ve,1):Ee}}}}return x}function vK(e,t){let r=Re(t.outShape,"int32"),o=t.strideDepth,n=t.strideHeight,a=t.strideWidth,i=t.dilationDepth,s=t.dilationHeight,c=t.dilationWidth,l=t.effectiveFilterDepth,p=t.effectiveFilterHeight,u=t.effectiveFilterWidth,m=t.padInfo.front,f=t.padInfo.top,d=t.padInfo.left;for(let h=0;h<t.batchSize;++h)for(let y=0;y<t.inChannels;++y)for(let g=0;g<t.outDepth;++g){let b=g*o-m,x=b;for(;x<0;)x+=i;let w=Math.min(t.inDepth,l+b);for(let I=0;I<t.outHeight;++I){let C=I*n-f,R=C;for(;R<0;)R+=s;let P=Math.min(t.inHeight,p+C);for(let z=0;z<t.outWidth;++z){let $=z*a-d,B=$;for(;B<0;)B+=c;let V=Math.min(t.inWidth,u+$),H=Number.NEGATIVE_INFINITY,G=-1;for(let X=x;X<w;X+=i){let ee=X-b;for(let Z=R;Z<P;Z+=s){let te=Z-C;for(let re=B;re<V;re+=c){let se=re-$,ae=e.get(h,X,Z,re,y);ae>=H&&(H=ae,G=ee*p*u+te*p+se)}}}r.set(G,h,g,I,z,y)}}}return r}function rke(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t;ne(n,"avgPool");let{filterSize:a,strides:i,pad:s,dimRoundingMode:c}=o,l=1;S.assert(M.eitherStridesOrDilationsAreOne(i,l),()=>`Error in avgPool: Either strides or dilations must be 1. Got strides ${i} and dilations '${l}'`);let p=M.computePool2DInfo(n.shape,a,i,l,s,c),u;if(p.filterWidth===1&&p.filterHeight===1&&S.arraysEqual(p.inShape,p.outShape))u=xo({inputs:{x:n},backend:r});else{let m=r.data.get(n.dataId).values,f=S.computeStrides(n.shape),d=mg(m,n.shape,n.dtype,f,p,"avg");u=r.makeTensorInfo(p.outShape,n.dtype,d.values)}return u}var bK={kernelName:Ap,backendName:"cpu",kernelFunc:rke};function oke(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,{filterSize:a,strides:i,pad:s,dimRoundingMode:c,dataFormat:l}=o;ne(n,"avgPool3d");let p=M.computePool3DInfo(n.shape,a,i,1,s,c,l),u=r.data.get(n.dataId).values,m=Uk(u,n.shape,n.dtype,S.computeStrides(n.shape),p,"avg");return r.makeTensorInfo(m.shape,"float32",m.values)}var xK={kernelName:oh,backendName:"cpu",kernelFunc:oke};function nke(e){let{inputs:t,backend:r,attrs:o}=e,{dy:n,input:a}=t,{filterSize:i,strides:s,pad:c,dimRoundingMode:l}=o;ne([n,a],"avgPool3DGrad");let p=M.computePool3DInfo(a.shape,i,s,1,c,l),u=p.strideDepth,m=p.strideHeight,f=p.strideWidth,d=p.filterDepth,h=p.filterHeight,y=p.filterWidth,g=p.dilationDepth,b=p.dilationHeight,x=p.dilationWidth,w=p.effectiveFilterDepth,I=p.effectiveFilterHeight,C=p.effectiveFilterWidth,R=w-1-p.padInfo.front,P=C-1-p.padInfo.left,z=I-1-p.padInfo.top,$=Re(a.shape,"float32"),B=1/(d*h*y),V=r.bufferSync(n);for(let H=0;H<p.batchSize;++H)for(let G=0;G<p.inChannels;++G)for(let X=0;X<p.inDepth;++X)for(let ee=0;ee<p.inHeight;++ee)for(let Z=0;Z<p.inWidth;++Z){let te=X-R,re=ee-z,se=Z-P,ae=0;for(let pe=0;pe<w;pe+=g){let ie=(te+pe)/u;if(!(ie<0||ie>=p.outDepth||Math.floor(ie)!==ie))for(let Y=0;Y<I;Y+=b){let le=(re+Y)/m;if(!(le<0||le>=p.outHeight||Math.floor(le)!==le))for(let ge=0;ge<C;ge+=x){let ve=(se+ge)/f;if(ve<0||ve>=p.outWidth||Math.floor(ve)!==ve)continue;let Ee=V.get(H,ie,le,ve,G);ae+=Ee}}}$.set(ae*B,H,X,ee,Z,G)}return r.makeTensorInfo($.shape,$.dtype,$.values)}var wK={kernelName:_1,backendName:"cpu",kernelFunc:nke};function ake(e){let{inputs:t,backend:r,attrs:o}=e,{dy:n,input:a}=t,i=a;ne([n,a],"avgPoolGrad");let{filterSize:s,strides:c,pad:l}=o,p=M.computePool2DInfo(i.shape,s,c,1,l),u=p.strideHeight,m=p.strideWidth,f=p.filterHeight,d=p.filterWidth,h=p.dilationHeight,y=p.dilationWidth,g=p.effectiveFilterHeight,b=p.effectiveFilterWidth,x=b-1-p.padInfo.left,w=g-1-p.padInfo.top,I=Re(i.shape,"float32"),C=1/(f*d),R=r.data.get(n.dataId).values,P=Re(n.shape,"float32",R);for(let z=0;z<p.batchSize;++z)for(let $=0;$<p.inChannels;++$)for(let B=0;B<p.inHeight;++B)for(let V=0;V<p.inWidth;++V){let H=B-w,G=V-x,X=0;for(let ee=0;ee<g;ee+=h){let Z=(H+ee)/u;if(!(Z<0||Z>=p.outHeight||Math.floor(Z)!==Z))for(let te=0;te<b;te+=y){let re=(G+te)/m;if(re<0||re>=p.outWidth||Math.floor(re)!==re)continue;let se=P.get(z,Z,re,$);X+=se}}I.set(X*C,z,B,V,$)}return r.makeTensorInfo(I.shape,I.dtype,I.values)}var SK={kernelName:k1,backendName:"cpu",kernelFunc:ake};function ike(e){let{inputs:t,backend:r,attrs:o}=e,{x:n,scale:a,offset:i,mean:s,variance:c}=t;S.assert(s.shape.length===c.shape.length,()=>"Batch normalization gradient requires mean and variance to have equal ranks."),S.assert(i==null||s.shape.length===i.shape.length,()=>"Batch normalization gradient requires mean and offset to have equal ranks."),S.assert(a==null||s.shape.length===a.shape.length,()=>"Batch normalization gradient requires mean and scale to have equal ranks."),ne([n,s,c,a,i],"batchNorm");let{varianceEpsilon:l}=o;l==null&&(l=.001);let p=r.data.get(n.dataId).values,u=r.data.get(s.dataId).values,m=r.data.get(c.dataId).values,f=a?r.data.get(a.dataId).values:new Float32Array([1]),d=i?r.data.get(i.dataId).values:new Float32Array([0]),h=new Float32Array(p.length),y=d.length,g=f.length,b=m.length,x=u.length,w=0,I=0,C=0,R=0;for(let P=0;P<p.length;++P)h[P]=d[w++]+(p[P]-u[I++])*f[C++]/Math.sqrt(m[R++]+l),w>=y&&(w=0),I>=x&&(I=0),C>=g&&(C=0),R>=b&&(R=0);return r.makeTensorInfo(n.shape,n.dtype,h)}var kK={kernelName:ru,backendName:"cpu",kernelFunc:ike};function ske(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,{blockShape:a,crops:i}=o;ne([n],"batchToSpaceND");let s=a.reduce((g,b)=>g*b),c=M.getReshaped(n.shape,a,s),l=M.getPermuted(c.length,a.length),p=M.getReshapedPermuted(n.shape,a,s),u=M.getSliceBeginCoords(i,a.length),m=M.getSliceSize(p,i,a.length),f=st({inputs:{x:n},backend:r,attrs:{shape:c}}),d=ar({inputs:{x:f},backend:r,attrs:{perm:l}}),h=st({inputs:{x:d},backend:r,attrs:{shape:p}}),y=Ca({inputs:{x:h},backend:r,attrs:{begin:u,size:m}});return r.disposeIntermediateTensorInfo(f),r.disposeIntermediateTensorInfo(d),r.disposeIntermediateTensorInfo(h),y}var _K={kernelName:nh,backendName:"cpu",kernelFunc:ske};function lke(e){let{inputs:t,backend:r,attrs:o}=e,{x:n,weights:a}=t,{size:i}=o,s=r.data.get(n.dataId).values,c=r.data.get(a.dataId).values,l=Ak(s,c,a.dtype,a.shape,i);return r.makeTensorInfo([i],a.dtype,l)}var EK={kernelName:Dp,backendName:"cpu",kernelFunc:lke};function cke(e){let{inputs:t,backend:r}=e,{s0:o,s1:n}=t,a=r.data.get(o.dataId).values,i=r.data.get(n.dataId).values,s=M.assertAndGetBroadcastShape(Array.from(a),Array.from(i));return r.makeTensorInfo([s.length],"int32",Int32Array.from(s))}var IK={kernelName:ah,backendName:"cpu",kernelFunc:cke};var pke=Oe(Bl,(e,t)=>{let r=t;return e>r.clipValueMax?r.clipValueMax:e<r.clipValueMin?r.clipValueMin:e}),TK={kernelName:Bl,backendName:"cpu",kernelFunc:pke};var uke=e=>{let{x:t}=e.inputs,r=e.backend,o=new Float32Array(S.sizeFromShape(t.shape)),n=r.data.get(t.dataId),a=n.complexTensorInfos.real,i=n.complexTensorInfos.imag,s=r.data.get(a.dataId).values,c=r.data.get(i.dataId).values;for(let l=0;l<s.length;l++){let p=s[l],u=c[l];o[l]=Math.hypot(p,u)}return r.makeOutput(o,t.shape,"float32")},CK={kernelName:I1,backendName:"cpu",kernelFunc:uke};function Vi(e){let{inputs:t,backend:r}=e,{input:o}=t,n=r.data.get(o.dataId).complexTensorInfos.imag,a=r.data.get(n.dataId).values;return r.makeTensorInfo(n.shape,n.dtype,a)}var NK={kernelName:F1,backendName:"cpu",kernelFunc:Vi};function sc(e){let{inputs:t,backend:r,attrs:o}=e,{axis:n}=o,a=S.parseAxisParam(n,t[0].shape)[0],i=t.map(h=>h.shape);M.assertParamsConsistent(i,a);let s=M.computeOutShape(t.map(h=>h.shape),a);if(S.sizeFromShape(s)===0)return r.makeTensorInfo(s,t[0].dtype,[]);let c=t.filter(h=>S.sizeFromShape(h.shape)>0);if(c.length===1)return xo({inputs:{x:c[0]},backend:r});if(c[0].dtype==="complex64"){let h=c.map(w=>Ea({inputs:{input:w},backend:r})),y=c.map(w=>Vi({inputs:{input:w},backend:r})),g=sc({inputs:h,backend:r,attrs:{axis:a}}),b=sc({inputs:y,backend:r,attrs:{axis:a}}),x=qr({inputs:{real:g,imag:b},backend:r});return h.forEach(w=>r.disposeIntermediateTensorInfo(w)),y.forEach(w=>r.disposeIntermediateTensorInfo(w)),r.disposeIntermediateTensorInfo(g),r.disposeIntermediateTensorInfo(b),x}let l=c.map(h=>{let g=[-1,S.sizeFromShape(h.shape.slice(a))];return st({inputs:{x:h},backend:r,attrs:{shape:g}})}),p=l.map(h=>({vals:r.data.get(h.dataId).values,shape:h.shape}));s=M.computeOutShape(l.map(h=>h.shape),1);let u=l[0].shape[0]===1,m=ng(p,s,t[0].dtype,u),f=M.computeOutShape(c.map(h=>h.shape),a),d=r.makeTensorInfo(f,t[0].dtype,m);return l.forEach(h=>r.disposeIntermediateTensorInfo(h)),d}var AK={kernelName:ih,backendName:"cpu",kernelFunc:sc};function yR(e){let{inputs:t,backend:r,attrs:o}=e,{x:n,filter:a}=t,{strides:i,pad:s,dataFormat:c,dilations:l,dimRoundingMode:p}=o;ne([n,a],"conv2d");let u=M.convertConv2DDataFormat(c),m=M.computeConv2DInfo(n.shape,a.shape,i,l,s,p,!1,u),f=m.filterHeight,d=m.filterWidth,h=m.dilationHeight,y=m.dilationWidth,g=m.padInfo.left,b=m.padInfo.top,x=m.dataFormat==="channelsLast",w=new Tt(m.outShape,n.dtype),I=S.computeStrides(n.shape),C=S.computeStrides(a.shape),R=I[0],P=x?I[1]:I[2],z=x?I[2]:1,$=x?1:I[1],B=w.strides[0],V=x?w.strides[1]:w.strides[2],H=x?w.strides[2]:1,G=x?1:w.strides[1],X=r.data.get(n.dataId).values,ee=r.data.get(a.dataId).values,Z=w.values;for(let te=0;te<m.batchSize;++te){let re=te*R,se=te*B;for(let ae=0;ae<m.outHeight;++ae){let pe=se+ae*V,ie=ae*m.strideHeight-b;for(let Y=0;Y<f;++Y){let le=ie+Y*h;if(le<0||le>=m.inHeight)continue;let ge=Y*C[0],ve=re+le*P;for(let Ee=0;Ee<m.outWidth;++Ee){let Se=pe+Ee*H,Ve=Ee*m.strideWidth-g;for(let Ge=0;Ge<d;++Ge){let Ye=Ve+Ge*y;if(Ye<0||Ye>=m.inWidth)continue;let Ze=ge+Ge*C[1],Je=ve+Ye*z,yt=Ze;for(let lt=0;lt<m.inChannels;++lt){let Nt=X[Je+lt*$];for(let St=0;St<m.outChannels;++St)Z[Se+St*G]+=Nt*ee[yt+St];yt+=m.outChannels}}}}}}return r.makeTensorInfo(w.shape,w.dtype,Z)}var RK={kernelName:Op,backendName:"cpu",kernelFunc:yR};function mke(e){let{inputs:t,backend:r,attrs:o}=e,{x:n,dy:a}=t,{strides:i,pad:s,dataFormat:c,dimRoundingMode:l,filterShape:p}=o;ne([n,a],"conv2dBackpropFilter");let u=M.convertConv2DDataFormat(c),m=M.computeConv2DInfo(n.shape,p,i,1,s,l,!1,u),{strideHeight:f,strideWidth:d,filterHeight:h,filterWidth:y}=m,g=m.dataFormat==="channelsLast",b=new Tt(m.filterShape,"float32"),x=m.padInfo.left,w=m.padInfo.top,I=r.data.get(n.dataId).values,C=r.data.get(a.dataId).values,R=new Tt(n.shape,n.dtype,I),P=new Tt(a.shape,a.dtype,C);for(let z=0;z<h;++z){let $=Math.max(0,Math.ceil((w-z)/f)),B=Math.min(m.outHeight,(m.inHeight+w-z)/f);for(let V=0;V<y;++V){let H=Math.max(0,Math.ceil((x-V)/d)),G=Math.min(m.outWidth,(m.inWidth+x-V)/d);for(let X=0;X<m.inChannels;++X)for(let ee=0;ee<m.outChannels;++ee){let Z=0;for(let te=0;te<m.batchSize;++te)for(let re=$;re<B;++re){let se=z+re*f-w;for(let ae=H;ae<G;++ae){let pe=V+ae*d-x;g?Z+=R.get(te,se,pe,X)*P.get(te,re,ae,ee):Z+=R.get(te,X,se,pe)*P.get(te,ee,re,ae)}}b.set(Z,z,V,X,ee)}}}return r.makeTensorInfo(b.shape,b.dtype,b.values)}var DK={kernelName:T1,backendName:"cpu",kernelFunc:mke};function fke(e){let{inputs:t,backend:r,attrs:o}=e,{dy:n,filter:a}=t,{inputShape:i,strides:s,pad:c,dataFormat:l,dimRoundingMode:p}=o;ne([n,a],"conv2dBackpropInput");let u=S.computeStrides(a.shape),m=S.computeStrides(n.shape),f=M.convertConv2DDataFormat(l),d=M.computeConv2DInfo(i,a.shape,s,1,c,p,!1,f),h=new Tt(d.inShape,"float32"),y=h.values,g=r.data.get(n.dataId).values,b=r.data.get(a.dataId).values,[x,w,I]=u,{batchSize:C,filterHeight:R,filterWidth:P,inChannels:z,inHeight:$,inWidth:B,outChannels:V,outHeight:H,outWidth:G,strideHeight:X,strideWidth:ee}=d;f=d.dataFormat;let Z=R-1-d.padInfo.top,te=P-1-d.padInfo.left,re=f==="channelsLast",se=h.strides[0],ae=re?h.strides[1]:h.strides[2],pe=re?h.strides[2]:1,ie=re?1:h.strides[1],Y=m[0],le=re?m[1]:m[2],ge=re?m[2]:1,ve=re?1:m[1];for(let Ee=0;Ee<C;++Ee)for(let Se=0;Se<z;++Se)for(let Ve=0;Ve<$;++Ve){let Ge=Ve-Z,Ye=Math.max(0,Math.ceil(Ge/X)),Ze=Math.min(H,(R+Ge)/X);for(let Je=0;Je<B;++Je){let yt=Je-te,lt=Math.max(0,Math.ceil(yt/ee)),Nt=Math.min(G,(P+yt)/ee),St=0;for(let Lt=Ye;Lt<Ze;++Lt){let Kr=Lt*X-Ge;for(let tr=lt;tr<Nt;++tr){let xt=tr*ee-yt,Qt=Y*Ee+le*Lt+ge*tr,Ht=x*(R-1-Kr)+w*(P-1-xt)+I*Se;for(let _r=0;_r<V;++_r){let br=g[Qt+ve*_r],Br=b[Ht+_r];St+=br*Br}}}let zt=se*Ee+ae*Ve+pe*Je+ie*Se;y[zt]=St}}return r.makeTensorInfo(h.shape,h.dtype,h.values)}var FK={kernelName:Pp,backendName:"cpu",kernelFunc:fke};function dke(e){let{inputs:t,backend:r,attrs:o}=e,{x:n,filter:a}=t,{strides:i,pad:s,dilations:c}=o;ne([n,a],"conv3d");let l=M.computeConv3DInfo(n.shape,a.shape,i,c,s),{filterDepth:p,filterHeight:u,filterWidth:m,dilationDepth:f,dilationHeight:d,dilationWidth:h,padInfo:y}=l,g=y.front,b=y.left,x=y.top,w=new Tt(l.outShape,n.dtype),I=r.data.get(n.dataId).values,C=r.data.get(a.dataId).values,R=w.values,P=S.computeStrides(n.shape),z=S.computeStrides(a.shape);for(let $=0;$<l.batchSize;++$){let B=$*P[0],V=$*w.strides[0];for(let H=0;H<l.outDepth;++H){let G=V+H*w.strides[1],X=H*l.strideDepth-g;for(let ee=0;ee<p;++ee){let Z=X+ee*f;if(Z<0||Z>=l.inDepth)continue;let te=ee*z[0],re=B+Z*P[1];for(let se=0;se<l.outHeight;++se){let ae=G+se*w.strides[2],pe=se*l.strideHeight-x;for(let ie=0;ie<u;++ie){let Y=pe+ie*d;if(Y<0||Y>=l.inHeight)continue;let le=te+ie*z[1],ge=re+Y*P[2];for(let ve=0;ve<l.outWidth;++ve){let Ee=ae+ve*l.outChannels,Se=ve*l.strideWidth-b;for(let Ve=0;Ve<m;++Ve){let Ge=Se+Ve*h;if(Ge<0||Ge>=l.inWidth)continue;let Ye=le+Ve*z[2],Ze=ge+Ge*l.inChannels,Je=Ye;for(let yt=0;yt<l.inChannels;++yt){let lt=I[Ze+yt];for(let Nt=0;Nt<l.outChannels;++Nt)R[Ee+Nt]+=lt*C[Je+Nt];Je+=l.outChannels}}}}}}}}return r.makeTensorInfo(w.shape,w.dtype,w.values)}var MK={kernelName:zp,backendName:"cpu",kernelFunc:dke};function hke(e){let{inputs:t,backend:r,attrs:o}=e,{x:n,dy:a}=t,{strides:i,pad:s,filterShape:c}=o;ne([n,a],"conv3dBackpropFilterV2");let l=S.computeStrides(n.shape),p=S.computeStrides(a.shape),u=M.computeConv3DInfo(n.shape,c,i,1,s),m=u.strideDepth,f=u.strideHeight,d=u.strideWidth,h=u.filterDepth,y=u.filterHeight,g=u.filterWidth,b=new Tt(u.filterShape,"float32"),x=b.values,[w,I,C,R]=b.strides,P=r.data.get(a.dataId).values,[z,$,B,V]=p,H=r.data.get(n.dataId).values,[G,X,ee,Z]=l,te=u.padInfo.front,re=u.padInfo.left,se=u.padInfo.top;for(let ae=0;ae<h;++ae){let pe=Math.max(0,Math.ceil((te-ae)/m)),ie=Math.min(u.outDepth,(u.inDepth+te-ae)/m),Y=ae*w;for(let le=0;le<y;++le){let ge=Math.max(0,Math.ceil((se-le)/f)),ve=Math.min(u.outHeight,(u.inHeight+se-le)/f),Ee=le*I+Y;for(let Se=0;Se<g;++Se){let Ve=Math.max(0,Math.ceil((re-Se)/d)),Ge=Math.min(u.outWidth,(u.inWidth+re-Se)/d),Ye=Se*C+Ee;for(let Ze=0;Ze<u.inChannels;++Ze){let Je=Ze*R+Ye;for(let yt=0;yt<u.outChannels;++yt){let lt=0;for(let Nt=0;Nt<u.batchSize;++Nt){let St=Nt*G,zt=Nt*z;for(let Lt=pe;Lt<ie;++Lt){let tr=(ae+Lt*m-te)*X+St,xt=Lt*$+zt;for(let Qt=ge;Qt<ve;++Qt){let _r=(le+Qt*f-se)*ee+tr,br=Qt*B+xt;for(let Br=Ve;Br<Ge;++Br){let On=(Se+Br*d-re)*Z+_r,Xo=Br*V+br;lt+=H[On+Ze]*P[Xo+yt]}}}}x[Je+yt]=lt}}}}}return r.makeTensorInfo(b.shape,b.dtype,b.values)}var OK={kernelName:Jv,backendName:"cpu",kernelFunc:hke};function gke(e){let{inputs:t,backend:r,attrs:o}=e,{dy:n,filter:a}=t,{pad:i,strides:s,inputShape:c}=o;ne([n],"conv3dBackpropInputV2");let l=S.computeStrides(n.shape),p=S.computeStrides(a.shape),u=M.computeConv3DInfo(c,a.shape,s,1,i),m=new Tt(u.inShape,"float32"),f=m.values,[d,h,y,g]=m.strides,b=r.data.get(n.dataId).values,[x,w,I,C]=l,R=r.data.get(a.dataId).values,[P,z,$,B]=p,{batchSize:V,filterDepth:H,filterHeight:G,filterWidth:X,inChannels:ee,inDepth:Z,inHeight:te,inWidth:re,outChannels:se,outDepth:ae,outHeight:pe,outWidth:ie,strideDepth:Y,strideHeight:le,strideWidth:ge}=u,ve=H-1-u.padInfo.front,Ee=G-1-u.padInfo.top,Se=X-1-u.padInfo.left;for(let Ve=0;Ve<V;++Ve)for(let Ge=0;Ge<ee;++Ge)for(let Ye=0;Ye<Z;++Ye){let Ze=Ye-ve,Je=Math.max(0,Math.ceil(Ze/Y)),yt=Math.min(ae,(H+Ze)/Y);for(let lt=0;lt<te;++lt){let Nt=lt-Ee,St=Math.max(0,Math.ceil(Nt/le)),zt=Math.min(pe,(G+Nt)/le);for(let Lt=0;Lt<re;++Lt){let Kr=Lt-Se,tr=Math.max(0,Math.ceil(Kr/ge)),xt=Math.min(ie,(X+Kr)/ge),Qt=0;for(let Ht=Je;Ht<yt;++Ht){let _r=Ht*Y-Ze;for(let br=St;br<zt;++br){let Br=br*le-Nt;for(let Ao=tr;Ao<xt;++Ao){let On=Ao*ge-Kr,Xo=x*Ve+w*Ht+I*br+C*Ao,Mr=P*(H-1-_r)+z*(G-1-Br)+$*(X-1-On)+B*Ge;for(let na=0;na<se;++na){let Pa=b[Xo+na],za=R[Mr+na];Qt+=Pa*za}}}}f[d*Ve+h*Ye+y*lt+g*Lt+Ge]=Qt}}}return r.makeTensorInfo(m.shape,m.dtype,m.values)}var PK={kernelName:$p,backendName:"cpu",kernelFunc:gke};var yke=Oe(Lp,e=>Math.cos(e)),zK={kernelName:Lp,backendName:"cpu",kernelFunc:yke};var vke=Oe(Bp,e=>Math.cosh(e)),$K={kernelName:Bp,backendName:"cpu",kernelFunc:vke};function bke(e){let{inputs:t,backend:r,attrs:o}=e,{image:n,boxes:a,boxInd:i}=t,{cropSize:s,method:c,extrapolationValue:l}=o,[p,u,m,f]=n.shape,d=a.shape[0],[h,y]=s,g=Re([d,h,y,f],"float32"),b=r.data.get(a.dataId).values,x=r.data.get(i.dataId).values,w=r.data.get(n.dataId).values,I=S.computeStrides(n.shape),C=S.computeStrides(g.shape);for(let R=0;R<d;R++){let P=R*4,z=b[P],$=b[P+1],B=b[P+2],V=b[P+3],H=x[R];if(H>=p)continue;let G=h>1?(B-z)*(u-1)/(h-1):0,X=y>1?(V-$)*(m-1)/(y-1):0;for(let ee=0;ee<h;ee++){let Z=h>1?z*(u-1)+ee*G:.5*(z+B)*(u-1);if(Z<0||Z>u-1){for(let te=0;te<y;te++)for(let re=0;re<f;re++){let se=re+te*C[2]+ee*C[1]+R*C[0];g.values[se]=l}continue}if(c==="bilinear"){let te=Math.floor(Z),re=Math.ceil(Z),se=Z-te;for(let ae=0;ae<y;ae++){let pe=y>1?$*(m-1)+ae*X:.5*($+V)*(m-1);if(pe<0||pe>m-1){for(let ge=0;ge<f;ge++){let ve=ge+ae*C[2]+ee*C[1]+R*C[0];g.values[ve]=l}continue}let ie=Math.floor(pe),Y=Math.ceil(pe),le=pe-ie;for(let ge=0;ge<f;ge++){let ve=ge+ie*I[2]+te*I[1]+H*I[0],Ee=w[ve];ve=ge+Y*I[2]+te*I[1]+H*I[0];let Se=w[ve];ve=ge+ie*I[2]+re*I[1]+H*I[0];let Ve=w[ve];ve=ge+Y*I[2]+re*I[1]+H*I[0];let Ge=w[ve],Ye=Ee+(Se-Ee)*le,Ze=Ve+(Ge-Ve)*le;ve=ge+ae*C[2]+ee*C[1]+R*C[0],g.values[ve]=Ye+(Ze-Ye)*se}}}else for(let te=0;te<y;++te){let re=y>1?$*(m-1)+te*X:.5*($+V)*(m-1);if(re<0||re>m-1){for(let pe=0;pe<f;pe++){let ie=pe+te*C[2]+ee*C[1]+R*C[0];g.values[ie]=l}continue}let se=Math.round(re),ae=Math.round(Z);for(let pe=0;pe<f;pe++){let ie=pe+se*I[2]+ae*I[1]+H*I[0],Y=pe+te*C[2]+ee*C[1]+R*C[0];g.values[Y]=w[ie]}}}}return r.makeTensorInfo(g.shape,g.dtype,g.values)}var LK={kernelName:Hp,backendName:"cpu",kernelFunc:bke};function xke(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,{axis:a,exclusive:i,reverse:s}=o;ne(n,"cumprod");let c=M.getAxesPermutation([a],n.shape.length),l=n;c!=null&&(l=ar({inputs:{x:n},backend:r,attrs:{perm:c}}));let p=M.getInnerMostAxes(1,n.shape.length)[0];if(p!==l.shape.length-1)throw new Error(`backend.cumprod in CPU expects an inner-most axis=${l.shape.length-1} but got axis=${p}`);let u=Xn(l.dtype,"int32"),m=S.makeOnesTypedArray(S.sizeFromShape(l.shape),u),f=r.data.get(l.dataId).values,d=l.shape[l.shape.length-1],h=s?(g,b)=>g+d-b-1:(g,b)=>g+b;for(let g=0;g<f.length;g+=d)for(let b=0;b<d;b++){let x=h(g,b);if(b===0)m[x]=i?1:f[x];else{let w=h(g,b-1);m[x]=i?f[w]*m[w]:f[x]*m[w]}}let y=r.makeTensorInfo(l.shape,u,m);if(c!=null){let g=M.getUndoAxesPermutation(c),b=ar({inputs:{x:y},backend:r,attrs:{perm:g}});return r.disposeIntermediateTensorInfo(y),r.disposeIntermediateTensorInfo(l),b}return y}var BK={kernelName:Up,backendName:"cpu",kernelFunc:xke};function wke(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,{axis:a,exclusive:i,reverse:s}=o;ne(n,"cumsum");let c=M.getAxesPermutation([a],n.shape.length),l=n;c!=null&&(l=ar({inputs:{x:n},backend:r,attrs:{perm:c}}));let p=M.getInnerMostAxes(1,n.shape.length)[0];if(p!==l.shape.length-1)throw new Error(`backend.cumsum in CPU expects an inner-most axis=${l.shape.length-1} but got axis=${p}`);let u=Xn(l.dtype,"int32"),m=S.makeZerosTypedArray(S.sizeFromShape(l.shape),u),f=r.data.get(l.dataId).values,d=l.shape[l.shape.length-1],h=s?(g,b)=>g+d-b-1:(g,b)=>g+b;for(let g=0;g<f.length;g+=d)for(let b=0;b<d;b++){let x=h(g,b);if(b===0)m[x]=i?0:f[x];else{let w=h(g,b-1);m[x]=i?f[w]+m[w]:f[x]+m[w]}}let y=r.makeTensorInfo(l.shape,u,m);if(c!=null){let g=M.getUndoAxesPermutation(c),b=ar({inputs:{x:y},backend:r,attrs:{perm:g}});return r.disposeIntermediateTensorInfo(y),r.disposeIntermediateTensorInfo(l),b}return y}var UK={kernelName:Wp,backendName:"cpu",kernelFunc:wke};function Ske(e){let{inputs:t,backend:r,attrs:o}=e,{x:n,weights:a}=t,{size:i,binaryOutput:s}=o;if(n.shape.length===1){let c=r.data.get(n.dataId).values,l=r.data.get(a.dataId).values,p=Ak(c,l,a.dtype,a.shape,i);return r.makeTensorInfo([i],a.dtype,p)}else if(n.shape.length===2){let c=r.bufferSync(n),l=r.bufferSync(a),p=mH(c,l,i,s);return r.makeTensorInfo(p.shape,a.dtype,p.values)}throw new Error(`Error in denseBincount: input must be at most rank 2, but got rank${n.shape.length}.`)}var WK={kernelName:sh,backendName:"cpu",kernelFunc:Ske};function kke(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,{blockSize:a,dataFormat:i}=o;S.assert(i==="NHWC",()=>`Only NHWC dataFormat supported on CPU for depthToSpace. Got ${i}`);let s=n.shape[0],c=n.shape[1],l=n.shape[2],p=n.shape[3],u=c*a,m=l*a,f=p/(a*a),d=r.data.get(n.dataId).values,h=new Float32Array(s*u*m*f),y=0;for(let g=0;g<s;++g)for(let b=0;b<u;++b){let x=Math.floor(b/a),w=b%a;for(let I=0;I<m;++I){let C=Math.floor(I/a),R=I%a,P=(w*a+R)*f;for(let z=0;z<f;++z){let B=z+P+p*(C+l*(x+c*g));h[y++]=d[B]}}}return r.makeTensorInfo([s,u,m,f],n.dtype,h)}var HK={kernelName:Vp,backendName:"cpu",kernelFunc:kke};function vR(e){let{inputs:t,backend:r,attrs:o}=e,{x:n,filter:a}=t,{strides:i,pad:s,dilations:c,dimRoundingMode:l}=o;ne([n,a],"depthwiseConv2DNative");let p=S.computeStrides(n.shape),u=S.computeStrides(a.shape),m=c;m==null&&(m=[1,1]),S.assert(M.eitherStridesOrDilationsAreOne(i,m),()=>`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${i} and dilations '${m}'`);let f=M.computeConv2DInfo(n.shape,a.shape,i,m,s,l,!0),{filterHeight:d,filterWidth:h,dilationHeight:y,dilationWidth:g,padInfo:b}=f,x=b.left,w=b.top,I=f.outChannels/f.inChannels,C=new Tt(f.outShape,n.dtype),R=r.data.get(n.dataId).values,P=r.data.get(a.dataId).values,z=C.values;for(let $=0;$<f.batchSize;++$){let B=$*p[0],V=$*C.strides[0];for(let H=0;H<f.outHeight;++H){let G=V+H*C.strides[1],X=H*f.strideHeight-w;for(let ee=0;ee<d;++ee){let Z=X+ee*y;if(Z<0||Z>=f.inHeight)continue;let te=ee*u[0],re=B+Z*p[1];for(let se=0;se<f.outWidth;++se){let ae=G+se*C.strides[2],pe=se*f.strideWidth-x;for(let ie=0;ie<h;++ie){let Y=pe+ie*g;if(Y<0||Y>=f.inWidth)continue;let le=te+ie*u[1],ge=re+Y*f.inChannels,ve=ae,Ee=le;for(let Se=0;Se<f.inChannels;++Se){let Ve=R[ge+Se];for(let Ge=0;Ge<I;++Ge)z[ve+Ge]+=Ve*P[Ee+Ge];ve+=I,Ee+=I}}}}}}return r.makeTensorInfo(C.shape,C.dtype,C.values)}var VK={kernelName:jp,backendName:"cpu",kernelFunc:vR};function _ke(e){let{inputs:t,backend:r,attrs:o}=e,{x:n,dy:a}=t,{strides:i,dilations:s,pad:c,dimRoundingMode:l,filterShape:p}=o;ne([n,a],"depthwiseConv2dNativeBackpropFilter");let u=M.computeConv2DInfo(n.shape,p,i,s,c,l,!0),{strideHeight:m,strideWidth:f,filterHeight:d,filterWidth:h}=u,y=new Tt(u.filterShape,"float32"),g=u.padInfo.left,b=u.padInfo.top,x=u.outChannels/u.inChannels,w=r.data.get(n.dataId).values,I=new Tt(n.shape,n.dtype,w),C=r.data.get(a.dataId).values,R=new Tt(a.shape,a.dtype,C);for(let P=0;P<d;++P){let z=Math.max(0,Math.ceil((b-P)/m)),$=Math.min(u.outHeight,(u.inHeight+b-P)/m);for(let B=0;B<h;++B){let V=Math.max(0,Math.ceil((g-B)/f)),H=Math.min(u.outWidth,(u.inWidth+g-B)/f);for(let G=0;G<u.outChannels;++G){let X=Math.trunc(G/x),ee=G%x,Z=0;for(let te=0;te<u.batchSize;++te)for(let re=z;re<$;++re){let se=P+re*m-b;for(let ae=V;ae<H;++ae){let pe=B+ae*f-g;Z+=I.get(te,se,pe,X)*R.get(te,re,ae,G)}}y.set(Z,P,B,X,ee)}}}return r.makeTensorInfo(y.shape,y.dtype,y.values)}var jK={kernelName:C1,backendName:"cpu",kernelFunc:_ke};function Eke(e){let{inputs:t,backend:r,attrs:o}=e,{dy:n,filter:a}=t,{strides:i,dilations:s,pad:c,dimRoundingMode:l,inputShape:p}=o;ne([n,a],"depthwiseConv2DNativeBackpropInput");let u=S.computeStrides(n.shape),m=S.computeStrides(a.shape),f=M.computeConv2DInfo(p,a.shape,i,s,c,l,!0),d=new Tt(f.inShape,"float32"),h=d.values,[y,g,b]=d.strides,x=r.data.get(n.dataId).values,[w,I,C]=u,R=r.data.get(a.dataId).values,[P,z,$]=m,{batchSize:B,filterHeight:V,filterWidth:H,inChannels:G,inHeight:X,inWidth:ee,outChannels:Z,outHeight:te,outWidth:re,strideHeight:se,strideWidth:ae}=f,pe=V-1-f.padInfo.top,ie=H-1-f.padInfo.left,Y=Z/G;for(let le=0;le<B;++le)for(let ge=0;ge<G;++ge)for(let ve=0;ve<X;++ve){let Ee=ve-pe,Se=Math.max(0,Math.ceil(Ee/se)),Ve=Math.min(te,(V+Ee)/se);for(let Ge=0;Ge<ee;++Ge){let Ye=Ge-ie,Ze=Math.max(0,Math.ceil(Ye/ae)),Je=Math.min(re,(H+Ye)/ae),yt=0;for(let lt=Se;lt<Ve;++lt){let Nt=lt*se-Ee;for(let St=Ze;St<Je;++St){let zt=St*ae-Ye,Lt=w*le+I*lt+C*St,Kr=P*(V-1-Nt)+z*(H-1-zt)+$*ge;for(let tr=0;tr<Y;++tr){let xt=ge*Y+tr,Qt=x[Lt+xt],Ht=R[Kr+tr];yt+=Qt*Ht}}}h[y*le+g*ve+b*Ge+ge]=yt}}return r.makeTensorInfo(d.shape,d.dtype,d.values)}var GK={kernelName:N1,backendName:"cpu",kernelFunc:Eke};function Ike(e){let{inputs:t,backend:r}=e,{x:o}=t,n=S.sizeFromShape(o.shape),a=r.data.get(o.dataId).values,i=Re([n,n],o.dtype),s=i.values;for(let l=0;l<a.length;l++)s[l*n+l]=a[l];let c=[...o.shape,...o.shape];return r.makeTensorInfo(c,i.dtype,i.values)}var qK={kernelName:lh,backendName:"cpu",kernelFunc:Ike};var KK={kernelName:Gp,backendName:"cpu",kernelFunc:({inputs:e,backend:t,attrs:r})=>{let{x:o,filter:n}=e,{strides:a,pad:i,dilations:s}=r,c=t,l=c.data.get(o.dataId).values,p=o.shape.length,u=c.data.get(n.dataId).values,m=n.shape.length,{batchSize:f,inHeight:d,inWidth:h,inChannels:y,outHeight:g,outWidth:b,padInfo:x,strideHeight:w,strideWidth:I,filterHeight:C,filterWidth:R,dilationHeight:P,dilationWidth:z,outShape:$}=M.computeDilation2DInfo(o.shape,n.shape,a,i,"NHWC",s),B=S.sizeFromShape($),V=$.length,H=S.getArrayFromDType(o.dtype,B);for(let X=0;X<f;++X)for(let ee=0;ee<g;++ee){let Z=ee*w-x.top;for(let te=0;te<b;++te){let re=te*I-x.left;for(let se=0;se<y;++se){let ae=Number.MIN_SAFE_INTEGER;for(let ie=0;ie<C;++ie){let Y=Z+ie*P;if(Y>=0&&Y<d)for(let le=0;le<R;++le){let ge=re+le*z;if(ge>=0&&ge<h){let ve=S.locToIndex([X,Y,ge,se],p,S.computeStrides(o.shape)),Ee=S.locToIndex([ie,le,se],m,S.computeStrides(n.shape)),Se=l[ve]+u[Ee];Se>ae&&(ae=Se)}}}let pe=S.locToIndex([X,ee,te,se],V,S.computeStrides($));H[pe]=ae}}}return{dataId:c.write(S.toTypedArray(H,o.dtype),$,o.dtype),shape:$,dtype:o.dtype}}};var XK={kernelName:ph,backendName:"cpu",kernelFunc:({inputs:e,backend:t,attrs:r})=>{let{x:o,filter:n,dy:a}=e,{strides:i,pad:s,dilations:c}=r,l=t,p=S.toNestedArray(o.shape,l.data.get(o.dataId).values),u=S.toNestedArray(n.shape,l.data.get(n.dataId).values),{batchSize:m,inHeight:f,inWidth:d,inChannels:h,outHeight:y,outWidth:g,padInfo:b,strideHeight:x,strideWidth:w,filterHeight:I,filterWidth:C,dilationHeight:R,dilationWidth:P,outShape:z}=M.computeDilation2DInfo(o.shape,n.shape,i,s,"NHWC",c);S.assert(a.rank===z.length,()=>`Error in ${ph}, dy must have the same rank as output ${z.length}, but got ${a.rank}`);let $=S.toNestedArray(z,l.data.get(a.dataId).values),B=S.makeZerosNestedTypedArray(n.shape,n.dtype);for(let H=0;H<m;++H)for(let G=0;G<y;++G){let X=G*x-b.top;for(let ee=0;ee<g;++ee){let Z=ee*w-b.left;for(let te=0;te<h;++te){let re=Number.MIN_SAFE_INTEGER,se=0,ae=0;for(let pe=0;pe<I;++pe){let ie=X+pe*R;if(ie>=0&&ie<f)for(let Y=0;Y<C;++Y){let le=Z+Y*P;if(le>=0&&le<d){let ge=p[H][ie][le][te]+u[pe][Y][te];ge>re&&(re=ge,se=pe,ae=Y)}}}B[se][ae][te]+=$[H][G][ee][te]}}}return{dataId:l.write(S.toTypedArray(B,o.dtype),n.shape,n.dtype),shape:n.shape,dtype:n.dtype}}};var YK={kernelName:ch,backendName:"cpu",kernelFunc:({inputs:e,backend:t,attrs:r})=>{let{x:o,filter:n,dy:a}=e,{strides:i,pad:s,dilations:c}=r,l=t,p=S.toNestedArray(o.shape,l.data.get(o.dataId).values),u=S.toNestedArray(n.shape,l.data.get(n.dataId).values),{batchSize:m,inHeight:f,inWidth:d,inChannels:h,outHeight:y,outWidth:g,padInfo:b,strideHeight:x,strideWidth:w,filterHeight:I,filterWidth:C,dilationHeight:R,dilationWidth:P,outShape:z}=M.computeDilation2DInfo(o.shape,n.shape,i,s,"NHWC",c);S.assert(a.rank===z.length,()=>`Error in ${ch}, dy must have the same rank as output ${z.length}, but got ${a.rank}`);let $=S.toNestedArray(z,l.data.get(a.dataId).values),B=S.makeZerosNestedTypedArray(o.shape,o.dtype);for(let H=0;H<m;++H)for(let G=0;G<y;++G){let X=G*x-b.top;for(let ee=0;ee<g;++ee){let Z=ee*w-b.left;for(let te=0;te<h;++te){let re=Number.MIN_SAFE_INTEGER,se=X<0?0:X,ae=Z<0?0:Z;for(let pe=0;pe<I;++pe){let ie=X+pe*R;if(ie>=0&&ie<f)for(let Y=0;Y<C;++Y){let le=Z+Y*P;if(le>=0&&le<d){let ge=p[H][ie][le][te]+u[pe][Y][te];ge>re&&(re=ge,se=ie,ae=le)}}}B[H][se][ae][te]+=$[H][G][ee][te]}}}return{dataId:l.write(S.toTypedArray(B,o.dtype),o.shape,o.dtype),shape:o.shape,dtype:o.dtype}}};function Tke(e){let{inputs:t,backend:r,attrs:o}=e,{image:n}=t,{canvas:a,options:i}=o,{contextOptions:s,imageOptions:c}=i||{},l=c?.alpha||1,p=s?.contextType||"2d";if(p!=="2d")throw new Error(`Context type ${s.contextType} is not supported by the CPU backend.`);let u=a.getContext(p,s?.contextAttributes||{});if(u==null)throw new Error(`Could not get the context with ${p} type.`);let[m,f]=n.shape.slice(0,2),d=n.shape.length===2?1:n.shape[2],h=r.data.get(n.dataId).values,y=n.dtype==="float32"?255:1,g=new Uint8ClampedArray(f*m*4);for(let x=0;x<m*f;++x){let w=[0,0,0,255*l];for(let C=0;C<d;C++){let R=h[x*d+C];if(n.dtype==="float32"){if(R<0||R>1)throw new Error(`Tensor values for a float32 Tensor must be in the range [0 - 1] but encountered ${R}.`)}else if(n.dtype==="int32"&&(R<0||R>255))throw new Error(`Tensor values for a int32 Tensor must be in the range [0 - 255] but encountered ${R}.`);d===1?(w[0]=R*y,w[1]=R*y,w[2]=R*y):w[C]=R*y}let I=x*4;g[I+0]=Math.round(w[0]),g[I+1]=Math.round(w[1]),g[I+2]=Math.round(w[2]),g[I+3]=Math.round(w[3])}a.width=f,a.height=m;let b=new ImageData(g,f,m);return u.putImageData(b,0,0),n}var QK={kernelName:Zv,backendName:"cpu",kernelFunc:Tke};function Bs(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,{axis:a,keepDims:i}=o;ne(n,"sum");let s;n.dtype==="bool"?s=Ia({inputs:{x:n},backend:r,attrs:{dtype:"int32"}}):s=xo({inputs:{x:n},backend:r});let c=s.shape.length,l=S.parseAxisParam(a,s.shape),p=M.getAxesPermutation(l,c),u=l,m=s;p!=null&&(m=ar({inputs:{x:s},backend:r,attrs:{perm:p}}),u=M.getInnerMostAxes(u.length,c)),M.assertAxesAreInnerMostDims("sum",u,m.shape.length);let[f,d]=M.computeOutAndReduceShapes(m.shape,u),h=M.upcastType(m.dtype,"int32"),y=rg(r,f,h),g=S.sizeFromShape(d),b=r.data.get(y.dataId).values,x=r.data.get(m.dataId).values;for(let w=0;w<b.length;++w){let I=w*g,C=0;for(let R=0;R<g;++R)C+=x[I+R];b[w]=C}if(i){let w=M.expandShapeToKeepDim(y.shape,l),I=y;y=st({inputs:{x:y},backend:r,attrs:{shape:w}}),r.disposeIntermediateTensorInfo(I)}return r.disposeIntermediateTensorInfo(s),p!=null&&r.disposeIntermediateTensorInfo(m),y}var JK={kernelName:rm,backendName:"cpu",kernelFunc:Bs};function Cke(e){let{inputs:t,backend:r,attrs:o}=e,{equation:n}=o,a=t,{allDims:i,summedDims:s,idDims:c}=M.decodeEinsumEquation(n,a.length);M.checkEinsumDimSizes(i.length,c,a);let{path:l,steps:p}=M.getEinsumComputePath(s,c),u=p.length,m=null,f=i.length,d=[];for(let h=0;h<u;++h){for(let y of p[h]){let{permutationIndices:g,expandDims:b}=M.getEinsumPermutation(f,c[y]),x;M.isIdentityPermutation(g)?x=a[y]:(x=ar({inputs:{x:a[y]},backend:r,attrs:{perm:g}}),d.push(x));let w=x.shape.slice();for(let I=0;I<b.length;++I)w.splice(b[I],0,1);S.arraysEqual(x.shape,w)||(x=st({inputs:{x},backend:r,attrs:{shape:w}}),d.push(x)),m===null?m=x:(m=zm({inputs:{a:x,b:m},backend:r}),d.push(m))}h<u-1&&(l[h]>=0&&(m=Bs({inputs:{x:m},backend:r,attrs:{axis:l[h]-(i.length-f),keepDims:!1}}),d.push(m)),f--)}for(let h of d)h!==m&&r.disposeIntermediateTensorInfo(h);return m}var ZK={kernelName:A1,backendName:"cpu",kernelFunc:Cke};function Nke(e){let{inputs:t,backend:r}=e,{dy:o,y:n}=t;ne([o,n],"eluGrad");let a=new Float32Array(S.sizeFromShape(n.shape)),i=r.data.get(n.dataId).values,s=r.data.get(o.dataId).values;for(let c=0;c<i.length;++c){let l=i[c];l>=0?a[c]=s[c]:a[c]=s[c]*(l+1)}return r.makeTensorInfo(n.shape,"float32",a)}var eX={kernelName:eb,backendName:"cpu",kernelFunc:Nke};var Ake=M.ERF_P,Rke=M.ERF_A1,Dke=M.ERF_A2,Fke=M.ERF_A3,Mke=M.ERF_A4,Oke=M.ERF_A5,Pke=Oe(Xp,e=>{let t=Math.sign(e),r=Math.abs(e),o=1/(1+Ake*r);return t*(1-((((Oke*o+Mke)*o+Fke)*o+Dke)*o+Rke)*o*Math.exp(-r*r))}),tX={kernelName:Xp,backendName:"cpu",kernelFunc:Pke};function fg(e){let{inputs:t,backend:r,attrs:o}=e,{input:n}=t,{dim:a}=o,i=n.shape.length,s=n.shape.slice(),c=a;return a<0&&(S.assert(-(i+1)<=a,()=>`Axis must be in the interval [${-(i+1)}, ${i}]`),c=i+a+1),s.splice(c,0,1),st({inputs:{x:n},backend:r,attrs:{shape:s}})}var rX={kernelName:uh,backendName:"cpu",kernelFunc:fg};var zke=it((e,t)=>e/t),Ob=ht(qp,zke),Pb={kernelName:qp,backendName:"cpu",kernelFunc:Ob};function Wk(e,t,r){let o=e.shape,n=o[0],a=o[1],i=r.data.get(e.dataId),s=i.complexTensorInfos.real,c=i.complexTensorInfos.imag,l=[n,a],p=S.sizeFromShape(l),u=S.getTypedArrayFromDType("float32",p),m=S.getTypedArrayFromDType("float32",p);for(let y=0;y<n;y++){let g=Ca({inputs:{x:s},backend:r,attrs:{begin:[y,0],size:[1,a]}}),b=Ca({inputs:{x:c},backend:r,attrs:{begin:[y,0],size:[1,a]}}),x=qr({inputs:{real:g,imag:b},backend:r}),{real:w,imag:I}=$ke(x,t,r),C=M.mergeRealAndImagArrays(w,I);for(let R=0;R<a;R++){let P=M.getComplexWithIndex(C,R);u[y*a+R]=P.real,m[y*a+R]=P.imag}r.disposeIntermediateTensorInfo(g),r.disposeIntermediateTensorInfo(b),r.disposeIntermediateTensorInfo(x)}let f=r.makeTensorInfo(l,"float32",u),d=r.makeTensorInfo(l,"float32",m),h=qr({inputs:{real:f,imag:d},backend:r});return r.disposeIntermediateTensorInfo(f),r.disposeIntermediateTensorInfo(d),h}function $ke(e,t,r){let o=S.sizeFromShape(e.shape),n=r.data.get(e.dataId),a=r.data.get(n.complexTensorInfos.real.dataId).values,i=r.data.get(n.complexTensorInfos.imag.dataId).values;if(Lke(o)){let s=bR(a,i,o,t,r),c=[e.shape[0],e.shape[1]];if(t){let l=r.makeTensorInfo(c,"float32",s.real),p=r.makeTensorInfo(c,"float32",s.imag),u=r.makeTensorInfo([],"float32",S.createScalarValue(o,"float32")),m=xo({inputs:{x:u},backend:r}),f=Pb.kernelFunc({inputs:{a:l,b:u},backend:r}),d=Pb.kernelFunc({inputs:{a:p,b:m},backend:r}),h=r.data.get(f.dataId).values,y=r.data.get(d.dataId).values;return r.disposeIntermediateTensorInfo(l),r.disposeIntermediateTensorInfo(p),r.disposeIntermediateTensorInfo(u),r.disposeIntermediateTensorInfo(m),r.disposeIntermediateTensorInfo(f),r.disposeIntermediateTensorInfo(d),{real:h,imag:y}}return s}else{let s=M.mergeRealAndImagArrays(a,i),c=Bke(s,o,t);return M.splitRealAndImagArrays(c)}}function Lke(e){return(e&e-1)===0}function bR(e,t,r,o,n){if(r===1)return{real:e,imag:t};let a=M.mergeRealAndImagArrays(e,t),i=r/2,s=M.complexWithEvenIndex(a),c=s.real,l=s.imag,p=[c.length],u=n.makeTensorInfo(p,"float32",c),m=n.makeTensorInfo(p,"float32",l),f=qr({inputs:{real:u,imag:m},backend:n}),d=M.complexWithOddIndex(a),h=d.real,y=d.imag,g=[h.length],b=n.makeTensorInfo(g,"float32",h),x=n.makeTensorInfo(g,"float32",y),w=qr({inputs:{real:b,imag:x},backend:n}),I=bR(c,l,i,o,n),C=I.real,R=I.imag,P=[C.length],z=n.makeTensorInfo(P,"float32",C),$=n.makeTensorInfo(P,"float32",R),B=qr({inputs:{real:z,imag:$},backend:n}),V=bR(h,y,i,o,n),H=V.real,G=V.imag,X=[H.length],ee=n.makeTensorInfo(X,"float32",H),Z=n.makeTensorInfo(X,"float32",G),te=qr({inputs:{real:ee,imag:Z},backend:n}),re=M.exponents(r,o),se=[re.real.length],ae=n.makeTensorInfo(se,"float32",re.real),pe=n.makeTensorInfo(se,"float32",re.imag),ie=qr({inputs:{real:ae,imag:pe},backend:n}),Y=zm({inputs:{a:ie,b:te},backend:n}),le=Hi({inputs:{a:B,b:Y},backend:n}),ge=Nb({inputs:{a:B,b:Y},backend:n}),ve=Ea({inputs:{input:le},backend:n}),Ee=Ea({inputs:{input:ge},backend:n}),Se=Vi({inputs:{input:le},backend:n}),Ve=Vi({inputs:{input:ge},backend:n}),Ge=sc({inputs:[ve,Ee],backend:n,attrs:{axis:0}}),Ye=sc({inputs:[Se,Ve],backend:n,attrs:{axis:0}}),Ze=n.data.get(Ge.dataId).values,Je=n.data.get(Ye.dataId).values;return n.disposeIntermediateTensorInfo(u),n.disposeIntermediateTensorInfo(m),n.disposeIntermediateTensorInfo(f),n.disposeIntermediateTensorInfo(b),n.disposeIntermediateTensorInfo(x),n.disposeIntermediateTensorInfo(w),n.disposeIntermediateTensorInfo(z),n.disposeIntermediateTensorInfo($),n.disposeIntermediateTensorInfo(B),n.disposeIntermediateTensorInfo(ee),n.disposeIntermediateTensorInfo(Z),n.disposeIntermediateTensorInfo(te),n.disposeIntermediateTensorInfo(ae),n.disposeIntermediateTensorInfo(pe),n.disposeIntermediateTensorInfo(ie),n.disposeIntermediateTensorInfo(Y),n.disposeIntermediateTensorInfo(le),n.disposeIntermediateTensorInfo(ge),n.disposeIntermediateTensorInfo(ve),n.disposeIntermediateTensorInfo(Se),n.disposeIntermediateTensorInfo(Ee),n.disposeIntermediateTensorInfo(Ve),n.disposeIntermediateTensorInfo(Ge),n.disposeIntermediateTensorInfo(Ye),{real:Ze,imag:Je}}function Bke(e,t,r){let o=new Float32Array(t*2);for(let n=0;n<t;n++){let a=0,i=0;for(let s=0;s<t;s++){let c=M.exponent(n*s,t,r),l=M.getComplexWithIndex(e,s);a+=l.real*c.real-l.imag*c.imag,i+=l.real*c.imag+l.imag*c.real}r&&(a/=t,i/=t),M.assignToTypedArray(o,a,i,n)}return o}function Uke(e){let{inputs:t,backend:r}=e,{input:o}=t,n=S.sizeFromShape(o.shape),a=o.shape[o.shape.length-1],i=n/a,s=st({inputs:{x:o},backend:r,attrs:{shape:[i,a]}}),c=Wk(s,!1,r),l=st({inputs:{x:c},backend:r,attrs:{shape:o.shape}});return r.disposeIntermediateTensorInfo(s),r.disposeIntermediateTensorInfo(c),l}var oX={kernelName:R1,backendName:"cpu",kernelFunc:Uke};function zb(e){let{backend:t,attrs:r}=e,{shape:o,value:n,dtype:a}=r,i=a||S.inferDtype(n),s=S.getArrayFromDType(i,S.sizeFromShape(o));return Wke(s,n,i),t.makeTensorInfo(o,i,s)}var nX={kernelName:mh,backendName:"cpu",kernelFunc:zb};function Wke(e,t,r){e.fill(t)}var aX={kernelName:Zp,backendName:"cpu",kernelFunc:({inputs:e,attrs:t,backend:r})=>{let{image:o}=e,n=r,a=S.getTypedArrayFromDType(o.dtype,S.sizeFromShape(o.shape)),[i,s,c,l]=o.shape,p=n.data.get(o.dataId).values;for(let m=0;m<i;m++){let f=m*c*s*l;for(let d=0;d<s;d++){let h=d*(c*l);for(let y=0;y<c;y++){let g=y*l;for(let b=0;b<l;b++){let x=Math.round(c-y-1),w=f+h+g+b,I=p[w];if(x>=0&&x<c){let C=x*l,R=f+h+C+b;I=p[R]}a[w]=I}}}}return{dataId:n.write(a,o.shape,o.dtype),shape:o.shape,dtype:o.dtype}}};function Hke(e){let{inputs:t,backend:r,attrs:o}=e,{x:n,filter:a,bias:i,preluActivationWeights:s}=t,{strides:c,pad:l,dataFormat:p,dilations:u,dimRoundingMode:m,activation:f,leakyreluAlpha:d}=o,h=yR({inputs:{x:n,filter:a},backend:r,attrs:{strides:c,pad:l,dataFormat:p,dilations:u,dimRoundingMode:m}});if(i){let y=h;if(p==="NCHW"&&i.shape.length===1&&i.shape[0]!==1){let g=st({inputs:{x:i},backend:r,attrs:{shape:[i.shape[0],1,1]}});h=Hi({inputs:{a:h,b:g},backend:r}),r.disposeIntermediateTensorInfo(g)}else h=Hi({inputs:{a:h,b:i},backend:r});r.disposeIntermediateTensorInfo(y)}if(f){let y=h;if(p==="NCHW"&&f==="prelu"&&s.shape.length===1&&s.shape[0]!==1){let g=st({inputs:{x:s},backend:r,attrs:{shape:[s.shape[0],1,1]}});h=$m(r,h,f,g,d),r.disposeIntermediateTensorInfo(g)}else h=$m(r,h,f,s,d);r.disposeIntermediateTensorInfo(y)}return h}var iX={kernelName:Vl,backendName:"cpu",kernelFunc:Hke};function Vke(e){let{inputs:t,backend:r,attrs:o}=e,{x:n,filter:a,bias:i,preluActivationWeights:s}=t,{strides:c,pad:l,dataFormat:p,dilations:u,dimRoundingMode:m,activation:f,leakyreluAlpha:d}=o,h=vR({inputs:{x:n,filter:a},backend:r,attrs:{strides:c,pad:l,dataFormat:p,dilations:u,dimRoundingMode:m}});if(i){let y=h;h=Hi({inputs:{a:h,b:i},backend:r}),r.disposeIntermediateTensorInfo(y)}if(f){let y=h;h=$m(r,h,f,s,d),r.disposeIntermediateTensorInfo(y)}return h}var sX={kernelName:jl,backendName:"cpu",kernelFunc:Vke};function jke(e){let{inputs:t,backend:r}=e,{params:o,indices:n}=t,a=S.sizeFromShape(o.shape),i=n.shape,s=i[i.length-1],[c,l,p,u]=M.prepareAndValidate(o,n);if(l===0)return r.makeTensorInfo(c,o.dtype,[]);let m=r.data.get(n.dataId).values,f=r.bufferSync(o),d=xH(m,f,o.dtype,l,s,p,u,o.shape,a);return r.makeTensorInfo(c,o.dtype,d.values)}var lX={kernelName:ou,backendName:"cpu",kernelFunc:jke};function Gke(e){let{inputs:t,backend:r,attrs:o}=e,{x:n,indices:a}=t,{axis:i,batchDims:s}=o;ne([n,a],"gatherV2");let c=S.parseAxisParam(i,n.shape)[0],l=r.data.get(a.dataId).values,p=n.shape[c];for(let w=0;w<l.length;++w){let I=l[w];S.assert(I<=p-1&&I>=0,()=>`GatherV2: the index value ${I} is not in [0, ${p-1}]`)}let u=s;s==null&&(u=0);let m=S.sizeFromShape(a.shape),f=M.segment_util.collectGatherOpShapeInfo(n,a,c,u),d=st({inputs:{x:n},backend:r,attrs:{shape:[f.batchSize,f.outerSize,f.dimSize,f.sliceSize]}}),h=st({inputs:{x:a},backend:r,attrs:{shape:[f.batchSize,m/f.batchSize]}}),y=[f.batchSize,f.outerSize,m/f.batchSize,f.sliceSize],g=r.bufferSync(h),b=r.bufferSync(d),x=wH(b,g,y);return r.disposeIntermediateTensorInfo(d),r.disposeIntermediateTensorInfo(h),r.makeTensorInfo(f.outputShape,x.dtype,x.values)}var cX={kernelName:fh,backendName:"cpu",kernelFunc:Gke};function qke(e){let{inputs:t,backend:r}=e,{input:o}=t,n=S.sizeFromShape(o.shape),a=o.shape[o.shape.length-1],i=n/a,s=st({inputs:{x:o},backend:r,attrs:{shape:[i,a]}}),c=Wk(s,!0,r),l=st({inputs:{x:c},backend:r,attrs:{shape:o.shape}});return r.disposeIntermediateTensorInfo(s),r.disposeIntermediateTensorInfo(c),l}var pX={kernelName:D1,backendName:"cpu",kernelFunc:qke};var Kke=Oe(iu,e=>Number.isFinite(e)?1:0,"bool"),uX={kernelName:iu,backendName:"cpu",kernelFunc:Kke};var Xke=Oe(su,e=>Math.abs(e)===1/0?1:0,"bool"),mX={kernelName:su,backendName:"cpu",kernelFunc:Xke};var Yke=Oe(lu,e=>Number.isNaN(e)?1:0,"bool"),fX={kernelName:lu,backendName:"cpu",kernelFunc:Yke};function Qke(e){let{backend:t,attrs:r}=e,{start:o,stop:n,num:a}=r,i=IH(o,n,a);return t.makeTensorInfo([i.length],"float32",i)}var dX={kernelName:mu,backendName:"cpu",kernelFunc:Qke};var Jke=Oe(du,e=>Math.log1p(e)),hX={kernelName:du,backendName:"cpu",kernelFunc:Jke};var Zke=it((e,t)=>e&&t),e_e=ht(hu,Zke,null,"bool"),gX={kernelName:hu,backendName:"cpu",kernelFunc:e_e};var t_e=Oe(gu,e=>e?0:1,"bool"),yX={kernelName:gu,backendName:"cpu",kernelFunc:t_e};var r_e=it((e,t)=>e||t),o_e=ht(yu,r_e,null,"bool"),vX={kernelName:yu,backendName:"cpu",kernelFunc:o_e};function n_e(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,{depthRadius:a,bias:i,alpha:s,beta:c}=o;ne(n,"LRN");let l=n.shape[3],p=l-1,u=r.data.get(n.dataId).values,m=S.sizeFromShape(n.shape),f=new Float32Array(m);function d(h){let y=h%l,g=h-y+Math.max(0,y-a),b=h-y+Math.min(y+a,p),x=0;for(;g<=b;g++){let w=u[g];x+=w*w}return x}for(let h=0;h<m;h++){let y=d(h),g=u[h]*Math.pow(i+s*y,-c);f[h]=g}return r.makeTensorInfo(n.shape,n.dtype,f)}var bX={kernelName:vu,backendName:"cpu",kernelFunc:n_e};function a_e(e){let{inputs:t,backend:r,attrs:o}=e,{x:n,y:a,dy:i}=t,{depthRadius:s,bias:c,alpha:l,beta:p}=o;ne(i,"LRNGrad");let u=S.sizeFromShape(i.shape),m=i.shape[3],f=r.data.get(i.dataId).values,d=r.data.get(n.dataId).values,h=r.data.get(a.dataId).values,y=new Float32Array(u),g=u;for(let b=0;b<g;b++){let x=b%m,w=b-x+Math.max(0,x-s),I=b-x+Math.min(m,x+s+1),C=0;for(let R=w;R<I;R++)C+=Math.pow(d[R],2);C=l*C+c;for(let R=w;R<I;R++){let P=-2*l*p*d[R]*h[b]/C;b===R&&(P+=Math.pow(C,-p)),P*=f[b],y[R]+=P}}return r.makeTensorInfo(i.shape,n.dtype,y)}var xX={kernelName:tb,backendName:"cpu",kernelFunc:a_e};function xR(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,{reductionIndices:a,keepDims:i}=o,s=r,c=n.shape,l=c.length,p=S.parseAxisParam(a,c),u=p,m=M.getAxesPermutation(u,l),f=s.data.get(n.dataId).values;if(m!=null){let w=new Array(l);for(let I=0;I<w.length;I++)w[I]=c[m[I]];f=Rk(f,c,n.dtype,m,w),u=M.getInnerMostAxes(u.length,l),c=w}ne(n,"max"),M.assertAxesAreInnerMostDims("max",u,l);let[d,h]=M.computeOutAndReduceShapes(c,u),y=S.sizeFromShape(h),g=CH(f,y,d,n.dtype),b=s.write(g,d,n.dtype),x=d;return i&&(x=M.expandShapeToKeepDim(d,p)),{dataId:b,shape:x,dtype:n.dtype}}var wX={kernelName:bu,backendName:"cpu",kernelFunc:xR};function i_e(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t;ne(n,"maxPool");let{filterSize:a,strides:i,pad:s,dimRoundingMode:c}=o,l=1;S.assert(M.eitherStridesOrDilationsAreOne(i,l),()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${i} and dilations '${l}'`);let p=M.computePool2DInfo(n.shape,a,i,l,s,c),u;if(p.filterWidth===1&&p.filterHeight===1&&S.arraysEqual(p.inShape,p.outShape))u=xo({inputs:{x:n},backend:r});else{let m=r.data.get(n.dataId).values,f=S.computeStrides(n.shape),d=mg(m,n.shape,n.dtype,f,p,"max");u=r.makeTensorInfo(p.outShape,n.dtype,d.values)}return u}var SX={kernelName:wu,backendName:"cpu",kernelFunc:i_e};function s_e(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,{filterSize:a,strides:i,pad:s,dimRoundingMode:c,dataFormat:l}=o;ne(n,"maxPool3d");let p=M.computePool3DInfo(n.shape,a,i,1,s,c,l),u=r.data.get(n.dataId).values,m=Uk(u,n.shape,n.dtype,S.computeStrides(n.shape),p,"max");return r.makeTensorInfo(m.shape,"float32",m.values)}var kX={kernelName:dh,backendName:"cpu",kernelFunc:s_e};function l_e(e){let{inputs:t,backend:r,attrs:o}=e,{dy:n,input:a}=t,{filterSize:i,strides:s,pad:c,dimRoundingMode:l}=o;ne([n,a],"maxPool3DGrad");let p=M.computePool3DInfo(a.shape,i,s,1,c,l),u=r.bufferSync(a),m=vK(u,p),f=p.strideDepth,d=p.strideHeight,h=p.strideWidth,y=p.dilationDepth,g=p.dilationHeight,b=p.dilationWidth,x=p.effectiveFilterDepth,w=p.effectiveFilterHeight,I=p.effectiveFilterWidth,C=x-1-p.padInfo.front,R=I-1-p.padInfo.left,P=w-1-p.padInfo.top,z=Re(a.shape,"float32"),$=r.bufferSync(n);for(let B=0;B<p.batchSize;++B)for(let V=0;V<p.inChannels;++V)for(let H=0;H<p.inDepth;++H)for(let G=0;G<p.inHeight;++G)for(let X=0;X<p.inWidth;++X){let ee=H-C,Z=G-P,te=X-R,re=0;for(let se=0;se<x;se+=y){let ae=(ee+se)/f;if(!(ae<0||ae>=p.outDepth||Math.floor(ae)!==ae))for(let pe=0;pe<w;pe+=g){let ie=(Z+pe)/d;if(!(ie<0||ie>=p.outHeight||Math.floor(ie)!==ie))for(let Y=0;Y<I;Y+=b){let le=(te+Y)/h;if(le<0||le>=p.outWidth||Math.floor(le)!==le)continue;let ge=x*w*I-1-m.get(B,ae,ie,le,V),ve=se*w*I+pe*I+Y,Ee=ge===ve?1:0;if(Ee===0)continue;let Se=$.get(B,ae,ie,le,V);re+=Se*Ee}}}z.set(re,B,H,G,X,V)}return r.makeTensorInfo(z.shape,z.dtype,z.values)}var _X={kernelName:O1,backendName:"cpu",kernelFunc:l_e};function c_e(e){let{inputs:t,backend:r,attrs:o}=e,{dy:n,input:a,output:i}=t,s=a;ne([a,i],"maxPoolGrad");let{filterSize:c,strides:l,pad:p,dimRoundingMode:u}=o,m=M.computePool2DInfo(s.shape,c,l,1,p,u),f=r.data.get(s.dataId).values,d=Re(m.outShape,s.dtype,Bk(f,s.shape,s.dtype,m).values),h=m.strideHeight,y=m.strideWidth,g=m.dilationHeight,b=m.dilationWidth,x=m.effectiveFilterHeight,w=m.effectiveFilterWidth,I=w-1-m.padInfo.left,C=x-1-m.padInfo.top,R=Re(s.shape,"float32"),P=r.data.get(n.dataId).values,z=Re(n.shape,"float32",P);for(let $=0;$<m.batchSize;++$)for(let B=0;B<m.inChannels;++B)for(let V=0;V<m.inHeight;++V)for(let H=0;H<m.inWidth;++H){let G=V-C,X=H-I,ee=0;for(let Z=0;Z<x;Z+=g){let te=(G+Z)/h;if(!(te<0||te>=m.outHeight||Math.floor(te)!==te))for(let re=0;re<w;re+=b){let se=(X+re)/y;if(se<0||se>=m.outWidth||Math.floor(se)!==se)continue;let ae=x*w-1-d.get($,te,se,B),pe=Z*w+re,ie=ae===pe?1:0;if(ie===0)continue;let Y=z.get($,te,se,B);ee+=Y*ie}}R.set(ee,$,V,H,B)}return r.makeTensorInfo(R.shape,R.dtype,R.values)}var EX={kernelName:M1,backendName:"cpu",kernelFunc:c_e};function IX(e,t,r,o,n){let a=S.computeStrides(t),i=mg(e,t,r,a,n,"max"),s=Bk(e,t,r,n,!0,o);return[i.values,s.values]}var TX={kernelName:hh,backendName:"cpu",kernelFunc:({inputs:e,attrs:t,backend:r})=>{let{x:o}=e,{filterSize:n,strides:a,pad:i,includeBatchInIndex:s}=t,c=r;ne(o,"MaxPoolWithArgmax");let l=c.data.get(o.dataId).values,p=M.computePool2DInfo(o.shape,n,a,[1,1],i),[u,m]=IX(l,o.shape,o.dtype,s,p),f=c.write(u,p.outShape,o.dtype),d=c.write(m,p.outShape,o.dtype);return[{dataId:f,shape:p.outShape,dtype:o.dtype},{dataId:d,shape:p.outShape,dtype:"int32"}]}};function p_e(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,{axis:a,keepDims:i}=o,s=S.parseAxisParam(a,n.shape),l=M.computeOutAndReduceShapes(n.shape,s)[1],p=S.sizeFromShape(l),u=[],m=r.makeTensorInfo([],"float32",new Float32Array([p]));u.push(m);let f=Ia({inputs:{x:n},backend:r,attrs:{dtype:"float32"}});u.push(f);let d=Ob({inputs:{a:f,b:m},backend:r});u.push(d);let h=Bs({inputs:{x:d},backend:r,attrs:{axis:a,keepDims:i}});return u.forEach(y=>r.disposeIntermediateTensorInfo(y)),h}var CX={kernelName:Su,backendName:"cpu",kernelFunc:p_e};function u_e(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,{axis:a,keepDims:i}=o;ne(n,"min");let s=S.parseAxisParam(a,n.shape),c=s,l=M.getAxesPermutation(c,n.shape.length),p=n;l!=null&&(p=ar({inputs:{x:n},backend:r,attrs:{perm:l}}),c=M.getInnerMostAxes(c.length,n.shape.length)),M.assertAxesAreInnerMostDims("min",c,p.shape.length);let[u,m]=M.computeOutAndReduceShapes(p.shape,c),f=S.sizeFromShape(m),d=S.makeZerosTypedArray(S.sizeFromShape(u),p.dtype),h=r.data.get(p.dataId).values;for(let g=0;g<d.length;++g){let b=g*f,x=h[b];for(let w=0;w<f;++w){let I=h[b+w];(Number.isNaN(I)||I<x)&&(x=I)}d[g]=x}l!=null&&r.disposeIntermediateTensorInfo(p);let y=r.makeTensorInfo(u,p.dtype,d);if(i){let g=M.expandShapeToKeepDim(u,s),b=st({inputs:{x:y},backend:r,attrs:{shape:g}});return r.disposeIntermediateTensorInfo(y),b}return y}var NX={kernelName:ku,backendName:"cpu",kernelFunc:u_e};function m_e(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,{paddings:a,mode:i}=o;ne(n,"mirrorPad");let s=a.map((x,w)=>x[0]+n.shape[w]+x[1]),c=a.map(x=>x[0]),l=a.map((x,w)=>x[0]+n.shape[w]),p=i==="reflect"?0:1,u=r.data.get(n.dataId).values,m=n.shape.length,f=S.computeStrides(n.shape),d=S.sizeFromShape(s),h=s.length,y=S.computeStrides(s),g=S.getTypedArrayFromDType(n.dtype,d);for(let x=0;x<d;x++){let w=S.indexToLoc(x,h,y);for(let C=0;C<h;C++)w[C]<c[C]?w[C]=c[C]*2-w[C]-p:w[C]>=l[C]&&(w[C]=(l[C]-1)*2-w[C]+p);w=w.map((C,R)=>C-c[R]);let I=S.locToIndex(w,m,f);g[x]=u[I]}return{dataId:r.write(g,s,n.dtype),shape:s,dtype:n.dtype}}var AX={kernelName:Eu,backendName:"cpu",kernelFunc:m_e};var f_e=it((e,t)=>{let r=e%t;return e<0&&t<0||e>=0&&t>=0?r:(r+t)%t}),d_e=ht(Iu,f_e),RX={kernelName:Iu,backendName:"cpu",kernelFunc:d_e};var FX=Ie(J3());function wR(e){let{inputs:t,backend:r,attrs:o}=e,{logits:n}=t,{dim:a}=o,i=n.shape.length,s=a;if(s===-1&&(s=i-1),s!==i-1)throw Error(`Softmax along a non-last dimension is not yet supported. Logits was rank ${i} and dim was ${s}`);let c=S.parseAxisParam([s],n.shape),l=xR({inputs:{x:n},backend:r,attrs:{reductionIndices:c,keepDims:!1}}),p=M.expandShapeToKeepDim(l.shape,c),u=st({inputs:{x:l},backend:r,attrs:{shape:p}}),m=Nb({inputs:{a:n,b:u},backend:r}),f=HA({inputs:{x:m},backend:r}),d=Bs({inputs:{x:f},backend:r,attrs:{axis:c,keepDims:!1}}),h=st({inputs:{x:d},backend:r,attrs:{shape:p}}),y=Ob({inputs:{a:f,b:h},backend:r});return r.disposeIntermediateTensorInfo(l),r.disposeIntermediateTensorInfo(u),r.disposeIntermediateTensorInfo(m),r.disposeIntermediateTensorInfo(f),r.disposeIntermediateTensorInfo(d),r.disposeIntermediateTensorInfo(h),y}var DX={kernelName:om,backendName:"cpu",kernelFunc:wR};function h_e(e){let{inputs:t,backend:r,attrs:o}=e,{logits:n}=t,{numSamples:a,seed:i,normalized:s}=o;ne(n,"multinomial");let c=s?n:wR({inputs:{logits:n},backend:r,attrs:{dim:-1}}),l=c.shape[0],p=c.shape[1],u=r.data.get(c.dataId).values,m=[l,a],f=S.makeZerosTypedArray(S.sizeFromShape(m),"int32");for(let d=0;d<l;++d){let h=d*p,y=new Float32Array(p-1);y[0]=u[h];for(let x=1;x<y.length;++x)y[x]=y[x-1]+u[h+x];let g=FX.alea(i.toString()),b=d*a;for(let x=0;x<a;++x){let w=g();f[b+x]=y.length;for(let I=0;I<y.length;I++)if(w<y[I]){f[b+x]=I;break}}}return s||r.disposeIntermediateTensorInfo(c),r.makeTensorInfo(m,"int32",f)}var MX={kernelName:Tu,backendName:"cpu",kernelFunc:h_e};var g_e=Wi.nonMaxSuppressionV3Impl;function y_e(e){let{inputs:t,backend:r,attrs:o}=e,{boxes:n,scores:a}=t,{maxOutputSize:i,iouThreshold:s,scoreThreshold:c}=o;ne(n,"NonMaxSuppression");let l=r.data.get(n.dataId).values,p=r.data.get(a.dataId).values,{selectedIndices:u}=g_e(l,p,i,s,c);return r.makeTensorInfo([u.length],"int32",new Int32Array(u))}var OX={kernelName:Au,backendName:"cpu",kernelFunc:y_e};var v_e=Wi.nonMaxSuppressionV4Impl;function b_e(e){let{inputs:t,backend:r,attrs:o}=e,{boxes:n,scores:a}=t,{maxOutputSize:i,iouThreshold:s,scoreThreshold:c,padToMaxOutputSize:l}=o;ne(n,"NonMaxSuppressionPadded");let p=r.data.get(n.dataId).values,u=r.data.get(a.dataId).values,{selectedIndices:m,validOutputs:f}=v_e(p,u,i,s,c,l);return[r.makeTensorInfo([m.length],"int32",new Int32Array(m)),r.makeTensorInfo([],"int32",new Int32Array([f]))]}var PX={kernelName:Ru,backendName:"cpu",kernelFunc:b_e};var x_e=Wi.nonMaxSuppressionV5Impl;function w_e(e){let{inputs:t,backend:r,attrs:o}=e,{boxes:n,scores:a}=t,{maxOutputSize:i,iouThreshold:s,scoreThreshold:c,softNmsSigma:l}=o;ne(n,"NonMaxSuppressionWithScore");let p=r.data.get(n.dataId).values,u=r.data.get(a.dataId).values,m=i,f=s,d=c,h=l,{selectedIndices:y,selectedScores:g}=x_e(p,u,m,f,d,h);return[r.makeTensorInfo([y.length],"int32",new Int32Array(y)),r.makeTensorInfo([g.length],"float32",new Float32Array(g))]}var zX={kernelName:Du,backendName:"cpu",kernelFunc:w_e};function S_e(e){let{inputs:t,backend:r,attrs:o}=e,{indices:n}=t,{dtype:a,depth:i,onValue:s,offValue:c}=o;ne(n,"oneHot");let l=S.sizeFromShape(n.shape),p=new Float32Array(l*i);p.fill(c);let u=r.data.get(n.dataId).values;for(let m=0;m<l;++m)u[m]>=0&&u[m]<i&&(p[m*i+u[m]]=s);return r.makeTensorInfo([...n.shape,i],a,p)}var $X={kernelName:Fu,backendName:"cpu",kernelFunc:S_e};function $b(e){let{inputs:t,backend:r}=e,{x:o}=t;if(o.dtype==="string")throw new Error("zerosLike is not supported for string tensors");if(o.dtype==="complex64"){let n=Ea({inputs:{input:o},backend:r}),a=$b({inputs:{x:n},backend:r}),i=Vi({inputs:{input:o},backend:r}),s=$b({inputs:{x:i},backend:r}),c=qr({inputs:{real:a,imag:s},backend:r});return r.disposeIntermediateTensorInfo(n),r.disposeIntermediateTensorInfo(a),r.disposeIntermediateTensorInfo(i),r.disposeIntermediateTensorInfo(s),c}else return zb({backend:r,attrs:{shape:o.shape,value:0,dtype:o.dtype}})}var LX={kernelName:Fh,backendName:"cpu",kernelFunc:$b};function BX(e){let{inputs:t,backend:r}=e,{x:o}=t;if(o.dtype==="string")throw new Error("onesLike is not supported for string tensors");if(o.dtype==="complex64"){let n=Ea({inputs:{input:o},backend:r}),a=BX({inputs:{x:n},backend:r}),i=Vi({inputs:{input:o},backend:r}),s=$b({inputs:{x:i},backend:r}),c=qr({inputs:{real:a,imag:s},backend:r});return r.disposeIntermediateTensorInfo(n),r.disposeIntermediateTensorInfo(a),r.disposeIntermediateTensorInfo(i),r.disposeIntermediateTensorInfo(s),c}else return zb({backend:r,attrs:{shape:o.shape,value:1,dtype:o.dtype}})}var UX={kernelName:yh,backendName:"cpu",kernelFunc:BX};function SR(e){let{inputs:t,backend:r,attrs:o}=e,{axis:n}=o;if(t.length===1)return fg({inputs:{input:t[0]},backend:r,attrs:{dim:n}});let a=t[0].shape,i=t[0].dtype;t.forEach(p=>{S.assertShapesMatch(a,p.shape,"All tensors passed to stack must have matching shapes"),S.assert(i===p.dtype,()=>"All tensors passed to stack must have matching dtypes")});let s=[],c=t.map(p=>{let u=fg({inputs:{input:p},backend:r,attrs:{dim:n}});return s.push(u),u}),l=sc({inputs:c,backend:r,attrs:{axis:n}});return s.forEach(p=>r.disposeIntermediateTensorInfo(p)),l}var WX={kernelName:vh,backendName:"cpu",kernelFunc:SR};function k_e(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,{paddings:a,constantValue:i}=o;ne(n,"pad");let s=a.map((b,x)=>b[0]+n.shape[x]+b[1]),c=a.map(b=>b[0]),l=r.data.get(n.dataId).values,p=S.sizeFromShape(n.shape),u=n.shape.length,m=S.computeStrides(n.shape),f=S.sizeFromShape(s),d=s.length,h=S.computeStrides(s),y=S.getTypedArrayFromDType(n.dtype,f);i!==0&&y.fill(i);for(let b=0;b<p;b++){let w=S.indexToLoc(b,u,m).map((C,R)=>C+c[R]),I=S.locToIndex(w,d,h);y[I]=l[b]}return{dataId:r.write(y,s,n.dtype),shape:s,dtype:n.dtype}}var Hk={kernelName:Mu,backendName:"cpu",kernelFunc:k_e};var __e=it((e,t)=>Math.pow(e,t)),E_e=ht(Ou,__e),HX={kernelName:Ou,backendName:"cpu",kernelFunc:E_e};function I_e(e){let{inputs:t,backend:r,attrs:o}=e,{paramsNestedSplits:n,paramsDenseValues:a,indices:i}=t,{outputRaggedRank:s}=o,c=n.map(g=>r.data.get(g.dataId).values),l=n.map(g=>g.shape),p=r.data.get(a.dataId).values,u=r.data.get(i.dataId).values,[m,f,d]=zH(c,l,p,a.shape,a.dtype,u,i.shape,s),h=m.map(g=>r.makeTensorInfo([g.length],"int32",g)),y=r.makeTensorInfo(d,a.dtype,f);return h.concat([y])}var VX={kernelName:P1,backendName:"cpu",kernelFunc:I_e};function T_e(e){let{inputs:t,backend:r}=e,{starts:o,limits:n,deltas:a}=t,i=r.data.get(o.dataId).values,s=r.data.get(n.dataId).values,c=r.data.get(a.dataId).values,[l,p]=LH(i,o.shape,o.dtype,s,n.shape,c,a.shape),u=r.makeTensorInfo([l.length],"int32",l),m=r.makeTensorInfo([p.length],o.dtype,p);return[u,m]}var jX={kernelName:z1,backendName:"cpu",kernelFunc:T_e};function C_e(e){let{inputs:t,backend:r,attrs:o}=e,{shape:n,values:a,defaultValue:i,rowPartitionTensors:s}=t,{rowPartitionTypes:c}=o,l=r.data.get(n.dataId).values,p=r.data.get(a.dataId).values,u=r.data.get(i.dataId).values,m=s.map(y=>r.data.get(y.dataId).values),f=s.map(y=>y.shape),[d,h]=WH(l,n.shape,p,a.shape,a.dtype,u,i.shape,m,f,c);return r.makeTensorInfo(d,a.dtype,h)}var GX={kernelName:$1,backendName:"cpu",kernelFunc:C_e};function N_e(e){let{backend:t,attrs:r}=e,{start:o,stop:n,dtype:a,step:i}=r,s=ag(o,n,i,a);return t.makeTensorInfo([s.length],a,s)}var qX={kernelName:bh,backendName:"cpu",kernelFunc:N_e};var A_e=Oe($u,e=>1/e),KX={kernelName:$u,backendName:"cpu",kernelFunc:A_e};function R_e(e){let{inputs:t,backend:r,attrs:o}=e,{images:n}=t,{alignCorners:a,halfPixelCenters:i,size:s}=o;ne(n,"resizeBilinear");let c=S.computeStrides(n.shape),[l,p]=s,[u,m,f,d]=n.shape,h=r.data.get(n.dataId).values,y=new Float32Array(S.sizeFromShape([u,l,p,d])),g=[a&&l>1?m-1:m,a&&p>1?f-1:f],b=[a&&l>1?l-1:l,a&&p>1?p-1:p],x=0,w=g[0]/b[0],I=g[1]/b[1];for(let C=0;C<u;C++)for(let R=0;R<l;R++){let P;i?P=w*(R+.5)-.5:P=w*R;let z=Math.max(0,Math.floor(P)),$=P-z,B=Math.min(m-1,Math.ceil(P)),V=C*c[0]+z*c[1],H=C*c[0]+B*c[1];for(let G=0;G<p;G++){let X;i?X=I*(G+.5)-.5:X=I*G;let ee=Math.max(0,Math.floor(X)),Z=X-ee,te=Math.min(f-1,Math.ceil(X)),re=V+ee*c[2],se=H+ee*c[2],ae=V+te*c[2],pe=H+te*c[2];for(let ie=0;ie<d;ie++){let Y=h[re+ie],le=h[se+ie],ge=h[ae+ie],ve=h[pe+ie],Ee=Y+(ge-Y)*Z,Se=le+(ve-le)*Z,Ve=Ee+(Se-Ee)*$;y[x++]=Ve}}}return r.makeTensorInfo([u,l,p,d],"float32",y)}var XX={kernelName:Uu,backendName:"cpu",kernelFunc:R_e};function D_e(e){let{inputs:t,backend:r,attrs:o}=e,{images:n,dy:a}=t,{alignCorners:i}=o;ne([a,n],"resizeBilinearGrad");let s=S.computeStrides(n.shape),[c,l,p,u]=n.shape,[,m,f]=a.shape,d=new Float32Array(c*l*p*u),h=[i&&m>1?l-1:l,i&&f>1?p-1:p],y=[i&&m>1?m-1:m,i&&f>1?f-1:f],g=h[0]/y[0],b=h[1]/y[1],x=r.data.get(a.dataId).values,w=0;for(let I=0;I<c;I++){let C=I*s[0];for(let R=0;R<m;R++){let P=R*g,z=Math.floor(P),$=Math.min(Math.ceil(P),l-1),B=C+z*s[1],V=C+$*s[1],H=P-z,G=1-H;for(let X=0;X<f;X++){let ee=X*b,Z=Math.floor(ee),te=Math.min(Math.ceil(ee),p-1),re=ee-Z,se=1-re,ae=B+Z*s[2],pe=B+te*s[2],ie=V+Z*s[2],Y=V+te*s[2],le=G*se,ge=G*re,ve=H*se,Ee=H*re;for(let Se=0;Se<u;Se++){let Ve=x[w++];d[ae+Se]+=Ve*le,d[pe+Se]+=Ve*ge,d[ie+Se]+=Ve*ve,d[Y+Se]+=Ve*Ee}}}}return r.makeTensorInfo([c,p,l,u],"float32",d)}var YX={kernelName:ob,backendName:"cpu",kernelFunc:D_e};function F_e(e){let{inputs:t,backend:r,attrs:o}=e,{images:n}=t,{alignCorners:a,halfPixelCenters:i,size:s}=o;ne(n,"resizeNearestNeighbor");let c=S.computeStrides(n.shape),[l,p]=s,[u,m,f,d]=n.shape,h=r.data.get(n.dataId).values,y=new Float32Array(u*l*p*d),g=[a&&l>1?m-1:m,a&&p>1?f-1:f],b=[a&&l>1?l-1:l,a&&p>1?p-1:p],x=g[0]/b[0],w=g[1]/b[1],I=0;for(let C=0;C<u;C++){let R=C*c[0];for(let P=0;P<l;P++){let z=i?x*(P+.5):x*P,$=Math.min(m-1,a?Math.round(z):Math.floor(z));i&&($=Math.max(0,$));let B=R+$*c[1];for(let V=0;V<p;V++){let H=i?w*(V+.5):w*V,G=Math.min(f-1,a?Math.round(H):Math.floor(H));i&&(G=Math.max(0,G));let X=B+G*c[2];for(let ee=0;ee<d;ee++){let Z=h[X+ee];y[I++]=Z}}}}return r.makeTensorInfo([u,l,p,d],n.dtype,y)}var QX={kernelName:Bu,backendName:"cpu",kernelFunc:F_e};function M_e(e){let{inputs:t,backend:r,attrs:o}=e,{images:n,dy:a}=t,{alignCorners:i}=o;ne([a,n],"resizeNearestNeighborGrad");let s=S.computeStrides(n.shape),c=S.computeStrides(a.shape),[l,p,u,m]=n.shape,[,f,d]=a.shape,h=new Float32Array(l*p*u*m),y=r.data.get(a.dataId).values,g=[i&&f>1?p-1:p,i&&d>1?u-1:u],b=[i&&f>1?f-1:f,i&&d>1?d-1:d],x=g[0]/b[0],w=g[1]/b[1],I=1/x,C=1/w,R=Math.ceil(I)*2+2,P=Math.ceil(C)*2+2;for(let z=0;z<l;z++){let $=z*s[0];for(let B=0;B<p;B++){let V=$+B*s[1],H=Math.floor(B*I),G=Math.floor(H-R/2);for(let X=0;X<u;X++){let ee=V+X*s[2],Z=Math.floor(X*C),te=Math.floor(Z-P/2);for(let re=0;re<m;re++){let se=0;for(let ae=0;ae<R;ae++){let pe=ae+G;if(pe<0||pe>=f)continue;let ie=$+pe*c[1],Y=pe*x,le=Math.min(p-1,i?Math.round(Y):Math.floor(Y));if(B===le)for(let ge=0;ge<P;ge++){let ve=ge+te;if(ve<0||ve>=d)continue;let Ee=ie+ve*c[2],Se=ve*w,Ve=Math.min(u-1,i?Math.round(Se):Math.floor(Se));X===Ve&&(se+=y[Ee+re])}}h[ee+re]=se}}}}return r.makeTensorInfo(n.shape,n.dtype,h)}var JX={kernelName:rb,backendName:"cpu",kernelFunc:M_e};function O_e(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,{dims:a}=o;ne(n,"reverse");let i=n.shape.length,s=S.parseAxisParam(a,n.shape);if(i===0)return xo({inputs:{x:n},backend:r});let c=new Tt(n.shape,n.dtype),l=r.bufferSync(n);for(let p=0;p<c.size;p++){let u=c.indexToLoc(p),m=u.slice();s.forEach(f=>m[f]=n.shape[f]-1-m[f]),c.set(l.get(...m),...u)}return r.makeTensorInfo(c.shape,c.dtype,c.values)}var ZX={kernelName:Hu,backendName:"cpu",kernelFunc:O_e};var eY={kernelName:fm,backendName:"cpu",kernelFunc:({inputs:e,attrs:t,backend:r})=>{let{image:o}=e,{radians:n,fillValue:a,center:i}=t,s=r,c=S.getTypedArrayFromDType(o.dtype,S.sizeFromShape(o.shape)),[l,p,u,m]=o.shape,[f,d]=M.getImageCenter(i,p,u),h=255,y=Math.sin(n),g=Math.cos(n),b=s.data.get(o.dataId).values;for(let w=0;w<l;w++){let I=w*u*p*m;for(let C=0;C<p;C++){let R=C*(u*m);for(let P=0;P<u;P++){let z=P*m;for(let $=0;$<m;$++){let B=[l,C,P,$],V=B[2],H=B[1],G=(V-f)*g-(H-d)*y,X=(V-f)*y+(H-d)*g;G=Math.round(G+f),X=Math.round(X+d);let ee=a;if(typeof a!="number"&&($===3?ee=h:ee=a[$]),G>=0&&G<u&&X>=0&&X<p){let te=X*(u*m),re=G*m,se=I+te+re+$;ee=b[se]}let Z=I+R+z+$;c[Z]=ee}}}}return{dataId:s.write(c,o.shape,o.dtype),shape:o.shape,dtype:o.dtype}}};var P_e=Oe(Vu,e=>{let t=Math.floor(e);return e-t<.5?Math.floor(e):e-t>.5?Math.ceil(e):t%2===0?t:t+1}),tY={kernelName:Vu,backendName:"cpu",kernelFunc:P_e};function z_e(e){let{inputs:t,backend:r,attrs:o}=e,{indices:n,updates:a}=t,{shape:i}=o,{sliceRank:s,numUpdates:c,sliceSize:l,strides:p,outputSize:u}=M.calculateShapes(a,n,i),m=!0,f=r.bufferSync(n),d=r.bufferSync(a),h=Ls(f,d,i,u,l,c,s,p,0,m);return r.makeTensorInfo(i,h.dtype,h.values)}var rY={kernelName:Gu,backendName:"cpu",kernelFunc:z_e};function $_e(e,t){let r=0,o=e.length,n=0;for(;r<o;)n=Math.floor((r+o)/2),e[n]<t?r=n+1:o=n;return o}function L_e(e,t){let r=0,o=e.length,n=0;for(;r<o;)n=Math.floor((r+o)/2),e[n]<=t?r=n+1:o=n;return o}function oY(e,t,r,o,n,a){let i=S.getArrayFromDType("int32",r*n);for(let s=0;s<r;++s){let c=e.slice(s*o,(s+1)*o),l=s*n;for(let p=0;p<n;++p)i[l+p]=a==="left"?$_e(c,t[p+l]):L_e(c,t[p+l])}return i}function B_e(e){let{inputs:t,backend:r,attrs:o}=e,{sortedSequence:n,values:a}=t,{side:i}=o,s=r.data.get(n.dataId).values,c=r.data.get(a.dataId).values,l=oY(s,c,n.shape[0],n.shape[1],a.shape[1],i);return r.makeTensorInfo(a.shape,"int32",l)}var nY={kernelName:Ku,backendName:"cpu",kernelFunc:B_e};function U_e(e){let{inputs:t,backend:r}=e,{condition:o,t:n,e:a}=t;ne([o,n,a],"select");let i=o.shape.length,s=r.data.get(o.dataId).values,c=r.data.get(n.dataId).values,l=r.data.get(a.dataId).values,p=Xn(n.dtype,a.dtype),u=S.makeZerosTypedArray(S.sizeFromShape(n.shape),p),m=0,f=i===0||i>1||n.shape.length===1?1:S.sizeFromShape(n.shape.slice(1));for(let d=0;d<s.length;d++)for(let h=0;h<f;h++)s[d]===1?u[m++]=c[d]:u[m++]=l[d];return r.makeTensorInfo(n.shape,p,u)}var aY={kernelName:wh,backendName:"cpu",kernelFunc:U_e};var W_e=M.SELU_SCALEALPHA,H_e=M.SELU_SCALE,V_e=Oe(Xu,e=>e>=0?H_e*e:W_e*(Math.exp(e)-1)),iY={kernelName:Xu,backendName:"cpu",kernelFunc:V_e};var j_e=Oe(Ju,e=>e<0?-1:e>0?1:0),sY={kernelName:Ju,backendName:"cpu",kernelFunc:j_e};var G_e=Oe(Yu,e=>Math.sin(e)),lY={kernelName:Yu,backendName:"cpu",kernelFunc:G_e};var q_e=Oe(Qu,e=>Math.sinh(e)),cY={kernelName:Qu,backendName:"cpu",kernelFunc:q_e};var K_e=11920928955078125e-23,pY=Math.log(K_e)+2,X_e=Oe(em,e=>{let t=e>-pY,r=e<pY,o=Math.exp(e),n;return r?n=o:t?n=e:n=Math.log(1+o),n}),uY={kernelName:em,backendName:"cpu",kernelFunc:X_e};function Y_e(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,{blockShape:a,paddings:i}=o;ne([n],"spaceToBatchND");let s=S.sizeFromShape(a),c=[[0,0]];c.push(...i);for(let C=1+a.length;C<n.shape.length;++C)c.push([0,0]);let l=Hk.kernelFunc({inputs:{x:n},backend:r,attrs:{paddings:c,constantValue:0}}),p=M.getReshaped(l.shape,a,s,!1),u=M.getPermuted(p.length,a.length,!1),m=M.getReshapedPermuted(l.shape,a,s,!1),h=st({inputs:{x:l},backend:r,attrs:{shape:p}}),b=ar({inputs:{x:h},backend:r,attrs:{perm:u}}),I=st({inputs:{x:b},backend:r,attrs:{shape:m}});return r.disposeIntermediateTensorInfo(l),r.disposeIntermediateTensorInfo(h),r.disposeIntermediateTensorInfo(b),I}var mY={kernelName:kh,backendName:"cpu",kernelFunc:Y_e};function Q_e(e){let{inputs:t,backend:r}=e,{indices:o,values:n,denseShape:a,defaultValue:i}=t;if(a.shape.length!==1)throw new Error(`Dense shape must be a vector, saw:
137
+ ${a.shape}`);if(o.shape.length!==2)throw new Error(`Indices must be a matrix, saw:
138
+ ${o.shape}`);if(n.shape.length!==1)throw new Error(`Values must be a vector, saw:
139
+ ${n.shape}`);if(i.shape.length!==0)throw new Error(`Default value must be a scalar, saw:
140
+ ${i.shape}`);let s=r.data.get(o.dataId).values,c=r.data.get(n.dataId).values,l=r.data.get(a.dataId).values,p=r.data.get(i.dataId).values[0],[u,m,f,d,h]=GH(s,o.shape,o.dtype,c,n.dtype,l,p);return[r.makeTensorInfo(m,o.dtype,u),r.makeTensorInfo([m[0]],n.dtype,f),r.makeTensorInfo([d.length],"bool",new Uint8Array(d.map(y=>Number(y)))),r.makeTensorInfo([h.length],o.dtype,new Int32Array(h))]}var fY={kernelName:Eh,backendName:"cpu",kernelFunc:Q_e};function J_e(e){let{inputs:t,backend:r}=e,{inputIndices:o,inputShape:n,newShape:a}=t;if(o.shape.length!==2)throw new Error(`Input indices should be a matrix but received shape
141
+ ${o.shape}`);if(n.shape.length!==1)throw new Error(`Input shape should be a vector but received shape
142
+ ${n.shape}`);if(a.shape.length!==1)throw new Error(`Target shape should be a vector but received shape ${a.shape}`);let i=Array.from(r.data.get(n.dataId).values),s=r.data.get(o.dataId).values,c=Array.from(r.data.get(a.dataId).values),[l,p,u]=qH(s,o.shape,o.dtype,i,c);return[r.makeTensorInfo(p,o.dtype,l),r.makeTensorInfo([u.length],a.dtype,new Int32Array(u))]}var dY={kernelName:nm,backendName:"cpu",kernelFunc:J_e};function Z_e(e){let{inputs:t,backend:r}=e,{data:o,indices:n,segmentIds:a}=t;if(o.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(n.shape.length!==1)throw new Error(`Indices should be a vector but received shape
143
+ ${n.shape}`);if(a.shape.length!==1)throw new Error(`Segment ids should be a vector but received shape
144
+ ${a.shape}`);if(n.shape[0]!==a.shape[0])throw new Error("segmentIds and indices should have same size.");let i=r.data.get(o.dataId).values,s=r.data.get(n.dataId).values,c=r.data.get(a.dataId).values,[l,p]=Dk(i,o.shape,o.dtype,s,c,!0);return r.makeTensorInfo(p,o.dtype,l)}var hY={kernelName:Ih,backendName:"cpu",kernelFunc:Z_e};function e2e(e){let{inputs:t,backend:r}=e,{data:o,indices:n,segmentIds:a}=t;if(o.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(n.shape.length!==1)throw new Error(`Indices should be a vector but received shape
145
+ ${n.shape}`);if(a.shape.length!==1)throw new Error(`Segment ids should be a vector but received shape
146
+ ${a.shape}`);if(n.shape[0]!==a.shape[0])throw new Error("segmentIds and indices should have same size.");let i=r.data.get(o.dataId).values,s=r.data.get(n.dataId).values,c=r.data.get(a.dataId).values,[l,p]=Dk(i,o.shape,o.dtype,s,c);return r.makeTensorInfo(p,o.dtype,l)}var gY={kernelName:Th,backendName:"cpu",kernelFunc:e2e};function t2e(e){let{inputs:t,backend:r,attrs:o}=e,{sparseIndices:n,sparseValues:a,defaultValue:i}=t,{outputShape:s}=o,{sliceRank:c,numUpdates:l,sliceSize:p,strides:u,outputSize:m}=M.calculateShapes(a,n,s),f=!1,d=r.bufferSync(n),h;switch(a.dtype){case"bool":{let y=r.bufferSync(a),g=!!r.data.get(i.dataId).values[0];h=Ls(d,y,s,m,p,l,c,u,g,f);break}case"float32":{let y=r.bufferSync(a),g=r.data.get(i.dataId).values[0];h=Ls(d,y,s,m,p,l,c,u,g,f);break}case"int32":{let y=r.bufferSync(a),g=r.data.get(i.dataId).values[0];h=Ls(d,y,s,m,p,l,c,u,g,f);break}case"string":{let y=r.bufferSync(a),g=S.decodeString(r.data.get(i.dataId).values[0]);h=Ls(d,y,s,m,p,l,c,u,g,f);break}default:throw new Error(`Unsupported type ${a.dtype}`)}return r.makeTensorInfo(s,h.dtype,h.values)}var yY={kernelName:am,backendName:"cpu",kernelFunc:t2e};function r2e(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,{numOrSizeSplits:a,axis:i}=o,s=S.parseAxisParam(i,n.shape)[0],c=M.prepareSplitSize(n,a,s),l=new Array(n.shape.length).fill(0),p=n.shape.slice();return c.map(u=>{let m=[...p];m[s]=u;let f=Ca({inputs:{x:n},backend:r,attrs:{begin:l,size:m}});return l[s]+=u,f})}var vY={kernelName:_h,backendName:"cpu",kernelFunc:r2e};var bY={kernelName:B1,backendName:"cpu",kernelFunc:({inputs:e,backend:t})=>{let{x:r}=e,o=t;ne(r,"square");let n=o.data.get(r.dataId).values,a=new Float32Array(n.length);for(let s=0;s<n.length;++s){let c=n[s];a[s]=c*c}return{dataId:o.write(a,r.shape,r.dtype),shape:r.shape,dtype:r.dtype}}};var o2e=Oe(Wl,(e,t)=>{let r=t;return isNaN(e)?NaN:e>0?1:r.alpha}),xY={kernelName:Wl,backendName:"cpu",kernelFunc:o2e};function n2e(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,{begin:a,end:i,strides:s,beginMask:c,endMask:l,ellipsisMask:p,newAxisMask:u,shrinkAxisMask:m}=o;ne(n,"stridedSlice");let{finalShapeSparse:f,finalShape:d,isIdentity:h,sliceDim0:y,isSimpleSlice:g,begin:b,end:x,strides:w}=co.sliceInfo(n.shape,a,i,s,c,l,p,u,m),I;if(h)I=st({inputs:{x:n},backend:r,attrs:{shape:d}});else if(y||g){S.assert(n.shape.length>=1,()=>`Input must have rank at least 1, got: ${n.shape.length}`);let C=co.computeOutShape(b,x,w),R=Ca({inputs:{x:n},backend:r,attrs:{begin:b,size:C}});I=st({inputs:{x:R},backend:r,attrs:{shape:d}}),r.disposeIntermediateTensorInfo(R)}else{let C=r.bufferSync(n),R=QH(f,C,w,b);I=r.makeTensorInfo(d,R.dtype,R.values)}return I}var wY={kernelName:sm,backendName:"cpu",kernelFunc:n2e};function a2e(e){let{inputs:t,backend:r,attrs:o}=e,{separator:n,nGramWidths:a,leftPad:i,rightPad:s,padWidth:c,preserveShortSequences:l}=o,{data:p,dataSplits:u}=t,m=r.data.get(p.dataId).values,f=r.data.get(u.dataId).values,[d,h]=sg(m,f,n,a,i,s,c,l);return[r.makeTensorInfo([d.length],"string",d),r.makeTensorInfo(u.shape,"int32",h)]}var SY={kernelName:Ch,backendName:"cpu",kernelFunc:a2e};function i2e(e){let{inputs:t,backend:r,attrs:o}=e,{skipEmpty:n}=o,{input:a,delimiter:i}=t;if(a.dtype!=="string")throw new Error("Input must be of datatype string");if(a.shape.length!==1)throw new Error(`Input must be a vector, got shape: ${a.shape}`);if(i.shape.length!==0)throw new Error(`Delimiter must be a scalar, got shape: ${i.shape}`);let s=r.data.get(a.dataId).values,c=r.data.get(i.dataId).values[0],[l,p,u]=lg(s,c,n),m=p.length;return[r.makeTensorInfo([m,2],"int32",l),r.makeTensorInfo([m],"string",p),r.makeTensorInfo([2],"int32",new Int32Array(u))]}var kY={kernelName:Nh,backendName:"cpu",kernelFunc:i2e};function s2e(e){let{inputs:t,backend:r,attrs:o}=e,{numBuckets:n}=o,{input:a}=t;if(a.dtype!=="string")throw new Error("Input must be of datatype string");if(n<=0)throw new Error("Number of buckets must be at least 1");let i=r.data.get(a.dataId).values,s=cg(i,n);return r.makeTensorInfo(a.shape,"int32",s)}var _Y={kernelName:Ah,backendName:"cpu",kernelFunc:s2e};var l2e=Oe(cm,e=>Math.tan(e)),EY={kernelName:cm,backendName:"cpu",kernelFunc:l2e};var c2e=Oe(pm,e=>Math.tanh(e)),IY={kernelName:pm,backendName:"cpu",kernelFunc:c2e};function p2e(e){let{inputs:t,backend:r}=e,{tensor:o,indices:n,updates:a}=t,{sliceRank:i,numUpdates:s,sliceSize:c,strides:l,outputSize:p}=M.calculateShapes(a,n,o.shape),u=!1,m=r.bufferSync(n),f=r.bufferSync(a),d=r.bufferSync(o),h=Ls(m,f,o.shape,p,c,s,i,l,d,u);return r.makeTensorInfo(o.shape,h.dtype,h.values)}var TY={kernelName:qu,backendName:"cpu",kernelFunc:p2e};function u2e(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,{reps:a}=o;ne(n,"tile");let i=ZH(r.bufferSync(n),a);return r.makeTensorInfo(i.shape,i.dtype,i.values)}var CY={kernelName:Ts,backendName:"cpu",kernelFunc:u2e};function m2e(e){let{inputs:t,backend:r,attrs:o}=e,{x:n}=t,{k:a,sorted:i}=o;ne(n,"topk");let s=r.data.get(n.dataId).values,[c,l]=tV(s,n.shape,n.dtype,a,i);return[r.makeTensorInfo(c.shape,c.dtype,c.values),r.makeTensorInfo(l.shape,l.dtype,l.values)]}var NY={kernelName:um,backendName:"cpu",kernelFunc:m2e};function f2e(e){let{inputs:t,attrs:r,backend:o}=e,{image:n,transforms:a}=t,{interpolation:i,fillMode:s,fillValue:c,outputShape:l}=r,[p,u,m,f]=n.shape,[d,h]=l??[u,m],y=[p,d,h,f],g=S.computeStrides(n.shape),b=g[0],x=g[1],w=g[2],I=S.computeStrides(y),C=I[0],R=I[1],P=I[2],z=S.getTypedArrayFromDType(n.dtype,S.sizeFromShape(y));z.fill(c);let $=o.data.get(n.dataId).values,B=o.data.get(a.dataId).values;for(let H=0;H<p;++H){let G=a.shape[0]===1?B:B.subarray(H*8,H*8+8);for(let X=0;X<d;++X)for(let ee=0;ee<h;++ee)for(let Z=0;Z<f;++Z){let te,re=G[6]*ee+G[7]*X+1;if(re===0)continue;let se=(G[0]*ee+G[1]*X+G[2])/re,ae=(G[3]*ee+G[4]*X+G[5])/re,pe=AY(se,m,s),ie=AY(ae,u,s);switch(i){case"nearest":te=v2e($,u,m,b,x,w,H,ie,pe,Z,c);break;case"bilinear":te=b2e($,u,m,b,x,w,H,ie,pe,Z,c);break;default:throw new Error(`Error in Transform: Expect 'nearest' or 'bilinear', but got ${i}`)}let Y=H*C+X*R+ee*P+Z;z[Y]=te}return o.makeTensorInfo(y,n.dtype,z)}return{dataId:o.write(z,y,n.dtype),shape:n.shape,dtype:n.dtype}}var RY={kernelName:mm,backendName:"cpu",kernelFunc:f2e};function AY(e,t,r){switch(r){case"reflect":return d2e(e,t);case"wrap":return h2e(e,t);case"nearest":return y2e(e,t);case"constant":default:return g2e(e,t)}}function d2e(e,t){let r=e;if(r<0)if(t<=1)r=0;else{let o=2*t;r<o&&(r=o*Math.trunc(-r/o)+r),r=r<-t?r+o:-r-1}else if(r>t-1)if(t<=1)r=0;else{let o=2*t;r-=o*Math.trunc(r/o),r>=t&&(r=o-r-1)}return S.clamp(0,r,t-1)}function h2e(e,t){let r=e;if(r<0)if(t<=1)r=0;else{let o=t-1;r+=t*(Math.trunc(-r/o)+1)}else if(r>t-1)if(t<=1)r=0;else{let o=t-1;r-=t*Math.trunc(r/o)}return S.clamp(0,r,t-1)}function g2e(e,t){return e}function y2e(e,t){return S.clamp(0,e,t-1)}function Lb(e,t,r,o,n,a,i,s,c,l,p){let u=i*o+s*n+c*a+l;return 0<=s&&s<t&&0<=c&&c<r?e[u]:p}function v2e(e,t,r,o,n,a,i,s,c,l,p){let u=Math.round(s),m=Math.round(c);return Lb(e,t,r,o,n,a,i,u,m,l,p)}function b2e(e,t,r,o,n,a,i,s,c,l,p){let u=Math.floor(s),m=Math.floor(c),f=u+1,d=m+1,h=(d-c)*Lb(e,t,r,o,n,a,i,u,m,l,p)+(c-m)*Lb(e,t,r,o,n,a,i,u,d,l,p),y=(d-c)*Lb(e,t,r,o,n,a,i,f,m,l,p)+(c-m)*Lb(e,t,r,o,n,a,i,f,d,l,p);return(f-s)*h+(s-u)*y}function x2e(e){let{inputs:t,attrs:r,backend:o}=e,{axis:n}=r,{x:a}=t;ne(a,"unique");let i=o.data.get(a.dataId).values,{outputValues:s,outputShape:c,indices:l}=pg(i,n,a.shape,a.dtype);return[o.makeTensorInfo(c,a.dtype,s),o.makeTensorInfo([l.length],"int32",l)]}var DY={kernelName:Rh,backendName:"cpu",kernelFunc:x2e};function w2e(e){let{inputs:t,backend:r,attrs:o}=e,{value:n}=t,{axis:a}=o;a<0&&(a+=n.shape.length);let i=n.shape.length,s=n.shape[a],c=new Array(i-1),l=0;for(let f=0;f<i;f++)f!==a&&(c[l++]=n.shape[f]);let p=new Array(i).fill(0),u=n.shape.slice();u[a]=1;let m=new Array(s);for(let f=0;f<m.length;f++){p[a]=f;let d=Ca({inputs:{x:n},backend:r,attrs:{begin:p,size:u}});m[f]=st({inputs:{x:d},backend:r,attrs:{shape:c}}),r.disposeIntermediateTensorInfo(d)}return m}var FY={kernelName:Dh,backendName:"cpu",kernelFunc:w2e};function S2e(e){let{inputs:t,backend:r,attrs:o}=e,{x:n,segmentIds:a}=t,{numSegments:i}=o;ne(n,"unsortedSegmentSum");let s=n.shape.length,c=a.shape.length,l=[],p=[],u=s-c,m=a;for(let d=0;d<u;++d){let h=fg({inputs:{input:m},backend:r,attrs:{dim:d+1}});m=h,p.push(h)}for(let d=0;d<i;++d){let h=S.createScalarValue(d,"int32"),y=r.makeTensorInfo([],"int32",h),g=WA({inputs:{a:y,b:m},backend:r}),b=Ia({inputs:{x:g},backend:r,attrs:{dtype:"float32"}}),x=zm({inputs:{a:b,b:n},backend:r}),w=Bs({inputs:{x},backend:r,attrs:{axis:0,keepDims:!1}});l.push(w),p.push(y),p.push(g),p.push(b),p.push(x),p.push(w)}let f=SR({inputs:l,backend:r,attrs:{axis:0}});return p.forEach(d=>r.disposeIntermediateTensorInfo(d)),f}var MY={kernelName:U1,backendName:"cpu",kernelFunc:S2e};var k2e=[aK,iH,iK,sK,uH,lK,cK,pK,uK,mK,fK,dK,hK,gK,yK,bK,xK,wK,SK,nK,kK,_K,EK,fH,IK,pH,dH,TK,sH,CK,AK,RK,DK,FK,MK,OK,PK,zK,$K,LK,BK,UK,WK,HK,VK,jK,GK,qK,KK,XK,YK,QK,ZK,Jq,eX,hH,tX,gH,rX,yH,oX,nX,aX,vH,bH,iX,sX,lX,cX,SH,kH,lH,pX,NK,uX,mX,fX,Zq,_H,EH,dX,TH,hX,gX,yX,vX,bX,xX,wX,NH,SX,kX,_X,EX,TX,CX,NX,AH,AX,RX,MX,RH,DH,OX,PX,zX,FH,$X,UX,WX,Hk,HX,eK,OH,VX,jX,GX,qX,cH,Pb,KX,tK,rK,oK,XX,YX,QX,JX,ZX,eY,tY,HH,rY,nY,aY,iY,VH,sY,lY,cY,jH,DX,uY,mY,fY,dY,hY,gY,yY,vY,KH,bY,XH,YH,xY,wY,SY,kY,_Y,JH,JK,EY,IY,TY,CY,NY,RY,MH,DY,FY,MY,LX];for(let e of k2e)H1(e);function OY(){try{return!!window.WebAssembly&&(!!window.WebAssembly.compile||!!window.WebAssembly.compileStreaming)}catch{return!1}}var Vk=class{triggerModelLoading(){this.modelLoadingPromise=this.loadModels()}};var _2e="1.0.2",E2e=`https://cdn.liveness.rekognition.amazonaws.com/face-detection/tensorflow-models/blazeface/${_2e}/model/model.json`,I2e=`https://cdn.liveness.rekognition.amazonaws.com/face-detection/tensorflow/tfjs-backend-wasm/${pR}/`,jk=class extends Vk{constructor(t,r){super(),this.faceModelUrl=r??E2e,this.binaryPath=t??I2e}async loadModels(){OY()?await this._loadWebAssemblyBackend():await this._loadCPUBackend();try{await JL(),this._model=await IW(Cb.MediaPipeFaceDetector,{runtime:"tfjs",detectorModelUrl:this.faceModelUrl})}catch{throw new Error("There was an error loading the blazeface model. If you are using a custom blazeface model url ensure that it is a fully qualified url that returns a json file.")}}async detectFaces(t){let o=await this._model.estimateFaces(t,{flipHorizontal:!0}),n=Date.now();return o.map(i=>{let{box:s,keypoints:c}=i,{xMin:l,yMin:p,width:u,height:m}=s,f=this._getCoordinate(c,"rightEye"),d=this._getCoordinate(c,"leftEye"),h=this._getCoordinate(c,"noseTip"),y=this._getCoordinate(c,"mouthCenter"),g=this._getCoordinate(c,"rightEarTragion"),b=this._getCoordinate(c,"leftEarTragion");return{top:p,left:l,width:u,height:m,timestampMs:n,probability:[90][0],rightEye:f,leftEye:d,mouth:y,nose:h,rightEar:g,leftEar:b}})}_getCoordinate(t,r){let o=t.find(n=>n.name===r);return[o.x,o.y]}async _loadWebAssemblyBackend(){try{cR(this.binaryPath),await vN(async()=>{if(!await U3("wasm"))throw new Error("Initialization of backend wasm failed")},[]),this.modelBackend="wasm"}catch{throw new Error('There was an error loading the TFJS WASM backend. If you are using a custom WASM path ensure that it ends with "/" and that it is not the full URL as @tensorflow/tfjs-backend-wasm will append the wasm binary file name. Read more: https://github.com/tensorflow/tfjs/blob/master/tfjs-backend-wasm/src/backend_wasm.ts#L475.')}}async _loadCPUBackend(){await U3("cpu"),this.modelBackend="cpu"}};function PY({face:e,ovalDetails:t,initialFaceIntersection:r,parsedSessionInformation:o,frameHeight:n}){let a,i=o.Challenge.ChallengeConfig;if(!i||!i.OvalIouThreshold||!i.OvalIouHeightThreshold||!i.OvalIouWidthThreshold||!i.FaceIouHeightThreshold||!i.FaceIouWidthThreshold)throw new Error("Challenge information not returned from session information.");let{OvalIouThreshold:s,FaceIouHeightThreshold:c,FaceIouWidthThreshold:l,OvalHeightWidthRatio:p}=i,u=Kv({ovalHeightWidthRatio:p,face:e,oval:t,frameHeight:n}),m=u.left,f=u.right,d=u.top,h=u.bottom,{ovalBoundingBox:y,minOvalX:g,minOvalY:b,maxOvalX:x,maxOvalY:w}=b1(t),I=x1(u,y),C=s,R=t.width*l,P=t.height*c,z=Math.max(Math.min(1,.75*(I-r)/(C-r)+.25),0)*100,$=g>m&&x>f,B=m>g&&f>x,V=I>C,H=b-d>P||h-w>P||g-m>R&&f-x>R;return V?a=It.MATCHED:$||B?a=It.OFF_CENTER:H?a=It.MATCHED:a=It.TOO_FAR,{faceMatchState:a,faceMatchPercentage:z}}var Us,ta,Lm,dg,li,hg,qk,Bb,kR,Gk,$Y,zY,Bm;(function(e){e[e.Scrolling=0]="Scrolling",e[e.Flat=1]="Flat"})(Bm||(Bm={}));var Kk=class{constructor(t){Us.add(this),ta.set(this,void 0),Lm.set(this,void 0),dg.set(this,Bm.Flat),li.set(this,0),hg.set(this,void 0),qk.set(this,!0),Bb.set(this,0),er(this,hg,t,"f"),er(this,ta,t[0],"f"),er(this,Lm,t[0],"f")}async startSequences(t){return new Promise(r=>{setTimeout(()=>{xe(this,Us,"m",$Y).call(this,{...t,resolve:r})},Math.min(F8))})}};ta=new WeakMap,Lm=new WeakMap,dg=new WeakMap,li=new WeakMap,hg=new WeakMap,qk=new WeakMap,Bb=new WeakMap,Us=new WeakSet,kR=function(){return xe(this,dg,"f")===Bm.Flat},Gk=function(){return xe(this,dg,"f")===Bm.Scrolling},$Y=function({onSequenceChange:t,onSequenceColorChange:r,onSequenceStart:o,onSequencesComplete:n,resolve:a}){En(o)&&o();let i=Date.now(),s=i-xe(this,Bb,"f");if(xe(this,qk,"f")&&(er(this,Bb,Date.now(),"f"),er(this,qk,!1,"f"),En(t)&&t({prevSequenceColor:xe(this,Lm,"f").color,sequenceColor:xe(this,ta,"f").color,sequenceIndex:xe(this,li,"f"),sequenceStartTime:i})),(xe(this,Us,"m",kR).call(this)&&s>=xe(this,ta,"f").flatDisplayDuration||xe(this,Us,"m",Gk).call(this)&&s>=xe(this,ta,"f").downscrollDuration)&&(xe(this,Us,"m",zY).call(this,{sequenceStartTime:i,onSequenceChange:t}),s=0),xe(this,li,"f")<xe(this,hg,"f").length){let l=s/(xe(this,Us,"m",Gk).call(this)?xe(this,ta,"f").downscrollDuration:xe(this,ta,"f").flatDisplayDuration);En(r)&&r({sequenceColor:xe(this,ta,"f").color,heightFraction:l,prevSequenceColor:xe(this,Lm,"f").color}),a(!1)}else En(n)&&n(),a(!0)},zY=function({sequenceStartTime:t,onSequenceChange:r}){er(this,Lm,xe(this,ta,"f"),"f"),xe(this,Us,"m",kR).call(this)?(er(this,li,xe(this,li,"f")+1,"f"),er(this,dg,Bm.Scrolling,"f")):xe(this,Us,"m",Gk).call(this)&&(xe(this,hg,"f")[xe(this,li,"f")].flatDisplayDuration>0?er(this,dg,Bm.Flat,"f"):er(this,li,xe(this,li,"f")+1,"f")),er(this,ta,xe(this,hg,"f")[xe(this,li,"f")],"f"),er(this,Bb,Date.now(),"f"),xe(this,ta,"f")&&En(r)&&r({prevSequenceColor:xe(this,Lm,"f").color,sequenceColor:xe(this,ta,"f").color,sequenceIndex:xe(this,li,"f"),sequenceStartTime:t})};var LY=e=>e?.Challenge?.Name==="FaceMovementAndLightChallenge",BY=e=>e?.Challenge?.Name==="FaceMovementChallenge",T2e=e=>!!e?.FaceMovementAndLightChallenge,C2e=e=>!!e?.FaceMovementChallenge,UY=e=>{let t;if(T2e(e.Challenge))t={...e.Challenge.FaceMovementAndLightChallenge,Name:qv.type};else if(C2e(e.Challenge))t={...e.Challenge.FaceMovementChallenge,Name:hp.type};else throw new Error("Unsupported challenge type returned from session information.");if(!t.ChallengeConfig||!t.ChallengeConfig.FaceDistanceThreshold||!t.ChallengeConfig.FaceDistanceThresholdMin||!t.ChallengeConfig.OvalHeightWidthRatio)throw new Error("Challenge config not returned from session information.");return{...e,Challenge:t}};var HY=async e=>{let{data:t,type:r}=e;return{VideoChunk:new Uint8Array(r==="streamVideo"?await t.arrayBuffer():[]),TimestampMillis:r==="closeCode"?t:Date.now()}},_R=e=>{let{height:t,width:r}=e.getVideoTracks()[0].getSettings();if(Fl(t)||Fl(r))throw new Error(`Invalid Track Dimensions. height: ${t}, width: ${r} `);return{trackHeight:t,trackWidth:r}};function VY({trackHeight:e,trackWidth:t,height:r,width:o,top:n,left:a}){return{Height:r/e,Width:o/t,Top:n/e,Left:a/t}}var N2e=(e,t,r)=>e-t-r,jY=e=>{let{trackWidth:t,left:r,width:o}=e;return VY({...e,left:N2e(t,r,o)})},A2e=e=>{let{height:t,width:r,centerX:o,centerY:n}=e;return VY({...e,top:n-t/2,left:o-r/2})};function GY({parsedSessionInformation:e,clientChallenge:t}){if(BY(e))return{Challenge:{FaceMovementChallenge:t}};if(LY(e))return{Challenge:{FaceMovementAndLightChallenge:t}};throw new Error("Unable to create ClientSessionInformationEvent")}function qY({parsedSessionInformation:e,challengeId:t,faceMatchAssociatedParams:r,ovalAssociatedParams:o,recordingEndedTimestamp:n,trackHeight:a,trackWidth:i}){let{initialFace:s,ovalDetails:c}=o,{startFace:l,endFace:p}=r,u=jY({trackHeight:a,trackWidth:i,...s}),m=A2e({trackHeight:a,trackWidth:i,...c}),f={ChallengeId:t,InitialFace:{InitialFaceDetectedTimestamp:s.timestampMs,BoundingBox:u},TargetFace:{FaceDetectedInTargetPositionStartTimestamp:l.timestampMs,FaceDetectedInTargetPositionEndTimestamp:p.timestampMs,BoundingBox:m},VideoEndTimestamp:n};return GY({parsedSessionInformation:e,clientChallenge:f})}function KY({parsedSessionInformation:e,challengeId:t,ovalAssociatedParams:r,recordingStartedTimestamp:o,trackHeight:n,trackWidth:a}){let{initialFace:i}=r,s=jY({trackHeight:n,trackWidth:a,...i}),c={ChallengeId:t,VideoStartTimestamp:o,InitialFace:{InitialFaceDetectedTimestamp:i.timestampMs,BoundingBox:s}};return GY({parsedSessionInformation:e,clientChallenge:c})}var WY=e=>e.slice(e.indexOf("(")+1,e.indexOf(")")).split(",").map(t=>parseInt(t));function XY({challengeId:e,sequenceStartTime:t,sequenceIndex:r,sequenceColor:o,prevSequenceColor:n}){let a={RGB:WY(o)},i={RGB:WY(n)};return{Challenge:{FaceMovementAndLightChallenge:{ChallengeId:e,ColorDisplayed:{CurrentColor:a,PreviousColor:i,SequenceNumber:r,CurrentColorStartTimestamp:t}}}}}function YY(e){let t=e.getReader();return{getRequestStream:async function*(){for(;;){let{done:r,value:o}=await t.read();if(r)return;if(o.type==="sessionInfo")yield{ClientSessionInformationEvent:o.data};else{if(o.type==="streamVideo"&&o.data.size<1)continue;yield{VideoEvent:await HY(o)}}}}}}function QY(e){let t=e.signer,r=e.signer,o=Object.assign(e,{eventSigner:t,messageSigner:r}),n=o.eventStreamPayloadHandlerProvider(o);return Object.assign(o,{eventStreamPayloadHandler:n})}var gg;(function(e){e.HTTP="http",e.HTTPS="https"})(gg||(gg={}));var Um;(function(e){e.MD5="md5",e.CRC32="crc32",e.CRC32C="crc32c",e.SHA1="sha1",e.SHA256="sha256"})(Um||(Um={}));var Ub="__smithy_context";var yg=class e{constructor(t){F(this,"method");F(this,"protocol");F(this,"hostname");F(this,"port");F(this,"path");F(this,"query");F(this,"headers");F(this,"username");F(this,"password");F(this,"fragment");F(this,"body");this.method=t.method||"GET",this.hostname=t.hostname||"localhost",this.port=t.port,this.query=t.query||{},this.headers=t.headers||{},this.body=t.body,this.protocol=t.protocol?t.protocol.slice(-1)!==":"?`${t.protocol}:`:t.protocol:"https:",this.path=t.path?t.path.charAt(0)!=="/"?`/${t.path}`:t.path:"/",this.username=t.username,this.password=t.password,this.fragment=t.fragment}static clone(t){let r=new e({...t,headers:{...t.headers}});return r.query&&(r.query=R2e(r.query)),r}static isInstance(t){if(!t)return!1;let r=t;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return e.clone(this)}};function R2e(e){return Object.keys(e).reduce((t,r)=>{let o=e[r];return{...t,[r]:Array.isArray(o)?[...o]:o}},{})}var JY=e=>(t,r)=>async o=>{let{request:n}=o;return yg.isInstance(n)?e.eventStreamPayloadHandler.handle(t,o,r):t(o)},ZY={tags:["EVENT_STREAM","SIGNATURE","HANDLE"],name:"eventStreamHandlingMiddleware",relation:"after",toMiddleware:"awsAuthMiddleware",override:!0};var eQ=e=>async t=>{let{request:r}=t;return yg.isInstance(r)?(r.headers={...r.headers,"content-type":"application/vnd.amazon.eventstream","x-amz-content-sha256":"STREAMING-AWS4-HMAC-SHA256-EVENTS"},e({...t,request:r})):e(t)},tQ={step:"build",tags:["EVENT_STREAM","HEADER","CONTENT_TYPE","CONTENT_SHA256"],name:"eventStreamHeaderMiddleware",override:!0};var rQ=e=>({applyToStack:t=>{t.addRelativeTo(JY(e),ZY),t.add(eQ,tQ)}});var Xk=class e{constructor(t){F(this,"method");F(this,"protocol");F(this,"hostname");F(this,"port");F(this,"path");F(this,"query");F(this,"headers");F(this,"username");F(this,"password");F(this,"fragment");F(this,"body");this.method=t.method||"GET",this.hostname=t.hostname||"localhost",this.port=t.port,this.query=t.query||{},this.headers=t.headers||{},this.body=t.body,this.protocol=t.protocol?t.protocol.slice(-1)!==":"?`${t.protocol}:`:t.protocol:"https:",this.path=t.path?t.path.charAt(0)!=="/"?`/${t.path}`:t.path:"/",this.username=t.username,this.password=t.password,this.fragment=t.fragment}static clone(t){let r=new e({...t,headers:{...t.headers}});return r.query&&(r.query=D2e(r.query)),r}static isInstance(t){if(!t)return!1;let r=t;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return e.clone(this)}};function D2e(e){return Object.keys(e).reduce((t,r)=>{let o=e[r];return{...t,[r]:Array.isArray(o)?[...o]:o}},{})}var F2e=e=>t=>async r=>{if(!Xk.isInstance(r.request))return t(r);let{request:o}=r,{handlerProtocol:n=""}=e.requestHandler.metadata||{};if(n.indexOf("h2")>=0&&!o.headers[":authority"])delete o.headers.host,o.headers[":authority"]=o.hostname+(o.port?":"+o.port:"");else if(!o.headers.host){let a=o.hostname;o.port!=null&&(a+=`:${o.port}`),o.headers.host=a}return t(r)},M2e={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},oQ=e=>({applyToStack:t=>{t.add(F2e(e),M2e)}});var O2e=()=>(e,t)=>async r=>{try{let o=await e(r),{clientName:n,commandName:a,logger:i,dynamoDbDocumentClientOptions:s={}}=t,{overrideInputFilterSensitiveLog:c,overrideOutputFilterSensitiveLog:l}=s,p=c??t.inputFilterSensitiveLog,u=l??t.outputFilterSensitiveLog,{$metadata:m,...f}=o.output;return i?.info?.({clientName:n,commandName:a,input:p(r.input),output:u(f),metadata:m}),o}catch(o){let{clientName:n,commandName:a,logger:i,dynamoDbDocumentClientOptions:s={}}=t,{overrideInputFilterSensitiveLog:c}=s,l=c??t.inputFilterSensitiveLog;throw i?.error?.({clientName:n,commandName:a,input:l(r.input),error:o,metadata:o.$metadata}),o}},P2e={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},nQ=e=>({applyToStack:t=>{t.add(O2e(),P2e)}});var aQ={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"};var iQ=()=>e=>async t=>e(t);var sQ=e=>({applyToStack:t=>{t.add(iQ(),aQ)}});var Aa=e=>e[Ub]||(e[Ub]={});var Vo=e=>{if(typeof e=="function")return e;let t=Promise.resolve(e);return()=>t};var lQ=(e,t)=>{if(!t||t.length===0)return e;let r=[];for(let o of t)for(let n of e)n.schemeId.split("#")[1]===o&&r.push(n);for(let o of e)r.find(({schemeId:n})=>n===o.schemeId)||r.push(o);return r};function z2e(e){let t=new Map;for(let r of e)t.set(r.schemeId,r);return t}var cQ=(e,t)=>(r,o)=>async n=>{let a=e.httpAuthSchemeProvider(await t.httpAuthSchemeParametersProvider(e,o,n.input)),i=e.authSchemePreference?await e.authSchemePreference():[],s=lQ(a,i),c=z2e(e.httpAuthSchemes),l=Aa(o),p=[];for(let u of s){let m=c.get(u.schemeId);if(!m){p.push(`HttpAuthScheme \`${u.schemeId}\` was not enabled for this service.`);continue}let f=m.identityProvider(await t.identityProviderConfigProvider(e));if(!f){p.push(`HttpAuthScheme \`${u.schemeId}\` did not have an IdentityProvider configured.`);continue}let{identityProperties:d={},signingProperties:h={}}=u.propertiesExtractor?.(e,o)||{};u.identityProperties=Object.assign(u.identityProperties||{},d),u.signingProperties=Object.assign(u.signingProperties||{},h),l.selectedHttpAuthScheme={httpAuthOption:u,identity:await f(u.identityProperties),signer:m.signer};break}if(!l.selectedHttpAuthScheme)throw new Error(p.join(`
147
+ `));return r(n)};var $2e={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:"endpointV2Middleware"},pQ=(e,{httpAuthSchemeParametersProvider:t,identityProviderConfigProvider:r})=>({applyToStack:o=>{o.addRelativeTo(cQ(e,{httpAuthSchemeParametersProvider:t,identityProviderConfigProvider:r}),$2e)}});var lc=class e{constructor(t){F(this,"method");F(this,"protocol");F(this,"hostname");F(this,"port");F(this,"path");F(this,"query");F(this,"headers");F(this,"username");F(this,"password");F(this,"fragment");F(this,"body");this.method=t.method||"GET",this.hostname=t.hostname||"localhost",this.port=t.port,this.query=t.query||{},this.headers=t.headers||{},this.body=t.body,this.protocol=t.protocol?t.protocol.slice(-1)!==":"?`${t.protocol}:`:t.protocol:"https:",this.path=t.path?t.path.charAt(0)!=="/"?`/${t.path}`:t.path:"/",this.username=t.username,this.password=t.password,this.fragment=t.fragment}static clone(t){let r=new e({...t,headers:{...t.headers}});return r.query&&(r.query=L2e(r.query)),r}static isInstance(t){if(!t)return!1;let r=t;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return e.clone(this)}};function L2e(e){return Object.keys(e).reduce((t,r)=>{let o=e[r];return{...t,[r]:Array.isArray(o)?[...o]:o}},{})}var vg=class{constructor(t){F(this,"statusCode");F(this,"reason");F(this,"headers");F(this,"body");this.statusCode=t.statusCode,this.reason=t.reason,this.headers=t.headers||{},this.body=t.body}static isInstance(t){if(!t)return!1;let r=t;return typeof r.statusCode=="number"&&typeof r.headers=="object"}};var B2e=e=>t=>{throw t},U2e=(e,t)=>{},uQ=e=>(t,r)=>async o=>{if(!lc.isInstance(o.request))return t(o);let a=Aa(r).selectedHttpAuthScheme;if(!a)throw new Error("No HttpAuthScheme was selected: unable to sign request");let{httpAuthOption:{signingProperties:i={}},identity:s,signer:c}=a,l=await t({...o,request:await c.sign(o.request,s,i)}).catch((c.errorHandler||B2e)(i));return(c.successHandler||U2e)(l.response,i),l};var W2e={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:"retryMiddleware"},mQ=e=>({applyToStack:t=>{t.addRelativeTo(uQ(e),W2e)}});var Wm=e=>{if(typeof e=="function")return e;let t=Promise.resolve(e);return()=>t};var fQ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ER=Object.entries(fQ).reduce((e,[t,r])=>(e[r]=Number(t),e),{}),dQ=fQ.split(""),cc=6,Hm=8,hQ=63;var ci=e=>{let t=e.length/4*3;e.slice(-2)==="=="?t-=2:e.slice(-1)==="="&&t--;let r=new ArrayBuffer(t),o=new DataView(r);for(let n=0;n<e.length;n+=4){let a=0,i=0;for(let l=n,p=n+3;l<=p;l++)if(e[l]!=="="){if(!(e[l]in ER))throw new TypeError(`Invalid character ${e[l]} in base64 string.`);a|=ER[e[l]]<<(p-l)*cc,i+=cc}else a>>=cc;let s=n/4*3;a>>=i%Hm;let c=Math.floor(i/Hm);for(let l=0;l<c;l++){let p=(c-l-1)*Hm;o.setUint8(s+l,(a&255<<p)>>p)}}return new Uint8Array(r)};var gQ=e=>new TextEncoder().encode(e);function Ra(e){let t;typeof e=="string"?t=gQ(e):t=e;let r=typeof t=="object"&&typeof t.length=="number",o=typeof t=="object"&&typeof t.byteOffset=="number"&&typeof t.byteLength=="number";if(!r&&!o)throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");let n="";for(let a=0;a<t.length;a+=3){let i=0,s=0;for(let l=a,p=Math.min(a+3,t.length);l<p;l++)i|=t[l]<<(p-l-1)*Hm,s+=Hm;let c=Math.ceil(s/cc);i<<=c*cc-s;for(let l=1;l<=c;l++){let p=(c-l)*cc;n+=dQ[(i&hQ<<p)>>p]}n+="==".slice(0,4-c)}return n}var yQ=e=>new TextEncoder().encode(e);var Yk=e=>{if(typeof e=="string")return e;if(typeof e!="object"||typeof e.byteOffset!="number"||typeof e.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(e)};var bg=class e extends Uint8Array{static fromString(t,r="utf-8"){if(typeof t=="string")return r==="base64"?e.mutate(ci(t)):e.mutate(yQ(t));throw new Error(`Unsupported conversion from ${typeof t} to Uint8ArrayBlobAdapter.`)}static mutate(t){return Object.setPrototypeOf(t,e.prototype),t}transformToString(t="utf-8"){return t==="base64"?Ra(this):Yk(this)}};var IR=e=>typeof ReadableStream=="function"&&(e?.constructor?.name===ReadableStream.name||e instanceof ReadableStream);var Wb=class{constructor(t){F(this,"statusCode");F(this,"reason");F(this,"headers");F(this,"body");this.statusCode=t.statusCode,this.reason=t.reason,this.headers=t.headers||{},this.body=t.body}static isInstance(t){if(!t)return!1;let r=t;return typeof r.statusCode=="number"&&typeof r.headers=="object"}};var jo=e=>encodeURIComponent(e).replace(/[!'()*]/g,H2e),H2e=e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`;function Qk(e){let t=[];for(let r of Object.keys(e).sort()){let o=e[r];if(r=jo(r),Array.isArray(o))for(let n=0,a=o.length;n<a;n++)t.push(`${r}=${jo(o[n])}`);else{let n=r;(o||typeof o=="string")&&(n+=`=${jo(o)}`),t.push(n)}}return t.join("&")}function TR(e,t){return new Request(e,t)}function vQ(e=0){return new Promise((t,r)=>{e&&setTimeout(()=>{let o=new Error(`Request did not complete within ${e} ms`);o.name="TimeoutError",r(o)},e)})}var CR={supported:void 0},Ws=class e{constructor(t){F(this,"config");F(this,"configProvider");typeof t=="function"?this.configProvider=t().then(r=>r||{}):(this.config=t??{},this.configProvider=Promise.resolve(this.config)),CR.supported===void 0&&(CR.supported=typeof Request<"u"&&"keepalive"in TR("https://[::1]"))}static create(t){return typeof t?.handle=="function"?t:new e(t)}destroy(){}async handle(t,{abortSignal:r,requestTimeout:o}={}){this.config||(this.config=await this.configProvider);let n=o??this.config.requestTimeout,a=this.config.keepAlive===!0,i=this.config.credentials;if(r?.aborted){let b=bQ(r);return Promise.reject(b)}let s=t.path,c=Qk(t.query||{});c&&(s+=`?${c}`),t.fragment&&(s+=`#${t.fragment}`);let l="";if(t.username!=null||t.password!=null){let b=t.username??"",x=t.password??"";l=`${b}:${x}@`}let{port:p,method:u}=t,m=`${t.protocol}//${l}${t.hostname}${p?`:${p}`:""}${s}`,f=u==="GET"||u==="HEAD"?void 0:t.body,d={body:f,headers:new Headers(t.headers),method:u,credentials:i};this.config?.cache&&(d.cache=this.config.cache),f&&(d.duplex="half"),typeof AbortController<"u"&&(d.signal=r),CR.supported&&(d.keepalive=a),typeof this.config.requestInit=="function"&&Object.assign(d,this.config.requestInit(t));let h=()=>{},y=TR(m,d),g=[fetch(y).then(b=>{let x=b.headers,w={};for(let C of x.entries())w[C[0]]=C[1];return b.body!=null?{response:new Wb({headers:w,reason:b.statusText,statusCode:b.status,body:b.body})}:b.blob().then(C=>({response:new Wb({headers:w,reason:b.statusText,statusCode:b.status,body:C})}))}),vQ(n)];return r&&g.push(new Promise((b,x)=>{let w=()=>{let I=bQ(r);x(I)};if(typeof r.addEventListener=="function"){let I=r;I.addEventListener("abort",w,{once:!0}),h=()=>I.removeEventListener("abort",w)}else r.onabort=w})),Promise.race(g).finally(h)}updateHttpClientConfig(t,r){this.config=void 0,this.configProvider=this.configProvider.then(o=>(o[t]=r,o))}httpHandlerConfigs(){return this.config??{}}};function bQ(e){let t=e&&typeof e=="object"&&"reason"in e?e.reason:void 0;if(t){if(t instanceof Error){let n=new Error("Request aborted");return n.name="AbortError",n.cause=t,n}let o=new Error(String(t));return o.name="AbortError",o}let r=new Error("Request aborted");return r.name="AbortError",r}var Jk=async e=>typeof Blob=="function"&&e instanceof Blob||e.constructor?.name==="Blob"?Blob.prototype.arrayBuffer!==void 0?new Uint8Array(await e.arrayBuffer()):V2e(e):j2e(e);async function V2e(e){let t=await G2e(e),r=ci(t);return new Uint8Array(r)}async function j2e(e){let t=[],r=e.getReader(),o=!1,n=0;for(;!o;){let{done:s,value:c}=await r.read();c&&(t.push(c),n+=c.length),o=s}let a=new Uint8Array(n),i=0;for(let s of t)a.set(s,i),i+=s.length;return a}function G2e(e){return new Promise((t,r)=>{let o=new FileReader;o.onloadend=()=>{if(o.readyState!==2)return r(new Error("Reader aborted too early"));let n=o.result??"",a=n.indexOf(","),i=a>-1?a+1:n.length;t(n.substring(i))},o.onabort=()=>r(new Error("Read aborted")),o.onerror=()=>r(o.error),o.readAsDataURL(e)})}var xQ={},q2e={};for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();t.length===1&&(t=`0${t}`),xQ[e]=t,q2e[t]=e}function wQ(e){let t="";for(let r=0;r<e.byteLength;r++)t+=xQ[e[r]];return t}var SQ="The stream has already been transformed.",_Q=e=>{if(!kQ(e)&&!IR(e)){let n=e?.__proto__?.constructor?.name||e;throw new Error(`Unexpected stream implementation, expect Blob or ReadableStream, got ${n}`)}let t=!1,r=async()=>{if(t)throw new Error(SQ);return t=!0,await Jk(e)},o=n=>{if(typeof n.stream!="function")throw new Error(`Cannot transform payload Blob to web stream. Please make sure the Blob.stream() is polyfilled.
148
+ If you are using React Native, this API is not yet supported, see: https://react-native.canny.io/feature-requests/p/fetch-streaming-body`);return n.stream()};return Object.assign(e,{transformToByteArray:r,transformToString:async n=>{let a=await r();if(n==="base64")return Ra(a);if(n==="hex")return wQ(a);if(n===void 0||n==="utf8"||n==="utf-8")return Yk(a);if(typeof TextDecoder=="function")return new TextDecoder(n).decode(a);throw new Error("TextDecoder is not available, please make sure polyfill is provided.")},transformToWebStream:()=>{if(t)throw new Error(SQ);if(t=!0,kQ(e))return o(e);if(IR(e))return e;throw new Error(`Cannot transform payload to web stream, got ${e}`)}})},kQ=e=>typeof Blob=="function"&&e instanceof Blob;var pc=async(e=new Uint8Array,t)=>{if(e instanceof Uint8Array)return bg.mutate(e);if(!e)return bg.mutate(new Uint8Array);let r=t.streamCollector(e);return bg.mutate(await r)};function NR(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}var Zk=e=>typeof e=="function"?e():e;var e_=(e,t,r,o,n)=>({name:t,namespace:e,traits:r,input:o,output:n});var EQ=e=>(t,r)=>async o=>{let{response:n}=await t(o),{operationSchema:a}=Aa(r),[,i,s,c,l,p]=a??[];try{let u=await e.protocol.deserializeResponse(e_(i,s,c,l,p),{...e,...r},n);return{response:n,output:u}}catch(u){if(Object.defineProperty(u,"$response",{value:n,enumerable:!1,writable:!1,configurable:!1}),!("$metadata"in u)){let m="Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.";try{u.message+=`
149
+ `+m}catch{!r.logger||r.logger?.constructor?.name==="NoOpLogger"?console.warn(m):r.logger?.warn?.(m)}typeof u.$responseBodyText<"u"&&u.$response&&(u.$response.body=u.$responseBodyText);try{if(vg.isInstance(n)){let{headers:f={}}=n,d=Object.entries(f);u.$metadata={httpStatusCode:n.statusCode,requestId:AR(/^x-[\w-]+-request-?id$/,d),extendedRequestId:AR(/^x-[\w-]+-id-2$/,d),cfId:AR(/^x-[\w-]+-cf-id$/,d)}}}catch{}}throw u}},AR=(e,t)=>(t.find(([r])=>r.match(e))||[void 0,void 0])[1];function IQ(e){let t={};if(e=e.replace(/^\?/,""),e)for(let r of e.split("&")){let[o,n=null]=r.split("=");o=decodeURIComponent(o),n&&(n=decodeURIComponent(n)),o in t?Array.isArray(t[o])?t[o].push(n):t[o]=[t[o],n]:t[o]=n}return t}var Hs=e=>{if(typeof e=="string")return Hs(new URL(e));let{hostname:t,pathname:r,port:o,protocol:n,search:a}=e,i;return a&&(i=IQ(a)),{hostname:t,port:o?parseInt(o):void 0,protocol:n,path:r,query:i}};var TQ=e=>{if(typeof e=="object"){if("url"in e){let t=Hs(e.url);if(e.headers){t.headers={};for(let r in e.headers)t.headers[r.toLowerCase()]=e.headers[r].join(", ")}return t}return e}return Hs(e)};var CQ=e=>(t,r)=>async o=>{let{operationSchema:n}=Aa(r),[,a,i,s,c,l]=n??[],p=r.endpointV2?async()=>TQ(r.endpointV2):e.endpoint,u=await e.protocol.serializeRequest(e_(a,i,s,c,l),o.input,{...e,...r,endpoint:p});return t({...o,request:u})};var K2e={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},X2e={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function NQ(e){return{applyToStack:t=>{t.add(CQ(e),X2e),t.add(EQ(e),K2e),e.protocol.setSerdeContext(e)}}}var RR=[];function Vs(e){if(typeof e=="object")return e;if(e=e|0,RR[e])return RR[e];let t={},r=0;for(let o of["httpLabel","idempotent","idempotencyToken","sensitive","httpPayload","httpResponseCode","httpQueryParams"])(e>>r++&1)===1&&(t[o]=1);return RR[e]=t}var Hb={it:Symbol.for("@smithy/nor-struct-it"),ns:Symbol.for("@smithy/ns")},DR=[],FR={},uc=class uc{constructor(t,r){F(this,"ref");F(this,"memberName");F(this,"symbol",uc.symbol);F(this,"name");F(this,"schema");F(this,"_isMemberSchema");F(this,"traits");F(this,"memberTraits");F(this,"normalizedTraits");this.ref=t,this.memberName=r;let o=[],n=t,a=t;for(this._isMemberSchema=!1;MR(n);)o.push(n[1]),n=n[0],a=Zk(n),this._isMemberSchema=!0;if(o.length>0){this.memberTraits={};for(let i=o.length-1;i>=0;--i){let s=o[i];Object.assign(this.memberTraits,Vs(s))}}else this.memberTraits=0;if(a instanceof uc){let i=this.memberTraits;Object.assign(this,a),this.memberTraits=Object.assign({},i,a.getMemberTraits(),this.getMemberTraits()),this.normalizedTraits=void 0,this.memberName=r??a.memberName;return}if(this.schema=Zk(a),Y2e(this.schema)?(this.name=`${this.schema[1]}#${this.schema[2]}`,this.traits=this.schema[3]):(this.name=this.memberName??String(a),this.traits=0),this._isMemberSchema&&!r)throw new Error(`@smithy/core/schema - NormalizedSchema member init ${this.getName(!0)} missing member name.`)}static[Symbol.hasInstance](t){let r=this.prototype.isPrototypeOf(t);return!r&&typeof t=="object"&&t!==null?t.symbol===this.symbol:r}static of(t){let r=typeof t=="function"||typeof t=="object"&&t!==null;if(typeof t=="number"){if(DR[t])return DR[t]}else if(typeof t=="string"){if(FR[t])return FR[t]}else if(r&&t[Hb.ns])return t[Hb.ns];let o=Zk(t);if(o instanceof uc)return o;if(MR(o)){let[a,i]=o;if(a instanceof uc)return Object.assign(a.getMergedTraits(),Vs(i)),a;throw new Error(`@smithy/core/schema - may not init unwrapped member schema=${JSON.stringify(t,null,2)}.`)}let n=new uc(o);return r?t[Hb.ns]=n:typeof o=="string"?FR[o]=n:typeof o=="number"?DR[o]=n:n}getSchema(){let t=this.schema;return Array.isArray(t)&&t[0]===0?t[4]:t}getName(t=!1){let{name:r}=this;return!t&&r&&r.includes("#")?r.split("#")[1]:r||void 0}getMemberName(){return this.memberName}isMemberSchema(){return this._isMemberSchema}isListSchema(){let t=this.getSchema();return typeof t=="number"?t>=64&&t<128:t[0]===1}isMapSchema(){let t=this.getSchema();return typeof t=="number"?t>=128&&t<=255:t[0]===2}isStructSchema(){let t=this.getSchema();if(typeof t!="object")return!1;let r=t[0];return r===3||r===-3||r===4}isUnionSchema(){let t=this.getSchema();return typeof t!="object"?!1:t[0]===4}isBlobSchema(){let t=this.getSchema();return t===21||t===42}isTimestampSchema(){let t=this.getSchema();return typeof t=="number"&&t>=4&&t<=7}isUnitSchema(){return this.getSchema()==="unit"}isDocumentSchema(){return this.getSchema()===15}isStringSchema(){return this.getSchema()===0}isBooleanSchema(){return this.getSchema()===2}isNumericSchema(){return this.getSchema()===1}isBigIntegerSchema(){return this.getSchema()===17}isBigDecimalSchema(){return this.getSchema()===19}isStreaming(){let{streaming:t}=this.getMergedTraits();return!!t||this.getSchema()===42}isIdempotencyToken(){return!!this.getMergedTraits().idempotencyToken}getMergedTraits(){return this.normalizedTraits??(this.normalizedTraits={...this.getOwnTraits(),...this.getMemberTraits()})}getMemberTraits(){return Vs(this.memberTraits)}getOwnTraits(){return Vs(this.traits)}getKeySchema(){let[t,r]=[this.isDocumentSchema(),this.isMapSchema()];if(!t&&!r)throw new Error(`@smithy/core/schema - cannot get key for non-map: ${this.getName(!0)}`);let o=this.getSchema(),n=t?15:o[4]??0;return Vb([n,0],"key")}getValueSchema(){let t=this.getSchema(),[r,o,n]=[this.isDocumentSchema(),this.isMapSchema(),this.isListSchema()],a=typeof t=="number"?63&t:t&&typeof t=="object"&&(o||n)?t[3+t[0]]:r?15:void 0;if(a!=null)return Vb([a,0],o?"value":"member");throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no value member.`)}getMemberSchema(t){let r=this.getSchema();if(this.isStructSchema()&&r[4].includes(t)){let o=r[4].indexOf(t),n=r[5][o];return Vb(MR(n)?n:[n,0],t)}if(this.isDocumentSchema())return Vb([15,0],t);throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no member=${t}.`)}getMemberSchemas(){let t={};try{for(let[r,o]of this.structIterator())t[r]=o}catch{}return t}getEventStreamMember(){if(this.isStructSchema()){for(let[t,r]of this.structIterator())if(r.isStreaming()&&r.isStructSchema())return t}return""}*structIterator(){if(this.isUnitSchema())return;if(!this.isStructSchema())throw new Error("@smithy/core/schema - cannot iterate non-struct schema.");let t=this.getSchema(),r=t[4].length,o=t[Hb.it];if(o&&r===o.length){yield*o;return}o=Array(r);for(let n=0;n<r;++n){let a=t[4][n],i=Vb([t[5][n],0],a);yield o[n]=[a,i]}t[Hb.it]=o}};F(uc,"symbol",Symbol.for("@smithy/nor"));var Pt=uc;function Vb(e,t){if(e instanceof Pt)return Object.assign(e,{memberName:t,_isMemberSchema:!0});let r=Pt;return new r(e,t)}var MR=e=>Array.isArray(e)&&e.length===2,Y2e=e=>Array.isArray(e)&&e.length>=5;var ji=class ji{constructor(t,r=new Map,o=new Map){F(this,"namespace");F(this,"schemas");F(this,"exceptions");this.namespace=t,this.schemas=r,this.exceptions=o}static for(t){return ji.registries.has(t)||ji.registries.set(t,new ji(t)),ji.registries.get(t)}copyFrom(t){let{schemas:r,exceptions:o}=this;for(let[n,a]of t.schemas)r.has(n)||r.set(n,a);for(let[n,a]of t.exceptions)o.has(n)||o.set(n,a)}register(t,r){let o=this.normalizeShapeId(t);for(let n of[this,ji.for(o.split("#")[0])])n.schemas.set(o,r)}getSchema(t){let r=this.normalizeShapeId(t);if(!this.schemas.has(r))throw new Error(`@smithy/core/schema - schema not found for ${r}`);return this.schemas.get(r)}registerError(t,r){let o=t,n=o[1];for(let a of[this,ji.for(n)])a.schemas.set(n+"#"+o[2],o),a.exceptions.set(o,r)}getErrorCtor(t){let r=t;return this.exceptions.has(r)?this.exceptions.get(r):ji.for(r[1]).exceptions.get(r)}getBaseException(){for(let t of this.exceptions.keys())if(Array.isArray(t)){let[,r,o]=t,n=r+"#"+o;if(n.startsWith("smithy.ts.sdk.synthetic.")&&n.endsWith("ServiceException"))return t}}find(t){for(let r of this.schemas.values())if(t(r))return r}clear(){this.schemas.clear(),this.exceptions.clear()}normalizeShapeId(t){return t.includes("#")?t:this.namespace+"#"+t}};F(ji,"registries",new Map);var wo=ji;var OR=e=>{if(e!=null){if(typeof e=="string"){let t=parseFloat(e);if(!Number.isNaN(t))return String(t)!==String(e)&&rEe.warn(tEe(`Expected number but observed string: ${e}`)),t}if(typeof e=="number")return e;throw new TypeError(`Expected number, got ${typeof e}: ${e}`)}},Q2e=Math.ceil(34028234663852886e22),AQ=e=>{let t=OR(e);if(t!==void 0&&!Number.isNaN(t)&&t!==1/0&&t!==-1/0&&Math.abs(t)>Q2e)throw new TypeError(`Expected 32-bit float, got ${e}`);return t},J2e=e=>{if(e!=null){if(Number.isInteger(e)&&!Number.isNaN(e))return e;throw new TypeError(`Expected integer, got ${typeof e}: ${e}`)}};var RQ=e=>FQ(e,16),DQ=e=>FQ(e,8),FQ=(e,t)=>{let r=J2e(e);if(r!==void 0&&Z2e(r,t)!==r)throw new TypeError(`Expected ${t}-bit integer, got ${e}`);return r},Z2e=(e,t)=>{switch(t){case 32:return Int32Array.of(e)[0];case 16:return Int16Array.of(e)[0];case 8:return Int8Array.of(e)[0]}};var MQ=e=>OR(typeof e=="string"?t_(e):e);var OQ=e=>AQ(typeof e=="string"?t_(e):e),eEe=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,t_=e=>{let t=e.match(eEe);if(t===null||t[0].length!==e.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(e)};var jb=e=>RQ(typeof e=="string"?t_(e):e),PQ=e=>DQ(typeof e=="string"?t_(e):e),tEe=e=>String(new TypeError(e).stack||e).split(`
150
+ `).slice(0,5).filter(t=>!t.includes("stackTraceWarning")).join(`
151
+ `),rEe={warn:console.warn};var oEe=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],zR=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function o_(e){let t=e.getUTCFullYear(),r=e.getUTCMonth(),o=e.getUTCDay(),n=e.getUTCDate(),a=e.getUTCHours(),i=e.getUTCMinutes(),s=e.getUTCSeconds(),c=n<10?`0${n}`:`${n}`,l=a<10?`0${a}`:`${a}`,p=i<10?`0${i}`:`${i}`,u=s<10?`0${s}`:`${s}`;return`${oEe[o]}, ${c} ${zR[r]} ${t} ${l}:${p}:${u} GMT`}var Hjt=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/);var nEe=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/),zQ=e=>{if(e==null)return;if(typeof e!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let t=nEe.exec(e);if(!t)throw new TypeError("Invalid RFC-3339 date-time value");let[r,o,n,a,i,s,c,l,p]=t,u=jb(Gb(o)),m=mc(n,"month",1,12),f=mc(a,"day",1,31),d=r_(u,m,f,{hours:i,minutes:s,seconds:c,fractionalMilliseconds:l});return p.toUpperCase()!="Z"&&d.setTime(d.getTime()-hEe(p)),d},aEe=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),iEe=new RegExp(/^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d{2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),sEe=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( [1-9]|\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? (\d{4})$/),n_=e=>{if(e==null)return;if(typeof e!="string")throw new TypeError("RFC-7231 date-times must be expressed as strings");let t=aEe.exec(e);if(t){let[r,o,n,a,i,s,c,l]=t;return r_(jb(Gb(a)),PR(n),mc(o,"day",1,31),{hours:i,minutes:s,seconds:c,fractionalMilliseconds:l})}if(t=iEe.exec(e),t){let[r,o,n,a,i,s,c,l]=t;return pEe(r_(lEe(a),PR(n),mc(o,"day",1,31),{hours:i,minutes:s,seconds:c,fractionalMilliseconds:l}))}if(t=sEe.exec(e),t){let[r,o,n,a,i,s,c,l]=t;return r_(jb(Gb(l)),PR(o),mc(n.trimLeft(),"day",1,31),{hours:a,minutes:i,seconds:s,fractionalMilliseconds:c})}throw new TypeError("Invalid RFC-7231 date-time value")},$Q=e=>{if(e==null)return;let t;if(typeof e=="number")t=e;else if(typeof e=="string")t=MQ(e);else if(typeof e=="object"&&e.tag===1)t=e.value;else throw new TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation");if(Number.isNaN(t)||t===1/0||t===-1/0)throw new TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics");return new Date(Math.round(t*1e3))},r_=(e,t,r,o)=>{let n=t-1;return mEe(e,n,r),new Date(Date.UTC(e,n,r,mc(o.hours,"hour",0,23),mc(o.minutes,"minute",0,59),mc(o.seconds,"seconds",0,60),dEe(o.fractionalMilliseconds)))},lEe=e=>{let t=new Date().getUTCFullYear(),r=Math.floor(t/100)*100+jb(Gb(e));return r<t?r+100:r},cEe=50*365*24*60*60*1e3,pEe=e=>e.getTime()-new Date().getTime()>cEe?new Date(Date.UTC(e.getUTCFullYear()-100,e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds())):e,PR=e=>{let t=zR.indexOf(e);if(t<0)throw new TypeError(`Invalid month: ${e}`);return t+1},uEe=[31,28,31,30,31,30,31,31,30,31,30,31],mEe=(e,t,r)=>{let o=uEe[t];if(t===1&&fEe(e)&&(o=29),r>o)throw new TypeError(`Invalid day for ${zR[t]} in ${e}: ${r}`)},fEe=e=>e%4===0&&(e%100!==0||e%400===0),mc=(e,t,r,o)=>{let n=PQ(Gb(e));if(n<r||n>o)throw new TypeError(`${t} must be between ${r} and ${o}, inclusive`);return n},dEe=e=>e==null?0:OQ("0."+e)*1e3,hEe=e=>{let t=e[0],r=1;if(t=="+")r=1;else if(t=="-")r=-1;else throw new TypeError(`Offset direction, ${t}, must be "+" or "-"`);let o=Number(e.substring(1,3)),n=Number(e.substring(4,6));return r*(o*60+n)*60*1e3},Gb=e=>{let t=0;for(;t<e.length-1&&e.charAt(t)==="0";)t++;return t===0?e:e.slice(t)};var $R=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);var Go=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0")),Vm=()=>{if($R)return $R();let e=new Uint8Array(16);return crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128,Go[e[0]]+Go[e[1]]+Go[e[2]]+Go[e[3]]+"-"+Go[e[4]]+Go[e[5]]+"-"+Go[e[6]]+Go[e[7]]+"-"+Go[e[8]]+Go[e[9]]+"-"+Go[e[10]]+Go[e[11]]+Go[e[12]]+Go[e[13]]+Go[e[14]]+Go[e[15]]};var Mn=function(t){return Object.assign(new String(t),{deserializeJSON(){return JSON.parse(String(t))},toString(){return String(t)},toJSON(){return String(t)}})};Mn.from=e=>e&&typeof e=="object"&&(e instanceof Mn||"deserializeJSON"in e)?e:typeof e=="string"||Object.getPrototypeOf(e)===String.prototype?Mn(String(e)):Mn(JSON.stringify(e));Mn.fromObject=Mn.from;function LQ(e){return(e.includes(",")||e.includes('"'))&&(e=`"${e.replace(/"/g,'\\"')}"`),e}var LR="(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)(?:[ne|u?r]?s?day)?",BR="(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)",UR="(\\d?\\d):(\\d{2}):(\\d{2})(?:\\.(\\d+))?",BQ="(\\d?\\d)",UQ="(\\d{4})",gEe=new RegExp(/^(\d{4})-(\d\d)-(\d\d)[tT](\d\d):(\d\d):(\d\d)(\.(\d+))?(([-+]\d\d:\d\d)|[zZ])$/),yEe=new RegExp(`^${LR}, ${BQ} ${BR} ${UQ} ${UR} GMT$`),vEe=new RegExp(`^${LR}, ${BQ}-${BR}-(\\d\\d) ${UR} GMT$`),bEe=new RegExp(`^${LR} ${BR} ( [1-9]|\\d\\d) ${UR} ${UQ}$`),xEe=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],WQ=e=>{if(e==null)return;let t=NaN;if(typeof e=="number")t=e;else if(typeof e=="string"){if(!/^-?\d*\.?\d+$/.test(e))throw new TypeError("parseEpochTimestamp - numeric string invalid.");t=Number.parseFloat(e)}else typeof e=="object"&&e.tag===1&&(t=e.value);if(isNaN(t)||Math.abs(t)===1/0)throw new TypeError("Epoch timestamps must be valid finite numbers.");return new Date(Math.round(t*1e3))},HQ=e=>{if(e==null)return;if(typeof e!="string")throw new TypeError("RFC3339 timestamps must be strings");let t=gEe.exec(e);if(!t)throw new TypeError(`Invalid RFC3339 timestamp format ${e}`);let[,r,o,n,a,i,s,,c,l]=t;js(o,1,12),js(n,1,31),js(a,0,23),js(i,0,59),js(s,0,60);let p=new Date(Date.UTC(Number(r),Number(o)-1,Number(n),Number(a),Number(i),Number(s),Number(c)?Math.round(parseFloat(`0.${c}`)*1e3):0));if(p.setUTCFullYear(Number(r)),l.toUpperCase()!="Z"){let[,u,m,f]=/([+-])(\d\d):(\d\d)/.exec(l)||[void 0,"+",0,0],d=u==="-"?1:-1;p.setTime(p.getTime()+d*(Number(m)*60*60*1e3+Number(f)*60*1e3))}return p},VQ=e=>{if(e==null)return;if(typeof e!="string")throw new TypeError("RFC7231 timestamps must be strings.");let t,r,o,n,a,i,s,c;if((c=yEe.exec(e))?[,t,r,o,n,a,i,s]=c:(c=vEe.exec(e))?([,t,r,o,n,a,i,s]=c,o=(Number(o)+1900).toString()):(c=bEe.exec(e))&&([,r,t,n,a,i,s,o]=c),o&&i){let l=Date.UTC(Number(o),xEe.indexOf(r),Number(t),Number(n),Number(a),Number(i),s?Math.round(parseFloat(`0.${s}`)*1e3):0);js(t,1,31),js(n,0,23),js(a,0,59),js(i,0,60);let p=new Date(l);return p.setUTCFullYear(Number(o)),p}throw new TypeError(`Invalid RFC7231 date-time value ${e}.`)};function js(e,t,r){let o=Number(e);if(o<t||o>r)throw new Error(`Value ${o} out of range [${t}, ${r}]`)}function jQ(e,t,r){if(r<=0||!Number.isInteger(r))throw new Error("Invalid number of delimiters ("+r+") for splitEvery.");let o=e.split(t);if(r===1)return o;let n=[],a="";for(let i=0;i<o.length;i++)a===""?a=o[i]:a+=t+o[i],(i+1)%r===0&&(n.push(a),a="");return a!==""&&n.push(a),n}var a_=e=>{let t=e.length,r=[],o=!1,n,a=0;for(let i=0;i<t;++i){let s=e[i];switch(s){case'"':n!=="\\"&&(o=!o);break;case",":o||(r.push(e.slice(a,i)),a=i+1);break;default:}n=s}return r.push(e.slice(a)),r.map(i=>{i=i.trim();let s=i.length;return s<2?i:(i[0]==='"'&&i[s-1]==='"'&&(i=i.slice(1,s-1)),i.replace(/\\"/g,'"'))})};var GQ=/^-?\d*(\.\d+)?$/,qo=class e{constructor(t,r){F(this,"string");F(this,"type");if(this.string=t,this.type=r,!GQ.test(t))throw new Error('@smithy/core/serde - NumericValue must only contain [0-9], at most one decimal point ".", and an optional negation prefix "-".')}toString(){return this.string}static[Symbol.hasInstance](t){if(!t||typeof t!="object")return!1;let r=t;return e.prototype.isPrototypeOf(t)||r.type==="bigDecimal"&&GQ.test(r.string)}};var Gi=class{constructor(){F(this,"serdeContext")}setSerdeContext(t){this.serdeContext=t}};var l_=class extends Gi{constructor(r){super();F(this,"options");F(this,"compositeErrorRegistry");this.options=r,this.compositeErrorRegistry=wo.for(r.defaultNamespace);for(let o of r.errorTypeRegistries??[])this.compositeErrorRegistry.copyFrom(o)}getRequestType(){return lc}getResponseType(){return vg}setSerdeContext(r){this.serdeContext=r,this.serializer.setSerdeContext(r),this.deserializer.setSerdeContext(r),this.getPayloadCodec()&&this.getPayloadCodec().setSerdeContext(r)}updateServiceEndpoint(r,o){if("url"in o){r.protocol=o.url.protocol,r.hostname=o.url.hostname,r.port=o.url.port?Number(o.url.port):void 0,r.path=o.url.pathname,r.fragment=o.url.hash||void 0,r.username=o.url.username||void 0,r.password=o.url.password||void 0,r.query||(r.query={});for(let[n,a]of o.url.searchParams.entries())r.query[n]=a;if(o.headers)for(let n in o.headers)r.headers[n]=o.headers[n].join(", ");return r}else{if(r.protocol=o.protocol,r.hostname=o.hostname,r.port=o.port?Number(o.port):void 0,r.path=o.path,r.query={...o.query},o.headers)for(let n in o.headers)r.headers[n]=o.headers[n];return r}}setHostPrefix(r,o,n){if(this.serdeContext?.disableHostPrefix)return;let a=Pt.of(o.input),i=Vs(o.traits??{});if(i.endpoint){let s=i.endpoint?.[0];if(typeof s=="string"){for(let[c,l]of a.structIterator()){if(!l.getMergedTraits().hostLabel)continue;let p=n[c];if(typeof p!="string")throw new Error(`@smithy/core/schema - ${c} in input must be a string as hostLabel.`);s=s.replace(`{${c}}`,p)}r.hostname=s+r.hostname}}}deserializeMetadata(r){return{httpStatusCode:r.statusCode,requestId:r.headers["x-amzn-requestid"]??r.headers["x-amzn-request-id"]??r.headers["x-amz-request-id"],extendedRequestId:r.headers["x-amz-id-2"],cfId:r.headers["x-amz-cf-id"]}}async serializeEventStream({eventStream:r,requestSchema:o,initialRequest:n}){return(await this.loadEventStreamCapability()).serializeEventStream({eventStream:r,requestSchema:o,initialRequest:n})}async deserializeEventStream({response:r,responseSchema:o,initialResponseContainer:n}){return(await this.loadEventStreamCapability()).deserializeEventStream({response:r,responseSchema:o,initialResponseContainer:n})}async loadEventStreamCapability(){let{EventStreamSerde:r}=await Promise.resolve().then(()=>(JQ(),QQ));return new r({marshaller:this.getEventStreamMarshaller(),serializer:this.serializer,deserializer:this.deserializer,serdeContext:this.serdeContext,defaultContentType:this.getDefaultContentType()})}getDefaultContentType(){throw new Error(`@smithy/core/protocols - ${this.constructor.name} getDefaultContentType() implementation missing.`)}async deserializeHttpMessage(r,o,n,a,i){return[]}getEventStreamMarshaller(){let r=this.serdeContext;if(!r.eventStreamMarshaller)throw new Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.");return r.eventStreamMarshaller}};var c_=class extends l_{async serializeRequest(t,r,o){let n=r&&typeof r=="object"?r:{},a=this.serializer,i={},s={},c=await o.endpoint(),l=Pt.of(t?.input),p=[],u=[],m=!1,f,d=new lc({protocol:"",hostname:"",port:void 0,path:"",fragment:void 0,query:i,headers:s,body:void 0});if(c){this.updateServiceEndpoint(d,c),this.setHostPrefix(d,t,n);let h=Vs(t.traits);if(h.http){d.method=h.http[0];let[y,g]=h.http[1].split("?");d.path=="/"?d.path=y:d.path+=y;let b=new URLSearchParams(g??"");for(let[x,w]of b)i[x]=w}}for(let[h,y]of l.structIterator()){let g=y.getMergedTraits()??{},b=n[h];if(b==null&&!y.isIdempotencyToken()){if(g.httpLabel&&(d.path.includes(`{${h}+}`)||d.path.includes(`{${h}}`)))throw new Error(`No value provided for input HTTP label: ${h}.`);continue}if(g.httpPayload)y.isStreaming()?y.isStructSchema()?n[h]&&(f=await this.serializeEventStream({eventStream:n[h],requestSchema:l})):f=b:(a.write(y,b),f=a.flush());else if(g.httpLabel){a.write(y,b);let x=a.flush();d.path.includes(`{${h}+}`)?d.path=d.path.replace(`{${h}+}`,x.split("/").map(NR).join("/")):d.path.includes(`{${h}}`)&&(d.path=d.path.replace(`{${h}}`,NR(x)))}else if(g.httpHeader)a.write(y,b),s[g.httpHeader.toLowerCase()]=String(a.flush());else if(typeof g.httpPrefixHeaders=="string")for(let x in b){let w=b[x],I=g.httpPrefixHeaders+x;a.write([y.getValueSchema(),{httpHeader:I}],w),s[I.toLowerCase()]=a.flush()}else g.httpQuery||g.httpQueryParams?this.serializeQuery(y,b,i):(m=!0,p.push(h),u.push(y))}if(m&&n){let[h,y]=(l.getName(!0)??"#Unknown").split("#"),g=l.getSchema()[6],b=[3,h,y,l.getMergedTraits(),p,u,void 0];g?b[6]=g:b.pop(),a.write(b,n),f=a.flush()}return d.headers=s,d.query=i,d.body=f,d}serializeQuery(t,r,o){let n=this.serializer,a=t.getMergedTraits();if(a.httpQueryParams){for(let i in r)if(!(i in o)){let s=r[i],c=t.getValueSchema();Object.assign(c.getMergedTraits(),{...a,httpQuery:i,httpQueryParams:void 0}),this.serializeQuery(c,s,o)}return}if(t.isListSchema()){let i=!!t.getMergedTraits().sparse,s=[];for(let c of r){n.write([t.getValueSchema(),a],c);let l=n.flush();(i||l!==void 0)&&s.push(l)}o[a.httpQuery]=s}else n.write([t,a],r),o[a.httpQuery]=n.flush()}async deserializeResponse(t,r,o){let n=this.deserializer,a=Pt.of(t.output),i={};if(o.statusCode>=300){let c=await pc(o.body,r);throw c.byteLength>0&&Object.assign(i,await n.read(15,c)),await this.handleError(t,r,o,i,this.deserializeMetadata(o)),new Error("@smithy/core/protocols - HTTP Protocol error handler failed to throw.")}for(let c in o.headers){let l=o.headers[c];delete o.headers[c],o.headers[c.toLowerCase()]=l}let s=await this.deserializeHttpMessage(a,r,o,i);if(s.length){let c=await pc(o.body,r);if(c.byteLength>0){let l=await n.read(a,c);for(let p of s)l[p]!=null&&(i[p]=l[p])}}else s.discardResponseBody&&await pc(o.body,r);return i.$metadata=this.deserializeMetadata(o),i}async deserializeHttpMessage(t,r,o,n,a){let i;n instanceof Set?i=a:i=n;let s=!0,c=this.deserializer,l=Pt.of(t),p=[];for(let[u,m]of l.structIterator()){let f=m.getMemberTraits();if(f.httpPayload){if(s=!1,m.isStreaming())m.isStructSchema()?i[u]=await this.deserializeEventStream({response:o,responseSchema:l}):i[u]=_Q(o.body);else if(o.body){let h=await pc(o.body,r);h.byteLength>0&&(i[u]=await c.read(m,h))}}else if(f.httpHeader){let d=String(f.httpHeader).toLowerCase(),h=o.headers[d];if(h!=null)if(m.isListSchema()){let y=m.getValueSchema();y.getMergedTraits().httpHeader=d;let g;y.isTimestampSchema()&&y.getSchema()===4?g=jQ(h,",",2):g=a_(h);let b=[];for(let x of g)b.push(await c.read(y,x.trim()));i[u]=b}else i[u]=await c.read(m,h)}else if(f.httpPrefixHeaders!==void 0){i[u]={};for(let d in o.headers)if(d.startsWith(f.httpPrefixHeaders)){let h=o.headers[d],y=m.getValueSchema();y.getMergedTraits().httpHeader=d,i[u][d.slice(f.httpPrefixHeaders.length)]=await c.read(y,h)}}else f.httpResponseCode?i[u]=o.statusCode:p.push(u)}return p.discardResponseBody=s,p}};s_();function fc(e,t){if(t.timestampFormat.useTrait&&e.isTimestampSchema()&&(e.getSchema()===5||e.getSchema()===6||e.getSchema()===7))return e.getSchema();let{httpLabel:r,httpPrefixHeaders:o,httpHeader:n,httpQuery:a}=e.getMergedTraits();return(t.httpBindings?typeof o=="string"||n?6:a||r?5:void 0:void 0)??t.timestampFormat.default}var p_=class extends Gi{constructor(r){super();F(this,"settings");this.settings=r}read(r,o){let n=Pt.of(r);if(n.isListSchema())return a_(o).map(a=>this.read(n.getValueSchema(),a));if(n.isBlobSchema())return(this.serdeContext?.base64Decoder??ci)(o);if(n.isTimestampSchema())switch(fc(n,this.settings)){case 5:return HQ(o);case 6:return VQ(o);case 7:return WQ(o);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",o),new Date(o)}if(n.isStringSchema()){let a=n.getMergedTraits().mediaType,i=o;if(a)return n.getMergedTraits().httpHeader&&(i=this.base64ToUtf8(i)),(a==="application/json"||a.endsWith("+json"))&&(i=Mn.from(i)),i}return n.isNumericSchema()?Number(o):n.isBigIntegerSchema()?BigInt(o):n.isBigDecimalSchema()?new qo(o,"bigDecimal"):n.isBooleanSchema()?String(o).toLowerCase()==="true":o}base64ToUtf8(r){return(this.serdeContext?.utf8Encoder??xg)((this.serdeContext?.base64Decoder??ci)(r))}};s_();var u_=class extends Gi{constructor(r,o){super();F(this,"codecDeserializer");F(this,"stringDeserializer");this.codecDeserializer=r,this.stringDeserializer=new p_(o)}setSerdeContext(r){this.stringDeserializer.setSerdeContext(r),this.codecDeserializer.setSerdeContext(r),this.serdeContext=r}read(r,o){let n=Pt.of(r),a=n.getMergedTraits(),i=this.serdeContext?.utf8Encoder??xg;if(a.httpHeader||a.httpResponseCode)return this.stringDeserializer.read(n,i(o));if(a.httpPayload){if(n.isBlobSchema()){let s=this.serdeContext?.utf8Decoder??i_;return typeof o=="string"?s(o):o}else if(n.isStringSchema())return"byteLength"in o?i(o):o}return this.codecDeserializer.read(n,o)}};var m_=class extends Gi{constructor(r){super();F(this,"settings");F(this,"stringBuffer","");this.settings=r}write(r,o){let n=Pt.of(r);switch(typeof o){case"object":if(o===null){this.stringBuffer="null";return}if(n.isTimestampSchema()){if(!(o instanceof Date))throw new Error(`@smithy/core/protocols - received non-Date value ${o} when schema expected Date in ${n.getName(!0)}`);switch(fc(n,this.settings)){case 5:this.stringBuffer=o.toISOString().replace(".000Z","Z");break;case 6:this.stringBuffer=o_(o);break;case 7:this.stringBuffer=String(o.getTime()/1e3);break;default:console.warn("Missing timestamp format, using epoch seconds",o),this.stringBuffer=String(o.getTime()/1e3)}return}if(n.isBlobSchema()&&"byteLength"in o){this.stringBuffer=(this.serdeContext?.base64Encoder??Ra)(o);return}if(n.isListSchema()&&Array.isArray(o)){let s="";for(let c of o){this.write([n.getValueSchema(),n.getMergedTraits()],c);let l=this.flush(),p=n.getValueSchema().isTimestampSchema()?l:LQ(l);s!==""&&(s+=", "),s+=p}this.stringBuffer=s;return}this.stringBuffer=JSON.stringify(o,null,2);break;case"string":let a=n.getMergedTraits().mediaType,i=o;if(a&&((a==="application/json"||a.endsWith("+json"))&&(i=Mn.from(i)),n.getMergedTraits().httpHeader)){this.stringBuffer=(this.serdeContext?.base64Encoder??Ra)(i.toString());return}this.stringBuffer=o;break;default:n.isIdempotencyToken()?this.stringBuffer=Vm():this.stringBuffer=String(o)}}flush(){let r=this.stringBuffer;return this.stringBuffer="",r}};var f_=class{constructor(t,r,o=new m_(r)){F(this,"codecSerializer");F(this,"stringSerializer");F(this,"buffer");this.codecSerializer=t,this.stringSerializer=o}setSerdeContext(t){this.codecSerializer.setSerdeContext(t),this.stringSerializer.setSerdeContext(t)}write(t,r){let o=Pt.of(t),n=o.getMergedTraits();if(n.httpHeader||n.httpLabel||n.httpQuery){this.stringSerializer.write(o,r),this.buffer=this.stringSerializer.flush();return}return this.codecSerializer.write(o,r)}flush(){if(this.buffer!==void 0){let t=this.buffer;return this.buffer=void 0,t}return this.codecSerializer.flush()}};function ZQ(e,t,r){e.__smithy_context?e.__smithy_context.features||(e.__smithy_context.features={}):e.__smithy_context={features:{}},e.__smithy_context.features[t]=r}var d_=class{constructor(t){F(this,"authSchemes",new Map);for(let r in t){let o=t[r];o!==void 0&&this.authSchemes.set(r,o)}}getIdentityProvider(t){return this.authSchemes.get(t)}};var wEe=e=>function(r){return HR(r)&&r.expiration.getTime()-Date.now()<e};var eJ=wEe(3e5),HR=e=>e.expiration!==void 0,tJ=(e,t,r)=>{if(e===void 0)return;let o=typeof e!="function"?async()=>Promise.resolve(e):e,n,a,i,s=!1,c=async l=>{a||(a=o(l));try{n=await a,i=!0,s=!1}finally{a=void 0}return n};return t===void 0?async l=>((!i||l?.forceRefresh)&&(n=await c(l)),n):async l=>((!i||l?.forceRefresh)&&(n=await c(l)),s?n:r(n)?(t(n)&&await c(l),n):(s=!0,n))};var SEe=void 0;function kEe(e){return e===void 0?!0:typeof e=="string"&&e.length<=50}function rJ(e){let t=Wm(e.userAgentAppId??SEe),{customUserAgent:r}=e;return Object.assign(e,{customUserAgent:typeof r=="string"?[[r]]:r,userAgentAppId:async()=>{let o=await t();if(!kEe(o)){let n=e.logger?.constructor?.name==="NoOpLogger"||!e.logger?console:e.logger;typeof o!="string"?n?.warn("userAgentAppId must be a string or undefined."):o.length>50&&n?.warn("The provided userAgentAppId exceeds the maximum length of 50 characters.")}return o}})}var h_=class{constructor({size:t,params:r}){F(this,"capacity");F(this,"data",new Map);F(this,"parameters",[]);this.capacity=t??50,r&&(this.parameters=r)}get(t,r){let o=this.hash(t);if(o===!1)return r();if(!this.data.has(o)){if(this.data.size>this.capacity+10){let n=this.data.keys(),a=0;for(;;){let{value:i,done:s}=n.next();if(this.data.delete(i),s||++a>10)break}}this.data.set(o,r())}return this.data.get(o)}size(){return this.data.size}hash(t){let r="",{parameters:o}=this;if(o.length===0)return!1;for(let n of o){let a=String(t[n]??"");if(a.includes("|;"))return!1;r+=a+"|;"}return r}};var vr=class extends Error{constructor(t){super(t),this.name="EndpointError"}};var Gs="endpoints";function Da(e){return typeof e!="object"||e==null?e:"ref"in e?`$${Da(e.ref)}`:"fn"in e?`${e.fn}(${(e.argv||[]).map(Da).join(", ")})`:JSON.stringify(e,null,2)}var wg={};var oJ=(e,t)=>e===t;function nJ(...e){for(let t of e)if(t!=null)return t}var aJ=e=>{let t=e.split("."),r=[];for(let o of t){let n=o.indexOf("[");if(n!==-1){if(o.indexOf("]")!==o.length-1)throw new vr(`Path: '${e}' does not end with ']'`);let a=o.slice(n+1,-1);if(Number.isNaN(parseInt(a)))throw new vr(`Invalid array index: '${a}' in path: '${e}'`);n!==0&&r.push(o.slice(0,n)),r.push(a)}else r.push(o)}return r};var g_=(e,t)=>aJ(t).reduce((r,o)=>{if(typeof r!="object")throw new vr(`Index '${o}' in '${t}' not found in '${JSON.stringify(e)}'`);if(Array.isArray(r)){let n=parseInt(o);return r[n<0?r.length+n:n]}return r[o]},e);var iJ=e=>e!=null;var _Ee=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),jm=(e,t=!1)=>{if(!t)return _Ee.test(e);let r=e.split(".");for(let o of r)if(!jm(o))return!1;return!0};function sJ(e,t,r){return e?t:r}var lJ=e=>!e;var EEe=new RegExp("^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$"),qb=e=>EEe.test(e)||e.startsWith("[")&&e.endsWith("]");var VR={[gg.HTTP]:80,[gg.HTTPS]:443},cJ=e=>{let t=(()=>{try{if(e instanceof URL)return e;if(typeof e=="object"&&"hostname"in e){let{hostname:m,port:f,protocol:d="",path:h="",query:y={}}=e,g=new URL(`${d}//${m}${f?`:${f}`:""}${h}`);return g.search=Object.entries(y).map(([b,x])=>`${b}=${x}`).join("&"),g}return new URL(e)}catch{return null}})();if(!t)return console.error(`Unable to parse ${JSON.stringify(e)} as a whatwg URL.`),null;let r=t.href,{host:o,hostname:n,pathname:a,protocol:i,search:s}=t;if(s)return null;let c=i.slice(0,-1);if(!Object.values(gg).includes(c))return null;let l=qb(n),p=r.includes(`${o}:${VR[c]}`)||typeof e=="string"&&e.includes(`${o}:${VR[c]}`),u=`${o}${p?`:${VR[c]}`:""}`;return{scheme:c,authority:u,path:a,normalizedPath:a.endsWith("/")?a:`${a}/`,isIp:l}};function pJ(e,t,r){if(r===1)return[e];if(e==="")return[""];let o=e.split(t);return r===0?o:o.slice(0,r-1).concat(o.slice(1).join(t))}var uJ=(e,t)=>e===t;var mJ=(e,t,r,o)=>e==null||t>=r||e.length<r||/[^\u0000-\u007f]/.test(e)?null:o?e.substring(e.length-r,e.length-t):e.substring(t,r);var fJ=e=>encodeURIComponent(e).replace(/[!*'()]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`);var dJ={booleanEquals:oJ,coalesce:nJ,getAttr:g_,isSet:iJ,isValidHostLabel:jm,ite:sJ,not:lJ,parseURL:cJ,split:pJ,stringEquals:uJ,substring:mJ,uriEncode:fJ};var y_=(e,t)=>{let r=[],{referenceRecord:o,endpointParams:n}=t,a=0;for(;a<e.length;){let i=e.indexOf("{",a);if(i===-1){r.push(e.slice(a));break}r.push(e.slice(a,i));let s=e.indexOf("}",i);if(s===-1){r.push(e.slice(i));break}e[i+1]==="{"&&e[s+1]==="}"&&(r.push(e.slice(i+1,s)),a=s+2);let c=e.substring(i+1,s);if(c.includes("#")){let[l,p]=c.split("#");r.push(g_(o[l]??n[l],p))}else r.push(o[c]??n[c]);a=s+1}return r.join("")};var hJ=({ref:e},t)=>t.referenceRecord[e]??t.endpointParams[e];var Gm=(e,t,r)=>{if(typeof e=="string")return y_(e,r);if(e.fn)return gJ.callFunction(e,r);if(e.ref)return hJ(e,r);throw new vr(`'${t}': ${String(e)} is not a string, function or reference.`)},v_=({fn:e,argv:t},r)=>{let o=Array(t.length);for(let i=0;i<o.length;++i){let s=t[i];typeof s=="boolean"||typeof s=="number"?o[i]=s:o[i]=gJ.evaluateExpression(s,"arg",r)}let n=e.indexOf(".");if(n!==-1){let s=wg[e.slice(0,n)]?.[e.slice(n+1)];if(typeof s=="function")return s(...o)}let a=dJ[e];if(typeof a=="function")return a(...o);throw new Error(`function ${e} not loaded in endpointFunctions.`)},gJ={evaluateExpression:Gm,callFunction:v_};var yJ=(e,t)=>{let{assign:r}=e;if(r&&r in t.referenceRecord)throw new vr(`'${r}' is already defined in Reference Record.`);let o=v_(e,t);t.logger?.debug?.(`${Gs} evaluateCondition: ${Da(e)} = ${Da(o)}`);let n=o===""?!0:!!o;return r!=null?{result:n,toAssign:{name:r,value:o}}:{result:n}};var vJ=(e,t)=>Object.entries(e??{}).reduce((r,[o,n])=>(r[o]=n.map(a=>{let i=Gm(a,"Header value entry",t);if(typeof i!="string")throw new vr(`Header '${o}' value '${i}' is not a string`);return i}),r),{});var jR=(e,t)=>Object.entries(e).reduce((r,[o,n])=>(r[o]=xJ.getEndpointProperty(n,t),r),{}),bJ=(e,t)=>{if(Array.isArray(e))return e.map(r=>bJ(r,t));switch(typeof e){case"string":return y_(e,t);case"object":if(e===null)throw new vr(`Unexpected endpoint property: ${e}`);return xJ.getEndpointProperties(e,t);case"boolean":return e;default:throw new vr(`Unexpected endpoint property type: ${typeof e}`)}},xJ={getEndpointProperty:bJ,getEndpointProperties:jR};var wJ=(e,t)=>{let r=Gm(e,"Endpoint URL",t);if(typeof r=="string")try{return new URL(r)}catch(o){throw console.error(`Failed to construct URL with ${r}`,o),o}throw new vr(`Endpoint URL must be a string, got ${typeof r}`)};var Sg=(e=[],t)=>{let r={},o={...t,referenceRecord:{...t.referenceRecord}},n=!1;for(let a of e){let{result:i,toAssign:s}=yJ(a,o);if(!i)return{result:i};s&&(n=!0,r[s.name]=s.value,o.referenceRecord[s.name]=s.value,t.logger?.debug?.(`${Gs} assign: ${s.name} := ${Da(s.value)}`))}return n?{result:!0,referenceRecord:r}:{result:!0}};var SJ=(e,t)=>{let{conditions:r,endpoint:o}=e,{result:n,referenceRecord:a}=Sg(r,t);if(!n)return;let i=a?{...t,referenceRecord:{...t.referenceRecord,...a}}:t,{url:s,properties:c,headers:l}=o;t.logger?.debug?.(`${Gs} Resolving endpoint from template: ${Da(o)}`);let p={url:wJ(s,i)};return l!=null&&(p.headers=vJ(l,i)),c!=null&&(p.properties=jR(c,i)),p};var kJ=(e,t)=>{let{conditions:r,error:o}=e,{result:n,referenceRecord:a}=Sg(r,t);if(!n)return;let i=a?{...t,referenceRecord:{...t.referenceRecord,...a}}:t;throw new vr(Gm(o,"Error",i))};var GR=(e,t)=>{for(let r of e)if(r.type==="endpoint"){let o=SJ(r,t);if(o)return o}else if(r.type==="error")kJ(r,t);else if(r.type==="tree"){let o=_J.evaluateTreeRule(r,t);if(o)return o}else throw new vr(`Unknown endpoint rule: ${r}`);throw new vr("Rules evaluation failed")},IEe=(e,t)=>{let{conditions:r,rules:o}=e,{result:n,referenceRecord:a}=Sg(r,t);if(!n)return;let i=a?{...t,referenceRecord:{...t.referenceRecord,...a}}:t;return _J.evaluateRules(o,i)},_J={evaluateRules:GR,evaluateTreeRule:IEe};var EJ=(e,t)=>{let{endpointParams:r,logger:o}=t,{parameters:n,rules:a}=e;t.logger?.debug?.(`${Gs} Initial EndpointParams: ${Da(r)}`);for(let s in n){let c=n[s],l=r[s];if(l==null&&c.default!=null){r[s]=c.default;continue}if(c.required&&l==null)throw new vr(`Missing required parameter: '${s}'`)}let i=GR(a,{endpointParams:r,logger:o,referenceRecord:{}});return t.logger?.debug?.(`${Gs} Resolved endpoint: ${Da(i)}`),i};var qR=(e,t=!1)=>{if(t){for(let r of e.split("."))if(!qR(r))return!1;return!0}return!(!jm(e)||e.length<3||e.length>63||e!==e.toLowerCase()||qb(e))};var IJ=":",TEe="/",TJ=e=>{let t=e.split(IJ);if(t.length<6)return null;let[r,o,n,a,i,...s]=t;if(r!=="arn"||o===""||n===""||s.join(IJ)==="")return null;let c=s.map(l=>l.split(TEe)).flat();return{partition:o,service:n,region:a,accountId:i,resourceId:c}};var CJ={partitions:[{id:"aws",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-east-1",name:"aws",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^(us|eu|ap|sa|ca|me|af|il|mx)\\-\\w+\\-\\d+$",regions:{"af-south-1":{description:"Africa (Cape Town)"},"ap-east-1":{description:"Asia Pacific (Hong Kong)"},"ap-east-2":{description:"Asia Pacific (Taipei)"},"ap-northeast-1":{description:"Asia Pacific (Tokyo)"},"ap-northeast-2":{description:"Asia Pacific (Seoul)"},"ap-northeast-3":{description:"Asia Pacific (Osaka)"},"ap-south-1":{description:"Asia Pacific (Mumbai)"},"ap-south-2":{description:"Asia Pacific (Hyderabad)"},"ap-southeast-1":{description:"Asia Pacific (Singapore)"},"ap-southeast-2":{description:"Asia Pacific (Sydney)"},"ap-southeast-3":{description:"Asia Pacific (Jakarta)"},"ap-southeast-4":{description:"Asia Pacific (Melbourne)"},"ap-southeast-5":{description:"Asia Pacific (Malaysia)"},"ap-southeast-6":{description:"Asia Pacific (New Zealand)"},"ap-southeast-7":{description:"Asia Pacific (Thailand)"},"aws-global":{description:"aws global region"},"ca-central-1":{description:"Canada (Central)"},"ca-west-1":{description:"Canada West (Calgary)"},"eu-central-1":{description:"Europe (Frankfurt)"},"eu-central-2":{description:"Europe (Zurich)"},"eu-north-1":{description:"Europe (Stockholm)"},"eu-south-1":{description:"Europe (Milan)"},"eu-south-2":{description:"Europe (Spain)"},"eu-west-1":{description:"Europe (Ireland)"},"eu-west-2":{description:"Europe (London)"},"eu-west-3":{description:"Europe (Paris)"},"il-central-1":{description:"Israel (Tel Aviv)"},"me-central-1":{description:"Middle East (UAE)"},"me-south-1":{description:"Middle East (Bahrain)"},"mx-central-1":{description:"Mexico (Central)"},"sa-east-1":{description:"South America (Sao Paulo)"},"us-east-1":{description:"US East (N. Virginia)"},"us-east-2":{description:"US East (Ohio)"},"us-west-1":{description:"US West (N. California)"},"us-west-2":{description:"US West (Oregon)"}}},{id:"aws-cn",outputs:{dnsSuffix:"amazonaws.com.cn",dualStackDnsSuffix:"api.amazonwebservices.com.cn",implicitGlobalRegion:"cn-northwest-1",name:"aws-cn",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^cn\\-\\w+\\-\\d+$",regions:{"aws-cn-global":{description:"aws-cn global region"},"cn-north-1":{description:"China (Beijing)"},"cn-northwest-1":{description:"China (Ningxia)"}}},{id:"aws-eusc",outputs:{dnsSuffix:"amazonaws.eu",dualStackDnsSuffix:"api.amazonwebservices.eu",implicitGlobalRegion:"eusc-de-east-1",name:"aws-eusc",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^eusc\\-(de)\\-\\w+\\-\\d+$",regions:{"eusc-de-east-1":{description:"EU (Germany)"}}},{id:"aws-iso",outputs:{dnsSuffix:"c2s.ic.gov",dualStackDnsSuffix:"api.aws.ic.gov",implicitGlobalRegion:"us-iso-east-1",name:"aws-iso",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-iso\\-\\w+\\-\\d+$",regions:{"aws-iso-global":{description:"aws-iso global region"},"us-iso-east-1":{description:"US ISO East"},"us-iso-west-1":{description:"US ISO WEST"}}},{id:"aws-iso-b",outputs:{dnsSuffix:"sc2s.sgov.gov",dualStackDnsSuffix:"api.aws.scloud",implicitGlobalRegion:"us-isob-east-1",name:"aws-iso-b",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-isob\\-\\w+\\-\\d+$",regions:{"aws-iso-b-global":{description:"aws-iso-b global region"},"us-isob-east-1":{description:"US ISOB East (Ohio)"},"us-isob-west-1":{description:"US ISOB West"}}},{id:"aws-iso-e",outputs:{dnsSuffix:"cloud.adc-e.uk",dualStackDnsSuffix:"api.cloud-aws.adc-e.uk",implicitGlobalRegion:"eu-isoe-west-1",name:"aws-iso-e",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^eu\\-isoe\\-\\w+\\-\\d+$",regions:{"aws-iso-e-global":{description:"aws-iso-e global region"},"eu-isoe-west-1":{description:"EU ISOE West"}}},{id:"aws-iso-f",outputs:{dnsSuffix:"csp.hci.ic.gov",dualStackDnsSuffix:"api.aws.hci.ic.gov",implicitGlobalRegion:"us-isof-south-1",name:"aws-iso-f",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-isof\\-\\w+\\-\\d+$",regions:{"aws-iso-f-global":{description:"aws-iso-f global region"},"us-isof-east-1":{description:"US ISOF EAST"},"us-isof-south-1":{description:"US ISOF SOUTH"}}},{id:"aws-us-gov",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-gov-west-1",name:"aws-us-gov",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-gov\\-\\w+\\-\\d+$",regions:{"aws-us-gov-global":{description:"aws-us-gov global region"},"us-gov-east-1":{description:"AWS GovCloud (US-East)"},"us-gov-west-1":{description:"AWS GovCloud (US-West)"}}}],version:"1.1"};var NEe=CJ,AEe="",NJ=e=>{let{partitions:t}=NEe;for(let o of t){let{regions:n,outputs:a}=o;for(let[i,s]of Object.entries(n))if(i===e)return{...a,...s}}for(let o of t){let{regionRegex:n,outputs:a}=o;if(new RegExp(n).test(e))return{...a}}let r=t.find(o=>o.id==="aws");if(!r)throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.");return{...r.outputs}};var AJ=()=>AEe;var KR={isVirtualHostableS3Bucket:qR,parseArn:TJ,partition:NJ};wg.aws=KR;var b_=class e{constructor(t){F(this,"method");F(this,"protocol");F(this,"hostname");F(this,"port");F(this,"path");F(this,"query");F(this,"headers");F(this,"username");F(this,"password");F(this,"fragment");F(this,"body");this.method=t.method||"GET",this.hostname=t.hostname||"localhost",this.port=t.port,this.query=t.query||{},this.headers=t.headers||{},this.body=t.body,this.protocol=t.protocol?t.protocol.slice(-1)!==":"?`${t.protocol}:`:t.protocol:"https:",this.path=t.path?t.path.charAt(0)!=="/"?`/${t.path}`:t.path:"/",this.username=t.username,this.password=t.password,this.fragment=t.fragment}static clone(t){let r=new e({...t,headers:{...t.headers}});return r.query&&(r.query=REe(r.query)),r}static isInstance(t){if(!t)return!1;let r=t;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return e.clone(this)}};function REe(e){return Object.keys(e).reduce((t,r)=>{let o=e[r];return{...t,[r]:Array.isArray(o)?[...o]:o}},{})}function RJ(e,t,r){return e.$source||(e.$source={}),e.$source[t]=r,e}function pi(e,t,r){e.__aws_sdk_context?e.__aws_sdk_context.features||(e.__aws_sdk_context.features={}):e.__aws_sdk_context={features:{}},e.__aws_sdk_context.features[t]=r}var dc=class e{constructor(t){F(this,"method");F(this,"protocol");F(this,"hostname");F(this,"port");F(this,"path");F(this,"query");F(this,"headers");F(this,"username");F(this,"password");F(this,"fragment");F(this,"body");this.method=t.method||"GET",this.hostname=t.hostname||"localhost",this.port=t.port,this.query=t.query||{},this.headers=t.headers||{},this.body=t.body,this.protocol=t.protocol?t.protocol.slice(-1)!==":"?`${t.protocol}:`:t.protocol:"https:",this.path=t.path?t.path.charAt(0)!=="/"?`/${t.path}`:t.path:"/",this.username=t.username,this.password=t.password,this.fragment=t.fragment}static clone(t){let r=new e({...t,headers:{...t.headers}});return r.query&&(r.query=DEe(r.query)),r}static isInstance(t){if(!t)return!1;let r=t;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return e.clone(this)}};function DEe(e){return Object.keys(e).reduce((t,r)=>{let o=e[r];return{...t,[r]:Array.isArray(o)?[...o]:o}},{})}var x_=class{constructor(t){F(this,"statusCode");F(this,"reason");F(this,"headers");F(this,"body");this.statusCode=t.statusCode,this.reason=t.reason,this.headers=t.headers||{},this.body=t.body}static isInstance(t){if(!t)return!1;let r=t;return typeof r.statusCode=="number"&&typeof r.headers=="object"}};var XR=e=>x_.isInstance(e)?e.headers?.date??e.headers?.Date:void 0;var w_=e=>new Date(Date.now()+e);var DJ=(e,t)=>Math.abs(w_(t).getTime()-e)>=3e5;var YR=(e,t)=>{let r=Date.parse(e);return DJ(r,t)?r-Date.now():t};var Kb=(e,t)=>{if(!t)throw new Error(`Property \`${e}\` is not resolved for AWS SDK SigV4Auth`);return t},FJ=async e=>{let t=Kb("context",e.context),r=Kb("config",e.config),o=t.endpointV2?.properties?.authSchemes?.[0],a=await Kb("signer",r.signer)(o),i=e?.signingRegion,s=e?.signingRegionSet,c=e?.signingName;return{config:r,signer:a,signingRegion:i,signingRegionSet:s,signingName:c}},Xb=class{async sign(t,r,o){if(!dc.isInstance(t))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");let n=await FJ(o),{config:a,signer:i}=n,{signingRegion:s,signingName:c}=n,l=o.context;if(l?.authSchemes?.length??!1){let[u,m]=l.authSchemes;u?.name==="sigv4a"&&m?.name==="sigv4"&&(s=m?.signingRegion??s,c=m?.signingName??c)}return await i.sign(t,{signingDate:w_(a.systemClockOffset),signingRegion:s,signingService:c})}errorHandler(t){return r=>{let o=r.ServerTime??XR(r.$response);if(o){let n=Kb("config",t.config),a=n.systemClockOffset;n.systemClockOffset=YR(o,n.systemClockOffset),n.systemClockOffset!==a&&r.$metadata&&(r.$metadata.clockSkewCorrected=!0)}throw r}}successHandler(t,r){let o=XR(t);if(o){let n=Kb("config",r.config);n.systemClockOffset=YR(o,n.systemClockOffset)}}};var MJ=(e,t,r)=>{let o,n,a,i=!1,s=async()=>{n||(n=e());try{o=await n,a=!0,i=!1}finally{n=void 0}return o};return t===void 0?async c=>((!a||c?.forceRefresh)&&(o=await s()),o):async c=>((!a||c?.forceRefresh)&&(o=await s()),i?o:r&&!r(o)?(i=!0,o):(t(o)&&await s(),o))};var OJ={},QR={};for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();t.length===1&&(t=`0${t}`),OJ[e]=t,QR[t]=e}function PJ(e){if(e.length%2!==0)throw new Error("Hex encoded strings must have an even number length");let t=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2){let o=e.slice(r,r+2).toLowerCase();if(o in QR)t[r/2]=QR[o];else throw new Error(`Cannot decode unrecognized sequence ${o} as hexadecimal`)}return t}function Fa(e){let t="";for(let r=0;r<e.byteLength;r++)t+=OJ[e[r]];return t}var Yb=e=>new TextEncoder().encode(e);var qs=e=>typeof e=="string"?Yb(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e);var zJ=e=>{if(typeof e=="string")return e;if(typeof e!="object"||typeof e.byteOffset!="number"||typeof e.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(e)};var $J="X-Amz-Algorithm",LJ="X-Amz-Credential",JR="X-Amz-Date",BJ="X-Amz-SignedHeaders",UJ="X-Amz-Expires",ZR="X-Amz-Signature",eD="X-Amz-Security-Token";var tD="authorization",rD=JR.toLowerCase(),FEe="date",WJ=[tD,rD,FEe],HJ=ZR.toLowerCase(),Qb="x-amz-content-sha256",VJ=eD.toLowerCase();var jJ={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},GJ=/^proxy-/,qJ=/^sec-/;var S_="AWS4-HMAC-SHA256";var KJ="AWS4-HMAC-SHA256-PAYLOAD",XJ="UNSIGNED-PAYLOAD",YJ=50,oD="aws4_request",QJ=60*60*24*7;var k_={},nD=[],__=(e,t,r)=>`${e}/${t}/${r}/${oD}`,ZJ=async(e,t,r,o,n)=>{let a=await JJ(e,t.secretAccessKey,t.accessKeyId),i=`${r}:${o}:${n}:${Fa(a)}:${t.sessionToken}`;if(i in k_)return k_[i];for(nD.push(i);nD.length>YJ;)delete k_[nD.shift()];let s=`AWS4${t.secretAccessKey}`;for(let c of[r,o,n,oD])s=await JJ(e,s,c);return k_[i]=s};var JJ=(e,t,r)=>{let o=new e(t);return o.update(qs(r)),o.digest()};var aD=({headers:e},t,r)=>{let o={};for(let n of Object.keys(e).sort()){if(e[n]==null)continue;let a=n.toLowerCase();(a in jJ||t?.has(a)||GJ.test(a)||qJ.test(a))&&(!r||r&&!r.has(a))||(o[a]=e[n].trim().replace(/\s+/g," "))}return o};var E_=e=>typeof ArrayBuffer=="function"&&e instanceof ArrayBuffer||Object.prototype.toString.call(e)==="[object ArrayBuffer]";var I_=async({headers:e,body:t},r)=>{for(let o of Object.keys(e))if(o.toLowerCase()===Qb)return e[o];if(t==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof t=="string"||ArrayBuffer.isView(t)||E_(t)){let o=new r;return o.update(qs(t)),Fa(await o.digest())}return XJ};var T_=class{format(t){let r=[];for(let a of Object.keys(t)){let i=Yb(a);r.push(Uint8Array.from([i.byteLength]),i,this.formatHeaderValue(t[a]))}let o=new Uint8Array(r.reduce((a,i)=>a+i.byteLength,0)),n=0;for(let a of r)o.set(a,n),n+=a.byteLength;return o}formatHeaderValue(t){switch(t.type){case"boolean":return Uint8Array.from([t.value?0:1]);case"byte":return Uint8Array.from([2,t.value]);case"short":let r=new DataView(new ArrayBuffer(3));return r.setUint8(0,3),r.setInt16(1,t.value,!1),new Uint8Array(r.buffer);case"integer":let o=new DataView(new ArrayBuffer(5));return o.setUint8(0,4),o.setInt32(1,t.value,!1),new Uint8Array(o.buffer);case"long":let n=new Uint8Array(9);return n[0]=5,n.set(t.value.bytes,1),n;case"binary":let a=new DataView(new ArrayBuffer(3+t.value.byteLength));a.setUint8(0,6),a.setUint16(1,t.value.byteLength,!1);let i=new Uint8Array(a.buffer);return i.set(t.value,3),i;case"string":let s=Yb(t.value),c=new DataView(new ArrayBuffer(3+s.byteLength));c.setUint8(0,7),c.setUint16(1,s.byteLength,!1);let l=new Uint8Array(c.buffer);return l.set(s,3),l;case"timestamp":let p=new Uint8Array(9);return p[0]=8,p.set(iD.fromNumber(t.value.valueOf()).bytes,1),p;case"uuid":if(!MEe.test(t.value))throw new Error(`Invalid UUID received: ${t.value}`);let u=new Uint8Array(17);return u[0]=9,u.set(PJ(t.value.replace(/\-/g,"")),1),u}}},eZ;(function(e){e[e.boolTrue=0]="boolTrue",e[e.boolFalse=1]="boolFalse",e[e.byte=2]="byte",e[e.short=3]="short",e[e.integer=4]="integer",e[e.long=5]="long",e[e.byteArray=6]="byteArray",e[e.string=7]="string",e[e.timestamp=8]="timestamp",e[e.uuid=9]="uuid"})(eZ||(eZ={}));var MEe=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,iD=class e{constructor(t){F(this,"bytes");if(this.bytes=t,t.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(t){if(t>9223372036854776e3||t<-9223372036854776e3)throw new Error(`${t} is too large (or, if negative, too small) to represent as an Int64`);let r=new Uint8Array(8);for(let o=7,n=Math.abs(Math.round(t));o>-1&&n>0;o--,n/=256)r[o]=n;return t<0&&tZ(r),new e(r)}valueOf(){let t=this.bytes.slice(0),r=t[0]&128;return r&&tZ(t),parseInt(Fa(t),16)*(r?-1:1)}toString(){return String(this.valueOf())}};function tZ(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,e[t]===0);t--);}var rZ=(e,t)=>{e=e.toLowerCase();for(let r of Object.keys(t))if(e===r.toLowerCase())return!0;return!1};var oZ=(e,t={})=>{let{headers:r,query:o={}}=dc.clone(e);for(let n of Object.keys(r)){let a=n.toLowerCase();(a.slice(0,6)==="x-amz-"&&!t.unhoistableHeaders?.has(a)||t.hoistableHeaders?.has(a))&&(o[n]=r[n],delete r[n])}return{...e,headers:r,query:o}};var sD=e=>{e=dc.clone(e);for(let t of Object.keys(e.headers))WJ.indexOf(t.toLowerCase())>-1&&delete e.headers[t];return e};var nZ=({query:e={}})=>{let t=[],r={};for(let o of Object.keys(e)){if(o.toLowerCase()===HJ)continue;let n=jo(o);t.push(n);let a=e[o];typeof a=="string"?r[n]=`${n}=${jo(a)}`:Array.isArray(a)&&(r[n]=a.slice(0).reduce((i,s)=>i.concat([`${n}=${jo(s)}`]),[]).sort().join("&"))}return t.sort().map(o=>r[o]).filter(o=>o).join("&")};var aZ=e=>OEe(e).toISOString().replace(/\.\d{3}Z$/,"Z"),OEe=e=>typeof e=="number"?new Date(e*1e3):typeof e=="string"?Number(e)?new Date(Number(e)*1e3):new Date(e):e;var C_=class{constructor({applyChecksum:t,credentials:r,region:o,service:n,sha256:a,uriEscapePath:i=!0}){F(this,"service");F(this,"regionProvider");F(this,"credentialProvider");F(this,"sha256");F(this,"uriEscapePath");F(this,"applyChecksum");this.service=n,this.sha256=a,this.uriEscapePath=i,this.applyChecksum=typeof t=="boolean"?t:!0,this.regionProvider=Vo(o),this.credentialProvider=Vo(r)}createCanonicalRequest(t,r,o){let n=Object.keys(r).sort();return`${t.method}
152
+ ${this.getCanonicalPath(t)}
153
+ ${nZ(t)}
154
+ ${n.map(a=>`${a}:${r[a]}`).join(`
155
+ `)}
156
+
157
+ ${n.join(";")}
158
+ ${o}`}async createStringToSign(t,r,o,n){let a=new this.sha256;a.update(qs(o));let i=await a.digest();return`${n}
159
+ ${t}
160
+ ${r}
161
+ ${Fa(i)}`}getCanonicalPath({path:t}){if(this.uriEscapePath){let r=[];for(let a of t.split("/"))a?.length!==0&&a!=="."&&(a===".."?r.pop():r.push(a));let o=`${t?.startsWith("/")?"/":""}${r.join("/")}${r.length>0&&t?.endsWith("/")?"/":""}`;return jo(o).replace(/%2F/g,"/")}return t}validateResolvedCredentials(t){if(typeof t!="object"||typeof t.accessKeyId!="string"||typeof t.secretAccessKey!="string")throw new Error("Resolved credential object is not valid")}formatDate(t){let r=aZ(t).replace(/[\-:]/g,"");return{longDate:r,shortDate:r.slice(0,8)}}getCanonicalHeaderList(t){return Object.keys(t).sort().join(";")}};var Jb=class extends C_{constructor({applyChecksum:r,credentials:o,region:n,service:a,sha256:i,uriEscapePath:s=!0}){super({applyChecksum:r,credentials:o,region:n,service:a,sha256:i,uriEscapePath:s});F(this,"headerFormatter",new T_)}async presign(r,o={}){let{signingDate:n=new Date,expiresIn:a=3600,unsignableHeaders:i,unhoistableHeaders:s,signableHeaders:c,hoistableHeaders:l,signingRegion:p,signingService:u}=o,m=await this.credentialProvider();this.validateResolvedCredentials(m);let f=p??await this.regionProvider(),{longDate:d,shortDate:h}=this.formatDate(n);if(a>QJ)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");let y=__(h,f,u??this.service),g=oZ(sD(r),{unhoistableHeaders:s,hoistableHeaders:l});m.sessionToken&&(g.query[eD]=m.sessionToken),g.query[$J]=S_,g.query[LJ]=`${m.accessKeyId}/${y}`,g.query[JR]=d,g.query[UJ]=a.toString(10);let b=aD(g,i,c);return g.query[BJ]=this.getCanonicalHeaderList(b),g.query[ZR]=await this.getSignature(d,y,this.getSigningKey(m,f,h,u),this.createCanonicalRequest(g,b,await I_(r,this.sha256))),g}async sign(r,o){return typeof r=="string"?this.signString(r,o):r.headers&&r.payload?this.signEvent(r,o):r.message?this.signMessage(r,o):this.signRequest(r,o)}async signEvent({headers:r,payload:o},{signingDate:n=new Date,priorSignature:a,signingRegion:i,signingService:s,eventStreamCredentials:c}){let l=i??await this.regionProvider(),{shortDate:p,longDate:u}=this.formatDate(n),m=__(p,l,s??this.service),f=await I_({headers:{},body:o},this.sha256),d=new this.sha256;d.update(r);let h=Fa(await d.digest()),y=[KJ,u,m,a,h,f].join(`
162
+ `);return this.signString(y,{signingDate:n,signingRegion:l,signingService:s,eventStreamCredentials:c})}async signMessage(r,{signingDate:o=new Date,signingRegion:n,signingService:a,eventStreamCredentials:i}){return this.signEvent({headers:this.headerFormatter.format(r.message.headers),payload:r.message.body},{signingDate:o,signingRegion:n,signingService:a,priorSignature:r.priorSignature,eventStreamCredentials:i}).then(c=>({message:r.message,signature:c}))}async signString(r,{signingDate:o=new Date,signingRegion:n,signingService:a,eventStreamCredentials:i}={}){let s=i??await this.credentialProvider();this.validateResolvedCredentials(s);let c=n??await this.regionProvider(),{shortDate:l}=this.formatDate(o),p=new this.sha256(await this.getSigningKey(s,c,l,a));return p.update(qs(r)),Fa(await p.digest())}async signRequest(r,{signingDate:o=new Date,signableHeaders:n,unsignableHeaders:a,signingRegion:i,signingService:s}={}){let c=await this.credentialProvider();this.validateResolvedCredentials(c);let l=i??await this.regionProvider(),p=sD(r),{longDate:u,shortDate:m}=this.formatDate(o),f=__(m,l,s??this.service);p.headers[rD]=u,c.sessionToken&&(p.headers[VJ]=c.sessionToken);let d=await I_(p,this.sha256);!rZ(Qb,p.headers)&&this.applyChecksum&&(p.headers[Qb]=d);let h=aD(p,a,n),y=await this.getSignature(u,f,this.getSigningKey(c,l,m,s),this.createCanonicalRequest(p,h,d));return p.headers[tD]=`${S_} Credential=${c.accessKeyId}/${f}, SignedHeaders=${this.getCanonicalHeaderList(h)}, Signature=${y}`,p}async getSignature(r,o,n,a){let i=await this.createStringToSign(r,o,a,S_),s=new this.sha256(await n);return s.update(qs(i)),Fa(await s.digest())}getSigningKey(r,o,n,a){return ZJ(this.sha256,r,n,o,a||this.service)}};var iZ=e=>{let t=e.credentials,r=!!e.credentials,o;Object.defineProperty(e,"credentials",{set(l){l&&l!==t&&l!==o&&(r=!0),t=l;let p=PEe(e,{credentials:t,credentialDefaultProvider:e.credentialDefaultProvider}),u=zEe(e,p);if(r&&!u.attributed){let m=typeof t=="object"&&t!==null;o=async f=>{let h=await u(f);return m&&(!h.$source||Object.keys(h.$source).length===0)?RJ(h,"CREDENTIALS_CODE","e"):h},o.memoized=u.memoized,o.configBound=u.configBound,o.attributed=!0}else o=u},get(){return o},enumerable:!0,configurable:!0}),e.credentials=t;let{signingEscapePath:n=!0,systemClockOffset:a=e.systemClockOffset||0,sha256:i}=e,s;return e.signer?s=Wm(e.signer):e.regionInfoProvider?s=()=>Wm(e.region)().then(async l=>[await e.regionInfoProvider(l,{useFipsEndpoint:await e.useFipsEndpoint(),useDualstackEndpoint:await e.useDualstackEndpoint()})||{},l]).then(([l,p])=>{let{signingRegion:u,signingService:m}=l;e.signingRegion=e.signingRegion||u||p,e.signingName=e.signingName||m||e.serviceId;let f={...e,credentials:e.credentials,region:e.signingRegion,service:e.signingName,sha256:i,uriEscapePath:n},d=e.signerConstructor||Jb;return new d(f)}):s=async l=>{l=Object.assign({},{name:"sigv4",signingName:e.signingName||e.defaultSigningName,signingRegion:await Wm(e.region)(),properties:{}},l);let p=l.signingRegion,u=l.signingName;e.signingRegion=e.signingRegion||p,e.signingName=e.signingName||u||e.serviceId;let m={...e,credentials:e.credentials,region:e.signingRegion,service:e.signingName,sha256:i,uriEscapePath:n},f=e.signerConstructor||Jb;return new f(m)},Object.assign(e,{systemClockOffset:a,signingEscapePath:n,signer:s})};function PEe(e,{credentials:t,credentialDefaultProvider:r}){let o;return t?t?.memoized?o=t:o=tJ(t,eJ,HR):r?o=Wm(r(Object.assign({},e,{parentClientConfig:e}))):o=async()=>{throw new Error("@aws-sdk/core::resolveAwsSdkSigV4Config - `credentials` not provided and no credentialDefaultProvider was configured.")},o.memoized=!0,o}function zEe(e,t){if(t.configBound)return t;let r=async o=>t({...o,callerClientConfig:e});return r.memoized=t.memoized,r.configBound=!0,r}var sZ=typeof TextEncoder=="function"?new TextEncoder:null,lZ=e=>{if(typeof e=="string"){if(sZ)return sZ.encode(e).byteLength;let t=e.length;for(let r=t-1;r>=0;r--){let o=e.charCodeAt(r);o>127&&o<=2047?t++:o>2047&&o<=65535&&(t+=2),o>=56320&&o<=57343&&r--}return t}else{if(typeof e.byteLength=="number")return e.byteLength;if(typeof e.size=="number")return e.size}throw new Error(`Body Length computation failed for ${e}`)};var qm=(e,t)=>{let r=[];if(e&&r.push(e),t)for(let o of t)r.push(o);return r},hc=(e,t)=>`${e||"anonymous"}${t&&t.length>0?` (a.k.a. ${t.join(",")})`:""}`,kg=()=>{let e=[],t=[],r=!1,o=new Set,n=u=>u.sort((m,f)=>cZ[f.step]-cZ[m.step]||pZ[f.priority||"normal"]-pZ[m.priority||"normal"]),a=u=>{let m=!1,f=d=>{let h=qm(d.name,d.aliases);if(h.includes(u)){m=!0;for(let y of h)o.delete(y);return!1}return!0};return e=e.filter(f),t=t.filter(f),m},i=u=>{let m=!1,f=d=>{if(d.middleware===u){m=!0;for(let h of qm(d.name,d.aliases))o.delete(h);return!1}return!0};return e=e.filter(f),t=t.filter(f),m},s=u=>(e.forEach(m=>{u.add(m.middleware,{...m})}),t.forEach(m=>{u.addRelativeTo(m.middleware,{...m})}),u.identifyOnResolve?.(p.identifyOnResolve()),u),c=u=>{let m=[];return u.before.forEach(f=>{f.before.length===0&&f.after.length===0?m.push(f):m.push(...c(f))}),m.push(u),u.after.reverse().forEach(f=>{f.before.length===0&&f.after.length===0?m.push(f):m.push(...c(f))}),m},l=(u=!1)=>{let m=[],f=[],d={};return e.forEach(y=>{let g={...y,before:[],after:[]};for(let b of qm(g.name,g.aliases))d[b]=g;m.push(g)}),t.forEach(y=>{let g={...y,before:[],after:[]};for(let b of qm(g.name,g.aliases))d[b]=g;f.push(g)}),f.forEach(y=>{if(y.toMiddleware){let g=d[y.toMiddleware];if(g===void 0){if(u)return;throw new Error(`${y.toMiddleware} is not found when adding ${hc(y.name,y.aliases)} middleware ${y.relation} ${y.toMiddleware}`)}y.relation==="after"&&g.after.push(y),y.relation==="before"&&g.before.push(y)}}),n(m).map(c).reduce((y,g)=>(y.push(...g),y),[])},p={add:(u,m={})=>{let{name:f,override:d,aliases:h}=m,y={step:"initialize",priority:"normal",middleware:u,...m},g=qm(f,h);if(g.length>0){if(g.some(b=>o.has(b))){if(!d)throw new Error(`Duplicate middleware name '${hc(f,h)}'`);for(let b of g){let x=e.findIndex(I=>I.name===b||I.aliases?.some(C=>C===b));if(x===-1)continue;let w=e[x];if(w.step!==y.step||y.priority!==w.priority)throw new Error(`"${hc(w.name,w.aliases)}" middleware with ${w.priority} priority in ${w.step} step cannot be overridden by "${hc(f,h)}" middleware with ${y.priority} priority in ${y.step} step.`);e.splice(x,1)}}for(let b of g)o.add(b)}e.push(y)},addRelativeTo:(u,m)=>{let{name:f,override:d,aliases:h}=m,y={middleware:u,...m},g=qm(f,h);if(g.length>0){if(g.some(b=>o.has(b))){if(!d)throw new Error(`Duplicate middleware name '${hc(f,h)}'`);for(let b of g){let x=t.findIndex(I=>I.name===b||I.aliases?.some(C=>C===b));if(x===-1)continue;let w=t[x];if(w.toMiddleware!==y.toMiddleware||w.relation!==y.relation)throw new Error(`"${hc(w.name,w.aliases)}" middleware ${w.relation} "${w.toMiddleware}" middleware cannot be overridden by "${hc(f,h)}" middleware ${y.relation} "${y.toMiddleware}" middleware.`);t.splice(x,1)}}for(let b of g)o.add(b)}t.push(y)},clone:()=>s(kg()),use:u=>{u.applyToStack(p)},remove:u=>typeof u=="string"?a(u):i(u),removeByTag:u=>{let m=!1,f=d=>{let{tags:h,name:y,aliases:g}=d;if(h&&h.includes(u)){let b=qm(y,g);for(let x of b)o.delete(x);return m=!0,!1}return!0};return e=e.filter(f),t=t.filter(f),m},concat:u=>{let m=s(kg());return m.use(u),m.identifyOnResolve(r||m.identifyOnResolve()||(u.identifyOnResolve?.()??!1)),m},applyToStack:s,identify:()=>l(!0).map(u=>{let m=u.step??u.relation+" "+u.toMiddleware;return hc(u.name,u.aliases)+" - "+m}),identifyOnResolve(u){return typeof u=="boolean"&&(r=u),r},resolve:(u,m)=>{for(let f of l().map(d=>d.middleware).reverse())u=f(u,m);return r&&console.log(p.identify()),u}};return p},cZ={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},pZ={high:3,normal:2,low:1};var N_=class{constructor(t){F(this,"config");F(this,"middlewareStack",kg());F(this,"initConfig");F(this,"handlers");this.config=t;let{protocol:r,protocolSettings:o}=t;o&&typeof r=="function"&&(t.protocol=new r(o))}send(t,r,o){let n=typeof r!="function"?r:void 0,a=typeof r=="function"?r:o,i=n===void 0&&this.config.cacheMiddleware===!0,s;if(i){this.handlers||(this.handlers=new WeakMap);let c=this.handlers;c.has(t.constructor)?s=c.get(t.constructor):(s=t.resolveMiddleware(this.middlewareStack,this.config,n),c.set(t.constructor,s))}else delete this.handlers,s=t.resolveMiddleware(this.middlewareStack,this.config,n);if(a)s(t).then(c=>a(null,c.output),c=>a(c)).catch(()=>{});else return s(t).then(c=>c.output)}destroy(){this.config?.requestHandler?.destroy?.(),delete this.handlers}};var lD="***SensitiveInformation***";function A_(e,t){if(t==null)return t;let r=Pt.of(e);if(r.getMergedTraits().sensitive)return lD;if(r.isListSchema()){if(!!r.getValueSchema().getMergedTraits().sensitive)return lD}else if(r.isMapSchema()){if(!!r.getKeySchema().getMergedTraits().sensitive||!!r.getValueSchema().getMergedTraits().sensitive)return lD}else if(r.isStructSchema()&&typeof t=="object"){let o=t,n={};for(let[a,i]of r.structIterator())o[a]!=null&&(n[a]=A_(i,o[a]));return n}return t}var Zb=class{constructor(){F(this,"middlewareStack",kg());F(this,"schema")}static classBuilder(){return new cD}resolveMiddlewareWithContext(t,r,o,{middlewareFn:n,clientName:a,commandName:i,inputFilterSensitiveLog:s,outputFilterSensitiveLog:c,smithyContext:l,additionalContext:p,CommandCtor:u}){for(let g of n.bind(this)(u,t,r,o))this.middlewareStack.use(g);let m=t.concat(this.middlewareStack),{logger:f}=r,d={logger:f,clientName:a,commandName:i,inputFilterSensitiveLog:s,outputFilterSensitiveLog:c,[Ub]:{commandInstance:this,...l},...p},{requestHandler:h}=r,y=o??{};return l.eventStream&&(y={isEventStream:!0,...y}),m.resolve(g=>h.handle(g.request,y),d)}},cD=class{constructor(){F(this,"_init",()=>{});F(this,"_ep",{});F(this,"_middlewareFn",()=>[]);F(this,"_commandName","");F(this,"_clientName","");F(this,"_additionalContext",{});F(this,"_smithyContext",{});F(this,"_inputFilterSensitiveLog");F(this,"_outputFilterSensitiveLog");F(this,"_serializer",null);F(this,"_deserializer",null);F(this,"_operationSchema")}init(t){this._init=t}ep(t){return this._ep=t,this}m(t){return this._middlewareFn=t,this}s(t,r,o={}){return this._smithyContext={service:t,operation:r,...o},this}c(t={}){return this._additionalContext=t,this}n(t,r){return this._clientName=t,this._commandName=r,this}f(t=o=>o,r=o=>o){return this._inputFilterSensitiveLog=t,this._outputFilterSensitiveLog=r,this}ser(t){return this._serializer=t,this}de(t){return this._deserializer=t,this}sc(t){return this._operationSchema=t,this._smithyContext.operationSchema=t,this}build(){let t=this,r;return r=class extends Zb{constructor(...[n]){super();F(this,"input");F(this,"serialize",t._serializer);F(this,"deserialize",t._deserializer);this.input=n??{},t._init(this),this.schema=t._operationSchema}static getEndpointParameterInstructions(){return t._ep}resolveMiddleware(n,a,i){let s=t._operationSchema,c=s?.[4]??s?.input,l=s?.[5]??s?.output;return this.resolveMiddlewareWithContext(n,a,i,{CommandCtor:r,middlewareFn:t._middlewareFn,clientName:t._clientName,commandName:t._commandName,inputFilterSensitiveLog:t._inputFilterSensitiveLog??(s?A_.bind(null,c):p=>p),outputFilterSensitiveLog:t._outputFilterSensitiveLog??(s?A_.bind(null,l):p=>p),smithyContext:t._smithyContext,additionalContext:t._additionalContext})}}}};var R_=class e extends Error{constructor(r){super(r.message);F(this,"$fault");F(this,"$response");F(this,"$retryable");F(this,"$metadata");Object.setPrototypeOf(this,Object.getPrototypeOf(this).constructor.prototype),this.name=r.name,this.$fault=r.$fault,this.$metadata=r.$metadata}static isInstance(r){if(!r)return!1;let o=r;return e.prototype.isPrototypeOf(o)||!!o.$fault&&!!o.$metadata&&(o.$fault==="client"||o.$fault==="server")}static[Symbol.hasInstance](r){if(!r)return!1;let o=r;return this===e?e.isInstance(r):e.isInstance(r)?o.name&&this.name?this.prototype.isPrototypeOf(r)||o.name===this.name:this.prototype.isPrototypeOf(r):!1}},pD=(e,t={})=>{Object.entries(t).filter(([,o])=>o!==void 0).forEach(([o,n])=>{(e[o]==null||e[o]==="")&&(e[o]=n)});let r=e.message||e.Message||"UnknownError";return e.message=r,delete e.Message,e};var uZ=e=>{switch(e){case"standard":return{retryMode:"standard",connectionTimeout:3100};case"in-region":return{retryMode:"standard",connectionTimeout:1100};case"cross-region":return{retryMode:"standard",connectionTimeout:3100};case"mobile":return{retryMode:"standard",connectionTimeout:3e4};default:return{}}};var mZ=Object.values(Um),fZ=e=>{let t=[];for(let r in Um){let o=Um[r];e[o]!==void 0&&t.push({algorithmId:()=>o,checksumConstructor:()=>e[o]})}for(let[r,o]of Object.entries(e.checksumAlgorithms??{}))t.push({algorithmId:()=>r,checksumConstructor:()=>o});return{addChecksumAlgorithm(r){e.checksumAlgorithms=e.checksumAlgorithms??{};let o=r.algorithmId(),n=r.checksumConstructor();mZ.includes(o)?e.checksumAlgorithms[o.toUpperCase()]=n:e.checksumAlgorithms[o]=n,t.push(r)},checksumAlgorithms(){return t}}},dZ=e=>{let t={};return e.checksumAlgorithms().forEach(r=>{let o=r.algorithmId();mZ.includes(o)&&(t[o]=r.checksumConstructor())}),t};var hZ=e=>({setRetryStrategy(t){e.retryStrategy=t},retryStrategy(){return e.retryStrategy}}),gZ=e=>{let t={};return t.retryStrategy=e.retryStrategy(),t};var yZ=e=>Object.assign(fZ(e),hZ(e));var vZ=e=>Object.assign(dZ(e),gZ(e));var _g=class{trace(){}debug(){}info(){}warn(){}error(){}};var D_=class{constructor(t=!1){F(this,"queryCompat");this.queryCompat=t}resolveRestContentType(t,r){let o=r.getMemberSchemas(),n=Object.values(o).find(a=>!!a.getMergedTraits().httpPayload);if(n){let a=n.getMergedTraits().mediaType;return a||(n.isStringSchema()?"text/plain":n.isBlobSchema()?"application/octet-stream":t)}else if(!r.isUnitSchema()&&Object.values(o).find(i=>{let{httpQuery:s,httpQueryParams:c,httpHeader:l,httpLabel:p,httpPrefixHeaders:u}=i.getMergedTraits();return!s&&!c&&!l&&!p&&u===void 0}))return t}async getErrorSchemaOrThrowBaseException(t,r,o,n,a,i){let s=r,c=t;t.includes("#")&&([s,c]=t.split("#"));let l={$metadata:a,$fault:o.statusCode<500?"client":"server"},p=wo.for(s);try{return{errorSchema:i?.(p,c)??p.getSchema(t),errorMetadata:l}}catch{n.message=n.message??n.Message??"UnknownError";let m=wo.for("smithy.ts.sdk.synthetic."+s),f=m.getBaseException();if(f){let d=m.getErrorCtor(f)??Error;throw this.decorateServiceException(Object.assign(new d({name:c}),l),n)}throw this.decorateServiceException(Object.assign(new Error(c),l),n)}}decorateServiceException(t,r={}){if(this.queryCompat){let o=t.Message??r.Message,n=pD(t,r);o&&(n.message=o),n.Error={...n.Error,Type:n.Error.Type,Code:n.Error.Code,Message:n.Error.message??n.Error.Message??o};let a=n.$metadata.requestId;return a&&(n.RequestId=a),n}return pD(t,r)}setQueryCompatError(t,r){let o=r.headers?.["x-amzn-query-error"];if(t!==void 0&&o!=null){let[n,a]=o.split(";"),i=Object.entries(t),s={Code:n,Type:a};Object.assign(t,s);for(let[c,l]of i)s[c==="message"?"Message":c]=l;delete s.__type,t.Error=s}}queryCompatOutput(t,r){t.Error&&(r.Error=t.Error),t.Type&&(r.Type=t.Type),t.Code&&(r.Code=t.Code)}findQueryCompatibleError(t,r){try{return t.getSchema(r)}catch{return t.find(n=>Pt.of(n).getMergedTraits().awsQueryError?.[0]===r)}}};var gc=class{constructor(){F(this,"serdeContext")}setSerdeContext(t){this.serdeContext=t}};function*bZ(e,t){if(e.isUnitSchema())return;let r=e.getSchema();for(let o=0;o<r[4].length;++o){let n=r[4][o],a=r[5][o],i=new Pt([a,0],n);!(n in t)&&!i.isIdempotencyToken()||(yield[n,i])}}function*xZ(e,t,r){if(e.isUnitSchema())return;let o=e.getSchema(),n=Object.keys(t).filter(a=>a!=="__type").length;for(let a=0;a<o[4].length&&n!==0;++a){let i=o[4][a],s=o[5][a],c=new Pt([s,0],i),l=i;r&&(l=c.getMergedTraits()[r]??i),l in t&&(yield[i,c],n-=1)}}var F_=class{constructor(t,r){F(this,"from");F(this,"to");F(this,"keys");this.from=t,this.to=r,this.keys=new Set(Object.keys(this.from).filter(o=>o!=="__type"))}mark(t){this.keys.delete(t)}hasUnknown(){return this.keys.size===1&&Object.keys(this.to).length===0}writeUnknown(){if(this.hasUnknown()){let t=this.keys.values().next().value,r=this.from[t];this.to.$unknown=[t,r]}}};function wZ(e,t,r){if(r?.source){let o=r.source;if(typeof t=="number"&&(t>Number.MAX_SAFE_INTEGER||t<Number.MIN_SAFE_INTEGER||o!==String(t)))return o.includes(".")?new qo(o,"bigDecimal"):BigInt(o)}return t}var SZ=(e,t)=>pc(e,t).then(r=>(t?.utf8Encoder??zJ)(r));var kZ=(e,t)=>SZ(e,t).then(r=>{if(r.length)try{return JSON.parse(r)}catch(o){throw o?.name==="SyntaxError"&&Object.defineProperty(o,"$responseBodyText",{value:r}),o}return{}});var _Z=(e,t)=>{let r=(a,i)=>Object.keys(a).find(s=>s.toLowerCase()===i.toLowerCase()),o=a=>{let i=a;return typeof i=="number"&&(i=i.toString()),i.indexOf(",")>=0&&(i=i.split(",")[0]),i.indexOf(":")>=0&&(i=i.split(":")[0]),i.indexOf("#")>=0&&(i=i.split("#")[1]),i},n=r(e.headers,"x-amzn-errortype");if(n!==void 0)return o(e.headers[n]);if(t&&typeof t=="object"){let a=r(t,"code");if(a&&t[a]!==void 0)return o(t[a]);if(t.__type!==void 0)return o(t.__type)}};var M_=class extends gc{constructor(r){super();F(this,"settings");this.settings=r}async read(r,o){return this._read(r,typeof o=="string"?JSON.parse(o,wZ):await kZ(o,this.serdeContext))}readObject(r,o){return this._read(r,o)}_read(r,o){let n=o!==null&&typeof o=="object",a=Pt.of(r);if(n){if(a.isStructSchema()){let s=a.isUnionSchema(),c={},l;s&&(l=new F_(o,c));for(let[p,u]of xZ(a,o,this.settings.jsonName?"jsonName":!1)){let m=this.settings.jsonName?u.getMergedTraits().jsonName??p:p;s&&l.mark(m),o[m]!=null&&(c[p]=this._read(u,o[m]))}return s&&l.writeUnknown(),c}if(Array.isArray(o)&&a.isListSchema()){let s=a.getValueSchema(),c=[],l=!!a.getMergedTraits().sparse;for(let p of o)(l||p!=null)&&c.push(this._read(s,p));return c}if(a.isMapSchema()){let s=a.getValueSchema(),c={},l=!!a.getMergedTraits().sparse;for(let[p,u]of Object.entries(o))(l||u!=null)&&(c[p]=this._read(s,u));return c}}if(a.isBlobSchema()&&typeof o=="string")return ci(o);let i=a.getMergedTraits().mediaType;if(a.isStringSchema()&&typeof o=="string"&&i)return i==="application/json"||i.endsWith("+json")?Mn.from(o):o;if(a.isTimestampSchema()&&o!=null)switch(fc(a,this.settings)){case 5:return zQ(o);case 6:return n_(o);case 7:return $Q(o);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",o),new Date(o)}if(a.isBigIntegerSchema()&&(typeof o=="number"||typeof o=="string"))return BigInt(o);if(a.isBigDecimalSchema()&&o!=null){if(o instanceof qo)return o;let s=o;return s.type==="bigDecimal"&&"string"in s?new qo(s.string,s.type):new qo(String(o),"bigDecimal")}if(a.isNumericSchema()&&typeof o=="string"){switch(o){case"Infinity":return 1/0;case"-Infinity":return-1/0;case"NaN":return NaN}return o}if(a.isDocumentSchema())if(n){let s=Array.isArray(o)?[]:{};for(let[c,l]of Object.entries(o))l instanceof qo?s[c]=l:s[c]=this._read(a,l);return s}else return structuredClone(o);return o}};var EZ="\u039D",O_=class{constructor(){F(this,"values",new Map);F(this,"counter",0);F(this,"stage",0)}createReplacer(){if(this.stage===1)throw new Error("@aws-sdk/core/protocols - JsonReplacer already created.");if(this.stage===2)throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");return this.stage=1,(t,r)=>{if(r instanceof qo){let o=`${EZ+"nv"+this.counter++}_`+r.string;return this.values.set(`"${o}"`,r.string),o}if(typeof r=="bigint"){let o=r.toString(),n=`${EZ+"b"+this.counter++}_`+o;return this.values.set(`"${n}"`,o),n}return r}}replaceInJson(t){if(this.stage===0)throw new Error("@aws-sdk/core/protocols - JsonReplacer not created yet.");if(this.stage===2)throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");if(this.stage=2,this.counter===0)return t;for(let[r,o]of this.values)t=t.replace(r,o);return t}};var P_=class extends gc{constructor(r){super();F(this,"settings");F(this,"buffer");F(this,"useReplacer",!1);F(this,"rootSchema");this.settings=r}write(r,o){this.rootSchema=Pt.of(r),this.buffer=this._write(this.rootSchema,o)}writeDiscriminatedDocument(r,o){this.write(r,o),typeof this.buffer=="object"&&(this.buffer.__type=Pt.of(r).getName(!0))}flush(){let{rootSchema:r,useReplacer:o}=this;if(this.rootSchema=void 0,this.useReplacer=!1,r?.isStructSchema()||r?.isDocumentSchema()){if(!o)return JSON.stringify(this.buffer);let n=new O_;return n.replaceInJson(JSON.stringify(this.buffer,n.createReplacer(),0))}return this.buffer}_write(r,o,n){let a=o!==null&&typeof o=="object",i=Pt.of(r);if(a){if(i.isStructSchema()){let s={};for(let[c,l]of bZ(i,o)){let p=this._write(l,o[c],i);if(p!==void 0){let u=l.getMergedTraits().jsonName,m=this.settings.jsonName?u??c:c;s[m]=p}}if(i.isUnionSchema()&&Object.keys(s).length===0){let{$unknown:c}=o;if(Array.isArray(c)){let[l,p]=c;s[l]=this._write(15,p)}}return s}if(Array.isArray(o)&&i.isListSchema()){let s=i.getValueSchema(),c=[],l=!!i.getMergedTraits().sparse;for(let p of o)(l||p!=null)&&c.push(this._write(s,p));return c}if(i.isMapSchema()){let s=i.getValueSchema(),c={},l=!!i.getMergedTraits().sparse;for(let[p,u]of Object.entries(o))(l||u!=null)&&(c[p]=this._write(s,u));return c}if(o instanceof Uint8Array&&(i.isBlobSchema()||i.isDocumentSchema()))return i===this.rootSchema?o:(this.serdeContext?.base64Encoder??Ra)(o);if(o instanceof Date&&(i.isTimestampSchema()||i.isDocumentSchema()))switch(fc(i,this.settings)){case 5:return o.toISOString().replace(".000Z","Z");case 6:return o_(o);case 7:return o.getTime()/1e3;default:return console.warn("Missing timestamp format, using epoch seconds",o),o.getTime()/1e3}o instanceof qo&&(this.useReplacer=!0)}if(!(o===null&&n?.isStructSchema())){if(i.isStringSchema()){if(typeof o>"u"&&i.isIdempotencyToken())return Vm();let s=i.getMergedTraits().mediaType;return o!=null&&s&&(s==="application/json"||s.endsWith("+json"))?Mn.from(o):o}if(typeof o=="number"&&i.isNumericSchema())return Math.abs(o)===1/0||isNaN(o)?String(o):o;if(typeof o=="string"&&i.isBlobSchema())return i===this.rootSchema?o:(this.serdeContext?.base64Encoder??Ra)(o);if(typeof o=="bigint"&&(this.useReplacer=!0),i.isDocumentSchema())if(a){let s=Array.isArray(o)?[]:{};for(let[c,l]of Object.entries(o))l instanceof qo?(this.useReplacer=!0,s[c]=l):s[c]=this._write(i,l);return s}else return structuredClone(o);return o}}};var z_=class extends gc{constructor(r){super();F(this,"settings");this.settings=r}createSerializer(){let r=new P_(this.settings);return r.setSerdeContext(this.serdeContext),r}createDeserializer(){let r=new M_(this.settings);return r.setSerdeContext(this.serdeContext),r}};var $_=class extends c_{constructor({defaultNamespace:r}){super({defaultNamespace:r});F(this,"serializer");F(this,"deserializer");F(this,"codec");F(this,"mixin",new D_);let o={timestampFormat:{useTrait:!0,default:7},httpBindings:!0,jsonName:!0};this.codec=new z_(o),this.serializer=new f_(this.codec.createSerializer(),o),this.deserializer=new u_(this.codec.createDeserializer(),o)}getShapeId(){return"aws.protocols#restJson1"}getPayloadCodec(){return this.codec}setSerdeContext(r){this.codec.setSerdeContext(r),super.setSerdeContext(r)}async serializeRequest(r,o,n){let a=await super.serializeRequest(r,o,n),i=Pt.of(r.input);if(!a.headers["content-type"]){let s=this.mixin.resolveRestContentType(this.getDefaultContentType(),i);s&&(a.headers["content-type"]=s)}return a.body==null&&a.headers["content-type"]===this.getDefaultContentType()&&(a.body="{}"),a}async deserializeResponse(r,o,n){let a=await super.deserializeResponse(r,o,n),i=Pt.of(r.output);for(let[s,c]of i.structIterator())c.getMemberTraits().httpPayload&&!(s in a)&&(a[s]=null);return a}async handleError(r,o,n,a,i){let s=_Z(n,a)??"Unknown",{errorSchema:c,errorMetadata:l}=await this.mixin.getErrorSchemaOrThrowBaseException(s,this.options.defaultNamespace,n,a,i),p=Pt.of(c),u=a.message??a.Message??"Unknown",m=wo.for(c[1]).getErrorCtor(c)??Error,f=new m(u);await this.deserializeHttpMessage(c,o,n,a);let d={};for(let[h,y]of p.structIterator()){let g=y.getMergedTraits().jsonName??h;d[h]=this.codec.createDeserializer().readObject(y,a[g])}throw this.mixin.decorateServiceException(Object.assign(f,l,{$fault:p.getMergedTraits().error,message:u},d),a)}getDefaultContentType(){return"application/json"}};var $Ee=/\d{12}\.ddb/;async function IZ(e,t,r){if(r.request?.headers?.["smithy-protocol"]==="rpc-v2-cbor"&&pi(e,"PROTOCOL_RPC_V2_CBOR","M"),typeof t.retryStrategy=="function"){let a=await t.retryStrategy();typeof a.acquireInitialRetryToken=="function"?a.constructor?.name?.includes("Adaptive")?pi(e,"RETRY_MODE_ADAPTIVE","F"):pi(e,"RETRY_MODE_STANDARD","E"):pi(e,"RETRY_MODE_LEGACY","D")}if(typeof t.accountIdEndpointMode=="function"){let a=e.endpointV2;switch(String(a?.url?.hostname).match($Ee)&&pi(e,"ACCOUNT_ID_ENDPOINT","O"),await t.accountIdEndpointMode?.()){case"disabled":pi(e,"ACCOUNT_ID_MODE_DISABLED","Q");break;case"preferred":pi(e,"ACCOUNT_ID_MODE_PREFERRED","P");break;case"required":pi(e,"ACCOUNT_ID_MODE_REQUIRED","R");break}}let n=e.__smithy_context?.selectedHttpAuthScheme?.identity;if(n?.$source){let a=n;a.accountId&&pi(e,"RESOLVED_ACCOUNT_ID","T");for(let[i,s]of Object.entries(a.$source??{}))pi(e,i,s)}}var uD="user-agent",L_="x-amz-user-agent",mD=" ",B_="/",TZ=/[^!$%&'*+\-.^_`|~\w]/g,CZ=/[^!$%&'*+\-.^_`|~\w#]/g,fD="-";function NZ(e){let t="";for(let r in e){let o=e[r];if(t.length+o.length+1<=1024){t.length?t+=","+o:t+=o;continue}break}return t}var LEe=e=>(t,r)=>async o=>{let{request:n}=o;if(!b_.isInstance(n))return t(o);let{headers:a}=n,i=r?.userAgent?.map(U_)||[],s=(await e.defaultUserAgentProvider()).map(U_);await IZ(r,e,o);let c=r;s.push(`m/${NZ(Object.assign({},r.__smithy_context?.features,c.__aws_sdk_context?.features))}`);let l=e?.customUserAgent?.map(U_)||[],p=await e.userAgentAppId();p&&s.push(U_(["app",`${p}`]));let u=AJ(),m=(u?[u]:[]).concat([...s,...i,...l]).join(mD),f=[...s.filter(d=>d.startsWith("aws-sdk-")),...l].join(mD);return e.runtime!=="browser"?(f&&(a[L_]=a[L_]?`${a[uD]} ${f}`:f),a[uD]=m):a[L_]=m,t({...o,request:n})},U_=e=>{let t=e[0].split(B_).map(i=>i.replace(TZ,fD)).join(B_),r=e[1]?.replace(CZ,fD),o=t.indexOf(B_),n=t.substring(0,o),a=t.substring(o+1);return n==="api"&&(a=a.toLowerCase()),[n,a,r].filter(i=>i&&i.length>0).reduce((i,s,c)=>{switch(c){case 0:return s;case 1:return`${i}/${s}`;default:return`${i}#${s}`}},"")},BEe={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},AZ=e=>({applyToStack:t=>{t.add(LEe(e),BEe)}});var UEe=function(){function e(){this.crc32=new Km}return e.prototype.update=function(t){Il(t)||this.crc32.update(Za(t))},e.prototype.digest=function(){return bw(this,void 0,void 0,function(){return xw(this,function(t){return[2,qC(this.crc32.digest())]})})},e.prototype.reset=function(){this.crc32=new Km},e}();var Km=function(){function e(){this.checksum=4294967295}return e.prototype.update=function(t){var r,o;try{for(var n=XP(t),a=n.next();!a.done;a=n.next()){var i=a.value;this.checksum=this.checksum>>>8^HEe[(this.checksum^i)&255]}}catch(s){r={error:s}}finally{try{a&&!a.done&&(o=n.return)&&o.call(n)}finally{if(r)throw r.error}}return this},e.prototype.digest=function(){return(this.checksum^4294967295)>>>0},e}();var WEe=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],HEe=KC(WEe);var RZ={},dD={};for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();t.length===1&&(t=`0${t}`),RZ[e]=t,dD[t]=e}function DZ(e){if(e.length%2!==0)throw new Error("Hex encoded strings must have an even number length");let t=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2){let o=e.slice(r,r+2).toLowerCase();if(o in dD)t[r/2]=dD[o];else throw new Error(`Cannot decode unrecognized sequence ${o} as hexadecimal`)}return t}function yc(e){let t="";for(let r=0;r<e.byteLength;r++)t+=RZ[e[r]];return t}var Eg=class e{constructor(t){F(this,"bytes");if(this.bytes=t,t.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(t){if(t>9223372036854776e3||t<-9223372036854776e3)throw new Error(`${t} is too large (or, if negative, too small) to represent as an Int64`);let r=new Uint8Array(8);for(let o=7,n=Math.abs(Math.round(t));o>-1&&n>0;o--,n/=256)r[o]=n;return t<0&&FZ(r),new e(r)}valueOf(){let t=this.bytes.slice(0),r=t[0]&128;return r&&FZ(t),parseInt(yc(t),16)*(r?-1:1)}toString(){return String(this.valueOf())}};function FZ(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,e[t]===0);t--);}var W_=class{constructor(t,r){F(this,"toUtf8");F(this,"fromUtf8");this.toUtf8=t,this.fromUtf8=r}format(t){let r=[];for(let a of Object.keys(t)){let i=this.fromUtf8(a);r.push(Uint8Array.from([i.byteLength]),i,this.formatHeaderValue(t[a]))}let o=new Uint8Array(r.reduce((a,i)=>a+i.byteLength,0)),n=0;for(let a of r)o.set(a,n),n+=a.byteLength;return o}formatHeaderValue(t){switch(t.type){case"boolean":return Uint8Array.from([t.value?0:1]);case"byte":return Uint8Array.from([2,t.value]);case"short":let r=new DataView(new ArrayBuffer(3));return r.setUint8(0,3),r.setInt16(1,t.value,!1),new Uint8Array(r.buffer);case"integer":let o=new DataView(new ArrayBuffer(5));return o.setUint8(0,4),o.setInt32(1,t.value,!1),new Uint8Array(o.buffer);case"long":let n=new Uint8Array(9);return n[0]=5,n.set(t.value.bytes,1),n;case"binary":let a=new DataView(new ArrayBuffer(3+t.value.byteLength));a.setUint8(0,6),a.setUint16(1,t.value.byteLength,!1);let i=new Uint8Array(a.buffer);return i.set(t.value,3),i;case"string":let s=this.fromUtf8(t.value),c=new DataView(new ArrayBuffer(3+s.byteLength));c.setUint8(0,7),c.setUint16(1,s.byteLength,!1);let l=new Uint8Array(c.buffer);return l.set(s,3),l;case"timestamp":let p=new Uint8Array(9);return p[0]=8,p.set(Eg.fromNumber(t.value.valueOf()).bytes,1),p;case"uuid":if(!JEe.test(t.value))throw new Error(`Invalid UUID received: ${t.value}`);let u=new Uint8Array(17);return u[0]=9,u.set(DZ(t.value.replace(/\-/g,"")),1),u}}parse(t){let r={},o=0;for(;o<t.byteLength;){let n=t.getUint8(o++),a=this.toUtf8(new Uint8Array(t.buffer,t.byteOffset+o,n));switch(o+=n,t.getUint8(o++)){case 0:r[a]={type:OZ,value:!0};break;case 1:r[a]={type:OZ,value:!1};break;case 2:r[a]={type:VEe,value:t.getInt8(o++)};break;case 3:r[a]={type:jEe,value:t.getInt16(o,!1)},o+=2;break;case 4:r[a]={type:GEe,value:t.getInt32(o,!1)},o+=4;break;case 5:r[a]={type:qEe,value:new Eg(new Uint8Array(t.buffer,t.byteOffset+o,8))},o+=8;break;case 6:let i=t.getUint16(o,!1);o+=2,r[a]={type:KEe,value:new Uint8Array(t.buffer,t.byteOffset+o,i)},o+=i;break;case 7:let s=t.getUint16(o,!1);o+=2,r[a]={type:XEe,value:this.toUtf8(new Uint8Array(t.buffer,t.byteOffset+o,s))},o+=s;break;case 8:r[a]={type:YEe,value:new Date(new Eg(new Uint8Array(t.buffer,t.byteOffset+o,8)).valueOf())},o+=8;break;case 9:let c=new Uint8Array(t.buffer,t.byteOffset+o,16);o+=16,r[a]={type:QEe,value:`${yc(c.subarray(0,4))}-${yc(c.subarray(4,6))}-${yc(c.subarray(6,8))}-${yc(c.subarray(8,10))}-${yc(c.subarray(10))}`};break;default:throw new Error("Unrecognized header type tag")}}return r}},MZ;(function(e){e[e.boolTrue=0]="boolTrue",e[e.boolFalse=1]="boolFalse",e[e.byte=2]="byte",e[e.short=3]="short",e[e.integer=4]="integer",e[e.long=5]="long",e[e.byteArray=6]="byteArray",e[e.string=7]="string",e[e.timestamp=8]="timestamp",e[e.uuid=9]="uuid"})(MZ||(MZ={}));var OZ="boolean",VEe="byte",jEe="short",GEe="integer",qEe="long",KEe="binary",XEe="string",YEe="timestamp",QEe="uuid",JEe=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;var PZ=4,vc=PZ*2,Xm=4,ZEe=vc+Xm*2;function zZ({byteLength:e,byteOffset:t,buffer:r}){if(e<ZEe)throw new Error("Provided message too short to accommodate event stream message overhead");let o=new DataView(r,t,e),n=o.getUint32(0,!1);if(e!==n)throw new Error("Reported message length does not match received message length");let a=o.getUint32(PZ,!1),i=o.getUint32(vc,!1),s=o.getUint32(e-Xm,!1),c=new Km().update(new Uint8Array(r,t,vc));if(i!==c.digest())throw new Error(`The prelude checksum specified in the message (${i}) does not match the calculated CRC32 checksum (${c.digest()})`);if(c.update(new Uint8Array(r,t+vc,e-(vc+Xm))),s!==c.digest())throw new Error(`The message checksum (${c.digest()}) did not match the expected value of ${s}`);return{headers:new DataView(r,t+vc+Xm,a),body:new Uint8Array(r,t+vc+Xm+a,n-a-(vc+Xm+Xm))}}var Ig=class{constructor(t,r){F(this,"headerMarshaller");F(this,"messageBuffer");F(this,"isEndOfStream");this.headerMarshaller=new W_(t,r),this.messageBuffer=[],this.isEndOfStream=!1}feed(t){this.messageBuffer.push(this.decode(t))}endOfStream(){this.isEndOfStream=!0}getMessage(){let t=this.messageBuffer.pop(),r=this.isEndOfStream;return{getMessage(){return t},isEndOfStream(){return r}}}getAvailableMessages(){let t=this.messageBuffer;this.messageBuffer=[];let r=this.isEndOfStream;return{getMessages(){return t},isEndOfStream(){return r}}}encode({headers:t,body:r}){let o=this.headerMarshaller.format(t),n=o.byteLength+r.byteLength+16,a=new Uint8Array(n),i=new DataView(a.buffer,a.byteOffset,a.byteLength),s=new Km;return i.setUint32(0,n,!1),i.setUint32(4,o.byteLength,!1),i.setUint32(8,s.update(a.subarray(0,8)).digest(),!1),a.set(o,12),a.set(r,o.byteLength+12),i.setUint32(n-4,s.update(a.subarray(8,n-4)).digest(),!1),a}decode(t){let{headers:r,body:o}=zZ(t);return{headers:this.headerMarshaller.parse(r),body:o}}formatHeaders(t){return this.headerMarshaller.format(t)}};var H_=class{constructor(t){F(this,"options");this.options=t}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let t of this.options.inputStream)yield this.options.decoder.decode(t)}};var V_=class{constructor(t){F(this,"options");this.options=t}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let t of this.options.messageStream)yield this.options.encoder.encode(t);this.options.includeEndFrame&&(yield new Uint8Array(0))}};var j_=class{constructor(t){F(this,"options");this.options=t}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let t of this.options.messageStream){let r=await this.options.deserializer(t);r!==void 0&&(yield r)}}};var G_=class{constructor(t){F(this,"options");this.options=t}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let t of this.options.inputStream)yield this.options.serializer(t)}};var eIe={},hD={};for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();t.length===1&&(t=`0${t}`),eIe[e]=t,hD[t]=e}function $Z(e){if(e.length%2!==0)throw new Error("Hex encoded strings must have an even number length");let t=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2){let o=e.slice(r,r+2).toLowerCase();if(o in hD)t[r/2]=hD[o];else throw new Error(`Cannot decode unrecognized sequence ${o} as hexadecimal`)}return t}var LZ=(e,t,r,o)=>{let n=e,a={start(){},async transform(i,s){try{let c=new Date(Date.now()+await o()),l={":date":{type:"timestamp",value:c}},p=await t.sign({message:{body:i,headers:l},priorSignature:n},{signingDate:c});n=p.signature;let u=r.encode({headers:{...l,":chunk-signature":{type:"binary",value:$Z(p.signature)}},body:i});s.enqueue(u)}catch(c){s.error(c)}}};return new TransformStream({...a})};var q_=class{constructor(t){F(this,"messageSigner");F(this,"eventStreamCodec");F(this,"systemClockOffsetProvider");this.messageSigner=t.messageSigner,this.eventStreamCodec=new Ig(t.utf8Encoder,t.utf8Decoder),this.systemClockOffsetProvider=async()=>t.systemClockOffset??0}async handle(t,r,o={}){let n=r.request,{body:a,headers:i,query:s}=n;if(!(a instanceof ReadableStream))throw new Error("Eventstream payload must be a ReadableStream.");let c=new TransformStream;n.body=c.readable;let l;try{l=await t(r)}catch(d){throw n.body.cancel(),d}let u=((i.authorization||"").match(/Signature=([\w]+)$/)||[])[1]||s&&s["X-Amz-Signature"]||"",m=LZ(u,await this.messageSigner(),this.eventStreamCodec,this.systemClockOffsetProvider);return a.pipeThrough(m).pipeThrough(c),l}};var BZ=e=>new q_(e);var UZ=()=>e=>async t=>{let r={...t.input},o=await e(t),n=o.output;return r.SessionId&&n.SessionId==null&&(n.SessionId=r.SessionId),o},WZ={step:"initialize",name:"injectSessionIdMiddleware",tags:["WEBSOCKET","EVENT_STREAM"],override:!0};var Tg=class e{constructor(t){F(this,"method");F(this,"protocol");F(this,"hostname");F(this,"port");F(this,"path");F(this,"query");F(this,"headers");F(this,"username");F(this,"password");F(this,"fragment");F(this,"body");this.method=t.method||"GET",this.hostname=t.hostname||"localhost",this.port=t.port,this.query=t.query||{},this.headers=t.headers||{},this.body=t.body,this.protocol=t.protocol?t.protocol.slice(-1)!==":"?`${t.protocol}:`:t.protocol:"https:",this.path=t.path?t.path.charAt(0)!=="/"?`/${t.path}`:t.path:"/",this.username=t.username,this.password=t.password,this.fragment=t.fragment}static clone(t){let r=new e({...t,headers:{...t.headers}});return r.query&&(r.query=tIe(r.query)),r}static isInstance(t){if(!t)return!1;let r=t;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return e.clone(this)}};function tIe(e){return Object.keys(e).reduce((t,r)=>{let o=e[r];return{...t,[r]:Array.isArray(o)?[...o]:o}},{})}var K_=class{constructor(t){F(this,"statusCode");F(this,"reason");F(this,"headers");F(this,"body");this.statusCode=t.statusCode,this.reason=t.reason,this.headers=t.headers||{},this.body=t.body}static isInstance(t){if(!t)return!1;let r=t;return typeof r.statusCode=="number"&&typeof r.headers=="object"}};var HZ=(e,t)=>r=>o=>{let{request:n}=o;if(Tg.isInstance(n)&&e.requestHandler.metadata?.handlerProtocol?.toLowerCase().includes("websocket")){n.protocol="wss:",n.method="GET",n.path=`${n.path}-websocket`;let{headers:a}=n;delete a["content-type"],delete a["x-amz-content-sha256"];for(let i of Object.keys(a))if(i.indexOf(t.headerPrefix)===0){let s=i.replace(t.headerPrefix,"");n.query[s]=a[i]}a["x-amz-user-agent"]&&(n.query["user-agent"]=a["x-amz-user-agent"]),n.headers={host:a.host??n.hostname}}return r(o)},VZ={name:"websocketEndpointMiddleware",tags:["WEBSOCKET","EVENT_STREAM"],relation:"after",toMiddleware:"eventStreamHeaderMiddleware",override:!0};var jZ=(e,t)=>({applyToStack:r=>{r.addRelativeTo(HZ(e,t),VZ),r.add(UZ(),WZ)}});var X_=e=>e.protocol==="ws:"||e.protocol==="wss:";var Y_=class{constructor(t){F(this,"signer");this.signer=t.signer}presign(t,r={}){return this.signer.presign(t,r)}async sign(t,r){return Tg.isInstance(t)&&X_(t)?{...await this.signer.presign({...t,body:""},{...r,expiresIn:60,unsignableHeaders:new Set(Object.keys(t.headers).filter(n=>n!=="host"))}),body:t.body}:this.signer.sign(t,r)}};var GZ=e=>{let{signer:t}=e;return Object.assign(e,{signer:async r=>{let o=await t(r);if(rIe(o))return new Y_({signer:o});throw new Error("Expected WebsocketSignatureV4 signer, please check the client constructor.")}})},rIe=e=>!!e;function Q_(e){let{port:t,query:r}=e,{protocol:o,path:n,hostname:a}=e;o&&o.slice(-1)!==":"&&(o+=":"),t&&(a+=`:${t}`),n&&n.charAt(0)!=="/"&&(n=`/${n}`);let i=r?Qk(r):"";i&&i[0]!=="?"&&(i=`?${i}`);let s="";if(e.username!=null||e.password!=null){let l=e.username??"",p=e.password??"";s=`${l}:${p}@`}let c="";return e.fragment&&(c=`#${e.fragment}`),`${o}//${s}${a}${n}${i}${c}`}function qZ(e){let t=0,r=0,o=null,n=null,a=s=>{if(typeof s!="number")throw new Error("Attempted to allocate an event message where size was not a number: "+s);t=s,r=4,o=new Uint8Array(s),new DataView(o.buffer).setUint32(0,s,!1)},i=async function*(){let s=e[Symbol.asyncIterator]();for(;;){let{value:c,done:l}=await s.next();if(l){if(t)if(t===r)yield o;else throw new Error("Truncated event message received.");else return;return}let p=c.length,u=0;for(;u<p;){if(!o){let f=p-u;n||(n=new Uint8Array(4));let d=Math.min(4-r,f);if(n.set(c.slice(u,u+d),r),r+=d,u+=d,r<4)break;a(new DataView(n.buffer).getUint32(0,!1)),n=null}let m=Math.min(t-r,p-u);o.set(c.slice(u,u+m),r),r+=m,u+=m,t&&t===r&&(yield o,o=null,t=0,r=0)}}};return{[Symbol.asyncIterator]:i}}function KZ(e,t){return async function(r){let{value:o}=r.headers[":message-type"];if(o==="error"){let n=new Error(r.headers[":error-message"].value||"UnknownError");throw n.name=r.headers[":error-code"].value,n}else if(o==="exception"){let n=r.headers[":exception-type"].value,a={[n]:r},i=await e(a);if(i.$unknown){let s=new Error(t(r.body));throw s.name=n,s}throw i[n]}else if(o==="event"){let n={[r.headers[":event-type"].value]:r},a=await e(n);return a.$unknown?void 0:a}else throw Error(`Unrecognizable event type: ${r.headers[":event-type"].value}`)}}var J_=class{constructor({utf8Encoder:t,utf8Decoder:r}){F(this,"eventStreamCodec");F(this,"utfEncoder");this.eventStreamCodec=new Ig(t,r),this.utfEncoder=t}deserialize(t,r){let o=qZ(t);return new j_({messageStream:new H_({inputStream:o,decoder:this.eventStreamCodec}),deserializer:KZ(r,this.utfEncoder)})}serialize(t,r){return new V_({messageStream:new G_({inputStream:t,serializer:r}),encoder:this.eventStreamCodec,includeEndFrame:!0})}};var Cg=e=>({[Symbol.asyncIterator]:async function*(){let t=e.getReader();try{for(;;){let{done:r,value:o}=await t.read();if(r)return;yield o}}finally{t.releaseLock()}}}),Ng=e=>{let t=e[Symbol.asyncIterator]();return new ReadableStream({async pull(r){let{done:o,value:n}=await t.next();if(o)return r.close();r.enqueue(n)}})};var Z_=class{constructor({utf8Encoder:t,utf8Decoder:r}){F(this,"universalMarshaller");this.universalMarshaller=new J_({utf8Decoder:r,utf8Encoder:t})}deserialize(t,r){let o=oIe(t)?Cg(t):t;return this.universalMarshaller.deserialize(o,r)}serialize(t,r){let o=this.universalMarshaller.serialize(t,r);return typeof ReadableStream=="function"?Ng(o):o}},oIe=e=>typeof ReadableStream=="function"&&e instanceof ReadableStream;var XZ=e=>new Z_(e);var nIe=2e3,e2=class e{constructor(t,r=new Ws){F(this,"metadata",{handlerProtocol:"websocket/h1.1"});F(this,"config");F(this,"configPromise");F(this,"httpHandler");F(this,"sockets",{});this.httpHandler=r,typeof t=="function"?(this.config={},this.configPromise=t().then(o=>this.config=o??{})):(this.config=t??{},this.configPromise=Promise.resolve(this.config))}static create(t,r=new Ws){return typeof t?.handle=="function"?t:new e(t,r)}destroy(){for(let[t,r]of Object.entries(this.sockets)){for(let o of r)o.close(1e3,"Socket closed through destroy() call");delete this.sockets[t]}}async handle(t){if(!X_(t))return this.httpHandler.handle(t);let r=Q_(t),o=new WebSocket(r);this.sockets[r]||(this.sockets[r]=[]),this.sockets[r].push(o),o.binaryType="arraybuffer",this.config=await this.configPromise;let{connectionTimeout:n=nIe}=this.config;await this.waitForReady(o,n);let{body:a}=t,i=aIe(a),s=this.connect(o,i),c=iIe(s);return{response:new K_({statusCode:200,body:c})}}updateHttpClientConfig(t,r){this.configPromise=this.configPromise.then(o=>(o[t]=r,o))}httpHandlerConfigs(){return this.config??{}}removeNotUsableSockets(t){this.sockets[t]=(this.sockets[t]??[]).filter(r=>![WebSocket.CLOSING,WebSocket.CLOSED].includes(r.readyState))}waitForReady(t,r){return new Promise((o,n)=>{let a=setTimeout(()=>{this.removeNotUsableSockets(t.url),n({$metadata:{httpStatusCode:500}})},r);t.onopen=()=>{clearTimeout(a),o()}})}connect(t,r){let o,n=!1,a=()=>{},i=()=>{};t.onmessage=l=>{i({done:!1,value:new Uint8Array(l.data)})},t.onerror=l=>{n=!0,t.close(),a(l)},t.onclose=()=>{this.removeNotUsableSockets(t.url),!n&&(o?a(o):i({done:!0,value:void 0}))};let s={[Symbol.asyncIterator]:()=>({next:()=>new Promise((l,p)=>{i=l,a=p})})};return(async()=>{try{for await(let l of r)t.send(l)}catch(l){o=l}finally{t.close(1e3)}})(),s}},aIe=e=>e[Symbol.asyncIterator]?e:sIe(e)?Cg(e):{[Symbol.asyncIterator]:async function*(){yield e}},iIe=e=>typeof ReadableStream=="function"?Ng(e):e,sIe=e=>typeof ReadableStream=="function"&&e instanceof ReadableStream;var YZ=!1;var QZ=!1;var JZ=new Set,ZZ=(e,t=jm)=>{if(!JZ.has(e)&&!t(e))if(e==="*")console.warn('@smithy/config-resolver WARN - Please use the caller region instead of "*". See "sigv4a" in https://github.com/aws/aws-sdk-js-v3/blob/main/supplemental-docs/CLIENTS.md.');else throw new Error(`Region not accepted: region="${e}" is not a valid hostname component.`);else JZ.add(e)};var t2=e=>typeof e=="string"&&(e.startsWith("fips-")||e.endsWith("-fips"));var eee=e=>t2(e)?["fips-aws-global","aws-fips"].includes(e)?"us-east-1":e.replace(/fips-(dkr-|prod-)?|-fips/,""):e;var tee=e=>{let{region:t,useFipsEndpoint:r}=e;if(!t)throw new Error("Region is missing");return Object.assign(e,{region:async()=>{let o=typeof t=="function"?await t():t,n=eee(o);return ZZ(n),n},useFipsEndpoint:async()=>{let o=typeof t=="string"?t:await t();return t2(o)?!0:typeof r!="function"?Promise.resolve(!!r):r()}})};var ree=e=>Object.assign(e,{eventStreamMarshaller:e.eventStreamSerdeProvider(e)});var r2=class e{constructor(t){F(this,"method");F(this,"protocol");F(this,"hostname");F(this,"port");F(this,"path");F(this,"query");F(this,"headers");F(this,"username");F(this,"password");F(this,"fragment");F(this,"body");this.method=t.method||"GET",this.hostname=t.hostname||"localhost",this.port=t.port,this.query=t.query||{},this.headers=t.headers||{},this.body=t.body,this.protocol=t.protocol?t.protocol.slice(-1)!==":"?`${t.protocol}:`:t.protocol:"https:",this.path=t.path?t.path.charAt(0)!=="/"?`/${t.path}`:t.path:"/",this.username=t.username,this.password=t.password,this.fragment=t.fragment}static clone(t){let r=new e({...t,headers:{...t.headers}});return r.query&&(r.query=lIe(r.query)),r}static isInstance(t){if(!t)return!1;let r=t;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return e.clone(this)}};function lIe(e){return Object.keys(e).reduce((t,r)=>{let o=e[r];return{...t,[r]:Array.isArray(o)?[...o]:o}},{})}var oee="content-length";function cIe(e){return t=>async r=>{let o=r.request;if(r2.isInstance(o)){let{body:n,headers:a}=o;if(n&&Object.keys(a).map(i=>i.toLowerCase()).indexOf(oee)===-1)try{let i=e(n);o.headers={...o.headers,[oee]:String(i)}}catch{}}return t({...r,request:o})}}var pIe={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},nee=e=>({applyToStack:t=>{t.add(cIe(e.bodyLengthChecker),pIe)}});var aee=async e=>{let t=e?.Bucket||"";if(typeof e.Bucket=="string"&&(e.Bucket=t.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),hIe(t)){if(e.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!dIe(t)||t.indexOf(".")!==-1&&!String(e.Endpoint).startsWith("http:")||t.toLowerCase()!==t||t.length<3)&&(e.ForcePathStyle=!0);return e.DisableMultiRegionAccessPoints&&(e.disableMultiRegionAccessPoints=!0,e.DisableMRAP=!0),e},uIe=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,mIe=/(\d+\.){3}\d+/,fIe=/\.\./;var dIe=e=>uIe.test(e)&&!mIe.test(e)&&!fIe.test(e),hIe=e=>{let[t,r,o,,,n]=e.split(":"),a=t==="arn"&&e.split(":").length>=6,i=!!(a&&r&&o&&n);if(a&&!i)throw new Error(`Invalid ARN: ${e} was an invalid ARN.`);return i};var iee=(e,t,r,o=!1)=>{let n=async()=>{let a;return o?a=r.clientContextParams?.[e]??r[e]??r[t]:a=r[e]??r[t],typeof a=="function"?a():a};return e==="credentialScope"||t==="CredentialScope"?async()=>{let a=typeof r.credentials=="function"?await r.credentials():r.credentials;return a?.credentialScope??a?.CredentialScope}:e==="accountId"||t==="AccountId"?async()=>{let a=typeof r.credentials=="function"?await r.credentials():r.credentials;return a?.accountId??a?.AccountId}:e==="endpoint"||t==="endpoint"?async()=>{if(r.isCustomEndpoint===!1)return;let a=await n();if(a&&typeof a=="object"){if("url"in a)return a.url.href;if("hostname"in a){let{protocol:i,hostname:s,port:c,path:l}=a;return`${i}//${s}${c?":"+c:""}${l}`}}return a}:n};var o2=async e=>{};var n2=e=>{if(typeof e=="object"){if("url"in e){let t=Hs(e.url);if(e.headers){t.headers={};for(let[r,o]of Object.entries(e.headers))t.headers[r.toLowerCase()]=o.join(", ")}return t}return e}return Hs(e)};var see=async(e,t,r,o)=>{if(!r.isCustomEndpoint){let i;r.serviceConfiguredEndpoint?i=await r.serviceConfiguredEndpoint():i=await o2(r.serviceId),i&&(r.endpoint=()=>Promise.resolve(n2(i)),r.isCustomEndpoint=!0)}let n=await gIe(e,t,r);if(typeof r.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");let a=r.endpointProvider(n,o);if(r.isCustomEndpoint&&r.endpoint){let i=await r.endpoint();if(i?.headers){a.headers??(a.headers={});for(let[s,c]of Object.entries(i.headers))a.headers[s]=Array.isArray(c)?c:[c]}}return a},gIe=async(e,t,r)=>{let o={},n=t?.getEndpointParameterInstructions?.()||{};for(let[a,i]of Object.entries(n))switch(i.type){case"staticContextParams":o[a]=i.value;break;case"contextParams":o[a]=e[i.name];break;case"clientContextParams":case"builtInParams":o[a]=await iee(i.name,a,r,i.type!=="builtInParams")();break;case"operationContextParams":o[a]=i.get(e);break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(i))}return Object.keys(n).length===0&&Object.assign(o,r),String(r.serviceId).toLowerCase()==="s3"&&await aee(o),o};var lee=({config:e,instructions:t})=>(r,o)=>async n=>{e.isCustomEndpoint&&ZQ(o,"ENDPOINT_OVERRIDE","N");let a=await see(n.input,{getEndpointParameterInstructions(){return t}},{...e},o);o.endpointV2=a,o.authSchemes=a.properties?.authSchemes;let i=o.authSchemes?.[0];if(i){o.signing_region=i.signingRegion,o.signing_service=i.signingName;let c=Aa(o)?.selectedHttpAuthScheme?.httpAuthOption;c&&(c.signingProperties=Object.assign(c.signingProperties||{},{signing_region:i.signingRegion,signingRegion:i.signingRegion,signing_service:i.signingName,signingName:i.signingName,signingRegionSet:i.signingRegionSet},i.properties))}return r({...n})};var cee={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};var yIe={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:cee.name},pee=(e,t)=>({applyToStack:r=>{r.addRelativeTo(lee({config:e,instructions:t}),yIe)}});var uee=e=>{let t=e.tls??!0,{endpoint:r,useDualstackEndpoint:o,useFipsEndpoint:n}=e,a=r!=null?async()=>n2(await Vo(r)()):void 0,s=Object.assign(e,{endpoint:a,tls:t,isCustomEndpoint:!!r,useDualstackEndpoint:Vo(o??!1),useFipsEndpoint:Vo(n??!1)}),c;return s.serviceConfiguredEndpoint=async()=>(e.serviceId&&!c&&(c=o2(e.serviceId)),c),s};var Ks;(function(e){e.STANDARD="standard",e.ADAPTIVE="adaptive"})(Ks||(Ks={}));var bc=3,gD=Ks.STANDARD;var mee=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],fee=["TimeoutError","RequestTimeout","RequestTimeoutException"],dee=[500,502,503,504],hee=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"],gee=["EHOSTUNREACH","ENETUNREACH","ENOTFOUND"];var vIe=e=>e?.$retryable!==void 0;var bIe=e=>e.$metadata?.clockSkewCorrected,xIe=e=>{let t=new Set(["Failed to fetch","NetworkError when attempting to fetch resource","The Internet connection appears to be offline","Load failed","Network request failed"]);return e&&e instanceof TypeError?t.has(e.message):!1},a2=e=>e.$metadata?.httpStatusCode===429||mee.includes(e.name)||e.$retryable?.throttling==!0,i2=(e,t=0)=>vIe(e)||bIe(e)||e.name==="InvalidSignatureException"&&e.message?.includes("Signature expired")||fee.includes(e.name)||hee.includes(e?.code||"")||gee.includes(e?.code||"")||dee.includes(e.$metadata?.httpStatusCode||0)||xIe(e)||wIe(e)||e.cause!==void 0&&t<=10&&i2(e.cause,t+1),yee=e=>{if(e.$metadata?.httpStatusCode!==void 0){let t=e.$metadata.httpStatusCode;return 500<=t&&t<=599&&!i2(e)}return!1};function wIe(e){return e.code==="ERR_HTTP2_STREAM_ERROR"&&e.message.includes("NGHTTP2_REFUSED_STREAM")}var l2=class l2{constructor(t){F(this,"beta");F(this,"minCapacity");F(this,"minFillRate");F(this,"scaleConstant");F(this,"smooth");F(this,"enabled",!1);F(this,"availableTokens",0);F(this,"lastMaxRate",0);F(this,"measuredTxRate",0);F(this,"requestCount",0);F(this,"fillRate");F(this,"lastThrottleTime");F(this,"lastTimestamp",0);F(this,"lastTxRateBucket");F(this,"maxCapacity");F(this,"timeWindow",0);this.beta=t?.beta??.7,this.minCapacity=t?.minCapacity??1,this.minFillRate=t?.minFillRate??.5,this.scaleConstant=t?.scaleConstant??.4,this.smooth=t?.smooth??.8,this.lastThrottleTime=this.getCurrentTimeInSeconds(),this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}async getSendToken(){return this.acquireTokenBucket(1)}updateClientSendingRate(t){let r;this.updateMeasuredRate();let o=t;if(o?.errorType==="THROTTLING"||a2(o?.error??t)){let i=this.enabled?Math.min(this.measuredTxRate,this.fillRate):this.measuredTxRate;this.lastMaxRate=i,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),r=this.cubicThrottle(i),this.enableTokenBucket()}else this.calculateTimeWindow(),r=this.cubicSuccess(this.getCurrentTimeInSeconds());let a=Math.min(r,2*this.measuredTxRate);this.updateTokenBucketRate(a)}getCurrentTimeInSeconds(){return Date.now()/1e3}async acquireTokenBucket(t){if(this.enabled){for(this.refillTokenBucket();t>this.availableTokens;){let r=(t-this.availableTokens)/this.fillRate*1e3;await new Promise(o=>l2.setTimeoutFn(o,r)),this.refillTokenBucket()}this.availableTokens=this.availableTokens-t}}refillTokenBucket(){let t=this.getCurrentTimeInSeconds();if(!this.lastTimestamp){this.lastTimestamp=t;return}let r=(t-this.lastTimestamp)*this.fillRate;this.availableTokens=Math.min(this.maxCapacity,this.availableTokens+r),this.lastTimestamp=t}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,1/3))}cubicThrottle(t){return this.getPrecise(t*this.beta)}cubicSuccess(t){return this.getPrecise(this.scaleConstant*Math.pow(t-this.lastThrottleTime-this.timeWindow,3)+this.lastMaxRate)}enableTokenBucket(){this.enabled=!0}updateTokenBucketRate(t){this.refillTokenBucket(),this.fillRate=Math.max(t,this.minFillRate),this.maxCapacity=Math.max(t,this.minCapacity),this.availableTokens=Math.min(this.availableTokens,this.maxCapacity)}updateMeasuredRate(){let t=this.getCurrentTimeInSeconds(),r=Math.floor(t*2)/2;if(this.requestCount++,r>this.lastTxRateBucket){let o=this.requestCount/(r-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(o*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=r}}getPrecise(t){return parseFloat(t.toFixed(8))}};F(l2,"setTimeoutFn",setTimeout);var s2=l2;var vee="amz-sdk-invocation-id",bee="amz-sdk-request";var xc=class xc{static delay(){return xc.v2026?50:100}static throttlingDelay(){return xc.v2026?1e3:500}static cost(){return xc.v2026?14:5}static throttlingCost(){return xc.v2026?5:10}static modifiedCostType(){return xc.v2026?"THROTTLING":"TRANSIENT"}};F(xc,"v2026",typeof process<"u"&&process.env?.SMITHY_NEW_RETRIES_2026==="true");var ra=xc;var c2=class{constructor(){F(this,"x",ra.delay())}computeNextBackoffDelay(t){let n=Math.random()*Math.min(this.x*2**t,2e4);return Math.floor(n)}setDelayBase(t){this.x=t}};var ex=class{constructor(t,r,o,n){F(this,"delay");F(this,"count");F(this,"cost");F(this,"longPoll");this.delay=t,this.count=r,this.cost=o,this.longPoll=n}getRetryCount(){return this.count}getRetryDelay(){return Math.min(2e4,this.delay)}getRetryCost(){return this.cost}isLongPoll(){return this.longPoll}};var p2={incompatible:1,attempts:2,capacity:3},Ym=class{constructor(t){F(this,"mode",Ks.STANDARD);F(this,"capacity",500);F(this,"retryBackoffStrategy");F(this,"maxAttemptsProvider");F(this,"baseDelay");typeof t=="number"?this.maxAttemptsProvider=async()=>t:typeof t=="function"?this.maxAttemptsProvider=t:t&&typeof t=="object"&&(this.maxAttemptsProvider=async()=>t.maxAttempts,this.baseDelay=t.baseDelay,this.retryBackoffStrategy=t.backoff),this.maxAttemptsProvider??(this.maxAttemptsProvider=async()=>bc),this.baseDelay??(this.baseDelay=ra.delay()),this.retryBackoffStrategy??(this.retryBackoffStrategy=new c2)}async acquireInitialRetryToken(t){return new ex(ra.delay(),0,void 0,ra.v2026&&t.includes(":longpoll"))}async refreshRetryTokenForRetry(t,r){let o=await this.getMaxAttempts(),n=this.retryCode(t,r,o),a=n===0,i=t.isLongPoll?.();if(a||i){let s=r.errorType;this.retryBackoffStrategy.setDelayBase(s==="THROTTLING"?ra.throttlingDelay():this.baseDelay);let c=this.retryBackoffStrategy.computeNextBackoffDelay(t.getRetryCount()),l=c;if(r.retryAfterHint instanceof Date&&(l=Math.max(c,Math.min(r.retryAfterHint.getTime()-Date.now(),c+5e3))),a){let p=this.getCapacityCost(s);return this.capacity-=p,new ex(l,t.getRetryCount()+1,p,t.isLongPoll?.()??!1)}else throw Object.assign(new Error("No retry token available"),{$backoff:ra.v2026&&n===p2.capacity&&i?l:0})}throw new Error("No retry token available")}recordSuccess(t){this.capacity=Math.min(500,this.capacity+(t.getRetryCost()??1))}getCapacity(){return this.capacity}async maxAttempts(){return this.maxAttemptsProvider()}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch{return console.warn(`Max attempts provider could not resolve. Using default of ${bc}`),bc}}retryCode(t,r,o){let n=t.getRetryCount()+1,a=this.isRetryableError(r.errorType)?0:p2.incompatible,i=n<o?0:p2.attempts,s=this.capacity>=this.getCapacityCost(r.errorType)?0:p2.capacity;return a||i||s}getCapacityCost(t){return t===ra.modifiedCostType()?ra.throttlingCost():ra.cost()}isRetryableError(t){return t==="THROTTLING"||t==="TRANSIENT"}};var u2=class{constructor(t,r){F(this,"mode",Ks.ADAPTIVE);F(this,"rateLimiter");F(this,"standardRetryStrategy");let{rateLimiter:o}=r??{};this.rateLimiter=o??new s2,this.standardRetryStrategy=r?new Ym({maxAttempts:typeof t=="number"?t:3,...r}):new Ym(t)}async acquireInitialRetryToken(t){let r=await this.standardRetryStrategy.acquireInitialRetryToken(t);return await this.rateLimiter.getSendToken(),r}async refreshRetryTokenForRetry(t,r){this.rateLimiter.updateClientSendingRate(r);let o=await this.standardRetryStrategy.refreshRetryTokenForRetry(t,r);return await this.rateLimiter.getSendToken(),o}recordSuccess(t){this.rateLimiter.updateClientSendingRate({}),this.standardRetryStrategy.recordSuccess(t)}async maxAttemptsProvider(){return this.standardRetryStrategy.maxAttempts()}};var m2=class e{constructor(t){F(this,"method");F(this,"protocol");F(this,"hostname");F(this,"port");F(this,"path");F(this,"query");F(this,"headers");F(this,"username");F(this,"password");F(this,"fragment");F(this,"body");this.method=t.method||"GET",this.hostname=t.hostname||"localhost",this.port=t.port,this.query=t.query||{},this.headers=t.headers||{},this.body=t.body,this.protocol=t.protocol?t.protocol.slice(-1)!==":"?`${t.protocol}:`:t.protocol:"https:",this.path=t.path?t.path.charAt(0)!=="/"?`/${t.path}`:t.path:"/",this.username=t.username,this.password=t.password,this.fragment=t.fragment}static clone(t){let r=new e({...t,headers:{...t.headers}});return r.query&&(r.query=_Ie(r.query)),r}static isInstance(t){if(!t)return!1;let r=t;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return e.clone(this)}};function _Ie(e){return Object.keys(e).reduce((t,r)=>{let o=e[r];return{...t,[r]:Array.isArray(o)?[...o]:o}},{})}var f2=class{constructor(t){F(this,"statusCode");F(this,"reason");F(this,"headers");F(this,"body");this.statusCode=t.statusCode,this.reason=t.reason,this.headers=t.headers||{},this.body=t.body}static isInstance(t){if(!t)return!1;let r=t;return typeof r.statusCode=="number"&&typeof r.headers=="object"}};var xee=e=>e instanceof Error?e:e instanceof Object?Object.assign(new Error,e):typeof e=="string"?new Error(e):new Error(`AWS SDK error wrapper for ${e}`);var wee=e=>{let{retryStrategy:t,retryMode:r}=e,o=Vo(e.maxAttempts??bc),n=t?Promise.resolve(t):void 0,a=async()=>await Vo(r)()===Ks.ADAPTIVE?new u2(o):new Ym(o);return Object.assign(e,{maxAttempts:o,retryStrategy:()=>n??(n=a())})};var See=e=>e?.body instanceof ReadableStream;function kee(e,t){if(f2.isInstance(e))for(let r of Object.keys(e.headers)){let o=r.toLowerCase();if(o==="retry-after"){let n=e.headers[r],a=NaN;if(n.endsWith("GMT"))try{a=(n_(n).getTime()-Date.now())/1e3}catch(i){t?.trace?.("Failed to parse retry-after header"),t?.trace?.(i)}else n.match(/ GMT, ((\d+)|(\d+\.\d+))$/)?a=Number(n.match(/ GMT, ([\d.]+)$/)?.[1]):n.match(/^((\d+)|(\d+\.\d+))$/)?a=Number(n):Date.parse(n)>=Date.now()&&(a=(Date.parse(n)-Date.now())/1e3);return isNaN(a)?void 0:new Date(Date.now()+a*1e3)}else if(o==="x-amz-retry-after"){let n=e.headers[r],a=Number(n);if(isNaN(a)){t?.trace?.(`Failed to parse x-amz-retry-after=${n}`);return}return new Date(Date.now()+a)}}}var EIe=e=>(t,r)=>async o=>{let n=await e.retryStrategy(),a=await e.maxAttempts();if(IIe(n)){n=n;let i=await n.acquireInitialRetryToken((r.partition_id??"")+(r.__retryLongPoll?":longpoll":"")),s=new Error,c=0,l=0,{request:p}=o,u=m2.isInstance(p);for(u&&(p.headers[vee]=Vm());;)try{u&&(p.headers[bee]=`attempt=${c+1}; max=${a}`);let{response:m,output:f}=await t(o);return n.recordSuccess(i),f.$metadata.attempts=c+1,f.$metadata.totalRetryDelay=l,{response:m,output:f}}catch(m){let f=TIe(m,e.logger);if(s=xee(m),u&&See(p))throw(r.logger instanceof _g?console:r.logger)?.warn("An error was encountered in a non-retryable streaming request."),s;try{i=await n.refreshRetryTokenForRetry(i,f)}catch(h){throw typeof h.$backoff=="number"&&await _ee(h.$backoff),s.$metadata||(s.$metadata={}),s.$metadata.attempts=c+1,s.$metadata.totalRetryDelay=l,s}c=i.getRetryCount();let d=i.getRetryDelay();l+=d,await _ee(d)}}else return n=n,n?.mode&&(r.userAgent=[...r.userAgent||[],["cfg/retry-mode",n.mode]]),n.retry(t,o)},_ee=e=>new Promise(t=>setTimeout(t,e)),IIe=e=>typeof e.acquireInitialRetryToken<"u"&&typeof e.refreshRetryTokenForRetry<"u"&&typeof e.recordSuccess<"u",TIe=(e,t)=>{let r={error:e,errorType:CIe(e)},o=kee(e.$response,t);return o&&(r.retryAfterHint=o),r},CIe=e=>a2(e)?"THROTTLING":i2(e)?"TRANSIENT":yee(e)?"SERVER_ERROR":"CLIENT_ERROR",NIe={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},Eee=e=>({applyToStack:t=>{t.add(EIe(e),NIe)}});var Iee=async(e,t,r)=>({operation:Aa(t).operation,region:await Vo(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function AIe(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"rekognition",region:e.region},propertiesExtractor:(t,r)=>({signingProperties:{config:t,context:r}})}}var Tee=e=>{let t=[];switch(e.operation){default:t.push(AIe(e))}return t},Cee=e=>{let t=iZ(e);return Object.assign(t,{authSchemePreference:Vo(e.authSchemePreference??[])})};var Nee=e=>Object.assign(e,{useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,defaultSigningName:"rekognition"}),Aee={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var Ree={name:"@aws-sdk/client-rekognitionstreaming",description:"AWS SDK for JavaScript Rekognitionstreaming Client for Node.js, Browser and React Native",version:"3.967.0",scripts:{build:"concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs","build:cjs":"node ../../scripts/compilation/inline client-rekognitionstreaming","build:es":"tsc -p tsconfig.es.json","build:include:deps":'yarn g:turbo run build -F="$npm_package_name"',"build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo rekognitionstreaming","test:index":"tsc --noEmit ./test/index-types.ts && node ./test/index-objects.spec.mjs"},main:"./dist-cjs/index.js",types:"./dist-types/index.d.ts",module:"./dist-es/index.js",sideEffects:!1,dependencies:{"@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/core":"3.967.0","@aws-sdk/credential-provider-node":"3.967.0","@aws-sdk/eventstream-handler-node":"3.965.0","@aws-sdk/middleware-eventstream":"3.965.0","@aws-sdk/middleware-host-header":"3.965.0","@aws-sdk/middleware-logger":"3.965.0","@aws-sdk/middleware-recursion-detection":"3.965.0","@aws-sdk/middleware-user-agent":"3.967.0","@aws-sdk/middleware-websocket":"3.965.0","@aws-sdk/region-config-resolver":"3.965.0","@aws-sdk/types":"3.965.0","@aws-sdk/util-endpoints":"3.965.0","@aws-sdk/util-user-agent-browser":"3.965.0","@aws-sdk/util-user-agent-node":"3.967.0","@smithy/config-resolver":"^4.4.5","@smithy/core":"^3.20.2","@smithy/eventstream-serde-browser":"^4.2.7","@smithy/eventstream-serde-config-resolver":"^4.3.7","@smithy/eventstream-serde-node":"^4.2.7","@smithy/fetch-http-handler":"^5.3.8","@smithy/hash-node":"^4.2.7","@smithy/invalid-dependency":"^4.2.7","@smithy/middleware-content-length":"^4.2.7","@smithy/middleware-endpoint":"^4.4.3","@smithy/middleware-retry":"^4.4.19","@smithy/middleware-serde":"^4.2.8","@smithy/middleware-stack":"^4.2.7","@smithy/node-config-provider":"^4.3.7","@smithy/node-http-handler":"^4.4.7","@smithy/protocol-http":"^5.3.7","@smithy/smithy-client":"^4.10.4","@smithy/types":"^4.11.0","@smithy/url-parser":"^4.2.7","@smithy/util-base64":"^4.3.0","@smithy/util-body-length-browser":"^4.2.0","@smithy/util-body-length-node":"^4.2.1","@smithy/util-defaults-mode-browser":"^4.3.18","@smithy/util-defaults-mode-node":"^4.2.21","@smithy/util-endpoints":"^3.2.7","@smithy/util-middleware":"^4.2.7","@smithy/util-retry":"^4.2.7","@smithy/util-utf8":"^4.2.0",tslib:"^2.6.2"},devDependencies:{"@tsconfig/node18":"18.2.4","@types/node":"^18.19.69",concurrently:"7.0.0","downlevel-dts":"0.10.1",rimraf:"5.0.10",typescript:"~5.8.3"},engines:{node:">=18.0.0"},typesVersions:{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},files:["dist-*/**"],author:{name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/javascript/"},license:"Apache-2.0",browser:{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},homepage:"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-rekognitionstreaming",repository:{type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"clients/client-rekognitionstreaming"}};var yD={name:"SHA-256"},vD={name:"HMAC",hash:yD},Dee=new Uint8Array([227,176,196,66,152,252,28,20,154,251,244,200,153,111,185,36,39,174,65,228,100,155,147,76,164,149,153,27,120,82,184,85]);var DIe={};function Ag(){return typeof window<"u"?window:typeof self<"u"?self:DIe}var bD=function(){function e(t){this.toHash=new Uint8Array(0),this.secret=t,this.reset()}return e.prototype.update=function(t){if(!Il(t)){var r=Za(t),o=new Uint8Array(this.toHash.byteLength+r.byteLength);o.set(this.toHash,0),o.set(r,this.toHash.byteLength),this.toHash=o}},e.prototype.digest=function(){var t=this;return this.key?this.key.then(function(r){return Ag().crypto.subtle.sign(vD,r,t.toHash).then(function(o){return new Uint8Array(o)})}):Il(this.toHash)?Promise.resolve(Dee):Promise.resolve().then(function(){return Ag().crypto.subtle.digest(yD,t.toHash)}).then(function(r){return Promise.resolve(new Uint8Array(r))})},e.prototype.reset=function(){var t=this;this.toHash=new Uint8Array(0),this.secret&&this.secret!==void 0&&(this.key=new Promise(function(r,o){Ag().crypto.subtle.importKey("raw",Za(t.secret),vD,!1,["sign"]).then(r,o)}),this.key.catch(function(){}))},e}();var FIe=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];function Fee(e){if(MIe(e)&&typeof e.crypto.subtle=="object"){var t=e.crypto.subtle;return OIe(t)}return!1}function MIe(e){if(typeof e=="object"&&typeof e.crypto=="object"){var t=e.crypto.getRandomValues;return typeof t=="function"}return!1}function OIe(e){return e&&FIe.every(function(t){return typeof e[t]=="function"})}var Mee=function(){function e(t){Fee(Ag())?this.hash=new bD(t):this.hash=new ez(t)}return e.prototype.update=function(t,r){this.hash.update(Za(t))},e.prototype.digest=function(){return this.hash.digest()},e.prototype.reset=function(){this.hash.reset()},e}();var Pee=({serviceId:e,clientVersion:t})=>async r=>{let o=typeof window<"u"?window.navigator:void 0,n=o?.userAgent??"",a=o?.userAgentData?.platform??Oee.os(n)??"other",i=void 0,s=o?.userAgentData?.brands??[],c=s[s.length-1],l=c?.brand??Oee.browser(n)??"unknown",p=c?.version??"unknown",u=[["aws-sdk-js",t],["ua","2.1"],[`os/${a}`,i],["lang/js"],["md/browser",`${l}_${p}`]];e&&u.push([`api/${e}`,t]);let m=await r?.userAgentAppId?.();return m&&u.push([`app/${m}`]),u},Oee={os(e){if(/iPhone|iPad|iPod/.test(e))return"iOS";if(/Macintosh|Mac OS X/.test(e))return"macOS";if(/Windows NT/.test(e))return"Windows";if(/Android/.test(e))return"Android";if(/Linux/.test(e))return"Linux"},browser(e){if(/EdgiOS|EdgA|Edg\//.test(e))return"Microsoft Edge";if(/Firefox\//.test(e))return"Firefox";if(/Chrome\//.test(e))return"Chrome";if(/Safari\//.test(e))return"Safari"}};var zee=e=>()=>Promise.reject(e);var $ee=["in-region","cross-region","mobile","standard","legacy"];var Lee=({defaultsMode:e}={})=>MJ(async()=>{let t=typeof e=="function"?await e():e;switch(t?.toLowerCase()){case"auto":return Promise.resolve(PIe()?"mobile":"standard");case"mobile":case"in-region":case"cross-region":case"standard":case"legacy":return Promise.resolve(t?.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw new Error(`Invalid parameter for "defaultsMode", expect ${$ee.join(", ")}, got ${t}`)}}),PIe=()=>{let e=window?.navigator;if(e?.connection){let{effectiveType:t,rtt:r,downlink:o}=e?.connection;if(typeof t=="string"&&t!=="4g"||Number(r)>100||Number(o)<10)return!0}return e?.userAgentData?.mobile||typeof e?.maxTouchPoints=="number"&&e?.maxTouchPoints>1};var Bee=e=>new TextEncoder().encode(e);var Uee=e=>{if(typeof e=="string")return e;if(typeof e!="object"||typeof e.byteOffset!="number"||typeof e.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(e)};var Qee="required",Ki="fn",Xi="argv",Dg="ref";var Wee="isSet",rx="booleanEquals",Rg="error",tx="endpoint",fn="tree",xD="PartitionResult",Hee={[Qee]:!1,type:"String"},Vee={[Qee]:!0,default:!1,type:"Boolean"},jee={[Dg]:"Endpoint"},Jee={[Ki]:rx,[Xi]:[{[Dg]:"UseFIPS"},!0]},Zee={[Ki]:rx,[Xi]:[{[Dg]:"UseDualStack"},!0]},qi={},Gee={[Ki]:"getAttr",[Xi]:[{[Dg]:xD},"supportsFIPS"]},qee={[Ki]:rx,[Xi]:[!0,{[Ki]:"getAttr",[Xi]:[{[Dg]:xD},"supportsDualStack"]}]},Kee=[Jee],Xee=[Zee],Yee=[{[Dg]:"Region"}],zIe={version:"1.0",parameters:{Region:Hee,UseDualStack:Vee,UseFIPS:Vee,Endpoint:Hee},rules:[{conditions:[{[Ki]:Wee,[Xi]:[jee]}],rules:[{conditions:Kee,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:Rg},{rules:[{conditions:Xee,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:Rg},{endpoint:{url:jee,properties:qi,headers:qi},type:tx}],type:fn}],type:fn},{rules:[{conditions:[{[Ki]:Wee,[Xi]:Yee}],rules:[{conditions:[{[Ki]:"aws.partition",[Xi]:Yee,assign:xD}],rules:[{conditions:[Jee,Zee],rules:[{conditions:[{[Ki]:rx,[Xi]:[!0,Gee]},qee],rules:[{rules:[{endpoint:{url:"https://streaming-rekognition-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:qi,headers:qi},type:tx}],type:fn}],type:fn},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:Rg}],type:fn},{conditions:Kee,rules:[{conditions:[{[Ki]:rx,[Xi]:[Gee,!0]}],rules:[{rules:[{endpoint:{url:"https://streaming-rekognition-fips.{Region}.{PartitionResult#dnsSuffix}",properties:qi,headers:qi},type:tx}],type:fn}],type:fn},{error:"FIPS is enabled but this partition does not support FIPS",type:Rg}],type:fn},{conditions:Xee,rules:[{conditions:[qee],rules:[{rules:[{endpoint:{url:"https://streaming-rekognition.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:qi,headers:qi},type:tx}],type:fn}],type:fn},{error:"DualStack is enabled but this partition does not support DualStack",type:Rg}],type:fn},{rules:[{endpoint:{url:"https://streaming-rekognition.{Region}.{PartitionResult#dnsSuffix}",properties:qi,headers:qi},type:tx}],type:fn}],type:fn}],type:fn},{error:"Invalid Configuration: Missing Region",type:Rg}],type:fn}]},ete=zIe;var $Ie=new h_({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),tte=(e,t={})=>$Ie.get(e,()=>EJ(ete,{endpointParams:e,logger:t.logger}));wg.aws=KR;var rte=e=>({apiVersion:"2022-05-30",base64Decoder:e?.base64Decoder??ci,base64Encoder:e?.base64Encoder??Ra,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??tte,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??Tee,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4"),signer:new Xb}],logger:e?.logger??new _g,protocol:e?.protocol??$_,protocolSettings:e?.protocolSettings??{defaultNamespace:"com.amazonaws.rekognitionstreaming",version:"2022-05-30",serviceTarget:"RekognitionStreamingService"},serviceId:e?.serviceId??"RekognitionStreaming",urlParser:e?.urlParser??Hs,utf8Decoder:e?.utf8Decoder??Bee,utf8Encoder:e?.utf8Encoder??Uee});var ote=e=>{let t=Lee(e),r=()=>t().then(uZ),o=rte(e);return{...o,...e,runtime:"browser",defaultsMode:t,bodyLengthChecker:e?.bodyLengthChecker??lZ,credentialDefaultProvider:e?.credentialDefaultProvider??(n=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:e?.defaultUserAgentProvider??Pee({serviceId:o.serviceId,clientVersion:Ree.version}),eventStreamPayloadHandlerProvider:e?.eventStreamPayloadHandlerProvider??BZ,eventStreamSerdeProvider:e?.eventStreamSerdeProvider??XZ,maxAttempts:e?.maxAttempts??bc,region:e?.region??zee("Region is missing"),requestHandler:e2.create(e?.requestHandler??r,Ws.create(r)),retryMode:e?.retryMode??(async()=>(await r()).retryMode||gD),sha256:e?.sha256??Mee,streamCollector:e?.streamCollector??Jk,useDualstackEndpoint:e?.useDualstackEndpoint??(()=>Promise.resolve(YZ)),useFipsEndpoint:e?.useFipsEndpoint??(()=>Promise.resolve(QZ))}};var nte=e=>({setRegion(t){e.region=t},region(){return e.region}}),ate=e=>({region:e.region()});var ite=e=>({setHttpHandler(t){e.httpHandler=t},httpHandler(){return e.httpHandler},updateHttpClientConfig(t,r){e.httpHandler?.updateHttpClientConfig(t,r)},httpHandlerConfigs(){return e.httpHandler.httpHandlerConfigs()}}),ste=e=>({httpHandler:e.httpHandler()});var lte=e=>{let t=e.httpAuthSchemes,r=e.httpAuthSchemeProvider,o=e.credentials;return{setHttpAuthScheme(n){let a=t.findIndex(i=>i.schemeId===n.schemeId);a===-1?t.push(n):t.splice(a,1,n)},httpAuthSchemes(){return t},setHttpAuthSchemeProvider(n){r=n},httpAuthSchemeProvider(){return r},setCredentials(n){o=n},credentials(){return o}}},cte=e=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()});var pte=(e,t)=>{let r=Object.assign(nte(e),yZ(e),ite(e),lte(e));return t.forEach(o=>o.configure(r)),Object.assign(e,ate(r),vZ(r),ste(r),cte(r))};var d2=class extends N_{constructor(...[r]){let o=ote(r||{});super(o);F(this,"config");this.initConfig=o;let n=Nee(o),a=rJ(n),i=wee(a),s=tee(i),c=s,l=uee(c),p=ree(l),u=Cee(p),m=QY(u),f=GZ(m),d=pte(f,r?.extensions||[]);this.config=d,this.middlewareStack.use(NQ(this.config)),this.middlewareStack.use(AZ(this.config)),this.middlewareStack.use(Eee(this.config)),this.middlewareStack.use(nee(this.config)),this.middlewareStack.use(oQ(this.config)),this.middlewareStack.use(nQ(this.config)),this.middlewareStack.use(sQ(this.config)),this.middlewareStack.use(pQ(this.config,{httpAuthSchemeParametersProvider:Iee,identityProviderConfigProvider:async h=>new d_({"aws.auth#sigv4":h.credentials})})),this.middlewareStack.use(mQ(this.config))}destroy(){super.destroy()}};var Ma=class e extends R_{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};var h2=class e extends Ma{constructor(r){super({name:"AccessDeniedException",$fault:"client",...r});F(this,"name","AccessDeniedException");F(this,"$fault","client");F(this,"Message");F(this,"Code");Object.setPrototypeOf(this,e.prototype),this.Message=r.Message,this.Code=r.Code}},g2=class e extends Ma{constructor(r){super({name:"InternalServerException",$fault:"server",...r});F(this,"name","InternalServerException");F(this,"$fault","server");F(this,"Message");F(this,"Code");Object.setPrototypeOf(this,e.prototype),this.Message=r.Message,this.Code=r.Code}},y2=class e extends Ma{constructor(r){super({name:"ServiceQuotaExceededException",$fault:"client",...r});F(this,"name","ServiceQuotaExceededException");F(this,"$fault","client");F(this,"Message");F(this,"Code");Object.setPrototypeOf(this,e.prototype),this.Message=r.Message,this.Code=r.Code}},v2=class e extends Ma{constructor(r){super({name:"ServiceUnavailableException",$fault:"server",...r});F(this,"name","ServiceUnavailableException");F(this,"$fault","server");F(this,"Message");F(this,"Code");Object.setPrototypeOf(this,e.prototype),this.Message=r.Message,this.Code=r.Code}},b2=class e extends Ma{constructor(r){super({name:"ThrottlingException",$fault:"client",...r});F(this,"name","ThrottlingException");F(this,"$fault","client");F(this,"Message");F(this,"Code");Object.setPrototypeOf(this,e.prototype),this.Message=r.Message,this.Code=r.Code}},x2=class e extends Ma{constructor(r){super({name:"ValidationException",$fault:"client",...r});F(this,"name","ValidationException");F(this,"$fault","client");F(this,"Message");F(this,"Code");Object.setPrototypeOf(this,e.prototype),this.Message=r.Message,this.Code=r.Code}},w2=class e extends Ma{constructor(r){super({name:"SessionNotFoundException",$fault:"client",...r});F(this,"name","SessionNotFoundException");F(this,"$fault","client");F(this,"Message");F(this,"Code");Object.setPrototypeOf(this,e.prototype),this.Message=r.Message,this.Code=r.Code}};var LIe="AccessDeniedException",SD="BoundingBox",BIe="BlazeFaceDetectionThreshold",Qm="Code",kD="ChallengeConfig",UIe="CurrentColorStartTimestamp",WIe="ClientChallenge",HIe="CurrentColor",ute="ColorDisplayed",mte="ChallengeEvent",fte="ChallengeId",VIe="ColorSequence",dte="ClientSessionInformationEvent",hte="ColorSequences",jIe="ChallengeVersions",GIe="CenterX",qIe="CenterY",gte="Challenge",KIe="DownscrollDuration",yte="DisconnectionEvent",vte="FreshnessColor",XIe="FlatDisplayDuration",YIe="FaceDetectedInTargetPositionEndTimestamp",QIe="FaceDetectedInTargetPositionStartTimestamp",JIe="FaceDistanceThreshold",ZIe="FaceDistanceThresholdMin",eTe="FaceDistanceThresholdMax",tTe="FaceIouHeightThreshold",rTe="FaceIouWidthThreshold",bte="FaceMovementAndLightChallenge",oTe="FaceMovementAndLightClientChallenge",nTe="FaceMovementAndLightServerChallenge",xte="FaceMovementChallenge",aTe="FaceMovementClientChallenge",iTe="FaceMovementServerChallenge",wte="Height",_D="InitialFace",sTe="InitialFaceDetectedTimestamp",Ste="InternalServerException",lTe="Left",cTe="LightChallengeType",kte="LivenessRequestStream",_te="LivenessResponseStream",Jm="Message",pTe="OvalFitTimeout",uTe="OvalHeightWidthRatio",mTe="OvalIouHeightThreshold",fTe="OvalIouThreshold",dTe="OvalIouWidthThreshold",ED="OvalParameters",hTe="PreviousColor",gTe="RGB",yTe="ServerChallenge",vTe="StartFaceLivenessSession",bTe="StartFaceLivenessSessionRequest",xTe="StartFaceLivenessSessionResponse",Ete="SessionInformation",Ite="SessionId",wTe="SequenceNumber",STe="SessionNotFoundException",Tte="ServiceQuotaExceededException",Cte="ServerSessionInformationEvent",Nte="ServiceUnavailableException",kTe="Top",Ate="ThrottlingException",ID="TargetFace",Rte="TimestampMillis",_Te="Type",ETe="Version",ITe="VideoChunk",Dte="ValidationException",Fte="VideoEndTimestamp",Mte="VideoEvent",TTe="VideoHeight",Ote="VideoStartTimestamp",CTe="VideoWidth",Pte="Width",nx="client",Zm="error",NTe="http",ef="httpError",ox="httpHeader",zte="server",$te="smithy.ts.sdk.synthetic.com.amazonaws.rekognitionstreaming",Lte="streaming",ATe="x-amz-rekognition-streaming-liveness-challenge-versions",Bte="x-amz-rekognition-streaming-liveness-session-id",RTe="x-amz-rekognition-streaming-liveness-video-height",DTe="x-amz-rekognition-streaming-liveness-video-width",gt="com.amazonaws.rekognitionstreaming",FTe=[-3,gt,LIe,{[Zm]:nx,[ef]:403},[Jm,Qm],[0,0]];wo.for(gt).registerError(FTe,h2);var Ute=[3,gt,SD,0,[Pte,wte,lTe,kTe],[1,1,1,1]],Wte=[3,gt,kD,0,[BIe,ZIe,JIe,eTe,fTe,uTe,dTe,mTe,rTe,tTe,pTe],[1,1,1,1,1,1,1,1,1,1,1]],MTe=[3,gt,mte,0,[ETe,_Te],[0,0]],OTe=[3,gt,dte,0,[gte],[()=>QTe]],PTe=[3,gt,ute,0,[HIe,hTe,wTe,UIe],[()=>wD,()=>wD,1,1]],zTe=[3,gt,VIe,0,[vte,KIe,XIe],[()=>wD,1,1]],$Te=[3,gt,yte,0,[Rte],[1]],LTe=[3,gt,oTe,0,[fte,Ote,Fte,_D,ID,ute],[0,1,1,()=>Hte,()=>Kte,()=>PTe]],BTe=[3,gt,nTe,0,[ED,cTe,kD,hte],[()=>jte,0,()=>Wte,()=>YTe]],UTe=[3,gt,aTe,0,[fte,Ote,Fte,_D,ID],[0,1,1,()=>Hte,()=>Kte]],WTe=[3,gt,iTe,0,[ED,kD],[()=>jte,()=>Wte]],wD=[3,gt,vte,0,[gTe],[65]],Hte=[3,gt,_D,0,[SD,sTe],[()=>Ute,1]],Vte=[-3,gt,Ste,{[Zm]:zte,[ef]:500},[Jm,Qm],[0,0]];wo.for(gt).registerError(Vte,g2);var jte=[3,gt,ED,0,[Pte,wte,GIe,qIe],[1,1,1,1]],HTe=[3,gt,Cte,0,[Ete],[()=>VTe]],Gte=[-3,gt,Tte,{[Zm]:nx,[ef]:429},[Jm,Qm],[0,0]];wo.for(gt).registerError(Gte,y2);var qte=[-3,gt,Nte,{[Zm]:zte,[ef]:503},[Jm,Qm],[0,0]];wo.for(gt).registerError(qte,v2);var VTe=[3,gt,Ete,0,[gte],[()=>eCe]],jTe=[-3,gt,STe,{[Zm]:nx,[ef]:400},[Jm,Qm],[0,0]];wo.for(gt).registerError(jTe,w2);var GTe=[3,gt,bTe,0,[Ite,CTe,TTe,jIe,kte],[[0,{[ox]:Bte}],[0,{[ox]:DTe}],[0,{[ox]:RTe}],[0,{[ox]:ATe}],[()=>JTe,16]]],qTe=[3,gt,xTe,0,[Ite,_te],[[0,{[ox]:Bte}],[()=>ZTe,16]]],Kte=[3,gt,ID,0,[SD,QIe,YIe],[()=>Ute,1,1]],Xte=[-3,gt,Ate,{[Zm]:nx,[ef]:429},[Jm,Qm],[0,0]];wo.for(gt).registerError(Xte,b2);var Yte=[-3,gt,Dte,{[Zm]:nx,[ef]:400},[Jm,Qm],[0,0]];wo.for(gt).registerError(Yte,x2);var KTe=[3,gt,Mte,0,[ITe,Rte],[21,1]],XTe=[-3,$te,"RekognitionStreamingServiceException",0,[],[]];wo.for($te).registerError(XTe,Ma);var YTe=[1,gt,hte,0,()=>zTe],QTe=[4,gt,WIe,0,[bte,xte],[()=>LTe,()=>UTe]],JTe=[4,gt,kte,{[Lte]:1},[Mte,dte],[()=>KTe,()=>OTe]],ZTe=[4,gt,_te,{[Lte]:1},[Cte,yte,mte,Dte,Ste,Ate,Tte,Nte],[()=>HTe,()=>$Te,()=>MTe,[()=>Yte,0],[()=>Vte,0],[()=>Xte,0],[()=>Gte,0],[()=>qte,0]]],eCe=[4,gt,yTe,0,[bte,xte],[()=>BTe,()=>WTe]],Qte=[9,gt,vTe,{[NTe]:["POST","/start-face-liveness-session",200]},()=>GTe,()=>qTe];var S2=class extends Zb.classBuilder().ep(Aee).m(function(t,r,o,n){return[pee(o,t.getEndpointParameterInstructions()),rQ(o),jZ(o,{headerPrefix:"x-amz-rekognition-streaming-liveness-"})]}).s("RekognitionStreamingService","StartFaceLivenessSession",{eventStream:{input:!0,output:!0}}).n("RekognitionStreamingClient","StartFaceLivenessSessionCommand").sc(Qte).build(){};var Jte="3.6.4";var tCe=`ui-react-liveness/${Jte}`,Zte=()=>tCe;var ere;(function(e){e.HEADER="header",e.QUERY="query"})(ere||(ere={}));var tre;(function(e){e.HEADER="header",e.QUERY="query"})(tre||(tre={}));var rre;(function(e){e.HTTP="http",e.HTTPS="https"})(rre||(rre={}));var TD;(function(e){e.MD5="md5",e.CRC32="crc32",e.CRC32C="crc32c",e.SHA1="sha1",e.SHA256="sha256"})(TD||(TD={}));var CD;(function(e){e[e.HEADER=0]="HEADER",e[e.TRAILER=1]="TRAILER"})(CD||(CD={}));var ore;(function(e){e.PROFILE="profile",e.SSO_SESSION="sso-session",e.SERVICES="services"})(ore||(ore={}));var nre;(function(e){e.HTTP_0_9="http/0.9",e.HTTP_1_0="http/1.0",e.TDS_8_0="tds/8.0"})(nre||(nre={}));var k2=class{constructor(t){this.statusCode=t.statusCode,this.reason=t.reason,this.headers=t.headers||{},this.body=t.body}static isInstance(t){if(!t)return!1;let r=t;return typeof r.statusCode=="number"&&typeof r.headers=="object"}};var rCe=2e3,ND="Websocket connection timeout",oCe=e=>e.protocol==="ws:"||e.protocol==="wss:",nCe=e=>typeof ReadableStream=="function"&&e instanceof ReadableStream,aCe=e=>e[Symbol.asyncIterator]?e:nCe(e)?Cg(e):{[Symbol.asyncIterator]:async function*(){yield e}},iCe=e=>typeof ReadableStream=="function"?Ng(e):e,_2=class{constructor(t,r=new Ws){this.metadata={handlerProtocol:"websocket/h1.1"},this.sockets={},this.utf8decoder=new TextDecoder,this.httpHandler=r,typeof t=="function"?(this.config={},this.configPromise=t().then(o=>this.config=o??{})):(this.config=t??{},this.configPromise=Promise.resolve(this.config))}destroy(){for(let[t,r]of Object.entries(this.sockets)){for(let o of r)o.close(1e3,"Socket closed through destroy() call");delete this.sockets[t]}}async handle(t){if(!oCe(t))return this.httpHandler.handle(t);let r=Q_(t),o=new WebSocket(r);this.sockets[r]||(this.sockets[r]=[]),this.sockets[r].push(o),o.binaryType="arraybuffer";let{connectionTimeout:n=rCe}=await this.configPromise;await this.waitForReady(o,n);let{body:a}=t,i=aCe(a),s=this.connect(o,i),c=iCe(s);return{response:new k2({statusCode:200,body:c})}}updateHttpClientConfig(t,r){this.configPromise=this.configPromise.then(o=>({...o,[t]:r}))}httpHandlerConfigs(){return this.config??{}}removeNotUsableSockets(t){this.sockets[t]=(this.sockets[t]??[]).filter(r=>!(r.readyState===WebSocket.CLOSING||r.readyState===WebSocket.CLOSED))}waitForReady(t,r){return new Promise((o,n)=>{let a=setTimeout(()=>{this.removeNotUsableSockets(t.url),n(new Error(ND))},r);t.onopen=()=>{clearTimeout(a),o()}})}connect(t,r){let o,n=!1,a=()=>{},i=()=>{};t.onmessage=l=>{i({done:!1,value:new Uint8Array(l.data)})},t.onerror=l=>{n=!0,t.close(),a(l)},t.onclose=()=>{this.removeNotUsableSockets(t.url),!n&&(o?a(o):i({done:!0,value:void 0}))};let s={[Symbol.asyncIterator]:()=>({next:()=>new Promise((l,p)=>{i=l,a=p})})};return(async()=>{try{for await(let l of r){let p=this.utf8decoder.decode(l);if(p.includes("closeCode")){let u=p.match(/"closeCode":([0-9]*)/);if(u){let m=u[1];t.close(parseInt(m))}continue}t.send(l)}}catch(l){l instanceof Error&&(o=l)}finally{t.close(Pl.SUCCESS_CODE)}})(),s}};var sCe=e=>typeof e=="function",lCe=e=>!!(e?.accessKeyId&&e?.secretAccessKey);async function are(e){let t=sCe(e);if(e&&!t)throw new Error("Invalid credentialsProvider");if(t)return e;try{let r=(await Tw()).credentials;if(lCe(r))return r;throw new Error("Missing credentials")}catch(r){let{message:o}=r;throw new Error(`Invalid credentials: ${o}`)}}var ire={},AD={};for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();t.length===1&&(t=`0${t}`),ire[e]=t,AD[t]=e}function sre(e){if(e.length%2!==0)throw new Error("Hex encoded strings must have an even number length");let t=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2){let o=e.slice(r,r+2).toLowerCase();if(o in AD)t[r/2]=AD[o];else throw new Error(`Cannot decode unrecognized sequence ${o} as hexadecimal`)}return t}function Oa(e){let t="";for(let r=0;r<e.byteLength;r++)t+=ire[e[r]];return t}var ax=e=>new TextEncoder().encode(e);var Xs=e=>typeof e=="string"?ax(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e);var lre="X-Amz-Algorithm",cre="X-Amz-Credential",RD="X-Amz-Date",pre="X-Amz-SignedHeaders",ure="X-Amz-Expires",DD="X-Amz-Signature",FD="X-Amz-Security-Token";var MD="authorization",OD=RD.toLowerCase(),cCe="date",mre=[MD,OD,cCe],fre=DD.toLowerCase(),ix="x-amz-content-sha256",dre=FD.toLowerCase();var hre={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},gre=/^proxy-/,yre=/^sec-/;var E2="AWS4-HMAC-SHA256";var vre="AWS4-HMAC-SHA256-PAYLOAD",bre="UNSIGNED-PAYLOAD",xre=50,PD="aws4_request",wre=60*60*24*7;var I2={},zD=[],T2=(e,t,r)=>`${e}/${t}/${r}/${PD}`,kre=async(e,t,r,o,n)=>{let a=await Sre(e,t.secretAccessKey,t.accessKeyId),i=`${r}:${o}:${n}:${Oa(a)}:${t.sessionToken}`;if(i in I2)return I2[i];for(zD.push(i);zD.length>xre;)delete I2[zD.shift()];let s=`AWS4${t.secretAccessKey}`;for(let c of[r,o,n,PD])s=await Sre(e,s,c);return I2[i]=s};var Sre=(e,t,r)=>{let o=new e(t);return o.update(Xs(r)),o.digest()};var C2=({headers:e},t,r)=>{let o={};for(let n of Object.keys(e).sort()){if(e[n]==null)continue;let a=n.toLowerCase();(a in hre||t?.has(a)||gre.test(a)||yre.test(a))&&(!r||r&&!r.has(a))||(o[a]=e[n].trim().replace(/\s+/g," "))}return o};var sx=async({headers:e,body:t},r)=>{for(let o of Object.keys(e))if(o.toLowerCase()===ix)return e[o];if(t==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof t=="string"||ArrayBuffer.isView(t)||E_(t)){let o=new r;return o.update(Xs(t)),Oa(await o.digest())}return bre};var N2=class{format(t){let r=[];for(let a of Object.keys(t)){let i=ax(a);r.push(Uint8Array.from([i.byteLength]),i,this.formatHeaderValue(t[a]))}let o=new Uint8Array(r.reduce((a,i)=>a+i.byteLength,0)),n=0;for(let a of r)o.set(a,n),n+=a.byteLength;return o}formatHeaderValue(t){switch(t.type){case"boolean":return Uint8Array.from([t.value?0:1]);case"byte":return Uint8Array.from([2,t.value]);case"short":let r=new DataView(new ArrayBuffer(3));return r.setUint8(0,3),r.setInt16(1,t.value,!1),new Uint8Array(r.buffer);case"integer":let o=new DataView(new ArrayBuffer(5));return o.setUint8(0,4),o.setInt32(1,t.value,!1),new Uint8Array(o.buffer);case"long":let n=new Uint8Array(9);return n[0]=5,n.set(t.value.bytes,1),n;case"binary":let a=new DataView(new ArrayBuffer(3+t.value.byteLength));a.setUint8(0,6),a.setUint16(1,t.value.byteLength,!1);let i=new Uint8Array(a.buffer);return i.set(t.value,3),i;case"string":let s=ax(t.value),c=new DataView(new ArrayBuffer(3+s.byteLength));c.setUint8(0,7),c.setUint16(1,s.byteLength,!1);let l=new Uint8Array(c.buffer);return l.set(s,3),l;case"timestamp":let p=new Uint8Array(9);return p[0]=8,p.set($D.fromNumber(t.value.valueOf()).bytes,1),p;case"uuid":if(!pCe.test(t.value))throw new Error(`Invalid UUID received: ${t.value}`);let u=new Uint8Array(17);return u[0]=9,u.set(sre(t.value.replace(/\-/g,"")),1),u}}},_re;(function(e){e[e.boolTrue=0]="boolTrue",e[e.boolFalse=1]="boolFalse",e[e.byte=2]="byte",e[e.short=3]="short",e[e.integer=4]="integer",e[e.long=5]="long",e[e.byteArray=6]="byteArray",e[e.string=7]="string",e[e.timestamp=8]="timestamp",e[e.uuid=9]="uuid"})(_re||(_re={}));var pCe=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,$D=class e{constructor(t){if(this.bytes=t,t.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(t){if(t>9223372036854776e3||t<-9223372036854776e3)throw new Error(`${t} is too large (or, if negative, too small) to represent as an Int64`);let r=new Uint8Array(8);for(let o=7,n=Math.abs(Math.round(t));o>-1&&n>0;o--,n/=256)r[o]=n;return t<0&&Ere(r),new e(r)}valueOf(){let t=this.bytes.slice(0),r=t[0]&128;return r&&Ere(t),parseInt(Oa(t),16)*(r?-1:1)}toString(){return String(this.valueOf())}};function Ere(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,e[t]===0);t--);}var LD=(e,t)=>{e=e.toLowerCase();for(let r of Object.keys(t))if(e===r.toLowerCase())return!0;return!1};var Fg=class e{constructor(t){F(this,"method");F(this,"protocol");F(this,"hostname");F(this,"port");F(this,"path");F(this,"query");F(this,"headers");F(this,"username");F(this,"password");F(this,"fragment");F(this,"body");this.method=t.method||"GET",this.hostname=t.hostname||"localhost",this.port=t.port,this.query=t.query||{},this.headers=t.headers||{},this.body=t.body,this.protocol=t.protocol?t.protocol.slice(-1)!==":"?`${t.protocol}:`:t.protocol:"https:",this.path=t.path?t.path.charAt(0)!=="/"?`/${t.path}`:t.path:"/",this.username=t.username,this.password=t.password,this.fragment=t.fragment}static clone(t){let r=new e({...t,headers:{...t.headers}});return r.query&&(r.query=uCe(r.query)),r}static isInstance(t){if(!t)return!1;let r=t;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return e.clone(this)}};function uCe(e){return Object.keys(e).reduce((t,r)=>{let o=e[r];return{...t,[r]:Array.isArray(o)?[...o]:o}},{})}var BD=(e,t={})=>{let{headers:r,query:o={}}=Fg.clone(e);for(let n of Object.keys(r)){let a=n.toLowerCase();(a.slice(0,6)==="x-amz-"&&!t.unhoistableHeaders?.has(a)||t.hoistableHeaders?.has(a))&&(o[n]=r[n],delete r[n])}return{...e,headers:r,query:o}};var A2=e=>{e=Fg.clone(e);for(let t of Object.keys(e.headers))mre.indexOf(t.toLowerCase())>-1&&delete e.headers[t];return e};var UD=({query:e={}})=>{let t=[],r={};for(let o of Object.keys(e)){if(o.toLowerCase()===fre)continue;let n=jo(o);t.push(n);let a=e[o];typeof a=="string"?r[n]=`${n}=${jo(a)}`:Array.isArray(a)&&(r[n]=a.slice(0).reduce((i,s)=>i.concat([`${n}=${jo(s)}`]),[]).sort().join("&"))}return t.sort().map(o=>r[o]).filter(o=>o).join("&")};var Ire=e=>mCe(e).toISOString().replace(/\.\d{3}Z$/,"Z"),mCe=e=>typeof e=="number"?new Date(e*1e3):typeof e=="string"?Number(e)?new Date(Number(e)*1e3):new Date(e):e;var lx=class{constructor({applyChecksum:t,credentials:r,region:o,service:n,sha256:a,uriEscapePath:i=!0}){this.service=n,this.sha256=a,this.uriEscapePath=i,this.applyChecksum=typeof t=="boolean"?t:!0,this.regionProvider=Vo(o),this.credentialProvider=Vo(r)}createCanonicalRequest(t,r,o){let n=Object.keys(r).sort();return`${t.method}
163
+ ${this.getCanonicalPath(t)}
164
+ ${UD(t)}
165
+ ${n.map(a=>`${a}:${r[a]}`).join(`
166
+ `)}
167
+
168
+ ${n.join(";")}
169
+ ${o}`}async createStringToSign(t,r,o,n){let a=new this.sha256;a.update(Xs(o));let i=await a.digest();return`${n}
170
+ ${t}
171
+ ${r}
172
+ ${Oa(i)}`}getCanonicalPath({path:t}){if(this.uriEscapePath){let r=[];for(let a of t.split("/"))a?.length!==0&&a!=="."&&(a===".."?r.pop():r.push(a));let o=`${t?.startsWith("/")?"/":""}${r.join("/")}${r.length>0&&t?.endsWith("/")?"/":""}`;return jo(o).replace(/%2F/g,"/")}return t}validateResolvedCredentials(t){if(typeof t!="object"||typeof t.accessKeyId!="string"||typeof t.secretAccessKey!="string")throw new Error("Resolved credential object is not valid")}formatDate(t){let r=Ire(t).replace(/[\-:]/g,"");return{longDate:r,shortDate:r.slice(0,8)}}getCanonicalHeaderList(t){return Object.keys(t).sort().join(";")}};var R2=class extends lx{constructor({applyChecksum:t,credentials:r,region:o,service:n,sha256:a,uriEscapePath:i=!0}){super({applyChecksum:t,credentials:r,region:o,service:n,sha256:a,uriEscapePath:i}),this.headerFormatter=new N2}async presign(t,r={}){let{signingDate:o=new Date,expiresIn:n=3600,unsignableHeaders:a,unhoistableHeaders:i,signableHeaders:s,hoistableHeaders:c,signingRegion:l,signingService:p}=r,u=await this.credentialProvider();this.validateResolvedCredentials(u);let m=l??await this.regionProvider(),{longDate:f,shortDate:d}=this.formatDate(o);if(n>wre)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");let h=T2(d,m,p??this.service),y=BD(A2(t),{unhoistableHeaders:i,hoistableHeaders:c});u.sessionToken&&(y.query[FD]=u.sessionToken),y.query[lre]=E2,y.query[cre]=`${u.accessKeyId}/${h}`,y.query[RD]=f,y.query[ure]=n.toString(10);let g=C2(y,a,s);return y.query[pre]=this.getCanonicalHeaderList(g),y.query[DD]=await this.getSignature(f,h,this.getSigningKey(u,m,d,p),this.createCanonicalRequest(y,g,await sx(t,this.sha256))),y}async sign(t,r){return typeof t=="string"?this.signString(t,r):t.headers&&t.payload?this.signEvent(t,r):t.message?this.signMessage(t,r):this.signRequest(t,r)}async signEvent({headers:t,payload:r},{signingDate:o=new Date,priorSignature:n,signingRegion:a,signingService:i}){let s=a??await this.regionProvider(),{shortDate:c,longDate:l}=this.formatDate(o),p=T2(c,s,i??this.service),u=await sx({headers:{},body:r},this.sha256),m=new this.sha256;m.update(t);let f=Oa(await m.digest()),d=[vre,l,p,n,f,u].join(`
173
+ `);return this.signString(d,{signingDate:o,signingRegion:s,signingService:i})}async signMessage(t,{signingDate:r=new Date,signingRegion:o,signingService:n}){return this.signEvent({headers:this.headerFormatter.format(t.message.headers),payload:t.message.body},{signingDate:r,signingRegion:o,signingService:n,priorSignature:t.priorSignature}).then(i=>({message:t.message,signature:i}))}async signString(t,{signingDate:r=new Date,signingRegion:o,signingService:n}={}){let a=await this.credentialProvider();this.validateResolvedCredentials(a);let i=o??await this.regionProvider(),{shortDate:s}=this.formatDate(r),c=new this.sha256(await this.getSigningKey(a,i,s,n));return c.update(Xs(t)),Oa(await c.digest())}async signRequest(t,{signingDate:r=new Date,signableHeaders:o,unsignableHeaders:n,signingRegion:a,signingService:i}={}){let s=await this.credentialProvider();this.validateResolvedCredentials(s);let c=a??await this.regionProvider(),l=A2(t),{longDate:p,shortDate:u}=this.formatDate(r),m=T2(u,c,i??this.service);l.headers[OD]=p,s.sessionToken&&(l.headers[dre]=s.sessionToken);let f=await sx(l,this.sha256);!LD(ix,l.headers)&&this.applyChecksum&&(l.headers[ix]=f);let d=C2(l,n,o),h=await this.getSignature(p,m,this.getSigningKey(s,c,u,i),this.createCanonicalRequest(l,d,f));return l.headers[MD]=`${E2} Credential=${s.accessKeyId}/${m}, SignedHeaders=${this.getCanonicalHeaderList(d)}, Signature=${h}`,l}async getSignature(t,r,o,n){let a=await this.createStringToSign(t,r,n,E2),i=new this.sha256(await o);return i.update(Xs(a)),Oa(await i.digest())}getSigningKey(t,r,o,n){return kre(this.sha256,t,o,r,n||this.service)}};var D2=class extends R2{presign(t,r){return super.presign(t,{...r,expiresIn:M8,unsignableHeaders:new Set(Object.keys(t.headers).filter(o=>o!=="host"))})}};var Mg=class e{static getAttemptCountAndUpdateTimestamp(){return Date.now()-e.timestamp>3e5?e.attemptCount=1:e.attemptCount+=1,e.timestamp=Date.now(),e.attemptCount}};Mg.attemptCount=0;Mg.timestamp=Date.now();var Tre=(e,t)=>r=>async o=>(o.request.query["attempt-count"]=e.toString(),o.request.query["precheck-view-enabled"]=t?"1":"0",await r(o));var fCe=`${lp()} ${Zte()}`;async function dCe({credentialsProvider:e,endpointOverride:t,region:r,systemClockOffset:o}){let n={credentials:await are(e),customUserAgent:fCe,region:r,requestHandler:new _2({connectionTimeout:O8}),signerConstructor:D2,systemClockOffset:o};return qn(t)&&(n.endpointProvider=()=>({url:new URL(t)})),new d2(n)}var hCe=({requestStream:e,sessionId:t,videoWidth:r,videoHeight:o})=>({ChallengeVersions:P8,SessionId:t,LivenessRequestStream:e,VideoWidth:r,VideoHeight:o});async function Cre(e){let t=await dCe(e);return t.middlewareStack.add(Tre(e.attemptCount,e.preCheckViewEnabled),{step:"build",name:"telemetryMiddleware",tags:["liveness","amplify-ui"]}),{async getResponseStream(r){let o=new S2(hCe(r)),{LivenessResponseStream:n}=await t.send(o);return n}}}var Sc,rf,dn,wc,M2,O2,cx,px,Og,P2,F2,tf,Are,Rre,WD,Nre,Dre,z2=class{constructor(t){if(Sc.add(this),rf.set(this,void 0),dn.set(this,void 0),wc.set(this,void 0),M2.set(this,!1),O2.set(this,void 0),cx.set(this,void 0),px.set(this,void 0),Og.set(this,void 0),P2.set(this,void 0),F2.set(this,void 0),tf.set(this,void 0),typeof MediaRecorder>"u")throw Error("MediaRecorder is not supported by this browser");er(this,rf,[],"f"),er(this,dn,new MediaRecorder(t,{bitsPerSecond:1e6}),"f"),er(this,wc,xe(this,dn,"f"),"f"),er(this,F2,xe(this,Sc,"m",Rre).call(this),"f"),er(this,tf,{},"f")}getVideoStream(){return xe(this,F2,"f")}setNewVideoStream(t){xe(this,Sc,"m",Dre).call(this),er(this,dn,new MediaRecorder(t,{bitsPerSecond:1e6}),"f"),xe(this,Sc,"m",WD).call(this,xe(this,dn,"f"))}dispatchStreamEvent(t){let{type:r}=t,o=r==="streamStop"?void 0:t.data;xe(this,dn,"f").dispatchEvent(new MessageEvent(r,{data:o}))}getRecordingStartTimestamp(){if(Fl(xe(this,px,"f"))||Fl(xe(this,Og,"f")))throw new Error("Recording has not started");return Math.round(.73*(xe(this,px,"f")-xe(this,Og,"f"))+xe(this,Og,"f"))}getRecordingEndedTimestamp(){if(Fl(xe(this,cx,"f")))throw new Error("Recording has not ended");return xe(this,cx,"f")}startRecording(){xe(this,Sc,"m",Are).call(this),er(this,Og,Date.now(),"f"),xe(this,dn,"f").start(D8)}isRecording(){return xe(this,dn,"f").state==="recording"}getChunksLength(){return xe(this,rf,"f").length}hasRecordingStarted(){return xe(this,M2,"f")&&xe(this,O2,"f")!==void 0}async stopRecording(){return this.isRecording()&&xe(this,dn,"f").stop(),xe(this,P2,"f")}};rf=new WeakMap,dn=new WeakMap,wc=new WeakMap,M2=new WeakMap,O2=new WeakMap,cx=new WeakMap,px=new WeakMap,Og=new WeakMap,P2=new WeakMap,F2=new WeakMap,tf=new WeakMap,Sc=new WeakSet,Are=function(){er(this,rf,[],"f")},Rre=function(){return new ReadableStream({start:t=>{xe(this,Sc,"m",WD).call(this,xe(this,dn,"f"),t)}})},WD=function(t,r){let o=r?({data:c})=>{c&&c.size>0&&(xe(this,rf,"f").length===0&&er(this,O2,Date.now(),"f"),xe(this,rf,"f").push(c),r.enqueue({type:"streamVideo",data:c}))}:({data:c})=>{xe(this,wc,"f").dispatchEvent(new MessageEvent("dataavailable",{data:c}))};t.ondataavailable=o;let n=r?c=>{let{data:l}=c;r.enqueue({type:"sessionInfo",data:l})}:c=>{let{data:l}=c;xe(this,wc,"f").dispatchEvent(new MessageEvent("sessionInfo",{data:l}))};t.addEventListener("sessionInfo",n);let a=r?()=>{r.enqueue({type:"streamStop"})}:()=>{xe(this,wc,"f").dispatchEvent(new MessageEvent("streamStop"))};t.addEventListener("streamStop",a);let i=r?c=>{let{data:l}=c;r.enqueue({type:"closeCode",data:l})}:c=>{let{data:l}=c;xe(this,wc,"f").dispatchEvent(new MessageEvent("closeCode",{data:l}))};t.addEventListener("closeCode",i);let s=r?()=>{r.close()}:()=>{xe(this,wc,"f").dispatchEvent(new MessageEvent("endStream"))};t.addEventListener("endStream",s),xe(this,Sc,"m",Nre).call(this),er(this,tf,{endStream:s,closeCode:i,streamStop:a,sessionInfo:n,dataavailable:o},"f")},Nre=function(){xe(this,dn,"f").onstart=()=>{er(this,M2,!0,"f"),er(this,px,Date.now(),"f")},er(this,P2,new Promise(t=>{xe(this,dn,"f").onstop=()=>{er(this,cx,Date.now(),"f"),t()}}),"f"),xe(this,dn,"f").onerror=()=>{this.stopRecording()}},Dre=function(){Object.keys(xe(this,tf,"f")).forEach(r=>{xe(this,dn,"f").removeEventListener(r,xe(this,tf,"f")[r])}),er(this,tf,{},"f")};var Fre=e=>!!e?.ServerSessionInformationEvent,Mre=e=>{let{message:t}=e;return t.includes(ND)},Ore=e=>!!e?.DisconnectionEvent,Pre=e=>!!e?.ValidationException,zre=e=>!!e?.InternalServerException,$re=e=>!!e?.ThrottlingException,Lre=e=>!!e?.ServiceQuotaExceededException,Bre=e=>{let{message:t,name:r}=e;return r==="InvalidSignatureException"&&t.includes("valid region")};var Pg={width:{min:320,ideal:640},height:{min:240,ideal:480},frameRate:{min:15,ideal:30,max:60},facingMode:"user"};var Wre="AmplifyLivenessCameraId",gCe=7e3,Hre,ux=e=>{let t=e.videoAssociatedParams?.selectableDevices?.find(r=>r.deviceId===e.videoAssociatedParams?.selectedDeviceId);return t?{deviceId:t.deviceId,groupId:t.groupId,label:t.label??""}:void 0},yCe=async e=>{try{let t=await Hre;for await(let r of t)Fre(r)?e({type:"SET_SESSION_INFO",data:{serverSessionInformation:r.ServerSessionInformationEvent.SessionInformation}}):Ore(r)?e({type:"DISCONNECT_EVENT"}):Pre(r)?e({type:"SERVER_ERROR",data:{error:{...r.ValidationException}}}):zre(r)?e({type:"SERVER_ERROR",data:{error:{...r.InternalServerException}}}):$re(r)?e({type:"SERVER_ERROR",data:{error:{...r.ThrottlingException}}}):Lre(r)&&e({type:"SERVER_ERROR",data:{error:{...r.ServiceQuotaExceededException}}})}catch(t){Bre(t)?e({type:"SERVER_ERROR",data:{error:new Error("Invalid region in FaceLivenessDetector or credentials are scoped to the wrong region.")}}):t instanceof Error&&e({type:Mre(t)?"CONNECTION_TIMEOUT":"SERVER_ERROR",data:{error:t}})}};function vCe(){return localStorage.getItem(Wre)}function Ure(e){localStorage.setItem(Wre,e)}var Vre=FC({id:"livenessMachine",initial:"initCamera",predictableActionArguments:!0,context:{challengeId:zd(),errorMessage:void 0,maxFailedAttempts:0,failedAttempts:0,componentProps:void 0,parsedSessionInformation:void 0,serverSessionInformation:void 0,videoAssociatedParams:{videoConstraints:Pg,selectableDevices:[]},ovalAssociatedParams:void 0,faceMatchAssociatedParams:{illuminationState:void 0,faceMatchState:void 0,faceMatchPercentage:25,currentDetectedFace:void 0,startFace:void 0,endFace:void 0},freshnessColorAssociatedParams:{freshnessColorEl:void 0,freshnessColors:[],freshnessColorsComplete:!1},colorSequenceDisplay:void 0,errorState:void 0,livenessStreamProvider:void 0,responseStreamActorRef:void 0,shouldDisconnect:!1,faceMatchStateBeforeStart:void 0,isFaceFarEnoughBeforeRecording:void 0,isRecordingStopped:!1},on:{CANCEL:"userCancel",TIMEOUT:{target:"retryableTimeout",actions:"updateErrorStateForTimeout"},SET_SESSION_INFO:{internal:!0,actions:"updateSessionInfo"},DISCONNECT_EVENT:{internal:!0,actions:"updateShouldDisconnect"},SET_DOM_AND_CAMERA_DETAILS:{actions:"setDOMAndCameraDetails"},UPDATE_DEVICE_AND_STREAM:{actions:"updateDeviceAndStream",target:"start"},SERVER_ERROR:{target:"error",actions:"updateErrorStateForServer"},CONNECTION_TIMEOUT:{target:"error",actions:"updateErrorStateForConnectionTimeout"},RUNTIME_ERROR:{target:"error",actions:"updateErrorStateForRuntime"},MOBILE_LANDSCAPE_WARNING:{target:"mobileLandscapeWarning",actions:"updateErrorStateForServer"}},states:{initCamera:{initial:"cameraCheck",on:{SET_DOM_AND_CAMERA_DETAILS:{actions:"setDOMAndCameraDetails",target:"#livenessMachine.initWebsocket"}},states:{cameraCheck:{entry:"resetErrorState",invoke:{src:"checkVirtualCameraAndGetStream",onDone:{target:"waitForDOMAndCameraDetails",actions:"updateVideoMediaStream"},onError:{target:"#livenessMachine.permissionDenied"}}},waitForDOMAndCameraDetails:{}}},initWebsocket:{entry:()=>{},initial:"initializeLivenessStream",states:{initializeLivenessStream:{invoke:{src:"openLivenessStreamConnection",onDone:{target:"waitForSessionInfo",actions:["updateLivenessStreamProvider","spawnResponseStreamActor"]}}},waitForSessionInfo:{entry:()=>{},after:{0:{target:"#livenessMachine.start",cond:"hasParsedSessionInfo"},100:{target:"waitForSessionInfo"}}}}},start:{entry:["initializeFaceDetector",()=>{}],always:[{target:"detectFaceBeforeStart",cond:"shouldSkipStartScreen"}],on:{BEGIN:"detectFaceBeforeStart"}},detectFaceBeforeStart:{invoke:{src:"detectFace",onDone:{target:"checkFaceDetectedBeforeStart",actions:"updateFaceMatchBeforeStartDetails"}}},checkFaceDetectedBeforeStart:{after:{0:{target:"detectFaceDistanceBeforeRecording",cond:"hasSingleFaceBeforeStart"},100:{target:"detectFaceBeforeStart"}}},detectFaceDistanceBeforeRecording:{invoke:{src:"detectFaceDistance",onDone:{target:"checkFaceDistanceBeforeRecording",actions:"updateFaceDistanceBeforeRecording"}}},checkFaceDistanceBeforeRecording:{after:{0:{target:"recording",cond:"hasEnoughFaceDistanceBeforeRecording"},100:{target:"detectFaceDistanceBeforeRecording"}}},recording:{entry:["clearErrorState","startRecording","sendTimeoutAfterOvalDrawingDelay"],initial:"ovalDrawing",states:{ovalDrawing:{invoke:{src:"detectInitialFaceAndDrawOval",onDone:{target:"checkFaceDetected",actions:["updateOvalAndFaceDetailsPostDraw","sendTimeoutAfterOvalMatchDelay"]},onError:{target:"#livenessMachine.error",actions:"updateErrorStateForRuntime"}}},checkFaceDetected:{after:{0:{target:"cancelOvalDrawingTimeout",cond:"hasSingleFace"},100:{target:"ovalDrawing"}}},cancelOvalDrawingTimeout:{entry:["cancelOvalDrawingTimeout","sendTimeoutAfterRecordingDelay"],after:{0:{target:"checkRecordingStarted"}}},checkRecordingStarted:{entry:()=>{},after:{0:{target:"ovalMatching",cond:"hasRecordingStarted",actions:"updateRecordingStartTimestamp"},100:{target:"checkRecordingStarted"}}},ovalMatching:{entry:"cancelRecordingTimeout",invoke:{src:"detectFaceAndMatchOval",onDone:{target:"checkMatch",actions:"updateFaceDetailsPostMatch"}}},checkMatch:{entry:()=>{},after:{0:{target:"handleChallenge",cond:"hasFaceMatchedInOval",actions:["setFaceMatchTimeAndStartFace","updateEndFaceMatch","setColorDisplay","cancelOvalMatchTimeout","cancelOvalDrawingTimeout"]},1:{target:"ovalMatching"}}},handleChallenge:{entry:()=>{},always:[{target:"delayBeforeFlash",cond:"isFaceMovementAndLightChallenge"},{target:"success",cond:"isFaceMovementChallenge"}]},delayBeforeFlash:{entry:()=>{},after:{1e3:"flashFreshnessColors"}},flashFreshnessColors:{invoke:{src:"flashColors",onDone:[{target:"success",cond:"hasFreshnessColorShown"},{target:"flashFreshnessColors",actions:"updateFreshnessDetails"}]}},success:{entry:"stopRecording",type:"final"}},onDone:"uploading"},uploading:{initial:"pending",states:{pending:{entry:["pauseVideoStream"],invoke:{src:"stopVideo",onDone:"waitForDisconnectEvent",onError:{target:"#livenessMachine.error",actions:"updateErrorStateForRuntime"}}},waitForDisconnectEvent:{entry:()=>{},after:{0:{cond:"getShouldDisconnect",target:"getLivenessResult"},100:{target:"waitForDisconnectEvent"}}},getLivenessResult:{entry:["freezeStream"],invoke:{src:"getLiveness",onError:{target:"#livenessMachine.error",actions:"updateErrorStateForServer"}}}}},retryableTimeout:{entry:"updateFailedAttempts",always:[{target:"timeout",cond:"shouldTimeoutOnFailedAttempts"},{target:"start"}]},permissionDenied:{entry:"callUserPermissionDeniedCallback",on:{RETRY_CAMERA_CHECK:"initCamera"}},mobileLandscapeWarning:{entry:"callMobileLandscapeWarningCallback",always:{target:"error"}},timeout:{entry:["cleanUpResources","callUserTimeoutCallback","freezeStream"]},error:{entry:["cleanUpResources","callErrorCallback","cancelOvalDrawingTimeout","cancelOvalMatchTimeout","cancelRecordingTimeout","freezeStream"]},userCancel:{entry:["cleanUpResources","callUserCancelCallback","freezeStream","resetContext"],always:{target:"initCamera"}}}},{actions:{spawnResponseStreamActor:Xt({responseStreamActorRef:()=>RC(yCe)}),updateFailedAttempts:Xt({failedAttempts:e=>e.failedAttempts+1}),updateVideoMediaStream:Xt({videoAssociatedParams:(e,t)=>({...e.videoAssociatedParams,videoMediaStream:t.data?.stream,selectedDeviceId:t.data?.selectedDeviceId,selectableDevices:t.data?.selectableDevices})}),initializeFaceDetector:Xt({ovalAssociatedParams:e=>{let{componentProps:t}=e,{faceModelUrl:r,binaryPath:o}=t.config,n=new jk(o,r);return n.triggerModelLoading(),{...e.ovalAssociatedParams,faceDetector:n}}}),updateLivenessStreamProvider:Xt({livenessStreamProvider:(e,t)=>t.data?.livenessStreamProvider}),setDOMAndCameraDetails:Xt({videoAssociatedParams:(e,t)=>({...e.videoAssociatedParams,videoEl:t.data?.videoEl,canvasEl:t.data?.canvasEl,isMobile:t.data?.isMobile}),freshnessColorAssociatedParams:(e,t)=>({...e.freshnessColorAssociatedParams,freshnessColorEl:t.data?.freshnessColorEl})}),updateDeviceAndStream:Xt({videoAssociatedParams:(e,t)=>(Ure(t.data?.newDeviceId),e.livenessStreamProvider?.setNewVideoStream(t.data?.newStream),{...e.videoAssociatedParams,selectedDeviceId:t.data?.newDeviceId,videoMediaStream:t.data?.newStream})}),updateRecordingStartTimestamp:Xt({videoAssociatedParams:e=>{let{challengeId:t,ovalAssociatedParams:r,videoAssociatedParams:o,livenessStreamProvider:n,parsedSessionInformation:a}=e,{videoMediaStream:i}=o,s=n.getRecordingStartTimestamp();return e.livenessStreamProvider.dispatchStreamEvent({type:"sessionInfo",data:KY({parsedSessionInformation:a,..._R(i),challengeId:t,ovalAssociatedParams:r,recordingStartedTimestamp:s})}),{...e.videoAssociatedParams,recordingStartedTimestamp:s}}}),startRecording:Xt({videoAssociatedParams:e=>(e.livenessStreamProvider&&!e.livenessStreamProvider.isRecording()&&e.livenessStreamProvider.startRecording(),{...e.videoAssociatedParams})}),stopRecording:()=>{},updateFaceMatchBeforeStartDetails:Xt({faceMatchStateBeforeStart:(e,t)=>t.data.faceMatchState}),updateFaceDistanceBeforeRecording:Xt({isFaceFarEnoughBeforeRecording:(e,t)=>!!t.data.isFaceFarEnoughBeforeRecording}),updateFaceDistanceWhileLoading:Xt({isFaceFarEnoughBeforeRecording:(e,t)=>!!t.data.isFaceFarEnoughBeforeRecording,errorState:(e,t)=>t.data?.error}),updateOvalAndFaceDetailsPostDraw:Xt({ovalAssociatedParams:(e,t)=>({...e.ovalAssociatedParams,initialFace:t.data.initialFace,ovalDetails:t.data.ovalDetails,scaleFactor:t.data.scaleFactor}),faceMatchAssociatedParams:(e,t)=>({...e.faceMatchAssociatedParams,faceMatchState:t.data.faceMatchState,illuminationState:t.data.illuminationState})}),updateFaceDetailsPostMatch:Xt({faceMatchAssociatedParams:(e,t)=>({...e.faceMatchAssociatedParams,faceMatchState:t.data.faceMatchState,faceMatchPercentage:t.data.faceMatchPercentage,illuminationState:t.data.illuminationState,currentDetectedFace:t.data.detectedFace})}),updateEndFaceMatch:Xt({faceMatchAssociatedParams:e=>({...e.faceMatchAssociatedParams,endFace:e.faceMatchAssociatedParams.currentDetectedFace})}),setFaceMatchTimeAndStartFace:Xt({faceMatchAssociatedParams:e=>({...e.faceMatchAssociatedParams,startFace:e.faceMatchAssociatedParams.startFace===void 0?e.faceMatchAssociatedParams.currentDetectedFace:e.faceMatchAssociatedParams.startFace})}),resetErrorState:Xt({errorState:e=>{}}),updateErrorStateForConnectionTimeout:Xt({errorState:e=>Wt.CONNECTION_TIMEOUT}),updateErrorStateForTimeout:Xt({errorState:(e,t)=>t.data?.errorState||Wt.TIMEOUT,errorMessage:(e,t)=>t.data?.message}),updateErrorStateForRuntime:Xt({errorState:(e,t)=>t.data?.errorState||Wt.RUNTIME_ERROR}),updateErrorStateForServer:Xt({errorState:e=>Wt.SERVER_ERROR}),clearErrorState:Xt({errorState:e=>{}}),updateSessionInfo:Xt({parsedSessionInformation:(e,t)=>{let{serverSessionInformation:r}=t.data;return UY(r)}}),updateShouldDisconnect:Xt({shouldDisconnect:()=>!0}),updateFreshnessDetails:Xt({freshnessColorAssociatedParams:(e,t)=>({...e.freshnessColorAssociatedParams,freshnessColorsComplete:t.data.freshnessColorsComplete})}),setColorDisplay:Xt({colorSequenceDisplay:({parsedSessionInformation:e})=>new Kk(V8(e))}),sendTimeoutAfterOvalDrawingDelay:ys.send({type:"RUNTIME_ERROR",data:{message:"Client failed to draw oval."}},{delay:5e3,id:"ovalDrawingTimeout"}),cancelOvalDrawingTimeout:ys.cancel("ovalDrawingTimeout"),sendTimeoutAfterRecordingDelay:ys.send({type:"RUNTIME_ERROR",data:{message:"Client failed to start recording."}},{delay:5e3,id:"recordingTimeout"}),cancelRecordingTimeout:ys.cancel("recordingTimeout"),sendTimeoutAfterOvalMatchDelay:ys.send({type:"TIMEOUT",data:{message:"Client timed out waiting for face to match oval."}},{delay:e=>e.parsedSessionInformation.Challenge.ChallengeConfig?.OvalFitTimeout??gCe,id:"ovalMatchTimeout"}),cancelOvalMatchTimeout:ys.cancel("ovalMatchTimeout"),callUserPermissionDeniedCallback:Xt({errorState:(e,t)=>{let r;t.data.message.includes("15 fps")?r=Wt.CAMERA_FRAMERATE_ERROR:t.data.message.includes(Wt.DEFAULT_CAMERA_NOT_FOUND_ERROR)?r=Wt.DEFAULT_CAMERA_NOT_FOUND_ERROR:r=Wt.CAMERA_ACCESS_ERROR;let o=t.data.message||t.data.Message,n=new Error(o),a={state:r,error:n};return e.componentProps.onError?.(a,ux(e)),r}}),callMobileLandscapeWarningCallback:Xt({errorState:()=>Wt.MOBILE_LANDSCAPE_ERROR}),getSelectedDeviceInfo:e=>ux(e),callUserCancelCallback:e=>{let{onUserCancel:t}=e.componentProps??{};if(t)try{t()}catch(r){console.error("Error in onUserCancel callback:",r)}},callUserTimeoutCallback:e=>{let t=new Error(e.errorMessage??"Client Timeout");t.name=e.errorState;let r={state:e.errorState,error:t};e.componentProps.onError?.(r,ux(e))},callErrorCallback:(e,t)=>{let r={state:e.errorState,error:t.data?.error||t.data};e.componentProps.onError?.(r,ux(e))},cleanUpResources:e=>{let{freshnessColorEl:t}=e.freshnessColorAssociatedParams;t&&(t.style.display="none");let r=Pl.DEFAULT_ERROR_CODE;e.errorState===Wt.TIMEOUT?r=Pl.FACE_FIT_TIMEOUT:e.errorState===Wt.RUNTIME_ERROR?r=Pl.RUNTIME_ERROR:e.errorState===Wt.FACE_DISTANCE_ERROR||e.errorState===Wt.MULTIPLE_FACES_ERROR?r=Pl.USER_ERROR_DURING_CONNECTION:e.errorState===void 0&&(r=Pl.USER_CANCEL),e.livenessStreamProvider?.stopRecording().then(()=>{e.livenessStreamProvider?.dispatchStreamEvent({type:"closeCode",data:{closeCode:r}})})},freezeStream:e=>{let{videoMediaStream:t,videoEl:r}=e.videoAssociatedParams;e.isRecordingStopped=!0,r?.pause(),t?.getTracks().forEach(function(o){o.stop()})},pauseVideoStream:e=>{let{videoEl:t}=e.videoAssociatedParams;e.isRecordingStopped=!0,t.pause()},resetContext:Xt({challengeId:zd(),maxFailedAttempts:0,failedAttempts:0,componentProps:e=>e.componentProps,parsedSessionInformation:e=>{},videoAssociatedParams:e=>({videoConstraints:Pg}),ovalAssociatedParams:e=>{},errorState:e=>{},livenessStreamProvider:e=>{},responseStreamActorRef:e=>{},shouldDisconnect:!1,faceMatchStateBeforeStart:e=>{},isFaceFarEnoughBeforeRecording:e=>{},isRecordingStopped:!1})},guards:{shouldTimeoutOnFailedAttempts:e=>e.failedAttempts>=e.maxFailedAttempts,hasFaceMatchedInOval:e=>e.faceMatchAssociatedParams.faceMatchState===It.MATCHED,hasSingleFace:e=>e.faceMatchAssociatedParams.faceMatchState===It.FACE_IDENTIFIED,hasSingleFaceBeforeStart:e=>e.faceMatchStateBeforeStart===It.FACE_IDENTIFIED,hasEnoughFaceDistanceBeforeRecording:e=>e.isFaceFarEnoughBeforeRecording,hasNotEnoughFaceDistanceBeforeRecording:e=>!e.isFaceFarEnoughBeforeRecording,hasFreshnessColorShown:e=>e.freshnessColorAssociatedParams.freshnessColorsComplete,hasParsedSessionInfo:e=>e.parsedSessionInformation!==void 0,hasDOMAndCameraDetails:e=>e.videoAssociatedParams.videoEl!==void 0&&e.videoAssociatedParams.canvasEl!==void 0&&e.freshnessColorAssociatedParams.freshnessColorEl!==void 0,isFaceMovementChallenge:e=>e.parsedSessionInformation?.Challenge?.Name===hp.type,isFaceMovementAndLightChallenge:e=>e.parsedSessionInformation?.Challenge?.Name===qv.type,getShouldDisconnect:e=>!!e.shouldDisconnect,hasRecordingStarted:e=>e.livenessStreamProvider.hasRecordingStarted(),shouldSkipStartScreen:e=>!!e.componentProps?.disableStartScreen},services:{async checkVirtualCameraAndGetStream(e){let{videoConstraints:t}=e.videoAssociatedParams,{componentProps:r}=e,o,n=!1;r?.config?.deviceId?o=r.config.deviceId:o=vCe()??void 0;let a=await navigator.mediaDevices.getUserMedia({video:{...t,...o?{deviceId:{exact:o}}:{}},audio:!1}).catch(d=>{if(d instanceof DOMException&&(d.name==="NotFoundError"||d.name==="OverconstrainedError"))return o&&!n&&(n=!0),navigator.mediaDevices.getUserMedia({video:{...t},audio:!1});throw d}),s=(await navigator.mediaDevices.enumerateDevices()).filter(d=>d.kind==="videoinput").filter(d=>!W8(d));if(!s.length)throw new Error("No real video devices found");let c=a.getTracks().filter(d=>(d.getSettings().frameRate??0)>=15);if(c.length<1)throw new Error("No camera found with more than 15 fps");let l=c[0].getSettings().deviceId,p=s.some(d=>d.deviceId===l),u=p?l:s[0].deviceId,m=a;p||(m=await navigator.mediaDevices.getUserMedia({video:{...t,deviceId:{exact:u}},audio:!1})),Ure(u);let f={stream:m,selectedDeviceId:l,selectableDevices:s};if(n)throw new Error(Wt.DEFAULT_CAMERA_NOT_FOUND_ERROR);return f},async openLivenessStreamConnection(e){let{config:t,disableStartScreen:r}=e.componentProps,{credentialProvider:o,endpointOverride:n,systemClockOffset:a}=t,{videoHeight:i,videoWidth:s}=e.videoAssociatedParams.videoEl,c=new z2(e.videoAssociatedParams.videoMediaStream),l=YY(c.getVideoStream()).getRequestStream(),{getResponseStream:p}=await Cre({credentialsProvider:o,endpointOverride:n,region:e.componentProps.region,attemptCount:Mg.getAttemptCountAndUpdateTimestamp(),preCheckViewEnabled:!r,systemClockOffset:a});return Hre=p({requestStream:l,sessionId:e.componentProps.sessionId,videoHeight:i.toString(),videoWidth:s.toString()}),{livenessStreamProvider:c}},async detectFace(e){let{videoEl:t}=e.videoAssociatedParams,{faceDetector:r}=e.ovalAssociatedParams;try{await r.modelLoadingPromise}catch(n){console.log({err:n})}return{faceMatchState:await j8(r,t)}},async detectFaceDistance(e){let{parsedSessionInformation:t,isFaceFarEnoughBeforeRecording:r}=e,{videoEl:o,videoMediaStream:n}=e.videoAssociatedParams,{faceDetector:a}=e.ovalAssociatedParams,{width:i,height:s}=n.getTracks()[0].getSettings(),c=t.Challenge.ChallengeConfig,l=r3({width:i,height:s,ovalHeightWidthRatio:c.OvalHeightWidthRatio}),{isDistanceBelowThreshold:p}=await G8({parsedSessionInformation:t,faceDetector:a,videoEl:o,ovalDetails:l,reduceThreshold:r});return{isFaceFarEnoughBeforeRecording:p}},async detectInitialFaceAndDrawOval(e){let{parsedSessionInformation:t}=e,{videoEl:r,canvasEl:o,isMobile:n}=e.videoAssociatedParams,{faceDetector:a}=e.ovalAssociatedParams;try{await a.modelLoadingPromise}catch(y){console.log({err:y})}let i=await a.detectFaces(r),s,c,l;switch(i.length){case 0:{c=It.CANT_IDENTIFY,l=a3(r);break}case 1:{c=It.FACE_IDENTIFIED,s=i[0];break}default:{c=It.TOO_MANY;break}}if(!s)return{faceMatchState:c,illuminationState:l};let{width:p,height:u}=r.getBoundingClientRect();n?(o.width=window.innerWidth,o.height=window.innerHeight):(o.width=p,o.height=u);let m=p/r.videoWidth,f=L8({parsedSessionInformation:t,videoWidth:r.width}),d=t.Challenge.ChallengeConfig,h=Kv({ovalHeightWidthRatio:d.OvalHeightWidthRatio,face:s,oval:f,frameHeight:r.videoHeight});return s.top=h.top,s.left=h.left,s.height=h.bottom-h.top,s.width=h.right-h.left,o3({canvas:o,oval:f,scaleFactor:m,videoEl:r}),{faceMatchState:c,ovalDetails:f,scaleFactor:m,initialFace:s}},async detectFaceAndMatchOval(e){let{parsedSessionInformation:t}=e,{videoEl:r}=e.videoAssociatedParams,{faceDetector:o,ovalDetails:n,initialFace:a}=e.ovalAssociatedParams,i=await o.detectFaces(r),s,c=0,l,p,u=t.Challenge.ChallengeConfig,m=Kv({ovalHeightWidthRatio:u.OvalHeightWidthRatio,face:a,oval:n,frameHeight:r.videoHeight}),{ovalBoundingBox:f}=b1(n),d=x1(m,f);switch(i.length){case 0:{s=It.CANT_IDENTIFY,p=a3(r);break}case 1:{l=i[0];let{faceMatchState:h,faceMatchPercentage:y}=PY({face:l,ovalDetails:n,initialFaceIntersection:d,parsedSessionInformation:t,frameHeight:r.videoHeight});s=h,c=y;break}default:{s=It.TOO_MANY;break}}return{faceMatchState:s,faceMatchPercentage:c,illuminationState:p,detectedFace:l}},async flashColors({challengeId:e,colorSequenceDisplay:t,freshnessColorAssociatedParams:r,livenessStreamProvider:o,ovalAssociatedParams:n,videoAssociatedParams:a}){let{freshnessColorsComplete:i,freshnessColorEl:s}=r;if(i)return;let{ovalDetails:c,scaleFactor:l}=n,{videoEl:p}=a;return{freshnessColorsComplete:await t.startSequences({onSequenceColorChange:({sequenceColor:m,prevSequenceColor:f,heightFraction:d})=>{H8({heightFraction:d,overlayCanvas:s,ovalDetails:c,nextColor:m,prevColor:f,scaleFactor:l,videoEl:p})},onSequenceStart:()=>{s.style.display="block"},onSequencesComplete:()=>{s.style.display="none"},onSequenceChange:m=>{o.dispatchStreamEvent({type:"sessionInfo",data:XY({...m,challengeId:e})})}})}},async stopVideo(e){let{challengeId:t,parsedSessionInformation:r,faceMatchAssociatedParams:o,ovalAssociatedParams:n,livenessStreamProvider:a,videoAssociatedParams:i}=e,{videoMediaStream:s}=i;if(await a.stopRecording(),a.getChunksLength()===0)throw new Error("Video chunks not recorded successfully.");a.dispatchStreamEvent({type:"sessionInfo",data:qY({..._R(s),parsedSessionInformation:r,challengeId:t,faceMatchAssociatedParams:o,ovalAssociatedParams:n,recordingEndedTimestamp:a.getRecordingEndedTimestamp()})}),a.dispatchStreamEvent({type:"streamStop"})},async getLiveness(e){let{onAnalysisComplete:t}=e.componentProps??{};if(t)try{let r=ux(e);await t(r)}catch(r){throw console.error("Error in onAnalysisComplete callback:",r),r}}}});var $2=Ie(Me(),1),jre=$2.default.createContext(null);function Gre({children:e,...t}){return $2.default.createElement(jre.Provider,{value:t},e)}function L2(){let e=$2.default.useContext(jre);if(e===null)throw new Error("useFaceLivenessDetector must be used within a FaceLivenessDetectorProvider");return e}var oa=Ie(Me(),1);var nt=Ie(Me(),1);var HD=()=>{let{breakpoints:{values:e,defaultBreakpoint:t}}=mp();return t1({breakpoints:e,defaultBreakpoint:t})};function kc(){let{service:e}=L2();return zC(e)}function po(e){let{service:t}=L2();return $C(t,e)}var of=Ie(Me(),1);function qre(e){let t=Pg.height.ideal,r=Pg.width.ideal,o=(0,of.useRef)(null),[n,a]=(0,of.useState)(t),[i,s]=(0,of.useState)(r);return(0,of.useEffect)(()=>{if(e){Gn(o.current)&&(o.current.srcObject=e);let c=e.getTracks()?.[0]?.getSettings();c&&(a(c.height),s(c.width))}return()=>{e&&e.getTracks().forEach(c=>{e.removeTrack(c),c.stop()})}},[e]),{videoRef:o,videoHeight:n,videoWidth:i}}var Pe;(function(e){e.CameraModule="amplify-liveness-camera-module",e.CancelContainer="amplify-liveness-cancel-container",e.CancelButton="amplify-liveness-cancel-button",e.CenteredLoader="amplify-liveness-centered-loader",e.ConnectingLoader="amplify-liveness-connecting-loader",e.CountdownContainer="amplify-liveness-countdown-container",e.DescriptionBullet="amplify-liveness-description-bullet",e.DescriptionBulletIndex="amplify-liveness-description-bullet__index",e.DescriptionBulletIndexText="amplify-liveness-description-bullet__index__text",e.DescriptionBulletMessage="amplify-liveness-description-bullet__message",e.ErrorModal="amplify-liveness-error-modal",e.ErrorModalHeading="amplify-liveness-error-modal__heading",e.FadeOut="amplify-liveness-fade-out",e.FreshnessCanvas="amplify-liveness-freshness-canvas",e.InstructionList="amplify-liveness-instruction-list",e.InstructionOverlay="amplify-liveness-instruction-overlay",e.Hint="amplify-liveness-hint",e.HintText="amplify-liveness-hint__text",e.LandscapeErrorModal="amplify-liveness-landscape-error-modal",e.LandscapeErrorModalButton="amplify-liveness-landscape-error-modal__button",e.LandscapeErrorModalHeader="amplify-liveness-landscape-error-modal__header",e.Loader="amplify-liveness-loader",e.MatchIndicator="amplify-liveness-match-indicator",e.OvalCanvas="amplify-liveness-oval-canvas",e.OpaqueOverlay="amplify-liveness-overlay-opaque",e.Overlay="amplify-liveness-overlay",e.Popover="amplify-liveness-popover",e.PopoverContainer="amplify-liveness-popover__container",e.PopoverAnchor="amplify-liveness-popover__anchor",e.PopoverAnchorSecondary="amplify-liveness-popover__anchor-secondary",e.RecordingIconContainer="amplify-liveness-recording-icon-container",e.RecordingIcon="amplify-liveness-recording-icon",e.StartScreenCameraSelect="amplify-liveness-start-screen-camera-select",e.StartScreenCameraSelectContainer="amplify-liveness-start-screen-camera-select__container",e.StartScreenCameraWaiting="amplify-liveness-start-screen-camera-waiting",e.StartScreenHeader="amplify-liveness-start-screen-header",e.StartScreenHeaderBody="amplify-liveness-start-screen-header__body",e.StartScreenHeaderHeading="amplify-liveness-start-screen-header__heading",e.StartScreenWarning="amplify-liveness-start-screen-warning",e.StartScreenInstructions="amplify-liveness-start-screen-instructions",e.StartScreenInstructionsHeading="amplify-liveness-start-screen-instructions__heading",e.Toast="amplify-liveness-toast",e.ToastContainer="amplify-liveness-toast__container",e.ToastMessage="amplify-liveness-toast__message",e.UserFacingVideo="amplify-liveness-video--user-facing",e.Video="amplify-liveness-video",e.VideoAnchor="amplify-liveness-video-anchor"})(Pe||(Pe={}));var eo=Ie(Me(),1);var B2=Ie(Me(),1);var nf=({variation:e="default",size:t="medium",children:r,isInitial:o=!1,...n})=>{let{tokens:a}=mp();return B2.createElement(Ue,{className:`${Pe.Toast} ${Pe.Toast}--${e} ${Pe.Toast}--${t}`,...o&&{backgroundColor:a.colors.background.primary},...n},B2.createElement(rt,{className:Pe.ToastContainer},B2.createElement(rt,{className:Pe.ToastMessage,...o?{color:a.colors.font.primary}:{}},r)))};var mx=Ie(Me(),1);var Kre=({displayText:e})=>mx.createElement(nf,{"aria-live":"polite"},mx.createElement(rt,{className:Pe.HintText},mx.createElement(ks,null),mx.createElement(Ue,null,e)));var fx=e=>e.context.errorState,bCe=e=>e.context.faceMatchAssociatedParams.faceMatchState,xCe=e=>e.context.faceMatchAssociatedParams.illuminationState,wCe=e=>e.context.isFaceFarEnoughBeforeRecording,SCe=e=>e.context.faceMatchStateBeforeStart,kCe=e=>e.context.faceMatchAssociatedParams?.faceMatchPercentage,zg=({text:e,isInitial:t=!1})=>eo.createElement(nf,{size:"large",variation:"primary",isInitial:t},eo.createElement(Ue,{"aria-live":"assertive"},e)),Yre=({hintDisplayText:e})=>{let[t]=kc(),r=po(fx),o=po(bCe),n=po(xCe),a=po(SCe),i=po(wCe),s=po(kCe),c=t.matches("checkFaceDetectedBeforeStart")||t.matches("detectFaceBeforeStart"),l=t.matches("checkFaceDistanceBeforeRecording")||t.matches("detectFaceDistanceBeforeRecording"),p=t.matches("start")||t.matches("userCancel"),u=t.matches("recording"),m=t.matches("uploading"),f=t.matches("checkSucceeded"),d=t.matches("checkFailed"),h=t.matches({recording:"flashFreshnessColors"}),y={[It.CANT_IDENTIFY]:e.hintCanNotIdentifyText,[It.FACE_IDENTIFIED]:e.hintTooFarText,[It.TOO_MANY]:e.hintTooManyFacesText,[It.TOO_FAR]:e.hintTooFarText,[It.MATCHED]:e.hintHoldFaceForFreshnessText,[It.OFF_CENTER]:e.hintFaceOffCenterText},g={[ti.BRIGHT]:e.hintIlluminationTooBrightText,[ti.DARK]:e.hintIlluminationTooDarkText,[ti.NORMAL]:e.hintIlluminationNormalText};if(p)return eo.createElement(eo.Fragment,null,eo.createElement(Gd,{role:"alert"},e.hintCenterFaceInstructionText),eo.createElement(zg,{text:e.hintCenterFaceText,isInitial:!0}));if(r??(d||f))return null;if(!u){if(c)return a===It.TOO_MANY?eo.createElement(zg,{text:e.hintTooManyFacesText}):eo.createElement(zg,{text:e.hintMoveFaceFrontOfCameraText});if(l&&i===!1)return eo.createElement(zg,{text:e.hintTooCloseText});if(m)return eo.createElement(eo.Fragment,null,eo.createElement(Gd,{"aria-live":"assertive"},e.hintCheckCompleteText),eo.createElement(Kre,{displayText:e.hintVerifyingText}));if(n&&n!==ti.NORMAL)return eo.createElement(zg,{text:g[n]})}if(h)return eo.createElement(zg,{text:e.hintHoldFaceForFreshnessText});if(u&&!h){let b=y[It.TOO_FAR];o===It.MATCHED&&(b=y[o]);let x=b;return o===It.OFF_CENTER?x=y[o]:o===It.TOO_FAR&&s>50&&(x=e.hintMatchIndicatorText),eo.createElement(nf,{size:"large",variation:"primary"},eo.createElement(Gd,{"aria-live":"assertive"},x),eo.createElement(Ue,{"aria-label":x},b))}return null};var dx=Ie(Me(),1);var Qre=({percentage:e,initialPercentage:t=25,testId:r})=>{let[o,n]=dx.default.useState(t);dx.default.useEffect(()=>{e<0?n(0):e>100?n(100):n(e)},[e]);let a={"--percentage":`${o}%`};return dx.default.createElement("div",{className:Pe.MatchIndicator,"data-testid":r},dx.default.createElement("div",{className:`${Pe.MatchIndicator}__bar`,style:a,role:"progressbar","aria-label":"MatchIndicator","aria-valuenow":e,"aria-valuetext":`${e}% face fit`}))};var Jre=Ie(Me(),1);var U2=({children:e,horizontal:t="center",vertical:r="center",className:o,...n})=>Jre.createElement(rt,{className:`${Pe.Overlay} ${o}`,alignItems:t,justifyContent:r,...n},e);function _Ce(){return/Macintosh/i.test(navigator.userAgent)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>1}function Zre(){return/Android|iPhone|iPad/i.test(navigator.userAgent)||_Ce()}async function eoe(e){let r=(await navigator.mediaDevices?.enumerateDevices())?.find(o=>o.deviceId===e&&o.kind==="videoinput");return r?!r.label.toLowerCase().includes("back"):!0}function W2(){return window.matchMedia("(orientation: landscape)")}var ui=Ie(Me(),1);var $g={errorLabelText:"Error",connectionTimeoutHeaderText:"Connection time out",connectionTimeoutMessageText:"Connection has timed out.",timeoutHeaderText:"Time out",timeoutMessageText:"Face didn't fit inside oval in time limit. Try again and completely fill the oval with face in it.",faceDistanceHeaderText:"Forward movement detected",faceDistanceMessageText:"Avoid moving closer when connecting.",multipleFacesHeaderText:"Multiple faces detected",multipleFacesMessageText:"Ensure only one face is present in front of the camera when connecting.",clientHeaderText:"Client error",clientMessageText:"Check failed due to client issue",serverHeaderText:"Server issue",serverMessageText:"Cannot complete check due to server issue",landscapeHeaderText:"Landscape orientation not supported",landscapeMessageText:"Rotate your device to portrait (vertical) orientation.",portraitMessageText:"Ensure your device remains in portrait (vertical) orientation for the check\u2019s duration.",tryAgainText:"Try again"},hx={cameraMinSpecificationsHeadingText:"Camera does not meet minimum specifications",cameraMinSpecificationsMessageText:"Camera must support at least 320*240 resolution and 15 frames per second.",cameraNotFoundHeadingText:"Camera is not accessible.",cameraNotFoundMessageText:"Check that a camera is connected and there is not another application using the camera. You may have to go into settings to grant camera permissions and close out all instances of your browser and retry.",a11yVideoLabelText:"Webcam for liveness check",cancelLivenessCheckText:"Cancel Liveness check",goodFitCaptionText:"Good fit",goodFitAltText:"Ilustration of a person's face, perfectly fitting inside of an oval.",hintCenterFaceText:"Center your face",hintCenterFaceInstructionText:"Instruction: Before starting the check, make sure your camera is at the center top of your screen and center your face to the camera. When the check starts an oval will show up in the center. You will be prompted to move forward into the oval and then prompted to hold still. After holding still for a few seconds, you should hear check complete.",hintFaceOffCenterText:"Face is not in the oval, center your face to the camera.",hintMoveFaceFrontOfCameraText:"Move face in front of camera",hintTooManyFacesText:"Ensure only one face is in front of camera",hintFaceDetectedText:"Face detected",hintCanNotIdentifyText:"Move face in front of camera",hintTooCloseText:"Move back",hintTooFarText:"Move closer",hintConnectingText:"Connecting...",hintVerifyingText:"Verifying...",hintCheckCompleteText:"Check complete",hintIlluminationTooBrightText:"Move to dimmer area",hintIlluminationTooDarkText:"Move to brighter area",hintIlluminationNormalText:"Lighting conditions normal",hintHoldFaceForFreshnessText:"Hold still",hintMatchIndicatorText:"50% completed. Keep moving closer.",photosensitivityWarningBodyText:"This check flashes different colors. Use caution if you are photosensitive.",photosensitivityWarningHeadingText:"Photosensitivity warning",photosensitivityWarningInfoText:"Some people may experience epileptic seizures when exposed to colored lights. Use caution if you, or anyone in your family, have an epileptic condition.",photosensitivityWarningLabelText:"More information about photosensitivity",photosensitivyWarningBodyText:"This check flashes different colors. Use caution if you are photosensitive.",photosensitivyWarningHeadingText:"Photosensitivity warning",photosensitivyWarningInfoText:"Some people may experience epileptic seizures when exposed to colored lights. Use caution if you, or anyone in your family, have an epileptic condition.",photosensitivyWarningLabelText:"More information about photosensitivity",retryCameraPermissionsText:"Retry",recordingIndicatorText:"Rec",startScreenBeginCheckText:"Start video check",tooFarCaptionText:"Too far",tooFarAltText:"Illustration of a person's face inside of an oval; there is a gap between the perimeter of the face and the boundaries of the oval.",waitingCameraPermissionText:"Waiting for you to allow camera permission.",...$g};var ECe=e=>{let{error:t,displayText:r}=e,{connectionTimeoutHeaderText:o,connectionTimeoutMessageText:n,errorLabelText:a,timeoutHeaderText:i,timeoutMessageText:s,faceDistanceHeaderText:c,faceDistanceMessageText:l,multipleFacesHeaderText:p,multipleFacesMessageText:u,clientHeaderText:m,clientMessageText:f,serverHeaderText:d,serverMessageText:h}=r,y,g;switch(t){case Wt.CONNECTION_TIMEOUT:y=o,g=n;break;case Wt.TIMEOUT:y=i,g=s;break;case Wt.FACE_DISTANCE_ERROR:y=c,g=l;break;case Wt.MULTIPLE_FACES_ERROR:y=p,g=u;break;case Wt.RUNTIME_ERROR:y=m,g=f;break;case Wt.SERVER_ERROR:default:y=d,g=h}return ui.default.createElement(ui.default.Fragment,null,ui.default.createElement(rt,{className:Pe.ErrorModal},ui.default.createElement(Vd,{ariaLabel:a,role:"img",variation:"error"}),ui.default.createElement(Qr,{className:Pe.ErrorModalHeading,id:"amplify-liveness-error-heading"},y)),ui.default.createElement(Qr,{id:"amplify-liveness-error-message"},g))},toe=({errorState:e,overrideErrorDisplayText:t})=>{let r={...$g,...t};return e===Wt.CAMERA_ACCESS_ERROR||e===Wt.CAMERA_FRAMERATE_ERROR||e===Wt.MOBILE_LANDSCAPE_ERROR?null:ECe({error:e,displayText:r})},roe=e=>{let{children:t,onRetry:r,displayText:o}=e,n={...$g,...o},{tryAgainText:a}=n;return ui.default.createElement(U2,{className:Pe.OpaqueOverlay},ui.default.createElement(nf,{"aria-labelledby":"amplify-liveness-error-heading","aria-describedby":"amplify-liveness-error-message",role:"alertdialog"},t,ui.default.createElement(rt,{justifyContent:"center"},ui.default.createElement(In,{variation:"primary",type:"button",onClick:r},a))))};var Yi=Ie(Me(),1);var VD=Ie(Me(),1);var H2=({ariaLabel:e})=>{let[t,r]=kc(),o=t.done,n=()=>{r({type:"CANCEL"})};return o?null:VD.default.createElement(In,{autoFocus:!0,variation:"link",onClick:n,size:"large",className:Pe.CancelButton,"aria-label":e},VD.default.createElement(GN,{"aria-hidden":"true","data-testid":"close-icon"}))};var Lg=Ie(Me(),1);var ooe=({children:e})=>Lg.default.createElement(rt,{className:Pe.RecordingIcon},Lg.default.createElement(rt,{"data-testid":"rec-icon",justifyContent:"center"},Lg.default.createElement(o1,{viewBox:{width:20,height:20},width:"20",height:"20"},Lg.default.createElement("circle",{cx:"10",cy:"10",r:"8",fill:"red"}))),Lg.default.createElement(Qr,{as:"span",fontWeight:"bold"},e));var Ko=Ie(Me(),1);var jD=({children:e,headingText:t,labelText:r})=>{let o=HD(),[n,a]=Ko.useState(!1),i=Ko.useRef(null),s=o==="base";return Ko.useEffect(()=>{function c(l){n&&i.current&&!i.current.contains(l.target)&&a(!1)}return document.addEventListener("mousedown",c),()=>{document.removeEventListener("mousedown",c)}},[i,n]),Ko.createElement("div",{className:Pe.Popover,ref:i},Ko.createElement(In,{"aria-controls":"photosensitivity-description","aria-expanded":n,role:"alertdialog","aria-label":r,"aria-describedby":"photosensitivity-description",colorTheme:"info",id:"popover-button",onClick:()=>a(!n),testId:"popover-icon"},Ko.createElement(Vd,{ariaHidden:!0,variation:"info"})),n&&Ko.createElement(Ko.Fragment,null,Ko.createElement(rt,{className:Pe.PopoverAnchor}),Ko.createElement(rt,{className:Pe.PopoverAnchorSecondary}),Ko.createElement(rt,{"aria-hidden":!n,"aria-label":t,className:Pe.PopoverContainer,"data-testid":"popover-text",id:"photosensitivity-description",left:s?-190:-108,role:"alertdialog"},e)))};jD.displayName="LivenessIconWithPopover";var noe=({bodyText:e,headingText:t,infoText:r,labelText:o})=>Yi.default.createElement(rt,{className:`${_e.Alert} ${Pe.StartScreenWarning}`,style:{zIndex:"3"}},Yi.default.createElement(Ue,{flex:"1"},Yi.default.createElement(Ue,{className:_e.AlertHeading},t),Yi.default.createElement(Ue,{className:_e.AlertBody},e)),Yi.default.createElement(jD,{labelText:o,headingText:t},r)),aoe=({recordingIndicatorText:e})=>Yi.default.createElement(Ue,{className:Pe.RecordingIconContainer},Yi.default.createElement(ooe,null,e)),ioe=({cancelLivenessCheckText:e})=>Yi.default.createElement(Ue,{className:Pe.CancelContainer},Yi.default.createElement(H2,{ariaLabel:e}));var Bg=Ie(Me(),1);var soe=e=>{let{onSelect:t,devices:r,deviceId:o}=e;return Bg.default.createElement(rt,{className:Pe.StartScreenCameraSelect},Bg.default.createElement(Ue,{className:Pe.StartScreenCameraSelectContainer},Bg.default.createElement(jd,{htmlFor:"amplify-liveness-camera-select",className:`${Pe.StartScreenCameraSelect}__label`},"Camera:"),Bg.default.createElement(v1,{id:"amplify-liveness-camera-select",testId:"amplify-liveness-camera-select",label:"Camera",labelHidden:!0,value:o,onChange:t},r.map(n=>Bg.default.createElement("option",{value:n.deviceId,key:n.deviceId},n.label)))))};var ICe=e=>e.context.parsedSessionInformation?.Challenge?.Name,TCe=e=>e.context.videoAssociatedParams?.videoConstraints,CCe=e=>e.context.videoAssociatedParams?.videoMediaStream,NCe=e=>e.context.faceMatchAssociatedParams?.faceMatchPercentage,ACe=e=>e.context.faceMatchAssociatedParams?.faceMatchState,RCe=e=>e.context.videoAssociatedParams?.selectedDeviceId,DCe=e=>e.context.videoAssociatedParams?.selectableDevices,FCe=[It.TOO_FAR,It.CANT_IDENTIFY,It.FACE_IDENTIFIED,It.OFF_CENTER],MCe=nt.default.memo(Qre),loe=e=>{let{isMobileScreen:t,isRecordingStopped:r,instructionDisplayText:o,streamDisplayText:n,hintDisplayText:a,errorDisplayText:i,cameraDisplayText:s,components:c,testId:l}=e,{cancelLivenessCheckText:p,recordingIndicatorText:u}=n,{ErrorView:m=roe,PhotosensitiveWarning:f=noe}=c??{},[d,h]=kc(),y=po(ICe)===hp.type,g=po(CCe),b=po(TCe),x=po(RCe),w=po(DCe),I=po(NCe),C=po(ACe),R=po(fx),P=UN(),{videoRef:z,videoWidth:$,videoHeight:B}=qre(g),V=(0,nt.useRef)(null),H=(0,nt.useRef)(null),[G,X]=(0,nt.useState)(!1),[ee,Z]=(0,nt.useState)(!1),[te,re]=(0,nt.useState)(!0),se=d.matches("initCamera"),ae=d.matches("initWebsocket"),pe=d.matches({initCamera:"cameraCheck"}),ie=d.matches({initCamera:"waitForDOMAndCameraDetails"}),Y=d.matches("start")||d.matches("userCancel"),le=d.matches("detectFaceBeforeStart"),ge=d.matches("recording"),ve=d.matches("checkSucceeded"),Ee=d.matches({recording:"flashFreshnessColors"}),[Se,Ve]=(0,nt.useState)($),[Ge,Ye]=(0,nt.useState)(B),[Ze,Je]=(0,nt.useState)(()=>$&&B?$/B:0),yt=!!w?.length&&w.length>1,lt=Y&&yt&&(!t||y);nt.default.useEffect(()=>{async function Qt(){let Ht=await eoe(x);re(Ht)}Qt()},[x]),nt.default.useEffect(()=>{let Qt=V?.current&&z?.current&&g&&Y&&ee;Qt&&n3(V.current,z.current,g);let Ht=Br=>{Br.matches&&Qt&&n3(V.current,z.current,g)},_r=window.matchMedia("(prefers-color-scheme: dark)"),br=window.matchMedia("(prefers-color-scheme: light)");return _r.addEventListener("change",Ht),br.addEventListener("change",Ht),()=>{_r.removeEventListener("change",Ht),br.addEventListener("change",Ht)}},[z,g,P,Y,ee]),nt.default.useLayoutEffect(()=>{G&&h({type:"SET_DOM_AND_CAMERA_DETAILS",data:{videoEl:z.current,canvasEl:V.current,freshnessColorEl:H.current,isMobile:t}}),z.current&&(Ve(z.current.videoWidth),Ye(z.current.videoHeight),Je(z.current.videoWidth/z.current.videoHeight))},[h,z,G,t]),nt.default.useEffect(()=>{le&&B8({canvas:V.current})},[le]);let Nt=nt.default.useMemo(()=>nt.default.createElement(Ue,{style:{visibility:Y?"visible":"hidden"}},nt.default.createElement(f,{bodyText:o.photosensitivityWarningBodyText,headingText:o.photosensitivityWarningHeadingText,infoText:o.photosensitivityWarningInfoText,labelText:o.photosensitivityWarningLabelText})),[f,o,Y]),St=()=>{X(!0)},zt=()=>{Z(!0)},Lt=nt.default.useCallback(()=>{h({type:"BEGIN"})},[h]),Kr=nt.default.useCallback(Qt=>{let Ht=Qt.target.value;(async()=>{Z(!1);let br=await navigator.mediaDevices.getUserMedia({video:{...b,deviceId:{exact:Ht}},audio:!1});h({type:"UPDATE_DEVICE_AND_STREAM",data:{newDeviceId:Ht,newStream:br}})})()},[b,h]);if(pe)return nt.default.createElement(rt,{justifyContent:"center",className:Pe.StartScreenCameraWaiting},nt.default.createElement(ks,{size:"large",className:Pe.CenteredLoader,"data-testid":"centered-loader",position:"unset"}),nt.default.createElement(Qr,{fontSize:"large",fontWeight:"bold","data-testid":"waiting-camera-permission",className:`${Pe.StartScreenCameraWaiting}__text`},s.waitingCameraPermissionText));let tr=se||ae,xt=t&&!Y&&!tr;return nt.default.createElement(nt.default.Fragment,null,!y&&Nt,tr&&nt.default.createElement(rt,{className:Pe.ConnectingLoader},nt.default.createElement(ks,{size:"large",className:Pe.Loader,"data-testid":"centered-loader"}),nt.default.createElement(Qr,{className:Pe.LandscapeErrorModalHeader},a.hintConnectingText)),nt.default.createElement(rt,{className:ct(Pe.CameraModule,xt&&`${Pe.CameraModule}--mobile`),"data-testid":l,gap:"zero"},nt.default.createElement(U2,{horizontal:"center",vertical:ge&&!Ee?"start":"space-between",className:Pe.InstructionOverlay},ge&&nt.default.createElement(aoe,{recordingIndicatorText:u}),!Y&&!ie&&!ve&&nt.default.createElement(ioe,{cancelLivenessCheckText:p}),nt.default.createElement(rt,{className:ct(Pe.Hint,xt&&`${Pe.Hint}--mobile`)},nt.default.createElement(Yre,{hintDisplayText:a})),R&&nt.default.createElement(m,{onRetry:()=>{h({type:"CANCEL"})},displayText:i},toe({errorState:R,overrideErrorDisplayText:i})),ge&&!Ee&&FCe.includes(C)?nt.default.createElement(MCe,{percentage:Math.ceil(I)}):null),nt.default.createElement(Ue,{as:"canvas",ref:H,className:Pe.FreshnessCanvas,hidden:!0}),nt.default.createElement(Ue,{className:Pe.VideoAnchor,style:{aspectRatio:`${Ze}`}},nt.default.createElement("video",{ref:z,muted:!0,autoPlay:!0,playsInline:!0,width:Se,height:Ge,onCanPlay:St,onLoadedMetadata:zt,"data-testid":"video",className:ct(Pe.Video,te&&Pe.UserFacingVideo,r&&Pe.FadeOut),"aria-label":s.a11yVideoLabelText}),nt.default.createElement(rt,{className:ct(Pe.OvalCanvas,xt&&`${Pe.OvalCanvas}--mobile`,r&&Pe.FadeOut)},nt.default.createElement(Ue,{as:"canvas",ref:V})),lt?nt.default.createElement(soe,{onSelect:Kr,devices:w,deviceId:x}):null)),Y&&nt.default.createElement(rt,{justifyContent:"center"},nt.default.createElement(In,{variation:"primary",type:"button",onClick:Lt},o.startScreenBeginCheckText)))};var Qi=Ie(Me(),1);var coe=e=>{let{onRetry:t,header:r,portraitMessage:o,landscapeMessage:n,tryAgainText:a}=e,[i,s]=Qi.useState(!0);return Qi.useLayoutEffect(()=>{let c=W2();return s(c.matches),c.addEventListener("change",l=>{s(l.matches)}),()=>{c.removeEventListener("change",l=>s(l.matches))}},[]),Qi.createElement(rt,{className:Pe.LandscapeErrorModal,height:i?"auto":480},Qi.createElement(Qr,{className:Pe.LandscapeErrorModalHeader},r),Qi.createElement(Qr,null,i?n:o),i?null:Qi.createElement(rt,{className:Pe.LandscapeErrorModalButton},Qi.createElement(In,{variation:"primary",type:"button",onClick:t},a)))};var poe="liveness-detector-check",OCe=420,PCe=e=>e.context.isRecordingStopped,uoe=({instructionDisplayText:e,hintDisplayText:t,cameraDisplayText:r,streamDisplayText:o,errorDisplayText:n,components:a})=>{let[i,s]=kc(),c=po(fx),l=po(PCe),p=i.matches("permissionDenied"),u=Zre(),m=()=>{s({type:"RETRY_CAMERA_CHECK"})},{cameraMinSpecificationsHeadingText:f,cameraMinSpecificationsMessageText:d,cameraNotFoundHeadingText:h,cameraNotFoundMessageText:y,retryCameraPermissionsText:g}=r,{cancelLivenessCheckText:b}=o;return oa.useLayoutEffect(()=>{if(u){let w=C=>{C&&s({type:"MOBILE_LANDSCAPE_WARNING"})},I=W2();return w(I.matches),I.addEventListener("change",C=>{w(C.matches)}),()=>{I.removeEventListener("change",C=>w(C.matches))}}},[u,s]),oa.createElement(rt,{direction:"column",position:"relative",testId:poe,className:poe,gap:"xl"},(()=>{if(c===Wt.MOBILE_LANDSCAPE_ERROR){let w={...$g,...n},{landscapeHeaderText:I,portraitMessageText:C,landscapeMessageText:R,tryAgainText:P}=w;return oa.createElement(rt,{backgroundColor:"background.primary",direction:"column",textAlign:"center",alignItems:"center",justifyContent:"center",position:"absolute",width:"100%"},oa.createElement(coe,{header:I,portraitMessage:C,landscapeMessage:R,tryAgainText:P,onRetry:()=>{s({type:"CANCEL"})}}))}else return p?oa.createElement(rt,{backgroundColor:"background.primary",direction:"column",textAlign:"center",alignItems:"center",justifyContent:"center",width:"100%",height:480},oa.createElement(Qr,{fontSize:"large",fontWeight:"bold"},c===Wt.CAMERA_FRAMERATE_ERROR?f:h),oa.createElement(Qr,{maxWidth:OCe},c===Wt.CAMERA_FRAMERATE_ERROR?d:y),oa.createElement(In,{variation:"primary",type:"button",onClick:m},g),oa.createElement(Ue,{position:"absolute",top:"medium",right:"medium"},oa.createElement(H2,{ariaLabel:b}))):oa.createElement(loe,{isMobileScreen:u,isRecordingStopped:l,instructionDisplayText:e,streamDisplayText:o,hintDisplayText:t,errorDisplayText:n,cameraDisplayText:r,components:a})})())};function zCe(e){let t=(r,o)=>e[r]&&e[r]!==hx[r]?e[r]:e[o]&&e[o]!==hx[r]?e[o]:hx[r];return{photosensitivityWarningBodyText:t("photosensitivityWarningBodyText","photosensitivyWarningBodyText"),photosensitivityWarningHeadingText:t("photosensitivityWarningHeadingText","photosensitivyWarningHeadingText"),photosensitivityWarningInfoText:t("photosensitivityWarningInfoText","photosensitivyWarningInfoText"),photosensitivityWarningLabelText:t("photosensitivityWarningLabelText","photosensitivyWarningLabelText")}}function moe(e){let t=zCe(e??{}),r={...hx,...e,...t},{a11yVideoLabelText:o,cameraMinSpecificationsHeadingText:n,cameraMinSpecificationsMessageText:a,cameraNotFoundHeadingText:i,cameraNotFoundMessageText:s,cancelLivenessCheckText:c,connectionTimeoutHeaderText:l,connectionTimeoutMessageText:p,clientHeaderText:u,clientMessageText:m,errorLabelText:f,hintCanNotIdentifyText:d,hintCenterFaceText:h,hintCenterFaceInstructionText:y,hintFaceOffCenterText:g,hintConnectingText:b,hintFaceDetectedText:x,hintHoldFaceForFreshnessText:w,hintIlluminationNormalText:I,hintIlluminationTooBrightText:C,hintIlluminationTooDarkText:R,hintMoveFaceFrontOfCameraText:P,hintTooManyFacesText:z,hintTooCloseText:$,hintTooFarText:B,hintVerifyingText:V,hintCheckCompleteText:H,hintMatchIndicatorText:G,faceDistanceHeaderText:X,faceDistanceMessageText:ee,goodFitCaptionText:Z,goodFitAltText:te,landscapeHeaderText:re,landscapeMessageText:se,multipleFacesHeaderText:ae,multipleFacesMessageText:pe,photosensitivityWarningBodyText:ie,photosensitivityWarningHeadingText:Y,photosensitivityWarningInfoText:le,photosensitivityWarningLabelText:ge,photosensitivyWarningBodyText:ve,photosensitivyWarningHeadingText:Ee,photosensitivyWarningInfoText:Se,photosensitivyWarningLabelText:Ve,portraitMessageText:Ge,retryCameraPermissionsText:Ye,recordingIndicatorText:Ze,serverHeaderText:Je,serverMessageText:yt,startScreenBeginCheckText:lt,timeoutHeaderText:Nt,timeoutMessageText:St,tooFarCaptionText:zt,tooFarAltText:Lt,tryAgainText:Kr,waitingCameraPermissionText:tr}=r;return{hintDisplayText:{hintMoveFaceFrontOfCameraText:P,hintTooManyFacesText:z,hintFaceDetectedText:x,hintCanNotIdentifyText:d,hintTooCloseText:$,hintTooFarText:B,hintConnectingText:b,hintVerifyingText:V,hintCheckCompleteText:H,hintIlluminationTooBrightText:C,hintIlluminationTooDarkText:R,hintIlluminationNormalText:I,hintHoldFaceForFreshnessText:w,hintCenterFaceText:h,hintCenterFaceInstructionText:y,hintFaceOffCenterText:g,hintMatchIndicatorText:G},cameraDisplayText:{cameraMinSpecificationsHeadingText:n,cameraMinSpecificationsMessageText:a,cameraNotFoundHeadingText:i,cameraNotFoundMessageText:s,retryCameraPermissionsText:Ye,waitingCameraPermissionText:tr,a11yVideoLabelText:o},instructionDisplayText:{photosensitivityWarningBodyText:ie,photosensitivityWarningHeadingText:Y,photosensitivityWarningInfoText:le,photosensitivityWarningLabelText:ge,photosensitivyWarningBodyText:ve,photosensitivyWarningHeadingText:Ee,photosensitivyWarningInfoText:Se,photosensitivyWarningLabelText:Ve,goodFitCaptionText:Z,goodFitAltText:te,tooFarCaptionText:zt,tooFarAltText:Lt,startScreenBeginCheckText:lt},streamDisplayText:{cancelLivenessCheckText:c,recordingIndicatorText:Ze},errorDisplayText:{connectionTimeoutHeaderText:l,connectionTimeoutMessageText:p,errorLabelText:f,timeoutHeaderText:Nt,timeoutMessageText:St,faceDistanceHeaderText:X,faceDistanceMessageText:ee,multipleFacesHeaderText:ae,multipleFacesMessageText:pe,clientHeaderText:u,clientMessageText:m,serverHeaderText:Je,serverMessageText:yt,landscapeHeaderText:re,landscapeMessageText:se,portraitMessageText:Ge,tryAgainText:Kr}}}var foe="liveness-detector";function GD(e){let{components:t,config:r,displayText:o}=e,n=af.useRef(null),{hintDisplayText:a,cameraDisplayText:i,instructionDisplayText:s,streamDisplayText:c,errorDisplayText:l}=moe(o),p=OC(Vre,{devTools:!1,context:{componentProps:{...e,config:r??{}}}});return af.createElement(Ue,{className:foe,testId:foe},af.createElement(Gre,{componentProps:e,service:p},af.createElement(rt,{direction:"column",ref:n},af.createElement(uoe,{instructionDisplayText:s,hintDisplayText:a,cameraDisplayText:i,streamDisplayText:c,errorDisplayText:l,components:t}))))}var V2=Ie(y1());function hoe(e){let t=(0,doe.createRoot)(e.container),r=async()=>({accessKeyId:e.credentials.accessKeyId,secretAccessKey:e.credentials.secretAccessKey,sessionToken:e.credentials.sessionToken,expiration:new Date(e.credentials.expiration)}),o=()=>(0,V2.jsx)(e3,{children:(0,V2.jsx)(GD,{sessionId:e.sessionId,region:e.region,config:{credentialProvider:r},onAnalysisComplete:async()=>{await e.onAnalysisComplete()},onUserCancel:e.onCancel,onError:n=>{let a=n?.error instanceof Error?n.error:new Error(String(n?.state??"Liveness error"));e.onError?.(a)}})});return t.render((0,V2.jsx)(o,{})),{unmount:()=>{try{t.unmount()}catch{}}}}typeof window<"u"&&!window.__NeoCashLiveness&&(window.__NeoCashLiveness={mount:hoe});return tne($Ce);})();